Update SAI modules for Nokia and Juniper for Bullseye and 5.10 kernel
Also, start working on getting Dell SAI module compilable on 5.10 kernel. Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
This commit is contained in:
parent
7fe1cf5938
commit
9a3a17c547
@ -1,6 +1,6 @@
|
|||||||
include $(PLATFORM_PATH)/sai-modules.mk
|
include $(PLATFORM_PATH)/sai-modules.mk
|
||||||
include $(PLATFORM_PATH)/sai.mk
|
include $(PLATFORM_PATH)/sai.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-nokia.mk
|
include $(PLATFORM_PATH)/platform-modules-nokia.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-dell.mk
|
#include $(PLATFORM_PATH)/platform-modules-dell.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-arista.mk
|
#include $(PLATFORM_PATH)/platform-modules-arista.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
|
#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
|
||||||
@ -11,7 +11,7 @@ include $(PLATFORM_PATH)/sai.mk
|
|||||||
#include $(PLATFORM_PATH)/platform-modules-delta.mk
|
#include $(PLATFORM_PATH)/platform-modules-delta.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-quanta.mk
|
#include $(PLATFORM_PATH)/platform-modules-quanta.mk
|
||||||
##include $(PLATFORM_PATH)/platform-modules-mitac.mk
|
##include $(PLATFORM_PATH)/platform-modules-mitac.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-juniper.mk
|
include $(PLATFORM_PATH)/platform-modules-juniper.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk
|
#include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-ruijie.mk
|
#include $(PLATFORM_PATH)/platform-modules-ruijie.mk
|
||||||
#include $(PLATFORM_PATH)/platform-modules-ragile.mk
|
#include $(PLATFORM_PATH)/platform-modules-ragile.mk
|
||||||
|
@ -5,7 +5,6 @@ s5232f/scripts/sensors usr/bin
|
|||||||
s5232f/scripts/qsfp_irq_enable.py usr/bin
|
s5232f/scripts/qsfp_irq_enable.py usr/bin
|
||||||
s5232f/cfg/s5232f-modules.conf etc/modules-load.d
|
s5232f/cfg/s5232f-modules.conf etc/modules-load.d
|
||||||
s5232f/systemd/platform-modules-s5232f.service etc/systemd/system
|
s5232f/systemd/platform-modules-s5232f.service etc/systemd/system
|
||||||
s5232f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
|
|
||||||
s5232f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
|
s5232f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
|
||||||
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
|
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0
|
||||||
common/fw-updater usr/local/bin
|
common/fw-updater usr/local/bin
|
||||||
|
@ -10,5 +10,4 @@ common/actions.sh usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
|||||||
s6000/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
s6000/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
||||||
s6000/scripts/platform_update_reboot_cause usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
s6000/scripts/platform_update_reboot_cause usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
||||||
s6000/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
|
s6000/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
|
||||||
s6000/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
|
||||||
s6000/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
s6000/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0
|
||||||
|
@ -21,7 +21,6 @@ common/actions.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
|||||||
s6100/scripts/platform_sensors.py usr/local/bin
|
s6100/scripts/platform_sensors.py usr/local/bin
|
||||||
s6100/scripts/platform_reboot_pre_check usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
s6100/scripts/platform_reboot_pre_check usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
||||||
s6100/scripts/hw-management-generate-dump.sh usr/bin
|
s6100/scripts/hw-management-generate-dump.sh usr/bin
|
||||||
s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
|
||||||
s6100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
s6100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
||||||
s6100/scripts/platform_watchdog_enable.sh usr/local/bin
|
s6100/scripts/platform_watchdog_enable.sh usr/local/bin
|
||||||
s6100/scripts/platform_watchdog_disable.sh usr/local/bin
|
s6100/scripts/platform_watchdog_disable.sh usr/local/bin
|
||||||
|
@ -7,7 +7,6 @@ z9100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_z9100_
|
|||||||
z9100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
|
z9100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
|
||||||
z9100/scripts/platform_sensors.py usr/local/bin
|
z9100/scripts/platform_sensors.py usr/local/bin
|
||||||
z9100/scripts/sensors usr/bin
|
z9100/scripts/sensors usr/bin
|
||||||
z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
|
|
||||||
z9100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
|
z9100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
|
||||||
z9100/cfg/z9100-modules.conf etc/modules-load.d
|
z9100/cfg/z9100-modules.conf etc/modules-load.d
|
||||||
z9100/systemd/platform-modules-z9100.service etc/systemd/system
|
z9100/systemd/platform-modules-z9100.service etc/systemd/system
|
||||||
|
@ -5,7 +5,6 @@ z9264f/scripts/sensors usr/bin
|
|||||||
z9264f/scripts/port_irq_enable.py usr/bin
|
z9264f/scripts/port_irq_enable.py usr/bin
|
||||||
z9264f/cfg/z9264f-modules.conf etc/modules-load.d
|
z9264f/cfg/z9264f-modules.conf etc/modules-load.d
|
||||||
z9264f/systemd/platform-modules-z9264f.service etc/systemd/system
|
z9264f/systemd/platform-modules-z9264f.service etc/systemd/system
|
||||||
z9264f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
|
|
||||||
z9264f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
|
z9264f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
|
||||||
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
|
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0
|
||||||
common/fw-updater usr/local/bin
|
common/fw-updater usr/local/bin
|
||||||
|
@ -3,7 +3,6 @@ z9332f/scripts/platform_sensors.py usr/local/bin
|
|||||||
z9332f/scripts/sensors usr/bin
|
z9332f/scripts/sensors usr/bin
|
||||||
z9332f/cfg/z9332f-modules.conf etc/modules-load.d
|
z9332f/cfg/z9332f-modules.conf etc/modules-load.d
|
||||||
z9332f/systemd/platform-modules-z9332f.service etc/systemd/system
|
z9332f/systemd/platform-modules-z9332f.service etc/systemd/system
|
||||||
z9332f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0
|
|
||||||
z9332f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0
|
z9332f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0
|
||||||
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0
|
common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0
|
||||||
common/pcisysfs.py usr/bin
|
common/pcisysfs.py usr/bin
|
||||||
|
@ -18,25 +18,21 @@ override_dh_auto_build:
|
|||||||
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
|
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
|
||||||
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
|
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "z9100" ]; then \
|
elif [ $$mod = "z9100" ]; then \
|
||||||
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
|
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
|
||||||
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
|
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "s6000" ]; then \
|
elif [ $$mod = "s6000" ]; then \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "z9264f" ]; then \
|
elif [ $$mod = "z9264f" ]; then \
|
||||||
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "s5212f" ]; then \
|
elif [ $$mod = "s5212f" ]; then \
|
||||||
@ -52,7 +48,6 @@ override_dh_auto_build:
|
|||||||
elif [ $$mod = "s5232f" ]; then \
|
elif [ $$mod = "s5232f" ]; then \
|
||||||
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "s5248f" ]; then \
|
elif [ $$mod = "s5248f" ]; then \
|
||||||
@ -68,7 +63,6 @@ override_dh_auto_build:
|
|||||||
elif [ $$mod = "z9332f" ]; then \
|
elif [ $$mod = "z9332f" ]; then \
|
||||||
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \
|
||||||
cd $(MOD_SRC_DIR)/$${mod}; \
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
||||||
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
|
||||||
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
|
||||||
cd $(MOD_SRC_DIR); \
|
cd $(MOD_SRC_DIR); \
|
||||||
elif [ $$mod = "n3248pxe" ]; then \
|
elif [ $$mod = "n3248pxe" ]; then \
|
||||||
|
@ -971,7 +971,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
|
|
||||||
/* map the device memory or IO region into kernel virtual
|
/* map the device memory or IO region into kernel virtual
|
||||||
* address space */
|
* address space */
|
||||||
fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
||||||
|
|
||||||
if (!fpgapci->bar[i]) {
|
if (!fpgapci->bar[i]) {
|
||||||
PRINT ( "Could not map BAR #%d.\n", i);
|
PRINT ( "Could not map BAR #%d.\n", i);
|
||||||
@ -985,7 +985,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fpga_phys_addr = bar_start;
|
fpga_phys_addr = bar_start;
|
||||||
fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE);
|
fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE);
|
||||||
fpga_base_addr = fpgapci->bar[i];
|
fpga_base_addr = fpgapci->bar[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,7 +1046,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
|
|
||||||
/* map the device memory or IO region into kernel virtual
|
/* map the device memory or IO region into kernel virtual
|
||||||
* address space */
|
* address space */
|
||||||
fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
||||||
|
|
||||||
if (!fpgapci->bar[i]) {
|
if (!fpgapci->bar[i]) {
|
||||||
PRINT ( "Could not map BAR #%d.\n", i);
|
PRINT ( "Could not map BAR #%d.\n", i);
|
||||||
@ -1060,7 +1060,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fpga_phys_addr = bar_start;
|
fpga_phys_addr = bar_start;
|
||||||
fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE);
|
fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE);
|
||||||
fpga_base_addr = fpgapci->bar[i];
|
fpga_base_addr = fpgapci->bar[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,269 +0,0 @@
|
|||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# DellEMC
|
|
||||||
#
|
|
||||||
# Module contains implementation of IpmiSensor and IpmiFru classes that
|
|
||||||
# provide Sensor's and FRU's information respectively.
|
|
||||||
#
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import re
|
|
||||||
|
|
||||||
# IPMI Request Network Function Codes
|
|
||||||
NetFn_SensorEvent = 0x04
|
|
||||||
NetFn_Storage = 0x0A
|
|
||||||
|
|
||||||
# IPMI Sensor Device Commands
|
|
||||||
Cmd_GetSensorReadingFactors = 0x23
|
|
||||||
Cmd_GetSensorThreshold = 0x27
|
|
||||||
Cmd_GetSensorReading = 0x2D
|
|
||||||
|
|
||||||
# IPMI FRU Device Commands
|
|
||||||
Cmd_ReadFRUData = 0x11
|
|
||||||
|
|
||||||
def get_ipmitool_raw_output(args):
|
|
||||||
"""
|
|
||||||
Returns a list the elements of which are the individual bytes of
|
|
||||||
ipmitool raw <cmd> command output.
|
|
||||||
"""
|
|
||||||
result_bytes = list()
|
|
||||||
result = ""
|
|
||||||
command = "ipmitool raw {}".format(args)
|
|
||||||
try:
|
|
||||||
proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE,
|
|
||||||
universal_newlines=True, stderr=subprocess.STDOUT)
|
|
||||||
stdout = proc.communicate()[0]
|
|
||||||
proc.wait()
|
|
||||||
if not proc.returncode:
|
|
||||||
result = stdout.rstrip('\n')
|
|
||||||
except EnvironmentError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
for i in result.split():
|
|
||||||
result_bytes.append(int(i, 16))
|
|
||||||
|
|
||||||
return result_bytes
|
|
||||||
|
|
||||||
class IpmiSensor(object):
|
|
||||||
|
|
||||||
# Sensor Threshold types and their respective bit masks
|
|
||||||
THRESHOLD_BIT_MASK = {
|
|
||||||
"LowerNonCritical" : 0,
|
|
||||||
"LowerCritical" : 1,
|
|
||||||
"LowerNonRecoverable" : 2,
|
|
||||||
"UpperNonCritical" : 3,
|
|
||||||
"UpperCritical" : 4,
|
|
||||||
"UpperNonRecoverable" : 5
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, sensor_id, is_discrete=False):
|
|
||||||
self.id = sensor_id
|
|
||||||
self.is_discrete = is_discrete
|
|
||||||
|
|
||||||
def _get_converted_sensor_reading(self, raw_value):
|
|
||||||
"""
|
|
||||||
Returns a 2 element tuple(bool, int) in which first element
|
|
||||||
provides the validity of the reading and the second element is
|
|
||||||
the converted sensor reading
|
|
||||||
"""
|
|
||||||
# Get Sensor Reading Factors
|
|
||||||
cmd_args = "{} {} {} {}".format(NetFn_SensorEvent,
|
|
||||||
Cmd_GetSensorReadingFactors,
|
|
||||||
self.id, raw_value)
|
|
||||||
factors = get_ipmitool_raw_output(cmd_args)
|
|
||||||
|
|
||||||
if len(factors) != 7:
|
|
||||||
return False, 0
|
|
||||||
|
|
||||||
# Compute Twos complement
|
|
||||||
def get_twos_complement(val, bits):
|
|
||||||
if val & (1 << (bits - 1)):
|
|
||||||
val = val - (1 << bits)
|
|
||||||
return val
|
|
||||||
|
|
||||||
# Calculate actual sensor value from the raw sensor value
|
|
||||||
# using the sensor reading factors.
|
|
||||||
M = get_twos_complement(((factors[2] & 0xC0) << 8) | factors[1], 10)
|
|
||||||
B = get_twos_complement(((factors[4] & 0xC0) << 8) | factors[3], 10)
|
|
||||||
R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4)
|
|
||||||
B_exp = get_twos_complement(factors[6] & 0x0F, 4)
|
|
||||||
|
|
||||||
converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp
|
|
||||||
|
|
||||||
return True, converted_reading
|
|
||||||
|
|
||||||
def get_reading(self):
|
|
||||||
"""
|
|
||||||
For Threshold sensors, returns the sensor reading.
|
|
||||||
For Discrete sensors, returns the state value.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A tuple (bool, int) where the first element provides the
|
|
||||||
validity of the reading and the second element provides the
|
|
||||||
sensor reading/state value.
|
|
||||||
"""
|
|
||||||
# Get Sensor Reading
|
|
||||||
cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorReading,
|
|
||||||
self.id)
|
|
||||||
output = get_ipmitool_raw_output(cmd_args)
|
|
||||||
if len(output) != 4:
|
|
||||||
return False, 0
|
|
||||||
|
|
||||||
# Check reading/state unavailable
|
|
||||||
if output[1] & 0x20:
|
|
||||||
return False, 0
|
|
||||||
|
|
||||||
if self.is_discrete:
|
|
||||||
state = ((output[3] & 0x7F) << 8) | output[2]
|
|
||||||
return True, state
|
|
||||||
else:
|
|
||||||
return self._get_converted_sensor_reading(output[0])
|
|
||||||
|
|
||||||
def get_threshold(self, threshold_type):
|
|
||||||
"""
|
|
||||||
Returns the sensor's threshold value for a given threshold type.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
threshold_type (str) - one of the below mentioned
|
|
||||||
threshold type strings
|
|
||||||
|
|
||||||
"LowerNonCritical"
|
|
||||||
"LowerCritical"
|
|
||||||
"LowerNonRecoverable"
|
|
||||||
"UpperNonCritical"
|
|
||||||
"UpperCritical"
|
|
||||||
"UpperNonRecoverable"
|
|
||||||
Returns:
|
|
||||||
A tuple (bool, int) where the first element provides the
|
|
||||||
validity of that threshold and second element provides the
|
|
||||||
threshold value.
|
|
||||||
"""
|
|
||||||
# Thresholds are not valid for discrete sensors
|
|
||||||
if self.is_discrete:
|
|
||||||
raise TypeError("Threshold is not applicable for Discrete Sensor")
|
|
||||||
|
|
||||||
if threshold_type not in list(self.THRESHOLD_BIT_MASK.keys()):
|
|
||||||
raise ValueError("Invalid threshold type {} provided. Valid types "
|
|
||||||
"are {}".format(threshold_type,
|
|
||||||
list(self.THRESHOLD_BIT_MASK.keys())))
|
|
||||||
|
|
||||||
bit_mask = self.THRESHOLD_BIT_MASK[threshold_type]
|
|
||||||
|
|
||||||
# Get Sensor Threshold
|
|
||||||
cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorThreshold,
|
|
||||||
self.id)
|
|
||||||
thresholds = get_ipmitool_raw_output(cmd_args)
|
|
||||||
if len(thresholds) != 7:
|
|
||||||
return False, 0
|
|
||||||
|
|
||||||
valid_thresholds = thresholds.pop(0)
|
|
||||||
# Check whether particular threshold is readable
|
|
||||||
if valid_thresholds & (1 << bit_mask):
|
|
||||||
return self._get_converted_sensor_reading(thresholds[bit_mask])
|
|
||||||
else:
|
|
||||||
return False, 0
|
|
||||||
|
|
||||||
class IpmiFru(object):
|
|
||||||
|
|
||||||
def __init__(self, fru_id):
|
|
||||||
self.id = fru_id
|
|
||||||
|
|
||||||
def _get_ipmitool_fru_print(self):
|
|
||||||
result = ""
|
|
||||||
command = "ipmitool fru print {}".format(self.id)
|
|
||||||
try:
|
|
||||||
proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE,
|
|
||||||
universal_newlines=True, stderr=subprocess.STDOUT)
|
|
||||||
stdout = proc.communicate()[0]
|
|
||||||
proc.wait()
|
|
||||||
if not proc.returncode:
|
|
||||||
result = stdout.rstrip('\n')
|
|
||||||
except EnvironmentError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _get_from_fru(self, info):
|
|
||||||
"""
|
|
||||||
Returns a string containing the info from FRU
|
|
||||||
"""
|
|
||||||
fru_output = self._get_ipmitool_fru_print()
|
|
||||||
if not fru_output:
|
|
||||||
return "NA"
|
|
||||||
|
|
||||||
info_req = re.search(r"%s\s*:(.*)" % info, fru_output)
|
|
||||||
if not info_req:
|
|
||||||
return "NA"
|
|
||||||
|
|
||||||
return info_req.group(1).strip()
|
|
||||||
|
|
||||||
def get_board_serial(self):
|
|
||||||
"""
|
|
||||||
Returns a string containing the Serial Number of the device.
|
|
||||||
"""
|
|
||||||
return self._get_from_fru('Board Serial')
|
|
||||||
|
|
||||||
def get_board_part_number(self):
|
|
||||||
"""
|
|
||||||
Returns a string containing the Part Number of the device.
|
|
||||||
"""
|
|
||||||
return self._get_from_fru('Board Part Number')
|
|
||||||
|
|
||||||
def get_board_mfr_id(self):
|
|
||||||
"""
|
|
||||||
Returns a string containing the manufacturer id of the FRU.
|
|
||||||
"""
|
|
||||||
return self._get_from_fru('Board Mfg')
|
|
||||||
|
|
||||||
def get_board_product(self):
|
|
||||||
"""
|
|
||||||
Returns a string containing the manufacturer id of the FRU.
|
|
||||||
"""
|
|
||||||
return self._get_from_fru('Board Product')
|
|
||||||
|
|
||||||
def get_fru_data(self, offset, count=1):
|
|
||||||
"""
|
|
||||||
Reads and returns the FRU data at the provided offset.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
offset (int) - FRU offset to read
|
|
||||||
count (int) - Number of bytes to read [optional, default = 1]
|
|
||||||
Returns:
|
|
||||||
A tuple (bool, list(int)) where the first element provides
|
|
||||||
the validity of the data read and the second element is a
|
|
||||||
list, the elements of which are the individual bytes of the
|
|
||||||
FRU data read.
|
|
||||||
"""
|
|
||||||
result_bytes = list()
|
|
||||||
is_valid = True
|
|
||||||
result = ""
|
|
||||||
|
|
||||||
offset_LSB = offset & 0xFF
|
|
||||||
offset_MSB = offset & 0xFF00
|
|
||||||
command = "ipmitool raw {} {} {} {} {} {}".format(NetFn_Storage,
|
|
||||||
Cmd_ReadFRUData,
|
|
||||||
self.id, offset_LSB,
|
|
||||||
offset_MSB, count)
|
|
||||||
try:
|
|
||||||
proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE,
|
|
||||||
universal_newlines=True, stderr=subprocess.STDOUT)
|
|
||||||
stdout = proc.communicate()[0]
|
|
||||||
proc.wait()
|
|
||||||
if not proc.returncode:
|
|
||||||
result = stdout.rstrip('\n')
|
|
||||||
except EnvironmentError:
|
|
||||||
is_valid = False
|
|
||||||
|
|
||||||
if (not result) or (not is_valid):
|
|
||||||
return False, result_bytes
|
|
||||||
|
|
||||||
for i in result.split():
|
|
||||||
result_bytes.append(int(i, 16))
|
|
||||||
|
|
||||||
read_count = result_bytes.pop(0)
|
|
||||||
if read_count != count:
|
|
||||||
return False, result_bytes
|
|
||||||
else:
|
|
||||||
return True, result_bytes
|
|
@ -1046,7 +1046,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
|
|
||||||
/* map the device memory or IO region into kernel virtual
|
/* map the device memory or IO region into kernel virtual
|
||||||
* address space */
|
* address space */
|
||||||
fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
||||||
|
|
||||||
if (!fpgapci->bar[i]) {
|
if (!fpgapci->bar[i]) {
|
||||||
PRINT ( "Could not map BAR #%d.\n", i);
|
PRINT ( "Could not map BAR #%d.\n", i);
|
||||||
@ -1060,7 +1060,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fpga_phys_addr = bar_start;
|
fpga_phys_addr = bar_start;
|
||||||
fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE);
|
fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE);
|
||||||
fpga_base_addr = fpgapci->bar[i];
|
fpga_base_addr = fpgapci->bar[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,10 @@ static struct i2c_mux_gpio_platform_data s6000_mux_platform_data = {
|
|||||||
.base_nr = S6000_MUX_BASE_NR,
|
.base_nr = S6000_MUX_BASE_NR,
|
||||||
.values = s6000_mux_values,
|
.values = s6000_mux_values,
|
||||||
.n_values = ARRAY_SIZE(s6000_mux_values),
|
.n_values = ARRAY_SIZE(s6000_mux_values),
|
||||||
|
#if 0
|
||||||
.gpios = s6000_mux_gpios,
|
.gpios = s6000_mux_gpios,
|
||||||
.n_gpios = ARRAY_SIZE(s6000_mux_gpios),
|
.n_gpios = ARRAY_SIZE(s6000_mux_gpios),
|
||||||
|
#endif
|
||||||
.idle = 0,
|
.idle = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1223,7 +1225,7 @@ static int __init cpld_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CPLD_DEVICE_NUM; i++) {
|
for (i = 0; i < CPLD_DEVICE_NUM; i++) {
|
||||||
pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr);
|
pdata[i].client = i2c_new_dummy_device(parent, pdata[i].reg_addr);
|
||||||
if (!pdata[i].client) {
|
if (!pdata[i].client) {
|
||||||
printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr);
|
printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1072,7 +1072,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
|
|
||||||
/* map the device memory or IO region into kernel virtual
|
/* map the device memory or IO region into kernel virtual
|
||||||
* address space */
|
* address space */
|
||||||
fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET);
|
||||||
|
|
||||||
if (!fpgapci->bar[i]) {
|
if (!fpgapci->bar[i]) {
|
||||||
PRINT ( "Could not map BAR #%d.\n", i);
|
PRINT ( "Could not map BAR #%d.\n", i);
|
||||||
@ -1086,7 +1086,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fpga_phys_addr = bar_start;
|
fpga_phys_addr = bar_start;
|
||||||
fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE);
|
fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE);
|
||||||
fpga_base_addr = fpgapci->bar[i];
|
fpga_base_addr = fpgapci->bar[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ static int tmc_gpio_probe(struct platform_device *pdev)
|
|||||||
dev_info(dev, "TMC GPIO resource 0x%llx, %llu\n",
|
dev_info(dev, "TMC GPIO resource 0x%llx, %llu\n",
|
||||||
res->start, resource_size(res));
|
res->start, resource_size(res));
|
||||||
|
|
||||||
chip->base = devm_ioremap_nocache(dev, res->start, resource_size(res));
|
chip->base = devm_ioremap(dev, res->start, resource_size(res));
|
||||||
if (!chip->base)
|
if (!chip->base)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -1029,7 +1029,7 @@ static int tmc_i2c_probe(struct platform_device *pdev)
|
|||||||
dev_info(dev, "Tmc I2C Accel resource 0x%llx, %llu\n",
|
dev_info(dev, "Tmc I2C Accel resource 0x%llx, %llu\n",
|
||||||
res->start, resource_size(res));
|
res->start, resource_size(res));
|
||||||
|
|
||||||
tmc->membase = devm_ioremap_nocache(dev, res->start,
|
tmc->membase = devm_ioremap(dev, res->start,
|
||||||
resource_size(res));
|
resource_size(res));
|
||||||
if (!tmc->membase)
|
if (!tmc->membase)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1041,7 +1041,7 @@ static int tmc_i2c_probe(struct platform_device *pdev)
|
|||||||
dev_info(dev, "Tmc I2C Mem resource 0x%llx, %llu\n",
|
dev_info(dev, "Tmc I2C Mem resource 0x%llx, %llu\n",
|
||||||
res->start, resource_size(res));
|
res->start, resource_size(res));
|
||||||
|
|
||||||
tmc->dpmbase = devm_ioremap_nocache(dev, res->start,
|
tmc->dpmbase = devm_ioremap(dev, res->start,
|
||||||
resource_size(res));
|
resource_size(res));
|
||||||
if (!tmc->dpmbase)
|
if (!tmc->dpmbase)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -529,7 +529,7 @@ static int jnx_refpga_tmc_probe(struct platform_device *pdev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmc_membase = devm_ioremap_nocache(dev, res->start, resource_size(res));
|
tmc_membase = devm_ioremap(dev, res->start, resource_size(res));
|
||||||
if (!tmc_membase) {
|
if (!tmc_membase) {
|
||||||
dev_err(dev, "ioremap failed\n");
|
dev_err(dev, "ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -13,7 +13,7 @@ include /usr/share/dpkg/pkg-info.mk
|
|||||||
|
|
||||||
export INSTALL_MOD_DIR:=extra
|
export INSTALL_MOD_DIR:=extra
|
||||||
|
|
||||||
PYTHON ?= python2
|
PYTHON ?= python3
|
||||||
|
|
||||||
PACKAGE_PRE_NAME := sonic-platform-juniper
|
PACKAGE_PRE_NAME := sonic-platform-juniper
|
||||||
KVERSION ?= $(shell uname -r)
|
KVERSION ?= $(shell uname -r)
|
||||||
|
@ -109,7 +109,7 @@ static int tmc_psu_probe(struct platform_device *pdev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = devm_ioremap_nocache(dev, res->start, resource_size(res));
|
addr = devm_ioremap(dev, res->start, resource_size(res));
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
dev_err(dev, "ioremap failed\n");
|
dev_err(dev, "ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -121,7 +121,7 @@ static int jnx_tmc_leds_init(struct device *dev, struct tmc_led_data *ild,
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = devm_ioremap_nocache(dev, res->start, resource_size(res));
|
addr = devm_ioremap(dev, res->start, resource_size(res));
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
dev_err(dev, "ioremap failed\n");
|
dev_err(dev, "ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1 +1 @@
|
|||||||
import platform
|
from . import platform
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import os
|
import os
|
||||||
import commands
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import syslog
|
import syslog
|
||||||
@ -65,7 +65,7 @@ class Chassis(ChassisBase):
|
|||||||
return content[1:]
|
return content[1:]
|
||||||
return "False"
|
return "False"
|
||||||
except IOError:
|
except IOError:
|
||||||
print "Error: File not found"
|
print("Error: File not found")
|
||||||
return "False"
|
return "False"
|
||||||
|
|
||||||
def get_product_name(self):
|
def get_product_name(self):
|
||||||
@ -242,7 +242,7 @@ class Chassis(ChassisBase):
|
|||||||
log_info("Juniper Platform name: {} and {}".format(self.get_platform_name(), platform_name))
|
log_info("Juniper Platform name: {} and {}".format(self.get_platform_name(), platform_name))
|
||||||
if str(platform_name) == "x86_64-juniper_networks_qfx5210-r0":
|
if str(platform_name) == "x86_64-juniper_networks_qfx5210-r0":
|
||||||
log_info("Juniper Platform QFX5210 ")
|
log_info("Juniper Platform QFX5210 ")
|
||||||
status, last_reboot_reason = commands.getstatusoutput("i2cget -f -y 0 0x65 0x24")
|
status, last_reboot_reason = subprocess.getstatusoutput("i2cget -f -y 0 0x65 0x24")
|
||||||
if (status == 0):
|
if (status == 0):
|
||||||
if last_reboot_reason == "0x80":
|
if last_reboot_reason == "0x80":
|
||||||
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
||||||
@ -256,7 +256,7 @@ class Chassis(ChassisBase):
|
|||||||
return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason")
|
return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason")
|
||||||
else:
|
else:
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
status, last_reboot_reason = commands.getstatusoutput("i2cget -f -y 0 0x65 0x24")
|
status, last_reboot_reason = subprocess.getstatusoutput("i2cget -f -y 0 0x65 0x24")
|
||||||
if last_reboot_reason == "0x80":
|
if last_reboot_reason == "0x80":
|
||||||
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
||||||
elif last_reboot_reason == "0x40" or last_reboot_reason == "0x08":
|
elif last_reboot_reason == "0x40" or last_reboot_reason == "0x08":
|
||||||
@ -270,9 +270,9 @@ class Chassis(ChassisBase):
|
|||||||
|
|
||||||
elif str(platform_name) == "x86_64-juniper_networks_qfx5200-r0" :
|
elif str(platform_name) == "x86_64-juniper_networks_qfx5200-r0" :
|
||||||
log_info("Juniper Platform QFX5200 ")
|
log_info("Juniper Platform QFX5200 ")
|
||||||
status, major_version = commands.getstatusoutput("busybox devmem 0xFED50000 8")
|
status, major_version = subprocess.getstatusoutput("busybox devmem 0xFED50000 8")
|
||||||
status, minor_version = commands.getstatusoutput("busybox devmem 0xFED50001 8")
|
status, minor_version = subprocess.getstatusoutput("busybox devmem 0xFED50001 8")
|
||||||
status, last_reboot_reason = commands.getstatusoutput("busybox devmem 0xFED50004 8")
|
status, last_reboot_reason = subprocess.getstatusoutput("busybox devmem 0xFED50004 8")
|
||||||
if (status == 0):
|
if (status == 0):
|
||||||
if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"):
|
if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"):
|
||||||
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
||||||
@ -288,9 +288,9 @@ class Chassis(ChassisBase):
|
|||||||
return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason")
|
return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason")
|
||||||
else:
|
else:
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
status, major_version = commands.getstatusoutput("busybox devmem 0xFED50000 8")
|
status, major_version = subprocess.getstatusoutput("busybox devmem 0xFED50000 8")
|
||||||
status, minor_version = commands.getstatusoutput("busybox devmem 0xFED50001 8")
|
status, minor_version = subprocess.getstatusoutput("busybox devmem 0xFED50001 8")
|
||||||
status, last_reboot_reason = commands.getstatusoutput("busybox devmem 0xFED50004 8")
|
status, last_reboot_reason = subprocess.getstatusoutput("busybox devmem 0xFED50004 8")
|
||||||
if (status == 0):
|
if (status == 0):
|
||||||
if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"):
|
if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"):
|
||||||
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 90afc22977b481e4511953904e3d66c68d039537
|
Subproject commit ff8218aed6cd5f048221794c7698815b2706e761
|
Reference in New Issue
Block a user