PNOR init workaround for P8 based systems
The PNOR chip requires an init to be done to it prior
to starting the host. This is a temporary fix to this
issue until we get the mboxd function ported to P8.
Resolves openbmc/openbmc#1426
Change-Id: I784c6aa6ca299fe1d4593295c30d0056f0167706
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
index e4c54be..1842697 100644
--- a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host.bb
@@ -14,6 +14,7 @@
DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_SERVICE_${PN} = " \
op-start-host@.service \
+ op-init-pnor@.service \
"
START_TMPL = "op-start-host@.service"
@@ -21,4 +22,9 @@
START_INSTFMT = "obmc-start-host@{0}.service"
START_FMT = "../${START_TMPL}:${START_TGTFMT}.requires/${START_INSTFMT}"
+INIT_PNOR_TMPL = "op-init-pnor@.service"
+INIT_PNOR_INSTFMT = "op-init-pnor@{0}.service"
+INIT_PNOR_FMT = "../${INIT_PNOR_TMPL}:${START_TGTFMT}.requires/${INIT_PNOR_INSTFMT}"
+
SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'INIT_PNOR_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
diff --git a/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-init-pnor@.service b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-init-pnor@.service
new file mode 100644
index 0000000..5accb48
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/host/obmc-op-control-host/op-init-pnor@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Init PNOR for Host%i
+After=obmc-power-on@%i.target
+Before=obmc-host-start-pre@%i.target
+Conflicts=obmc-host-stop@%i.target
+ConditionPathExists=!/run/openbmc/host@%i-on
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+# TODO openbmc/openbmc#1598 - Delete this service once available
+ExecStart={sbindir}/pflash -i
+
+[Install]
+WantedBy=obmc-host-start@%i.target