summaryrefslogtreecommitdiff
path: root/meta-phosphor/common/recipes-phosphor
diff options
context:
space:
mode:
authorDhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>2017-12-17 21:06:23 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-14 19:45:10 +0300
commitef07e6fdf19d31ce52ffdecfeb406a56d9cb41eb (patch)
treeac18f19ebed48dd67900592fc3c2b02fc1cf2200 /meta-phosphor/common/recipes-phosphor
parent81cc51fc851c3a05f3c16c7451572d09c1e8f167 (diff)
downloadopenbmc-ef07e6fdf19d31ce52ffdecfeb406a56d9cb41eb.tar.xz
Reset boot progress and OS status sensors after reboot
Reset boot progress and OS status sensors if host is not running Resolves openbmc/openbmc#2804 Change-Id: I1fee2bf7776ae957e87452d9cfa7a4fca647b46f Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor')
-rw-r--r--meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service15
-rw-r--r--meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb19
2 files changed, 33 insertions, 1 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reset-sensor-states@.service
new file mode 100644
index 000000000..689372f4a
--- /dev/null
+++ b/meta-phosphor/common/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/common/recipes-phosphor/state/phosphor-state-manager.bb b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
index c04d21bae..672090e15 100644
--- a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
@@ -13,6 +13,7 @@ STATE_MGR_PACKAGES = " \
${PN}-bmc \
${PN}-discover \
${PN}-host-check \
+ ${PN}-reset-sensor-states \
"
PACKAGES =+ "${STATE_MGR_PACKAGES}"
PACKAGES_remove = "${PN}"
@@ -21,7 +22,13 @@ RDEPENDS_${PN}-staticdev = "${STATE_MGR_PACKAGES}"
DBUS_PACKAGES = "${STATE_MGR_PACKAGES}"
-SYSTEMD_PACKAGES = "${PN}-discover"
+SYSTEMD_PACKAGES = "${PN}-discover \
+ ${PN}-reset-sensor-states \
+"
+# The reset-sensor-states function will reset the host
+# sensors on a BMC reset or system power loss so it is
+# recommended when bringing in the host state function
+RRECOMMENDS_${PN}-host = "${PN}-reset-sensor-states"
inherit autotools pkgconfig
inherit obmc-phosphor-dbus-service
@@ -38,6 +45,7 @@ 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"
@@ -56,11 +64,18 @@ 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"
@@ -69,6 +84,8 @@ RESET_RUNNING_FMT = "../${RESET_RUNNING_TMPL}:${RESET_RUNNING_TGTFMT}.requires/$
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}"