meta-facebook: tiogapass: modify power control script
Update power control scripts as per x86 host power control
which is dbus based.
(From meta-facebook rev: 14bcc378fa968fd8c8fbd4de3aa7b568c1899ab0)
Change-Id: I36348f9e54781f377ff509cf9287443db5a78262
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/host-gpio.service b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/host-gpio.service
index 00c116b..82ba12e 100644
--- a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/host-gpio.service
+++ b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/host-gpio.service
@@ -1,5 +1,5 @@
[Unit]
-Description=Configure GPIOs for Host Power Control
+Description=Configure GPIOs for Tiogapass
[Service]
Restart=no
diff --git a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/power-util b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/power-util
index a2261fb..c587bcf 100755
--- a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/power-util
+++ b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/power-util
@@ -5,44 +5,28 @@
echo " power-util sled-cycle"
}
-GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)
-PWR_GPIO=$(($GPIO_BASE + 32 + 3))
-BMC_RDY_GPIO=$(($GPIO_BASE + 144 +1))
-PWR_GOOD=$(($GPIO_BASE + 8 + 6))
-PWR_RESET=$(($GPIO_BASE + 33))
-
power_off() {
echo "Shutting down Server $2"
- echo 1 > /sys/class/gpio/gpio${PWR_GPIO}/value
- sleep 1
- echo 0 > /sys/class/gpio/gpio${PWR_GPIO}/value
- sleep 6
- echo 1 > /sys/class/gpio/gpio${PWR_GPIO}/value
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Off
}
power_on() {
echo "Powering on Server $2"
- echo 0 > /sys/class/gpio/gpio${BMC_RDY_GPIO}/value
- echo 1 > /sys/class/gpio/gpio${PWR_GPIO}/value
- echo 0 > /sys/class/gpio/gpio${PWR_GPIO}/value
- sleep 1
- echo 1 > /sys/class/gpio/gpio${PWR_GPIO}/value
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.On
}
power_status() {
- st=$(cat /sys/class/gpio/gpio${PWR_GOOD}/value)
- if [ "$st" == "0" ]; then
- echo "off"
- else
+ st=$(busctl get-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis CurrentPowerState | cut -d"." -f6)
+ if [ "$st" == "On\"" ]; then
echo "on"
+ else
+ echo "off"
fi
}
power_reset() {
echo "Reset on server $2"
- echo 0 > /sys/class/gpio/gpio${PWR_RESET}/value
- sleep 0.1
- echo 1 > /sys/class/gpio/gpio${PWR_RESET}/value
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Reset
}
sled_cycle() {
diff --git a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
index 1b1b2e3..2624abd 100755
--- a/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
+++ b/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
@@ -14,25 +14,9 @@
GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)
# FM_BMC_READY_N, GPIO S1, active low
-set_gpio_active_low $((${GPIO_BASE} + 144 +1)) high
-
-# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
-#set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high
-
-# FP_PWR_BTN_PASS_R_N, GPIO E3, active low
-set_gpio_active_low $((${GPIO_BASE} + 32 + 3)) high
-
-# FP_PWR_GOOD, GPIO B6, active low
-set_gpio_active_low $((${GPIO_BASE} + 8 + 6)) in
-
-# SYSRST_BTN_OUT_N, GPIO E1, active low
-set_gpio_active_low $((${GPIO_BASE} + 32 + 1)) high
+set_gpio_active_low $((${GPIO_BASE} + 144 +1)) low
# FP_PECI_MUX, active low
set_gpio_active_low $((${GPIO_BASE} + 212)) high
-# Set PECI Mux to high to select Peci interface
-echo 1 > /sys/class/gpio/gpio$((${GPIO_BASE} + 212))/value
-
-
exit 0;