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