Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1 @@
console-id = host0
@@ -0,0 +1 @@
console-id = host1
@@ -0,0 +1 @@
console-id = host2
@@ -0,0 +1 @@
console-id = host3
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot1
Wants=obmc-console@ttyS0.service
[Socket]
ListenStream=2300
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot1
Wants=obmc-console@ttyS0.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot1 bic
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host0" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS0
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot1
Wants=obmc-console@ttyS0.service
[Socket]
ListenStream=2200
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot1
Wants=obmc-console@ttyS0.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot1 host
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host0" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS0
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot2
Wants=obmc-console@ttyS1.service
[Socket]
ListenStream=2301
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot2
Wants=obmc-console@ttyS1.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot2 bic
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host1" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS1
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot2
Wants=obmc-console@ttyS1.service
[Socket]
ListenStream=2201
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot2
Wants=obmc-console@ttyS1.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot2 host
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host1" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS1
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot3
Wants=obmc-console@ttyS2.service
[Socket]
ListenStream=2302
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,12 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot3
Wants=obmc-console@ttyS2.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot3 bic
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host2" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS2
CollectMode=inactive-or-failed
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot3
Wants=obmc-console@ttyS2.service
[Socket]
ListenStream=2202
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot3
Wants=obmc-console@ttyS2.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot3 host
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host2" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS2
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot4
Wants=obmc-console@ttyS3.service
[Socket]
ListenStream=2303
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor BIC Console SSH socket for Slot4
Wants=obmc-console@ttyS3.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot4 bic
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host3" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS3
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,10 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot4
Wants=obmc-console@ttyS3.service
[Socket]
ListenStream=2203
Accept=yes
[Install]
WantedBy=sockets.target
@@ -0,0 +1,11 @@
[Unit]
Description=Phosphor Host Console SSH socket for Slot4
Wants=obmc-console@ttyS3.service
[Service]
ExecStartPre=/usr/bin/select-uart-mux slot4 host
ExecStart=/usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -i host3" $DROPBEAR_EXTRA_ARGS
SyslogIdentifier=console-client-ttyS3
ExecReload=/bin/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
@@ -0,0 +1,4 @@
local-tty = ttyS0
baud = 57600
console-id = host0
logfile = /var/log/obmc-console0.log
@@ -0,0 +1,4 @@
local-tty = ttyS1
baud = 57600
console-id = host1
logfile = /var/log/obmc-console1.log
@@ -0,0 +1,4 @@
local-tty = ttyS2
baud = 57600
console-id = host2
logfile = /var/log/obmc-console2.log
@@ -0,0 +1,4 @@
local-tty = ttyS3
baud = 57600
console-id = host3
logfile = /var/log/obmc-console3.log
@@ -0,0 +1,2 @@
local-tty = ttyS2
baud = 57600
@@ -0,0 +1,59 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
OBMC_CONSOLE_HOST_TTY = "ttyS2"
OBMC_CONSOLE_TTYS:fb-compute-multihost = "ttyS0 ttyS1 ttyS2 ttyS3"
SRC_URI:append:fb-compute-singlehost = " file://server.ttyS2.conf"
SRC_URI:append:fb-compute-multihost = " file://server.ttyS0.conf \
file://server.ttyS1.conf \
file://server.ttyS2.conf \
file://server.ttyS3.conf \
file://client.2200.conf \
file://client.2201.conf \
file://client.2202.conf \
file://client.2203.conf"
CLIENT_SERVICE_FILES_FMT = "file://${BPN}-{0}-ssh-host@.service \
file://${BPN}-{0}-ssh-bic@.service \
file://${BPN}-{0}-ssh-host.socket \
file://${BPN}-{0}-ssh-bic.socket"
SRC_URI:append:fb-compute-multihost = " \
${@compose_list(d, 'CLIENT_SERVICE_FILES_FMT', 'OBMC_CONSOLE_TTYS')}"
CLIENT_SERVICE_FMT = "${PN}-{0}-ssh-host@.service \
${PN}-{0}-ssh-bic@.service \
${PN}-{0}-ssh-host.socket \
${PN}-{0}-ssh-bic.socket"
SYSTEMD_SERVICE:${PN}:append:fb-compute-multihost = " \
${@compose_list(d, 'CLIENT_SERVICE_FMT', 'OBMC_CONSOLE_TTYS')} \
"
SRC_URI:remove = "file://${BPN}.conf"
SYSTEMD_SERVICE:${PN}:remove:fb-compute-multihost = "obmc-console-ssh.socket"
SYSTEMD_SERVICE:${PN}:remove:fb-compute-multihost = "obmc-console-ssh@.service"
PACKAGECONFIG:append:fb-compute-multihost = " concurrent-servers"
do_install:append() {
# Install the server configuration
install -m 0755 -d ${D}${sysconfdir}/${BPN}
install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}/${BPN}/
# Remove upstream-provided server configuration
rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
}
do_install:append:fb-compute-multihost() {
# Implement a script called "select-uart-mux" in project layer and follow the interface below:
# Usage: select-uart-mux <slot1|slot2|slot3|slot4> <host|bic>
install -m 0644 ${WORKDIR}/${BPN}-*-ssh-bic@.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/${BPN}-*-ssh-bic.socket ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/${BPN}-*-ssh-host@.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/${BPN}-*-ssh-host.socket ${D}${systemd_system_unitdir}
rm -rf ${D}${systemd_system_unitdir}/obmc-console-ssh@.service.d/
rm -f ${D}${systemd_system_unitdir}/${BPN}-ssh@.service
rm -f ${D}${systemd_system_unitdir}/${BPN}-ssh.socket
}
@@ -0,0 +1,12 @@
[Unit]
Description= Sync time from host via ipmb
Wants=ipmb.service xyz.openbmc_project.Network.service
After=ipmb.service xyz.openbmc_project.Network.service
[Service]
Type=onshot
ExecStart=/usr/libexec/set-bmc-time-from-host
RemainAfterExit=no
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,116 @@
#!/bin/bash
#BMC set time from host
set -e
echo "set-bmc-time-from-host is started"
# Sync BMC's date with one of the four servers
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
MAX_RETRY_LIMIT=6
check_NTP_status()
{
timedatectl show --property=NTPSynchronized --value
}
get_single_host_time()
{
for (( retry=1; retry<=5; retry++ ))
do
#request the single host time via ipmb command
# which will be set as bmc time
# 0x01 - me channel | 0x0a - storage net fn | 0x00 - lun
# 0x48 - get SEL time
ipmi_cmd_output=$(busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb \
"/xyz/openbmc_project/Ipmi/Channel/Ipmb" org.openbmc.Ipmb sendRequest \
yyyyay 0x01 0x0a 0x00 0x48 0)
ipmb_result=$?
if [ "$ipmb_result" == "0" ];then
sleep 1
break
fi
done
if [ "$retry" == "$MAX_RETRY_LIMIT" ];then
exit 1
fi
echo "$ipmi_cmd_output"
}
get_multi_host_datetime()
{
ipmbAddr=$1
for (( retry=1; retry<=5; retry++ ))
do
#request the multihost host time via ipmb command
# which will be set as bmc time
# 0x38 - oem net fn | 0x00 - lun | 0x02 - request to bridge ic cmd
# 0x6 - length | IANA id 0x15 0xA0 0x0 |0x48 - get SEL time
ipmi_cmd_output=$(busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb \
/xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb sendRequest \
yyyyay "$ipmbAddr" 0x38 0 0x2 6 0x15 0xA0 0x0 0x1 0x28 0x48)
ipmb_result=$?
if [ $ipmb_result == 0 ];then
break
fi
sleep 1
done
echo "$ipmi_cmd_output"
}
sync_multi_host_datetime()
{
for index in $HOST_INSTANCES
do
ipmb_addr=$(((index-1)*4))
# Use standard IPMI command 'SendRequest method' to read RTC time
echo "chosen ipmb addr : "$ipmb_addr
multi_host_time_result=$(get_multi_host_datetime $ipmb_addr)
if [[ $(echo "$multi_host_time_result" | awk '{ print NF }') -eq 18 ]];
then
echo "syncing up host " "$index" " date time with bmc..."
date -s @$((0x$(echo "$multi_host_time_result" | \
awk '{printf "%02x%02x%02x%02x",$18,$17,$16,$15}')))
sync
break
fi
done
}
sync_single_host_datetime()
{
single_host_time_result=$(get_single_host_time)
if [[ $(echo "$single_host_time_result" | awk '{ print NF }') -eq 11 ]];
then
echo "Syncing up host date time with bmc..."
date -s @$((0x$(echo "$single_host_time_result" | \
awk '{printf "%02x%02x%02x%02x",$11,$10,$9,$8}')))
sync
fi
}
#wait for the NTP server start if available.
sleep 60
NTP_STATUS=$(check_NTP_status)
echo "NTP status :""$NTP_STATUS"
if [ "$NTP_STATUS" == "yes" ]; then
echo "NTP is running and system clock is in sync.skiping host time sync..."
exit 0
fi
if [ "$HOST_INSTANCES" == "0" ]; then
echo "single host instance"
sync_single_host_datetime
else
echo "multiple host instance"
sync_multi_host_datetime
fi
@@ -0,0 +1,19 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:fb-withhost = " file://set-bmc-time-from-host"
RDEPENDS:${PN}:append:fb-withhost = " bash"
do_install:append:fb-withhost(){
# Store the bitbake variable OBMC_HOST_INSTANCES inside time sync script as HOST_INSTANCES variable using sed.
sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/set-bmc-time-from-host
install -d ${D}$/lib/systemd/system
install -m 0644 ${WORKDIR}/bmc-set-time.service ${D}$/lib/systemd/system
install -d ${D}${libexecdir}
install -m 0777 ${WORKDIR}/set-bmc-time-from-host ${D}${libexecdir}
}
SYSTEMD_SERVICE:${PN}:fb-withhost += "bmc-set-time.service"
@@ -0,0 +1,5 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "This feature is not implemented in bletchley and it will be implemented in future."
@@ -0,0 +1,28 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in $HOST_INSTANCES
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,4 @@
[Unit]
Description=Chassis%i (Hard Power Off)
After=multi-user.target
Requires=obmc-poweroff.service
@@ -0,0 +1,3 @@
[Unit]
Description=Chassis%i (Power Off)
After=multi-user.target
@@ -0,0 +1,7 @@
[Unit]
Description=power off host
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/phosphor-fan-sensor-monitor/host-poweroff
@@ -0,0 +1,5 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "This feature is not implemented in Tiogapass and it will be implemented in future."
@@ -0,0 +1,27 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in ${HOST_INSTANCES_SED_REPLACEMENT_VALUE}
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" \
$DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,28 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in $HOST_INSTANCES
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,52 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
OVERRIDES:append = "${@bb.utils.contains('VIRTUAL-RUNTIME_obmc-host-state-manager', 'phosphor-state-manager-host', ':phosphor-fan-with-psm', ':phosphor-fan-without-psm', d)}"
PHOSPHOR_FAN_EXTRA_SERVICES = "obmc-poweroff.service"
PHOSPHOR_FAN_EXTRA_SERVICES:append:phosphor-fan-without-psm = " \
obmc-chassis-hard-poweroff@.target \
obmc-chassis-poweroff@0.target \
"
SRC_URI:append:fb-withhost = " file://obmc-chassis-hard-poweroff@.target \
file://obmc-chassis-poweroff@0.target \
file://obmc-poweroff.service \
file://host-poweroff"
PACKAGECONFIG:append = " json sensor-monitor"
EXTRA_OEMESON = "-Duse-host-power-state=enabled"
RDEPENDS:${PN}-sensor-monitor = " bash"
do_install:append:fb-withhost() {
install -d ${D}${systemd_system_unitdir}
for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do
install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir}
done
# Store the bitbake variable OBMC_HOST_INSTANCES inside the script as HOST_INSTANCES variable using sed.
sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff
install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor
install -d ${D}${libexecdir}/phosphor-fan-sensor-monitor
install -m 0777 ${WORKDIR}/host-poweroff ${D}${libexecdir}/phosphor-fan-sensor-monitor/
}
pkg_postinst:${PN}-sensor-monitor() {
mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires
mkdir -p $D/var/lib/phosphor-fan-presence
LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target"
TARGET="../obmc-chassis-poweroff@0.target"
ln -s $TARGET $LINK
LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service"
TARGET="../obmc-poweroff.service"
ln -s $TARGET $LINK
}
FILES:${PN}-sensor-monitor += "${libexecdir}/phosphor-fan-sensor-monitor/host-poweroff"
FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}"
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
EXTRA_OECONF:append = " --enable-configure-dbus=yes"
@@ -0,0 +1,143 @@
#!/bin/bash
set -e
POWER_CMD="/usr/sbin/power-util mb"
IMAGE_FILE=$1/bios.bin
GPIO=389
IPMB_OBJ="xyz.openbmc_project.Ipmi.Channel.Ipmb"
IPMB_PATH="/xyz/openbmc_project/Ipmi/Channel/Ipmb"
IPMB_INTF="org.openbmc.Ipmb"
IPMB_CALL="sendRequest yyyyay"
ME_CMD_RECOVER="1 0x2e 0 0xdf 4 0x57 0x01 0x00 0x01"
ME_CMD_RESET="1 6 0 0x2 0"
SPI_DEV="1e630000.spi"
SPI_PATH="/sys/bus/platform/drivers/aspeed-smc"
set_gpio_to_bmc()
{
echo "switch bios GPIO to bmc"
if [ ! -d /sys/class/gpio/gpio$GPIO ]; then
cd /sys/class/gpio
echo $GPIO > "export"
cd gpio$GPIO
else
cd /sys/class/gpio/gpio$GPIO
fi
direc=$(cat direction)
if [ "$direc" == "in" ]; then
echo "out" > direction
fi
data=$(cat value)
if [ "$data" == "0" ]; then
echo 1 > value
fi
return 0
}
set_gpio_to_pch()
{
echo "switch bios GPIO to pch"
if [ ! -d /sys/class/gpio/gpio$GPIO ]; then
cd /sys/class/gpio
echo $GPIO > "export"
cd gpio$GPIO
else
cd /sys/class/gpio/gpio$GPIO
fi
direc=$(cat direction)
if [ "$direc" == "in" ]; then
echo "out" > direction
fi
data=$(cat value)
if [ "$data" == "1" ]; then
echo 0 > value
fi
echo "in" > direction
echo $GPIO > /sys/class/gpio/unexport
return 0
}
echo "Bios upgrade started at $(date)"
#Power off host server.
echo "Power off host server"
$POWER_CMD off
sleep 15
if [ "$($POWER_CMD status)" != "off" ];
then
echo "Host server didn't power off"
echo "Bios upgrade failed"
exit 1
fi
echo "Host server powered off"
#Set ME to recovery mode
echo "Set ME to recovery mode"
# shellcheck disable=SC2086
busctl call "$IPMB_OBJ" "$IPMB_PATH" "$IPMB_INTF" $IPMB_CALL $ME_CMD_RECOVER
sleep 5
#Flip GPIO to access SPI flash used by host.
echo "Set GPIO $GPIO to access SPI flash from BMC used by host"
set_gpio_to_bmc
#Bind spi driver to access flash
echo "bind aspeed-smc spi driver"
echo -n $SPI_DEV > $SPI_PATH/bind
sleep 1
#Flashcp image to device.
if [ -e "$IMAGE_FILE" ];
then
echo "Bios image is $IMAGE_FILE"
for d in mtd6 mtd7 ; do
if [ -e "/dev/$d" ]; then
mtd=$(cat /sys/class/mtd/$d/name)
if [ "$mtd" == "pnor" ]; then
echo "Flashing bios image to $d..."
if flashcp -v "$IMAGE_FILE" /dev/$d; then
echo "bios updated successfully..."
else
echo "bios update failed..."
fi
break
fi
echo "$d is not a pnor device"
fi
echo "$d not available"
done
else
echo "Bios image $IMAGE_FILE doesn't exist"
fi
#Unbind spi driver
sleep 1
echo "Unbind aspeed-smc spi driver"
echo -n $SPI_DEV > $SPI_PATH/unbind
sleep 10
#Flip GPIO back for host to access SPI flash
echo "Set GPIO $GPIO back for host to access SPI flash"
set_gpio_to_pch
sleep 5
#Reset ME to boot from new bios
echo "Reset ME to boot from new bios"
# shellcheck disable=SC2086
busctl call "$IPMB_OBJ" "$IPMB_PATH" "$IPMB_INTF" $IPMB_CALL $ME_CMD_RESET
sleep 10
#Power on server
echo "Power on server"
$POWER_CMD on
sleep 5
# Retry to power on once again if server didn't powered on
if [ "$($POWER_CMD status)" != "on" ];
then
sleep 5
echo "Powering on server again"
$POWER_CMD on
fi
@@ -0,0 +1,7 @@
[Unit]
Description=Flash Host Bios image %I to Host
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/sbin/bios-update.sh /tmp/images/%i
@@ -0,0 +1,10 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://bios-update.sh"
PACKAGECONFIG:append = " flash_bios"
RDEPENDS:${PN} += "bash"
do_install:append() {
install -d ${D}/${sbindir}
install -m 0755 ${WORKDIR}/bios-update.sh ${D}/${sbindir}/
}
@@ -0,0 +1,30 @@
[
{
"Name": "presence-slot1",
"LineName": "PRESENCE-SLOT1",
"EventMon": "BOTH",
"Continue": true,
"Target": "obmc-ipmb-rescan-fru.service"
},
{
"Name": "presence-slot2",
"LineName": "PRESENCE-SLOT2",
"EventMon": "BOTH",
"Continue": true,
"Target": "obmc-ipmb-rescan-fru.service"
},
{
"Name": "presence-slot3",
"LineName": "PRESENCE-SLOT3",
"EventMon": "BOTH",
"Continue": true,
"Target": "obmc-ipmb-rescan-fru.service"
},
{
"Name": "presence-slot4",
"LineName": "PRESENCE-SLOT4",
"EventMon": "BOTH",
"Continue": true,
"Target": "obmc-ipmb-rescan-fru.service"
}
]
@@ -0,0 +1,8 @@
#!/bin/bash
# Rescan the ipmb busses for slots fru.
DBUS_SERVICE="xyz.openbmc_project.Ipmb.FruDevice"
DBUS_OBJECT="/xyz/openbmc_project/Ipmb/FruDevice"
DBUS_INTERFACE="xyz.openbmc_project.Ipmb.FruDeviceManager"
busctl call $DBUS_SERVICE $DBUS_OBJECT $DBUS_INTERFACE ReScan
@@ -0,0 +1,6 @@
[Unit]
Description=ipmb based rescan the slots fru service
[Service]
Type=oneshot
ExecStart=/usr/libexec/phosphor-gpio-monitor/ipmb-rescan-fru.sh
@@ -0,0 +1,29 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:fb-compute-multihost = " file://phosphor-multi-gpio-monitor.json"
SRC_URI:append:fb-compute-multihost = " file://obmc-ipmb-rescan-fru.service"
SRC_URI:append:fb-compute-multihost = " file://ipmb-rescan-fru.sh"
RDEPENDS:${PN} += "bash"
SYSTEMD_SERVICE:${PN}-monitor += "phosphor-multi-gpio-monitor.service"
SYSTEMD_SERVICE:${PN} += "obmc-ipmb-rescan-fru.service"
SYSTEMD_LINK:${PN}-monitor:append = " ../phosphor-multi-gpio-monitor.service:multi-user.target.requires/phosphor-multi-gpio-monitor.service"
GPIO_HOST_TEMPLATES:append = " ${WORKDIR}/phosphor-multi-gpio-monitor.json"
do_install:append:fb-compute-multihost() {
install -d ${D}${datadir}/phosphor-gpio-monitor
install -m 0644 ${WORKDIR}/phosphor-multi-gpio-monitor.json \
${D}${datadir}/phosphor-gpio-monitor/phosphor-multi-gpio-monitor.json
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/obmc-ipmb-rescan-fru.service \
${D}${systemd_system_unitdir}
install -d ${D}${libexecdir}/phosphor-gpio-monitor
install -m 0777 ${WORKDIR}/ipmb-rescan-fru.sh ${D}${libexecdir}/phosphor-gpio-monitor/
}
FILES:${PN} += "${systemd_system_unitdir}/obmc-ipmb-rescan-fru.service"
@@ -0,0 +1,60 @@
{
"CPU" : {
"Frequency" : 1,
"Window_size": 120,
"Threshold":
{
"Critical":
{
"Value": "CPU_CRIT_VAL",
"Log": true,
"Target": "CPU_CRIT_TGT"
},
"Warning":
{
"Value": "CPU_WARN_VAL",
"Log": true,
"Target": "CPU_WARN_TGT"
}
}
},
"Memory" : {
"Frequency" : 1,
"Window_size": 120,
"Threshold":
{
"Critical":
{
"Value": "MEM_CRIT_VAL",
"Log": true,
"Target": "MEM_CRIT_TGT"
},
"Warning":
{
"Value": "MEM_WARN_VAL",
"Log": true,
"Target": "MEM_WARN_TGT"
}
}
},
"Storage_RW" : {
"Path" : "/run/initramfs/rw",
"Frequency" : 1,
"Window_size": 120,
"Threshold":
{
"Critical":
{
"Value": "STORAGE_CRIT_VAL",
"Log": true,
"Target": "STORAGE_CRIT_TGT"
},
"Warning":
{
"Value": "STORAGE_WARN_VAL",
"Log": true,
"Target": "STORAGE_WARN_TGT"
}
}
}
}
@@ -0,0 +1,35 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI:append = " file://bmc_health_config.json \
"
CPU_CRIT_VAL ?= "90.0"
CPU_CRIT_TGT ?= "reboot.target"
CPU_WARN_VAL ?= "80.0"
CPU_WARN_TGT ?= ""
MEM_CRIT_VAL ?= "85.0"
MEM_CRIT_TGT ?= "reboot.target"
MEM_WARN_VAL ?= "70.0"
MEM_WARN_TGT ?= ""
STORAGE_CRIT_VAL ?= "95.0"
STORAGE_CRIT_TGT ?= ""
STORAGE_WARN_VAL ?= "90.0"
STORAGE_WARN_TGT ?= ""
do_install:prepend() {
sed -i "s/\"CPU_CRIT_VAL\"/${CPU_CRIT_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/CPU_CRIT_TGT/${CPU_CRIT_TGT}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/\"CPU_WARN_VAL\"/${CPU_WARN_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/CPU_WARN_TGT/${CPU_WARN_TGT}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/\"MEM_CRIT_VAL\"/${MEM_CRIT_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/MEM_CRIT_TGT/${MEM_CRIT_TGT}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/\"MEM_WARN_VAL\"/${MEM_WARN_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/MEM_WARN_TGT/${MEM_WARN_TGT}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/\"STORAGE_CRIT_VAL\"/${STORAGE_CRIT_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/STORAGE_CRIT_TGT/${STORAGE_CRIT_TGT}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/\"STORAGE_WARN_VAL\"/${STORAGE_WARN_VAL}/g" ${WORKDIR}/bmc_health_config.json
sed -i "s/STORAGE_WARN_TGT/${STORAGE_WARN_TGT}/g" ${WORKDIR}/bmc_health_config.json
}
@@ -0,0 +1,5 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
#Enable multi-host support for yosemitev2 in the phosphor-host-postd
EXTRA_OEMESON += "-Dhost-instances='${OBMC_HOST_INSTANCES}'"
EXTRA_OEMESON:append:fb-compute-multihost = " -Dsnoop=enabled"
@@ -0,0 +1,7 @@
SOCKET_ID=host0
BUF_MAXSIZE=3000
BUF_MAXTIME=0
FLUSH_FULL=false
HOST_STATE=/xyz/openbmc_project/state/host1
OUT_DIR=/var/lib/obmc/hostlogs/host1
MAX_FILES=10
@@ -0,0 +1,7 @@
SOCKET_ID=host1
BUF_MAXSIZE=3000
BUF_MAXTIME=0
FLUSH_FULL=false
HOST_STATE=/xyz/openbmc_project/state/host2
OUT_DIR=/var/lib/obmc/hostlogs/host2
MAX_FILES=10
@@ -0,0 +1,7 @@
SOCKET_ID=host2
BUF_MAXSIZE=3000
BUF_MAXTIME=0
FLUSH_FULL=false
HOST_STATE=/xyz/openbmc_project/state/host3
OUT_DIR=/var/lib/obmc/hostlogs/host3
MAX_FILES=10
@@ -0,0 +1,7 @@
SOCKET_ID=host3
BUF_MAXSIZE=3000
BUF_MAXTIME=0
FLUSH_FULL=false
HOST_STATE=/xyz/openbmc_project/state/host4
OUT_DIR=/var/lib/obmc/hostlogs/host4
MAX_FILES=10
@@ -0,0 +1,7 @@
SOCKET_ID=
BUF_MAXSIZE=3000
BUF_MAXTIME=0
FLUSH_FULL=false
HOST_STATE=/xyz/openbmc_project/state/host0
OUT_DIR=/var/lib/obmc/hostlogs/host0
MAX_FILES=10
@@ -0,0 +1,19 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:fb-compute-singlehost = " file://ttyS2.conf"
SRC_URI:append:fb-compute-multihost = " file://ttyS0.conf \
file://ttyS1.conf \
file://ttyS2.conf \
file://ttyS3.conf "
do_install:append() {
# Install the configurations
install -m 0755 -d ${D}${sysconfdir}/${BPN}
install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}/${BPN}/
# Remove upstream-provided default configuration
rm -f ${D}${sysconfdir}/${BPN}/ttyVUART0.conf
}
@@ -0,0 +1,27 @@
IMAGE_FEATURES:remove = "\
obmc-net-ipmi \
obmc-user-mgmt-ldap \
"
IMAGE_FEATURES:remove:fb-nohost = "\
obmc-console \
ssh-server-dropbear \
"
IMAGE_FEATURES:append:fb-nohost = "\
ssh-server-openssh \
"
OBMC_IMAGE_EXTRA_INSTALL:append = "\
${@bb.utils.contains('DISTRO_FEATURES', 'tpm', \
bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'packagegroup-security-tpm2 libtss2-tcti-device', '', d), \
'', d)} \
curl \
dbus-top \
strace \
tmux \
wget \
"
OBMC_IMAGE_EXTRA_INSTALL:append:mf-fb-secondary-emmc = " emmc-init"
IMAGE_LINGUAS="en-us"
include recipes-phosphor/images/fb-${MACHINE}-phosphor-image.inc
@@ -0,0 +1,5 @@
require recipes-phosphor/images/fb-phosphor-image.inc
# Please do not add any content directly to this file. Instead add it to
# the corresponding .inc file. Otherwise, builds from facebook/openbmc will
# not be able to pick up your content.
@@ -0,0 +1,6 @@
EXTRA_OEMESON:append = "\
-Dredfish-dbus-log=enabled \
-Dredfish-new-powersubsystem-thermalsubsystem=enabled \
"
PACKAGECONFIG:append = " insecure-redfish-expand"
@@ -0,0 +1 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
@@ -0,0 +1,181 @@
{
"0" : {
"name" : "Ipmb",
"is_valid" : true,
"active_sessions" : 0,
"max_transfer_size" : 256,
"channel_info" : {
"medium_type" : "ipmb",
"protocol_type" : "ipmb-1.0",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"1" : {
"name" : "eth0",
"is_valid" : true,
"active_sessions" : 0,
"max_transfer_size" : 256,
"channel_info" : {
"medium_type" : "lan-802.3",
"protocol_type" : "ipmb-1.0",
"session_supported" : "multi-session",
"is_ipmi" : true
}
},
"2" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"3" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"4" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"5" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"6" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"7" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"8" : {
"name" : "INTRABMC",
"is_valid" : true,
"active_sessions" : 0,
"max_transfer_size" : 256,
"channel_info" : {
"medium_type" : "oem",
"protocol_type" : "oem",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"9" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"10" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"11" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"12" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"13" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"14" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
},
"15" : {
"name" : "RESERVED",
"is_valid" : false,
"active_sessions" : 0,
"channel_info" : {
"medium_type" : "reserved",
"protocol_type" : "na",
"session_supported" : "session-less",
"is_ipmi" : true
}
}
}
@@ -0,0 +1,8 @@
{
"id": 32,
"revision": 129,
"addn_dev_support": 191,
"manuf_id": 40981,
"prod_id": 12614,
"aux": 0
}
@@ -0,0 +1,31 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
IPMB_CHANNELS ?= ""
python do_ipmb_channels() {
import json
channels = []
for channel in d.getVar('IPMB_CHANNELS').split():
channels.append({
"type": "ipmb",
"slave-path": channel,
"bmc-addr": 32,
"remote-addr": 64,
"devIndex": len(channels)
})
data = { "channels" : channels }
path = os.path.join(d.getVar('D') + d.getVar('datadir'),
'ipmbbridge', 'ipmb-channels.json')
with open(path, 'w') as f:
json.dump(data, f, indent=4)
}
do_ipmb_channels[vardeps] += "IPMB_CHANNELS"
addtask ipmb_channels after do_install before do_package
do_install:append() {
install -d ${D}${datadir}/ipmbbridge
}
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG:append = " use-lamp-test"
@@ -0,0 +1,5 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
PACKAGES:remove:fb-nohost = "\
${PN}-console \
"
@@ -0,0 +1,120 @@
{
"gpio_definitions": [
{
"name": "POWER_BUTTON",
"pin": "D0",
"direction": "both"
},
{
"name": "RESET_BUTTON",
"pin": "AB0",
"direction": "both"
},
{
"name": "DEBUG_SELECTOR_BUTTON",
"pin": "O3",
"direction": "both"
},
{
"name" : "HOST_SELECTOR",
"group_gpio_config" : [
{
"name" : "host_select_0",
"pin": "AA4",
"direction": "both",
"polarity" : "active_high"
},
{
"name" : "host_select_1",
"pin": "AA5",
"direction": "both",
"polarity" : "active_high"
},
{
"name" : "host_select_2",
"pin": "AA6",
"direction": "both",
"polarity" : "active_high"
},
{
"name" : "host_select_3",
"pin": "AA7",
"direction": "both",
"polarity" : "active_high"
}
],
"max_position" : 4,
"host_selector_map" : {
"6" : 0,
"7": 1,
"8": 2,
"9": 3,
"10": 4,
"11": 0,
"12": 1,
"13": 2,
"14" : 3,
"15" : 4
}
},
{
"name" : "SERIAL_UART_MUX",
"group_gpio_config" : [
{
"name" : "serial_uart_sel_0",
"pin": "E0",
"direction": "out",
"polarity" : "active_high"
},
{
"name" : "serial_uart_sel_1",
"pin": "E1",
"direction": "out",
"polarity" : "active_high"
},
{
"name" : "serial_uart_sel_2",
"pin": "E2",
"direction": "out",
"polarity" : "active_high"
},
{
"name" : "serial_uart_sel_3",
"pin": "E3",
"direction": "out",
"polarity" : "active_high"
},
{
"name" : "serial_uart_rx",
"pin": "E4",
"direction": "out",
"polarity" : "active_high"
},
{
"name" : "debug_card_present",
"pin": "R3",
"direction": "both",
"polarity" : "active_high"
}
],
"serial_uart_mux_map" : {
"0" : 4,
"1": 0,
"2": 1,
"3": 2,
"4": 3
}
}
]
}
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:yosemitev2 = " file://gpio_defs.json"
@@ -0,0 +1 @@
PACKAGECONFIG:append = " log-threshold log-pulse send-to-logger"
@@ -0,0 +1,6 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG:remove = " \
external \
intrusion \
"
@@ -0,0 +1,18 @@
SENSOR_CONFIGS ?= "virtual_sensor_config.json"
SRC_URI:append = "\
${@ ' '.join([ 'file://' + x for x in d.getVar('SENSOR_CONFIGS').split()])} \
"
do_install:append() {
# Delete the default one from Meson.
if [ -e "${D}${datadir}/phosphor-virtual-sensor/virtual_sensor_config.json" ]; then
rm "${D}${datadir}/phosphor-virtual-sensor/virtual_sensor_config.json"
fi
# Install the ones from our meta-layer.
install -d ${D}${datadir}/phosphor-virtual-sensor
for s in ${SENSOR_CONFIGS}; do
install -m 0644 ${WORKDIR}/$s ${D}${datadir}/phosphor-virtual-sensor
done
}
@@ -0,0 +1,7 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append = " file://fb_host_settings.override.yml"
SRC_URI:append:fb-compute = " file://restrictionmode-host-settings.override.yml"
SETTINGS_HOST_TEMPLATES:append = " fb_host_settings.override.yml"
SETTINGS_HOST_TEMPLATES:append:fb-compute = " restrictionmode-host-settings.override.yml"
@@ -0,0 +1,5 @@
/xyz/openbmc_project/control/host{}/restriction_mode:
- Interface: xyz.openbmc_project.Control.Security.RestrictionMode
Properties:
RestrictionMode:
Default: RestrictionMode::Modes::Whitelist
@@ -0,0 +1,7 @@
/xyz/openbmc_project/control/host{}/power_restore_policy:
- Interface: xyz.openbmc_project.Control.Power.RestorePolicy
Properties:
PowerRestorePolicy:
Default: RestorePolicy::Policy::Restore
PowerRestoreDelay:
Default: 0
@@ -0,0 +1,5 @@
/xyz/openbmc_project/control/ocp_debug_card/restriction_mode:
- Interface: xyz.openbmc_project.Control.Security.RestrictionMode
Properties:
RestrictionMode:
Default: RestrictionMode::Modes::Whitelist
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append = " file://restrictionmode-ocpdebugcard-settings.override.yml"
@@ -0,0 +1,56 @@
#!/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
SLOT=$(( $1-1 ))
OFFSET=$(( 0x9 + SLOT ))
chassis-power-cycle()
{
CHASSIS_ID=$1
if [ "$CHASSIS_ID" -le 4 ]
then
chassis_status=$(chassis-power-status $SLOT)
if [ "$chassis_status" == "$STATE_ON" ]
then
i2cset -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" "$OFFSET" "$POW_OFF_SLOT"
sleep 10
chassis_status=$(chassis-power-status $SLOT)
if [ "$chassis_status" -ne "$STATE_OFF" ]
then
echo "chassis$CHASSIS_ID power off fail"
exit 1
fi
fi
i2cset -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" "$OFFSET" "$POW_ON_SLOT"
sleep 2
# Check chassis stattus after doing 12V cycle
chassis_status=$(chassis-power-status $SLOT)
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"
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"
exit 0;
fi
fi
echo "Invalid slot id"
exit 1;
}
if [ "$1" == 0 ]
then
echo "Enter SLED-cycle"
result=$(i2cset -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" 0x2b 0x1)
echo "$result"
else
echo "Enter slot$1 cycle"
chassis-power-cycle "$1"
fi
@@ -0,0 +1,10 @@
[Unit]
Description=Chassis Power Cycle: %i
[Service]
Type=oneshot
ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle %i
ExecStartPost=/bin/systemctl restart phosphor-discover-system-state@%i.service
[Install]
WantedBy=obmc-chassis-powercycle@%i.target
@@ -0,0 +1,43 @@
#!/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
CHASSIS_ID=$1
SLOT=$(( $1-1 ))
OFFSET=$(( 0x9 + SLOT ))
# Server 12v power off
chassis-power-off()
{
result=$(i2cset -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" "$OFFSET" "$POW_OFF_SLOT")
echo "$result"
sleep 1
# Check chassis status after doing 12V off
chassis_status=$(chassis-power-status $SLOT)
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"
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"
echo "Chassis is power on"
exit 0;
fi
}
chassis_status=$(chassis-power-status $SLOT)
if [ "$chassis_status" == "$STATE_UNKNOWN" ]
then
echo "Invalid slot id"
exit 1;
elif [ "$chassis_status" == "$STATE_ON" ]
then
chassis-power-off
exit 0;
else
echo "Chassis is already off"
exit 0;
fi
@@ -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
@@ -0,0 +1,43 @@
#!/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
CHASSIS_ID=$1
SLOT=$(( $1-1 ))
OFFSET=$(( 0x9 + SLOT ))
# Server 12v power on
chassis-power-on()
{
result=$(i2cset -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" "$OFFSET" "$POW_ON_SLOT")
echo "$result"
sleep 1
# Check chassis stattus after doing 12V on
chassis_status=$(chassis-power-status $SLOT)
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"
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"
echo "Chassis is power off"
exit 0;
fi
}
chassis_status=$(chassis-power-status $SLOT)
if [ "$chassis_status" == "$STATE_UNKNOWN" ]
then
echo "Invalid slot id"
exit 1;
elif [ "$chassis_status" == "$STATE_OFF" ]
then
chassis-power-on
exit 0;
else
echo "Chassis is already on"
exit 0;
fi
@@ -0,0 +1,10 @@
[Unit]
Description=power on chassis:%i
[Service]
Type=oneshot
ExecStart=/usr/libexec/phosphor-state-manager/chassis-poweron %i
ExecStartPost=/bin/systemctl restart phosphor-discover-system-state@%i.service
[Install]
WantedBy=obmc-chassis-poweron@%i.target
@@ -0,0 +1,51 @@
#!/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
HOST_ID=$1
SLOT_ID=$(( $1-1 << 2 ))
# Host Reboot
host-reboot()
{
power_delay=$1
for pwr_cmd in "${power_seq[@]}"
do
response="$(busctl call "$SERVICE" "$OBJECT_PATH" "$INTERFACE" sendRequest yyyyay "$SLOT_ID" "$NETFN" "$LUN" "$CMD" "$DATA_LEN" 0x01 0x42 0x01 0x00 "$pwr_cmd")"
echo "$response"
result=$(echo "$response" | cut -d" " -f "$IPMB_CMD_COMPLETE_CODE_INDEX")
if [ "$result" -ne 0 ]
then
echo "Failed to send ipmb command"
exit 1
fi
if [ "$pwr_cmd" == "$POWER_BTN_LOW" ]
then
sleep "$power_delay"
fi
done
}
# Check Host Response and Status
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
host-reboot 6
sleep 15
host-reboot 2
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_ON"
exit 0;
else
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_OFF"
exit 0;
fi
else
echo "Host is Off"
exit 1;
fi
@@ -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
@@ -0,0 +1,51 @@
#!/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
HOST_ID=$1
SLOT_ID=$(( $1-1 << 2 ))
# Host Power Off
host-power-off()
{
for pwr_cmd in "${power_seq[@]}"
do
response="$(busctl call "$SERVICE" "$OBJECT_PATH" "$INTERFACE" sendRequest yyyyay "$SLOT_ID" "$NETFN" "$LUN" "$CMD" "$DATA_LEN" 0x01 0x42 0x01 0x00 "$pwr_cmd")"
echo "$response"
result=$(echo "$response" | cut -d" " -f "$IPMB_CMD_COMPLETE_CODE_INDEX")
if [ "$result" -ne 0 ]
then
echo "Failed to send ipmb command"
exit 1
fi
if [ "$pwr_cmd" == "$POWER_BTN_LOW" ]
then
sleep 6
fi
done
# Check host stattus after doing host power off
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_OFF" ]
then
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_OFF"
echo "Host power off"
exit 0;
else
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_ON"
echo "Host power on"
exit 0;
fi
}
# Check Host Response and Status
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
host-power-off
else
echo "Power is already off"
exit 1;
fi
@@ -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
@@ -0,0 +1,50 @@
#!/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
HOST_ID=$1
SLOT_ID=$(( $1-1 << 2 ))
# Host Power On
host-power-on()
{
for pwr_cmd in "${power_seq[@]}"
do
response="$(busctl call "$SERVICE" "$OBJECT_PATH" "$INTERFACE" sendRequest yyyyay "$SLOT_ID" "$NETFN" "$LUN" "$CMD" "$DATA_LEN" 0x01 0x42 0x01 0x00 "$pwr_cmd")"
echo "$response"
result=$(echo "$response" | cut -d" " -f "$IPMB_CMD_COMPLETE_CODE_INDEX")
if [ "$result" -ne 0 ]
then
echo "Failed to send ipmb command"
exit 1
fi
if [ "$pwr_cmd" == "$POWER_BTN_LOW" ]
then
sleep 2
fi
done
# Check host status after doing host power on
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_ON"
echo "Host power on"
exit 0;
else
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_OFF"
echo "Host power off"
exit 0;
fi
}
# Check Host Response and Status
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_OFF" ]
then
host-power-on
else
echo "Power is already on"
exit 1;
fi
@@ -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
@@ -0,0 +1,51 @@
#!/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
HOST_ID=$1
SLOT_ID=$(( $1-1 << 2 ))
# Host Reboot
host-reboot()
{
for reset_cmd in "${reset_seq[@]}"
do
response="$(busctl call "$SERVICE" "$OBJECT_PATH" "$INTERFACE" sendRequest yyyyay "$SLOT_ID" "$NETFN" "$LUN" "$CMD" "$DATA_LEN" 0x01 0x42 0x01 0 "$reset_cmd")"
echo "$response"
result=$(echo "$response" | cut -d" " -f "$IPMB_CMD_COMPLETE_CODE_INDEX")
if [ "$result" -ne 0 ]
then
echo "Failed to send ipmb command"
exit 1
fi
if [ "$reset_cmd" == "$POWER_BTN_LOW" ]
then
sleep "$1"
fi
done
# Check host stattus after doing host power reset
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_ON"
echo "Host power Reset"
exit 0;
else
busctl set-property "$HOST_BUS_NAME""$HOST_ID" "$HOST_OBJ_PATH""$HOST_ID" "$HOST_INTF_NAME" "$HOST_PROPERTY_NAME" s "$HOST_OFF"
echo "Host power off"
exit 0;
fi
}
# Check Host Response and Status
host_status=$(host-power-status $SLOT_ID)
if [ "$host_status" == "$STATE_ON" ]
then
host-reboot 1
else
echo "Host is Off"
exit 1;
fi
@@ -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,67 @@
#!/bin/bash
export POWER_BTN_HIGH=0xFF
export POWER_BTN_LOW=0xFE
export RESET_BTN_HIGH=0xFF
export RESET_BTN_LOW=0xFD
export power_seq=( "$POWER_BTN_HIGH" "$POWER_BTN_LOW" "$POWER_BTN_HIGH" )
export reset_seq=( "$RESET_BTN_HIGH" "$RESET_BTN_LOW" "$RESET_BTN_HIGH")
export SERVICE="xyz.openbmc_project.Ipmi.Channel.Ipmb"
export OBJECT_PATH="/xyz/openbmc_project/Ipmi/Channel/Ipmb"
export INTERFACE="org.openbmc.Ipmb"
export DATA_LEN=0x05
export NETFN=0x06
export LUN=0x00
export CMD=0x52
export STATE_OFF=0
export STATE_ON=1
export STATE_UNKNOWN=-1
export CPLD_BUS_NUM=12
export CPLD_PWR_CTRL_ADDR=0xf
export POW_ON_SLOT=0x01
export POW_OFF_SLOT=0x00
export PWRGD_SYS_PWROK_INDEX=12
export IANA="0x15 0xA0 0x0"
export IANA_LEN=3
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 HOST_BUS_NAME="xyz.openbmc_project.State.Host"
export HOST_OBJ_PATH="/xyz/openbmc_project/state/host"
export HOST_INTF_NAME="xyz.openbmc_project.State.Host"
export HOST_PROPERTY_NAME="CurrentHostState"
export CHASSIS_ON="xyz.openbmc_project.State.Chassis.PowerState.On"
export CHASSIS_OFF="xyz.openbmc_project.State.Chassis.PowerState.Off"
export HOST_ON="xyz.openbmc_project.State.Host.HostState.Running"
export HOST_OFF="xyz.openbmc_project.State.Host.HostState.Off"
export IPMB_CMD_COMPLETE_CODE_INDEX=2
host-power-status()
{
SLOT_ID=$1
response="$(busctl call "$SERVICE" "$OBJECT_PATH" "$INTERFACE" sendRequest yyyyay "$SLOT_ID" 0x38 "$LUN" 0x03 0x03 0x15 0xa0 0x00)"
result=$(echo "$response" | cut -d" " -f "$PWRGD_SYS_PWROK_INDEX")
res="$(( "$result" & 0x80 ))"
status="$(( "$res" >> 7 ))"
echo "$status"
return 0
}
chassis-power-status()
{
slot=$1
status=-1
if [ "$slot" -le 4 ]
then
response="$(i2cget -y "$CPLD_BUS_NUM" "$CPLD_PWR_CTRL_ADDR" 0x25)"
res="$(( "$response" >> slot ))"
status="$(( "$res" & 0x01 ))"
fi
echo "$status"
return 0
}
@@ -0,0 +1,24 @@
#!/bin/bash
# Provide source directive to shellcheck.
gpioInitHighTable=(
"power-nic-bmc-enable"
"usb-bmc-enable"
"reset-cause-usb-hub"
"bmc-ready"
"fan0-bmc-cpld-enable"
"fan1-bmc-cpld-enable"
"fan2-bmc-cpld-enable"
"fan3-bmc-cpld-enable"
)
gpio-init()
{
for gpioInitHigh in "${gpioInitHighTable[@]}"
do
# need the word splitting for gpiofind command.
# shellcheck disable=SC2046
gpioset $(gpiofind "${gpioInitHigh}")=1
done
}
gpio-init
@@ -0,0 +1,11 @@
[Unit]
Description=Power Control Initialization
Before=mapper-wait@-xyz.openbmc_project.State.Chassis@0.service
Before=mapper-wait@-xyz-openbmc_project-state-bmc.service
[Service]
Type=oneshot
ExecStart=/usr/libexec/phosphor-state-manager/power-ctrl-init
[Install]
WantedBy=multi-user.target
@@ -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,65 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}/${MACHINE}:"
HOST_DEFAULT_TARGETS:append = " \
obmc-host-shutdown@{}.target.wants/host-poweroff@{}.service \
obmc-host-start@{}.target.wants/host-poweron@{}.service \
obmc-host-reboot@{}.target.wants/host-powercycle@{}.service \
obmc-host-force-warm-reboot@{}.target.wants/host-powerreset@{}.service \
"
CHASSIS_DEFAULT_TARGETS:append = " \
obmc-chassis-poweron@{}.target.wants/chassis-poweron@{}.service \
obmc-chassis-hard-poweroff@{}.target.wants/chassis-poweroff@{}.service \
obmc-chassis-powercycle@{}.target.wants/chassis-powercycle@{}.service \
"
CHASSIS_DEFAULT_TARGETS:remove = " \
obmc-chassis-poweroff@{}.target.requires/obmc-powered-off@{}.service \
"
CHASSIS_DEFAULT_TARGETS:remove:greatlakes = " \
obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
"
SRC_URI:append:greatlakes = " \
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://power-ctrl-init.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 \
file://power-ctrl-init \
"
RDEPENDS:${PN}:append:greatlakes = " bash"
do_install:append:greatlakes() {
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}/
install -m 0777 ${WORKDIR}/power-ctrl-init ${D}${libexecdir}/${PN}/
}
FILES:${PN} += " ${systemd_system_unitdir}/*.service"
SYSTEMD_SERVICE:${PN}-bmc:append:greatlakes = "power-ctrl-init.service"
@@ -0,0 +1,12 @@
[Unit]
Description=Power Cycle Host Server
Requires=host-gpio.service
After=host-gpio.service
[Service]
Type=oneshot
ExecStart=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
ExecStart=busctl set-property xyz.openbmc_project.Control.Host.RestartCause /xyz/openbmc_project/control/host0/restart_cause xyz.openbmc_project.Control.Host.RestartCause RequestedRestartCause s xyz.openbmc_project.State.Host.RestartCause.WatchdogTimer
ExecStart=sleep 6
ExecStart=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
SyslogIdentifier=phosphor-watchdog
@@ -0,0 +1,9 @@
[Unit]
Description=Shutdown Host Server
Requires=host-gpio.service
After=host-gpio.service
[Service]
Type=oneshot
ExecStart=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
SyslogIdentifier=phosphor-watchdog
@@ -0,0 +1,10 @@
[Unit]
Description=Reset Host Server
Requires=host-gpio.service
After=host-gpio.service
[Service]
Type=oneshot
ExecStart=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
ExecStart=busctl set-property xyz.openbmc_project.Control.Host.RestartCause /xyz/openbmc_project/control/host0/restart_cause xyz.openbmc_project.Control.Host.RestartCause RequestedRestartCause s xyz.openbmc_project.State.Host.RestartCause.WatchdogTimer
SyslogIdentifier=phosphor-watchdog
@@ -0,0 +1,16 @@
[Unit]
Description=Phosphor Watchdog
[Service]
ExecStart=/usr/bin/env phosphor-watchdog --continue --service=xyz.openbmc_project.Watchdog \
--path=/xyz/openbmc_project/watchdog/host0 \
--action_target=xyz.openbmc_project.State.Watchdog.Action.HardReset=phosphor-watchdog-host-reset.service \
--action_target=xyz.openbmc_project.State.Watchdog.Action.PowerOff=host-phosphor-watchdog-host-poweroff.service \
--action_target=xyz.openbmc_project.State.Watchdog.Action.PowerCycle=phosphor-watchdog-host-cycle.service \
SyslogIdentifier=phosphor-watchdog
BusName =xyz.openbmc_project.Watchdog
Type=dbus
[Install]
WantedBy=basic.target
@@ -0,0 +1,5 @@
FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"
# Remove the override to keep service running after DC cycle
SYSTEMD_OVERRIDE:${PN}:remove = "poweron.conf:phosphor-watchdog@poweron.service.d/poweron.conf"
SYSTEMD_SERVICE:${PN} = "phosphor-watchdog.service phosphor-watchdog-host-poweroff.service phosphor-watchdog-host-reset.service phosphor-watchdog-host-cycle.service"