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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
New config language for LinuxBIOS
\begin{abstract}
We describe the new configuration language for LinuxBIOS.
\end{abstract}
\section{Scope}
This document defines the new configuration language for LinuxBIOS.
\section{Goals}
The goals of the new language are these:
\begin{itemize}
\item Simplified Makefiles so people can see what is set
\item Move from the regular-expression-based language to something
a bit more comprehensible and flexible
\item make the specification easier for people to use and understand
\item allow unique register-set-specifiers for each chip
\item allow generic register-set-specifiers for each chip
\item generate static initialization code, as needed, for the
specifiers.
\end{itemize}
\section{Language}
Here is the new language. It is very similar to the old one, differing
in only a few respects. It borrows heavily from Greg Watson's suggestions.
I am presenting it in a pseudo-BNF in the hopes it will be easier. Things
in '' are keywords; things in ``'' are strings in the actual text.
\begin{verbatim}
#exprs are composed of factor or factor + factor etc.
expr ::= factor ( ``+'' factor | ``-'' factor | )*
#factors are term or term * term or term / term or ...
factor ::= term ( ``*'' term | ``/'' term | ... )*
#
unary-op ::= ``!'' ID
# term is a number, hexnumber, ID, unary-op, or a full-blown expression
term ::= NUM | XNUM | ID | unary-op | ``(`` expr ``)''
# Option command. Can be an expression or quote-string.
# Options are used in the config tool itself (in expressions and 'if')
# and are also passed to the C compiler when building linuxbios.
# It is an error to have two option commands in a file.
# It is an error to have an option command after the ID has been used
# in an expression (i.e. 'set after used' is an error)
option ::= 'option' ID '=' (``value'' | term)
# Default command. The ID is set to this value if no option command
# is scanned.
# Multiple defaults for an ID will produce warning, but not errors.
# It is OK to scan a default command after use of an ID.
# Options always over-ride defaults.
default ::= 'default' ID '=' (``value'' | term)
# the mainboard, southbridge, northbridge commands
# cause sourcing of Config.lb files as in the old config tool
# as parts are sourced, a device tree is built. The structure
# of the tree is determined by the structure of the components
# as they are specified. To attach a superio to a southbridge, for
# example, one would do this:
# southbridge acer/5432
# superio NSC/123
# end
# end
# the tool generates static initializers for this hierarchy.
# add C code to the current component (motherboard, etc. )
# to initialise the component-INDEPENDENT structure members
init ::= 'init' ``CODE''
# add C code to the current component (motherboard, etc. )
# to initialise the component-DEPENDENT structure members
register ::= 'register' ``CODE''
# mainboard command
# statements in this block will set variables controlling the mainboard,
# and will also place components (northbridge etc.) in the device tree
# under this mainboard
mainboard ::= 'mainboard' PATH (statements)* 'end'
# standard linuxbios commands
southbridge ::= 'southbridge' PATH (statemnts)* 'end'
northbridge ::= 'northbridge' PATH (statemnts)* 'end'
superio ::= 'superio PATH (statemnts)* 'end'
cpu ::= 'cpu' PATH (statemnts)* 'end'
arch ::= 'arch' PATH (statemnts)* 'end'
# files for building linuxbios
# include a file in crt0.S
mainboardinit ::= 'mainboardinit' PATH
# object file
object ::= 'object' PATH
# driver objects are just built into the image in a different way
driver ::= 'driver' PATH
# Use the Config.lb file in the PATH
dir ::= 'dir' PATH
# add a file to the set of ldscript files
ldscript ::= 'ldscript' PATH
# dependencies or actions for the makerule command
dep ::= 'dep' ``dependency-string''
act ::= 'act' ``actions''
depsacts ::= (dep | act)*
# set up a makerule
#
makerule ::= 'makerule' PATH depsacts
#defines for use in makefiles only
# note usable in the config tool, not passed to cc
makedefine ::= 'makedefine' ``RAWTEXT''
# add an action to an existing make rule
addaction ::= 'addaction' PATH ``ACTION''
# statements
statement ::=
option
| default
| cpu
| arch
| northbridge
| southbridge
| superio
| object
| driver
| mainboardinit
| makerule
| makedefine
| addaction
| init
| register
| iif
| dir
| ldscript
statements ::= (statement)*
# target directory specification
target ::= 'target' PATH
# and the whole thing
board ::= target (option)* mainboard
\end{verbatim}
\subsubsection{Command definitions}
\subsubsubsection{option}
\subsubsubsection{default}
\subsubsubsection{cpu}
\subsubsubsection{arch}
\subsubsubsection{northbridge}
\subsubsubsection{southbridge}
\subsubsubsection{superio}
\subsubsubsection{object}
\subsubsubsection{driver}
\subsubsubsection{mainboardinit}
\subsubsubsection{makerule}
\subsubsubsection{makedefine}
\subsubsubsection{addaction}
\subsubsubsection{init}
\subsubsubsection{register}
\subsubsubsection{iif}
\subsubsubsection{dir}
\subsubsubsection{ldscript}
A sample file:
\begin{verbatim}
target x
# over-ride the default rom size in the mainboard file
option ROM_SIZE=1024*1024
mainboard amd/solo
end
\end{verbatim}
Sample mainboard file
\begin{verbatim}
#
###
### Set all of the defaults for an x86 architecture
###
arch i386 end
cpu k8 end
#
option DEBUG=1
default USE_FALLBACK_IMAGE=1
option A=(1+2)
option B=0xa
#
###
### Build our 16 bit and 32 bit linuxBIOS entry code
###
mainboardinit cpu/i386/entry16.inc
mainboardinit cpu/i386/entry32.inc
ldscript cpu/i386/entry16.lds
ldscript cpu/i386/entry32.lds
#
###
### Build our reset vector (This is where linuxBIOS is entered)
###
if USE_FALLBACK_IMAGE
mainboardinit cpu/i386/reset16.inc
ldscript cpu/i386/reset16.lds
else
mainboardinit cpu/i386/reset32.inc
ldscript cpu/i386/reset32.lds
end
.
.
.
if USE_FALLBACK_IMAGE mainboardinit arch/i386/lib/noop_failover.inc end
#
###
### Romcc output
###
#makerule ./failover.E dep "$(MAINBOARD)/failover.c" act "$(CPP) -I$(TOP)/src $(CPPFLAGS) $(MAINBOARD)/failover.c > ./failever.E"
#makerule ./failover.inc dep "./romcc ./failover.E" act "./romcc -O ./failover.E > failover.inc"
#mainboardinit ./failover.inc
makerule ./auto.E dep "$(MAINBOARD)/auto.c" act "$(CPP) -I$(TOP)/src -$(ROMCCPPFLAGS) $(CPPFLAGS) $(MAINBOARD)/auto.c > ./auto.E"
makerule ./auto.inc dep "./romcc ./auto.E" act "./romcc -O ./auto.E > auto.inc"
mainboardinit ./auto.inc
#
###
### Include the secondary Configuration files
###
northbridge amd/amdk8
end
southbridge amd/amd8111
end
#mainboardinit arch/i386/smp/secondary.inc
superio NSC/pc87360
register "com1={1} com2={0} floppy=1 lpt=1 keyboard=1"
end
dir /pc80
##dir /src/superio/winbond/w83627hf
cpu p5 end
cpu p6 end
cpu k7 end
cpu k8 end
#
###
### Build the objects we have code for in this directory.
###
##object mainboard.o
driver mainboard.o
object static_devices.o
if HAVE_MP_TABLE object mptable.o end
if HAVE_PIRQ_TABLE object irq_tables.o end
### Location of the DIMM EEPROMS on the SMBUS
### This is fixed into a narrow range by the DIMM package standard.
###
option SMBUS_MEM_DEVICE_START=(0xa << 3)
option SMBUS_MEM_DEVICE_END=(SMBUS_MEM_DEVICE_START +1)
option SMBUS_MEM_DEVICE_INC=1
#
### The linuxBIOS bootloader.
###
option PAYLOAD_SIZE = (ROM_SECTION_SIZE - ROM_IMAGE_SIZE)
option CONFIG_ROM_STREAM_START = (0xffffffff - ROM_SIZE + ROM_SECTION_OFFSET + 1)
#
\end{verbatim}
I've found the output of the new tool to be easier to
handle. Makefile.settings looks like this, for example:
\begin{verbatim}
TOP:=/home/rminnich/src/yapps2/freebios2
TARGET_DIR:=x
export MAINBOARD:=/home/rminnich/src/yapps2/freebios2/src/mainboard/amd/solo
export ARCH:=i386
export _RAMBASE:=0x4000
export ROM_IMAGE_SIZE:=65535
export PAYLOAD_SIZE:=131073
export CONFIG_MAX_CPUS:=1
export HEAP_SIZE:=8192
export STACK_SIZE:=8192
export MEMORY_HOLE:=0
export LINUXBIOS_VERSION:=1.1.0
export CC:=$(CROSS_COMPILE)gcc
\end{verbatim}
In other words, instead of expressions, we see the values. It's easier to
deal with.
|