Initial commit
This commit is contained in:
+81
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
# File which is managing GPIOS when detected. First parameter is which GPIOs that switched
|
||||
if [ "$1" = "up" ]
|
||||
then
|
||||
systemctl stop xyz.openbmc_project.ampere_host_error_monitor.service
|
||||
rmmod smpro_hwmon smpro_errmon smpro_misc smpro_mfd
|
||||
busctl set-property xyz.openbmc_project.Chassis.Gpios /xyz/openbmc_project/chassis/gpios xyz.openbmc_project.Chassis.Gpios PGood b true
|
||||
smproStatus=$(lsmod | grep smpro-mfd)
|
||||
if [ "$smproStatus" = "" ]
|
||||
then
|
||||
# sleep 15
|
||||
# We need to wait for the SoC to be ready to communicate - We just received the PGOOD signal
|
||||
# The status is reported through an interrupt that we can poll at 2e within the CPLD address space (0xd100_00e2)
|
||||
max_retry=5
|
||||
sleep_time=5
|
||||
success=0
|
||||
while [ "$max_retry" != "0" ]
|
||||
do
|
||||
waitForSoC=$(devmem 0xd10000e2 8)
|
||||
isAvailable=$(( waitForSoC & 0x2 ))
|
||||
if [ "r$isAvailable" = "r2" ]
|
||||
then
|
||||
max_retry=0
|
||||
success=1
|
||||
else
|
||||
max_retry=$(( max_retry - 1))
|
||||
sleep $sleep_time
|
||||
fi
|
||||
done
|
||||
if [ "$success" = "1" ]
|
||||
then
|
||||
# Activate local UBM (front NVME drive)
|
||||
devmem 0xd1000087 8 5
|
||||
i2ctransfer -y 3 w4@0x40 0x34 0xbf 0x00 0xe8
|
||||
i2ctransfer -y 3 w2@0x40 0x34 0xa7 r1
|
||||
|
||||
devmem 0xd1000087 8 7
|
||||
i2ctransfer -y 3 w4@0x40 0x34 0xbf 0x00 0xe8
|
||||
i2ctransfer -y 3 w2@0x40 0x34 0xa7 r1
|
||||
|
||||
devmem 0xd1000087 8 9
|
||||
i2ctransfer -y 3 w4@0x40 0x34 0xbf 0x00 0xe8
|
||||
i2ctransfer -y 3 w2@0x40 0x34 0xa7 r1
|
||||
|
||||
devmem 0xd1000087 8 0xb
|
||||
i2ctransfer -y 3 w4@0x40 0x34 0xbf 0x00 0xe8
|
||||
i2ctransfer -y 3 w2@0x40 0x34 0xa7 r1
|
||||
|
||||
devmem 0xd1000088 8 5
|
||||
i2ctransfer -y 4 w4@0x40 0x34 0xbf 0x00 0xe8
|
||||
i2ctransfer -y 4 w2@0x40 0x34 0xa7 r1
|
||||
|
||||
modprobe smpro-misc
|
||||
modprobe smpro-errmon
|
||||
modprobe smpro-hwmon
|
||||
modprobe smpro-mfd
|
||||
systemctl restart xyz.openbmc_project.ampere_host_error_monitor.service
|
||||
systemctl restart xyz.openbmc_project.amperecpusensor.service
|
||||
systemctl restart xyz.openbmc_project.EntityManager.service
|
||||
systemctl restart phosphor-pid-control.service
|
||||
fi
|
||||
# We shall add a condition here to make an emergency stop
|
||||
fi
|
||||
else
|
||||
if [ "$1" = "down" ]
|
||||
then
|
||||
busctl set-property xyz.openbmc_project.Chassis.Gpios /xyz/openbmc_project/chassis/gpios xyz.openbmc_project.Chassis.Gpios PGood b false
|
||||
# We can re-init the system
|
||||
devmem 0xd1000009 8 0x24
|
||||
# We need to check the reason why we have been shutdown
|
||||
shutdownReason=$(devmem 0x80000074 16)
|
||||
# If bit 10 is set Software initiated a shutdown we need to restart
|
||||
isSet2=$( ${shutdownReason} | 0xFBFF )
|
||||
if [ "$isSet2" = "65535" ]
|
||||
then
|
||||
echo "Restarting" >> /tmp/gpios
|
||||
obmcutil poweron
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "$1" >> /tmp/gpios.txt
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=HPE RL300 PowerOK
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/gpios-manager down
|
||||
|
||||
[Install]
|
||||
# WantedBy=multi-user.target
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=HPE RL300 PowerOK
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/gpios-manager up
|
||||
|
||||
[Install]
|
||||
# WantedBy=multi-user.target
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
dbus-monitor --system --profile "type='method_call',path='/xyz/openbmc_project/state/host0',interface='org.freedesktop.DBus.Properties',member='Set'" | awk '/xyz.openbmc_project.State.Host/ { print "DONE" }' | while read -r ; do
|
||||
/usr/bin/rl300Start.sh
|
||||
done
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=RL300 IPMI power sequencing request
|
||||
After=dbus.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
ExecStart=/usr/bin/ipmi-power-button-monitoring.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# File which is managing GPIOS when detected. First parameter is which GPIOs that switched
|
||||
if [ "$1" = "pressed" ]
|
||||
then
|
||||
busctl set-property xyz.openbmc_project.Chassis.Gpios /xyz/openbmc_project/chassis/gpios xyz.openbmc_project.Chassis.Gpios PButton b true
|
||||
else
|
||||
if [ "$1" = "released" ]
|
||||
then
|
||||
busctl set-property xyz.openbmc_project.Chassis.Gpios /xyz/openbmc_project/chassis/gpios xyz.openbmc_project.Chassis.Gpios PButton b false
|
||||
fi
|
||||
fi
|
||||
echo "$1" >> /tmp/buttons.txt
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=RL300 power sequencing manager
|
||||
#After=dbus.service
|
||||
After=xyz.openbmc_project.Chassis.Control.Power@0.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
ExecStart=/usr/bin/startMonitoring.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=HPE RL300 Power Button
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/power-button pressed
|
||||
|
||||
[Install]
|
||||
# WantedBy=multi-user.target
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=HPE RL300 Power Button Release
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/power-button released
|
||||
|
||||
[Install]
|
||||
# WantedBy=multi-user.target
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# A power up request has been made we must setup the system properly
|
||||
# RL300 requires UEFI VAR ROM export through spi controller 1
|
||||
# the machine needs to get out of Hold too
|
||||
|
||||
rmmod gxp_spifi_ctrl1
|
||||
# vejmarie was 58
|
||||
devmem 0xd1000119 32 0x5d
|
||||
modprobe gxp_spifi_ctrl1
|
||||
|
||||
# clear previous reset reason
|
||||
devmem 0x80000074 16 0x0
|
||||
# Release the Soc
|
||||
currentVal=$(devmem 0xD100011A 8)
|
||||
currentVal=$(( currentVal | 1 << 3 ))
|
||||
devmem 0xD100011A 8 "0x""${currentVal}"
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# We just started we have to update the Gpios status
|
||||
/usr/bin/phosphor-multi-gpio-monitor --config /usr/share/gpios/test.json
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"Name": "PowerGoodUp",
|
||||
"LineName": "PS_PWROK",
|
||||
"EventMon": "BOTH",
|
||||
"TargetRising": "gpiosup.service",
|
||||
"TargetFalling": "gpiosdown.service",
|
||||
"Continue": true
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user