update ingrasys platform driver with bmc module

This commit is contained in:
fengkm
2019-04-11 14:45:52 +08:00
parent dc8505cdac
commit c74516b838
15 changed files with 471 additions and 84 deletions

View File

@@ -2642,7 +2642,7 @@ CONFIG_SENSORS_LM77=y
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
CONFIG_SENSORS_LM90=y
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_LM95234 is not set
@@ -2697,7 +2697,8 @@ CONFIG_SENSORS_LM77=y
# CONFIG_SENSORS_W83791D is not set
# CONFIG_SENSORS_W83792D is not set
# CONFIG_SENSORS_W83793 is not set
# CONFIG_SENSORS_W83795 is not set
CONFIG_SENSORS_W83795=m
CONFIG_SENSORS_W83795_FANCTRL=y
# CONFIG_SENSORS_W83L785TS is not set
# CONFIG_SENSORS_W83L786NG is not set
# CONFIG_SENSORS_W83627HF is not set

View File

@@ -39,6 +39,7 @@
#define SYS_CORE_TEMP_PREFIX "/sys/class/hwmon/hwmon0/device/hwmon/hwmon0/"
#define SYS_FAN_PREFIX "/sys/class/hwmon/hwmon1/device/"
#define SYS_EEPROM_PATH "/sys/bus/i2c/devices/9-0054/eeprom"
#define SYS_EEPROM_SIZE 512
#define PSU1_EEPROM_PATH "/sys/bus/i2c/devices/8-0050/eeprom"
#define PSU2_EEPROM_PATH "/sys/bus/i2c/devices/9-0050/eeprom"
#define PSU_STATUS_PRESENT 1

View File

@@ -51,9 +51,9 @@ onlp_sysi_init(void)
int
onlp_sysi_onie_data_get(uint8_t** data, int* size)
{
uint8_t* rdata = aim_zmalloc(256);
if(onlp_file_read(rdata, 256, size, SYS_EEPROM_PATH) == ONLP_STATUS_OK) {
if(*size == 256) {
uint8_t* rdata = aim_zmalloc(SYS_EEPROM_SIZE);
if(onlp_file_read(rdata, SYS_EEPROM_SIZE, size, SYS_EEPROM_PATH) == ONLP_STATUS_OK) {
if(*size == SYS_EEPROM_SIZE) {
AIM_LOG_INFO("read success\n");
*data = rdata;
return ONLP_STATUS_OK;

View File

@@ -9,9 +9,12 @@ class OnlPlatform_x86_64_ingrasys_s9100_r0(OnlPlatformIngrasys):
def baseconfig(self):
os.system("modprobe i2c_ismt")
self.insmod("eeprom_mb")
os.system("modprobe w83795")
os.system("modprobe eeprom")
os.system("modprobe gpio_pca953x")
self.insmod("optoe")
########### initialize I2C bus 1 ###########
self.new_i2c_device('pca9548', 0x70, 1)

View File

@@ -117,6 +117,10 @@ int sys_fan_present_get(onlp_fan_info_t* info, int id)
{
int rv, fan_presence, i2c_bus, offset, fan_reg_mask;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
/* get fan presence*/
i2c_bus = I2C_BUS_59;
switch (id)
@@ -169,6 +173,10 @@ sys_fan_info_get(onlp_fan_info_t* info, int id)
fan_status = 0;
fan_rpm = 0;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
rv = sys_fan_present_get(info, id);
if (rv < 0) {
return ONLP_STATUS_E_INTERNAL;
@@ -225,6 +233,11 @@ int
sys_fan_rpm_percent_set(int perc)
{
int rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
rc = onlp_file_write_int(perc, SYS_FAN_PREFIX "pwm%d", FAN_CTRL_SET1);
if (rc < 0) {
@@ -257,6 +270,11 @@ int
onlp_fani_percentage_set(onlp_oid_t id, int percentage)
{
int fid, perc_val, rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
fid = ONLP_OID_ID_GET(id);
/*
@@ -298,6 +316,10 @@ int
onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* rv)
{
int fan_id ,rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
fan_id = ONLP_OID_ID_GET(id);
*rv = fan_info[fan_id];

View File

@@ -103,6 +103,10 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
int exist_offset, good_offset, i2c_bus;
onlp_fan_info_t fan_info;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
memset(&fan_info, 0, sizeof(onlp_fan_info_t));
led_id = ONLP_OID_ID_GET(id);
@@ -193,6 +197,10 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
{
int led_id, rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
led_id = ONLP_OID_ID_GET(id);
switch (led_id) {
case LED_SYSTEM_LED:

View File

@@ -46,6 +46,10 @@ psu_thermal_get(onlp_thermal_info_t* info, int thermal_id)
unsigned int temp = 0;
char result[32];
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if (thermal_id == THERMAL_ID_PSU1_1) {
i2c_bus = I2C_BUS_PSU1;
offset = PSU_THERMAL1_OFFSET;
@@ -120,6 +124,10 @@ psu_fan_info_get(onlp_fan_info_t* info, int id)
int pw_exist, pw_good, exist_offset, good_offset;
int i2c_bus, psu_mask, rc;
unsigned int tmp_fan_rpm, fan_rpm;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if (id == FAN_ID_PSU_FAN1) {
i2c_bus = I2C_BUS_PSU1;
@@ -177,6 +185,10 @@ psu_vout_get(onlp_psu_info_t* info, int i2c_bus)
char result[32];
double dvalue;
memset(result, 0, sizeof(result));
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
n_value = onlp_i2c_readb(i2c_bus, PSU_REG, PSU_VOUT_OFFSET1, ONLP_I2C_F_FORCE);
if (n_value < 0) {
@@ -217,6 +229,10 @@ psu_iout_get(onlp_psu_info_t* info, int i2c_bus)
char result[32];
memset(result, 0, sizeof(result));
double dvalue;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
value = onlp_i2c_readw(i2c_bus, PSU_REG, PSU_IOUT_OFFSET, ONLP_I2C_F_FORCE);
if (value < 0) {
@@ -256,6 +272,10 @@ psu_pout_get(onlp_psu_info_t* info, int i2c_bus)
char result[32];
memset(result, 0, sizeof(result));
double dvalue;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
value = onlp_i2c_readw(i2c_bus, PSU_REG, PSU_POUT_OFFSET, ONLP_I2C_F_FORCE);
if (value < 0) {
@@ -295,6 +315,10 @@ psu_pin_get(onlp_psu_info_t* info, int i2c_bus)
char result[32];
memset(result, 0, sizeof(result));
double dvalue;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
value = onlp_i2c_readw(i2c_bus, PSU_REG, PSU_PIN_OFFSET, ONLP_I2C_F_FORCE);
if (value < 0) {
@@ -332,6 +356,10 @@ psu_eeprom_get(onlp_psu_info_t* info, int id)
int data_len, i, rc;
memset(data, 0, sizeof(data));
memset(eeprom_path, 0, sizeof(eeprom_path));
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if (id == PSU_ID_PSU1) {
rc = onlp_file_read(data, sizeof(data), &data_len, PSU1_EEPROM_PATH);
@@ -382,6 +410,10 @@ psu_present_get(int *pw_exist, int exist_offset, int i2c_bus, int psu_mask)
{
int psu_pres;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
psu_pres = onlp_i2c_readb(i2c_bus, PSU_STATE_REG, 0x0,
ONLP_I2C_F_FORCE);
if (psu_pres < 0) {
@@ -396,6 +428,10 @@ int
psu_pwgood_get(int *pw_good, int good_offset, int i2c_bus, int psu_mask)
{
int psu_pwgood;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
psu_pwgood = onlp_i2c_readb(i2c_bus, PSU_STATE_REG, 0x0,
ONLP_I2C_F_FORCE);
@@ -410,30 +446,24 @@ psu_pwgood_get(int *pw_good, int good_offset, int i2c_bus, int psu_mask)
int
qsfp_present_get(int port, int *pres_val)
{
int reg_addr, val, offset;
if (port >= 1 && port <= 8) {
reg_addr = QSFP_PRES_REG1;
offset = QSFP_PRES_OFFSET1;
} else if (port >= 9 && port <= 16) {
reg_addr = QSFP_PRES_REG1;
offset = QSFP_PRES_OFFSET2;
} else if (port >= 17 && port <= 24) {
reg_addr = QSFP_PRES_REG2;
offset = QSFP_PRES_OFFSET1;
} else if (port >= 25 && port <= 32) {
reg_addr = QSFP_PRES_REG2;
offset = QSFP_PRES_OFFSET2;
} else {
int status, rc, gpio_num;
if (port >= 1 && port <= 16) {
gpio_num = 496 + ((port - 1) ^ 1);
} else if (port >= 17 && port <= 32) {
gpio_num = 464 + ((port - 1) ^ 1);
} else if (port == 33) {
gpio_num = 432;
} else if (port == 34) {
gpio_num = 433;
}
if ((rc = onlp_file_read_int(&status, "/sys/class/gpio/gpio%d/value",
gpio_num)) != ONLP_STATUS_OK) {
return ONLP_STATUS_E_INTERNAL;
}
val = onlp_i2c_readb(I2C_BUS_6, reg_addr, offset, ONLP_I2C_F_FORCE);
if (val < 0) {
return ONLP_STATUS_E_INTERNAL;
}
*pres_val = val;
*pres_val = status;
return ONLP_STATUS_OK;
}
@@ -443,6 +473,11 @@ int
system_led_set(onlp_led_mode_t mode)
{
int rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if(mode == ONLP_LED_MODE_GREEN) {
rc = onlp_i2c_modifyb(I2C_BUS_50, LED_REG, LED_OFFSET, LED_SYS_AND_MASK,
LED_SYS_GMASK, ONLP_I2C_F_FORCE);
@@ -466,6 +501,10 @@ fan_led_set(onlp_led_mode_t mode)
{
int rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if(mode == ONLP_LED_MODE_GREEN ) {
rc = onlp_i2c_modifyb(I2C_BUS_50, LED_REG, LED_OFFSET, LED_FAN_AND_MASK,
LED_FAN_GMASK, ONLP_I2C_F_FORCE);
@@ -488,6 +527,11 @@ int
psu1_led_set(onlp_led_mode_t mode)
{
int rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if(mode == ONLP_LED_MODE_GREEN) {
rc = onlp_i2c_modifyb(I2C_BUS_50, LED_REG, LED_PWOK_OFFSET,
LED_PSU1_ON_AND_MASK, LED_PSU1_ON_OR_MASK,
@@ -521,6 +565,11 @@ int
psu2_led_set(onlp_led_mode_t mode)
{
int rc;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if(mode == ONLP_LED_MODE_GREEN) {
rc = onlp_i2c_modifyb(I2C_BUS_50, LED_REG, LED_PWOK_OFFSET,
LED_PSU2_ON_AND_MASK, LED_PSU2_ON_OR_MASK,
@@ -557,6 +606,10 @@ fan_tray_led_set(onlp_oid_t id, onlp_led_mode_t mode)
int rc, temp_id;
int fan_tray_id, offset;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
temp_id = ONLP_OID_ID_GET(id);
switch (temp_id) {
case 5:
@@ -622,3 +675,20 @@ sysi_platform_info_get(onlp_platform_info_t* pi)
return ONLP_STATUS_OK;
}
bool
onlp_sysi_bmc_en_get(void)
{
int value;
if (onlp_file_read_int(&value, BMC_EN_FILE_PATH) < 0) {
// flag file not exist, default to not enable
return false;
}
/* 1 - enable, 0 - no enable */
if ( value )
return true;
return false;
}

View File

@@ -42,11 +42,15 @@
#define SYS_PSU2_NEAR_TEMP_PREFIX "/sys/class/hwmon/hwmon7/"
#define SYS_MAC_REAR_TEMP_PREFIX "/sys/class/hwmon/hwmon5/"
#define SYS_QSFP_NEAR_TEMP_PREFIX "/sys/class/hwmon/hwmon6/"
#define SYS_BMC_CPU_BOARD_TEMP_PREFIX "/sys/class/hwmon/hwmon1/"
#define SYS_FAN_PREFIX "/sys/class/hwmon/hwmon1/device/"
#define SYS_EEPROM_PATH "/sys/bus/i2c/devices/0-0055/eeprom"
#define SYS_EEPROM_PATH "/sys/bus/i2c/devices/0-0051/eeprom"
#define SYS_EEPROM_SIZE 512
#define PSU1_EEPROM_PATH "/sys/bus/i2c/devices/58-0050/eeprom"
#define PSU2_EEPROM_PATH "/sys/bus/i2c/devices/57-0050/eeprom"
#define BMC_EN_FILE_PATH "/etc/onl/bmc_en"
#define PSU_STATUS_PRESENT 1
#define PSU_STATUS_POWER_GOOD 1
#define FAN_PRESENT 0
@@ -304,4 +308,7 @@ int sysi_platform_info_get(onlp_platform_info_t* pi);
int qsfp_present_get(int port, int *pres_val);
bool onlp_sysi_bmc_en_get(void);
extern bool bmc_enable;
#endif /* __PLATFORM_LIB_H__ */

View File

@@ -65,6 +65,10 @@ psu_status_info_get(int id, onlp_psu_info_t *info)
int pw_good, good_offset;
int rc, psu_mask, i2c_bus;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
if (id == PSU_ID_PSU1) {
i2c_bus = I2C_BUS_PSU1;
exist_offset = PSU1_PRESENT_OFFSET;
@@ -137,6 +141,10 @@ int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
{
int pid;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
pid = ONLP_OID_ID_GET(id);
memset(info, 0, sizeof(onlp_psu_info_t));

View File

@@ -51,20 +51,9 @@ onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
int
onlp_sfpi_is_present(int port)
{
int status, rc, gpio_num;
int status;
if (port >= 1 && port <= 16) {
gpio_num = 496 + ((port - 1) ^ 1);
} else if (port >= 17 && port <= 32) {
gpio_num = 464 + ((port - 1) ^ 1);
} else if (port == 33) {
gpio_num = 432;
} else if (port == 34) {
gpio_num = 433;
}
if ((rc = onlp_file_read_int(&status, "/sys/class/gpio/gpio%d/value",
gpio_num)) != ONLP_STATUS_OK) {
if (qsfp_present_get(port, &status) != ONLP_STATUS_OK) {
return ONLP_STATUS_E_INTERNAL;
}

View File

@@ -36,6 +36,8 @@
#include "platform_lib.h"
bool bmc_enable = false;
const char*
onlp_sysi_platform_get(void)
{
@@ -45,6 +47,23 @@ onlp_sysi_platform_get(void)
int
onlp_sysi_init(void)
{
/* check if the platform is bmc enabled */
if ( onlp_sysi_bmc_en_get() ) {
bmc_enable = true;
//AIM_LOG_INFO("BMC detected on platform!");
AIM_SYSLOG_INFO(
"BMC detected on platform!",
"BMC detected on platform!",
"BMC detected on platform!");
} else {
bmc_enable = false;
//AIM_LOG_INFO("BMC NOT detected on platform!");
AIM_SYSLOG_INFO(
"BMC NOT detected on platform!",
"BMC NOT detected on platform!",
"BMC NOT detected on platform!");
}
return ONLP_STATUS_OK;
}
@@ -72,25 +91,35 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max)
memset(table, 0, max*sizeof(onlp_oid_t));
int i;
/* 2 PSUs */
*e++ = ONLP_PSU_ID_CREATE(1);
*e++ = ONLP_PSU_ID_CREATE(2);
if ( !bmc_enable ) {
/* 2 PSUs */
*e++ = ONLP_PSU_ID_CREATE(1);
*e++ = ONLP_PSU_ID_CREATE(2);
/* LEDs Item */
for (i=1; i<=LED_NUM; i++) {
*e++ = ONLP_LED_ID_CREATE(i);
/* LEDs Item */
for (i=1; i<=LED_NUM; i++) {
*e++ = ONLP_LED_ID_CREATE(i);
}
/* Fans Item */
for (i=1; i<=FAN_NUM; i++) {
*e++ = ONLP_FAN_ID_CREATE(i);
}
}
/* THERMALs Item */
for (i=1; i<=THERMAL_NUM; i++) {
*e++ = ONLP_THERMAL_ID_CREATE(i);
/* THERMALs Item */
if ( !bmc_enable ) {
for (i=1; i<=THERMAL_NUM; i++) {
*e++ = ONLP_THERMAL_ID_CREATE(i);
}
} else {
*e++ = THERMAL_OID_CPU1;
*e++ = THERMAL_OID_CPU2;
*e++ = THERMAL_OID_CPU3;
*e++ = THERMAL_OID_CPU4;
*e++ = THERMAL_OID_CPU_BOARD;
}
/* Fans Item */
for (i=1; i<=FAN_NUM; i++) {
*e++ = ONLP_FAN_ID_CREATE(i);
}
return ONLP_STATUS_OK;
}
@@ -157,6 +186,10 @@ onlp_sysi_platform_manage_fans(void)
static int ori_temp = 0;
onlp_thermal_info_t thermal_info;
memset(&thermal_info, 0, sizeof(thermal_info));
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
/* get new temperature */
if ((rc = platform_thermal_temp_get(&thermal_temp)) != ONLP_STATUS_OK) {
@@ -223,6 +256,10 @@ onlp_sysi_platform_manage_leds(void)
FAN_OID_FAN7,
FAN_OID_FAN8, };
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
/* PSU LED CTRL */
if ((rc = onlp_psui_info_get(PSU_OID_PSU1, &psu_info)) != ONLP_STATUS_OK) {
goto _EXIT;

View File

@@ -31,11 +31,11 @@ static onlp_thermal_info_t thermal_info[] = {
{ }, /* Not used */
{ { THERMAL_OID_FRONT_MAC, "Front MAC", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, THERMAL_THRESHOLD_INIT_DEFAULTS
ONLP_THERMAL_CAPS_ALL, 0, {62700, 66000, 69000}
},
{ { THERMAL_OID_ASIC, "ASIC Core Temp", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, THERMAL_THRESHOLD_INIT_DEFAULTS
ONLP_THERMAL_CAPS_ALL, 0, {84787, 89250, 93712}
},
{ { THERMAL_OID_CPU1, "CPU Thermal 1", 0},
ONLP_THERMAL_STATUS_PRESENT,
@@ -71,23 +71,23 @@ static onlp_thermal_info_t thermal_info[] = {
},
{ { THERMAL_OID_CPU_BOARD, "CPU Board", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0
ONLP_THERMAL_CAPS_ALL, 0, {59774, 62920, 66066}
},
{ { THERMAL_OID_PSU1_NEAR, "Near PSU 1", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0
ONLP_THERMAL_CAPS_ALL, 0, {61132, 64350, 67567}
},
{ { THERMAL_OID_PSU2_NEAR, "Near PSU 2", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0
ONLP_THERMAL_CAPS_ALL, 0, {61132, 64350, 67567}
},
{ { THERMAL_OID_MAC_REAR, "Rear MAC", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0
ONLP_THERMAL_CAPS_ALL, 0, {5727, 60260, 63273}
},
{ { THERMAL_OID_QSFP_NEAR, "Near QSFP Port", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0
ONLP_THERMAL_CAPS_ALL, 0, {55508, 58430, 61351}
}
};
@@ -105,8 +105,12 @@ sys_thermal_info_get(onlp_thermal_info_t* info, int id)
{
int rv;
rv = onlp_file_read_int(&info->mcelsius,
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_CORE_TEMP_PREFIX "temp%d_input", id);
}
if(rv == ONLP_STATUS_E_INTERNAL) {
return rv;
@@ -147,7 +151,11 @@ int
psu_thermal_info_get(onlp_thermal_info_t* info, int id)
{
int rv;
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
}
rv = psu_thermal_get(info, id);
if(rv == ONLP_STATUS_E_INTERNAL) {
return rv;
@@ -161,9 +169,14 @@ cpu_board_thermal_info_get(onlp_thermal_info_t* info)
{
int rv;
rv = onlp_file_read_int(&info->mcelsius,
if ( bmc_enable ) {
rv = onlp_file_read_int(&info->mcelsius,
SYS_BMC_CPU_BOARD_TEMP_PREFIX "temp1_input");
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_CPU_BOARD_TEMP_PREFIX "temp1_input");
}
if (rv == ONLP_STATUS_E_INTERNAL) {
return rv;
}
@@ -182,11 +195,19 @@ psu_near_thermal_info_get(onlp_thermal_info_t* info, int id)
int rv;
if (id == THERMAL_ID_PSU1_NEAR) {
rv = onlp_file_read_int(&info->mcelsius,
SYS_PSU1_NEAR_TEMP_PREFIX "temp1_input");
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_PSU1_NEAR_TEMP_PREFIX "temp1_input");
}
} else if (id == THERMAL_ID_PSU2_NEAR) {
rv = onlp_file_read_int(&info->mcelsius,
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_PSU2_NEAR_TEMP_PREFIX "temp1_input");
}
} else {
return ONLP_STATUS_E_INTERNAL;
}
@@ -208,9 +229,13 @@ mac_rear_thermal_info_get(onlp_thermal_info_t* info)
{
int rv;
rv = onlp_file_read_int(&info->mcelsius,
SYS_MAC_REAR_TEMP_PREFIX "temp1_input");
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_MAC_REAR_TEMP_PREFIX "temp1_input");
}
if (rv == ONLP_STATUS_E_INTERNAL) {
return rv;
}
@@ -228,8 +253,12 @@ qsfp_near_thermal_info_get(onlp_thermal_info_t* info)
{
int rv;
rv = onlp_file_read_int(&info->mcelsius,
if ( bmc_enable ) {
return ONLP_STATUS_E_UNSUPPORTED;
} else {
rv = onlp_file_read_int(&info->mcelsius,
SYS_QSFP_NEAR_TEMP_PREFIX "temp1_input");
}
if (rv == ONLP_STATUS_E_INTERNAL) {
return rv;

View File

@@ -14,20 +14,46 @@ class OnlPlatform_x86_64_ingrasys_s9180_32x_r0(OnlPlatformIngrasys):
PLATFORM='x86-64-ingrasys-s9180-32x-r0'
MODEL="S9180-32X"
SYS_OBJECT_ID=".9180.32"
def check_bmc_enable(self):
# check if main mux accessable, if no, bmc enabled
retcode = subprocess.call('i2cget -y 0 0x76 0x0 2>/dev/null', shell=True)
# fail if retrun code not 0
if retcode:
return 1
return 0
def baseconfig(self):
bmc_enable = self.check_bmc_enable()
msg("bmc enable : %r\n" % (True if bmc_enable else False))
# record the result for onlp
os.system("echo %d > /etc/onl/bmc_en" % bmc_enable)
if bmc_enable:
return self.baseconfig_bmc()
# vid to mac vdd value mapping
vdd_val_array=( 0.85, 0.82, 0.77, 0.87, 0.74, 0.84, 0.79, 0.89 )
# vid to rov reg value mapping
rov_reg_array=( 0x24, 0x21, 0x1C, 0x26, 0x19, 0x23, 0x1E, 0x28 )
self.insmod("eeprom_mb")
self.insmod("eeprom_mb")
# init SYS EEPROM devices
self.new_i2c_device('mb_eeprom', 0x55, 0)
self.new_i2c_devices(
[
# on main board
('mb_eeprom', 0x55, 0),
# on cpu board
('mb_eeprom', 0x51, 0),
]
)
os.system("modprobe w83795")
os.system("modprobe eeprom")
os.system("modprobe gpio_pca953x")
self.insmod("optoe")
########### initialize I2C bus 0 ###########
# init PCA9548
@@ -278,7 +304,7 @@ class OnlPlatform_x86_64_ingrasys_s9180_32x_r0(OnlPlatformIngrasys):
# init QSFP EEPROM
for port in range(1, 33):
self.new_i2c_device('sff8436', 0x50, port + 8)
self.new_i2c_device('optoe1', 0x50, port + 8)
# init SFP(0/1) EEPROM
self.new_i2c_device('sff8436', 0x50, 45)
@@ -307,4 +333,186 @@ class OnlPlatform_x86_64_ingrasys_s9180_32x_r0(OnlPlatformIngrasys):
return True
def baseconfig_bmc(self):
self.insmod("eeprom_mb")
# init SYS EEPROM devices
self.new_i2c_devices(
[
# on cpu board
('mb_eeprom', 0x51, 0),
]
)
os.system("modprobe eeprom")
os.system("modprobe gpio_pca953x")
self.insmod("optoe")
########### initialize I2C bus 0 ###########
# init PCA9548
self.new_i2c_devices(
[
('pca9548', 0x70, 0),
('pca9548', 0x71, 1),
('pca9548', 0x71, 2),
('pca9548', 0x71, 3),
('pca9548', 0x71, 4),
('pca9548', 0x71, 7),
]
)
# Golden Finger to show CPLD
os.system("i2cget -y 44 0x74 2")
# CPU Baord
os.system("i2cset -y -r 0 0x77 6 0xFF")
os.system("i2cset -y -r 0 0x77 7 0xFF")
# init SMBUS1 ABS
os.system("i2cset -y -r 5 0x20 4 0x00")
os.system("i2cset -y -r 5 0x20 5 0x00")
os.system("i2cset -y -r 5 0x20 6 0xFF")
os.system("i2cset -y -r 5 0x20 7 0xFF")
os.system("i2cset -y -r 5 0x21 4 0x00")
os.system("i2cset -y -r 5 0x21 5 0x00")
os.system("i2cset -y -r 5 0x21 6 0xFF")
os.system("i2cset -y -r 5 0x21 7 0xFF")
os.system("i2cset -y -r 5 0x22 4 0x00")
os.system("i2cset -y -r 5 0x22 5 0x00")
os.system("i2cset -y -r 5 0x22 6 0xFF")
os.system("i2cset -y -r 5 0x22 7 0xFF")
os.system("i2cset -y -r 5 0x23 4 0x00")
os.system("i2cset -y -r 5 0x23 5 0x00")
os.system("i2cset -y -r 5 0x23 2 0xCF")
os.system("i2cset -y -r 5 0x23 3 0xF0")
os.system("i2cset -y -r 5 0x23 6 0xCF")
os.system("i2cset -y -r 5 0x23 7 0xF0")
# init SFP
os.system("i2cset -y -r 5 0x27 4 0x00")
os.system("i2cset -y -r 5 0x27 5 0x00")
os.system("i2cset -y -r 5 0x27 2 0x00")
os.system("i2cset -y -r 5 0x27 3 0x00")
os.system("i2cset -y -r 5 0x27 6 0xCF")
os.system("i2cset -y -r 5 0x27 7 0xF0")
# set ZQSFP LP_MODE = 0
os.system("i2cset -y -r 6 0x20 4 0x00")
os.system("i2cset -y -r 6 0x20 5 0x00")
os.system("i2cset -y -r 6 0x20 2 0x00")
os.system("i2cset -y -r 6 0x20 3 0x00")
os.system("i2cset -y -r 6 0x20 6 0x00")
os.system("i2cset -y -r 6 0x20 7 0x00")
os.system("i2cset -y -r 6 0x21 4 0x00")
os.system("i2cset -y -r 6 0x21 5 0x00")
os.system("i2cset -y -r 6 0x21 2 0x00")
os.system("i2cset -y -r 6 0x21 3 0x00")
os.system("i2cset -y -r 6 0x21 6 0x00")
os.system("i2cset -y -r 6 0x21 7 0x00")
# set ZQSFP RST = 1
os.system("i2cset -y -r 6 0x22 4 0x00")
os.system("i2cset -y -r 6 0x22 5 0x00")
os.system("i2cset -y -r 6 0x22 2 0xFF")
os.system("i2cset -y -r 6 0x22 3 0xFF")
os.system("i2cset -y -r 6 0x22 6 0x00")
os.system("i2cset -y -r 6 0x22 7 0x00")
os.system("i2cset -y -r 6 0x23 4 0x00")
os.system("i2cset -y -r 6 0x23 5 0x00")
os.system("i2cset -y -r 6 0x23 2 0xFF")
os.system("i2cset -y -r 6 0x23 3 0xFF")
os.system("i2cset -y -r 6 0x23 6 0x00")
os.system("i2cset -y -r 6 0x23 7 0x00")
# init Host GPIO
os.system("i2cset -y -r 0 0x74 4 0x00")
os.system("i2cset -y -r 0 0x74 5 0x00")
os.system("i2cset -y -r 0 0x74 2 0x0F")
os.system("i2cset -y -r 0 0x74 3 0xDF")
os.system("i2cset -y -r 0 0x74 6 0x08")
os.system("i2cset -y -r 0 0x74 7 0x1F")
# init Temperature
self.new_i2c_devices(
[
# CPU Board
('tmp75', 0x4F, 0),
]
)
# init GPIO, ABS Port 0-15
self.new_i2c_device('pca9535', 0x20, 5)
for i in range(496, 512):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
# init GPIO, ABS Port 16-31
self.new_i2c_device('pca9535', 0x21, 5)
for i in range(480, 496):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
# init GPIO, INT Port 0-15
self.new_i2c_device('pca9535', 0x22, 5)
for i in range(464, 480):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
# init GPIO, INT Port 16-31
self.new_i2c_device('pca9535', 0x23, 5)
for i in range(448, 464):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
# init GPIO, SFP
self.new_i2c_device('pca9535', 0x27, 5)
for i in range(432, 448):
os.system("echo %d > /sys/class/gpio/export" % i)
if i == 180 or i == 181 or i == 184 or \
i == 185 or i == 186 or i == 187:
os.system("echo out > /sys/class/gpio/gpio%d/direction" % i)
else:
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
# init GPIO, LP Mode Port 0-15
self.new_i2c_device('pca9535', 0x20, 6)
for i in range(416, 432):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo out > /sys/class/gpio/gpio%d/direction" % i)
# init GPIO, LP Mode Port 16-31
self.new_i2c_device('pca9535', 0x21, 6)
for i in range(400, 416):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo out > /sys/class/gpio/gpio%d/direction" % i)
# init GPIO, RST Port 0-15
self.new_i2c_device('pca9535', 0x22, 6)
for i in range(384, 400):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo out > /sys/class/gpio/gpio%d/direction" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
os.system("echo 0 > /sys/class/gpio/gpio%d/value" % i)
# init GPIO, RST Port 16-31
self.new_i2c_device('pca9535', 0x23, 6)
for i in range(368, 384):
os.system("echo %d > /sys/class/gpio/export" % i)
os.system("echo out > /sys/class/gpio/gpio%d/direction" % i)
os.system("echo 1 > /sys/class/gpio/gpio%d/active_low" % i)
os.system("echo 0 > /sys/class/gpio/gpio%d/value" % i)
# init QSFP EEPROM
for port in range(1, 33):
self.new_i2c_device('optoe1', 0x50, port + 8)
# init SFP(0/1) EEPROM
self.new_i2c_device('sff8436', 0x50, 45)
self.new_i2c_device('sff8436', 0x50, 46)
return True

View File

@@ -15,7 +15,7 @@ class OnlPlatform_x86_64_ingrasys_s9230_64x_r0(OnlPlatformIngrasys):
3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31, 32,
35, 36, 39, 40, 43, 44, 47, 48, 51, 52, 55, 56, 59, 60, 63, 64)
self.insmod("eeprom_mb")
self.insmod("eeprom_mb")
# init SYS EEPROM devices
self.new_i2c_devices(
[
@@ -29,6 +29,8 @@ class OnlPlatform_x86_64_ingrasys_s9230_64x_r0(OnlPlatformIngrasys):
os.system("modprobe w83795")
os.system("modprobe eeprom")
os.system("modprobe gpio_pca953x")
self.insmod("optoe")
########### initialize I2C bus 0 ###########
# init PCA9548
@@ -164,7 +166,7 @@ class OnlPlatform_x86_64_ingrasys_s9230_64x_r0(OnlPlatformIngrasys):
eeprom_busbase = 33 + (port_group * 8)
eeprom_busshift = (phy_port-1)%8
eeprom_bus = eeprom_busbase + eeprom_busshift
self.new_i2c_device('sff8436', 0x50, eeprom_bus)
self.new_i2c_device('optoe1', 0x50, eeprom_bus)
# _i2c_sfp_eeprom_init
for i in range(1, 3):

View File

@@ -32,7 +32,7 @@ class OnlPlatform_x86_64_ingrasys_s9280_64x_r0(OnlPlatformIngrasys):
# vid to rov reg value mapping
rov_reg_array=( 0x79, 0x73, 0x69, 0x7D, 0x63, 0x77, 0x6D, 0x81 )
self.insmod("eeprom_mb")
self.insmod("eeprom_mb")
# init SYS EEPROM devices
self.new_i2c_devices(
[
@@ -46,6 +46,8 @@ class OnlPlatform_x86_64_ingrasys_s9280_64x_r0(OnlPlatformIngrasys):
os.system("modprobe w83795")
os.system("modprobe eeprom")
os.system("modprobe gpio_pca953x")
self.insmod("optoe")
########### initialize I2C bus 0 ###########
# init PCA9548
@@ -182,7 +184,7 @@ class OnlPlatform_x86_64_ingrasys_s9280_64x_r0(OnlPlatformIngrasys):
eeprom_busbase = 41 + (port_group * 8)
eeprom_busshift = (phy_port-1)%8
eeprom_bus = eeprom_busbase + eeprom_busshift
self.new_i2c_device('sff8436', 0x50, eeprom_bus)
self.new_i2c_device('optoe1', 0x50, eeprom_bus)
# _i2c_sfp_eeprom_init
for i in range(1, 3):