diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index 0823b7c86d..1f1b7609b7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -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 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin index e32747c7fe..683dcc6733 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin @@ -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 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_reboot_override b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_reboot_override index dc681104da..b47382a38b 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_reboot_override +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_reboot_override @@ -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(): diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin new file mode 100755 index 0000000000..4ccfecdfe2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin @@ -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 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh index 775c0c8d05..691b63a4a7 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh @@ -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(){ @@ -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 @@ -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 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index 4527f69473..7f07739e7d 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -99,6 +99,7 @@ class Chassis(ChassisBase): 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 @@ -257,6 +258,8 @@ class Chassis(ChassisBase): 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):