meta-ampere: power control: refactor host power control
Refactor the Mt.Jade Host power control operations to support Altra
CPU following the Altra SoC BMC Interface specification which still
satisfying the OpenBMC power control framework.
Tested: check the below cases and ensure Host state report correctly:
1. Run "reboot" from Host Linux. Check the Host is graceful
shutdown, then SYS_RESET is asserted and the Host is booted.
2. Run "shutdown" from Host Linux. Check the Host is graceful
shutdown then the chassis power is turned OFF.
3. Run "ipmitool chassis power soft". Check the Host is graceful
shutdown
4. Execute Redfish GracefulShutdown. Check the Host is graceful
shutdown then the chassis power is turned OFF.
5. Execute Redfish GracefulRestart. Check the Host is graceful
shutdown then turned ON.
6. Check other IPMI chassis power and Redfish Reset actions work.
Signed-off-by: ThuBaNguyen <thu@os.amperecomputing.com>
Change-Id: I3a9716f37d7e80bdc1a1d0422e561c8fc51ad040
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweron.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweron.service
deleted file mode 100644
index 76ceb88..0000000
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweron.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Ampere Computing LLC Power ON Chassis
-Conflicts=obmc-chassis-poweroff@0.target
-
-[Service]
-RemainAfterExit=yes
-Type=oneshot
-ExecStart=/usr/bin/env ampere_power_util.sh mb on
-SyslogIdentifier=ampere_power_util.sh
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset.service
deleted file mode 100644
index 8a40baf..0000000
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Ampere Computing LLC force reset host
-Conflicts=obmc-chassis-poweroff@0.target
-OnFailure=obmc-chassis-powerreset@0.target
-
-[Service]
-RemainAfterExit=no
-Type=oneshot
-ExecStart=/usr/bin/env ampere_power_util.sh mb force_reset
-SyslogIdentifier=ampere_power_util.sh
-
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset@.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset@.service
new file mode 100644
index 0000000..6e03c8b
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-force-reset@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Ampere Computing LLC force reset host%i
+Wants=phosphor-reboot-host@%i.service
+Conflicts=obmc-chassis-poweroff@%i.target
+OnFailure=obmc-chassis-powerreset@%i.target
+
+[Service]
+RemainAfterExit=no
+Type=oneshot
+ExecStart=/bin/sh -c "sleep 3 && /usr/bin/env ampere_power_util.sh mb force_reset"
+SyslogIdentifier=ampere_power_util.sh
+
+[Install]
+WantedBy=obmc-host-force-warm-reboot@%i.target
\ No newline at end of file
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-power-cycle.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-power-cycle.service
deleted file mode 100644
index 2fb03ef..0000000
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-power-cycle.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Ampere Computing LLC power cycle service
-Conflicts=obmc-host-start@0.target
-OnFailure=obmc-chassis-powerreset@0.target
-
-[Service]
-RemainAfterExit=no
-Type=oneshot
-ExecStart=/usr/bin/env ampere_power_util.sh mb cycle
-SyslogIdentifier=ampere_power_util.sh
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset-ack.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset-ack.service
deleted file mode 100644
index 504186e..0000000
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset-ack.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Ampere Computing LLC triggering reset ACK
-Conflicts=obmc-host-start@0.target
-OnFailure=obmc-chassis-powerreset@0.target
-
-[Service]
-RemainAfterExit=no
-Type=oneshot
-ExecStart=/usr/bin/env ampere_power_util.sh mb force_reset
-SyslogIdentifier=ampere_power_util.sh
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset.service
deleted file mode 100644
index ac7618a..0000000
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-reset.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Ampere Computing LLC warm reset host
-Conflicts=obmc-chassis-poweroff@0.target
-
-[Service]
-RemainAfterExit=no
-Type=oneshot
-ExecStart=/usr/bin/env ampere_power_util.sh mb graceful_reset
-SyslogIdentifier=ampere_power_util.sh
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown-ack@.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown-ack@.service
new file mode 100644
index 0000000..6588191
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown-ack@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Ampere Computing LLC host shutdown ACK
+Conflicts=obmc-chassis-poweron@0.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env ampere_power_util.sh mb shutdown_ack
+SyslogIdentifier=ampere_host_shutdown_ack