diff options
author | Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com> | 2022-11-03 10:40:43 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-02-02 22:45:09 +0300 |
commit | 0528ecd60ca357896da8b993291ed7a725ef0102 (patch) | |
tree | 373b6d472690f2b0d9224db4d58582e7a6fee890 /meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset | |
parent | a576a59a677ee5af5fbc5304190e7d99853835c2 (diff) | |
download | openbmc-0528ecd60ca357896da8b993291ed7a725ef0102.tar.xz |
meta-facebook: phosphor-state-manager: support host power reset and chassis power cycle
Summary:
Add service and script to support host reset and chassis
power cycle.
Tested:
Change property to trigger host and chassis
target and check the power status.
Change-Id: Ie21903f5bc5bbebeaf31153c52d1605cd35619a0
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Diffstat (limited to 'meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset')
-rw-r--r-- | meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset b/meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset new file mode 100644 index 0000000000..f08c1317d6 --- /dev/null +++ b/meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/host-powerreset @@ -0,0 +1,43 @@ +#!/bin/bash + +# Provide source directive to shellcheck. +# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd +source /usr/libexec/power-cmd + +SLOT_ID=$(( $1-1 << 2 )) + +# Host Reboot +host-reboot() +{ + for reset_cmd in "${reset_seq[@]}" + do + result="$(busctl call $SERVICE $OBJECT_PATH $INTERFACE sendRequest yyyyay $SLOT_ID $NETFN $LUN $CMD $DATA_LEN 0x01 0x42 0x01 0 "$reset_cmd")" + echo "$result" + if [ "$reset_cmd" == $POWER_BTN_LOW ] + then + sleep "$1" + fi + done + echo "Host Power Reset" + exit 0 +} + +# Check Host Response and Status +check-response() +{ + response="$(busctl call $SERVICE $OBJECT_PATH $INTERFACE sendRequest yyyyay $SLOT_ID 0x38 $LUN 0x3 0x03 0x15 0xa0 0x00)" + + result=$(echo "$response" | cut -d" " -f $PWRGD_SYS_PWROK_INDEX) + res="$(( "$result" & 0x80 ))" + pgood="$(( "$res" >> 7 ))" + if [ "$pgood" == $STATE_ON ] + then + host-reboot 1 + exit 0; + else + echo "Host is Off" + exit 1; + fi +} + +check-response |