From 98f43bec14af073da25f53db2122fe3546f54095 Mon Sep 17 00:00:00 2001 From: ThuBaNguyen Date: Thu, 1 Jul 2021 22:29:49 +0700 Subject: 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 Change-Id: Ibc0dc8c62408e8282520c9b70e41ab75c10137f6 --- .../host/ampere-hostctrl/ampere-chassis-poweroff.service | 11 ----------- .../host/ampere-hostctrl/ampere-host-shutdown.service | 10 ---------- 2 files changed, 21 deletions(-) delete mode 100644 meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweroff.service delete mode 100644 meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown.service (limited to 'meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl') diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweroff.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweroff.service deleted file mode 100644 index b0a1af785..000000000 --- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-chassis-poweroff.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Ampere Computing LLC Power OFF Chassis -Requires=op-wait-power-off@%i.service -Before=op-wait-power-off@%i.service -Conflicts=obmc-chassis-poweron@0.target - -[Service] -RemainAfterExit=no -Type=oneshot -ExecStart=/usr/bin/env ampere_power_util.sh mb off -SyslogIdentifier=ampere_power_util.sh diff --git a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown.service b/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown.service deleted file mode 100644 index be4d45260..000000000 --- a/meta-ampere/meta-common/recipes-ac01/host/ampere-hostctrl/ampere-host-shutdown.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Ampere Computing LLC graceful shutdown host -Conflicts=obmc-host-start@0.target -OnFailure=obmc-chassis-poweroff@0.target - -[Service] -RemainAfterExit=no -Type=oneshot -ExecStart=/usr/bin/env ampere_power_util.sh mb graceful_shutdown -SyslogIdentifier=ampere_power_util.sh -- cgit v1.2.3