From d64de2f909b0ce4a4ccbda0b429f31b64d4aac56 Mon Sep 17 00:00:00 2001 From: Mykola Faryma Date: Fri, 9 Aug 2019 14:19:37 +0300 Subject: [PATCH 1/4] [Mellanox] add platform_reboot for SimX platform Signed-off-by: Mykola Faryma --- .../platform_reboot | 22 ++++++++++++++++++- .../platform_reboot | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) mode change 120000 => 100755 device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot diff --git a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot deleted file mode 120000 index 43c8ea5674..0000000000 --- a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot +++ /dev/null @@ -1 +0,0 @@ -../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot new file mode 100755 index 0000000000..5b9809e104 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_reboot @@ -0,0 +1,21 @@ +#!/bin/bash + +declare -r EXIT_SUCCESS="0" +declare -r EXIT_ERROR="1" + +FORCE_REBOOT="no" + +function ParseArguments() { + while [ $# -ge 1 ]; do + case "$1" in + -f|--force) + FORCE_REBOOT="yes" + ;; + esac + shift + done +} + +ParseArguments "$@" + +exec /sbin/reboot $@ diff --git a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_reboot index d66ab7537b..dfaf534176 120000 --- a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_reboot @@ -1 +1 @@ -../x86_64-mlnx_msn3700-r0/platform_reboot \ No newline at end of file +../x86_64-mlnx_msn2700_simx-r0/platform_reboot \ No newline at end of file From 7455d19729ddba9a2fe456d76b33905e50c314e9 Mon Sep 17 00:00:00 2001 From: Mykola Faryma Date: Fri, 9 Aug 2019 14:42:19 +0300 Subject: [PATCH 2/4] [Mellanox] allign platform reboot to use "hardware reboot" Signed-off-by: Mykola Faryma --- device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index 58ead64023..74427fb59c 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -20,7 +20,7 @@ function ParseArguments() { ParseArguments "$@" -${FW_UPGRADE_SCRIPT} --upgrade +${FW_UPGRADE_SCRIPT} --upgrade --verbose EXIT_CODE="$?" if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then echo "Failed to burn MLNX FW: errno=${EXIT_CODE}" @@ -31,4 +31,7 @@ if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then fi fi -exec /sbin/reboot $@ +# perform "hardware" reboot +echo 1 > /var/run/hw-management/system/pwr_cycle +sleep 3 +echo 0 > /var/run/hw-management/system/pwr_cycle From 61b3bb0e6cbafa948764e25ea209e8e841839c06 Mon Sep 17 00:00:00 2001 From: Mykola Faryma Date: Tue, 13 Aug 2019 16:27:43 +0300 Subject: [PATCH 3/4] use sysfs path instead of bsp symlink Signed-off-by: Mykola Faryma --- device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index 74427fb59c..45022a7baf 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -4,6 +4,7 @@ declare -r EXIT_SUCCESS="0" declare -r EXIT_ERROR="1" declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" +declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon1/pwr_cycle" FORCE_REBOOT="no" @@ -32,6 +33,6 @@ if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then fi # perform "hardware" reboot -echo 1 > /var/run/hw-management/system/pwr_cycle +echo 1 > $SYSFS_PWR_CYCLE sleep 3 -echo 0 > /var/run/hw-management/system/pwr_cycle +echo 0 > $SYSFS_PWR_CYCLE From 01c038fdb38bf8d0469eaaee92f1dae79b8b2220 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Thu, 15 Aug 2019 16:16:44 +0300 Subject: [PATCH 4/4] use an asterisk --- device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index 45022a7baf..d310210497 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -4,7 +4,7 @@ declare -r EXIT_SUCCESS="0" declare -r EXIT_ERROR="1" declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" -declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon1/pwr_cycle" +declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pwr_cycle" FORCE_REBOOT="no"