Add service and recipe for PGOOD fail errors
The service starts the witherspoon-pseq-monitor application.
The service will start right after a power on has been
kicked off and will create an error log if PGOOD doesn't
come on in a certain amount of time.
Future witherspoon-pseq-monitor enhancements will add more
functionality to analyze the power sequencer chip to see
which hardware was the actual cause of the fail.
Resolves openbmc/openbmc#2147
Change-Id: Ia64c59985da57352a007dcaab82d317cdec0fa50
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-witherspoon/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
index f2756d0..253c0aa 100644
--- a/meta-witherspoon/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
+++ b/meta-witherspoon/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -1,2 +1,3 @@
RDEPENDS_${PN}-inventory += "openpower-fru-vpd openpower-occ-control phosphor-cooling-type virtual/obmc-gpio-presence"
RDEPENDS_${PN}-fan-control += "witherspoon-fan-watchdog"
+RDEPENDS_${PN}-extras += "witherspoon-pfault-analysis"
diff --git a/meta-witherspoon/recipes-phosphor/power/phosphor-logging-error-logs-native.bbappend b/meta-witherspoon/recipes-phosphor/power/phosphor-logging-error-logs-native.bbappend
new file mode 100644
index 0000000..03646ad
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/phosphor-logging-error-logs-native.bbappend
@@ -0,0 +1,2 @@
+DEPENDS += "witherspoon-pfault-analysis-error-native"
+
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native.bb b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native.bb
new file mode 100644
index 0000000..068d792
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Copy error yaml files to known path for elog parsing"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-dbus-yaml
+
+PROVIDES += "witherspoon-pfault-analysis-error-native"
+require witherspoon-pfault-analysis.inc
+
+S = "${WORKDIR}/git"
+
+do_install_append() {
+ SRC=${S}/xyz/openbmc_project/Power
+ DEST=${yaml_dir}/xyz/openbmc_project/Power
+ install -d ${DEST}
+ install ${SRC}/Fault.errors.yaml ${DEST}
+}
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.bb b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.bb
new file mode 100644
index 0000000..57ee0fe
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.bb
@@ -0,0 +1,31 @@
+SUMMARY = "Witherspoon Power Fault Analysis"
+DESCRIPTION = "Analyzes power devices for faults"
+PR = "r1"
+
+inherit autotools
+inherit pkgconfig
+inherit obmc-phosphor-systemd
+inherit pythonnative
+
+require ${PN}.inc
+
+S = "${WORKDIR}/git"
+
+DEPENDS += " \
+ phosphor-logging \
+ autoconf-archive-native \
+ sdbus++-native \
+ "
+
+RDEPENDS_${PN} += " \
+ phosphor-logging \
+ phosphor-dbus-interfaces \
+ sdbusplus \
+ "
+
+CHASSIS_ON_TGT = "obmc-chassis-poweron@0.target"
+SEQ_PGOOD_SVC = "witherspoon-pseq-monitor-pgood.service"
+SEQ_PGOOD_FMT = "../${SEQ_PGOOD_SVC}:${CHASSIS_ON_TGT}.wants/${SEQ_PGOOD_SVC}"
+
+SYSTEMD_SERVICE_${PN} += "${SEQ_PGOOD_SVC}"
+SYSTEMD_LINK_${PN} += "${SEQ_PGOOD_FMT}"
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc
new file mode 100644
index 0000000..6cbcf46
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc
@@ -0,0 +1,5 @@
+HOMEPAGE = "https://github.com/openbmc/witherspoon-pfault-analysis"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
+SRC_URI += "git://github.com/openbmc/witherspoon-pfault-analysis"
+SRCREV = "56d90a89317c293a8d70c9483102eb5cec767577"
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon-pseq-monitor-pgood.service b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon-pseq-monitor-pgood.service
new file mode 100644
index 0000000..010be6f
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon-pseq-monitor-pgood.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Witherspoon Power Sequencer Power-on Monitor
+Wants=op-power-start@0.service
+After=op-power-start@0.service
+Conflicts=obmc-chassis-poweroff@0.target
+ConditionPathExists=!/run/openbmc/chassis@0-on
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env witherspoon-pseq-monitor -a pgood-monitor -i 5
+SyslogIdentifier=witherspoon-pseq-monitor