meta-ampere: power control: restructure source code

ampere-hostctrl package includes the generic codes and the platform
specific codes. The generic sources are applied for all of the Ampere
platforms, they are the service files and the scripts to setting the
GPIO pins. The platform specific sources are the GPIO pin config file
and the gpio monitor config files.
This commit moves the platform specific files to the platform code.

Tested:
    1. Do the power control actions use ipmitool, BMC web and Redfish.
    2. Make sure the server states are changed as expected.

Signed-off-by: ThuBaNguyen <thu@os.amperecomputing.com>
Change-Id: Ic0e261109f7a5dfaf38c883bff0afedab763a0b6
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling.bb b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling.bb
new file mode 100644
index 0000000..4358b12
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Ampere Computing LLC Host Gpio Handling"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit obmc-phosphor-systemd
+
+DEPENDS += "virtual/obmc-gpio-monitor"
+RDEPENDS_${PN} += "virtual/obmc-gpio-monitor"
+
+OBMC_HOST_ACK_MONITOR_INSTANCES = "reboot_ack shutdown_ack"
+
+SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/reboot_ack \
+                                  obmc/gpio/shutdown_ack \
+                                 "
+
+TMPL = "phosphor-gpio-monitor@.service"
+INSTFMT = "phosphor-gpio-monitor@{0}.service"
+TGT = "multi-user.target"
+FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "ampere-host-shutdown-ack@.service"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_ACK_MONITOR_INSTANCES')}"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/ampere-host-shutdown-ack@.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/ampere-host-shutdown-ack@.service
new file mode 100644
index 0000000..6588191
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/ampere-host-shutdown-ack@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Ampere Computing LLC host shutdown ACK
+Conflicts=obmc-chassis-poweron@0.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env ampere_power_util.sh mb shutdown_ack
+SyslogIdentifier=ampere_host_shutdown_ack
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/reboot_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/reboot_ack
new file mode 100644
index 0000000..a8ad98e
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/reboot_ack
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/event0
+KEY=75
+POLARITY=1
+TARGET=obmc-host-force-warm-reboot@0.target
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/shutdown_ack b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/shutdown_ack
new file mode 100644
index 0000000..18cc872
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/host-gpio-handling/obmc/gpio/shutdown_ack
@@ -0,0 +1,4 @@
+DEVPATH=/dev/input/event0
+KEY=50
+POLARITY=1
+TARGET=ampere-host-shutdown-ack@0.service
diff --git a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
index 3af7022..ca86a4a 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -1,2 +1,6 @@
 RDEPENDS_${PN}-extras_append_mtjade = " webui-vue phosphor-image-signing phosphor-virtual-sensor"
 RDEPENDS_${PN}-inventory_append_mtjade = " fault-monitor id-button psu-hotswap-reset"
+
+RDEPENDS_${PN}-inventory_append_mtjade = " \
+                                        host-gpio-handling \
+                                        "