Recipe updates for power sequencer YAML files

Add YAML file for Witherspoon power sequencer information.
Add YAML file for Swift power sequencer information.
Add native recipe to pull in YAML files.
Update recipe to set appropriate configuration variable
for YAML file to use based on machine configuration.

Depends-On: I54958ce49496464e601ff9c6f2b081ee8d2c07be
gerrit.openbmc-project.xyz/c/openbmc/witherspoon-pfault-analysis/+/20513

Change-Id: I17d3821b766c91582bd0f6dd5a14a2b74440ab9d
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/meta-witherspoon/recipes-phosphor/power/power-sequencer.bb b/meta-witherspoon/recipes-phosphor/power/power-sequencer.bb
new file mode 100644
index 0000000..f19e02f
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/power-sequencer.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Power sequencer data definition"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${IBMBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit allarch
+
+SRC_URI = "file://ucd90160.yaml"
+
+FILES_${PN} += "${datadir}/power-sequencer/ucd90160.yaml"
+
+S = "${WORKDIR}"
+
+do_install() {
+    DEST=${D}${datadir}/power-sequencer
+
+    install -D ucd90160.yaml ${DEST}/ucd90160.yaml
+}
diff --git a/meta-witherspoon/recipes-phosphor/power/power-sequencer/swift/ucd90160.yaml b/meta-witherspoon/recipes-phosphor/power/power-sequencer/swift/ucd90160.yaml
new file mode 100644
index 0000000..d6ba581
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/power-sequencer/swift/ucd90160.yaml
@@ -0,0 +1,92 @@
+- Device:
+  index: 0
+  # Linux sysfs path for this power sequencer (0xC8 8-bit address)
+  path:  /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-8/8-0064
+  RailNames:
+      - "12.0V"
+      - "3.3V"
+      - "1.8V"
+      - "1.1V"
+      - "0.8V_SW"
+      - "5.0V"
+      - "VDN0"
+      - "VDN1"
+      - "AVDD"
+      - "VIO0"
+      - "VIO1"
+      - "VDD0"
+      - "VDD1"
+      - "VCS0"
+      - "VCS1"
+  GPIConfigs:
+      - name:            PGOOD_5P0V
+        gpi:             1
+        pinID:           8
+        poll:            false
+        analysis:        none
+      - name:            MEM_GOOD0
+        gpi:             2
+        pinID:           9
+        poll:            false
+        analysis:        none
+      - name:            MEM_GOOD1
+        gpi:             3
+        pinID:           10
+        poll:            false
+        analysis:        none
+      - name:            GPU_PGOOD
+        gpi:             4
+        pinID:           14
+        poll:            false
+        analysis:        gpuPGOOD # Extra GPIOAnalysis to run if faulted
+      - name:            GPU_TH_OVERT
+        gpi:             5
+        pinID:           17
+        poll:            false
+        analysis:        gpuOverTemp # Extra GPIOAnalysis to run if faulted
+      - name:            SOFTWARE_PGOOD
+        gpi:             6
+        pinID:           11
+        poll:            false
+        analysis:        none
+  GPIOAnalysis:
+      - type:            gpuPGOOD
+        # The PCA9xxx chip device path and address (0xC0 8-bit = 0x60 7-bit)
+        path:            /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-8/8-0060
+        gpio_value:      low # What GPIO value indicates a fault/problem?
+        error_function:  gpuPGOODError # Extra analysis function to call for this type
+        option_flags:    none
+        GPIODefinitions:
+            - GPIODefinition: GPU Card 0
+              gpio:      8 # GPIO pin/register to check for fault
+              # Call out path for fault
+              callout:   /system/chassis/motherboard/gv100card0
+            - GPIODefinition: GPU Card 1
+              gpio:      9
+              callout:   /system/chassis/motherboard/gv100card1
+            - GPIODefinition: GPU Card 2
+              gpio:      10
+              callout:   /system/chassis/motherboard/gv100card2
+            - GPIODefinition: GPU Card 3
+              gpio:      11
+              callout:   /system/chassis/motherboard/gv100card3
+      - type:            gpuOverTemp
+        # The PCA9xxx chip device path and address (0xC0 8-bit = 0x60 7-bit)
+        path:            /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-8/8-0060
+        gpio_value:      low # What GPIO value indicates a fault/problem?
+        error_function:  gpuOverTempError # Extra analysis function to call for this type
+        option_flags:    shutdownOnFault
+        GPIODefinitions:
+            - GPIODefinition: GPU Card 0 Overtemperature
+              gpio:      2 # GPIO pin/register to check for fault
+              # Call out path for fault
+              callout:   /system/chassis/motherboard/gv100card0
+            - GPIODefinition: GPU Card 1 Overtemperature
+              gpio:      3
+              callout:   /system/chassis/motherboard/gv100card1
+            - GPIODefinition: GPU Card 2 Overtemperature
+              gpio:      4
+              callout:   /system/chassis/motherboard/gv100card2
+            - GPIODefinition: GPU Card 3 Overtemperature
+              gpio:      5
+              callout:   /system/chassis/motherboard/gv100card3
diff --git a/meta-witherspoon/recipes-phosphor/power/power-sequencer/witherspoon/ucd90160.yaml b/meta-witherspoon/recipes-phosphor/power/power-sequencer/witherspoon/ucd90160.yaml
new file mode 100644
index 0000000..bf373ea
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/power-sequencer/witherspoon/ucd90160.yaml
@@ -0,0 +1,103 @@
+- Device:
+  index: 0
+  # Linux sysfs path for this power sequencer (0xC8 8-bit address)
+  path:  /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-11/11-0064
+  RailNames:
+      - "5.0VCS"
+      - "12.0V"
+      - "3.3V"
+      - "1.8V"
+      - "1.1V"
+      - "1.0V"
+      - "0.9V"
+      - "VDN-A"
+      - "VDN-B"
+      - "AVDD"
+      - "VIO-A"
+      - "VIO-B"
+      - "VDD-A"
+      - "VDD-B"
+      - "VCS-A"
+      - "VCS-B"
+  GPIConfigs:
+      - name:            PGOOD_5P0V
+        gpi:             1
+        pinID:           8
+        poll:            false
+        analysis:        none
+      - name:            MEM_GOOD0
+        gpi:             2
+        pinID:           9
+        poll:            false
+        analysis:        none
+      - name:            MEM_GOOD1
+        gpi:             3
+        pinID:           10
+        poll:            false
+        analysis:        none
+      - name:            GPU_PGOOD
+        gpi:             4
+        pinID:           14
+        poll:            false
+        analysis:        gpuPGOOD
+      - name:            GPU_TH_OVERT
+        gpi:             5
+        pinID:           17
+        poll:            true
+        analysis:        gpuOverTemp
+      - name:            SOFTWARE_PGOOD
+        gpi:             6
+        pinID:           11
+        poll:            false
+        analysis:        none
+  GPIOAnalysis:
+      - type:            gpuPGOOD
+        path:            /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-11/11-0060
+        gpio_value:      low
+        error_function:  gpuPGOODError
+        option_flags:    none
+        GPIODefinitions:
+            - GPIODefinition: GPU Card 0
+              gpio:      8
+              callout:   /system/chassis/motherboard/gv100card0
+            - GPIODefinition: GPU Card 1
+              gpio:      9
+              callout:   /system/chassis/motherboard/gv100card1
+            - GPIODefinition: GPU Card 2
+              gpio:      10
+              callout:   /system/chassis/motherboard/gv100card2
+            - GPIODefinition: GPU Card 3
+              gpio:      11
+              callout:   /system/chassis/motherboard/gv100card3
+            - GPIODefinition: GPU Card 4
+              gpio:      12
+              callout:   /system/chassis/motherboard/gv100card4
+            - GPIODefinition: GPU Card 5
+              gpio:      13
+              callout:   /system/chassis/motherboard/gv100card5
+      - type:            gpuOverTemp # Extra analysis function to call for this type
+        # The PCA9xxx chip device path and address (0xC0 8-bit = 0x60 7-bit)
+        path:            /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-11/11-0060
+        gpio_value:      low # What GPIO value indicates a fault/problem?
+        error_function:  gpuOverTempError
+        option_flags:    shutdownOnFault
+        GPIODefinitions:
+            - GPIODefinition: GPU Card 0 Overtemperature
+              gpio:      2 # GPIO pin/register to check for fault
+              # Call out path for fault
+              callout:   /system/chassis/motherboard/gv100card0
+            - GPIODefinition: GPU Card 1 Overtemperature
+              gpio:      3
+              callout:   /system/chassis/motherboard/gv100card1
+            - GPIODefinition: GPU Card 2 Overtemperature
+              gpio:      4
+              callout:   /system/chassis/motherboard/gv100card2
+            - GPIODefinition: GPU Card 3 Overtemperature
+              gpio:      5
+              callout:   /system/chassis/motherboard/gv100card3
+            - GPIODefinition: GPU Card 4 Overtemperature
+              gpio:      6
+              callout:   /system/chassis/motherboard/gv100card4
+            - GPIODefinition: GPU Card 5 Overtemperature
+              gpio:      7
+              callout:   /system/chassis/motherboard/gv100card5
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb
index 51086c6..802f759 100644
--- a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb
@@ -18,8 +18,11 @@
          openpower-dbus-interfaces \
          sdbus++-native \
          sdeventplus \
+         power-sequencer \
          "
 
+EXTRA_OECONF = "UCD90160_DEF_YAML_FILE=${STAGING_DIR_HOST}${datadir}/power-sequencer/ucd90160.yaml"
+
 CHASSIS_ON_TGT = "obmc-chassis-poweron@0.target"
 SEQ_MONITOR_SVC = "pseq-monitor.service"
 SEQ_MONITOR_FMT = "../${SEQ_MONITOR_SVC}:${CHASSIS_ON_TGT}.wants/${SEQ_MONITOR_SVC}"