mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
Compilation fixes for GCC6.
This commit is contained in:
@@ -458,7 +458,7 @@ int getCtrlOfBus(void)
|
||||
return getCtrlOfBus_9541();
|
||||
}
|
||||
|
||||
static const struct fan_cpld_reg fan_cpld_reg[FAN_NUM] = {
|
||||
const struct fan_cpld_reg fan_cpld_reg[FAN_NUM] = {
|
||||
{0x180, 0x181},
|
||||
{0x182, 0x183},
|
||||
{0x184, 0x185},
|
||||
@@ -1952,5 +1952,3 @@ int fanSpeedSet(int id, unsigned short speed)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright (C) 2017 Delta Networks, Inc.
|
||||
* Copyright (C) 2017 Delta Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
@@ -43,44 +43,44 @@
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR), "FRONT LED (PWR LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "FAN TRAY 1 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "FAN TRAY 2 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "FAN TRAY 3 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "FAN TRAY 4 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
};
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR), "FRONT LED (PWR LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "FAN TRAY 1 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "FAN TRAY 2 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "FAN TRAY 3 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "FAN TRAY 4 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
},
|
||||
};
|
||||
/*
|
||||
* This function will be called prior to any other onlp_ledi_* functions.
|
||||
*/
|
||||
@@ -104,10 +104,10 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
dev_info.flags = DEFAULT_FLAG;
|
||||
|
||||
/* Set front panel's mode of leds */
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,LED_REG);
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,LED_REG);
|
||||
int local_id = ONLP_OID_ID_GET(id);
|
||||
switch(local_id)
|
||||
{
|
||||
{
|
||||
case LED_FRONT_FAN:
|
||||
if((r_data & 0xc0) == 0x80)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
@@ -120,11 +120,11 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
break;
|
||||
case LED_FRONT_SYS:
|
||||
if((r_data & 0x30) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x30) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else if((r_data & 0x30) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
|
||||
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
@@ -143,12 +143,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
|
||||
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
|
||||
if(fantray_present >= 0)
|
||||
{
|
||||
if((r_data & 0x01) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
{
|
||||
if((r_data & 0x01) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
@@ -157,12 +157,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
|
||||
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
|
||||
if(fantray_present >= 0)
|
||||
{
|
||||
if((r_data & 0x04) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
{
|
||||
if((r_data & 0x04) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
@@ -171,12 +171,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
|
||||
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
|
||||
if(fantray_present >= 0)
|
||||
{
|
||||
if((r_data & 0x10) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
{
|
||||
if((r_data & 0x10) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
@@ -185,20 +185,20 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
r_data = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG);
|
||||
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
|
||||
if(fantray_present >= 0)
|
||||
{
|
||||
if((r_data & 0x40) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
{
|
||||
if((r_data & 0x40) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Set the on/off status */
|
||||
if (info->mode == ONLP_LED_MODE_OFF)
|
||||
if (info->mode == ONLP_LED_MODE_OFF)
|
||||
info->status |= ONLP_LED_STATUS_FAILED;
|
||||
else
|
||||
info->status |=ONLP_LED_STATUS_PRESENT;
|
||||
@@ -250,40 +250,40 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
fan_led_status_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_STAT1_REG);
|
||||
fan_tray_pres_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,FAN_STAT2_REG);
|
||||
alarm_reg_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,ALARM_REG);
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_FRONT_FAN:
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_FRONT_FAN:
|
||||
/* Clean the bit 7,6 */
|
||||
front_panel_led_value &= ~0xC0;
|
||||
fan_board_not_present_count = 0;
|
||||
/* Read cpld fan status to check present. Fan tray 1-4 */
|
||||
/* Read cpld fan status to check present. Fan tray 1-4 */
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
fan_stat2_reg_mask = 0x01 << i;
|
||||
fan_stat1_reg_mask = 0x01 << (i * 2);
|
||||
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
|
||||
fan_board_not_present_count++;
|
||||
else if((fan_led_status_value & fan_stat1_reg_mask) == fan_stat1_reg_mask)
|
||||
count++;
|
||||
}
|
||||
{
|
||||
fan_stat2_reg_mask = 0x01 << i;
|
||||
fan_stat1_reg_mask = 0x01 << (i * 2);
|
||||
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
|
||||
fan_board_not_present_count++;
|
||||
else if((fan_led_status_value & fan_stat1_reg_mask) == fan_stat1_reg_mask)
|
||||
count++;
|
||||
}
|
||||
/* Set front light of FAN */
|
||||
if(count == ALL_FAN_TRAY_EXIST)
|
||||
{
|
||||
front_panel_led_value |= 0x80;/*Solid green, FAN operates normally.*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
{
|
||||
front_panel_led_value |= 0x80;/*Solid green, FAN operates normally.*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
else if (fan_board_not_present_count > 0)
|
||||
{
|
||||
front_panel_led_value |= 0xc0;/*Blinking Yellow , FAN is failed */
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
{
|
||||
front_panel_led_value |= 0xc0;/*Blinking Yellow , FAN is failed */
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
front_panel_led_value |= 0x40;/*Solid Amber FAN operating is NOT present */
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
|
||||
{
|
||||
front_panel_led_value |= 0x40;/*Solid Amber FAN operating is NOT present */
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LED_FRONT_PWR:
|
||||
@@ -298,52 +298,52 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
psu2_state = dni_i2c_lock_read(NULL, &dev_info);
|
||||
|
||||
if(psu1_state == 1 && psu2_state == 1)
|
||||
{
|
||||
power_state = dni_lock_cpld_read_attribute(MASTER_CPLD_PATH,PSU_STAT_REG);
|
||||
|
||||
if((power_state & 0x40) == 0x40 || (power_state & 0x04) == 0x04)
|
||||
{
|
||||
front_panel_led_value |= 0x06; /*Blinking Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
power_state = dni_lock_cpld_read_attribute(MASTER_CPLD_PATH,PSU_STAT_REG);
|
||||
|
||||
if((power_state & 0x40) == 0x40 || (power_state & 0x04) == 0x04)
|
||||
{
|
||||
front_panel_led_value |= 0x06; /*Blinking Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
front_panel_led_value |= 0x04; /*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
front_panel_led_value |= 0x04; /*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
front_panel_led_value |= 0x02; /*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,LED_REG, front_panel_led_value);
|
||||
break;
|
||||
|
||||
|
||||
case LED_FRONT_SYS:
|
||||
/* Clean bit 4,5 */
|
||||
front_panel_led_value &= ~0x30;
|
||||
fan_board_not_present_count = 0;
|
||||
fan_board_not_present_count = 0;
|
||||
/* Read fan eeprom to check present */
|
||||
for(i = 0;i < 4; i++)
|
||||
{
|
||||
fan_stat2_reg_mask = 0x01 << i;
|
||||
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
|
||||
fan_board_not_present_count++;
|
||||
}
|
||||
if(fan_board_not_present_count > 0 || (alarm_reg_value & 0xff) == 0xff)
|
||||
{
|
||||
fan_tray_interface_detected_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,INTERRUPT_REG);
|
||||
if(fan_tray_interface_detected_value == 0xfe || (alarm_reg_value & 0xff) == 0xff)
|
||||
{
|
||||
front_panel_led_value |= 0x20;
|
||||
fan_stat2_reg_mask = 0x01 << i;
|
||||
if((fan_tray_pres_value & fan_stat2_reg_mask) == fan_stat2_reg_mask)
|
||||
fan_board_not_present_count++;
|
||||
}
|
||||
if(fan_board_not_present_count > 0 || (alarm_reg_value & 0xff) == 0xff)
|
||||
{
|
||||
fan_tray_interface_detected_value = dni_lock_cpld_read_attribute(SLAVE_CPLD_PATH,INTERRUPT_REG);
|
||||
if(fan_tray_interface_detected_value == 0xfe || (alarm_reg_value & 0xff) == 0xff)
|
||||
{
|
||||
front_panel_led_value |= 0x20;
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
front_panel_led_value |= 0x10;
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
front_panel_led_value |= 0x10;
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH, LED_REG, front_panel_led_value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LED_REAR_FAN_TRAY_1:
|
||||
dev_info.addr = FAN_TRAY_1;
|
||||
fantray_present = dni_i2c_lock_read(NULL, &dev_info);
|
||||
@@ -351,15 +351,15 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN1_REAR);
|
||||
fan_tray_led_reg_value &= ~0x03;
|
||||
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x01;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x01;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x02;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x02;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_2:
|
||||
@@ -368,17 +368,17 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN2_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN2_REAR);
|
||||
fan_tray_led_reg_value &= ~0x0c;
|
||||
|
||||
|
||||
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x04;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x04;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x08;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x08;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_3:
|
||||
@@ -388,15 +388,15 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN3_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN3_REAR);
|
||||
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm != 0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x10;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x10;/*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x20;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x20;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_4:
|
||||
@@ -406,16 +406,16 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN4_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN4_REAR);
|
||||
if(fantray_present >= 0 && rpm != FAN_ZERO_RPM && rpm !=0 && rpm1 != FAN_ZERO_RPM && rpm1 != 0 )
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x40; /*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x40; /*Solid Green*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x80;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
}
|
||||
{
|
||||
fan_tray_led_reg_value |= 0x80;/*Solid Amber*/
|
||||
dni_lock_cpld_write_attribute(SLAVE_CPLD_PATH,FAN_TRAY_LED_REG, fan_tray_led_reg_value);
|
||||
}
|
||||
}
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
} while(0)
|
||||
static long psu_data_convert(unsigned int d, int mult)
|
||||
{
|
||||
long X, Y, N, n;
|
||||
long X, Y, N, n;
|
||||
|
||||
Y = d & 0x07FF;
|
||||
N = (d >> 11) & 0x0f;
|
||||
@@ -73,116 +73,116 @@ static long psu_data_convert(unsigned int d, int mult)
|
||||
|
||||
static long psu_data_convert_16(unsigned int d, int mult)
|
||||
{
|
||||
long X;
|
||||
X = (d * mult) / (1 << 9);
|
||||
return X;
|
||||
long X;
|
||||
X = (d * mult) / (1 << 9);
|
||||
return X;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
static int
|
||||
psu_status_info_get(int id, char *node)
|
||||
{
|
||||
int ret;
|
||||
char r_data;
|
||||
ret=i2c_devname_read_byte(CPLD_PSU_NAME,PSU_STATUS_REG);
|
||||
|
||||
if(ret<0)
|
||||
return -1;
|
||||
|
||||
if (PSU1_ID == id) {
|
||||
if(!strcmp("present",node))
|
||||
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
|
||||
else if(!strcmp("good",node))
|
||||
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
|
||||
else
|
||||
r_data=-1;
|
||||
|
||||
char r_data;
|
||||
ret=i2c_devname_read_byte(CPLD_PSU_NAME,PSU_STATUS_REG);
|
||||
|
||||
if(ret<0)
|
||||
return -1;
|
||||
|
||||
if (PSU1_ID == id) {
|
||||
if(!strcmp("present",node))
|
||||
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
|
||||
else if(!strcmp("good",node))
|
||||
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
|
||||
else
|
||||
r_data=-1;
|
||||
|
||||
}
|
||||
else if (PSU2_ID == id) {
|
||||
|
||||
|
||||
if(!strcmp("present",node))
|
||||
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
|
||||
else if(!strcmp("good",node))
|
||||
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
|
||||
else
|
||||
r_data=-1;
|
||||
}
|
||||
r_data=!((ret& PSU_STATUS_PRESENT_BIT(id))>> PSU_STATUS_PRESENT_OFFSET(id));
|
||||
else if(!strcmp("good",node))
|
||||
r_data=((ret& PSU_STATUS_GOOD_BIT(id))>> PSU_STATUS_GOOD_OFFSET(id));
|
||||
else
|
||||
r_data=-1;
|
||||
}
|
||||
else{
|
||||
r_data=-1;
|
||||
}
|
||||
|
||||
return r_data;
|
||||
r_data=-1;
|
||||
}
|
||||
|
||||
return r_data;
|
||||
}
|
||||
static int
|
||||
static int
|
||||
psu_value_info_get(int id, char *type)
|
||||
{
|
||||
int ret;
|
||||
char *dev_name;
|
||||
int reg_offset;
|
||||
|
||||
char *dev_name;
|
||||
int reg_offset;
|
||||
|
||||
if(PSU1_ID == id)
|
||||
dev_name="PSU1_PMBUS";
|
||||
else
|
||||
dev_name="PSU2_PMBUS";
|
||||
|
||||
if(!strcmp(type,"vin"))
|
||||
reg_offset=PSU_PNBUS_VIN_REG;
|
||||
else if(!strcmp(type,"iin"))
|
||||
reg_offset=PSU_PNBUS_IIN_REG;
|
||||
else if(!strcmp(type,"pin"))
|
||||
reg_offset=PSU_PNBUS_PIN_REG;
|
||||
else if(!strcmp(type,"vout"))
|
||||
reg_offset=PSU_PNBUS_VOUT_REG;
|
||||
else if(!strcmp(type,"iout"))
|
||||
reg_offset=PSU_PNBUS_IOUT_REG;
|
||||
else
|
||||
reg_offset=PSU_PNBUS_POUT_REG;
|
||||
|
||||
ret=i2c_devname_read_word(dev_name,reg_offset);
|
||||
|
||||
if(ret<0)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
|
||||
if(!strcmp(type,"vin"))
|
||||
reg_offset=PSU_PNBUS_VIN_REG;
|
||||
else if(!strcmp(type,"iin"))
|
||||
reg_offset=PSU_PNBUS_IIN_REG;
|
||||
else if(!strcmp(type,"pin"))
|
||||
reg_offset=PSU_PNBUS_PIN_REG;
|
||||
else if(!strcmp(type,"vout"))
|
||||
reg_offset=PSU_PNBUS_VOUT_REG;
|
||||
else if(!strcmp(type,"iout"))
|
||||
reg_offset=PSU_PNBUS_IOUT_REG;
|
||||
else
|
||||
reg_offset=PSU_PNBUS_POUT_REG;
|
||||
|
||||
ret=i2c_devname_read_word(dev_name,reg_offset);
|
||||
|
||||
if(ret<0)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
psu_serial_model_info_get(int id,char *type,char*data,int data_len)
|
||||
{
|
||||
int i,r_data,re_cnt;
|
||||
char *dev_name;
|
||||
int reg_offset;
|
||||
|
||||
char *dev_name;
|
||||
int reg_offset;
|
||||
|
||||
if(PSU1_ID == id)
|
||||
dev_name="PSU1_EEPROM";
|
||||
else
|
||||
dev_name="PSU2_EEPROM";
|
||||
|
||||
if(!strcmp(type,"serial"))
|
||||
reg_offset=PSU_PNBUS_SERIAL_REG;
|
||||
else
|
||||
reg_offset=PSU_PNBUS_MODEL_REG;
|
||||
|
||||
for(i=0;i<data_len;i++){
|
||||
re_cnt=3;
|
||||
while(re_cnt){
|
||||
r_data=i2c_devname_read_byte(dev_name,reg_offset+i);
|
||||
if(r_data<0){
|
||||
re_cnt--;
|
||||
continue;
|
||||
}
|
||||
data[i]=r_data;
|
||||
break;
|
||||
}
|
||||
if(re_cnt==0){
|
||||
AIM_LOG_ERROR("Unable to read the %d reg \r\n",i);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
}
|
||||
if(!strcmp(type,"serial"))
|
||||
reg_offset=PSU_PNBUS_SERIAL_REG;
|
||||
else
|
||||
reg_offset=PSU_PNBUS_MODEL_REG;
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
for(i=0;i<data_len;i++){
|
||||
re_cnt=3;
|
||||
while(re_cnt){
|
||||
r_data=i2c_devname_read_byte(dev_name,reg_offset+i);
|
||||
if(r_data<0){
|
||||
re_cnt--;
|
||||
continue;
|
||||
}
|
||||
data[i]=r_data;
|
||||
break;
|
||||
}
|
||||
if(re_cnt==0){
|
||||
AIM_LOG_ERROR("Unable to read the %d reg \r\n",i);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -195,15 +195,15 @@ onlp_psui_init(void)
|
||||
* 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 },
|
||||
}
|
||||
};
|
||||
{ }, /* 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)
|
||||
@@ -211,141 +211,141 @@ 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;
|
||||
int r_data;
|
||||
char sn_data[15]={0};
|
||||
char model_data[17]={0};
|
||||
psu_type_t psu_type;
|
||||
int r_data;
|
||||
char sn_data[15]={0};
|
||||
char model_data[17]={0};
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_psu_info_t));
|
||||
|
||||
|
||||
*info = pinfo[index]; /* Set the onlp_oid_hdr_t */
|
||||
|
||||
/* Get the present state */
|
||||
val=psu_status_info_get(index, "present");
|
||||
|
||||
val=psu_status_info_get(index, "present");
|
||||
|
||||
if (val<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d present value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d present value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
if (val != PSU_STATUS_PRESENT) {
|
||||
if (val != PSU_STATUS_PRESENT) {
|
||||
info->status &= ~ONLP_PSU_STATUS_PRESENT;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
info->status |= ONLP_PSU_STATUS_PRESENT;
|
||||
|
||||
/* Get power good status */
|
||||
val=psu_status_info_get(index,"good");
|
||||
|
||||
if (val<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d good value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
val=psu_status_info_get(index,"good");
|
||||
|
||||
if (val<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d good value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
if (val != PSU_STATUS_POWER_GOOD) {
|
||||
info->status |= ONLP_PSU_STATUS_FAILED;
|
||||
}
|
||||
|
||||
|
||||
/* Get PSU type
|
||||
*/
|
||||
psu_type = get_psu_type(index, info->model, sizeof(info->model));
|
||||
|
||||
switch (psu_type) {
|
||||
case PSU_TYPE_AC_F2B:
|
||||
case PSU_TYPE_AC_B2F:
|
||||
info->caps = ONLP_PSU_CAPS_AC;
|
||||
ret = ONLP_STATUS_OK;
|
||||
break;
|
||||
case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/
|
||||
info->status |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
info->status &= ~ONLP_PSU_STATUS_FAILED;
|
||||
ret = ONLP_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
ret = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
case PSU_TYPE_AC_F2B:
|
||||
case PSU_TYPE_AC_B2F:
|
||||
info->caps = ONLP_PSU_CAPS_AC;
|
||||
ret = ONLP_STATUS_OK;
|
||||
break;
|
||||
case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/
|
||||
info->status |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
info->status &= ~ONLP_PSU_STATUS_FAILED;
|
||||
ret = ONLP_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
ret = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get PSU vin,vout*/
|
||||
|
||||
r_data=psu_value_info_get(index,"vin");
|
||||
|
||||
/* Get PSU vin,vout*/
|
||||
|
||||
r_data=psu_value_info_get(index,"vin");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Vin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Vin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->mvin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"vout");
|
||||
|
||||
|
||||
info->mvin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"vout");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Vout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Vout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->mvout=psu_data_convert_16(r_data,1000);
|
||||
/* Get PSU iin, iout
|
||||
|
||||
info->mvout=psu_data_convert_16(r_data,1000);
|
||||
/* Get PSU iin, iout
|
||||
*/
|
||||
r_data=psu_value_info_get(index,"iin");
|
||||
|
||||
r_data=psu_value_info_get(index,"iin");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Iin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Iin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->miin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"iout");
|
||||
|
||||
|
||||
info->miin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"iout");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Iout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Iout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->miout=psu_data_convert(r_data,1000);
|
||||
|
||||
/* Get PSU pin, pout
|
||||
|
||||
info->miout=psu_data_convert(r_data,1000);
|
||||
|
||||
/* Get PSU pin, pout
|
||||
*/
|
||||
r_data=psu_value_info_get(index,"pin");
|
||||
|
||||
r_data=psu_value_info_get(index,"pin");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Pin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Pin value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->mpin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"pout");
|
||||
|
||||
|
||||
info->mpin=psu_data_convert(r_data,1000);
|
||||
|
||||
r_data=psu_value_info_get(index,"pout");
|
||||
|
||||
if (r_data<0) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d Pout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
AIM_LOG_INFO("Unable to read PSU %d Pout value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
info->mpout=psu_data_convert(r_data,1000);
|
||||
/* Get PSU serial
|
||||
|
||||
info->mpout=psu_data_convert(r_data,1000);
|
||||
/* Get PSU serial
|
||||
*/
|
||||
|
||||
ret=psu_serial_model_info_get(index,"serial",sn_data,14);
|
||||
if (ret!=ONLP_STATUS_OK) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d SN value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
ret=psu_serial_model_info_get(index,"serial",sn_data,14);
|
||||
if (ret!=ONLP_STATUS_OK) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d SN value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
strcpy(info->serial,sn_data);
|
||||
|
||||
/* Get PSU model
|
||||
|
||||
strcpy(info->serial,sn_data);
|
||||
|
||||
/* Get PSU model
|
||||
*/
|
||||
ret=psu_serial_model_info_get(index,"model",model_data,16);
|
||||
if (ret!=ONLP_STATUS_OK) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d model value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
ret=psu_serial_model_info_get(index,"model",model_data,16);
|
||||
if (ret!=ONLP_STATUS_OK) {
|
||||
AIM_LOG_INFO("Unable to read PSU %d model value)\r\n", index);
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
strcpy(info->model,model_data);
|
||||
|
||||
strcpy(info->model,model_data);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -354,4 +354,3 @@ onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user