int onlp_sysi_oids_get(onlp_oid_t* table, int max) { onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); int i; /* 2 PSUs */ *e++ = ONLP_PSU_ID_CREATE(1); *e++ = ONLP_PSU_ID_CREATE(2); /* LEDs Item */ for (i=1; i<=CHASSIS_LED_COUNT; i++) { *e++ = ONLP_LED_ID_CREATE(i); } /* THERMALs Item */ for (i=1; i<=CHASSIS_THERMAL_COUNT; i++) { *e++ = ONLP_THERMAL_ID_CREATE(i); } /* Fans Item */ for (i=1; i<=CHASSIS_FAN_COUNT; i++) { *e++ = ONLP_FAN_ID_CREATE(i); } return 0; }
int onlp_sysi_oids_get(onlp_oid_t* table, int max) { onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); /* 2 PSUs */ *e++ = ONLP_PSU_ID_CREATE(1); *e++ = ONLP_PSU_ID_CREATE(2); /* 1 Fan */ *e++ = ONLP_FAN_ID_CREATE(1); /* 9 Thermal sensors */ *e++ = ONLP_THERMAL_ID_CREATE(1); *e++ = ONLP_THERMAL_ID_CREATE(2); *e++ = ONLP_THERMAL_ID_CREATE(3); *e++ = ONLP_THERMAL_ID_CREATE(4); *e++ = ONLP_THERMAL_ID_CREATE(5); *e++ = ONLP_THERMAL_ID_CREATE(6); *e++ = ONLP_THERMAL_ID_CREATE(7); *e++ = ONLP_THERMAL_ID_CREATE(8); *e++ = ONLP_THERMAL_ID_CREATE(11); /* 5 LEDs */ *e++ = ONLP_LED_ID_CREATE(1); *e++ = ONLP_LED_ID_CREATE(2); *e++ = ONLP_LED_ID_CREATE(3); *e++ = ONLP_LED_ID_CREATE(4); *e++ = ONLP_LED_ID_CREATE(5); return 0; }
int onlp_sysi_platform_manage_leds(void) { int rv; onlp_fan_info_t fi; onlp_led_mode_t mode = ONLP_LED_MODE_GREEN; rv = onlp_fani_info_get(ONLP_FAN_ID_CREATE(1), &fi); if(rv < 0) { mode = ONLP_LED_MODE_ORANGE; } else if((fi.status & 1) == 0) { mode = ONLP_LED_MODE_OFF; } else if(fi.status & ONLP_FAN_STATUS_FAILED) { mode = ONLP_LED_MODE_ORANGE; } onlp_ledi_mode_set(ONLP_LED_ID_CREATE(2), mode); onlp_psu_info_t pi; mode = ONLP_LED_MODE_GREEN; rv = onlp_psu_info_get(ONLP_PSU_ID_CREATE(1), &pi); if(rv < 0) { mode = ONLP_LED_MODE_ORANGE; } else if((pi.status & 1) == 0) { mode = ONLP_LED_MODE_OFF; } else if(pi.status & ONLP_PSU_STATUS_FAILED) { mode = ONLP_LED_MODE_ORANGE; } onlp_ledi_mode_set(ONLP_LED_ID_CREATE(4), mode); mode = ONLP_LED_MODE_GREEN; rv = onlp_psu_info_get(ONLP_PSU_ID_CREATE(2), &pi); if(rv < 0) { mode = ONLP_LED_MODE_ORANGE; } else if((pi.status & 1) == 0) { mode = ONLP_LED_MODE_OFF; } else if(pi.status & ONLP_PSU_STATUS_FAILED) { mode = ONLP_LED_MODE_ORANGE; } onlp_ledi_mode_set(ONLP_LED_ID_CREATE(5), mode); return 0; }
int onlp_sysi_oids_get(onlp_oid_t* table, int max) { int i; onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); /* 6 Thermal sensors on the chassis */ for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) { *e++ = ONLP_THERMAL_ID_CREATE(i); } /* 5 LEDs on the chassis */ for (i = 1; i <= CHASSIS_LED_COUNT; i++) { *e++ = ONLP_LED_ID_CREATE(i); } /* 2 PSUs on the chassis */ for (i = 1; i <= CHASSIS_PSU_COUNT; i++) { *e++ = ONLP_PSU_ID_CREATE(i); } /* 6 Fans on the chassis */ for (i = 1; i <= CHASSIS_FAN_COUNT; i++) { *e++ = ONLP_FAN_ID_CREATE(i); } return 0; }
int onlp_sysi_oids_get(onlp_oid_t* table, int max) { int i; onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); /* 4 Thermal sensors on the chassis */ for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++) { *e++ = ONLP_THERMAL_ID_CREATE(i); } /* 5 LEDs on the chassis */ for (i = 1; i <= NUM_OF_LED_ON_MAIN_BROAD; i++) { *e++ = ONLP_LED_ID_CREATE(i); } /* 2 PSUs on the chassis */ for (i = 1; i <= NUM_OF_PSU_ON_MAIN_BROAD; i++) { *e++ = ONLP_PSU_ID_CREATE(i); } /* 4 Fans on the chassis */ for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++) { *e++ = ONLP_FAN_ID_CREATE(i); } return 0; }
ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS }, { { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "LM75-4", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS }, { { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BROAD), "LM75-5", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS }, { { ONLP_THERMAL_ID_CREATE(THERMAL_6_ON_MAIN_BROAD), "LM75-6", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS }, { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", 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_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 } }; /* * This will be called to intiialize the thermali subsystem. */ int onlp_thermali_init(void) {
if (psu_ym2651y_pmbus_info_get(index, "psu_p_out", &val) == 0) { info->mpout = val; info->caps |= ONLP_PSU_CAPS_POUT; } return ONLP_STATUS_OK; } /* * Get all information about the given PSU oid. */ static onlp_psu_info_t pinfo[] = { { }, /* Not used */ { { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, }, { { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, } }; int onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) { int val = 0; int ret = ONLP_STATUS_OK; int index = ONLP_OID_ID_GET(id); psu_type_t psu_type; VALIDATE(id);
int onlp_sysi_platform_manage_leds(void) { int rc,rc1; onlp_fan_info_t info1,info2; onlp_led_mode_t fan_new_mode; onlp_thermal_info_t ti; onlp_led_mode_t temp_new_mode; onlp_psu_info_t psu1; onlp_led_mode_t psu1_new_mode; onlp_psu_info_t psu2; onlp_led_mode_t psu2_new_mode; onlp_led_mode_t sys_new_mode; /*fan led */ rc=onlp_fani_info_get(ONLP_FAN_ID_CREATE(1), &info1); rc1=onlp_fani_info_get(ONLP_FAN_ID_CREATE(2), &info2); if ((rc != ONLP_STATUS_OK)||(rc1 != ONLP_STATUS_OK)){ fan_new_mode=ONLP_LED_MODE_RED; goto temp_led; } if(((info1.status&0x3)==1)&&((info2.status&0x3)==1)) fan_new_mode=ONLP_LED_MODE_GREEN; else fan_new_mode=ONLP_LED_MODE_RED; temp_led: onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN),fan_new_mode); /*temperature led */ rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &ti); if (rc != ONLP_STATUS_OK) { temp_new_mode=ONLP_LED_MODE_OFF; goto psu1_led; } if(ti.mcelsius >= 75000) temp_new_mode=ONLP_LED_MODE_RED; else temp_new_mode=ONLP_LED_MODE_GREEN; psu1_led: onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_TEMP),temp_new_mode); /*psu1 and psu2 led */ rc=onlp_psui_info_get(ONLP_PSU_ID_CREATE(1),&psu1); if (rc != ONLP_STATUS_OK) { psu1_new_mode=ONLP_LED_MODE_OFF; goto psu2_led; } if((psu1.status&0x1)&&!(psu1.status&0x2)) psu1_new_mode=ONLP_LED_MODE_GREEN; else psu1_new_mode=ONLP_LED_MODE_OFF; psu2_led: onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_PSU1),psu1_new_mode); //psu2 led ---------------- rc=onlp_psui_info_get(ONLP_PSU_ID_CREATE(2),&psu2); if (rc != ONLP_STATUS_OK) { psu2_new_mode=ONLP_LED_MODE_OFF; goto sys_led; } if((psu2.status&0x1)&&!(psu2.status&0x2)) psu2_new_mode=ONLP_LED_MODE_GREEN; else psu2_new_mode=ONLP_LED_MODE_OFF; sys_led : onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_PSU2),psu2_new_mode); //sys led ---------------- if((fan_new_mode!=ONLP_LED_MODE_GREEN)||((psu2_new_mode!=ONLP_LED_MODE_GREEN)&& \ (psu1_new_mode!=ONLP_LED_MODE_GREEN))) sys_new_mode=ONLP_LED_MODE_RED_BLINKING; else sys_new_mode=ONLP_LED_MODE_GREEN; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_SYS),sys_new_mode); return ONLP_STATUS_OK; }
return ONLP_STATUS_OK; } /* * Get the fan information. */ /* Static fan information */ onlp_fan_info_t finfo[] = { { }, /* Not used */ { { ONLP_FAN_ID_CREATE(FAN_ID_CHASSIS), "Chassis Fan 1", 0 }, }, { { ONLP_FAN_ID_CREATE(FAN_ID_PSU1), "PSU-1 Fan 1", ONLP_PSU_ID_CREATE(1) }, }, { { ONLP_FAN_ID_CREATE(FAN_ID_PSU2), "PSU-2 Fan 1", ONLP_PSU_ID_CREATE(2) }, } }; static int chassis_fan_get_info(onlp_fan_info_t* info) { unsigned char data; info->status = 0; data = cpld_base__[CPLD_REG_SYS_STATUS]; /* Get the present bit */
int onlp_sysi_platform_manage_leds(void) { int i,tray_i,rc; onlp_fan_info_t info; onlp_led_mode_t fan_new_mode; onlp_led_mode_t fan_tray_new_mode[3]; onlp_psu_info_t psu; onlp_led_mode_t psu_new_mode; onlp_led_mode_t sys_new_mode; onlp_led_mode_t locator_new_mode; /*fan led */ /*fan led */ for(tray_i=0;tray_i<3;tray_i++){ for(i=CHASSIS_FAN_COUNT-2*tray_i;i>=CHASSIS_FAN_COUNT-2*tray_i-1;i--){ rc=onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &info); if ((rc != ONLP_STATUS_OK) ||((info.status&0x1)!=1)){ fan_tray_new_mode[tray_i]=ONLP_LED_MODE_OFF; goto tray_next; } else{ if((info.status&0x2)==1){ fan_tray_new_mode[tray_i]=ONLP_LED_MODE_YELLOW; goto tray_next; } } } fan_tray_new_mode[tray_i]=ONLP_LED_MODE_GREEN; tray_next: continue; } onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY0),fan_tray_new_mode[0]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY1),fan_tray_new_mode[1]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY2),fan_tray_new_mode[2]); if((fan_tray_new_mode[0]==ONLP_LED_MODE_GREEN)&&(fan_tray_new_mode[1]==ONLP_LED_MODE_GREEN)&& (fan_tray_new_mode[2]==ONLP_LED_MODE_GREEN)) fan_new_mode=ONLP_LED_MODE_GREEN; else if((fan_tray_new_mode[0]==ONLP_LED_MODE_OFF)||(fan_tray_new_mode[1]==ONLP_LED_MODE_OFF)|| (fan_tray_new_mode[2]==ONLP_LED_MODE_OFF)) fan_new_mode=ONLP_LED_MODE_YELLOW; else fan_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN),fan_new_mode); /*psu1 and psu2 led */ for(i=1;i<=CHASSIS_PSU_COUNT;i++){ rc=onlp_psui_info_get(ONLP_PSU_ID_CREATE(i),&psu); if (rc != ONLP_STATUS_OK) { continue; } if((psu.status&0x1)&&!(psu.status&0x2)){ psu_new_mode=ONLP_LED_MODE_GREEN; goto sys_led; } } psu_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; sys_led : onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_POWER),psu_new_mode); //sys led ---------------- if((fan_new_mode!=ONLP_LED_MODE_GREEN)||(psu_new_mode!=ONLP_LED_MODE_GREEN)) sys_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; else sys_new_mode=ONLP_LED_MODE_GREEN; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_SYS),sys_new_mode); locator_new_mode=ONLP_LED_MODE_BLUE; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOCATOR),locator_new_mode); return ONLP_STATUS_OK; }