phosphor: ensure host state sensors cleared on host stop

With some of the new targets like obmc-host-diagnostic-mode, the BMC can
be a while in these targets before other ones are started which start
initializing these sensors again. Need to be sure to reset them to
defaults once the host is stopped for any reason. This ensures that
other BMC software which is looking at these to know host boot state
have the correct information.

Tested:
- Verified sensors were reset when starting obmc-host-diagnostic-mode
target

Change-Id: Ida66143b562a9b067e619d34cef6dded6c364abc
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc b/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
index c6ec8ea..4803cac 100644
--- a/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
+++ b/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
@@ -31,6 +31,11 @@
     TARGET="../phosphor-reset-host-running@.service"
     ln -s $TARGET $LINK
 
+    mkdir -p $D$systemd_system_unitdir/obmc-host-stop@0.target.wants
+    LINK="$D$systemd_system_unitdir/obmc-host-stop@0.target.wants/phosphor-reset-sensor-states@0.service"
+    TARGET="../phosphor-reset-sensor-states@.service"
+    ln -s $TARGET $LINK
+
     mkdir -p $D$systemd_system_unitdir/obmc-host-shutdown@0.target.requires
     LINK="$D$systemd_system_unitdir/obmc-host-shutdown@0.target.requires/obmc-chassis-poweroff@0.target"
     TARGET="../obmc-chassis-poweroff@.target"
@@ -89,6 +94,9 @@
     LINK="$D$systemd_system_unitdir/obmc-host-reset@0.target.requires/phosphor-reset-sensor-states@0.service"
     rm $LINK
 
+    LINK="$D$systemd_system_unitdir/obmc-host-stop@0.target.wants/phosphor-reset-sensor-states@0.service"
+    rm $LINK
+
     LINK="$D$systemd_system_unitdir/obmc-host-reset@0.target.requires/phosphor-reset-host-running@0.service"
     rm $LINK