diff options
author | Potin Lai <potin.lai@quantatw.com> | 2023-03-06 09:33:00 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-03-10 02:00:04 +0300 |
commit | 31cca7c34ed29aa51eb480500d7bd3464efa6d22 (patch) | |
tree | ddb86399fe0b3ed103d30aa4cda1447089bc9fff /meta-facebook/meta-bletchley/recipes-phosphor | |
parent | 93e6bbee156d2ba3232cc54ea9623119c4b0e749 (diff) | |
download | openbmc-31cca7c34ed29aa51eb480500d7bd3464efa6d22.tar.xz |
meta-bletchley: move chassis and host power control service into phosphor-state-manager
Move chassis and host power control services as part of PSM package to
align with other platforms in meta-facebook.
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I6e6afc0ad62d3b872b330202a4696b704d245911
Diffstat (limited to 'meta-facebook/meta-bletchley/recipes-phosphor')
10 files changed, 115 insertions, 2 deletions
diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/images/fb-bletchley-phosphor-image.inc b/meta-facebook/meta-bletchley/recipes-phosphor/images/fb-bletchley-phosphor-image.inc index b32b28f199..45f2428032 100644 --- a/meta-facebook/meta-bletchley/recipes-phosphor/images/fb-bletchley-phosphor-image.inc +++ b/meta-facebook/meta-bletchley/recipes-phosphor/images/fb-bletchley-phosphor-image.inc @@ -14,4 +14,5 @@ OBMC_IMAGE_EXTRA_INSTALL:append = " \ board-type-checker \ obmc-phosphor-buttons-signals \ obmc-phosphor-buttons-handler \ + phosphor-state-manager \ " diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle new file mode 100644 index 0000000000..c46e8ab47e --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$1" == "0" ]; then + echo "Enter chassis-cycle" + /usr/sbin/power-ctrl chassis-cycle +else + echo "Enter sled$1 cycle" + /usr/sbin/power-ctrl "sled$1" cycle +fi diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle@.service new file mode 100644 index 0000000000..a8a110e4d1 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Chassis Power Cycle: %i + +[Service] +Type=oneshot +ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle %i + +[Install] +WantedBy=obmc-chassis-powercycle@%i.target diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweroff@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweroff@.service new file mode 100644 index 0000000000..7deff9aa15 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweroff@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Turn off AC at Sled%i +Conflicts=chassis-poweron@%i.service +After=host-poweroff@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i ac-off +SyslogIdentifier=power-ctrl diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweron@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweron@.service new file mode 100644 index 0000000000..2f5f67bed1 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/chassis-poweron@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Turn on AC at Sled%i +Requires=motor-init-calibration@%i.service +After=motor-init-calibration@%i.service +Conflicts=chassis-poweroff@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i ac-on +SyslogIdentifier=power-ctrl +ExecStartPost=/bin/systemctl restart phosphor-discover-system-state@%i.service + +[Install] +WantedBy=multi-user.target diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powercycle@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powercycle@.service new file mode 100644 index 0000000000..2fb7d9dbba --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powercycle@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sled%i Host Power Cycle +Requires=motor-init-calibration@%i.service +After=motor-init-calibration@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i cycle +SyslogIdentifier=power-ctrl diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweroff@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweroff@.service new file mode 100644 index 0000000000..c81f6d6a19 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweroff@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Power off System in Sled%i by Step Motor +Requires=motor-init-calibration@%i.service +After=motor-init-calibration@%i.service +Conflicts=host-poweron@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i off +SyslogIdentifier=power-ctrl + diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweron@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweron@.service new file mode 100644 index 0000000000..5a57e977e9 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-poweron@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Power on System in Sled%i by Step Motor +Requires=motor-init-calibration@%i.service +After=motor-init-calibration@%i.service +Requires=chassis-poweron@%i.service +After=chassis-poweron@%i.service +Conflicts=host-poweroff@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i boot-from-bootmode +SyslogIdentifier=power-ctrl + diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powerreset@.service b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powerreset@.service new file mode 100644 index 0000000000..a8b6a082a1 --- /dev/null +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager/host-powerreset@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sled%i Host Power Reset +Requires=motor-init-calibration@%i.service +After=motor-init-calibration@%i.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/power-ctrl sled%i reset +SyslogIdentifier=power-ctrl diff --git a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager_%.bbappend b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager_%.bbappend index f9783e5ea9..2c0c2de01c 100644 --- a/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager_%.bbappend +++ b/meta-facebook/meta-bletchley/recipes-phosphor/state/phosphor-state-manager_%.bbappend @@ -1,5 +1,27 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" -RDEPENDS:${PN}-discover:append = " bletchley-common-tool" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append:bletchley = " \ + file://chassis-powercycle \ + file://chassis-powercycle@.service \ + file://chassis-poweroff@.service \ + file://chassis-poweron@.service \ + file://host-poweroff@.service \ + file://host-poweron@.service \ + " + +RDEPENDS:${PN}-discover:append:bletchley = " bletchley-common-tool" +RDEPENDS:${PN}:append:bletchley = " bash motor-ctrl" + +do_install:append:bletchley() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/*.service ${D}${systemd_system_unitdir}/ + + install -d ${D}${libexecdir}/${PN} + install -m 0777 ${WORKDIR}/chassis-powercycle ${D}${libexecdir}/${PN}/ +} + +FILES:${PN}:append:bletchley = " ${systemd_system_unitdir}" +FILES:${PN}:append:bletchley = " ${libexecdir}/${PN}" # Because Bletchley does not have IPMI between Bmc & Host, the Host init # state will set to Off after Bmc booted. We require an extra service to @@ -15,4 +37,11 @@ SYSTEMD_OVERRIDE:${PN}-discover:bletchley += "${@compose_list_zip(d, 'BLETCHLEY_ CHASSIS_DEFAULT_TARGETS:remove:bletchley = " \ obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \ obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \ + obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \ + obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \ " + +HOST_DEFAULT_TARGETS:append = " \ + obmc-host-startmin@{}.target.wants/host-poweron@{}.service \ + obmc-host-stop@{}.target.wants/host-poweroff@{}.service \ +"
\ No newline at end of file |