blob: d75d4b74d1e5f1e54a196f2e53ebd85d1a8c2d7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#!/bin/sh
# Copyright 2018 IBM Corp
# SPDX-License-Identifier: Apache-2.0
# Authored May 2018, Joel Stanley <joel@jms.id.au>
#
# This script sets the SIO scratch registers 0x2D in order to configure
# hostboot. It supports boot flags v1 as defined in hostboot source:
# src/usr/initservice/bootconfig/bootconfig_ast2400.C
# src/usr/console/ast2400.C
#
# BOOT_FLAGS_VERSION_REG = 0x28,
# Serial config reg: 0x2d
# Serial config mask: 0xc0
#
# NONE = 0x00, // No output selected
# SELECT_SUART = 0x40, // SIO Uart
# SELECT_VUART = 0x80, // SOL virtual uart
# RESERVED = 0xc0, // Reserved
SYSFS_SIO=/sys/devices/platform/ahb/ahb:apb/1e789000.lpc/1e789080.lpc-host/1e789080.lpc-host:regs
SYSFS_SIO28=$SYSFS_SIO/sio_28
SYSFS_SIO2D=$SYSFS_SIO/sio_2d
FLAGS_VERSION1=$((0x42))
usage()
{
echo "usage: hb_settings [[-u|--uart vuart|suart|none] | [-s|--show] | [-h]]"
}
show_regs()
{
SIO28=$(cat $SYSFS_SIO28)
SIO2D=$(cat $SYSFS_SIO2D)
case $SIO28 in
$FLAGS_VERSION1)
echo "Boot flags version 1"
;;
* )
echo "Unknown boot flags version"
;;
esac
case $(($SIO2D >> 6)) in
0)
echo "Hostboot serial output disabled"
;;
1)
echo "Hostboot serial output on SUART"
;;
2)
echo "Hostboot serial output on VUART"
;;
3)
echo "Reserved value"
;;
* )
echo "Invalid uart value"
;;
esac
}
set_regs()
{
case $uart in
suart)
echo "Hostboot serial output on SUART"
VAL=0x40
;;
vuart)
echo "Hostboot serial output on VUART"
VAL=0x80
;;
none)
echo "Hostboot serial output disabled"
VAL=0x00
;;
* )
echo "Invalid uart value"
usage
exit 1
esac
echo $FLAGS_VERSION1 > $SYSFS_SIO28
echo $VAL > $SYSFS_SIO2D
}
while [ "$1" != "" ]; do
case $1 in
-u | --uart) shift
uart=$1
set_regs
exit
;;
-s | --show ) show_regs
exit
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
usage
exit 0
|