summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh
diff options
context:
space:
mode:
authorjmbills <jason.m.bills@intel.com>2022-01-18 21:55:05 +0300
committerGitHub <noreply@github.com>2022-01-18 21:55:05 +0300
commit7cf0c1cd0ce835d1833509b7b911e8a97380278b (patch)
tree0b45c3beaa9874facc4ed1a2395a31e42be0135d /meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh
parent4dac5fcd49b5e2de1074f1363775ec0f19041072 (diff)
parent1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 (diff)
downloadopenbmc-7cf0c1cd0ce835d1833509b7b911e8a97380278b.tar.xz
Merge pull request #76 from Intel-BMC/update1-0.86
Update
Diffstat (limited to 'meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh')
-rw-r--r--meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh51
1 files changed, 22 insertions, 29 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh b/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh
index 9eeeeca5a..024336d20 100644
--- a/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/mtjade-utils/ampere_host_check.sh
@@ -1,45 +1,38 @@
#!/bin/bash
+# shellcheck source=/dev/null
source /usr/sbin/gpio-defs.sh
source /usr/sbin/gpio-lib.sh
-host_status() {
- st=$(busctl get-property xyz.openbmc_project.State.Host /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host CurrentHostState | cut -d"." -f6)
- if [ "$st" == "Running\"" ]; then
- echo "on"
- else
- echo "off"
- fi
-}
-
createFile=$1
-setState=$2
-if [ $(host_status) == "on" ]; then
- exit 0
+# Check current Host status. Do nothing when the Host is currently ON
+st=$(busctl get-property xyz.openbmc_project.State.Host \
+ /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
+ CurrentHostState | cut -d"." -f6)
+if [ "$st" == "Running\"" ]; then
+ exit 0
fi
# Time out to check S0_FW_BOOT_OK is 60 seconds
cnt=60
val=0
-while [ $cnt -gt 0 ];
+while [ "$cnt" -gt 0 ];
do
- val=$(gpio_get_val $S0_CPU_FW_BOOT_OK)
- cnt=$((cnt - 1))
- echo "$cnt S0_CPU_FW_BOOT_OK = $val"
- if [ $val == 1 ]; then
- # Sleep 5 second before the host is ready
- sleep 5
- if [ $createFile == 1 ]; then
- if [ ! -d "/run/openbmc" ]; then
- mkdir -p /run/openbmc
- fi
- echo "Creating /run/openbmc/host@0-on"
- touch /run/openbmc/host@0-on
- fi
- exit 0
- fi
- sleep 1
+ val=$(gpio_get_val "$S0_CPU_FW_BOOT_OK")
+ cnt=$((cnt - 1))
+ echo "$cnt S0_CPU_FW_BOOT_OK = $val"
+ if [ "$val" == 1 ]; then
+ # Sleep 5 second before the host is ready
+ sleep 5
+ if [ "$createFile" == 1 ]; then
+ mkdir -p /run/openbmc
+ echo "Creating /run/openbmc/host@0-on"
+ touch /run/openbmc/host@0-on
+ fi
+ exit 0
+ fi
+ sleep 1
done
exit 1