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 5 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
1 change: 1 addition & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
python-scapy \
tcptraceroute \
mtr-tiny \
ipmitool \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipmitool is installed the pmon container, can you use that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

locales

#Adds a locale to a debian system in non-interactive mode
Expand Down
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)
92 changes: 71 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 @@ -44,28 +44,48 @@ 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 enable_oir_interrupts(self):
for port_num in range(self.port_start, (self.port_end + 1)):
status_offset = 16396 + ((port_num) * 16)
status = self.pci_get_value(self.BASE_RES_PATH, status_offset)
reg_value = int(status)

if (reg_value == ""):
return False

# 4th bit to turn on transceiver interrupts
mask = (1 << 4)
reg_value = reg_value | mask
self.pci_set_value(self.BASE_RES_PATH, reg_value, status_offset)

def __init__(self):
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"

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

SfpUtilBase.__init__(self)

Expand Down Expand Up @@ -192,9 +213,38 @@ 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 = {}
notify = False
try:
while (!notify):
# Check for invalid port_num
for port_num in range(self.port_start, (self.port_end + 1)):
# Interrupt offset starts with 0x4008
status_offset = 16392 + ((port_num) * 16)
status = self.pci_get_value(self.BASE_RES_PATH,
status_offset)
reg_value = int(status)

# Absence of status throws error
if (reg_value == ""):
return False

# Mask off 4th bit for presence interrupt
mask = (1 << 4)
if reg_value & mask:
if(self.get_presence(port_num)):
port_dict[port_num] = '1'
else:
port_dict[port_num] = '0'
notify = True
reg_value = reg_value | mask
self.pci_set_value(self.BASE_RES_PATH, reg_value,
status_offset)

if(notify):
return True, port_dict
time.sleep(0.5)
except:
return False, {}
return False, {}

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