[DellEMC] S6100 Reboot cause determining CPU reset in fast-reboot (#8024)

Why I did it
Added a check in determining CPU reset in fast-/warm-reboot in their respective platform plugin.
Introducing reboot plugin for "reboot" command to handle its own platform plugin.
How I did it
On branch s6100_fast_warm_check
Changes to be committed:
(use "git reset HEAD ..." to unstage)

    modified:   ../../debian/platform-modules-s6100.install
    modified:   ../scripts/fast-reboot_plugin
    modified:   ../scripts/platform_reboot_override
    new file:   ../scripts/reboot_plugin
    modified:   ../scripts/track_reboot_reason.sh
    modified:   chassis.py
How to verify it
Triggered cold-reset inside fast-reboot to test out the reboot-cause 2.0 API.
This commit is contained in:
Santhosh Kumar T 2021-08-05 03:05:36 +05:30 committed by GitHub
parent 81ab2f1bbb
commit e5a64463fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 5 deletions

View File

@ -10,6 +10,7 @@ s6100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6100_
s6100/scripts/fast-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/fast-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/track_reboot_reason.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/warm-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/warm-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/ssd-fw-upgrade usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/ssd-fw-upgrade usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
common/dell_lpc_mon.sh usr/local/bin common/dell_lpc_mon.sh usr/local/bin

View File

@ -4,4 +4,8 @@ if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then
cd /sys/devices/platform/SMF.512/hwmon/* cd /sys/devices/platform/SMF.512/hwmon/*
echo 0xcc > mb_poweron_reason echo 0xcc > mb_poweron_reason
fi fi
io_rd_wr.py --set --val 40 --offset 0x131
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --set --val aa --offset 213
/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null /usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null

View File

@ -7,8 +7,8 @@ PORT_RES = '/dev/port'
def log_software_reboot(): def log_software_reboot():
# Run plugin script which will track the cli triggered reboot, fastboot, warmboot # Run plugin script which will track the cli triggered reboot
res = subprocess.check_output(['/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0/fast-reboot_plugin']) res = subprocess.check_output(['/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0/reboot_plugin'])
return return
def ssd_hdparm_upgrade(): def ssd_hdparm_upgrade():

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then
cd /sys/devices/platform/SMF.512/hwmon/*
echo 0xcc > mb_poweron_reason
fi
/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null

View File

@ -131,7 +131,29 @@ _is_unknown_reset(){
mb_poweron_reason=$(cat $MAILBOX_POWERON_REASON) mb_poweron_reason=$(cat $MAILBOX_POWERON_REASON)
echo "Unknown POR: $curr_poweron_reason RST: $curr_reset_reason MBR: $mb_poweron_reason" > $REBOOT_CAUSE_FILE echo "Unknown POR: $curr_poweron_reason RST: $curr_reset_reason MBR: $mb_poweron_reason" > $REBOOT_CAUSE_FILE
fi fi
}
_is_software_reboot(){
SMF_STATUS=`io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --get --offset 212`
SMF_STATUS=$(echo "$SMF_STATUS" | awk '{print $NF}')
CPLD_STATUS=`io_rd_wr.py --get --offset 0x131`
CPLD_STATUS=$(echo "$CPLD_STATUS" | awk '{print $NF}')
if [[ $SMF_STATUS == "aa" ]]; then
if [[ $CPLD_STATUS != "40" ]]; then
# Cold reset happened; Resetting the registers
io_rd_wr.py --set --val ff --offset 0x131
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --set --val ff --offset 213
echo 0x88 > $MAILBOX_POWERON_REASON
else
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --set --val ff --offset 213
echo 0xaa > $MAILBOX_POWERON_REASON
fi
else
echo 0xaa > $MAILBOX_POWERON_REASON
fi
} }
update_mailbox_register(){ update_mailbox_register(){
@ -162,7 +184,7 @@ update_mailbox_register(){
&& [[ $SMF_FPGA_VERSION_MAJOR -ge 1 ]] && [[ $SMF_FPGA_VERSION_MINOR -ge 4 ]]; then && [[ $SMF_FPGA_VERSION_MAJOR -ge 1 ]] && [[ $SMF_FPGA_VERSION_MINOR -ge 4 ]]; then
if [[ $reason = "cc" ]]; then if [[ $reason = "cc" ]]; then
echo 0xaa > $MAILBOX_POWERON_REASON _is_software_reboot
elif [[ $SMF_RESET = "11" ]]; then elif [[ $SMF_RESET = "11" ]]; then
echo 0xee > $MAILBOX_POWERON_REASON echo 0xee > $MAILBOX_POWERON_REASON
elif [[ $SMF_RESET = "33" ]]; then elif [[ $SMF_RESET = "33" ]]; then
@ -185,7 +207,7 @@ update_mailbox_register(){
elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then
echo 0xdd > $MAILBOX_POWERON_REASON echo 0xdd > $MAILBOX_POWERON_REASON
elif [[ $reason = "cc" ]]; then elif [[ $reason = "cc" ]]; then
echo 0xaa > $MAILBOX_POWERON_REASON _is_software_reboot
else else
_is_unknown_reset $is_thermal_reboot _is_unknown_reset $is_thermal_reboot
echo 0x99 > $MAILBOX_POWERON_REASON echo 0x99 > $MAILBOX_POWERON_REASON

View File

@ -99,6 +99,7 @@ class Chassis(ChassisBase):
def _get_reboot_reason_smf_register(self): def _get_reboot_reason_smf_register(self):
# In S6100, mb_poweron_reason register will # In S6100, mb_poweron_reason register will
# Returns 0xaa or 0xcc on software reload # Returns 0xaa or 0xcc on software reload
# Returns 0x88 on cold-reboot happened during software reload
# Returns 0xff or 0xbb on power-cycle # Returns 0xff or 0xbb on power-cycle
# Returns 0xdd on Watchdog # Returns 0xdd on Watchdog
# Returns 0xee on Thermal Shutdown # Returns 0xee on Thermal Shutdown
@ -257,6 +258,8 @@ class Chassis(ChassisBase):
return (ChassisBase.REBOOT_CAUSE_POWER_LOSS, None) return (ChassisBase.REBOOT_CAUSE_POWER_LOSS, None)
elif ((smf_mb_reg_reason == 0xaa) or (smf_mb_reg_reason == 0xcc)): elif ((smf_mb_reg_reason == 0xaa) or (smf_mb_reg_reason == 0xcc)):
return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None) return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None)
elif (smf_mb_reg_reason == 0x88):
return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "CPU Reset")
elif (smf_mb_reg_reason == 0xdd): elif (smf_mb_reg_reason == 0xdd):
return (ChassisBase.REBOOT_CAUSE_WATCHDOG, None) return (ChassisBase.REBOOT_CAUSE_WATCHDOG, None)
elif (smf_mb_reg_reason == 0xee): elif (smf_mb_reg_reason == 0xee):