From 9a7eb495c2ad04323e5fd2946b62f209a73421f7 Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Thu, 3 Aug 2023 08:20:53 +0800 Subject: [PATCH] [E1031] add platform specific reboot command support (#15889) * [E1031] add platform specific reboot command support Why I did it E1031: add platform specific cold reboot support How I did it Use the CPLD to trigger board level power cycle when cold reboot How to verify it Do reboot stress test and check the reboot cause history * [E1031] try to umount filesystem before power cycle reboot * [E1031] remove fstrim in customized reboot script --- device/celestica/x86_64-cel_e1031-r0/platform_reboot | 9 +++++++++ .../x86_64-cel_e1031-r0/platform_update_reboot_cause | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100755 device/celestica/x86_64-cel_e1031-r0/platform_reboot create mode 100755 device/celestica/x86_64-cel_e1031-r0/platform_update_reboot_cause diff --git a/device/celestica/x86_64-cel_e1031-r0/platform_reboot b/device/celestica/x86_64-cel_e1031-r0/platform_reboot new file mode 100755 index 000000000000..3bcaf6a8af09 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/platform_reboot @@ -0,0 +1,9 @@ +#!/bin/bash + +declare -r CPLD_SETREG_PATH="/sys/bus/platform/devices/e1031.smc/setreg" + +sync ; sync +umount -fa > /dev/null 2&>1 + +# Board level power cycle +echo "0x0113 0xAA" > ${CPLD_SETREG_PATH} diff --git a/device/celestica/x86_64-cel_e1031-r0/platform_update_reboot_cause b/device/celestica/x86_64-cel_e1031-r0/platform_update_reboot_cause new file mode 100755 index 000000000000..9ffb2129c87f --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/platform_update_reboot_cause @@ -0,0 +1,8 @@ +#!/bin/bash + +REBOOT_USER=$(logname) +REBOOT_TIME=$(date) +declare -r REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt" + +echo "User issued 'reboot' with platform-specific command [User: ${REBOOT_USER}, Time: ${REBOOT_TIME}]" > ${REBOOT_CAUSE_FILE} +sync