summaryrefslogtreecommitdiff
path: root/meta-facebook/recipes-fb
diff options
context:
space:
mode:
authorVijay Khemka <vijaykhemka@fb.com>2020-02-21 00:35:51 +0300
committerAndrew Geissler <geissonator@yahoo.com>2020-03-05 04:44:17 +0300
commit60329ae7948afad0113799469efa212bba60b9b7 (patch)
treeb1599d5ef9baa2eb998019c1d2497a176952cc1c /meta-facebook/recipes-fb
parentde4b38553068abc5058acc7bae4d4d855999af03 (diff)
downloadopenbmc-60329ae7948afad0113799469efa212bba60b9b7.tar.xz
meta-facebook: Move common recipe under facebook layer
Moved common facebook recipe under meta-facebook to support multiple facebook platform and make use of common code across platforms. This is just a first phase to add common layer and moved meta-tiogapass/recipe-fbtp to ./recipe-fb. Slowly, will move all common meta data under meta-facebook. (From meta-facebook rev: 2769bfe7823ce0ce426f2faf463c6d91e43b6c29) Change-Id: I7f9f0d2d621524bc6de1c948a55a23238e3a7b7f Signed-off-by: Vijay Khemka <vijaykhemka@fb.com> Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-facebook/recipes-fb')
-rw-r--r--meta-facebook/recipes-fb/fb-powerctrl/fb-powerctrl.bb26
-rw-r--r--meta-facebook/recipes-fb/fb-powerctrl/files/LICENSE13
-rw-r--r--meta-facebook/recipes-fb/fb-powerctrl/files/host-gpio.service9
-rw-r--r--meta-facebook/recipes-fb/fb-powerctrl/files/host-poweroff.service9
-rw-r--r--meta-facebook/recipes-fb/fb-powerctrl/files/host-poweron.service12
-rwxr-xr-xmeta-facebook/recipes-fb/fb-powerctrl/files/power-util83
-rwxr-xr-xmeta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh22
-rwxr-xr-xmeta-facebook/recipes-fb/ipmi/fb-ipmi-oem_git.bb36
-rw-r--r--meta-facebook/recipes-fb/packagegroups/packagegroup-fb-apps.bb28
9 files changed, 238 insertions, 0 deletions
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/fb-powerctrl.bb b/meta-facebook/recipes-fb/fb-powerctrl/fb-powerctrl.bb
new file mode 100644
index 000000000..a46c44bbd
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/fb-powerctrl.bb
@@ -0,0 +1,26 @@
+FILESEXTRAPATHS_append := "${THISDIR}/files:"
+
+inherit obmc-phosphor-systemd
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a8328fd2a610bf4527feedcaa3ae3d14"
+
+S = "${WORKDIR}/"
+
+SRC_URI = "file://setup_gpio.sh \
+ file://power-util \
+ file://host-gpio.service \
+ file://host-poweroff.service \
+ file://host-poweron.service \
+ file://LICENSE"
+
+DEPENDS = "systemd"
+RDEPENDS_${PN} = "bash"
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "host-gpio.service host-poweron.service host-poweroff.service"
+
+do_install() {
+ install -d ${D}/usr/sbin
+ install -m 0755 ${S}setup_gpio.sh ${D}/${sbindir}/
+ install -m 0755 ${S}power-util ${D}/${sbindir}/
+}
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/LICENSE b/meta-facebook/recipes-fb/fb-powerctrl/files/LICENSE
new file mode 100644
index 000000000..2caf82099
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/LICENSE
@@ -0,0 +1,13 @@
+Copyright 2018 Facebook Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/host-gpio.service b/meta-facebook/recipes-fb/fb-powerctrl/files/host-gpio.service
new file mode 100644
index 000000000..82ba12e8e
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/host-gpio.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Configure GPIOs for Tiogapass
+
+[Service]
+Restart=no
+RemainAfterExit=true
+Type=oneshot
+ExecStart=/usr/sbin/setup_gpio.sh
+SyslogIdentifier=setup_gpio.sh
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweroff.service b/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweroff.service
new file mode 100644
index 000000000..d23ef909c
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweroff.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Shutdown Host Server
+Requires=host-gpio.service
+After=host-gpio.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/power-util mb off
+SyslogIdentifier=power-util
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweron.service b/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweron.service
new file mode 100644
index 000000000..446df3850
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/host-poweron.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Poweron Host Server
+Requires=host-gpio.service
+After=host-gpio.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/power-util mb on
+SyslogIdentifier=power-util
+
+[Install]
+WantedBy=basic.target
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/power-util b/meta-facebook/recipes-fb/fb-powerctrl/files/power-util
new file mode 100755
index 000000000..30fa34cc8
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/power-util
@@ -0,0 +1,83 @@
+#!/bin/bash
+# Usage of this utility
+function usage() {
+ echo "usage: power-util mb [on|off|status|cycle|reset]";
+ echo " power-util sled-cycle"
+}
+
+power_off() {
+ echo "Shutting down Server $2"
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Off
+}
+
+power_on() {
+ echo "Powering on Server $2"
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.On
+}
+
+power_status() {
+ st=$(busctl get-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis CurrentPowerState | cut -d"." -f6)
+ if [ "$st" == "On\"" ]; then
+ echo "on"
+ else
+ echo "off"
+ fi
+}
+
+power_reset() {
+ echo "Reset on server $2"
+ busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Reset
+}
+
+sled_cycle() {
+ i2cset -y 7 0x45 0xd9 c
+}
+
+if [ $1 == "sled-cycle" ]; then
+ echo "SLED_CYCLE starting at $(date)"
+ sled_cycle
+ exit 0;
+fi
+
+if [ $# -lt 2 ]; then
+ echo "Total number of parameter=$#"
+ echo "Insufficient parameter"
+ usage;
+ exit 0;
+fi
+
+if [ $1 != "mb" ]; then
+ echo "Invalid parameter1=$1"
+ usage;
+ exit 0;
+fi
+
+if [ $2 = "on" ]; then
+ if [ $(power_status) == "off" ]; then
+ power_on
+ fi
+elif [ $2 = "off" ]; then
+ if [ $(power_status) == "on" ]; then
+ power_off
+ fi
+elif [ $2 == "cycle" ]; then
+ if [ $(power_status) == "on" ]; then
+ power_off
+ else
+ echo "WARNING: Powering on server"
+ fi
+ power_on
+elif [ $2 == "reset" ]; then
+ if [ $(power_status) == "on" ]; then
+ power_reset
+ else
+ echo "ERROR: Server not powered on"
+ fi
+elif [ $2 == "status" ]; then
+ power_status
+else
+ echo "Invalid parameter2=$2"
+ usage;
+fi
+
+exit 0;
diff --git a/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh b/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
new file mode 100755
index 000000000..2624abd0d
--- /dev/null
+++ b/meta-facebook/recipes-fb/fb-powerctrl/files/setup_gpio.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Set all output GPIOs as such and drive them with reasonable values.
+function set_gpio_active_low() {
+ if [ $# -ne 2 ]; then
+ echo "set_gpio_active_low: need both GPIO# and initial level";
+ return;
+ fi
+
+ echo $1 > /sys/class/gpio/export
+ echo $2 > /sys/class/gpio/gpio$1/direction
+}
+
+GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)
+
+# FM_BMC_READY_N, GPIO S1, active low
+set_gpio_active_low $((${GPIO_BASE} + 144 +1)) low
+
+# FP_PECI_MUX, active low
+set_gpio_active_low $((${GPIO_BASE} + 212)) high
+
+exit 0;
diff --git a/meta-facebook/recipes-fb/ipmi/fb-ipmi-oem_git.bb b/meta-facebook/recipes-fb/ipmi/fb-ipmi-oem_git.bb
new file mode 100755
index 000000000..77d1e4570
--- /dev/null
+++ b/meta-facebook/recipes-fb/ipmi/fb-ipmi-oem_git.bb
@@ -0,0 +1,36 @@
+SUMMARY = "Facebook OEM IPMI commands"
+DESCRIPTION = "Facebook OEM IPMI commands"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9e69ba356fa59848ffd865152a3ccc13"
+
+SRC_URI = "git://github.com/openbmc/fb-ipmi-oem"
+SRCREV = "317999d3ac917654950e1288171b0cd546754880"
+
+S = "${WORKDIR}/git"
+PV = "0.1+git${SRCPV}"
+
+DEPENDS = "boost phosphor-ipmi-host phosphor-logging systemd "
+
+inherit cmake obmc-phosphor-ipmiprovider-symlink
+
+EXTRA_OECMAKE="-DENABLE_TEST=0 -DYOCTO=1"
+
+LIBRARY_NAMES = "libzfboemcmds.so"
+
+HOSTIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
+NETIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
+
+FILES_${PN}_append = " ${datadir}/lcd-debug/post_desc.json"
+FILES_${PN}_append = " ${datadir}/lcd-debug/gpio_desc.json"
+FILES_${PN}_append = " ${datadir}/lcd-debug/cri_sensors.json"
+
+FILES_${PN}_append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
+FILES_${PN}_append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
+FILES_${PN}_append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
+FILES_${PN}-dev_append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV}"
+
+do_install_append(){
+ install -d ${D}${includedir}/fb-ipmi-oem
+ install -m 0644 -D ${S}/include/*.hpp ${D}${includedir}/fb-ipmi-oem
+}
diff --git a/meta-facebook/recipes-fb/packagegroups/packagegroup-fb-apps.bb b/meta-facebook/recipes-fb/packagegroups/packagegroup-fb-apps.bb
new file mode 100644
index 000000000..a5dae1d9a
--- /dev/null
+++ b/meta-facebook/recipes-fb/packagegroups/packagegroup-fb-apps.bb
@@ -0,0 +1,28 @@
+SUMMARY = "OpenBMC for Facebook - Applications"
+PR = "r1"
+
+inherit packagegroup
+
+PROVIDES = "${PACKAGES}"
+PACKAGES = " \
+ ${PN}-system \
+ "
+
+PROVIDES += "virtual/obmc-system-mgmt"
+
+RPROVIDES_${PN}-system += "virtual-obmc-system-mgmt"
+
+SUMMARY_${PN}-system = "Facebook System"
+RDEPENDS_${PN}-system = " \
+ entity-manager \
+ dbus-sensors \
+ fb-powerctrl \
+ phosphor-ipmi-ipmb \
+ fb-ipmi-oem \
+ phosphor-pid-control \
+ phosphor-hostlogger \
+ phosphor-sel-logger \
+ ipmitool \
+ phosphor-post-code-manager \
+ phosphor-host-postd \
+ "