[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:
parent
837c13fa63
commit
444cede11d
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"skip_ledd": true
|
||||
"skip_ledd": true,
|
||||
"skip_thermalctld": true
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Dell Inc
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
* Copyright (C) 2018 Dell Inc
|
||||
*
|
||||
* Licensed under the GNU General Public License Version 2
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
* @file fpga_ocores.c
|
||||
* @brief This is a driver to interface with Linux Open Cores driver for FPGA i2c access
|
||||
*
|
||||
************************************************************************/
|
||||
/**
|
||||
* @file fpga_i2ccore.c
|
||||
* @brief This is a driver to interface with Linux Open Cores drivber for FPGA i2c access
|
||||
*
|
||||
************************************************************************/
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/list.h>
|
||||
@ -90,7 +90,6 @@ struct fpgapci_dev {
|
||||
unsigned int irq_length;
|
||||
unsigned int irq_assigned;
|
||||
unsigned int xcvr_intr_count;
|
||||
|
||||
};
|
||||
|
||||
static int use_irq = 1;
|
||||
@ -191,7 +190,7 @@ struct fpgalogic_i2c {
|
||||
#define FPGAI2C_REG_STAT_NACK 0x80
|
||||
|
||||
/* SR[7:0] - Status register */
|
||||
#define FPGAI2C_REG_SR_RXACK (1 << 7) /* Receive acknowledge from slave ‘1’ = No acknowledge received*/
|
||||
#define FPGAI2C_REG_SR_RXACK (1 << 7) /* Receive acknowledge from slave .1. = No acknowledge received*/
|
||||
#define FPGAI2C_REG_SR_BUSY (1 << 6) /* Busy, I2C bus busy (as defined by start / stop bits) */
|
||||
#define FPGAI2C_REG_SR_AL (1 << 5) /* Arbitration lost - fpga i2c logic lost arbitration */
|
||||
#define FPGAI2C_REG_SR_TIP (1 << 1) /* Transfer in progress */
|
||||
@ -205,6 +204,7 @@ enum {
|
||||
STATE_START,
|
||||
STATE_WRITE,
|
||||
STATE_READ,
|
||||
STATE_STOP,
|
||||
STATE_ERROR,
|
||||
};
|
||||
|
||||
@ -573,7 +573,6 @@ static irqreturn_t fpgaport_33_64_isr(int irq, void *dev)
|
||||
if(port_irq_status| (IRQ_LTCH_STS|PRSNT_LTCH_STS))
|
||||
{
|
||||
PRINT("%s:port:%d, port_status:%#x, port_irq_status:%#x\n", __FUNCTION__, ind, port_status, port_irq_status);
|
||||
//write on clear
|
||||
iowrite32( IRQ_LTCH_STS|PRSNT_LTCH_STS,fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16));
|
||||
}
|
||||
}
|
||||
@ -590,10 +589,14 @@ static void fpgai2c_process(struct fpgalogic_i2c *i2c)
|
||||
|
||||
PRINT("fpgai2c_process in. status reg :0x%x\n", stat);
|
||||
|
||||
if ((i2c->state == STATE_DONE) || (i2c->state == STATE_ERROR)) {
|
||||
if ((i2c->state == STATE_STOP) || (i2c->state == STATE_ERROR)) {
|
||||
/* stop has been sent */
|
||||
PRINT("fpgai2c_process FPGAI2C_REG_CMD_IACK stat = 0x%x Set FPGAI2C_REG_CMD(0%x) FPGAI2C_REG_CMD_IACK = 0x%x\n",stat, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK);
|
||||
PRINT("fpgai2c_process FPGAI2C_REG_CMD_IACK stat = 0x%x Set FPGAI2C_REG_CMD(0%x) FPGAI2C_REG_CMD_IACK = 0x%x\n" \
|
||||
,stat, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK);
|
||||
fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK);
|
||||
if(i2c->state == STATE_STOP) {
|
||||
i2c->state = STATE_DONE;
|
||||
}
|
||||
wake_up(&i2c->wait);
|
||||
return;
|
||||
}
|
||||
@ -647,7 +650,7 @@ static void fpgai2c_process(struct fpgalogic_i2c *i2c)
|
||||
? STATE_READ : STATE_WRITE;
|
||||
}
|
||||
} else {
|
||||
i2c->state = STATE_DONE;
|
||||
i2c->state = STATE_STOP;
|
||||
fpgai2c_stop(i2c);
|
||||
return;
|
||||
}
|
||||
@ -721,6 +724,7 @@ static int fpgai2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
|
||||
|
||||
|
||||
} else {
|
||||
ret = -ETIMEDOUT;
|
||||
PRINT("Set FPGAI2C_REG_DATA(0%x) val = 0x%x\n",FPGAI2C_REG_DATA,
|
||||
(i2c->msg->addr << 1) | ((i2c->msg->flags & I2C_M_RD) ? 1:0));
|
||||
|
||||
@ -732,9 +736,8 @@ static int fpgai2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
|
||||
/* Interrupt mode */
|
||||
if (wait_event_timeout(i2c->wait, (i2c->state == STATE_ERROR) ||
|
||||
(i2c->state == STATE_DONE), HZ))
|
||||
return (i2c->state == STATE_DONE) ? num : -EIO;
|
||||
else
|
||||
return -ETIMEDOUT;
|
||||
ret = (i2c->state == STATE_DONE) ? num : -EIO;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1505,12 +1508,13 @@ static int fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
fpgapci->pci_dev = dev;
|
||||
dev_set_drvdata(&dev->dev, (void*)fpgapci);
|
||||
|
||||
fpgapci->upstream = find_upstream_dev (dev);
|
||||
status = sysfs_create_group(&dev->dev.kobj, &port_attr_grp);
|
||||
if (status) {
|
||||
printk(KERN_INFO "%s:Cannot create sysfs\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
fpgapci->upstream = find_upstream_dev (dev);
|
||||
|
||||
if(fpgapci_setup_device(fpgapci,dev)) {
|
||||
goto error_no_device;
|
||||
}
|
||||
@ -1620,3 +1624,4 @@ MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("joyce_yu@dell.com");
|
||||
MODULE_DESCRIPTION ("Driver for FPGA Logic I2C bus");
|
||||
MODULE_SUPPORTED_DEVICE ("FPGA Logic I2C bus");
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user