Add recipes for Witherspoon VCS workaround
Create vcs-workaround machine feature p9.inc
Add new recipe vcs-pre-post.bb
Add new recipe p9-vcs-workaround.bb
Add new recipe start_host.bb
Create preferred providers
Create host control machine/distro/image feature
Add dependencies
Partially resolves openbmc/openbmc#647
Change-Id: I285cafc81afda20977fdf360ad8ad34d15e38685
Signed-off-by: Sergey Solomin <sergey.solomin@us.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/start_host@.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/start_host@.service
index 6b29110..dbf6021 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/start_host@.service
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/start_host@.service
@@ -5,7 +5,7 @@
Conflicts=obmc-chassis-stop@%i.target
[Service]
-ExecStart={bindir}/start_host.sh
+ExecStart={bindir}/start_host.sh {MACHINE}
Type=oneshot
RemainAfterExit=yes
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/vcs_workaround@.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/vcs_workaround@.service
index e15d2cf..6b4d425 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/vcs_workaround@.service
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/op-pdbg-host-control/vcs_workaround@.service
@@ -5,7 +5,7 @@
Conflicts=obmc-chassis-stop@%i.target
[Service]
-ExecStart={bindir}/vcs_workaround.sh
+ExecStart={bindir}/vcs_workaround.sh {MACHINE}
Type=oneshot
RemainAfterExit=yes
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-host-start.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-host-start.bb
new file mode 100644
index 0000000..3f7bf2b
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-host-start.bb
@@ -0,0 +1,32 @@
+SUMMARY = "POWER9 start host"
+DESCRIPTION = "Service to start POWER9 IPL through SBE"
+PR = "r1"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/op-pdbg-host-control:"
+
+PROVIDES += 'virtual/obmc-host-ctl'
+RPROVIDES_${PN} += 'virtual-obmc-host-ctl'
+
+RDEPENDS_${PN} += "pdbg \
+ p9-vcs-workaround"
+
+S = "${WORKDIR}"
+SRC_URI += "file://start_host.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/start_host.sh \
+ ${D}${bindir}/start_host.sh
+}
+
+TMPL = "start_host@.service"
+INSTFMT = "start_host@{0}.service"
+TGTFMT = "obmc-chassis-start@{0}.target"
+FMT = "../${TMPL}:${TGTFMT}.wants/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SUBSTITUTIONS += "MACHINE:${MACHINE}:${TMPL}"
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-vcs-workaround.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-vcs-workaround.bb
new file mode 100644
index 0000000..530085b
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/host/p9-vcs-workaround.bb
@@ -0,0 +1,29 @@
+SUMMARY = "POWER9 VCS workaround"
+DESCRIPTION = "Apply fixes over FSI to POWER9 CPUs prior to host power on"
+PR = "r1"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/op-pdbg-host-control:"
+
+RDEPENDS_${PN} += "pdbg \
+ virtual-p9-vcs-workaround"
+
+S = "${WORKDIR}"
+SRC_URI += "file://vcs_workaround.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/vcs_workaround.sh \
+ ${D}${bindir}/vcs_workaround.sh
+}
+
+TMPL = "vcs_workaround@.service"
+INSTFMT = "vcs_workaround@{0}.service"
+TGTFMT = "obmc-chassis-start@{0}.target"
+FMT = "../${TMPL}:${TGTFMT}.wants/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SUBSTITUTIONS += "MACHINE:${MACHINE}:${TMPL}"
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
index 268caf5..40b6b6f 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/packagegroups/packagegroup-op-apps.bb
@@ -41,7 +41,6 @@
obmc-op-control-power \
obmc-pcie-detect \
obmc-watchdog \
- obmc-op-control-host \
obmc-control-led \
"
diff --git a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
index c333784..9fc843f 100644
--- a/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
+++ b/meta-openbmc-machines/meta-openpower/conf/machine/include/openpower.inc
@@ -4,6 +4,7 @@
obmc-phosphor-sensor-mgmt \
obmc-phosphor-flash-mgmt \
obmc-host-ipmi \
+ obmc-host-ctl \
openpower-pflash \
"
@@ -15,4 +16,5 @@
PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-op-apps"
PREFERRED_PROVIDER_virtual/obmc-sensor-mgmt = "packagegroup-op-apps"
PREFERRED_PROVIDER_virtual/obmc-system-mgmt = "packagegroup-op-apps"
+PREFERRED_PROVIDER_virtual/obmc-host-ctl ?= "obmc-op-control-host"
PREFERRED_PROVIDER_virtual/obmc-inventory-data ?= "${VIRTUAL-RUNTIME_skeleton_workbook}"
diff --git a/meta-openbmc-machines/meta-openpower/conf/machine/include/p9.inc b/meta-openbmc-machines/meta-openpower/conf/machine/include/p9.inc
new file mode 100644
index 0000000..936576d
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/conf/machine/include/p9.inc
@@ -0,0 +1,2 @@
+OBMC_MACHINE_FEATURES += 'p9-vcs-workaround'
+PREFERRED_PROVIDER_virtual/obmc-host-ctl = "p9-host-start"
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
index 40c8357..e3fcad8 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf/machine/witherspoon.conf
@@ -5,9 +5,12 @@
OBMC_MACHINE_FEATURES += "obmc-mrw"
+PREFERRED_PROVIDER_virtual/p9-vcs-workaround = 'vcs-pre-post'
+
require conf/machine/include/ast2500.inc
require conf/machine/include/obmc-bsp-common.inc
require conf/machine/include/ibm.inc
+require conf/machine/include/p9.inc
PHOSPHOR_MRW_URI = "git://github.com/open-power/witherspoon-xml"
PHOSPHOR_MRW_REV = "657550f28ebd09854a93c299a5a5aff182375a66"
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post.bb b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post.bb
new file mode 100644
index 0000000..676df3d
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post.bb
@@ -0,0 +1,43 @@
+SUMMARY = "Witherspoon P9 power on"
+DESCRIPTION = "Witherspoon power on workaround"
+PR = "r1"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+RDEPENDS_${PN} += "i2c-tools"
+
+PROVIDES += 'virtual/p9-vcs-workaround'
+RPROVIDES_${PN} += 'virtual-p9-vcs-workaround'
+
+S = "${WORKDIR}"
+SRC_URI += "file://vcs_off.sh \
+ file://vcs_on.sh \
+ file://ucd_disable_vcs.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/vcs_off.sh ${D}${bindir}/vcs_off.sh
+ install -m 0755 ${WORKDIR}/vcs_on.sh ${D}${bindir}/vcs_on.sh
+ install -m 0755 ${WORKDIR}/ucd_disable_vcs.sh \
+ ${D}${bindir}/ucd_disable_vcs.sh
+}
+
+TMPL_OFF = "vcs_off@.service"
+TMPL_ON = "vcs_on@.service"
+TMPL_UCD = "ucd_disable_vcs@.service"
+INSTFMT_OFF = "vcs_off@{0}.service"
+INSTFMT_ON = "vcs_on@{0}.service"
+INSTFMT_UCD = "ucd_disable_vcs@{0}.service"
+TGTFMT = "obmc-chassis-start@{0}.target"
+FMT_OFF = "../${TMPL_OFF}:${TGTFMT}.wants/${INSTFMT_OFF}"
+FMT_ON = "../${TMPL_ON}:${TGTFMT}.wants/${INSTFMT_ON}"
+FMT_UCD = "../${TMPL_UCD}:${TGTFMT}.wants/${INSTFMT_UCD}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL_OFF}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_OFF', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SERVICE_${PN} += "${TMPL_ON}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SERVICE_${PN} += "${TMPL_UCD}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_UCD', 'OBMC_CHASSIS_INSTANCES')}"
+
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index 813b20d..31f99cf 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -27,6 +27,7 @@
FEATURE_PACKAGES_obmc-system-mgmt ?= "${@df_enabled('obmc-phosphor-system-mgmt', 'virtual-obmc-system-mgmt', d)}"
FEATURE_PACKAGES_obmc-host-ipmi ?= "${@cf_enabled('obmc-host-ipmi', 'virtual-obmc-host-ipmi-hw', d)}"
FEATURE_PACKAGES_obmc-logging-mgmt ?= "${@cf_enabled('obmc-logging-mgmt', 'virtual-obmc-logging-mgmt', d)}"
+FEATURE_PACKAGES_obmc-host-ctl ?= "${@cf_enabled('obmc-host-ctl', 'virtual-obmc-host-ctl', d)}"
# Install entire Phosphor application stack by default
IMAGE_FEATURES += " \
@@ -40,6 +41,7 @@
obmc-system-mgmt \
obmc-host-ipmi \
obmc-logging-mgmt \
+ obmc-host-ctl \
ssh-server-dropbear \
"
diff --git a/meta-phosphor/common/recipes-phosphor/hosts/obmc-op-control-host.bb b/meta-phosphor/common/recipes-phosphor/hosts/obmc-op-control-host.bb
index dabc4a8..2b5e8b1 100644
--- a/meta-phosphor/common/recipes-phosphor/hosts/obmc-op-control-host.bb
+++ b/meta-phosphor/common/recipes-phosphor/hosts/obmc-op-control-host.bb
@@ -5,6 +5,9 @@
inherit skeleton-gdbus
inherit obmc-phosphor-dbus-service
+PROVIDES += "virtual/obmc-host-ctl"
+RPROVIDES_${PN} += "virtual-obmc-host-ctl"
+
SKELETON_DIR = "op-hostctl"
FMT = "org.openbmc.control.Host@{0}.service"
diff --git a/meta-phosphor/conf/distro/openbmc-phosphor.conf b/meta-phosphor/conf/distro/openbmc-phosphor.conf
index 22b6bc6..2355dca 100644
--- a/meta-phosphor/conf/distro/openbmc-phosphor.conf
+++ b/meta-phosphor/conf/distro/openbmc-phosphor.conf
@@ -31,6 +31,7 @@
obmc-host-ipmi \
obmc-mrw \
obmc-logging-mgmt \
+ obmc-host-ctl \
avahi \
${DISTRO_FEATURES_LIBC} \
"