meta-ampere: host-check: overide phosphor-reset-host-check

When BMC boots, phosphor-host-check uses the software interfaces(IPMI
inband Hearbeat command or PLDM interface) to verify the host state
and creates the host on indicator file. Ampere Altra SoCs do not
support those software interfaces. They use the GPIO interface. GPIO
pin S0_FW_BOOT_OK go high when the host is on. This commit appends
ampere-reset-host-check@.service to phosphor-state-manager This
service will replaces the role of phosphor-reset-host-check@.service.

Tested:
    1. Boot up BMC with the host is off/on.
    2. Verify the CurrentHostState.

Signed-off-by: ThuBaNguyen <thu@os.amperecomputing.com>
Change-Id: Ie4f73538266fff7d8c5fd40b437ffebc82cb12c5
diff --git a/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager/ampere-reset-host-check@.service b/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager/ampere-reset-host-check@.service
new file mode 100644
index 0000000..83f6581
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager/ampere-reset-host-check@.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Check Host%i status on BMC reset
+Wants=phosphor-ipmi-host.service
+After=phosphor-ipmi-host.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/sbin/ampere_host_check.sh 1 0
+
+[Install]
+WantedBy=obmc-host-reset@%i.target
\ No newline at end of file
diff --git a/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend
index dcf8cac..bdb89ce 100644
--- a/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend
+++ b/meta-ampere/meta-common/recipes-phosphor/state/phosphor-state-manager_%.bbappend
@@ -3,3 +3,11 @@
 DEPS_CFG = "resetreason.conf"
 DEPS_TGT = "phosphor-discover-system-state@.service"
 SYSTEMD_OVERRIDE_${PN}-discover_append = "${DEPS_CFG}:${DEPS_TGT}.d/${DEPS_CFG}"
+
+SRC_URI += " \
+             file://ampere-reset-host-check@.service \
+           "
+
+do_install_append() {
+    install -m 0644 ${WORKDIR}/ampere-reset-host-check@.service ${D}${systemd_unitdir}/system/phosphor-reset-host-check@.service
+}
\ No newline at end of file