meta-ampere: power control: refactor power soft/off functions
The current ampere-hostctl package removes the power off/on services
of phosphor-state-manager and uses Ampere services. This solution is
not correct. Ampere platform should use power control functions of
phosphor-state-manager. And only appends or overides the default
services by Ampere's services if need.
By default, to handle power soft action, phosphor-state-manager will
trigger obmc-host-shutdown@0.target. This target then call
xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service to request OS
shutdown. When the host OS shutdown is already done, the target will
trigger obmc-chassis-poweroff@0.target to turn off the chassis. The
default xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service uses
Ipmi inband to communicate with the host. It is different with Ampere
Mt.Jade platform. We use the GPIO pin SHD_REQ to request shutdown the
host OS. The host will trigger SHD_ACK when shutdown is done. So
*.Ipmi.Internal.SoftPowerOff.service will be overide by Ampere service
named ampere.*.Ipmi.Internal.SoftPowerOff.service. This service will
trigger SHD_REQ pin and wait for SHD_ACK before start
obmc-chassis-poweroff@0.target.
This commit removes ampere-chassis-poweroff, ampere-host-shutdown
serives which handle power off/soft actions and restore
phosphor-state-manager's services. It also supports
ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service which
will overide xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service.
Tested:
1. Create "power soft" actions use ipmitool, redfish and BMC web.
2. Make sure the power order will be shutdown the host then power
of the chassis.
3. Create "power off" actions use ipmitool, redfish and BMC web.
4. Make sure the power action will be power off the chassis.
Signed-off-by: ThuBaNguyen <thu@os.amperecomputing.com>
Change-Id: Ibc0dc8c62408e8282520c9b70e41ab75c10137f6
diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl.bb b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl.bb
index e7c3cc1..f8e2954 100644
--- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl.bb
+++ b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl.bb
@@ -13,10 +13,9 @@
S = "${WORKDIR}"
-SRC_URI = "file://ampere-host-shutdown.service \
+SRC_URI = " \
file://ampere-host-reset.service \
file://ampere_power_util.sh \
- file://ampere-chassis-poweroff.service \
file://ampere-chassis-poweron.service \
file://ampere-host-reset-ack.service \
file://ampere-host-force-reset.service \
@@ -28,21 +27,13 @@
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = " \
- ampere-host-shutdown.service \
ampere-host-reset.service \
- ampere-chassis-poweroff.service \
ampere-chassis-poweron.service \
ampere-host-reset-ack.service \
ampere-host-force-reset.service \
ampere-host-power-cycle.service \
"
# host power control
-# overwrite the host shutdown to graceful shutdown
-HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service"
-HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target"
-HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}"
-SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_SHUTDOWN_FMT', 'OBMC_HOST_INSTANCES')}"
-
# Force the power cycle target to run the ampere power cycle
HOST_REBOOT_SVC = "ampere-host-power-cycle.service"
HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target"
@@ -67,11 +58,6 @@
CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}"
SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
-CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service"
-CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
-CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}"
-SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
-
TMPL = "phosphor-gpio-monitor@.service"
INSTFMT = "phosphor-gpio-monitor@{0}.service"
TGT = "multi-user.target"