meta-ampere: add fault monitor support

Support to detect GPIO, PSU, FAN, ... faults and turn ON/OFF fault LED.

Tested:
1. Unplug a PSU and check if Fault LED is turned ON.
2. Unplug a FAN and check if Fault LED is turned ON.
3. Stimulate GPIO fault pattern and check if the BMC can detect

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Signed-off-by: Quang Nguyen <quangn@amperecomputing.com>
Change-Id: Idfcd32953cf811fbe9299a162f604cb8fd028962
diff --git a/meta-ampere/meta-common/recipes-ampere/platform/ampere-fault-monitor.bb b/meta-ampere/meta-common/recipes-ampere/platform/ampere-fault-monitor.bb
new file mode 100644
index 0000000..79d7a3d
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-ampere/platform/ampere-fault-monitor.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Ampere Computing LLC Fault Monitor"
+DESCRIPTION = "Monitor fault events and update fault led status for Ampere systems"
+PR = "r1"
+
+LICENSE = "Apache-2.0"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit systemd
+inherit obmc-phosphor-systemd
+
+FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
+
+SYSTEMD_SERVICE:${PN} = "ampere-fault-monitor.service"
+
+GPIO_FAULT_START_TGT = "ampere-check-gpio-fault@.service"
+GPIO_FAULT_START_S0_INSTMPL = "ampere-check-gpio-fault@{0}.service"
+SYSTEMD_SERVICE:${PN} += "${GPIO_FAULT_START_TGT}"
+
+HOST_ON_STARTMIN_TGTFMT = "obmc-host-startmin@{0}.target"
+GPIO_FAULT_START_S0_STARTMIN_FMT = "../${GPIO_FAULT_START_TGT}:${HOST_ON_STARTMIN_TGTFMT}.wants/${GPIO_FAULT_START_S0_INSTMPL}"
+SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'GPIO_FAULT_START_S0_STARTMIN_FMT', 'OBMC_HOST_INSTANCES')}"
+