From c7a952ac48c7ccc5e3bb566c364953a353934de7 Mon Sep 17 00:00:00 2001 From: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> Date: Tue, 1 Dec 2020 23:15:11 +0000 Subject: [PATCH] DellEMC S6100: Update reboot-cause determination to support new firmware (#5807) - Why I did it For determining reboot-cause while running newer BIOS, SMF firmware. - How I did it Made changes in reboot-cause determination script to add support for behavior of newer firmware. - How to verify it Performed different type of resets and verified "show reboot-cause" provides the correct reason. Logs: UT_logs.txt - Description for the changelog DellEMC S6100: Update reboot-cause determination to support new firmware --- .../s6100/scripts/track_reboot_reason.sh | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) 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 27ea355347..775c0c8d05 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 @@ -8,6 +8,7 @@ nvram_missing=0 REBOOT_CAUSE_FILE=/host/reboot-cause/reboot-cause.txt REBOOT_REASON_FILE=/host/reboot-cause/platform/reboot_reason BIOS_VERSION_FILE=/host/reboot-cause/platform/bios_minor_version +SMF_MSS_VERSION_FILE=/sys/devices/platform/SMF.512/hwmon/*/smf_firmware_ver SMF_POWERON_REASON=/sys/devices/platform/SMF.512/hwmon/*/smf_poweron_reason SMF_RESET_REASON=/sys/devices/platform/SMF.512/hwmon/*/smf_reset_reason MAILBOX_POWERON_REASON=/sys/devices/platform/SMF.512/hwmon/*/mb_poweron_reason @@ -34,6 +35,7 @@ if [[ -d /host/reboot-cause/platform ]]; then fi fi +SMF_FPGA_VERSION=$((16#$(io_rd_wr.py --get --offset 0x200 | cut -d " " -f 3))) SMF_BIOS_REG=$(io_rd_wr.py --get --offset 0x203 | cut -d " " -f 3) SMF_BIOS_REG=$((16#$SMF_BIOS_REG)) bios_secondary_boot=$(($SMF_BIOS_REG & 1)) @@ -143,27 +145,51 @@ update_mailbox_register(){ _get_smf_reset_register if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then - is_thermal_reboot=$(_is_thermal_reset) - - is_wd_reboot=$(_is_watchdog_reset) - por=$(cat $SMF_POWERON_REASON) rst=$(cat $SMF_RESET_REASON) mbr=$(cat $MAILBOX_POWERON_REASON) reason=$(echo $mbr | cut -d 'x' -f2) logger -p user.info -t DELL_S6100_REBOOT_CAUSE "POR: $por, RST: $rst, MBR: $mbr" - if [[ $reason = "ff" ]]; then - echo "None" > $REBOOT_REASON_FILE - echo 0xbb > $MAILBOX_POWERON_REASON - elif [[ $is_thermal_reboot = 1 ]]; then - echo 0xee > $MAILBOX_POWERON_REASON - elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then - echo 0xdd > $MAILBOX_POWERON_REASON - elif [[ $reason = "cc" ]]; then - echo 0xaa > $MAILBOX_POWERON_REASON + + SMF_MSS_VERSION=$(cat $SMF_MSS_VERSION_FILE) + SMF_MSS_VERSION_MAJOR=$(echo $SMF_MSS_VERSION | cut -d '.' -f1) + SMF_MSS_VERSION_MINOR=$(echo $SMF_MSS_VERSION | cut -d '.' -f2) + SMF_FPGA_VERSION_MAJOR=$(( (SMF_FPGA_VERSION & 0xF0) >> 4 )) + SMF_FPGA_VERSION_MINOR=$(( SMF_FPGA_VERSION & 0x0F )) + + if [[ -e $BIOS_VERSION_FILE ]] \ + && [[ $SMF_MSS_VERSION_MAJOR -ge 2 ]] && [[ $SMF_MSS_VERSION_MINOR -ge 7 ]] \ + && [[ $SMF_FPGA_VERSION_MAJOR -ge 1 ]] && [[ $SMF_FPGA_VERSION_MINOR -ge 4 ]]; then + + if [[ $reason = "cc" ]]; then + echo 0xaa > $MAILBOX_POWERON_REASON + elif [[ $SMF_RESET = "11" ]]; then + echo 0xee > $MAILBOX_POWERON_REASON + elif [[ $SMF_RESET = "33" ]]; then + echo 0xdd > $MAILBOX_POWERON_REASON + else + echo "Unknown software reboot" > $REBOOT_CAUSE_FILE + echo 0x99 > $MAILBOX_POWERON_REASON + fi + else - _is_unknown_reset $is_thermal_reboot - echo 0x99 > $MAILBOX_POWERON_REASON + is_thermal_reboot=$(_is_thermal_reset) + + is_wd_reboot=$(_is_watchdog_reset) + + if [[ $reason = "ff" ]]; then + echo "None" > $REBOOT_REASON_FILE + echo 0xbb > $MAILBOX_POWERON_REASON + elif [[ $is_thermal_reboot = 1 ]]; then + echo 0xee > $MAILBOX_POWERON_REASON + elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then + echo 0xdd > $MAILBOX_POWERON_REASON + elif [[ $reason = "cc" ]]; then + echo 0xaa > $MAILBOX_POWERON_REASON + else + _is_unknown_reset $is_thermal_reboot + echo 0x99 > $MAILBOX_POWERON_REASON + fi fi fi }