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

[202012]: Update Silverstone BSP and platform APIs #266

591 changes: 591 additions & 0 deletions device/celestica/x86_64-cel_silverstone-r0/platform.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"chassis": {
"Silverstone": {
"component": {
"BIOS": {},
"BMC": {},
"SWITCH_CPLD": {},
"BASE_CPLD": {},
"FPGA": {}
}
}
}
}
67 changes: 49 additions & 18 deletions device/celestica/x86_64-cel_silverstone-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,46 @@ class SfpUtil(SfpUtilBase):
SFP_PORT_START = 33
SFP_PORT_END = 34

EEPROM_OFFSET = 9
PORT_INFO_PATH = '/sys/class/silverstone_fpga'
PORT_INFO_PATH = '/sys/devices/platform/cls-xcvr'

_port_name = ""
_port_to_eeprom_mapping = {}
_port_to_i2cbus_mapping = {}
_port_to_i2cbus_mapping = {
1: 10,
2: 11,
3: 12,
4: 13,
5: 14,
6: 15,
7: 16,
8: 17,
9: 18,
10: 19,
11: 20,
12: 21,
13: 22,
14: 23,
15: 24,
16: 25,
17: 26,
18: 27,
19: 28,
20: 29,
21: 30,
22: 31,
23: 32,
24: 33,
25: 34,
26: 35,
27: 36,
28: 37,
29: 38,
30: 39,
31: 40,
32: 41,
33: 1,
34: 2
}

@property
def port_start(self):
Expand All @@ -49,7 +83,7 @@ def port_to_eeprom_mapping(self):
def port_to_i2cbus_mapping(self):
return self._port_to_i2cbus_mapping

def get_port_name(self, port_num):
def _get_port_name(self, port_num):
if port_num in self.osfp_ports:
self._port_name = "QSFP" + str(port_num - self.OSFP_PORT_START + 1)
else:
Expand All @@ -67,11 +101,8 @@ def get_eeprom_dom_raw(self, port_num):
def __init__(self):
# Override port_to_eeprom_mapping for class initialization
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom'

for x in range(self.PORT_START, self.PORT_END+1):
self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET)
self.port_to_eeprom_mapping[x] = eeprom_path.format(
x + self.EEPROM_OFFSET)
for k,v in self._port_to_i2cbus_mapping.items():
self._port_to_eeprom_mapping[k] = eeprom_path.format(v)
SfpUtilBase.__init__(self)

def get_presence(self, port_num):
Expand All @@ -80,8 +111,8 @@ def get_presence(self, port_num):
return False

# Get path for access port presence status
port_name = self.get_port_name(port_num)
sysfs_filename = "qsfp_modprs" if port_num in self.osfp_ports else "sfp_modabs"
port_name = self._get_port_name(port_num)
sysfs_filename = "qsfp_modprsL" if port_num in self.osfp_ports else "sfp_modabs"
reg_path = "/".join([self.PORT_INFO_PATH, port_name, sysfs_filename])

# Read status
Expand All @@ -105,7 +136,7 @@ def get_low_power_mode(self, port_num):
return False

try:
port_name = self.get_port_name(port_num)
port_name = self._get_port_name(port_num)
reg_file = open("/".join([self.PORT_INFO_PATH,
port_name, "qsfp_lpmode"]))
except IOError as e:
Expand All @@ -122,12 +153,12 @@ def get_low_power_mode(self, port_num):
return True

def set_low_power_mode(self, port_num, lpmode):
# Check for invalid QSFP port_num
# Check for invalid port_num
if port_num not in self.osfp_ports:
return False

try:
port_name = self.get_port_name(port_num)
port_name = self._get_port_name(port_num)
reg_file = open("/".join([self.PORT_INFO_PATH,
port_name, "qsfp_lpmode"]), "r+")
except IOError as e:
Expand All @@ -143,14 +174,14 @@ def set_low_power_mode(self, port_num, lpmode):
return True

def reset(self, port_num):
# Check for invalid QSFP port_num
# Check for invalid port_num
if port_num not in self.osfp_ports:
return False

try:
port_name = self.get_port_name(port_num)
port_name = self._get_port_name(port_num)
reg_file = open("/".join([self.PORT_INFO_PATH,
port_name, "qsfp_reset"]), "w")
port_name, "qsfp_resetL"]), "w")
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
Expand All @@ -166,7 +197,7 @@ def reset(self, port_num):
# Flip the bit back high and write back to the register to take port out of reset
try:
reg_file = open(
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w")
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_resetL"]), "w")
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"skip_ledd": true
"skip_fancontrol": true,
"skip_ledd": true,
"skip_psud": false,
"skip_syseepromd": false,
"skip_thermalctld": false,
"skip_xcvrd": false
}
Loading