Exemplo n.º 1
0
/*
 * This function will be called prior to any other onlp_ledi_* functions.
 */
int
onlp_ledi_init(void)
{
	onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_OFF);
	onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOC), ONLP_LED_MODE_OFF);

    return ONLP_STATUS_OK;
}
Exemplo n.º 2
0
/*
 * This function will be called prior to any other onlp_ledi_* functions.
 */
int
onlp_ledi_init(void)
{
    /*
     * Turn off the LOCATION and DIAG LEDs at startup
     */
    onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOC), ONLP_LED_MODE_OFF);
    onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_OFF);
    return ONLP_STATUS_OK;
}
Exemplo n.º 3
0
/*
 * Turn an LED on or off.
 *
 * This function will only be called if the LED OID supports the ONOFF
 * capability.
 *
 * What 'on' means in terms of colors or modes for multimode LEDs is
 * up to the platform to decide. This is intended as baseline toggle mechanism.
 */
int
onlp_ledi_set(onlp_oid_t id, int on_or_off)
{
    VALIDATE(id);

    if (!on_or_off) {
        return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
    }
    else
        return onlp_ledi_mode_set(id, ONLP_LED_MODE_GREEN);

    
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
/* Turn an LED on or off.
 *
 * This function will only be called if the LED OID supports the ONOFF
 * capability.
 *
 * What 'on' means in terms of colors or modes for multimode LEDs is
 * up to the platform to decide. This is intended as baseline toggle mechanism. */
int onlp_ledi_set(onlp_oid_t id, int on_or_off)
{
    if (!on_or_off)
    {
        return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
    }
    return ONLP_STATUS_E_UNSUPPORTED;
}
Exemplo n.º 6
0
/*
 * This function will be called prior to any other onlp_ledi_* functions.
 */
int
onlp_ledi_init(void)
{
    int ret;

    if ((ret = onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_OFF)) != ONLP_STATUS_OK)
    {
        return ret;
    }
    return ONLP_STATUS_OK;
}
Exemplo n.º 7
0
int
onlp_ledi_init(void)
{
    pthread_mutex_init(&diag_mutex, NULL);

    /*
     * Diag LED Off
     */
    onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_SYS), ONLP_LED_MODE_OFF);

    return ONLP_STATUS_OK;
}
Exemplo n.º 8
0
Arquivo: led.c Projeto: bigswitch/ONLP
static int
onlp_led_mode_set_locked__(onlp_oid_t id, onlp_led_mode_t mode)
{
    onlp_led_info_t info;
    ONLP_LED_PRESENT_OR_RETURN(id, &info);

    /*
     * The mode enumeration values always match
     * the capability bit positions.
     */
    if(info.caps & (1 << mode)) {
        return onlp_ledi_mode_set(id, mode);
    }
    else {
        return ONLP_STATUS_E_UNSUPPORTED;
    }
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
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;
}