Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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