35
35
REBOOT_CAUSE_REG = "0xA106"
36
36
TLV_EEPROM_I2C_BUS = 0
37
37
TLV_EEPROM_I2C_ADDR = 56
38
-
39
38
BASE_CPLD_PLATFORM = "questone2bd.cpldb"
40
39
BASE_GETREG_PATH = "/sys/devices/platform/{}/getreg" .format (BASE_CPLD_PLATFORM )
41
40
@@ -52,12 +51,12 @@ def __init__(self):
52
51
ChassisBase .__init__ (self )
53
52
self ._api_helper = APIHelper ()
54
53
self .sfp_module_initialized = False
54
+ self .__initialize_eeprom ()
55
55
self .POLL_INTERVAL = 1
56
56
57
57
if not self ._api_helper .is_host ():
58
58
self .__initialize_fan ()
59
59
self .__initialize_psu ()
60
- self .__initialize_eeprom ()
61
60
self .__initialize_thermals ()
62
61
self .__initialize_interrupts ()
63
62
else :
@@ -176,33 +175,19 @@ def get_reboot_cause(self):
176
175
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
177
176
to pass a description of the reboot cause.
178
177
"""
179
-
180
- raw_cause = self ._api_helper .get_register_value (
178
+ hx_cause = self ._api_helper .get_register_value (
181
179
BASE_GETREG_PATH , REBOOT_CAUSE_REG )
182
- hx_cause = raw_cause .lower ()
183
- reboot_cause = {
184
- "0x00" : self .REBOOT_CAUSE_HARDWARE_OTHER ,
185
- "0x11" : self .REBOOT_CAUSE_POWER_LOSS ,
186
- "0x22" : self .REBOOT_CAUSE_NON_HARDWARE ,
187
- "0x33" : self .REBOOT_CAUSE_HARDWARE_OTHER ,
188
- "0x44" : self .REBOOT_CAUSE_NON_HARDWARE ,
189
- "0x55" : self .REBOOT_CAUSE_NON_HARDWARE ,
190
- "0x66" : self .REBOOT_CAUSE_WATCHDOG ,
191
- "0x77" : self .REBOOT_CAUSE_NON_HARDWARE
192
- }.get (hx_cause , self .REBOOT_CAUSE_HARDWARE_OTHER )
193
-
194
- description = {
195
- "0x00" : "Unknown reason" ,
196
- "0x11" : "The last reset is Power on reset" ,
197
- "0x22" : "The last reset is soft-set CPU warm reset" ,
198
- "0x33" : "The last reset is soft-set CPU cold reset" ,
199
- "0x44" : "The last reset is CPU warm reset" ,
200
- "0x55" : "The last reset is CPU cold reset" ,
201
- "0x66" : "The last reset is watchdog reset" ,
202
- "0x77" : "The last reset is power cycle reset"
203
- }.get (hx_cause , "Unknown reason" )
204
-
205
- return (reboot_cause , description )
180
+
181
+ return {
182
+ "0x00" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'Unknown' ),
183
+ "0x11" : (self .REBOOT_CAUSE_POWER_LOSS , 'The last reset is Power on reset' ),
184
+ "0x22" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'The last reset is soft-set CPU warm reset' ),
185
+ "0x33" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'The last reset is soft-set CPU cold reset' ),
186
+ "0x44" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'The last reset is CPU warm reset' ),
187
+ "0x55" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'The last reset is CPU cold reset' ),
188
+ "0x66" : (self .REBOOT_CAUSE_WATCHDOG , 'The last reset is watchdog reset' ),
189
+ "0x77" : (self .REBOOT_CAUSE_HARDWARE_OTHER , 'The last reset is power cycle reset' ),
190
+ }.get (hx_cause .lower (), (self .REBOOT_CAUSE_HARDWARE_OTHER , 'Unknown' ))
206
191
207
192
##############################################################
208
193
######################## SFP methods #########################
0 commit comments