Skip to content

Commit

Permalink
[DellEMC] S6100 Reboot cause determining CPU reset in fast-reboot (so…
Browse files Browse the repository at this point in the history
…nic-net#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.
  • Loading branch information
santhosh-kt authored and Carl Keene committed Aug 7, 2021
1 parent 45cbf9d commit 9b7ea4e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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/override.conf /etc/systemd/system/systemd-reboot.service.d
common/dell_lpc_mon.sh usr/local/bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then
cd /sys/devices/platform/SMF.512/hwmon/*
echo 0xcc > mb_poweron_reason
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ PORT_RES = '/dev/port'


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

def ssd_hdparm_upgrade():
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,29 @@ _is_unknown_reset(){
mb_poweron_reason=$(cat $MAILBOX_POWERON_REASON)
echo "Unknown POR: $curr_poweron_reason RST: $curr_reset_reason MBR: $mb_poweron_reason" > $REBOOT_CAUSE_FILE
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(){
Expand Down Expand Up @@ -162,7 +184,7 @@ update_mailbox_register(){
&& [[ $SMF_FPGA_VERSION_MAJOR -ge 1 ]] && [[ $SMF_FPGA_VERSION_MINOR -ge 4 ]]; then

if [[ $reason = "cc" ]]; then
echo 0xaa > $MAILBOX_POWERON_REASON
_is_software_reboot
elif [[ $SMF_RESET = "11" ]]; then
echo 0xee > $MAILBOX_POWERON_REASON
elif [[ $SMF_RESET = "33" ]]; then
Expand All @@ -185,7 +207,7 @@ update_mailbox_register(){
elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then
echo 0xdd > $MAILBOX_POWERON_REASON
elif [[ $reason = "cc" ]]; then
echo 0xaa > $MAILBOX_POWERON_REASON
_is_software_reboot
else
_is_unknown_reset $is_thermal_reboot
echo 0x99 > $MAILBOX_POWERON_REASON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(self):
def _get_reboot_reason_smf_register(self):
# In S6100, mb_poweron_reason register will
# Returns 0xaa or 0xcc on software reload
# Returns 0x88 on cold-reboot happened during software reload
# Returns 0xff or 0xbb on power-cycle
# Returns 0xdd on Watchdog
# Returns 0xee on Thermal Shutdown
Expand Down Expand Up @@ -257,6 +258,8 @@ def get_reboot_cause(self):
return (ChassisBase.REBOOT_CAUSE_POWER_LOSS, None)
elif ((smf_mb_reg_reason == 0xaa) or (smf_mb_reg_reason == 0xcc)):
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):
return (ChassisBase.REBOOT_CAUSE_WATCHDOG, None)
elif (smf_mb_reg_reason == 0xee):
Expand Down

0 comments on commit 9b7ea4e

Please sign in to comment.