Replace old gpio-monitor with new one

Change-Id: I8f96987ab61d7657c3ccd3d665fa34ed6cb508ec
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/common/recipes-phosphor/host/checkstop-monitor.bb b/common/recipes-phosphor/host/checkstop-monitor.bb
index 07d024e..d5d8d7f 100644
--- a/common/recipes-phosphor/host/checkstop-monitor.bb
+++ b/common/recipes-phosphor/host/checkstop-monitor.bb
@@ -15,15 +15,11 @@
 # via GPIO assertion
 SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/checkstop"
 
-SYSTEMD_SERVICE_${PN} += "openpower-host-checkstop-monitor@.target"
+STATES = "start stop"
+CHECKSTOP_SERVICE_FMT = "openpower-host-checkstop-monitor-{0}@.target"
+SYSTEMD_SERVICE_${PN} += "${@compose_list(d, 'CHECKSTOP_SERVICE_FMT', 'STATES')}"
 
-CHECKSTOP_TMPL = "openpower-host-checkstop-monitor@.target"
-CHECKSTOP_TGTFMT = "openpower-host-checkstop-monitor@{0}.target"
-CHECKSTOP_MONITOR_FMT = "${CHECKSTOP_TMPL}:${CHECKSTOP_TGTFMT}"
-SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHECKSTOP_MONITOR_FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
-
-GPIO_TMPL = "phosphor-gpio-monitor@.service"
-MONITOR_TGTFMT = "openpower-host-checkstop-monitor@{0}.target"
-GPIO_INSTFMT = "phosphor-gpio-monitor@{0}.service"
-MONITOR_GPIO_FMT = "../${GPIO_TMPL}:${MONITOR_TGTFMT}.wants/${GPIO_INSTFMT}"
-SYSTEMD_LINK_${PN} += "${@compose_list(d, 'MONITOR_GPIO_FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
+CHECKSTOP_TMPL = "openpower-host-checkstop-monitor-{0}@.target"
+CHECKSTOP_TGTFMT = "openpower-host-checkstop-monitor-{0}@{1}.target"
+CHECKSTOP_MONITOR_FMT = "../${CHECKSTOP_TMPL}:obmc-host-{0}@{2}.target.wants/${CHECKSTOP_TGTFMT}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'CHECKSTOP_MONITOR_FMT', 'STATES', 'OBMC_HOST_MONITOR_INSTANCES', 'OBMC_HOST_INSTANCES')}"
diff --git a/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-start@.target b/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-start@.target
new file mode 100644
index 0000000..6b07a6c
--- /dev/null
+++ b/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-start@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Start Host %I monitor
+Requires=phosphor-gpio-monitor@%i.service
+RefuseManualStop=yes
diff --git a/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-stop@.target b/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-stop@.target
new file mode 100644
index 0000000..242683a
--- /dev/null
+++ b/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor-stop@.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Stop Host %I monitor
+Conflicts=phosphor-gpio-monitor@%i.service
+RefuseManualStop=yes
diff --git a/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor@.target b/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor@.target
deleted file mode 100644
index 8c2168b..0000000
--- a/common/recipes-phosphor/host/checkstop-monitor/openpower-host-checkstop-monitor@.target
+++ /dev/null
@@ -1,4 +0,0 @@
-[Unit]
-Description=Host instance %i checkstop monitor
-Requires=phosphor-gpio-monitor@%i.service
-RefuseManualStop=yes
diff --git a/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb b/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
index 8e69012..69884ab 100644
--- a/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
+++ b/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
@@ -27,7 +27,6 @@
         obmc-button-power \
         obmc-button-reset \
         obmc-control-chassis \
-        obmc-hostcheckstop \
         obmc-op-control-power \
         obmc-pcie-detect \
         obmc-watchdog \