Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dell z9264f bringup #2415

Merged
merged 7 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_reboot
Original file line number Diff line number Diff line change
@@ -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)

Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
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)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


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"
Expand Down
69 changes: 48 additions & 21 deletions device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class SfpUtil(SfpUtilBase):

_port_to_eeprom_mapping = {}

_global_port_pres_dict = {}

@property
def port_start(self):
return self.PORT_START
Expand All @@ -44,28 +46,42 @@ def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping

def pci_mem_read(self, mm, offset):
mm.seek(offset)
read_data_stream=mm.read(4)
reg_val=struct.unpack('I',read_data_stream)
mem_val = str(reg_val)[1:-2]
# print "reg_val read:%x"%reg_val
return mem_val
mm.seek(offset)
read_data_stream=mm.read(4)
reg_val=struct.unpack('I',read_data_stream)
mem_val = str(reg_val)[1:-2]
# print "reg_val read:%x"%reg_val
return mem_val

def pci_mem_write(self, mm, offset, data):
mm.seek(offset)
# print "data to write:%x"%data
mm.write(struct.pack('I',data))
mm.seek(offset)
# print "data to write:%x"%data
mm.write(struct.pack('I',data))

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)
fd = open(resource, O_RDWR)
mm = mmap(fd, 0)
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)
fd = open(resource, O_RDWR)
mm = mmap(fd, 0)
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"

Expand All @@ -74,6 +90,7 @@ def __init__(self):
self.port_to_eeprom_mapping[x] = eeprom_path.format(
port_num)
port_num = 0
self.init_global_port_presence()

SfpUtilBase.__init__(self)

Expand Down Expand Up @@ -192,9 +209,19 @@ def reset(self, port_num):
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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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#

Loading