Initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Currently, the led related services couldn't complete
|
||||
# causing that multi-user.target never complete.
|
||||
# If multi-user.target doesn't complete,
|
||||
# the obmc-host-startmin@.target couldn't start.
|
||||
# In that case, BMC couldn't set current host state to "Running".
|
||||
IMAGE_FEATURES:remove = " \
|
||||
obmc-leds \
|
||||
"
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
[]
|
||||
+1
@@ -0,0 +1 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
GPIOCHIP_IO_EXP_SLOT_PWR_CTRL=$(basename "/sys/bus/i2c/devices/$MEDUSA_IO_EXP_BUS_NUM-00$IO_EXP_SLOT_PWR_CTRL_ADDR/"*gpiochip*)
|
||||
|
||||
#IO 0:7 input port for showing slot 1:8 power status
|
||||
#IO 8:16 output port for controlling slot 1:8 power status
|
||||
CHASSIS_ID=$1
|
||||
IO_EXP_SLOT_PWR_STATUS=$((CHASSIS_ID - 1))
|
||||
IO_EXP_SLOT_PWR_CTRL=$((IO_EXP_SLOT_PWR_STATUS + 8))
|
||||
|
||||
chassis-power-cycle()
|
||||
{
|
||||
CHASSIS_ID=$1
|
||||
|
||||
if [ "$CHASSIS_ID" -le 8 ]
|
||||
then
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_ON" ]
|
||||
then
|
||||
if ! gpioset "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_CTRL"=0
|
||||
then
|
||||
echo "Failed to set slot$1 power off"
|
||||
fi
|
||||
sleep 10
|
||||
fi
|
||||
if ! gpioset "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_CTRL"=1
|
||||
then
|
||||
echo "Failed to set slot$1 power on"
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
# Check chassis status after doing 12V cycle
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_ON" ]
|
||||
then
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_ON_PROPERTY"
|
||||
exit 0;
|
||||
else
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_OFF_PROPERTY"
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Invalid slot id"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if [ "$1" == 0 ]
|
||||
then
|
||||
# TODO: SLED cycle
|
||||
echo "SLED-cycle is not support for now"
|
||||
else
|
||||
echo "Starting slot$1 cycle"
|
||||
chassis-power-cycle "$1"
|
||||
fi
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Chassis Power Cycle: %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-chassis-powercycle@%i.target
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
GPIOCHIP_IO_EXP_SLOT_PWR_CTRL=$(basename "/sys/bus/i2c/devices/$MEDUSA_IO_EXP_BUS_NUM-00$IO_EXP_SLOT_PWR_CTRL_ADDR/"*gpiochip*)
|
||||
|
||||
#IO 0:7 input port for showing slot 1:8 power status
|
||||
#IO 8:16 output port for controlling slot 1:8 power status
|
||||
CHASSIS_ID=$1
|
||||
IO_EXP_SLOT_PWR_STATUS=$((CHASSIS_ID - 1))
|
||||
IO_EXP_SLOT_PWR_CTRL=$((IO_EXP_SLOT_PWR_STATUS + 8))
|
||||
|
||||
# Server 12v power off
|
||||
chassis-power-off()
|
||||
{
|
||||
if ! gpioset "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_CTRL"=0
|
||||
then
|
||||
echo "Failed to set slot$1 power off"
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
# Check chassis status after doing 12V off
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_OFF" ]
|
||||
then
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_OFF_PROPERTY"
|
||||
echo "Chassis is power off"
|
||||
else
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_ON_PROPERTY"
|
||||
echo "Chassis is power on"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL $IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_ON" ]
|
||||
then
|
||||
chassis-power-off
|
||||
exit 0;
|
||||
else
|
||||
echo "Chassis is already off"
|
||||
exit 0;
|
||||
fi
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=power off chassis:%i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/chassis-poweroff %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-chassis-hard-poweroff@%i.target
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
GPIOCHIP_IO_EXP_SLOT_PWR_CTRL=$(basename "/sys/bus/i2c/devices/$MEDUSA_IO_EXP_BUS_NUM-00$IO_EXP_SLOT_PWR_CTRL_ADDR/"*gpiochip*)
|
||||
|
||||
#IO 0:7 input port for showing slot 1:8 power status
|
||||
#IO 8:16 output port for controlling slot 1:8 power status
|
||||
CHASSIS_ID=$1
|
||||
IO_EXP_SLOT_PWR_STATUS=$((CHASSIS_ID - 1))
|
||||
IO_EXP_SLOT_PWR_CTRL=$((IO_EXP_SLOT_PWR_STATUS + 8))
|
||||
|
||||
# Server 12v power on
|
||||
chassis-power-on()
|
||||
{
|
||||
if ! gpioset "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_CTRL"=1
|
||||
then
|
||||
echo "Failed to set slot$1 power on"
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
# Check chassis status after doing 12V on
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_ON" ]
|
||||
then
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_ON_PROPERTY"
|
||||
echo "Chassis is power on"
|
||||
else
|
||||
busctl set-property "$CHASSIS_BUS_NAME""$CHASSIS_ID" "$CHASSIS_OBJ_PATH""$CHASSIS_ID" "$CHASSIS_INTF_NAME" "$CHASSIS_PROPERTY_NAME" s "$CHASSIS_OFF_PROPERTY"
|
||||
echo "Chassis is power off"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
chassis_status=$(gpioget "$GPIOCHIP_IO_EXP_SLOT_PWR_CTRL" "$IO_EXP_SLOT_PWR_STATUS")
|
||||
if [ "$chassis_status" == "$STATE_OFF" ]
|
||||
then
|
||||
chassis-power-on
|
||||
exit 0;
|
||||
else
|
||||
echo "Chassis is already on"
|
||||
exit 0;
|
||||
fi
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=power on chassis:%i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/chassis-poweron %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-chassis-poweron@%i.target
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
# TODO: host power cycle
|
||||
echo "Host power cycle is not support for now"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Host Power Cycle: %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/host-powercycle %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-reboot@%i.target
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
# TODO: host power off
|
||||
echo "Host power off is not support for now"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=power off host:%i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/host-poweroff %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-shutdown@%i.target
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
# TODO: host power on
|
||||
echo "Host power on is not support for now"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=power on host:%i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/host-poweron %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-start@%i.target
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
|
||||
source /usr/libexec/phosphor-state-manager/power-cmd
|
||||
|
||||
# TODO: host power reset
|
||||
echo "Host power reset is not support for now"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Host Power Reset: %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/host-powerreset %i
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-force-warm-reboot@%i.target
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
export STATE_OFF=0
|
||||
export STATE_ON=1
|
||||
export STATE_UNKNOWN=-1
|
||||
export MANAGEMENT_BOARD_IO_EXP_BUS_NUM="12"
|
||||
export MEDUSA_IO_EXP_BUS_NUM="11"
|
||||
export IO_EXP_SLOT_PWR_CTRL_ADDR="22"
|
||||
export IO_EXP_SLED_PWR_CTRL_ADDR="22"
|
||||
export CHASSIS_BUS_NAME="xyz.openbmc_project.State.Chassis"
|
||||
export CHASSIS_OBJ_PATH="/xyz/openbmc_project/state/chassis"
|
||||
export CHASSIS_INTF_NAME="xyz.openbmc_project.State.Chassis"
|
||||
export CHASSIS_PROPERTY_NAME="CurrentPowerState"
|
||||
export CHASSIS_ON_PROPERTY="xyz.openbmc_project.State.Chassis.PowerState.On"
|
||||
export CHASSIS_OFF_PROPERTY="xyz.openbmc_project.State.Chassis.PowerState.Off"
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Sled Cycle
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle 0
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-chassis-powercycle@0.target
|
||||
@@ -0,0 +1,49 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
EXTRA_OEMESON:append = " \
|
||||
-Dwarm-reboot=enabled \
|
||||
"
|
||||
|
||||
CHASSIS_DEFAULT_TARGETS:remove:yosemite4 = " \
|
||||
obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
|
||||
obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
|
||||
obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
|
||||
obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
|
||||
"
|
||||
|
||||
SRC_URI:append:yosemite4 = " \
|
||||
file://chassis-poweroff@.service \
|
||||
file://chassis-poweron@.service \
|
||||
file://chassis-powercycle@.service \
|
||||
file://host-poweroff@.service \
|
||||
file://host-poweron@.service \
|
||||
file://host-powercycle@.service \
|
||||
file://host-powerreset@.service \
|
||||
file://chassis-poweroff \
|
||||
file://chassis-poweron \
|
||||
file://chassis-powercycle \
|
||||
file://host-poweroff \
|
||||
file://host-poweron \
|
||||
file://host-powercycle \
|
||||
file://host-powerreset \
|
||||
file://power-cmd \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}:append:yosemite4 = " bash"
|
||||
|
||||
do_install:append:yosemite4() {
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/*.service ${D}${systemd_system_unitdir}/
|
||||
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0777 ${WORKDIR}/chassis-poweroff ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/chassis-poweron ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/chassis-powercycle ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/host-poweroff ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/host-poweron ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/host-powercycle ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/host-powerreset ${D}${libexecdir}/${PN}/
|
||||
install -m 0777 ${WORKDIR}/power-cmd ${D}${libexecdir}/${PN}/
|
||||
}
|
||||
|
||||
FILES:${PN} += " ${systemd_system_unitdir}/*.service"
|
||||
Reference in New Issue
Block a user