summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade
diff options
context:
space:
mode:
authorThuBaNguyen <thu@os.amperecomputing.com>2021-07-01 18:29:49 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2021-08-04 06:34:46 +0300
commit98f43bec14af073da25f53db2122fe3546f54095 (patch)
tree42263dff9d99d2676103ff4fbae0888fd622cbab /meta-ampere/meta-jade
parenteb53d86e93295398d743d1eb90cd92900ef5cc02 (diff)
downloadopenbmc-98f43bec14af073da25f53db2122fe3546f54095.tar.xz
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
Diffstat (limited to 'meta-ampere/meta-jade')
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere-phosphor-softpoweroff5
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service13
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend10
3 files changed, 28 insertions, 0 deletions
diff --git a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere-phosphor-softpoweroff b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere-phosphor-softpoweroff
new file mode 100644
index 000000000..214aeed7a
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere-phosphor-softpoweroff
@@ -0,0 +1,5 @@
+#!/bin/bash
+# Usage of this utility
+echo "Trigger soft off the host."
+/usr/sbin/ampere_power_util.sh mb soft_off
+exit $?;
diff --git a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
new file mode 100644
index 000000000..01b31b1b3
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host/ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Ampere Soft power off of the host
+Wants=obmc-host-stop-pre@0.target
+Before=obmc-host-stop-pre@0.target
+Conflicts=obmc-host-start@0.target
+ConditionPathExists=!/run/openbmc/host@0-request
+ConditionPathExists=!/lib/systemd/system/pldmSoftPowerOff.service
+
+[Service]
+Restart=no
+ExecStart=/usr/bin/env phosphor-softpoweroff
+SyslogIdentifier=phosphor-softpoweroff
+Type=oneshot
diff --git a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
index c0bcbdd3a..b8ea8d8d5 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -3,13 +3,23 @@ FILESEXTRAPATHS_append_mtjade := "${THISDIR}/${PN}:"
DEPENDS_append_mtjade = " mtjade-yaml-config"
RRECOMMENDS_${PN} += "ipmitool"
+RDEPENDS_${PN} += "bash"
+
+SRC_URI += " \
+ file://ampere-phosphor-softpoweroff \
+ file://ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
+ "
EXTRA_OECONF_mtjade = " \
SENSOR_YAML_GEN=${STAGING_DIR_HOST}${datadir}/mtjade-yaml-config/ipmi-sensors-${MACHINE}.yaml \
FRU_YAML_GEN=${STAGING_DIR_HOST}${datadir}/mtjade-yaml-config/ipmi-fru-read.yaml \
"
+AMPERE_SOFTPOWEROFF_TMPL = "ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
+
do_install_append_mtjade(){
install -d ${D}${includedir}/phosphor-ipmi-host
install -m 0644 -D ${S}/selutility.hpp ${D}${includedir}/phosphor-ipmi-host
+ install -m 0755 ${WORKDIR}/ampere-phosphor-softpoweroff ${D}/${bindir}/phosphor-softpoweroff
+ install -m 0644 ${WORKDIR}/${AMPERE_SOFTPOWEROFF_TMPL} ${D}${systemd_unitdir}/system/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
}