meta-amd: Add chassis control application
1. Remove the legacy AMD power control mechanism based off of phosphor
watchdog.
2. Removes "amd-powerctrl" app.
3. Add a new chassis power control app based off of x86-power-control
recipe with modifications needed to support EthanolX customer reference
board.
4. Update ethanolx configuration and packagegroup files to reflect the
above changes.
Change-Id: Icb361370fa57a0d10b4758ff688a8e607dec61d7
Signed-off-by: Supreeth Venkatesh <supreeth.venkatesh@amd.com>
diff --git a/recipes-amd/amd-powerctrl/amd-powerctrl.bb b/recipes-amd/amd-powerctrl/amd-powerctrl.bb
deleted file mode 100644
index a94356f..0000000
--- a/recipes-amd/amd-powerctrl/amd-powerctrl.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-FILESEXTRAPATHS_append := "${THISDIR}/files:"
-
-inherit obmc-phosphor-systemd
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=ab6ba4709f1286c534f36392ac1dcd27"
-
-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/recipes-amd/amd-powerctrl/files/LICENSE b/recipes-amd/amd-powerctrl/files/LICENSE
deleted file mode 100644
index e5a0f63..0000000
--- a/recipes-amd/amd-powerctrl/files/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2020 AMD 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/recipes-amd/amd-powerctrl/files/host-gpio.service b/recipes-amd/amd-powerctrl/files/host-gpio.service
deleted file mode 100644
index 346ff94..0000000
--- a/recipes-amd/amd-powerctrl/files/host-gpio.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Configure GPIOs for EthanolX
-
-[Service]
-Restart=no
-RemainAfterExit=true
-Type=oneshot
-ExecStart=/usr/sbin/setup_gpio.sh
-SyslogIdentifier=setup_gpio.sh
diff --git a/recipes-amd/amd-powerctrl/files/host-poweroff.service b/recipes-amd/amd-powerctrl/files/host-poweroff.service
deleted file mode 100644
index 8b00801..0000000
--- a/recipes-amd/amd-powerctrl/files/host-poweroff.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Shutdown Host Server
-Requires=host-gpio.service
-After=host-gpio.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/sbin/power-util off
-SyslogIdentifier=power-util
diff --git a/recipes-amd/amd-powerctrl/files/host-poweron.service b/recipes-amd/amd-powerctrl/files/host-poweron.service
deleted file mode 100644
index 1f52628..0000000
--- a/recipes-amd/amd-powerctrl/files/host-poweron.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Poweron Host Server
-Requires=host-gpio.service
-After=host-gpio.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/sbin/power-util on
-SyslogIdentifier=power-util
-
-[Install]
-WantedBy=basic.target
diff --git a/recipes-amd/amd-powerctrl/files/power-util b/recipes-amd/amd-powerctrl/files/power-util
deleted file mode 100755
index b67db36..0000000
--- a/recipes-amd/amd-powerctrl/files/power-util
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
-#MGMT_ASSERT_PWR_BTN - Asserts the system power button, GPIO M0, Active High, (Default = Low)
-GPIO_PWR_BTN=$(($GPIO_BASE + 96 + 0))
-#MGMT_ASSERT_RST_BTN - Assert the system cold reset button, GPIO M1, Active High, (Default = Low)
-GPIO_RST_BTN=$(($GPIO_BASE + 96 + 1))
-# MGMT_ASSERT_BMC_READY - Hold low until BMC has completed initialization, then drive high, GPIO M7, (Default = Low)
-GPIO_BMC_READY=$((${GPIO_BASE} + 96 + 7))
-
-# Usage of this utility
-function usage() {
- echo "usage: power-util [on|off|cycle|status|reset]";
-}
-
-power_off() {
- echo "Shutting down Server"
- POWER_STATUS=off
- printf %s "$POWER_STATUS" > /tmp/power_status
- echo 1 > /sys/class/gpio/gpio${GPIO_PWR_BTN}/value
- # Long Press
- sleep 5
- echo 0 > /sys/class/gpio/gpio${GPIO_PWR_BTN}/value
-}
-
-power_on() {
- echo "Powering on Server"
- echo 1 > /sys/class/gpio/gpio${GPIO_PWR_BTN}/value
- # Short Press
- sleep 1
- echo 0 > /sys/class/gpio/gpio${GPIO_PWR_BTN}/value
- POWER_STATUS=on
- printf %s "$POWER_STATUS" > /tmp/power_status
-}
-
-power_status() {
- POWER_STATUS=$(cat /tmp/power_status)
- echo ${POWER_STATUS}
-}
-
-power_reset() {
- echo "Toggle Cold Reset"
- echo 1 > /sys/class/gpio/gpio${GPIO_RST_BTN}/value
- sleep 1
- echo 0 > /sys/class/gpio/gpio${GPIO_RST_BTN}/value
-}
-
-if [ $# -lt 1 ]; then
- echo "Total number of parameter=$#"
- echo "Insufficient parameter"
- usage;
- exit 0;
-fi
-
-if [ $1 = "on" ]; then
- if [ $(power_status) == "off" ]; then
- power_on
- fi
-elif [ $1 = "off" ]; then
- if [ $(power_status) == "on" ]; then
- power_off
- fi
-elif [ $1 == "cycle" ]; then
- if [ $(power_status) == "on" ]; then
- power_off
- else
- echo "WARNING: Powering on server"
- power_on
- fi
-elif [ $1 == "reset" ]; then
- if [ $(power_status) == "on" ]; then
- power_reset
- else
- echo "ERROR: Server not powered on"
- fi
-elif [ $1 == "status" ]; then
- power_status
-else
- echo "Invalid parameter=$1"
- usage;
-fi
-
-exit 0;
diff --git a/recipes-amd/amd-powerctrl/files/setup_gpio.sh b/recipes-amd/amd-powerctrl/files/setup_gpio.sh
deleted file mode 100755
index 629bb48..0000000
--- a/recipes-amd/amd-powerctrl/files/setup_gpio.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# Set all output GPIOs as such and drive them with reasonable values.
-function set_gpio_active_low() {
- if [ $# -ne 3 ]; then
- echo "set_gpio_active_low: need GPIO#, active_low and initial value";
- return;
- fi
-
- echo $1 > /sys/class/gpio/export
- echo $2 > /sys/class/gpio/gpio$1/active_low
- echo $3 > /sys/class/gpio/gpio$1/direction
-}
-
-GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
-# MGMT_ASSERT_BMC_READY - Hold low until BMC has completed initialization, then drive high, GPIO M7, (Default = Low)
-GPIO_BMC_READY=$((${GPIO_BASE} + 96 + 7))
-
-#MGMT_ASSERT_PWR_BTN - Asserts the system power button, GPIO M0, Active High, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 0)) 0 low
-
-#MGMT_ASSERT_RST_BTN - Assert the system cold reset button, GPIO M1, Active High, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 1)) 0 low
-
-#MGMT_ASSERT_NMI_BTN - Asserts the system NMI button, GPIO M2 Active High, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 2)) 0 low
-
-#MGMT_ASSERT_P0_PROCHOT - Asserts the P0 PROCHOT_L signal, GPIO M4, Active High, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 4)) 0 low
-
-#MGMT_ASSERT_P1_PROCHOT - Asserts the P1 PROCHOT_L signal, GPIO M6, Active High, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 5)) 0 low
-
-#MGMT_ASSERT_CLR_CMOS - Clears processor CMOS, assert high for 1s To clear CMOS, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 6)) 0 low
-
-# MGMT_ASSERT_BMC_READY - Hold low until BMC has completed initialization, then drive high, GPIO M7, (Default = Low)
-set_gpio_active_low $((${GPIO_BASE} + 96 + 7)) 0 low
-
-# DRIVE BMC_READY HIGH
-echo 1 > /sys/class/gpio/gpio${GPIO_BMC_READY}/value
-POWER_STATUS=on
-# Write to temp. file named "power_status"
-rm -f /tmp/power_status
-printf %s "$POWER_STATUS" > /tmp/power_status
-exit 0;
diff --git a/recipes-amd/packagegroups/packagegroup-amd-apps.bb b/recipes-amd/packagegroups/packagegroup-amd-apps.bb
index 1839132..3c71220 100644
--- a/recipes-amd/packagegroups/packagegroup-amd-apps.bb
+++ b/recipes-amd/packagegroups/packagegroup-amd-apps.bb
@@ -22,7 +22,10 @@
RPROVIDES_${PN}-system += "virtual-obmc-system-mgmt"
SUMMARY_${PN}-chassis = "AMD Chassis"
-RDEPENDS_${PN}-chassis = ""
+RDEPENDS_${PN}-chassis = " \
+ x86-power-control \
+ obmc-host-failure-reboots \
+ "
SUMMARY_${PN}-fans = "AMD Fans"
RDEPENDS_${PN}-fans = ""
@@ -34,7 +37,6 @@
SUMMARY_${PN}-system = "AMD System"
RDEPENDS_${PN}-system = " \
- amd-powerctrl \
bmcweb \
entity-manager \
ipmitool \