meta-facebook: yosemite4: Support power policy after doing slot hot-plug

Add systemd service slot-hot-plug to recover host status by power policy

Tested:
plug out then in slot, check host status and journal

Change-Id: I8168b32a40c34d787fbfdd6c6a0c944ace919514
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hot-plug@.service b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hot-plug@.service
new file mode 100644
index 0000000..66403a2
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hot-plug@.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=slot hot-plug:%i
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/libexec/phosphor-state-manager/wait-until-mctp-connection-done %i
+ExecStart=/bin/systemctl restart phosphor-discover-system-state@%i.service
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
index a7bbcb1..8707388 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
@@ -148,5 +148,93 @@
             ]
         },
         "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT1_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 44,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@1.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT2_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 45,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@2.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT3_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 46,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@3.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT4_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 47,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@4.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT5_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 132,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@5.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT6_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 133,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@6.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT7_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 134,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@7.service"]
+        },
+        "Continue": true
+    },
+    {
+        "Name": "PRSNT_SB_SLOT8_BMC_N",
+        "ChipId": "0",
+        "GpioNum": 135,
+        "EventMon": "FALLING",
+        "Targets": {
+            "FALLING": [
+                "slot-hot-plug@8.service"]
+        },
+        "Continue": true
     }
 ]
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
index 3e4f07b..a3c30a3 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
@@ -8,6 +8,7 @@
             file://probe-slot-device \
             file://rescan-fru-device@.service \
             file://rescan-fru-device \
+            file://slot-hot-plug@.service \
             "
 
 RDEPENDS:${PN}:append:yosemite4 = " bash"
@@ -18,6 +19,7 @@
     set-button-sled.service \
     probe-slot-device@.service \
     rescan-fru-device@.service \
+    slot-hot-plug@.service \
     "
 
 SYSTEMD_AUTO_ENABLE = "enable"
@@ -29,6 +31,7 @@
     install -m 0644 ${WORKDIR}/set-button-sled.service ${D}${systemd_system_unitdir}/set-button-sled.service
     install -m 0644 ${WORKDIR}/probe-slot-device@.service ${D}${systemd_system_unitdir}/probe-slot-device@.service
     install -m 0644 ${WORKDIR}/rescan-fru-device@.service ${D}${systemd_system_unitdir}/rescan-fru-device@.service
+    install -m 0644 ${WORKDIR}/slot-hot-plug@.service ${D}${systemd_system_unitdir}/slot-hot-plug@.service
     install -d ${D}${libexecdir}/${PN}
     install -m 0777 ${WORKDIR}/probe-slot-device ${D}${libexecdir}/${PN}/
     install -m 0777 ${WORKDIR}/rescan-fru-device ${D}${libexecdir}/${PN}/