summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-08-15 14:04:51 -0500
committerAndrew Geissler <andrewg@us.ibm.com>2017-08-18 07:30:21 -0500
commit4cd9d0a07170821860a8c9a3e864676355c236f2 (patch)
tree4cb03b02062f75ebf945fbd269a10a8397aa8245
parent3de347ba1e3e8bb1bafdd6fa83adf921a5bebd9e (diff)
downloadtalos-openbmc-4cd9d0a07170821860a8c9a3e864676355c236f2.tar.gz
talos-openbmc-4cd9d0a07170821860a8c9a3e864676355c236f2.zip
Disable OCC active on host stop
The OCC active sensor drives the binding and unbinding of the OCC device driver to the OCC's. Need to ensure if the host is stopped for any reason, that the OCC sensors are set to non-active. Resolves openbmc/openbmc#2148 Change-Id: I5e4bc5469ddda16c961b9f46c771c101b7092cd6 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control.bb17
-rwxr-xr-xmeta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh17
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service10
3 files changed, 44 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control.bb
index 390ea720a..0befe277e 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control.bb
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control.bb
@@ -10,7 +10,15 @@ inherit autotools \
require ${PN}.inc
+SRC_URI += "file://occ-active.sh"
+do_install_append() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/occ-active.sh \
+ ${D}${bindir}/occ-active.sh
+}
+
DBUS_SERVICE_${PN} += "org.open_power.OCC.Control.service"
+SYSTEMD_SERVICE_${PN} += "op-occ-disable@.service"
DEPENDS += "virtual/${PN}-config-native"
DEPENDS += " \
@@ -21,6 +29,8 @@ DEPENDS += " \
phosphor-dbus-interfaces \
openpower-dbus-interfaces-native \
autoconf-archive-native \
+ obmc-targets \
+ systemd \
"
RDEPENDS_${PN} += " \
@@ -33,4 +43,11 @@ RDEPENDS_${PN} += " \
EXTRA_OECONF = "YAML_PATH=${STAGING_DATADIR_NATIVE}/${PN}"
EXTRA_OECONF_append = "${@bb.utils.contains('OBMC_MACHINE_FEATURES', 'i2c-occ', ' --enable-i2c-occ', '', d)}"
+# Ensure host stop target requires occ disable service
+OCC_DISABLE_TMPL = "op-occ-disable@.service"
+HOST_STOP_TGTFMT = "obmc-host-stop@{0}.target"
+OCC_DISABLE_INSTFMT = "op-occ-disable@{0}.service"
+HOST_STOP_OCC_DISABLE_FMT = "../${OCC_DISABLE_TMPL}:${HOST_STOP_TGTFMT}.requires/${OCC_DISABLE_INSTFMT}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_STOP_OCC_DISABLE_FMT', 'OBMC_HOST_INSTANCES')}"
+
S = "${WORKDIR}/git"
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
new file mode 100755
index 000000000..0d4857c11
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# set and unset occ active for all occ's in system
+
+if [ "$1" == "disable" ]; then
+ value='false'
+elif [ "$1" == "enable" ]; then
+ value='true'
+else
+ echo "Usage: occ-active.sh [argument]"
+ echo " enable - set occ's to active state"
+ echo " disable - set occ's to inactive state"
+ exit -1
+fi
+busctl tree org.open_power.OCC.Control --list | grep occ | xargs -n1 -I{} \
+ busctl set-property org.open_power.OCC.Control {} \
+ org.open_power.OCC.Status OccActive b $value
+exit 0
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service
new file mode 100644
index 000000000..3b19c2b30
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=OpenPOWER OCC Active Disable
+Before=obmc-host-stop-pre@%i.target
+
+[Service]
+ExecStart={bindir}/occ-active.sh disable
+Type=oneshot
+
+[Install]
+WantedBy=obmc-host-stop@%i.target
OpenPOWER on IntegriCloud