meta-ampere: support ampere power/host already on targets

There are no targets to identity the already on of power state and the
already running of host state. This commit adds those targets.
The targets will be the check points to start ampere services such as
drivers binder, hang detection...
obmc-power-already-on@.target will be always activated when
chassis-power-control is asserted. It will be deactivated before
deasserting chassis-power-control.
obmc-host-already-on@.target will be activated when the host%i-ready
is triggered. The target will be deactivated before turning
off/reseting the host.

Tested:
1. The targets should be activated/deactivated as designing.

Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I09a8b94d8043f31f7cee83b29765f7e2c7a5c35a
diff --git a/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere-bmc-reboot-host-check@.service b/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere-bmc-reboot-host-check@.service
new file mode 100644
index 0000000..feaa3d0
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere-bmc-reboot-host-check@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Check Host%i status after bmc reboot
+After=obmc-host-reset@%i.target
+After=obmc-host-reset-running@%i.target
+After=mapper-wait@-xyz-openbmc_project-state-host%i.service
+OnSuccess=obmc-host-already-on@%i.target
+ConditionPathExists=/run/openbmc/chassis@%i-on
+ConditionPathExists=/run/openbmc/host@%i-on
+Conflicts=obmc-chassis-poweroff@%i.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "if [ $(busctl get-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host CurrentHostState | grep -i '\.Running' | wc -l) != 0 ]; then exit 0; fi"
+
+