summaryrefslogtreecommitdiff
path: root/meta-openpower/recipes-phosphor/occ/openpower-occ-control
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openpower/recipes-phosphor/occ/openpower-occ-control')
-rwxr-xr-xmeta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh20
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service12
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-enable@.service17
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control/org.open_power.OCC.Control.service14
4 files changed, 63 insertions, 0 deletions
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
new file mode 100755
index 0000000000..a6097e5270
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -0,0 +1,20 @@
+#!/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
+
+OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
+
+busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
+ busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
+ OccActive b $value
+exit 0
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service
new file mode 100644
index 0000000000..0179a5083a
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-disable@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenPOWER OCC Active Disable
+Before=obmc-host-stop-pre@%i.target
+Conflicts=op-occ-enable@%i.service
+
+[Service]
+ExecStart=/usr/bin/env occ-active.sh disable
+SyslogIdentifier=occ-active.sh
+Type=oneshot
+
+[Install]
+WantedBy=obmc-host-stop@%i.target
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-enable@.service b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-enable@.service
new file mode 100644
index 0000000000..b97253cf07
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/op-occ-enable@.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=OpenPOWER OCC Active Enable for host %I
+Conflicts=obmc-host-stop@%i.target
+Conflicts=op-occ-disable@%i.service
+Wants=org.open_power.OCC.Control.service
+After=org.open_power.OCC.Control.service
+Wants=fsi-scan@%i.service
+After=fsi-scan@%i.service
+ConditionPathExists=/run/openbmc/host@%i-on
+
+[Service]
+ExecStart=/usr/bin/env occ-active.sh enable
+SyslogIdentifier=occ-active.sh
+Type=oneshot
+
+[Install]
+WantedBy=obmc-host-start@%i.target
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/org.open_power.OCC.Control.service b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/org.open_power.OCC.Control.service
new file mode 100644
index 0000000000..a63e18611d
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/org.open_power.OCC.Control.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=OpenPOWER OCC controller
+Wants=mapper-wait@-xyz-openbmc_project-inventory.service
+After=mapper-wait@-xyz-openbmc_project-inventory.service
+
+[Service]
+ExecStart=/usr/bin/env openpower-occ-control
+SyslogIdentifier=openpower-occ-control
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}