Skip to content

Commit

Permalink
[Author]:[email protected] [Jira ID]:N/A [Description]: fix the …
Browse files Browse the repository at this point in the history
…watchdog API issue
  • Loading branch information
nicwu-cel committed May 9, 2022
1 parent 6f31f8b commit c5ebd2f
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 35 deletions.
2 changes: 1 addition & 1 deletion device/celestica/x86_64-cel_belgite-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=9600
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off module_blacklist=gpio_ich,i2c-ismt,i2c_ismt,i2c-i801,i2c_i801 crashkernel=0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M acpi_no_watchdog"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off module_blacklist=gpio_ich crashkernel=0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M acpi_no_watchdog"
40 changes: 16 additions & 24 deletions device/celestica/x86_64-cel_belgite-r0/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"name": "Fantray1_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -31,7 +31,7 @@
{
"name": "Fantray2_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -41,7 +41,7 @@
{
"name": "Fantray3_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -51,7 +51,7 @@
{
"name": "Fantray1_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -61,7 +61,7 @@
{
"name": "Fantray2_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -71,7 +71,7 @@
{
"name": "Fantray3_1",
"speed": {
"controllable": false
"controllable": true
},
"status_led": {
"controllable": true,
Expand All @@ -86,8 +86,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
},
"max_consumed_power": false,
"fans": [
Expand All @@ -97,8 +96,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
}
}
]
Expand All @@ -109,8 +107,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
},
"max_consumed_power": false,
"fans": [
Expand All @@ -120,8 +117,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
}
}
]
Expand All @@ -132,8 +128,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
},
"max_consumed_power": false,
"fans": [
Expand All @@ -143,8 +138,7 @@
"controllable": false
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
"controllable": false
}
}
]
Expand All @@ -157,9 +151,7 @@
{
"name": "PSU1_FAN1",
"speed": {
"controllable": true,
"minimum": 25,
"maximum": 100
"controllable": false
},
"status_led": {
"controllable": false
Expand All @@ -172,6 +164,7 @@
"voltage_high_threshold": false,
"voltage_low_threshold": false,
"temperature": false,
"fans_target_speed": false,
"status_led": {
"controllable": false
}
Expand All @@ -182,9 +175,7 @@
{
"name": "PSU2_FAN1",
"speed": {
"controllable": true,
"minimum": 25,
"maximum": 100
"controllable": false
},
"status_led": {
"controllable": false
Expand All @@ -197,6 +188,7 @@
"voltage_high_threshold": false,
"voltage_low_threshold": false,
"temperature": false,
"fans_target_speed": false,
"status_led": {
"controllable": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/delay.h>
#include <linux/jiffies.h>

#define EEPROM_SIZE 8192 //mc24lt64t eeprom size in bytes.
#define EEPROM_SIZE 256 //mc24lt64t eeprom size in bytes.

struct mc24lc64t_data {
struct mutex update_lock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,9 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
new_timeout = new_timeout*1000;
if (watchdog_set_timeout(p, new_timeout))
return -EINVAL;
//watchdog_keepalive(p);
/* Fall */
return 0;

val = watchdog_get_timeout(p);
return put_user(val, uarg.i);
case WDIOC_GETTIMEOUT:
val = watchdog_get_timeout(p);
return put_user(val, uarg.i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@
from sonic_platform.watchdog import Watchdog
import sys
import subprocess
from sonic_py_common import device_info
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

NUM_COMPONENT = 3
FAN_DIRECTION_FILE_PATH = "/var/fan_direction"


class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""

def __init__(self, pddf_data=None, pddf_plugin_data=None):

PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
vendor_ext = self._eeprom.vendor_ext_str()
with open(FAN_DIRECTION_FILE_PATH, "w+") as f:
f.write(vendor_ext)
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

self.__initialize_components()

Expand Down Expand Up @@ -74,9 +76,11 @@ def get_watchdog(self):
An object derived from WatchdogBase representing the hardware
watchdog device
"""
self._watchdog = Watchdog()
if self._watchdog is None:
self._watchdog = Watchdog()

return self._watchdog

def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
Expand Down Expand Up @@ -138,3 +142,21 @@ def get_base_mac(self):
def get_system_eeprom_info(self):
return self._eeprom.system_eeprom_info()

def get_name(self):
return self.modelstr()

def get_model(self):
return self._eeprom.part_number_str()

def set_status_led(self, color):
color_dict = {
'green': "STATUS_LED_COLOR_GREEN",
'red': "STATUS_LED_COLOR_AMBER",
'amber': "STATUS_LED_COLOR_AMBER",
'off': "STATUS_LED_COLOR_OFF"
}
return self.set_system_led("SYS_LED", color_dict.get(color, "off"))

def get_status_led(self):
return self.get_system_led("SYS_LED")

Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,28 @@ def install_firmware(self, image_path):
return False

def update_firmware(self, image_path):
return False

def get_available_firmware_version(self, image_path):
return 'N/A'

def get_firmware_update_notification(self, image_path):
return "None"

def get_model(self):
return 'N/A'

def get_position_in_parent(self):
return -1

def get_presence(self):
return True

def get_serial(self):
return 'N/A'

def get_status(self):
return True

def is_replaceable(self):
return False
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ def set_status_led(self, color):

def get_status_led(self, color=None):
return self._fan_list[0].get_status_led()

def get_serial(self):
serial = "Unknown"
return serial

def get_model(self):
model = "Unknown"
return model
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ def get_position_in_parent(self):
return self.psu_index

def get_revision(self):

return "N/A"

def temperature(self):
return self.get_temperature()
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ def arm(self, seconds):
try:
if self.timeout != seconds:
self.timeout = self._settimeout(seconds)

if self.armed:
self._keepalive()
else:
self._settimeout(seconds)
self._enable()
self.armed = True

ret = self.timeout
except IOError as e:
pass

return ret

def disarm(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
modprobe -r i2c_ismt
modprobe -r i2c-i801
sleep 0.1
modprobe -r i2c-i801
sleep 0.1

0 comments on commit c5ebd2f

Please sign in to comment.