new diag and warm reboot targets

This commit supports the new warm-reboot, force-warm-reboot,
and diagnostic-mode targets.

Note that some systems, such as openpower based servers, will require
additional services from their corresponding meta layer to fully support
these new targets.

phosphor-state-manager: srcrev bump c101157e5b..47b96128da

Andrew Geissler (6):
      warm-reboot: add in new targets
      warm-reboot: support new host transitions
      diag-mode: create new diagnostic mode target
      dead code: remove an unused definition
      change systemd signal handler to be more specific
      diag-mode: support entry into diagnostic mode

(From meta-phosphor rev: accb48453b2c0c7a2149e7b2ca455476b0f89d9c)

Change-Id: I73e1c053d19d1d62dc61b565905ea09828d96945
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/recipes-phosphor/state/phosphor-state-manager_git.bb b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager_git.bb
index caa0352..fe1bbc9 100644
--- a/meta-phosphor/recipes-phosphor/state/phosphor-state-manager_git.bb
+++ b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager_git.bb
@@ -143,6 +143,36 @@
 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')}"
 
+# Force warm reboot target to call soft power off
+HOST_WARM_REBOOT_TGTFMT = "obmc-host-warm-reboot@{0}.target"
+HOST_WARM_REBOOT_SOFT_SVC = "xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
+HOST_WARM_REBOOT_SOFT_SVC_FMT = "../${HOST_WARM_REBOOT_SOFT_SVC}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_SOFT_SVC}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SOFT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Force warm reboot target to call host stop
+HOST_WARM_REBOOT_STOP_TMPL="obmc-host-stop@.target"
+HOST_WARM_REBOOT_STOP_REQUIRES="obmc-host-force-warm-reboot@{0}.target"
+HOST_WARM_REBOOT_STOP_TMPL_INST="obmc-host-stop@{0}.target"
+HOST_WARM_REBOOT_STOP_TARGET_FMT = "../${HOST_WARM_REBOOT_STOP_TMPL}:${HOST_WARM_REBOOT_STOP_REQUIRES}.requires/${HOST_WARM_REBOOT_STOP_TMPL_INST}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_STOP_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Force warm reboot target to call reboot host
+HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target"
+HOST_WARM_REBOOT_SVC = "phosphor-reboot-host@.service"
+HOST_WARM_REBOOT_SVC_INST = "phosphor-reboot-host@{0}.service"
+HOST_WARM_REBOOT_SVC_FMT = "../${HOST_WARM_REBOOT_SVC}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_SVC_INST}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Warm reboot to call force warm reboot
+# Warm reboot will be graceful due to to it also containing soft power off
+HOST_WARM_REBOOT_FORCE_TGT = "obmc-host-force-warm-reboot@.target"
+HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
+
+# Diagnostic target to call force warm reboot target
+HOST_DIAG_TGTFMT = "obmc-host-diagnostic-mode@0.target"
+HOST_DIAG_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_DIAG_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_TGTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_DIAG_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
 
 # Chassis power synchronization targets
 # - start-pre:         Services to run before we start power on process
@@ -183,8 +213,14 @@
 #            quiesce target but the only delta is that this target contains
 #            multiple services and one of them is the quiesce target.
 # - timeout: Target to run when host watchdog times out
-# - reboot:  Reboot the host
-HOST_ACTION_TARGETS = "start startmin stop quiesce reset shutdown crash timeout reboot"
+# - reboot:  Reboot the host with a chassis power cycle included
+# - warm-reboot: Reboot the host without a chassis power cycle.
+# - force-warm-reboot: Reboot the host without a chassis power cycle and without
+#                      notifying the host.
+# - diagnostic-mode: This will be entered when the host is collecting diagnostic
+#                    data for itself.
+HOST_ACTION_TARGETS = "start startmin stop quiesce reset shutdown crash timeout "
+HOST_ACTION_TARGETS += "reboot warm-reboot force-warm-reboot diagnostic-mode"
 
 CHASSIS_SYNCH_FMT = "obmc-power-{0}@.target"
 CHASSIS_ACTION_FMT = "obmc-chassis-{0}@.target"
@@ -226,6 +262,6 @@
 SYSTEMD_LINK_${PN}-obmc-targets += "${@compose_list(d, 'QUIESCE_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
 
 SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
-SRCREV = "c101157e5b138f36044a2a3aaf15ad8ac16501fc"
+SRCREV = "47b96128da8da00c2238f1314a3be6b0a9c9fce5"
 
 S = "${WORKDIR}/git"