[DellEMC] S5232 platform updates (#4360)

FPGA driver crash fix for stale buffer in i2c transfer
LED firmware load issue fix.
10G port swapfix
psu/sfp bug fixes to report correct states/status of hw
This commit is contained in:
Srideep 2020-04-08 03:41:56 -06:00 committed by GitHub
parent 837c13fa63
commit 444cede11d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1006 additions and 822 deletions

View File

@ -31,5 +31,5 @@ Ethernet112 113,114,115,116 hundredGigE1/29 29 100000
Ethernet116 117,118,119,120 hundredGigE1/30 30 100000
Ethernet120 121,122,123,124 hundredGigE1/31 31 100000
Ethernet124 125,126,127,128 hundredGigE1/32 32 100000
Ethernet128 128 tenGigE1/33 33 10000
Ethernet129 129 tenGigE1/34 34 10000
Ethernet128 129 tenGigE1/33 33 10000
Ethernet129 128 tenGigE1/34 34 10000

View File

@ -0,0 +1,2 @@
m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin

View File

@ -542,3 +542,5 @@ dport_map_port_66=127
dport_map_port_130=128
mmu_init_config="TD3-DEFAULT-LOSSLESS-P3P4"
sai_preinit_cmd_file=/usr/share/sonic/hwsku/sai_preinit_cmd.soc

View File

@ -0,0 +1,2 @@
m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin

View File

@ -542,3 +542,4 @@ dport_map_port_66=127
dport_map_port_130=128
mmu_init_config="TD3-DEFAULT"
sai_preinit_cmd_file=/usr/share/sonic/hwsku/sai_preinit_cmd.soc

View File

@ -0,0 +1,2 @@
m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin

View File

@ -615,3 +615,4 @@ dport_map_port_66=127
dport_map_port_130=128
mmu_init_config="TD3-DEFAULT"
sai_preinit_cmd_file=/usr/share/sonic/hwsku/sai_preinit_cmd.soc

View File

@ -0,0 +1,2 @@
m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin

View File

@ -615,3 +615,4 @@ dport_map_port_66=127
dport_map_port_130=128
mmu_init_config="TD3-DEFAULT"
sai_preinit_cmd_file=/usr/share/sonic/hwsku/sai_preinit_cmd.soc

View File

@ -2,8 +2,8 @@
#
#
#Led0
#led stop
m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
led stop
#m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin
m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin
#led auto on
led start

View File

@ -11,12 +11,13 @@ import sys
S5232F_MAX_PSUS = 2
IPMI_PSU_DATA = "docker exec -it pmon ipmitool sdr list"
IPMI_PSU_DATA_DOCKER = "ipmitool sdr list"
IPMI_PSU1_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'"
IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'"
IPMI_PSU2_DATA = "docker exec -it pmon ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'"
IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'"
PSU_PRESENCE = "PSU{0}_stat"
# Use this for older firmware
# PSU_PRESENCE="PSU{0}_prsnt"
ipmi_sdr_list = ""
try:
@ -42,30 +43,26 @@ class PsuUtil(PsuBase):
def get_pmc_register(self, reg_name):
status = 1
global ipmi_sdr_list
ipmi_dev_node = "/dev/pmi0"
ipmi_cmd = IPMI_PSU_DATA
ipmi_cmd_1 = IPMI_PSU1_DATA
ipmi_cmd_2 = IPMI_PSU1_DATA
dockerenv = self.isDockerEnv()
if dockerenv == True:
ipmi_cmd = IPMI_PSU_DATA_DOCKER
status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd)
if index == 1:
status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
elif index == 2:
status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER)
else:
if index == 1:
status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA)
elif index == 2:
status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA)
if status:
logging.error('Failed to execute:' + ipmi_sdr_list)
logging.error('Failed to execute ipmitool')
sys.exit(0)
for item in ipmi_sdr_list.split("\n"):
if reg_name in item:
output = item.strip()
output = ipmi_sdr_list
if not output:
print('\nFailed to fetch: ' + reg_name + ' sensor ')
sys.exit(0)
output = output.split('|')[1]
logging.basicConfig(level=logging.DEBUG)
return output
def get_num_psus(self):
@ -86,8 +83,26 @@ class PsuUtil(PsuBase):
"""
# Until psu_status is implemented this is hardcoded temporarily
status = 1
return status
psu_status = 'f'
ret_status = 1
dockerenv = self.isDockerEnv()
if dockerenv == True:
if index == 1:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
elif index == 2:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER)
else:
if index == 1:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA)
elif index == 2:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA)
if ret_status:
logging.error('Failed to execute ipmitool : ')
sys.exit(0)
psu_status = ipmi_sdr_list
return (not int(psu_status, 16) > 1)
def get_psu_presence(self, index):
"""
@ -96,12 +111,23 @@ class PsuUtil(PsuBase):
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
status = 0
psu_reg_name = PSU_PRESENCE.format(index)
psu_status = int(self.get_pmc_register(psu_reg_name), 16)
if (psu_status != 'ERR'):
# Check for PSU presence
if (psu_status == 0x00):
status = 1
return status
psu_status = '0'
ret_status = 1
dockerenv = self.isDockerEnv()
if dockerenv == True:
if index == 1:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
elif index == 2:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER)
else:
if index == 1:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU1_DATA)
elif index == 2:
ret_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_PSU2_DATA)
if ret_status:
logging.error('Failed to execute ipmitool : ')
sys.exit(0)
psu_status = ipmi_sdr_list
return (int(psu_status, 16) & 1)

View File

@ -49,8 +49,8 @@ class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 1
PORT_END = 64
PORTS_IN_BLOCK = 64
PORT_END = 34
PORTS_IN_BLOCK = 32
BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0"
@ -141,6 +141,11 @@ class SfpUtil(SfpUtilBase):
# Mask off 4th bit for presence
mask = (1 << 4)
# Mask off 1st bit for presence 33,34
if (port_num > 32):
mask = (1 << 0)
# ModPrsL is active low
if reg_value & mask == 0:
return True

View File

@ -1,3 +1,4 @@
{
"skip_ledd": true
"skip_ledd": true,
"skip_thermalctld": true
}

View File

@ -22,11 +22,15 @@ S5232F_MAX_PSUS = 2
IPMI_SENSOR_DATA = "ipmitool sdr list"
IPMI_SENSOR_DUMP = "/tmp/sdr"
FAN_PRESENCE = "FAN{0}_prsnt"
PSU_PRESENCE = "PSU{0}_stat"
# Use this for older firmware
# PSU_PRESENCE="PSU{0}_prsnt"
IPMI_FAN_PRESENCE = "ipmitool sensor get FAN{0}_prsnt"
IPMI_PSU1_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x31 | awk '{print substr($0,9,1)}'"
IPMI_PSU2_DATA_DOCKER = "ipmitool raw 0x04 0x2d 0x32 | awk '{print substr($0,9,1)}'"
IPMI_RAW_STORAGE_READ = "ipmitool raw 0x0a 0x11 {0} 0 0 0xa0"
IPMI_FRU = "ipmitool fru"
ipmi_sdr_list = ""
# Dump sensor registers
@ -40,9 +44,18 @@ def ipmi_sensor_dump():
status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd)
if status:
logging.error('Failed to execute:' + ipmi_sdr_list)
logging.error('Failed to execute: ' + ipmi_sdr_list)
sys.exit(0)
# Fetch a Fan Status
def get_fan_status(fan_id):
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_FAN_PRESENCE.format(fan_id))
if ret_status:
logging.error('Failed to execute : %s'%IPMI_FAN_PRESENCE.format(fan_id))
sys.exit(0)
return(' ' + ipmi_cmd_ret.splitlines()[5].strip(' ').strip('[]'))
# Fetch a BMC register
@ -62,6 +75,35 @@ def get_pmc_register(reg_name):
logging.basicConfig(level=logging.DEBUG)
return output
#Fetch FRU Data for given fruid
def get_psu_airflow(psu_id):
fru_id = 'PSU' + str(psu_id) + '_fru'
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_FRU)
if ret_status:
logging.error('Failed to execute ipmitool: '+ IPMI_FRU)
sys.exit(0)
found_fru = False
for line in ipmi_cmd_ret.splitlines():
if line.startswith('FRU Device Description') and fru_id in line.split(':')[1] :
found_fru = True
if found_fru and line.startswith(' Board Product '):
return ' B2F' if 'PS/IO' in line else ' F2B'
return ''
# Fetch FRU on given offset
def fetch_raw_fru(dev_id, offset):
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_RAW_STORAGE_READ.format(dev_id))
if ret_status:
logging.error('Failed to execute ipmitool :' + IPMI_RAW_STORAGE_READ.format(dev_id))
sys.exit(0)
return int((ipmi_cmd_ret.splitlines()[offset/16]).split(' ')[(offset%16+1)])
def get_fan_airflow(fan_id):
Airflow_Direction = [' F2B', ' B2F']
return Airflow_Direction[fetch_raw_fru(fan_id+2, 0x46)]
# Print the information for temperature sensors
@ -93,7 +135,6 @@ print_temperature_sensors()
def print_fan_tray(tray):
Fan_Status = [' Normal', ' Abnormal']
Airflow_Direction = ['B2F', 'F2B']
print ' Fan Tray ' + str(tray) + ':'
@ -152,16 +193,62 @@ def print_fan_tray(tray):
Fan_Status[fan1_status]
print ' Fan2 State: ',\
Fan_Status[fan2_status]
print ' Airflow: ',\
get_fan_airflow(tray)
print('\nFan Trays:')
for tray in range(1, S5232F_MAX_FAN_TRAYS + 1):
fan_presence = FAN_PRESENCE.format(tray)
if (get_pmc_register(fan_presence)):
if (get_fan_status(tray) == ' Present'):
print_fan_tray(tray)
else:
print '\n Fan Tray ' + str(tray + 1) + ': Not present'
print ' Fan Tray {}: NOT PRESENT'.format(str(tray))
def get_psu_presence(index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
ret_status = 1
if index == 1:
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
elif index == 2:
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER)
if ret_status:
logging.error('Failed to execute ipmitool :' + IPMI_PSU1_DATA_DOCKER)
sys.exit(0)
psu_status = ipmi_cmd_ret
return (int(psu_status, 16) & 1)
def get_psu_status(index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
status = 0
ret_status = 1
ipmi_cmd_ret = 'f'
if index == 1:
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU1_DATA_DOCKER)
elif index == 2:
ret_status, ipmi_cmd_ret = commands.getstatusoutput(IPMI_PSU2_DATA_DOCKER)
if ret_status:
logging.error('Failed to execute ipmitool : ' + IPMI_PSU2_DATA_DOCKER)
sys.exit(0)
psu_status = ipmi_cmd_ret
return (not int(psu_status, 16) > 1)
# Print the information for PSU1, PSU2
@ -175,7 +262,6 @@ def print_psu(psu):
PSU_FAN_AIR_FLOW_BIT = 0
Psu_Fan_Presence = ['Present', 'Absent']
Psu_Fan_Status = ['Normal', 'Abnormal']
Psu_Fan_Airflow = ['B2F', 'F2B']
# print ' Input: ', Psu_Input_Type[psu_input_type]
# print ' Type: ', Psu_Type[psu_type]
@ -233,15 +319,19 @@ def print_psu(psu):
get_pmc_register('PSU2_In_amp')
print ' Output Current: ',\
get_pmc_register('PSU2_Out_amp')
print ' Airflow: ',\
get_psu_airflow(psu)
print('\nPSUs:')
for psu in range(1, S5232F_MAX_PSUS + 1):
psu_presence = PSU_PRESENCE.format(psu)
if (get_pmc_register(psu_presence)):
print_psu(psu)
#psu_presence = PSU_PRESENCE.format(psu)
if not get_psu_presence(psu):
print ' PSU{}: NOT PRESENT'.format(psu)
elif not get_psu_status(psu) :
print ' PSU{}: NOT OK'.format(psu)
else:
print '\n PSU ', psu, 'Not present'
print_psu(psu)
print '\n Total Power: ',\
get_pmc_register('PSU_Total_watt')

View File

@ -113,6 +113,48 @@ switch_board_led_default() {
resource="/sys/bus/pci/devices/0000:04:00.0/resource0"
python /usr/bin/pcisysfs.py --set --offset 0x24 --val 0x194 --res $resource > /dev/null 2>&1
}
# Readout firmware version of the system and
# store in /var/log/firmware_versions
platform_firmware_versions() {
FIRMWARE_VERSION_FILE=/var/log/firmware_versions
rm -rf ${FIRMWARE_VERSION_FILE}
echo "BIOS: `dmidecode -s system-version `" > $FIRMWARE_VERSION_FILE
## Get FPGA version
r=`/usr/bin/pcisysfs.py --get --offset 0x00 --res /sys/bus/pci/devices/0000\:04\:00.0/resource0 | sed '1d; s/.*\(....\)$/\1/; s/\(..\{1\}\)/\1./'`
r_min=$(echo $r | sed 's/.*\(..\)$/0x\1/')
r_maj=$(echo $r | sed 's/^\(..\).*/0x\1/')
echo "FPGA: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
## Get BMC Firmware Revision
r=`cat /sys/class/ipmi/ipmi0/device/bmc/firmware_revision`
echo "BMC: $r" >> $FIRMWARE_VERSION_FILE
#System CPLD 0x31 on i2c bus 601 ( physical FPGA I2C-2)
r_min=`/usr/sbin/i2cget -y 601 0x31 0x0 | sed ' s/.*\(0x..\)$/\1/'`
r_maj=`/usr/sbin/i2cget -y 601 0x31 0x1 | sed ' s/.*\(0x..\)$/\1/'`
echo "System CPLD: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
#Slave CPLD 1 0x30 on i2c bus 600 ( physical FPGA I2C-1)
r_min=`/usr/sbin/i2cget -y 600 0x30 0x0 | sed ' s/.*\(0x..\)$/\1/'`
r_maj=`/usr/sbin/i2cget -y 600 0x30 0x1 | sed ' s/.*\(0x..\)$/\1/'`
echo "Slave CPLD 1: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
#Slave CPLD 2 0x31 on i2c bus 600 ( physical FPGA I2C-1)
r_min=`/usr/sbin/i2cget -y 600 0x31 0x0 | sed ' s/.*\(0x..\)$/\1/'`
r_maj=`/usr/sbin/i2cget -y 600 0x31 0x1 | sed ' s/.*\(0x..\)$/\1/'`
echo "Slave CPLD 2: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
#Slave CPLD 3 0x32 on i2c bus 600 ( physical FPGA I2C-1)
r_min=`/usr/sbin/i2cget -y 600 0x32 0x0 | sed ' s/.*\(0x..\)$/\1/'`
r_maj=`/usr/sbin/i2cget -y 600 0x32 0x1 | sed ' s/.*\(0x..\)$/\1/'`
echo "Slave CPLD 3: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
#Slave CPLD 3 0x32 on i2c bus 600 ( physical FPGA I2C-1)
r_min=`/usr/sbin/i2cget -y 600 0x33 0x0 | sed ' s/.*\(0x..\)$/\1/'`
r_maj=`/usr/sbin/i2cget -y 600 0x33 0x1 | sed ' s/.*\(0x..\)$/\1/'`
echo "Slave CPLD 4: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE
}
init_devnum
if [ "$1" == "init" ]; then
@ -129,10 +171,12 @@ if [ "$1" == "init" ]; then
switch_board_modsel
switch_board_led_default
python /usr/bin/qsfp_irq_enable.py
platform_firmware_versions
elif [ "$1" == "deinit" ]; then
sys_eeprom "delete_device"
switch_board_qsfp "delete_device"
switch_board_sfp "delete_device"
switch_board_qsfp_mux "delete_device"
switch_board_sfp "delete_device"
modprobe -r i2c-mux-pca954x