blob: f25495056f1d338650f59a8e13e43b18904da460 [file] [log] [blame]
Andrew Neyland7ebaff32023-08-29 14:48:27 -05001#!/bin/sh
2
3findmtd() {
4 m=$(grep -xl "$1" /sys/class/mtd/*/name)
5 m=${m%/name}
6 m=${m##*/}
7 echo "$m"
8}
9
10hostPrime=$(findmtd host-prime)
11if test -z "$hostPrime"
12then
13 echo "Unable to find mtd partition for ${hostPrime}"
14 exit 1
15fi
16
17hostSecond=$(findmtd host-second)
18if test -z "$hostSecond"
19then
20 echo "Unable to find mtd partition for ${hostSecond}"
21 exit 1
22fi
23
24vromPrime=$(findmtd vrom-prime)
25if test -z "$vromPrime"
26then
27 echo "Unable to find mtd partition for ${vromPrime}"
28 exit 1
29fi
30
31vromSecond=$(findmtd vrom-second)
32if test -z "$vromSecond"
33then
34 echo "Unable to find mtd partition for ${vromSecond}"
35 exit 1
36fi
37
38
39#enable vrom
40# host-prime to vrom-prime
41dd if=/dev/"${hostPrime}" of=/dev/"${vromPrime}"
42# host-second to vrom-second
43dd if=/dev/"${hostSecond}" of=/dev/"${vromSecond}"
44
45# enable UART on rl300
46systemctl start obmc-console@ttyS3.service
47
48echo 0x1800008a > /sys/class/soc/srom/vromoff
49
50devmem 0xd1000008 8 128
51devmem 0xd1000009 8 36
52devmem 0xd1000041 8 255
53devmem 0xd100004b 8 8
54# setup PCIe ID
55devmem 0x802f002e 16 0x03d8
56#enable debug vsp output
57devmem 0x80fc0230 8 0x1
58
59# Check the current power status
60
61currentstate=$(busctl get-property xyz.openbmc_project.State.Chassis0 /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis CurrentPowerState | awk '{ print $2 }')
62
63
64if [ "$currentstate" = "\"xyz.openbmc_project.State.Chassis.PowerState.On\"" ]
65then
66 systemctl stop phosphor-virtual-sensor.service
67 sleep 2
68 devmem 0x80fc0230 8 0x1
69 systemctl start phosphor-virtual-sensor.service
70fi
71
72while 'true'
73do
74 sleep 1
75done