blob: 97fec9dd37b8b6e08918838fe11be64878821e37 [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}
Stefan Reinauer14e22772010-04-27 06:56:47 +000011The goals of the new language are these:
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000012\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
Stefan Reinauer14e22772010-04-27 06:56:47 +000019\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
Stefan Reinauer14e22772010-04-27 06:56:47 +000025in only a few respects. It borrows heavily from Greg Watson's suggestions.
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000026
Stefan Reinauer14e22772010-04-27 06:56:47 +000027I 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.
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000029\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 | ... )*
Stefan Reinauer14e22772010-04-27 06:56:47 +000034#
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000035unary-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.
Stefan Reinauer14e22772010-04-27 06:56:47 +000042# It is an error to have two option commands in a file.
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000043# 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
Stefan Reinauer14e22772010-04-27 06:56:47 +000048# is scanned.
49# Multiple defaults for an ID will produce warning, but not errors.
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000050# 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
Stefan Reinauer14e22772010-04-27 06:56:47 +000056# as parts are sourced, a device tree is built. The structure
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000057# 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:
Stefan Reinauer14e22772010-04-27 06:56:47 +000060# southbridge acer/5432
61# superio nsc/123
62# end
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000063# 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
Stefan Reinauer14e22772010-04-27 06:56:47 +000082southbridge ::= 'southbridge' PATH (statemnts)* 'end'
83northbridge ::= 'northbridge' PATH (statemnts)* 'end'
84superio ::= 'superio PATH (statemnts)* 'end'
85cpu ::= 'cpu' PATH (statemnts)* 'end'
86arch ::= 'arch' PATH (statemnts)* 'end'
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000087
88# files for building linuxbios
Stefan Reinauer14e22772010-04-27 06:56:47 +000089# include a file in crt0.S
90mainboardinit ::= 'mainboardinit' PATH
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000091
Stefan Reinauer14e22772010-04-27 06:56:47 +000092# object file
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +000093object ::= '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
Stefan Reinauer14e22772010-04-27 06:56:47 +0000119statement ::=
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000120 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
Elyes HAOUASe5138782016-07-28 13:08:24 +0200175# over-ride the default ROM size in the mainboard file
Stefan Reinauer08670622009-06-30 15:17:49 +0000176option CONFIG_ROM_SIZE=1024*1024
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000177mainboard 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#
Stefan Reinauer08670622009-06-30 15:17:49 +0000191option CONFIG_DEBUG=1
192default CONFIG_USE_FALLBACK_IMAGE=1
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000193option 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###
Stefan Reinauer14e22772010-04-27 06:56:47 +0000207if CONFIG_USE_FALLBACK_IMAGE
208 mainboardinit cpu/i386/reset16.inc
209 ldscript cpu/i386/reset16.lds
Eric Biederman9bdb4602003-09-01 23:17:58 +0000210else
Stefan Reinauer14e22772010-04-27 06:56:47 +0000211 mainboardinit cpu/i386/reset32.inc
212 ldscript cpu/i386/reset32.lds
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000213end
214.
215.
216.
Stefan Reinauer08670622009-06-30 15:17:49 +0000217if CONFIG_USE_FALLBACK_IMAGE mainboardinit arch/i386/lib/noop_failover.inc end
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000218#
219###
220### Romcc output
221###
Stefan Reinauer08670622009-06-30 15:17:49 +0000222#makerule ./failover.E dep "$(CONFIG_MAINBOARD)/failover.c" act "$(CPP) -I$(TOP)/src $(CPPFLAGS) $(CONFIG_MAINBOARD)/failover.c > ./failever.E"
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000223#makerule ./failover.inc dep "./romcc ./failover.E" act "./romcc -O ./failover.E > failover.inc"
224#mainboardinit ./failover.inc
Stefan Reinauer08670622009-06-30 15:17:49 +0000225makerule ./auto.E dep "$(CONFIG_MAINBOARD)/auto.c" act "$(CPP) -I$(TOP)/src -$(ROMCCPPFLAGS) $(CPPFLAGS) $(CONFIG_MAINBOARD)/auto.c > ./auto.E"
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000226makerule ./auto.inc dep "./romcc ./auto.E" act "./romcc -O ./auto.E > auto.inc"
227mainboardinit ./auto.inc
228#
229###
Stefan Reinauer14e22772010-04-27 06:56:47 +0000230### Include the secondary Configuration files
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000231###
232northbridge amd/amdk8
233end
234southbridge amd/amd8111
235end
236#mainboardinit arch/i386/smp/secondary.inc
Uwe Hermannd86417b2006-10-24 23:00:42 +0000237superio nsc/pc87360
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000238 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
Stefan Reinauer08670622009-06-30 15:17:49 +0000253if CONFIG_HAVE_MP_TABLE object mptable.o end
254if CONFIG_HAVE_PIRQ_TABLE object irq_tables.o end
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000255### 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###
Stefan Reinauer08670622009-06-30 15:17:49 +0000264option CONFIG_PAYLOAD_SIZE = (CONFIG_ROM_SECTION_SIZE - CONFIG_ROM_IMAGE_SIZE)
265option CONFIG_ROM_PAYLOAD_START = (0xffffffff - CONFIG_ROM_SIZE + CONFIG_ROM_SECTION_OFFSET + 1)
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000266#
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
Stefan Reinauer08670622009-06-30 15:17:49 +0000275export CONFIG_MAINBOARD:=/home/rminnich/src/yapps2/freebios2/src/mainboard/amd/solo
276export CONFIG_ARCH:=i386
277export CONFIG_RAMBASE:=0x4000
278export CONFIG_ROM_IMAGE_SIZE:=65535
279export CONFIG_PAYLOAD_SIZE:=131073
Eric Biederman9bdb4602003-09-01 23:17:58 +0000280export CONFIG_MAX_CPUS:=1
Stefan Reinauer08670622009-06-30 15:17:49 +0000281export CONFIG_HEAP_SIZE:=8192
282export CONFIG_STACK_SIZE:=8192
283export CONFIG_MEMORY_HOLE:=0
Stefan Reinauerf8ee1802008-01-18 15:08:58 +0000284export COREBOOT_VERSION:=1.1.0
Stefan Reinauer08670622009-06-30 15:17:49 +0000285export CC:=$(CONFIG_CROSS_COMPILE)gcc
Ronald G. Minnichfd958ce2003-06-06 14:35:36 +0000286
287\end{verbatim}
288
Stefan Reinauer14e22772010-04-27 06:56:47 +0000289In other words, instead of expressions, we see the values. It's easier to
290deal with.