Skip to content

Commit 1ffb34b

Browse files
Sudharsan D.Glguohan
authored andcommitted
[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
1 parent 65f6253 commit 1ffb34b

File tree

10 files changed

+711
-541
lines changed

10 files changed

+711
-541
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
import sys
3+
import os
4+
import struct
5+
6+
PORT_RES = '/dev/port'
7+
8+
9+
def portio_reg_write(resource, offset, val):
10+
fd = os.open(resource, os.O_RDWR)
11+
if(fd < 0):
12+
print 'file open failed %s" % resource'
13+
return
14+
if(os.lseek(fd, offset, os.SEEK_SET) != offset):
15+
print 'lseek failed on %s' % resource
16+
return
17+
ret = os.write(fd, struct.pack('B', val))
18+
if(ret != 1):
19+
print 'write failed %d' % ret
20+
return
21+
os.close(fd)
22+
23+
if __name__ == "__main__":
24+
portio_reg_write(PORT_RES, 0xcf9, 0xe)
25+

device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/eeprom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
class board(eeprom_tlvinfo.TlvInfoDecoder):
1919

2020
def __init__(self, name, path, cpld_root, ro):
21-
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
21+
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0050/eeprom"
2222
super(board, self).__init__(self.eeprom_path, 0, '', True)

device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
Z9264F_MAX_PSUS = 2
13-
IPMI_SENSOR_DATA = "ipmitool sdr list"
13+
IPMI_SENSOR_DATA = "docker exec -it pmon ipmitool sdr list"
1414
PSU_PRESENCE = "PSU{0}_state"
1515
# Use this for older firmware
1616
# PSU_PRESENCE="PSU{0}_prsnt"

device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class SfpUtil(SfpUtilBase):
2727

2828
_port_to_eeprom_mapping = {}
2929

30+
_global_port_pres_dict = {}
31+
3032
@property
3133
def port_start(self):
3234
return self.PORT_START
@@ -44,28 +46,42 @@ def port_to_eeprom_mapping(self):
4446
return self._port_to_eeprom_mapping
4547

4648
def pci_mem_read(self, mm, offset):
47-
mm.seek(offset)
48-
read_data_stream=mm.read(4)
49-
reg_val=struct.unpack('I',read_data_stream)
50-
mem_val = str(reg_val)[1:-2]
51-
# print "reg_val read:%x"%reg_val
52-
return mem_val
49+
mm.seek(offset)
50+
read_data_stream=mm.read(4)
51+
reg_val=struct.unpack('I',read_data_stream)
52+
mem_val = str(reg_val)[1:-2]
53+
# print "reg_val read:%x"%reg_val
54+
return mem_val
5355

5456
def pci_mem_write(self, mm, offset, data):
55-
mm.seek(offset)
56-
# print "data to write:%x"%data
57-
mm.write(struct.pack('I',data))
57+
mm.seek(offset)
58+
# print "data to write:%x"%data
59+
mm.write(struct.pack('I',data))
5860

5961
def pci_set_value(self, resource, val, offset):
60-
fd=open(resource,O_RDWR)
61-
mm=mmap(fd,0)
62-
return self.pci_mem_write(mm,offset,val)
62+
fd = open(resource, O_RDWR)
63+
mm = mmap(fd, 0)
64+
val = self.pci_mem_write(mm, offset, val)
65+
mm.close()
66+
close(fd)
67+
return val
6368

6469
def pci_get_value(self, resource, offset):
65-
fd=open(resource,O_RDWR)
66-
mm=mmap(fd,0)
67-
return self.pci_mem_read(mm, offset)
70+
fd = open(resource, O_RDWR)
71+
mm = mmap(fd, 0)
72+
val = self.pci_mem_read(mm, offset)
73+
mm.close()
74+
close(fd)
75+
return val
6876

77+
def init_global_port_presence(self):
78+
for port_num in range(self.port_start, (self.port_end + 1)):
79+
presence = self.get_presence(port_num)
80+
if(presence):
81+
self._global_port_pres_dict[port_num] = '1'
82+
else:
83+
self._global_port_pres_dict[port_num] = '0'
84+
6985
def __init__(self):
7086
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
7187

@@ -74,6 +90,7 @@ def __init__(self):
7490
self.port_to_eeprom_mapping[x] = eeprom_path.format(
7591
port_num)
7692
port_num = 0
93+
self.init_global_port_presence()
7794

7895
SfpUtilBase.__init__(self)
7996

@@ -192,9 +209,19 @@ def reset(self, port_num):
192209
return True
193210

194211
def get_transceiver_change_event(self):
195-
"""
196-
TODO: This function need to be implemented
197-
when decide to support monitoring SFP(Xcvrd)
198-
on this platform.
199-
"""
200-
raise NotImplementedError
212+
port_dict = {}
213+
while True:
214+
for port_num in range(self.port_start, (self.port_end + 1)):
215+
presence = self.get_presence(port_num)
216+
if(presence and self._global_port_pres_dict[port_num] == '0'):
217+
self._global_port_pres_dict[port_num] = '1'
218+
port_dict[port_num] = '1'
219+
elif(not presence and
220+
self._global_port_pres_dict[port_num] == '1'):
221+
self._global_port_pres_dict[port_num] = '0'
222+
port_dict[port_num] = '0'
223+
224+
if(len(port_dict) > 0):
225+
return True, port_dict
226+
227+
time.sleep(0.5)

platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ z9264f/scripts/platform_sensors.py usr/local/bin
44
z9264f/scripts/sensors usr/bin
55
z9264f/scripts/pcisysfs.py usr/bin
66
z9264f/cfg/z9264f-modules.conf etc/modules-load.d
7+
z9264f/systemd/platform-modules-z9264f.service etc/systemd/system
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# postinst script for Z9264f
2+
3+
# Enable Dell-Z9264f-platform-service
4+
depmod -a
5+
systemctl enable platform-modules-z9264f.service
6+
systemctl start platform-modules-z9264f.service
7+
8+
9+
#DEBHELPER#
10+

0 commit comments

Comments
 (0)