Change on onlp get psu info for d7032q28b/d7054q28b

This commit is contained in:
robertyu
2018-12-06 15:43:40 -08:00
parent 2044ee9d30
commit a0e2eca3ba
19 changed files with 334 additions and 208 deletions

View File

@@ -1,4 +1,3 @@
#obj-m += gpio-ich.o
obj-m += inv_platform.o
obj-m += inv_cpld.o
obj-m += inv_psoc.o

View File

@@ -1733,14 +1733,6 @@ common_get_eeprom(struct transvr_obj_s *self, char *buf){
int err = DEBUG_TRANSVR_INT_VAL;
if (self->state == STATE_TRANSVR_CONNECTED &&
self->mode == TRANSVR_MODE_POLLING &&
TRANSVR_INFO_CACHE_ENABLE) {
memset(buf, 0, self->eeprom_map_p->length_eeprom+1);
memcpy(buf, self->eeprom, self->eeprom_map_p->length_eeprom);
*(buf+self->eeprom_map_p->length_eeprom) = '\n';
return self->eeprom_map_p->length_eeprom+1;
}
err = _check_by_mode(self, &_common_update_attr_eeprom,
"common_get_eeprom");
if (err < 0){

View File

@@ -23,21 +23,7 @@
#define PROJECT_NAME
#define LEN_FILE_NAME 80
enum fan_id {
FAN_RESERVED,
FAN_1_ON_MAIN_BOARD,
FAN_2_ON_MAIN_BOARD,
FAN_3_ON_MAIN_BOARD,
FAN_4_ON_MAIN_BOARD,
FAN_5_ON_MAIN_BOARD,
FAN_6_ON_MAIN_BOARD,
FAN_7_ON_MAIN_BOARD,
FAN_8_ON_MAIN_BOARD,
FAN_1_ON_PSU1,
FAN_1_ON_PSU2,
};
static char* devfiles__[CHASSIS_FAN_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[FAN_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_PSOC_PREFIX"/fan1_input",
@@ -73,7 +59,7 @@ static char* devfiles__[CHASSIS_FAN_COUNT+1] = /* must map with onlp_thermal_id
}
/* Static fan information */
onlp_fan_info_t linfo[] = {
onlp_fan_info_t linfo[FAN_MAX] = {
{ }, /* Not used */
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1),
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2),
@@ -163,7 +149,7 @@ _onlp_get_fan_direction_on_psu(void)
static int
_onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
{
int value, ret;
int value, ret, index;
char vstr[32], *vstrp = vstr, **vp = &vstrp;
info->status |= ONLP_FAN_STATUS_PRESENT;
@@ -172,6 +158,13 @@ _onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
/* get fan direction */
info->status |= _onlp_get_fan_direction_on_psu();
if (info->status & ONLP_FAN_STATUS_FAILED) {
return ONLP_STATUS_OK;
}
index = ONLP_OID_ID_GET(info->hdr.id);
info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
/* get front fan speed */
memset(vstr, 0, 32);
ret = onlp_file_read_str(vp, devfiles__[fid]);
@@ -182,6 +175,10 @@ _onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
info->rpm = value;
info->percentage = (info->rpm * 100) / MAX_PSU_FAN_SPEED;
info->status |= (value == 0) ? ONLP_FAN_STATUS_FAILED : 0;
snprintf(info->model, ONLP_CONFIG_INFO_STR_MAX, "NA");
snprintf(info->serial, ONLP_CONFIG_INFO_STR_MAX, "NA");
return ONLP_STATUS_OK;
}
@@ -255,9 +252,9 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
switch (fid)
{
case FAN_1_ON_PSU1:
return psu_pmbus_info_set(PSU1_ID, "rpm_psu", p);
return psu_pmbus_info_set(PSU1_ID, "rpm_psu1", p);
case FAN_1_ON_PSU2:
return psu_pmbus_info_set(PSU2_ID, "rpm_psu", p);
return psu_pmbus_info_set(PSU2_ID, "rpm_psu2", p);
case FAN_1_ON_MAIN_BOARD:
case FAN_2_ON_MAIN_BOARD:
case FAN_3_ON_MAIN_BOARD:

View File

@@ -25,18 +25,7 @@
} \
} while(0)
/* LED related data */
enum onlp_led_id
{
LED_RESERVED = 0,
LED_SYS,
LED_FAN1,
LED_FAN2,
LED_FAN3,
LED_FAN4
};
static char* devfiles__[CHASSIS_LED_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[LED_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_CPLD_PREFIX"/%s_led",
@@ -90,7 +79,7 @@ static char last_path[][10] = /* must map with onlp_led_id */
/*
* Get the information for the given LED OID.
*/
static onlp_led_info_t linfo[] =
static onlp_led_info_t linfo[LED_MAX] =
{
{ }, /* Not used */
{

View File

@@ -14,18 +14,14 @@
#define ONLP_NODE_MAX_INT_LEN (8)
#define ONLP_NODE_MAX_PATH_LEN (64)
#define CHASSIS_PSU_COUNT (2)
#define CHASSIS_LED_COUNT (5)
#define CHASSIS_FAN_COUNT (10)
#define CHASSIS_SFP_COUNT (32)
#define CHASSIS_THERMAL_COUNT (11)
#define INV_CPLD_COUNT (1)
#define INV_CPLD_PREFIX "/sys/bus/i2c/devices/0-0055/"
#define INV_PSOC_PREFIX "/sys/bus/i2c/devices/0-0066/"
#define INV_EPRM_PREFIX "/sys/bus/i2c/devices/0-0053/"
#define INV_CTMP_PREFIX "/sys/devices/platform/coretemp.0/hwmon/hwmon0/"
#define CHASSIS_SFP_COUNT (32)
/*
* Definitions of Chassis EEPROM
*/
@@ -34,12 +30,60 @@
/*
* Definitions of PSU device
*/
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE_FIRST,
THERMAL_CPU_CORE_3,
THERMAL_CPU_CORE_4,
THERMAL_CPU_CORE_LAST,
THERMAL_1_ON_MAIN_BROAD,
THERMAL_2_ON_MAIN_BROAD,
THERMAL_3_ON_MAIN_BROAD,
THERMAL_4_ON_MAIN_BROAD,
THERMAL_5_ON_MAIN_BROAD,
THERMAL_1_ON_PSU1,
THERMAL_1_ON_PSU2,
THERMAL_MAX
};
#define CHASSIS_THERMAL_COUNT (9)
enum fan_id {
FAN_RESERVED = 0,
FAN_1_ON_MAIN_BOARD,
FAN_2_ON_MAIN_BOARD,
FAN_3_ON_MAIN_BOARD,
FAN_4_ON_MAIN_BOARD,
FAN_5_ON_MAIN_BOARD,
FAN_6_ON_MAIN_BOARD,
FAN_7_ON_MAIN_BOARD,
FAN_8_ON_MAIN_BOARD,
FAN_1_ON_PSU1,
FAN_1_ON_PSU2,
FAN_MAX
};
#define CHASSIS_FAN_COUNT (8)
enum onlp_led_id
{
LED_RESERVED = 0,
LED_SYS,
LED_FAN1,
LED_FAN2,
LED_FAN3,
LED_FAN4,
LED_MAX
};
#define CHASSIS_LED_COUNT (1)
enum onlp_psu_id
{
PSU_RESERVED = 0,
PSU1_ID,
PSU2_ID
PSU2_ID,
PSU_MAX
};
#define CHASSIS_PSU_COUNT (2)
#define PSU1_AC_PMBUS_PREFIX INV_PSOC_PREFIX
#define PSU2_AC_PMBUS_PREFIX INV_PSOC_PREFIX

View File

@@ -27,14 +27,21 @@
} \
} while(0)
static char* status_devfiles__[CHASSIS_PSU_COUNT+1] = /* must map with onlp_psu_id */
static char* status_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */
{
"reserved",
INV_CPLD_PREFIX"/psu0",
INV_CPLD_PREFIX"/psu1",
};
static char* module_devfiles__[CHASSIS_PSU_COUNT+1] = /* must map with onlp_psu_id */
static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */
{
"reserved",
INV_PSOC_PREFIX"/psu1_%s",
INV_PSOC_PREFIX"/psu2_%s",
};
static char* module2_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */
{
"reserved",
INV_PSOC_PREFIX"/psoc_psu1_%s",
@@ -83,69 +90,97 @@ psu_module_info_get(int id, onlp_psu_info_t* info)
{
int ret = 0;
char node_path[ONLP_NODE_MAX_PATH_LEN] = {0};
char vstr[32], *vstrp = vstr, **vp = &vstrp;
int value = 0;
info->caps |= ONLP_PSU_CAPS_DC12;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "vout");
sprintf(node_path, module2_devfiles__[id], "vout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
AIM_LOG_ERROR("Unable to read vout from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
}
info->mvout = value;
info->caps |= ONLP_PSU_CAPS_VOUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "iout");
sprintf(node_path, module2_devfiles__[id], "iout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read iout from file(%s)\r\n", node_path);
}
else {
info->miout = value;
info->caps |= ONLP_PSU_CAPS_IOUT;
}
info->miout = value;
info->caps |= ONLP_PSU_CAPS_IOUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "pout");
sprintf(node_path, module2_devfiles__[id], "pout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read pout from file(%s)\r\n", node_path);
}
else {
info->mpout = value;
info->caps |= ONLP_PSU_CAPS_POUT;
}
info->mpout = value;
info->caps |= ONLP_PSU_CAPS_POUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "vin");
sprintf(node_path, module2_devfiles__[id], "vin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read vin from file(%s)\r\n", node_path);
}
else {
info->mvin = value;
info->caps |= ONLP_PSU_CAPS_VIN;
}
info->mvin = value;
info->caps |= ONLP_PSU_CAPS_VIN;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "iin");
sprintf(node_path, module2_devfiles__[id], "iin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read iin from file(%s)\r\n", node_path);
}
else {
info->miin = value;
info->caps |= ONLP_PSU_CAPS_IIN;
}
info->miin = value;
info->caps |= ONLP_PSU_CAPS_IIN;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "pin");
sprintf(node_path, module2_devfiles__[id], "pin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read pin from file(%s)\r\n", node_path);
}
else {
info->mpin = value;
info->caps |= ONLP_PSU_CAPS_PIN;
}
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "model");
ret = onlp_file_read_str(vp, node_path);
if (ret > 0) {
strncpy(info->model, *vp, ret-1);
}
else {
AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path);
strncpy(info->model, "N/A", 3);
}
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "sn");
ret = onlp_file_read_str(vp, node_path);
if (ret > 0) {
strncpy(info->serial, *vp, ret-1);
}
else {
AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path);
strncpy(info->serial, "N/A", 3);
}
info->mpin = value;
info->caps |= ONLP_PSU_CAPS_PIN;
return ONLP_STATUS_OK;
}
@@ -157,10 +192,22 @@ static onlp_psu_info_t pinfo[] =
{
{ }, /* Not used */
{
{ ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
{
ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0,
{
ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1),
ONLP_FAN_ID_CREATE(FAN_1_ON_PSU1)
}
},
},
{
{ ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
{
ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0,
{
ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2),
ONLP_FAN_ID_CREATE(FAN_1_ON_PSU2)
}
},
}
};
@@ -178,7 +225,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
/* Get the present state */
if ((ret = psu_status_info_get(index, "psu", &val)) == ONLP_STATUS_E_INTERNAL) {
printf("Unable to read PSU(%d) node(psu_present)\r\n", index);
printf("Unable to read PSU(%d) node(psu)\r\n", index);
return ret;
}

View File

@@ -140,6 +140,17 @@ onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
#if 1
int bus = FRONT_PORT_TO_MUX_INDEX(port);
memset(data, 0, 256);
/* Read eeprom information into data[] */
if (onlp_i2c_read(bus, 0x50, 0x00, 256, data, 0) != 0)
{
AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
return ONLP_STATUS_E_INTERNAL;
}
#else
char* path;
int len = 0;
/*
@@ -154,6 +165,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256])
AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
return ONLP_STATUS_E_INTERNAL;
}
#endif
return ONLP_STATUS_OK;
}

View File

@@ -22,23 +22,7 @@
} \
} while(0)
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE_FIRST,
THERMAL_CPU_CORE_3,
THERMAL_CPU_CORE_4,
THERMAL_CPU_CORE_LAST,
THERMAL_1_ON_MAIN_BROAD,
THERMAL_2_ON_MAIN_BROAD,
THERMAL_3_ON_MAIN_BROAD,
THERMAL_4_ON_MAIN_BROAD,
THERMAL_5_ON_MAIN_BROAD,
THERMAL_1_ON_PSU1,
THERMAL_1_ON_PSU2,
};
static char* devfiles__[CHASSIS_THERMAL_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[THERMAL_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_CTMP_PREFIX"/temp2_%s",
@@ -55,7 +39,7 @@ static char* devfiles__[CHASSIS_THERMAL_COUNT+1] = /* must map with onlp_therma
};
/* Static values */
static onlp_thermal_info_t linfo[CHASSIS_THERMAL_COUNT+1] = {
static onlp_thermal_info_t linfo[THERMAL_MAX] = {
{ }, /* Not used */
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_FIRST), "CPU Core 0", 0},
ONLP_THERMAL_STATUS_PRESENT,

View File

@@ -5,7 +5,7 @@ class OnlPlatform_x86_64_inventec_d7032q28b_r0(OnlPlatformInventec,
OnlPlatformPortConfig_32x100):
PLATFORM='x86-64-inventec-d7032q28b-r0'
MODEL="X86-D7032Q28B"
SYS_OBJECT_ID="7032.28"
SYS_OBJECT_ID=".7032.1"
def baseconfig(self):
os.system("insmod /lib/modules/`uname -r`/kernel/drivers/gpio/gpio-ich.ko gpiobase=0")

View File

@@ -1,4 +1,3 @@
#obj-m += gpio-ich.o
obj-m += inv_platform.o
obj-m += inv_cpld.o
obj-m += inv_psoc.o

View File

@@ -1731,14 +1731,6 @@ common_get_eeprom(struct transvr_obj_s *self, char *buf){
int err = DEBUG_TRANSVR_INT_VAL;
if (self->state == STATE_TRANSVR_CONNECTED &&
self->mode == TRANSVR_MODE_POLLING &&
TRANSVR_INFO_CACHE_ENABLE) {
memset(buf, 0, self->eeprom_map_p->length_eeprom+1);
memcpy(buf, self->eeprom, self->eeprom_map_p->length_eeprom);
*(buf+self->eeprom_map_p->length_eeprom) = '\n';
return self->eeprom_map_p->length_eeprom+1;
}
err = _check_by_mode(self, &_common_update_attr_eeprom,
"common_get_eeprom");
if (err < 0){

View File

@@ -23,21 +23,7 @@
#define PROJECT_NAME
#define LEN_FILE_NAME 80
enum fan_id {
FAN_RESERVED,
FAN_1_ON_MAIN_BOARD,
FAN_2_ON_MAIN_BOARD,
FAN_3_ON_MAIN_BOARD,
FAN_4_ON_MAIN_BOARD,
FAN_5_ON_MAIN_BOARD,
FAN_6_ON_MAIN_BOARD,
FAN_7_ON_MAIN_BOARD,
FAN_8_ON_MAIN_BOARD,
FAN_1_ON_PSU1,
FAN_1_ON_PSU2,
};
static char* devfiles__[CHASSIS_FAN_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[FAN_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_PSOC_PREFIX"/fan1_input",
@@ -73,7 +59,7 @@ static char* devfiles__[CHASSIS_FAN_COUNT+1] = /* must map with onlp_thermal_id
}
/* Static fan information */
onlp_fan_info_t linfo[] = {
onlp_fan_info_t linfo[FAN_MAX] = {
{ }, /* Not used */
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1),
MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2),
@@ -163,7 +149,7 @@ _onlp_get_fan_direction_on_psu(void)
static int
_onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
{
int value, ret;
int value, ret, index;
char vstr[32], *vstrp = vstr, **vp = &vstrp;
info->status |= ONLP_FAN_STATUS_PRESENT;
@@ -172,6 +158,12 @@ _onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
/* get fan direction */
info->status |= _onlp_get_fan_direction_on_psu();
if (info->status & ONLP_FAN_STATUS_FAILED) {
return ONLP_STATUS_OK;
}
index = ONLP_OID_ID_GET(info->hdr.id);
info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
/* get front fan speed */
memset(vstr, 0, 32);
ret = onlp_file_read_str(vp, devfiles__[fid]);
@@ -189,7 +181,6 @@ _onlp_fani_info_get_fan_on_psu(int fid, onlp_fan_info_t* info)
return ONLP_STATUS_OK;
}
/*
* This function will be called prior to all of onlp_fani_* functions.
*/
@@ -208,7 +199,6 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
local_id = ONLP_OID_ID_GET(id);
*info = linfo[local_id];
switch (local_id)
{
case FAN_1_ON_PSU1:
@@ -259,9 +249,9 @@ onlp_fani_percentage_set(onlp_oid_t id, int p)
switch (fid)
{
case FAN_1_ON_PSU1:
return psu_pmbus_info_set(PSU1_ID, "rpm_psu", p);
return psu_pmbus_info_set(PSU1_ID, "rpm_psu1", p);
case FAN_1_ON_PSU2:
return psu_pmbus_info_set(PSU2_ID, "rpm_psu", p);
return psu_pmbus_info_set(PSU2_ID, "rpm_psu2", p);
case FAN_1_ON_MAIN_BOARD:
case FAN_2_ON_MAIN_BOARD:
case FAN_3_ON_MAIN_BOARD:

View File

@@ -25,18 +25,7 @@
} \
} while(0)
/* LED related data */
enum onlp_led_id
{
LED_RESERVED = 0,
LED_SYS,
LED_FAN1,
LED_FAN2,
LED_FAN3,
LED_FAN4
};
static char* devfiles__[CHASSIS_LED_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[LED_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_CPLD_PREFIX"/%s_led",
@@ -90,7 +79,7 @@ static char last_path[][10] = /* must map with onlp_led_id */
/*
* Get the information for the given LED OID.
*/
static onlp_led_info_t linfo[] =
static onlp_led_info_t linfo[LED_MAX] =
{
{ }, /* Not used */
{

View File

@@ -45,8 +45,8 @@ int onlp_file_read_string(char *filename, char *buffer, int buf_size, int data_l
return ret;
}
#define I2C_PSU_MODEL_NAME_LEN 11
#define I2C_PSU_FAN_DIR_LEN 3
#define I2C_PSU_MODEL_NAME_LEN 32
#define I2C_PSU_FAN_DIR_LEN 8
#include <ctype.h>
psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
{
@@ -62,7 +62,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
}
if(isspace(model_name[strlen(model_name)-1])) {
model_name[strlen(model_name)-1] = 0;
model_name[strlen(model_name)] = 0;
}
if (strncmp(model_name, "YM-2651Y", 8) == 0) {
@@ -126,6 +126,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
}
}
if (strncmp(model_name, "DPS-150AB-10", 12) == 0) {
if (modelname) {
strncpy(modelname, model_name, 12);
}
return PSU_TYPE_DC_12V_F2B;
}
return PSU_TYPE_UNKNOWN;
}

View File

@@ -16,18 +16,14 @@
#define ONLP_NODE_MAX_INT_LEN (8)
#define ONLP_NODE_MAX_PATH_LEN (64)
#define CHASSIS_PSU_COUNT (2)
#define CHASSIS_LED_COUNT (5)
#define CHASSIS_FAN_COUNT (10)
#define CHASSIS_SFP_COUNT (54)
#define CHASSIS_THERMAL_COUNT (14)
#define INV_CPLD_COUNT (1)
#define INV_CPLD_PREFIX "/sys/bus/i2c/devices/0-0055/"
#define INV_PSOC_PREFIX "/sys/bus/i2c/devices/0-0066/"
#define INV_EPRM_PREFIX "/sys/bus/i2c/devices/0-0053/"
#define INV_CTMP_PREFIX "/sys/devices/platform/coretemp.0/hwmon/hwmon0/"
#define CHASSIS_SFP_COUNT (54)
/*
* Definitions of Chassis EEPROM
*/
@@ -35,14 +31,66 @@
/*
* Definitions of PSU device
* Definitions of D7054Q28B device
*/
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE_FIRST,
THERMAL_CPU_CORE_2,
THERMAL_CPU_CORE_3,
THERMAL_CPU_CORE_4,
THERMAL_CPU_CORE_LAST,
THERMAL_1_ON_MAIN_BROAD,
THERMAL_2_ON_MAIN_BROAD,
THERMAL_3_ON_MAIN_BROAD,
THERMAL_4_ON_MAIN_BROAD,
THERMAL_5_ON_MAIN_BROAD,
THERMAL_1_ON_PSU1,
THERMAL_2_ON_PSU1,
THERMAL_1_ON_PSU2,
THERMAL_2_ON_PSU2,
THERMAL_MAX
};
#define CHASSIS_THERMAL_COUNT (10)
enum onlp_fan_id {
FAN_RESERVED = 0,
FAN_1_ON_MAIN_BOARD,
FAN_2_ON_MAIN_BOARD,
FAN_3_ON_MAIN_BOARD,
FAN_4_ON_MAIN_BOARD,
FAN_5_ON_MAIN_BOARD,
FAN_6_ON_MAIN_BOARD,
FAN_7_ON_MAIN_BOARD,
FAN_8_ON_MAIN_BOARD,
FAN_1_ON_PSU1,
FAN_1_ON_PSU2,
FAN_MAX
};
#define CHASSIS_FAN_COUNT (8)
enum onlp_led_id
{
LED_RESERVED = 0,
LED_SYS,
LED_FAN1,
LED_FAN2,
LED_FAN3,
LED_FAN4,
LED_MAX
};
#define CHASSIS_LED_COUNT (1)
enum onlp_psu_id
{
PSU_RESERVED = 0,
PSU1_ID,
PSU2_ID
PSU2_ID,
PSU_MAX
};
#define CHASSIS_PSU_COUNT (2)
#define PSU1_AC_PMBUS_PREFIX INV_PSOC_PREFIX
#define PSU2_AC_PMBUS_PREFIX INV_PSOC_PREFIX

View File

@@ -27,14 +27,14 @@
} \
} while(0)
static char* status_devfiles__[CHASSIS_PSU_COUNT+1] = /* must map with onlp_psu_id */
static char* status_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */
{
"reserved",
INV_CPLD_PREFIX"/psu0",
INV_CPLD_PREFIX"/psu1",
};
static char* module_devfiles__[CHASSIS_PSU_COUNT+1] = /* must map with onlp_psu_id */
static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */
{
"reserved",
INV_PSOC_PREFIX"/psoc_psu1_%s",
@@ -83,6 +83,7 @@ psu_module_info_get(int id, onlp_psu_info_t* info)
{
int ret = 0;
char node_path[ONLP_NODE_MAX_PATH_LEN] = {0};
char vstr[32], *vstrp = vstr, **vp = &vstrp;
int value = 0;
info->caps |= ONLP_PSU_CAPS_DC12;
@@ -91,61 +92,89 @@ psu_module_info_get(int id, onlp_psu_info_t* info)
sprintf(node_path, module_devfiles__[id], "vout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read vout from file(%s)\r\n", node_path);
}
else {
info->mvout = value;
info->caps |= ONLP_PSU_CAPS_VOUT;
}
info->mvout = value;
info->caps |= ONLP_PSU_CAPS_VOUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "iout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read iout from file(%s)\r\n", node_path);
}
else {
info->miout = value;
info->caps |= ONLP_PSU_CAPS_IOUT;
}
info->miout = value;
info->caps |= ONLP_PSU_CAPS_IOUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "pout");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read pout from file(%s)\r\n", node_path);
}
else {
info->mpout = value;
info->caps |= ONLP_PSU_CAPS_POUT;
}
info->mpout = value;
info->caps |= ONLP_PSU_CAPS_POUT;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "vin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read vin from file(%s)\r\n", node_path);
}
else {
info->mvin = value;
info->caps |= ONLP_PSU_CAPS_VIN;
}
info->mvin = value;
info->caps |= ONLP_PSU_CAPS_VIN;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "iin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read iin from file(%s)\r\n", node_path);
}
else {
info->miin = value;
info->caps |= ONLP_PSU_CAPS_IIN;
}
info->miin = value;
info->caps |= ONLP_PSU_CAPS_IIN;
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "pin");
ret = onlp_file_read_int(&value, node_path);
if (ret < 0) {
AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", node_path);
return ONLP_STATUS_E_INTERNAL;
AIM_LOG_ERROR("Unable to read pin from file(%s)\r\n", node_path);
}
else {
info->mpin = value;
info->caps |= ONLP_PSU_CAPS_PIN;
}
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "model");
ret = onlp_file_read_str(vp, node_path);
if (ret > 0) {
strncpy(info->model, *vp, ret-1);
}
else {
//AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path);
strncpy(info->model, "N/A", 3);
}
memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN);
sprintf(node_path, module_devfiles__[id], "serial");
ret = onlp_file_read_str(vp, node_path);
if (ret > 0) {
strncpy(info->serial, *vp, ret-1);
}
else {
AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path);
strncpy(info->serial, "N/A", 3);
}
info->mpin = value;
info->caps |= ONLP_PSU_CAPS_PIN;
return ONLP_STATUS_OK;
}
@@ -157,10 +186,24 @@ static onlp_psu_info_t pinfo[] =
{
{ }, /* Not used */
{
{ ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
{
ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0,
{
ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1),
ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_PSU1),
ONLP_FAN_ID_CREATE(FAN_1_ON_PSU1)
}
},
},
{
{ ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
{
ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0,
{
ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2),
ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_PSU2),
ONLP_FAN_ID_CREATE(FAN_1_ON_PSU2)
}
},
}
};
@@ -178,7 +221,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
/* Get the present state */
if ((ret = psu_status_info_get(index, "psu", &val)) == ONLP_STATUS_E_INTERNAL) {
printf("Unable to read PSU(%d) node(psu_present)\r\n", index);
printf("Unable to read PSU(%d) node(psu)\r\n", index);
return ret;
}

View File

@@ -170,6 +170,17 @@ onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
#if 1
int bus = FRONT_PORT_TO_MUX_INDEX(port);
memset(data, 0, 256);
/* Read eeprom information into data[] */
if (onlp_i2c_read(bus, 0x50, 0x00, 256, data, 0) != 0)
{
AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
return ONLP_STATUS_E_INTERNAL;
}
#else
char* path;
int len = 0;
/*
@@ -184,6 +195,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256])
AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
return ONLP_STATUS_E_INTERNAL;
}
#endif
return ONLP_STATUS_OK;
}

View File

@@ -22,26 +22,7 @@
} \
} while(0)
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE_FIRST,
THERMAL_CPU_CORE_2,
THERMAL_CPU_CORE_3,
THERMAL_CPU_CORE_4,
THERMAL_CPU_CORE_LAST,
THERMAL_1_ON_MAIN_BROAD,
THERMAL_2_ON_MAIN_BROAD,
THERMAL_3_ON_MAIN_BROAD,
THERMAL_4_ON_MAIN_BROAD,
THERMAL_5_ON_MAIN_BROAD,
THERMAL_1_ON_PSU1,
THERMAL_1_ON_PSU2,
THERMAL_2_ON_PSU1,
THERMAL_2_ON_PSU2,
};
static char* devfiles__[CHASSIS_THERMAL_COUNT+1] = /* must map with onlp_thermal_id */
static char* devfiles__[THERMAL_MAX] = /* must map with onlp_thermal_id */
{
"reserved",
INV_CTMP_PREFIX"/temp1_%s",
@@ -55,13 +36,13 @@ static char* devfiles__[CHASSIS_THERMAL_COUNT+1] = /* must map with onlp_therma
INV_PSOC_PREFIX"/temp4_input",
INV_PSOC_PREFIX"/temp5_input",
INV_PSOC_PREFIX"/thermal_psu1",
INV_PSOC_PREFIX"/thermal_psu2",
INV_PSOC_PREFIX"/thermal2_psu1",
INV_PSOC_PREFIX"/thermal_psu2",
INV_PSOC_PREFIX"/thermal2_psu2",
};
/* Static values */
static onlp_thermal_info_t linfo[CHASSIS_THERMAL_COUNT+1] = {
static onlp_thermal_info_t linfo[THERMAL_MAX] = {
{ }, /* Not used */
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_FIRST), "Physical id 0", 0},
ONLP_THERMAL_STATUS_PRESENT,
@@ -107,11 +88,11 @@ static onlp_thermal_info_t linfo[CHASSIS_THERMAL_COUNT+1] = {
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_PSU1), "PSU-1 Thermal Sensor 2", ONLP_PSU_ID_CREATE(PSU1_ID)},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_PSU1), "PSU-1 Thermal Sensor 2", ONLP_PSU_ID_CREATE(PSU1_ID)},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},

View File

@@ -5,7 +5,7 @@ class OnlPlatform_x86_64_inventec_d7054q28b_r0(OnlPlatformInventec,
OnlPlatformPortConfig_48x25_6x100):
PLATFORM='x86-64-inventec-d7054q28b-r0'
MODEL="X86-D7054Q28B"
SYS_OBJECT_ID="7054.28"
SYS_OBJECT_ID=".7054.1"
def baseconfig(self):
os.system("insmod /lib/modules/`uname -r`/kernel/drivers/gpio/gpio-ich.ko")
@@ -16,5 +16,5 @@ class OnlPlatform_x86_64_inventec_d7054q28b_r0(OnlPlatformInventec,
self.insmod('inv_eeprom')
self.insmod('swps')
self.insmod('vpd')
self.insmod('inv_pthread')
# self.insmod('inv_pthread')
return True