pseq: Add presence checking

As a circumvention for hardware problems, it can be necessary to check
for device presence in order to prevent calling out not present
components. Add the ability to configure presence checking in the PSEQ
configuration files and use presence, when configured, in problem
determination.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: Ia9d8ee57f2d643f61ece45d9c03d523b891e98b8
diff --git a/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,everest.json b/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,everest.json
index 255682b..7e50882 100644
--- a/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,everest.json
+++ b/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,everest.json
@@ -1,37 +1,102 @@
 {
     "rails": [
-        "12.0V",
-        "3V3IO",
-        "CP0_VDD0",
-        "CP0_VDD1",
-        "CP1_VDD0",
-        "CP1_VDD1",
-        "CP2_VDD0",
-        "CP2_VDD1",
-        "CP3_VDD0",
-        "CP3_VDD1",
-        "CP0_VCS0",
-        "CP0_VCS1",
-        "CP1_VCS0",
-        "CP1_VCS1",
-        "CP2_VCS0",
-        "CP2_VCS1",
-        "CP3_VCS0",
-        "CP3_VCS1",
-        "CP03_AVDD",
-        "CP12_AVDD",
-        "CP0_VDN",
-        "CP1_VDN",
-        "CP2_VDN",
-        "CP3_VDN",
-        "CP0_VIO",
-        "CP1_VIO",
-        "CP2_VIO",
-        "CP3_VIO",
-        "CP0_VPCIE",
-        "CP1_VPCIE",
-        "CP2_VPCIE",
-        "CP3_VPCIE"
+        {
+            "name": "12.0V"
+        },
+        {
+            "name": "3V3IO"
+        },
+        {
+            "name": "CP0_VDD0"
+        },
+        {
+            "name": "CP0_VDD1"
+        },
+        {
+            "name": "CP1_VDD0"
+        },
+        {
+            "name": "CP1_VDD1"
+        },
+        {
+            "name": "CP2_VDD0"
+        },
+        {
+            "name": "CP2_VDD1"
+        },
+        {
+            "name": "CP3_VDD0"
+        },
+        {
+            "name": "CP3_VDD1"
+        },
+        {
+            "name": "CP0_VCS0"
+        },
+        {
+            "name": "CP0_VCS1"
+        },
+        {
+            "name": "CP1_VCS0"
+        },
+        {
+            "name": "CP1_VCS1"
+        },
+        {
+            "name": "CP2_VCS0"
+        },
+        {
+            "name": "CP2_VCS1",
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm2/cpu0"
+        },
+        {
+            "name": "CP3_VCS0"
+        },
+        {
+            "name": "CP3_VCS1"
+        },
+        {
+            "name": "CP03_AVDD"
+        },
+        {
+            "name": "CP12_AVDD"
+        },
+        {
+            "name": "CP0_VDN"
+        },
+        {
+            "name": "CP1_VDN"
+        },
+        {
+            "name": "CP2_VDN"
+        },
+        {
+            "name": "CP3_VDN"
+        },
+        {
+            "name": "CP0_VIO"
+        },
+        {
+            "name": "CP1_VIO"
+        },
+        {
+            "name": "CP2_VIO"
+        },
+        {
+            "name": "CP3_VIO"
+        },
+        {
+            "name": "CP0_VPCIE"
+        },
+        {
+            "name": "CP1_VPCIE"
+        },
+        {
+            "name": "CP2_VPCIE"
+        },
+        {
+            "name": "CP3_VPCIE"
+        }
     ],
 
     "pins": [
@@ -45,11 +110,13 @@
         },
         {
             "name": "CP2_VPCIE",
-            "line": 61
+            "line": 61,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm2/cpu0"
         },
         {
             "name": "CP3_VPCIE",
-            "line": 62
+            "line": 62,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm3/cpu0"
         },
         {
             "name": "5.0V_USB_front",
@@ -65,11 +132,13 @@
         },
         {
             "name": "CP2_VDN",
-            "line": 74
+            "line": 74,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm2/cpu0"
         },
         {
             "name": "CP3_VDN",
-            "line": 75
+            "line": 75,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm3/cpu0"
         },
         {
             "name": "CP0_VIO",
@@ -81,11 +150,13 @@
         },
         {
             "name": "CP2_VIO",
-            "line": 78
+            "line": 78,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm2/cpu0"
         },
         {
             "name": "CP3_VIO",
-            "line": 79
+            "line": 79,
+            "presence": "/xyz/openbmc_project/inventory/system/chassis/motherboard/dcm3/cpu0"
         }
     ]
 }
diff --git a/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,rainier.json b/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,rainier.json
index 01e2986..b489db2 100644
--- a/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,rainier.json
+++ b/phosphor-power-sequencer/config_files/UCD90320Monitor_ibm,rainier.json
@@ -1,37 +1,101 @@
 {
     "rails": [
-       "12.0V",
-       "5.0V_USB",
-       "5.0V_DASD",
-       "3.3VA",
-       "3.3VB",
-       "1.5V",
-       "1.1V",
-       "VDDA_DCM0",
-       "VDDB_DCM0",
-       "VDDA_DCM1",
-       "VDDB_DCM1",
-       "12.0VCS",
-       "3.3VCS",
-       "1.1V_Current",
-       "5.0V_USB_Current",
-       "5.0V_DASD_Current",
-       "12.0VN",
-       "12.0VP",
-       "12.0VQ",
-       "12.0VR",
-       "ThermalDiode1",
-       "ThermalDiode2",
-       "ThermalDiode3",
-       "ThermalDiode4",
-       "VDN_DCM0",
-       "VDN_DCM1",
-       "VCS_DCM0",
-       "VCS_DCM1",
-       "VIO_DCM0",
-       "VIO_DCM1",
-       "VPCIE_DCM0",
-       "VPCIE_DCM1"
+        {
+           "name": "12.0V"
+        },
+        {
+           "name": "5.0V_USB"
+        },
+        {
+           "name": "5.0V_DASD"
+        },
+        {
+           "name": "3.3VA"
+        },
+        {
+           "name": "3.3VB"
+        },
+        {
+           "name": "1.5V"
+        },
+        {
+           "name": "1.1V"
+        },
+        {
+           "name": "VDDA_DCM0"
+        },
+        {
+           "name": "VDDB_DCM0"
+        },
+        {
+           "name": "VDDA_DCM1"
+        },
+        {
+           "name": "VDDB_DCM1"
+        },
+        {
+           "name": "12.0VCS"
+        },
+        {
+           "name": "3.3VCS"
+        },
+        {
+           "name": "1.1V_Current"
+        },
+        {
+           "name": "5.0V_USB_Current"
+        },
+        {
+           "name": "5.0V_DASD_Current"
+        },
+        {
+           "name": "12.0VN"
+        },
+        {
+           "name": "12.0VP"
+        },
+        {
+           "name": "12.0VQ"
+        },
+        {
+           "name": "12.0VR"
+        },
+        {
+           "name": "ThermalDiode1"
+        },
+        {
+           "name": "ThermalDiode2"
+        },
+        {
+           "name": "ThermalDiode3"
+        },
+        {
+           "name": "ThermalDiode4"
+        },
+        {
+           "name": "VDN_DCM0"
+        },
+        {
+           "name": "VDN_DCM1"
+        },
+        {
+           "name": "VCS_DCM0"
+        },
+        {
+           "name": "VCS_DCM1"
+        },
+        {
+           "name": "VIO_DCM0"
+        },
+        {
+           "name": "VIO_DCM1"
+        },
+        {
+           "name": "VPCIE_DCM0"
+        },
+        {
+           "name": "VPCIE_DCM1"
+        }
     ],
 
     "pins": [