meta-ampere: mtmitchell: use power cycle for reset actions
AmpereOne POR recommends to use power cycle instead of SYS_RESET for
reset actions.
This commit changes REBOOT_ACK handling and warm reboot to use power
cycles.
Tested:
1. "ipmitool power reset" when the host is on power action should
similar "ipmitool power cycle".
2. "ipmitool power reset" when the host is off, power action should be
bypassed.
3. In host os call "reboot", the power action should be power off then
power on (without softoff action before power off).
4. Call "GracefulRestart" and "ForceRestart" from redfish when the
host is on the power action should be similar "power cycle"
5. Call "GracefulRestart" and "ForceRestart" from redfish when the
host is off, power action should be bypassed.
6. Press "reset" button in the chassis will cause power off then power
on the host.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I759623b68018b05d758b181936e0d4624eb03d94
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-utils/ampere_power_util.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-utils/ampere_power_util.sh
index fb5be7f..330861a 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-utils/ampere_power_util.sh
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-utils/ampere_power_util.sh
@@ -5,7 +5,7 @@
# Usage of this utility
function usage() {
- echo "usage: power-util mb [status|shutdown_ack|force_reset|soft_off]";
+ echo "usage: power-util mb [status|shutdown_ack|force_reset|soft_off|host_reboot_wa]";
}
power_status() {
@@ -84,6 +84,24 @@
gpio_name_set host0-sysreset-n 1
}
+host_reboot_wa() {
+ 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"
+
+ while ( true )
+ do
+ if systemctl status obmc-power-off@0.target | grep "Active: active"; then
+ break;
+ fi
+ sleep 2
+ done
+ echo "The power is already Off."
+
+ busctl set-property xyz.openbmc_project.State.Host \
+ /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
+ RequestedHostTransition s "xyz.openbmc_project.State.Host.Transition.On"
+}
if [ ! -d "/run/openbmc/" ]; then
mkdir -p "/run/openbmc/"
@@ -95,6 +113,8 @@
power_status
elif [ "$2" == "force_reset" ]; then
force_reset
+elif [ "$2" == "host_reboot_wa" ]; then
+ host_reboot_wa
elif [ "$2" == "soft_off" ]; then
ret=$(soft_off)
if [ "$ret" == 0 ]; then
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-reboot@.service b/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-reboot@.service
new file mode 100644
index 0000000..8b4dee5
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/ampere-host-reboot@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Ampere Computing LLC host reboot
+Conflicts=obmc-chassis-poweron@0.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/ampere_power_util.sh mb host_reboot_wa
+SyslogIdentifier=ampere_host_reboot
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json b/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json
index 38a09a6..f8ae78c 100644
--- a/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/gpio/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json
@@ -3,7 +3,7 @@
"Name": "REBOOT_ACK",
"LineName": "host0-reboot-ack-n",
"EventMon": "FALLING",
- "Target": "obmc-host-force-warm-reboot@0.target",
+ "Target": "ampere-host-reboot@0.service",
"Continue": true
},
{
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/state/phosphor-state-manager_%.bbappend b/meta-ampere/meta-mitchell/recipes-phosphor/state/phosphor-state-manager_%.bbappend
new file mode 100644
index 0000000..164614a
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/state/phosphor-state-manager_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+EXTRA_OEMESON:append = " \
+ -Dwarm-reboot=disabled \
+ "