[devices]: Dell z9264f bringup (#2415)
* Updating Z9264f for A01 board * Adding platform_reboot plugin to Z9264f * Change execute mode for platform_reboot * Indenting python files * Adding missed service file * Addressing code review comments * Modified the polling logic in transceiver change event
This commit is contained in:
parent
65f6253519
commit
1ffb34b4e3
25
device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_reboot
Normal file
25
device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_reboot
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import os
|
||||
import struct
|
||||
|
||||
PORT_RES = '/dev/port'
|
||||
|
||||
|
||||
def portio_reg_write(resource, offset, val):
|
||||
fd = os.open(resource, os.O_RDWR)
|
||||
if(fd < 0):
|
||||
print 'file open failed %s" % resource'
|
||||
return
|
||||
if(os.lseek(fd, offset, os.SEEK_SET) != offset):
|
||||
print 'lseek failed on %s' % resource
|
||||
return
|
||||
ret = os.write(fd, struct.pack('B', val))
|
||||
if(ret != 1):
|
||||
print 'write failed %d' % ret
|
||||
return
|
||||
os.close(fd)
|
||||
|
||||
if __name__ == "__main__":
|
||||
portio_reg_write(PORT_RES, 0xcf9, 0xe)
|
||||
|
@ -18,5 +18,5 @@ except ImportError, e:
|
||||
class board(eeprom_tlvinfo.TlvInfoDecoder):
|
||||
|
||||
def __init__(self, name, path, cpld_root, ro):
|
||||
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
|
||||
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0050/eeprom"
|
||||
super(board, self).__init__(self.eeprom_path, 0, '', True)
|
||||
|
@ -10,7 +10,7 @@ import commands
|
||||
|
||||
|
||||
Z9264F_MAX_PSUS = 2
|
||||
IPMI_SENSOR_DATA = "ipmitool sdr list"
|
||||
IPMI_SENSOR_DATA = "docker exec -it pmon ipmitool sdr list"
|
||||
PSU_PRESENCE = "PSU{0}_state"
|
||||
# Use this for older firmware
|
||||
# PSU_PRESENCE="PSU{0}_prsnt"
|
||||
|
@ -27,6 +27,8 @@ class SfpUtil(SfpUtilBase):
|
||||
|
||||
_port_to_eeprom_mapping = {}
|
||||
|
||||
_global_port_pres_dict = {}
|
||||
|
||||
@property
|
||||
def port_start(self):
|
||||
return self.PORT_START
|
||||
@ -59,12 +61,26 @@ class SfpUtil(SfpUtilBase):
|
||||
def pci_set_value(self, resource, val, offset):
|
||||
fd = open(resource, O_RDWR)
|
||||
mm = mmap(fd, 0)
|
||||
return self.pci_mem_write(mm,offset,val)
|
||||
val = self.pci_mem_write(mm, offset, val)
|
||||
mm.close()
|
||||
close(fd)
|
||||
return val
|
||||
|
||||
def pci_get_value(self, resource, offset):
|
||||
fd = open(resource, O_RDWR)
|
||||
mm = mmap(fd, 0)
|
||||
return self.pci_mem_read(mm, offset)
|
||||
val = self.pci_mem_read(mm, offset)
|
||||
mm.close()
|
||||
close(fd)
|
||||
return val
|
||||
|
||||
def init_global_port_presence(self):
|
||||
for port_num in range(self.port_start, (self.port_end + 1)):
|
||||
presence = self.get_presence(port_num)
|
||||
if(presence):
|
||||
self._global_port_pres_dict[port_num] = '1'
|
||||
else:
|
||||
self._global_port_pres_dict[port_num] = '0'
|
||||
|
||||
def __init__(self):
|
||||
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
|
||||
@ -74,6 +90,7 @@ class SfpUtil(SfpUtilBase):
|
||||
self.port_to_eeprom_mapping[x] = eeprom_path.format(
|
||||
port_num)
|
||||
port_num = 0
|
||||
self.init_global_port_presence()
|
||||
|
||||
SfpUtilBase.__init__(self)
|
||||
|
||||
@ -192,9 +209,19 @@ class SfpUtil(SfpUtilBase):
|
||||
return True
|
||||
|
||||
def get_transceiver_change_event(self):
|
||||
"""
|
||||
TODO: This function need to be implemented
|
||||
when decide to support monitoring SFP(Xcvrd)
|
||||
on this platform.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
port_dict = {}
|
||||
while True:
|
||||
for port_num in range(self.port_start, (self.port_end + 1)):
|
||||
presence = self.get_presence(port_num)
|
||||
if(presence and self._global_port_pres_dict[port_num] == '0'):
|
||||
self._global_port_pres_dict[port_num] = '1'
|
||||
port_dict[port_num] = '1'
|
||||
elif(not presence and
|
||||
self._global_port_pres_dict[port_num] == '1'):
|
||||
self._global_port_pres_dict[port_num] = '0'
|
||||
port_dict[port_num] = '0'
|
||||
|
||||
if(len(port_dict) > 0):
|
||||
return True, port_dict
|
||||
|
||||
time.sleep(0.5)
|
||||
|
@ -4,3 +4,4 @@ z9264f/scripts/platform_sensors.py usr/local/bin
|
||||
z9264f/scripts/sensors usr/bin
|
||||
z9264f/scripts/pcisysfs.py usr/bin
|
||||
z9264f/cfg/z9264f-modules.conf etc/modules-load.d
|
||||
z9264f/systemd/platform-modules-z9264f.service etc/systemd/system
|
||||
|
@ -0,0 +1,10 @@
|
||||
# postinst script for Z9264f
|
||||
|
||||
# Enable Dell-Z9264f-platform-service
|
||||
depmod -a
|
||||
systemctl enable platform-modules-z9264f.service
|
||||
systemctl start platform-modules-z9264f.service
|
||||
|
||||
|
||||
#DEBHELPER#
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -189,10 +189,14 @@ def print_psu(psu):
|
||||
# psu1_fan_status = int(get_pmc_register('PSU1_status'),16)
|
||||
|
||||
print ' PSU1:'
|
||||
print ' FAN Temperature: ',\
|
||||
get_pmc_register('PSU1_temp')
|
||||
print ' FAN Normal Temperature: ',\
|
||||
get_pmc_register('PSU1_Normal_temp')
|
||||
print ' FAN System Temperature: ',\
|
||||
get_pmc_register('PSU1_Sys_temp')
|
||||
print ' FAN Chassis Temperature: ',\
|
||||
get_pmc_register('PSU1_Chass_temp')
|
||||
print ' FAN AirFlow Temperature: ',\
|
||||
get_pmc_register('PSU1_AF_temp')
|
||||
get_pmc_register('PSU1AF_temp')
|
||||
print ' FAN RPM: ',\
|
||||
get_pmc_register('PSU1_rpm')
|
||||
# print ' FAN Status: ', Psu_Fan_Status[psu1_fan_status]
|
||||
@ -215,10 +219,14 @@ def print_psu(psu):
|
||||
|
||||
# psu2_fan_status = int(get_pmc_register('PSU1_status'),16)
|
||||
print ' PSU2:'
|
||||
print ' FAN Temperature: ',\
|
||||
get_pmc_register('PSU2_temp')
|
||||
print ' FAN Normal Temperature: ',\
|
||||
get_pmc_register('PSU2_Normal_temp')
|
||||
print ' FAN System Temperature: ',\
|
||||
get_pmc_register('PSU2_Sys_temp')
|
||||
print ' FAN Chassis Temperature: ',\
|
||||
get_pmc_register('PSU2_Chass_temp')
|
||||
print ' FAN AirFlow Temperature: ',\
|
||||
get_pmc_register('PSU2_AF_temp')
|
||||
get_pmc_register('PSU2AF_temp')
|
||||
print ' FAN RPM: ',\
|
||||
get_pmc_register('PSU2_rpm')
|
||||
# print ' FAN Status: ', Psu_Fan_Status[psu2_fan_status]
|
||||
|
@ -17,9 +17,9 @@ init_devnum() {
|
||||
# Attach/Detach syseeprom on CPU board
|
||||
sys_eeprom() {
|
||||
case $1 in
|
||||
"new_device") echo 24c02 0x53 > /sys/bus/i2c/devices/i2c-0/$1
|
||||
"new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-0/$1
|
||||
;;
|
||||
"delete_device") echo 0x53 > /sys/bus/i2c/devices/i2c-0/$1
|
||||
"delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-0/$1
|
||||
;;
|
||||
*) echo "z9264f_platform: sys_eeprom : invalid command !"
|
||||
;;
|
||||
@ -30,34 +30,20 @@ sys_eeprom() {
|
||||
switch_board_qsfp_mux() {
|
||||
case $1 in
|
||||
"new_device")
|
||||
for ((i=74;i<=77;i++));
|
||||
for ((i=603;i<=611;i++));
|
||||
do
|
||||
echo "Attaching PCA9548 @ $i"
|
||||
echo pca9548 0x$i > /sys/bus/i2c/devices/i2c-604/$1
|
||||
sleep 2
|
||||
echo "Attaching PCA9548 @ 0x74"
|
||||
echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-$i/$1
|
||||
done
|
||||
|
||||
for ((i=74;i<=77;i++));
|
||||
do
|
||||
echo "Attaching PCA9548 @ $i"
|
||||
echo pca9548 0x$i > /sys/bus/i2c/devices/i2c-603/$1
|
||||
sleep 2
|
||||
done
|
||||
;;
|
||||
"delete_device")
|
||||
for ((i=74;i<=77;i++));
|
||||
for ((i=603;i<=611;i++));
|
||||
do
|
||||
echo "Detaching PCA9548 @ $i"
|
||||
echo 0x$i > /sys/bus/i2c/devices/i2c-604/$1
|
||||
sleep 2
|
||||
echo "Detaching PCA9548 @ 0x74"
|
||||
echo 0x74 > /sys/bus/i2c/devices/i2c-$i/$1
|
||||
done
|
||||
|
||||
for ((i=74;i<=77;i++));
|
||||
do
|
||||
echo "Detaching PCA9548 @ $i"
|
||||
echo 0x$i > /sys/bus/i2c/devices/i2c-603/$1
|
||||
sleep 2
|
||||
done
|
||||
;;
|
||||
*) echo "z9264f_platform: switch_board_qsfp_mux: invalid command !"
|
||||
;;
|
||||
@ -94,9 +80,9 @@ switch_board_modsel() {
|
||||
resource="/sys/bus/pci/devices/0000:04:00.0/resource0"
|
||||
for ((i=1;i<=64;i++));
|
||||
do
|
||||
port_addr=$( 16384 + ((i - 1) * 16))
|
||||
port_addr=$(( 16384 + ((i - 1) * 16)))
|
||||
hex=$( printf "0x%x" $port_addr )
|
||||
python /bin/pcisysfs.py --set --offset $hex --val 0x41 --res $resource > /dev/null 2>&1
|
||||
python /usr/bin/pcisysfs.py --set --offset $hex --val 0x41 --res $resource > /dev/null 2>&1
|
||||
done
|
||||
}
|
||||
init_devnum
|
||||
@ -104,6 +90,8 @@ init_devnum
|
||||
if [ "$1" == "init" ]; then
|
||||
modprobe i2c-dev
|
||||
modprobe i2c-mux-pca954x force_deselect_on_exit=1
|
||||
modprobe ipmi_devintf
|
||||
modprobe ipmi_si
|
||||
modprobe i2c_ocores
|
||||
modprobe dell_z9264f_fpga_ocores
|
||||
sys_eeprom "new_device"
|
||||
|
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Dell Z9264f Platform modules
|
||||
Before=pmon.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/z9264f_platform.sh init
|
||||
ExecStop=/usr/local/bin/z9264f_platform.sh deinit
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user