summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/recipes-phosphor/state
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-31 06:25:51 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-09-06 07:44:12 -0400
commitff075f6ee795a590b244d70a90cc312ba1f2d83d (patch)
treea617790bdbfdeef960665ba0242e1f0c93e5301a /meta-phosphor/recipes-phosphor/state
parent3e4da38c127bb7e7641adc2fc41f4c33744cb918 (diff)
downloadtalos-openbmc-ff075f6ee795a590b244d70a90cc312ba1f2d83d.tar.gz
talos-openbmc-ff075f6ee795a590b244d70a90cc312ba1f2d83d.zip
meta-phosphor: Move layer content from common/
Adopt a more conventional directory hierarchy. meta-phosphor is still a _long_ way from suitable for hosting on yoctoproject.org but things like this don't help. (From meta-phosphor rev: 471cfcefa74b8c7ceb704cb670e6d915cf27c63b) Change-Id: I3f106b2f6cdc6cec734be28a6090800546f362eb Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/recipes-phosphor/state')
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/obmc/phosphor-reboot-host/reboot.conf1
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-discover-system-state@.service19
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-reboot-host@.service18
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-check@.service19
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-reboot-attempts@.service13
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-running@.service13
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service15
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service16
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Chassis.service16
-rw-r--r--meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Host.service18
-rw-r--r--meta-phosphor/recipes-phosphor/state/phosphor-state-manager.bb141
11 files changed, 289 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-phosphor/state/files/obmc/phosphor-reboot-host/reboot.conf b/meta-phosphor/recipes-phosphor/state/files/obmc/phosphor-reboot-host/reboot.conf
new file mode 100644
index 000000000..2e3ca1a5b
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/obmc/phosphor-reboot-host/reboot.conf
@@ -0,0 +1 @@
+REBOOT_DELAY=5
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-discover-system-state@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-discover-system-state@.service
new file mode 100644
index 000000000..f39803899
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-discover-system-state@.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Reboot If Enabled
+Wants=mapper-wait@-xyz-openbmc_project-control-host0-power_restore_policy.service
+After=mapper-wait@-xyz-openbmc_project-control-host0-power_restore_policy.service
+Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+After=op-reset-chassis-on@%i.service
+ConditionPathExists=!/run/openbmc/chassis@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/usr/bin/env phosphor-discover-system-state --host %i
+SyslogIdentifier=phosphor-discover-system-state
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-reboot-host@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-reboot-host@.service
new file mode 100644
index 000000000..27479f2de
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-reboot-host@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Reboot host%i
+Wants=obmc-host-stop@%i.target
+After=obmc-host-stop@%i.target
+
+[Service]
+#ExecStart={base_bindir}/systemctl start obmc-host-start@%i.target
+# This service is starting another target that conflicts with the
+# target this service is running in. OpenBMC needs a refactor of
+# how it does its host reset path. Until then, this short term
+# solution does the job.
+# Since this is a part of the reboot target, call the startmin
+# target which does the minimum required to start the host.
+ExecStart=/bin/sh -c "sleep ${{REBOOT_DELAY}} && systemctl start obmc-host-startmin@%i.target"
+EnvironmentFile={envfiledir}/obmc/phosphor-reboot-host/reboot.conf
+
+[Install]
+WantedBy=obmc-host-reboot@%i.target
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-check@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-check@.service
new file mode 100644
index 000000000..6062320b2
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-check@.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Check Host%i status on BMC reset
+Wants=mapper-wait@-xyz-openbmc_project-control-host%i.service
+After=mapper-wait@-xyz-openbmc_project-control-host%i.service
+Wants=obmc-host-reset-running@%i.target
+Before=obmc-host-reset-running@%i.target
+Wants=op-reset-chassis-on@%i.service
+After=op-reset-chassis-on@%i.service
+Conflicts=obmc-host-stop@%i.target
+ConditionPathExists=/run/openbmc/chassis@%i-on
+
+[Service]
+RemainAfterExit=yes
+Type=oneshot
+ExecStart=/usr/bin/env phosphor-host-check
+SyslogIdentifier=phosphor-host-check
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-reboot-attempts@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-reboot-attempts@.service
new file mode 100644
index 000000000..35de4304b
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-reboot-attempts@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Reset host reboot counter
+Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+ConditionPathExists=!/run/openbmc/host@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host%i` /xyz/openbmc_project/state/host%i xyz.openbmc_project.Control.Boot.RebootAttempts AttemptsLeft u 3"
+
+[Install]
+WantedBy=obmc-host-start@%i.target
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-running@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-running@.service
new file mode 100644
index 000000000..a49bbdd16
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-host-running@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Start host%i running after BMC reset
+After=obmc-host-reset-running@%i.target
+Requires=obmc-host-reset-running@%i.target
+ConditionPathExists=/run/openbmc/host@%i-on
+
+[Service]
+RemainAfterExit=no
+ExecStart=/bin/systemctl start obmc-host-start@%i.target
+
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service
new file mode 100644
index 000000000..689372f4a
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Reset host sensors
+After=phosphor-reset-host-check@%i.service
+Wants=mapper-wait@-xyz-openbmc_project-state-host%i.service
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+ConditionPathExists=!/run/openbmc/host@%i-on
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Boot.Progress BootProgress s xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified"
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.OperatingSystem.Status OperatingSystemState s xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive"
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
diff --git a/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service
new file mode 100644
index 000000000..057af648d
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.BMC.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Phosphor BMC State Manager
+Before=mapper-wait@-xyz-openbmc_project-state-bmc.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+
+
+[Service]
+ExecStart=/usr/bin/env phosphor-bmc-state-manager
+SyslogIdentifier=phosphor-bmc-state-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Chassis.service b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Chassis.service
new file mode 100644
index 000000000..259dd16af
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Chassis.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Phosphor Chassis State Manager
+Before=mapper-wait@-xyz-openbmc_project-state-chassis.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+After=org.openbmc.control.Power@0.service
+
+[Service]
+ExecStart=/usr/bin/env phosphor-chassis-state-manager
+SyslogIdentifier=phosphor-chassis-state-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Host.service b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Host.service
new file mode 100644
index 000000000..26f523eaa
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/files/xyz.openbmc_project.State.Host.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Phosphor Host State Manager
+Wants=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
+After=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
+Before=mapper-wait@-xyz-openbmc_project-state-host.service
+After=phosphor-reset-host-running@0.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+
+[Service]
+ExecStart=/usr/bin/env phosphor-host-state-manager
+SyslogIdentifier=phosphor-host-state-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/recipes-phosphor/state/phosphor-state-manager.bb b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager.bb
new file mode 100644
index 000000000..4acaa5688
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager.bb
@@ -0,0 +1,141 @@
+SUMMARY = "Phosphor State Management"
+DESCRIPTION = "Phosphor State Manager provides a set of system state \
+management daemons. It is suitable for use on a wide variety of OpenBMC \
+platforms."
+HOMEPAGE = "https://github.com/openbmc/phosphor-state-manager"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+STATE_MGR_PACKAGES = " \
+ ${PN}-host \
+ ${PN}-chassis \
+ ${PN}-bmc \
+ ${PN}-discover \
+ ${PN}-host-check \
+ ${PN}-reset-sensor-states \
+"
+PACKAGE_BEFORE_PN += "${STATE_MGR_PACKAGES}"
+ALLOW_EMPTY_${PN} = "1"
+
+DBUS_PACKAGES = "${STATE_MGR_PACKAGES}"
+
+SYSTEMD_PACKAGES = "${PN}-discover \
+ ${PN}-reset-sensor-states \
+"
+
+# The host-check function will check if the host is running
+# after a BMC reset.
+# The reset-sensor-states function will reset the host
+# sensors on a BMC reset or system power loss.
+# Neither is required for host state function but are
+# recommended to deal properly with these reset scenarios.
+RRECOMMENDS_${PN}-host = "${PN}-host-check ${PN}-reset-sensor-states"
+
+inherit autotools pkgconfig
+inherit obmc-phosphor-dbus-service
+
+DEPENDS += "autoconf-archive-native"
+DEPENDS += "sdbusplus"
+DEPENDS += "phosphor-logging"
+DEPENDS += "phosphor-dbus-interfaces"
+DEPENDS += "cereal"
+RDEPENDS_${PN} += "sdbusplus"
+
+RDEPENDS_${PN}-host += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-chassis += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-bmc += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-discover += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-host-check += "libsystemd phosphor-dbus-interfaces"
+RDEPENDS_${PN}-reset-sensor-states += "libsystemd phosphor-dbus-interfaces"
+
+FILES_${PN}-host = "${sbindir}/phosphor-host-state-manager"
+DBUS_SERVICE_${PN}-host += "xyz.openbmc_project.State.Host.service"
+DBUS_SERVICE_${PN}-host += "phosphor-reboot-host@.service"
+SYSTEMD_ENVIRONMENT_FILE_${PN}-host += "obmc/phosphor-reboot-host/reboot.conf"
+SYSTEMD_SERVICE_${PN}-host += "phosphor-reset-host-reboot-attempts@.service"
+
+FILES_${PN}-chassis = "${sbindir}/phosphor-chassis-state-manager"
+DBUS_SERVICE_${PN}-chassis += "xyz.openbmc_project.State.Chassis.service"
+
+FILES_${PN}-bmc = "${sbindir}/phosphor-bmc-state-manager"
+DBUS_SERVICE_${PN}-bmc += "xyz.openbmc_project.State.BMC.service"
+
+FILES_${PN}-discover = "${sbindir}/phosphor-discover-system-state"
+SYSTEMD_SERVICE_${PN}-discover += "phosphor-discover-system-state@.service"
+
+FILES_${PN}-host-check = "${sbindir}/phosphor-host-check"
+SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-check@.service"
+SYSTEMD_SERVICE_${PN}-host-check += "phosphor-reset-host-running@.service"
+
+SYSTEMD_SERVICE_${PN}-reset-sensor-states += "phosphor-reset-sensor-states@.service"
+
+RESET_CHECK_TMPL = "phosphor-reset-host-check@.service"
+RESET_CHECK_TGTFMT = "obmc-host-reset@{1}.target"
+RESET_CHECK_INSTFMT = "phosphor-reset-host-check@{0}.service"
+RESET_CHECK_FMT = "../${RESET_CHECK_TMPL}:${RESET_CHECK_TGTFMT}.requires/${RESET_CHECK_INSTFMT}"
+
+SENSOR_RESET_TMPL = "phosphor-reset-sensor-states@.service"
+SENSOR_RESET_TGTFMT = "obmc-host-reset@{1}.target"
+SENSOR_RESET_INSTFMT = "phosphor-reset-sensor-states@{0}.service"
+SENSOR_RESET_FMT = "../${SENSOR_RESET_TMPL}:${SENSOR_RESET_TGTFMT}.requires/${SENSOR_RESET_INSTFMT}"
+
+RESET_RUNNING_TMPL = "phosphor-reset-host-running@.service"
+RESET_RUNNING_TGTFMT = "obmc-host-reset@{1}.target"
+RESET_RUNNING_INSTFMT = "phosphor-reset-host-running@{0}.service"
+RESET_RUNNING_FMT = "../${RESET_RUNNING_TMPL}:${RESET_RUNNING_TGTFMT}.requires/${RESET_RUNNING_INSTFMT}"
+
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_CHECK_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_RUNNING_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+SYSTEMD_LINK_${PN}-reset-sensor-states += "${@compose_list_zip(d, 'SENSOR_RESET_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+# Force the standby target to run the host reset check target
+RESET_TMPL_CTRL = "obmc-host-reset@.target"
+SYSD_TGT = "${SYSTEMD_DEFAULT_TARGET}"
+RESET_INSTFMT_CTRL = "obmc-host-reset@{0}.target"
+RESET_FMT_CTRL = "../${RESET_TMPL_CTRL}:${SYSD_TGT}.wants/${RESET_INSTFMT_CTRL}"
+SYSTEMD_LINK_${PN}-host-check += "${@compose_list_zip(d, 'RESET_FMT_CTRL', 'OBMC_HOST_INSTANCES')}"
+
+TMPL = "phosphor-discover-system-state@.service"
+INSTFMT = "phosphor-discover-system-state@{0}.service"
+FMT = "../${TMPL}:${SYSTEMD_DEFAULT_TARGET}.wants/${INSTFMT}"
+SYSTEMD_LINK_${PN}-discover += "${@compose_list(d, 'FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Force the shutdown target to run the chassis-poweroff target
+CHASSIS_STOP_TMPL = "obmc-chassis-poweroff@.target"
+HOST_STOP_TGTFMT = "obmc-host-shutdown@{1}.target"
+CHASSIS_STOP_INSTFMT = "obmc-chassis-poweroff@{0}.target"
+HOST_STOP_FMT = "../${CHASSIS_STOP_TMPL}:${HOST_STOP_TGTFMT}.requires/${CHASSIS_STOP_INSTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_STOP_FMT', 'OBMC_CHASSIS_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+# Force the host reboot target to run the shutdown target
+HOST_SHUTDOWN_TMPL = "obmc-host-shutdown@.target"
+HOST_REBOOT_TGTFMT = "obmc-host-reboot@{0}.target"
+HOST_SHUTDOWN_INSTFMT = "obmc-host-shutdown@{0}.target"
+HOST_REBOOT_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_REBOOT_TGTFMT}.requires/${HOST_SHUTDOWN_INSTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# And also force the reboot target to call the host startmin service
+HOST_REBOOT_SVC = "phosphor-reboot-host@.service"
+HOST_REBOOT_SVC_INST = "phosphor-reboot-host@{0}.service"
+HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_TGTFMT}.requires/${HOST_REBOOT_SVC_INST}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+# Force the host-start target to call the host-startmin target
+HOST_STARTMIN_TMPL = "obmc-host-startmin@.target"
+HOST_START_TGTFMT = "obmc-host-start@{0}.target"
+HOST_STARTMIN_INSTFMT = "obmc-host-startmin@{0}.target"
+HOST_START_FMT = "../${HOST_STARTMIN_TMPL}:${HOST_START_TGTFMT}.requires/${HOST_STARTMIN_INSTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_START_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Force the host-start target to call the reboot count reset service
+HOST_RST_RBT_ATTEMPTS_SVC = "phosphor-reset-host-reboot-attempts@.service"
+HOST_RST_RBT_ATTEMPTS_SVC_INST = "phosphor-reset-host-reboot-attempts@{0}.service"
+HOST_RST_RBT_ATTEMPTS_SVC_FMT = "../${HOST_RST_RBT_ATTEMPTS_SVC}:${HOST_START_TGTFMT}.requires/${HOST_RST_RBT_ATTEMPTS_SVC_INST}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_RST_RBT_ATTEMPTS_SVC_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+
+SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
+SRCREV = "a965cf06a6bb6b130a2e4f1202978aac9124be68"
+
+S = "${WORKDIR}/git"
OpenPOWER on IntegriCloud