summaryrefslogtreecommitdiffstats
path: root/meta-openbmc-machines/meta-x86
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2017-04-10 15:21:32 -0700
committerPatrick Williams <patrick@stwcx.xyz>2017-07-24 02:49:11 +0000
commitccd06d2dfc36d5738b72d87df7f10576f73a9954 (patch)
treeb80579b492fe710ee1e8fb573a54c1b94430da78 /meta-openbmc-machines/meta-x86
parentf7ac926450782680c9c7b7608b54486e1af64089 (diff)
downloadtalos-openbmc-ccd06d2dfc36d5738b72d87df7f10576f73a9954.tar.gz
talos-openbmc-ccd06d2dfc36d5738b72d87df7f10576f73a9954.zip
Provide the quanta host power control.
systemctl start obmc-chassis-poweroff@0.target systemctl start obmc-chassis-poweron@0.target Added the host-gpio.service on boot to enable the power on and power off scripts. Testing: The scripts were launched with the state change commands above, however they were modified such that they didn't rely on the old namespace. The GPIOs basically trigger the power button on the front panel. Change-Id: I4a205e60c8f43f626f3ea0d4fedf182ccf4700ba Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'meta-openbmc-machines/meta-x86')
-rw-r--r--meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/images/obmc-phosphor-image.bbappend2
-rw-r--r--meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-gpio.service8
-rw-r--r--meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweroff.service13
-rw-r--r--meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweron.service13
-rwxr-xr-xmeta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh32
-rwxr-xr-xmeta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh10
-rwxr-xr-xmeta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh10
-rw-r--r--meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/quanta-powerctrl.bb27
8 files changed, 115 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/images/obmc-phosphor-image.bbappend b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/images/obmc-phosphor-image.bbappend
index ba64218c8..6124ab018 100644
--- a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/images/obmc-phosphor-image.bbappend
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/images/obmc-phosphor-image.bbappend
@@ -1 +1,3 @@
OBMC_IMAGE_EXTRA_INSTALL_append_quanta-q71l = " spictrl"
+OBMC_IMAGE_EXTRA_INSTALL_append_quanta-q71l = " quanta-powerctrl"
+
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-gpio.service b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-gpio.service
new file mode 100644
index 000000000..68adedfc3
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-gpio.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Configure GPIOs for Host Power Control
+
+[Service]
+Restart=no
+RemainsAfterExit=true
+Type=oneshot
+ExecStart={sbindir}/init_once.sh
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweroff.service b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweroff.service
new file mode 100644
index 000000000..d8159a140
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweroff.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Stop Host
+Requires=host-gpio.service
+After=host-gpio.service
+Conflicts=obmc-chassis-power-on@0.target
+
+[Service]
+RemainAfterExit=yes
+Type=oneshot
+ExecStart={sbindir}/poweroff.sh
+
+[Install]
+WantedBy=obmc-chassis-power-off@0.target
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweron.service b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweron.service
new file mode 100644
index 000000000..ee505c90d
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/host-poweron.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Start Host
+Requires=host-gpio.service
+After=host-gpio.service
+Conflicts=obmc-chassis-poweroff@0.target
+
+[Service]
+RemainAfterExit=yes
+Type=oneshot
+ExecStart={sbindir}/poweron.sh
+
+[Install]
+WantedBy=obmc-chassis-poweron@0.target
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
new file mode 100755
index 000000000..f157112fd
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
@@ -0,0 +1,32 @@
+#!/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 1 > /sys/class/gpio/gpio$1/active_low
+ echo $2 > /sys/class/gpio/gpio$1/direction
+}
+
+GPIO_BASE=$(cat /sys/class/gpio/gpiochip*/base)
+
+# FM_BMC_READY_N, GPIO Q4, active low
+set_gpio_active_low $((${GPIO_BASE} + 128 + 4)) high
+
+# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
+set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high
+
+# FM_BMC_SYS_THROTTLE_N, GPIO A3, active low
+set_gpio_active_low $((${GPIO_BASE} + 0 + 3)) high
+
+# FM_BMC_SSB_SCI_LPC_N, GPIO E4, active low
+set_gpio_active_low $((${GPIO_BASE} + 32 + 4)) high
+
+# FP_PWR_BTN_PASS_R_N, GPIO D3, active low
+set_gpio_active_low $((${GPIO_BASE} + 24 + 3)) high
+
+exit 0;
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
new file mode 100755
index 000000000..e429131a7
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+GPIO_BASE=$(cat /sys/class/gpio/gpiochip*/base)
+GPIO_NUM=$(($GPIO_BASE + 24 + 3))
+
+echo 1 > /sys/class/gpio/gpio${GPIO_NUM}/value
+sleep 5
+echo 0 > /sys/class/gpio/gpio${GPIO_NUM}/value
+
+exit 0;
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
new file mode 100755
index 000000000..a0f032622
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+GPIO_BASE=$(cat /sys/class/gpio/gpiochip*/base)
+GPIO_NUM=$(($GPIO_BASE + 24 + 3))
+
+echo 1 > /sys/class/gpio/gpio${GPIO_NUM}/value
+sleep 1
+echo 0 > /sys/class/gpio/gpio${GPIO_NUM}/value
+
+exit 0;
diff --git a/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/quanta-powerctrl.bb b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/quanta-powerctrl.bb
new file mode 100644
index 000000000..fd02327f1
--- /dev/null
+++ b/meta-openbmc-machines/meta-x86/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/quanta-powerctrl.bb
@@ -0,0 +1,27 @@
+FILESEXTRAPATHS_append := "${THISDIR}/files:"
+
+inherit systemd
+inherit obmc-phosphor-license
+inherit obmc-phosphor-systemd
+
+S = "${WORKDIR}/"
+
+SRC_URI = "file://init_once.sh \
+ file://poweroff.sh \
+ file://poweron.sh \
+ file://host-gpio.service \
+ file://host-poweroff.service \
+ file://host-poweron.service"
+
+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}init_once.sh ${D}/${sbindir}/
+ install -m 0755 ${S}poweroff.sh ${D}/${sbindir}/
+ install -m 0755 ${S}poweron.sh ${D}/${sbindir}/
+}
OpenPOWER on IntegriCloud