summaryrefslogtreecommitdiff
path: root/meta-openpower/recipes-phosphor/occ
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-31 13:30:50 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-09-05 00:28:29 +0300
commitd3f78932cf6b3063caceacdae9ddd6ca30d48786 (patch)
tree765de745d26798d7a37340d2851b86b57cda7eb8 /meta-openpower/recipes-phosphor/occ
parentf1ade61b5994799a4cffca0c124b2ed36e640cbf (diff)
downloadopenbmc-d3f78932cf6b3063caceacdae9ddd6ca30d48786.tar.xz
meta-openpower: Move layer content from common/
Adopt a more conventional directory hierarchy. meta-openpower is still a _long_ way from suitable for hosting on yoctoproject.org but things like this don't help. (From meta-openpower rev: 2c8db5661cecd7e4cc20bcb96df76490e62cfb67) Change-Id: I415caaa28ec728f24e755ddb549012f24874fefe Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-openpower/recipes-phosphor/occ')
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-example-native.bb17
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-mrw-native.bb19
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control.bb111
-rw-r--r--meta-openpower/recipes-phosphor/occ/openpower-occ-control.inc5
-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
8 files changed, 215 insertions, 0 deletions
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-example-native.bb b/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-example-native.bb
new file mode 100644
index 000000000..72b82a0b3
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-example-native.bb
@@ -0,0 +1,17 @@
+SUMMARY = "OpenPower OCC Control with example occ sensor IDs"
+PR = "r1"
+
+inherit native
+require openpower-occ-control.inc
+inherit openpower-occ-control
+
+PROVIDES += "virtual/openpower-occ-control-config-native"
+
+S = "${WORKDIR}/git"
+
+# Copies example occ sensor ID yaml file
+do_install() {
+ SRC=${S}
+ install -d ${YAML_DEST}/
+ install -D ${SRC}/example/occ_sensor.yaml ${YAML_DEST}/occ_sensor.yaml
+}
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-mrw-native.bb b/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-mrw-native.bb
new file mode 100644
index 000000000..e851ee1b3
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control-config-mrw-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "OpenPower OCC Control with MRW generated sensor IDs"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit openpower-occ-control
+inherit mrw-xml
+
+PROVIDES += "virtual/openpower-occ-control-config-native"
+DEPENDS += "mrw-native mrw-perl-tools-native"
+
+# Generate a YAML files based on MRW input
+do_install_append() {
+ install -d ${YAML_DEST}/
+ ${STAGING_BINDIR_NATIVE}/perl-native/perl \
+ ${STAGING_BINDIR_NATIVE}/gen_occ_map.pl \
+ -i ${mrw_datadir}/${MRW_XML} \
+ -o ${YAML_DEST}/occ_sensor.yaml
+}
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control.bb b/meta-openpower/recipes-phosphor/occ/openpower-occ-control.bb
new file mode 100644
index 000000000..18b298cc3
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control.bb
@@ -0,0 +1,111 @@
+SUMMARY = "OpenPOWER OCC controller"
+DESCRIPTION = "Application to control the OpenPOWER On-Chip-Controller"
+HOMEPAGE = "https://github.com/openbmc/openpower-occ-control"
+PR = "r1"
+
+inherit autotools \
+ pkgconfig \
+ obmc-phosphor-dbus-service \
+ pythonnative \
+ phosphor-dbus-yaml
+
+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-enable@.service"
+SYSTEMD_SERVICE_${PN} += "op-occ-disable@.service"
+
+DEPENDS += "virtual/${PN}-config-native"
+DEPENDS += " \
+ sdbusplus \
+ sdbusplus-native \
+ phosphor-logging \
+ openpower-dbus-interfaces \
+ phosphor-dbus-interfaces \
+ openpower-dbus-interfaces-native \
+ autoconf-archive-native \
+ obmc-targets \
+ systemd \
+ "
+
+RDEPENDS_${PN} += " \
+ sdbusplus \
+ phosphor-logging \
+ openpower-dbus-interfaces \
+ phosphor-dbus-interfaces \
+ "
+
+EXTRA_OECONF = " \
+ YAML_PATH=${STAGING_DATADIR_NATIVE}/${PN} \
+ PS_DERATING_FACTOR=${POWER_SUPPLY_DERATING_FACTOR} \
+ "
+EXTRA_OECONF_append = "${@bb.utils.contains('OBMC_MACHINE_FEATURES', 'i2c-occ', ' --enable-i2c-occ', '', d)}"
+
+OCC_ENABLE = "enable"
+OCC_DISABLE = "disable"
+HOST_START = "startmin"
+HOST_STOP = "stop"
+
+# Ensure host-stop and host-startmin targets require needed occ states
+OCC_TMPL = "op-occ-{0}@.service"
+HOST_TGTFMT = "obmc-host-{1}@{2}.target"
+OCC_INSTFMT = "op-occ-{0}@{2}.service"
+HOST_OCC_FMT = "../${OCC_TMPL}:${HOST_TGTFMT}.requires/${OCC_INSTFMT}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_ENABLE', 'HOST_START', 'OBMC_HOST_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_DISABLE', 'HOST_STOP', 'OBMC_HOST_INSTANCES')}"
+
+# Set the occ disable service to be executed on host error
+HOST_ERROR_TARGETS = "crash timeout"
+
+OCC_DISABLE_TMPL = "op-occ-disable@.service"
+HOST_ERROR_TGTFMT = "obmc-host-{0}@{1}.target"
+OCC_DISABLE_INSTFMT = "op-occ-disable@{1}.service"
+HOST_ERROR_FMT = "../${OCC_DISABLE_TMPL}:${HOST_ERROR_TGTFMT}.wants/${OCC_DISABLE_INSTFMT}"
+
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_ERROR_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
+
+S = "${WORKDIR}/git"
+
+# Remove packages not required for native build
+DEPENDS_remove_class-native = " \
+ phosphor-logging \
+ obmc-targets \
+ systemd \
+ virtual/${PN}-config-native \
+ "
+# Remove packages not required for native SDK build
+DEPENDS_remove_class-nativesdk = " \
+ phosphor-logging \
+ obmc-targets \
+ systemd \
+ virtual/${PN}-config-native \
+ "
+
+# Provide a means to enable/disable install_error_yaml feature
+PACKAGECONFIG ??= "install_error_yaml"
+PACKAGECONFIG[install_error_yaml] = "\
+ --enable-install_error_yaml,\
+ --disable-install_error_yaml,\
+ ,\
+ "
+
+# Enable install_error_yaml during native and native SDK build
+PACKAGECONFIG_add_class-native = "install_error_yaml"
+PACKAGECONFIG_add_class-nativesdk = "install_error_yaml"
+
+# Disable install_error_yaml during target build
+PACKAGECONFIG_remove_class-target = "install_error_yaml"
+
+# Disable generating elog error header file during bitbake. Applications
+# should be using the elog header generated by phosphor-logging recipe
+EXTRA_OECONF += "--disable-gen_errors"
+
+BBCLASSEXTEND += "native nativesdk"
+
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control.inc b/meta-openpower/recipes-phosphor/occ/openpower-occ-control.inc
new file mode 100644
index 000000000..a54412e4b
--- /dev/null
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control.inc
@@ -0,0 +1,5 @@
+HOMEPAGE = "https://github.com/openbmc/openpower-occ-control"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
+SRC_URI += "git://github.com/openbmc/openpower-occ-control"
+SRCREV = "f7d9e76dc7094214ab11bb4cb21ff6bd853ce750"
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 000000000..a6097e527
--- /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 000000000..0179a5083
--- /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 000000000..b97253cf0
--- /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 000000000..a63e18611
--- /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}