Skip to content

Commit fa89c6d

Browse files
DellEMC: S6100, S6000 - Enable thermalctld, Platform API implementation and fixes (#6438)
**- Why I did it** To incorporate the below changes in DellEMC S6100, S6000 platforms. - S6100, S6000: - Enable 'thermalctld' - Implement DeviceBase methods (presence, status, model, serial) for Fantray and Component - Implement ‘get_position_in_parent’, ‘is_replaceable’ methods for all device types - Implement ‘get_status’ method for Fantray - Implement ‘get_temperature’, ‘get_temperature_high_threshold’, ‘get_voltage_high_threshold’, ‘get_voltage_low_threshold’ methods for PSU - Implement ‘get_status_led’, ‘set_status_led’ methods for Chassis - SFP: - Make EEPROM read both Python2 and Python3 compatible - Fix ‘get_tx_disable_channel’ method’s return type - Implement ‘tx_disable’, ‘tx_disable_channel’ and ‘set_power_override’ methods - S6000: - Move PSU thermal sensors from Chassis to respective PSU - Make available the data of both Fans present in each Fantray **- How I did it** - Remove 'skip_thermalctld:true' in pmon_daemon_control.json - Implement the platform API methods in the respective device files - Use `bytearray` for data read from transceiver EEPROM - Change return type of 'get_tx_disable_channel' to match specification in sonic_platform_common/sfp_base.py
1 parent 85a6314 commit fa89c6d

File tree

19 files changed

+1084
-280
lines changed

19 files changed

+1084
-280
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"skip_ledd": true,
3-
"skip_thermalctld": true
2+
"skip_ledd": true
43
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"skip_ledd": true,
3-
"skip_thermalctld": true
2+
"skip_ledd": true
43
}

platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c

+46
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
/* Mailbox PowerOn Reason */
175175
#define TRACK_POWERON_REASON 0x05FF
176176

177+
/* System Status LED */
178+
#define SYSTEM_STATUS_LED 0x04DF
179+
177180
/* CPU Set IO Modules */
178181
#define CPU_IOM1_CTRL_FLAG 0x04D9
179182
#define CPU_IOM2_CTRL_FLAG 0x04DA
@@ -607,6 +610,44 @@ static ssize_t show_mb_poweron_reason(struct device *dev,
607610
return sprintf(buf, "0x%x\n", ret);
608611
}
609612

613+
/* System Status LED */
614+
static ssize_t set_sys_status_led(struct device *dev,
615+
struct device_attribute *devattr, const char *buf, size_t count)
616+
{
617+
int err = 0;
618+
unsigned int dev_data = 0;
619+
struct smf_data *data = dev_get_drvdata(dev);
620+
621+
if (data->kind == z9100smf)
622+
return -1;
623+
624+
err = kstrtouint(buf, 16, &dev_data);
625+
if (err)
626+
return err;
627+
628+
err = smf_write_reg(data, SYSTEM_STATUS_LED, dev_data);
629+
if(err < 0)
630+
return err;
631+
632+
return count;
633+
}
634+
635+
static ssize_t show_sys_status_led(struct device *dev,
636+
struct device_attribute *devattr, char *buf)
637+
{
638+
unsigned int ret = 0;
639+
struct smf_data *data = dev_get_drvdata(dev);
640+
641+
if (data->kind == z9100smf)
642+
return 0;
643+
644+
ret = smf_read_reg(data, SYSTEM_STATUS_LED);
645+
if(ret < 0)
646+
return ret;
647+
648+
return sprintf(buf, "0x%x\n", ret);
649+
}
650+
610651
/* FANIN ATTR */
611652
static ssize_t
612653
show_fan_label(struct device *dev, struct device_attribute *attr, char *buf)
@@ -2081,12 +2122,17 @@ static SENSOR_DEVICE_ATTR(smf_poweron_reason, S_IRUGO,
20812122
static SENSOR_DEVICE_ATTR(mb_poweron_reason, S_IRUGO|S_IWUSR,
20822123
show_mb_poweron_reason, set_mb_poweron_reason, 0);
20832124

2125+
/* System Status LED */
2126+
static SENSOR_DEVICE_ATTR(sys_status_led, S_IRUGO|S_IWUSR,
2127+
show_sys_status_led, set_sys_status_led, 0);
2128+
20842129
static struct attribute *smf_dell_attrs[] = {
20852130
&sensor_dev_attr_smf_version.dev_attr.attr,
20862131
&sensor_dev_attr_smf_firmware_ver.dev_attr.attr,
20872132
&sensor_dev_attr_smf_reset_reason.dev_attr.attr,
20882133
&sensor_dev_attr_smf_poweron_reason.dev_attr.attr,
20892134
&sensor_dev_attr_mb_poweron_reason.dev_attr.attr,
2135+
&sensor_dev_attr_sys_status_led.dev_attr.attr,
20902136
&sensor_dev_attr_fan_tray_presence.dev_attr.attr,
20912137
&sensor_dev_attr_fan1_airflow.dev_attr.attr,
20922138
&sensor_dev_attr_fan3_airflow.dev_attr.attr,

platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py

+75-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
MAX_S6000_FANTRAY = 3
2626
MAX_S6000_PSU = 2
27-
MAX_S6000_THERMAL = 10
27+
MAX_S6000_THERMAL = 6
2828
MAX_S6000_COMPONENT = 4
2929

3030

@@ -44,6 +44,8 @@ class Chassis(ChassisBase):
4444

4545
def __init__(self):
4646
ChassisBase.__init__(self)
47+
self.status_led_reg = "system_led"
48+
self.supported_led_color = ['green', 'blinking green', 'amber', 'blinking amber']
4749
# Initialize SFP list
4850
self.PORT_START = 0
4951
self.PORT_END = 31
@@ -101,13 +103,30 @@ def _get_cpld_register(self, reg_name):
101103
try:
102104
with open(mb_reg_file, 'r') as fd:
103105
rv = fd.read()
104-
except Exception as error:
106+
except IOError:
105107
rv = 'ERR'
106108

107109
rv = rv.rstrip('\r\n')
108110
rv = rv.lstrip(" ")
109111
return rv
110112

113+
def _set_cpld_register(self, reg_name, value):
114+
# On successful write, returns the value will be written on
115+
# reg_name and on failure returns 'ERR'
116+
rv = 'ERR'
117+
cpld_reg_file = self.CPLD_DIR+'/'+reg_name
118+
119+
if (not os.path.isfile(cpld_reg_file)):
120+
return rv
121+
122+
try:
123+
with open(cpld_reg_file, 'w') as fd:
124+
rv = fd.write(str(value))
125+
except IOError:
126+
rv = 'ERR'
127+
128+
return rv
129+
111130
def _nvram_write(self, offset, val):
112131
resource = "/dev/nvram"
113132
fd = os.open(resource, os.O_RDWR)
@@ -179,6 +198,23 @@ def get_status(self):
179198
"""
180199
return True
181200

201+
def get_position_in_parent(self):
202+
"""
203+
Retrieves 1-based relative physical position in parent device.
204+
Returns:
205+
integer: The 1-based relative physical position in parent
206+
device or -1 if cannot determine the position
207+
"""
208+
return -1
209+
210+
def is_replaceable(self):
211+
"""
212+
Indicate whether Chassis is replaceable.
213+
Returns:
214+
bool: True if it is replaceable.
215+
"""
216+
return False
217+
182218
def get_base_mac(self):
183219
"""
184220
Retrieves the base MAC address for the chassis
@@ -305,4 +341,41 @@ def get_change_event(self, timeout=0):
305341
return True, ret_dict
306342
return False, ret_dict
307343

344+
def set_status_led(self, color):
345+
"""
346+
Sets the state of the system LED
308347
348+
Args:
349+
color: A string representing the color with which to set the
350+
system LED
351+
352+
Returns:
353+
bool: True if system LED state is set successfully, False if not
354+
"""
355+
if color not in self.supported_led_color:
356+
return False
357+
358+
# Change color string format to the one used by driver
359+
color = color.replace('amber', 'yellow')
360+
color = color.replace('blinking ', 'blink_')
361+
rv = self._set_cpld_register(self.status_led_reg, color)
362+
if (rv != 'ERR'):
363+
return True
364+
else:
365+
return False
366+
367+
def get_status_led(self):
368+
"""
369+
Gets the state of the system LED
370+
371+
Returns:
372+
A string, one of the valid LED color strings which could be vendor
373+
specified.
374+
"""
375+
status_led = self._get_cpld_register(self.status_led_reg)
376+
if (status_led != 'ERR'):
377+
status_led = status_led.replace('yellow', 'amber')
378+
status_led = status_led.replace('blink_', 'blinking ')
379+
return status_led
380+
else:
381+
return None

platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/component.py

+51-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class Component(ComponentBase):
2929
"booting")],
3030
["System-CPLD", "Used for managing CPU board devices and power"],
3131
["Master-CPLD", ("Used for managing Fan, PSU, system LEDs, QSFP "
32-
"modules (1-16)")],
33-
["Slave-CPLD", "Used for managing QSFP modules (17-32)"]
32+
"modules (17-32)")],
33+
["Slave-CPLD", "Used for managing QSFP modules (1-16)"]
3434
]
3535

3636
def __init__(self, component_index):
@@ -90,6 +90,55 @@ def get_name(self):
9090
"""
9191
return self.name
9292

93+
def get_model(self):
94+
"""
95+
Retrieves the part number of the component
96+
Returns:
97+
string: Part number of component
98+
"""
99+
return 'NA'
100+
101+
def get_serial(self):
102+
"""
103+
Retrieves the serial number of the component
104+
Returns:
105+
string: Serial number of component
106+
"""
107+
return 'NA'
108+
109+
def get_presence(self):
110+
"""
111+
Retrieves the presence of the component
112+
Returns:
113+
bool: True if present, False if not
114+
"""
115+
return True
116+
117+
def get_status(self):
118+
"""
119+
Retrieves the operational status of the component
120+
Returns:
121+
bool: True if component is operating properly, False if not
122+
"""
123+
return True
124+
125+
def get_position_in_parent(self):
126+
"""
127+
Retrieves 1-based relative physical position in parent device.
128+
Returns:
129+
integer: The 1-based relative physical position in parent
130+
device or -1 if cannot determine the position
131+
"""
132+
return -1
133+
134+
def is_replaceable(self):
135+
"""
136+
Indicate whether component is replaceable.
137+
Returns:
138+
bool: True if it is replaceable.
139+
"""
140+
return False
141+
93142
def get_description(self):
94143
"""
95144
Retrieves the description of the component

platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
('Fab Rev', 's', 2)
3737
]
3838

39-
# Fan eeprom fields in format required by EepromDecoder
40-
fan_eeprom_format = [
39+
# FanTray eeprom fields in format required by EepromDecoder
40+
fantray_eeprom_format = [
4141
('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7),
4242
('Part Number', 's', 10), ('Part Num Revision', 's', 3),
4343
('Mfg Test', 's', 2), ('Redundant copy', 's', 83),
@@ -51,10 +51,10 @@ class Eeprom(TlvInfoDecoder):
5151

5252
I2C_DIR = "/sys/class/i2c-adapter/"
5353

54-
def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0):
54+
def __init__(self, is_psu=False, psu_index=0, is_fantray=False, fantray_index=0):
5555
self.is_psu_eeprom = is_psu
56-
self.is_fan_eeprom = is_fan
57-
self.is_sys_eeprom = not (is_psu | is_fan)
56+
self.is_fantray_eeprom = is_fantray
57+
self.is_sys_eeprom = not (is_psu | is_fantray)
5858

5959
if self.is_sys_eeprom:
6060
self.start_offset = 0
@@ -71,10 +71,10 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0):
7171
+ "i2c-1/1-005{}/eeprom".format(2 - self.index)
7272
self.format = psu_eeprom_format
7373
else:
74-
self.index = fan_index
74+
self.index = fantray_index
7575
self.eeprom_path = self.I2C_DIR \
7676
+ "i2c-11/11-005{}/eeprom".format(4 - self.index)
77-
self.format = fan_eeprom_format
77+
self.format = fantray_eeprom_format
7878
EepromDecoder.__init__(self, self.eeprom_path, self.format,
7979
self.start_offset, '', True)
8080
self._load_device_eeprom()

0 commit comments

Comments
 (0)