Professional Documents
Culture Documents
Devices For Linux
Devices For Linux
David Gibson
Benjamin Herrenschmidt
<dwg@au1.ibm.com>
<benh@kernel.crashing.org>
Abstract
devices or buses .
We
properties,
machine.
structured information.
chines.
be created using
bootwrapper image.
of device tree.
ppc64
powerpc
Introduction
relatively
recently,
the
only
64-bit
) iSeries
tree. Even so, the lack means the iSeries boot se-
device tree that describes all of the system's hardware devices and how they're connected.
During
plementing
kexec().
1 Well,
device information.
So, when
kexec()
comes
or removed with
compact :
ble.
When booting on OF
prom_init.c,
which executes in
Oset
0x00
0x04
0x08
0x0C
0x10
0x14
0x18
0x1C
0x20
is then passed to the kernel proper, which eventually unattens the tree into its runtime form. This
blob is the only data communicated between the
prom_init.c
When OF isn't available, either because the machine doesn't have it at all or because
memmove().
kexec() has
.
.
.
Contents
0xd00dfeed
totalsize
o_struct
o_strs
o_rsvmap
version
last_comp_ver
boot_cpu_id
size_strs
o_rsvmap
address0
...
OF. For
kexec(),
the userland
kexec
tools build
.
.
.
zImage
wrapper
o_strs
+
relocatable :
+
+
totalsize
0x0000000000000000
0x0000000000000000
memory reserve
table
end marker
.
.
.
.
.
.
.
.
.
only
.
.
.
.
.
.
0x04
0x08
0x0C
0x10
0x14
0x18
only
...
.
.
.
size_strs
len0
.
.
.
o_struct
0x04
0x08
>v2
>v3
.
.
.
0x04
0x08
0x0C
magic number
OF_DT_BEGIN_NODE
'/' 0
0 0
OF_DT_PROP
0x00000005
0x00000008
'M' 'y' 'B' 'o'
'a' 'r' 'd' 0
strings block
structure block
root node
model
.
.
.
OF_DT_END_NODE
OF_DT_END
.
.
.
The format for the blob we devised, was rst described on the
linuxppc64-dev
dtc
tems.
ture block
and
the kernel actually requires; the attened tree generally need not include devices that the kernel can
2
regions of memory that the kernel must not use .
system.
size entry.
for the PCI host bridges; the kernel will scan the
the kernel needs extra information, though: for example, for ISA devices on a subsidiary PCI/ISA
OF_DT_BEGIN_NODE
tag,
followed
by
the
ing.
node's
OF_DT_PROP
each in-
OF_DT_BEGIN_NODE tag.
The node ends with an OF_DT_END_NODE tag,
and after the OF_DT_END_NODE for the root node
is an OF_DT_END tag, indicating the end of the
troduced with their own
whole tree .
ings for many modern buses and devices. In particular, embedded specic devices such as the various
System-on-Chip buses are not covered. We intend
to create new bindings for such buses, in keeping
OF_DT_BEGIN_NODE
/).
OF_DT_PROP
The
an
2 Usually
4 In
nel.
3 This
within OF memory.
2
3
connections.
linux,phandle
property.
OF, it adds a
linux,phandle
property to each
10
11
12
13
14
15
16
17
18
19
type followed by an
20
For
21
22
HyperTransport
TM
24
25
26
27
30
properties equal to
memory
and
pci,
28
name
31
32
respectively.
33
34
35
pci@40000000000000 {
/* PCI host bridge */
/* ... */
};
36
mpic@0x3fffdd08400 {
/* Interrupt controller */
/* ... */
};
29
For example,
memory@0 {
device_type = " memory ";
memreg : reg = <00000000 00000000
00000000 20000000 >;
};
23
37
38
39
40
41
42
43
44
45
ory
/ {
};
chosen {
bootargs = " root =/ dev / sda2 ";
linux , platform = <00000600 >;
interrupt - controller =
< &/ mpic@0x3fffdd08400 >;
};
Figure 2: Example
dtc
source
tedious.
dtc5 ,
is de-
necessary blob.
5 dtc
booted kernel.
Figure
given as just
string
/proc/device-tree
(roughly, a di-
cells
to
node has an
node
.o le
The
(for example,
[1234abcdef]).
The
references.
In-
interrupt-controller
/chosen
property re-
/mpic@0x3fffdd08400.
dtc
will automati-
dtc
and
can produce an
(for example,
to act as a decompiler.
dtc
\n, \0
The
dtc
The prop-
blob format.
"MyBoard").
Properties are
(for example,
bytestring
dtc
name = value ;.
running kernel.
};
ward use of
...
starts
dtc
le
In addition,
layout of
The
example.
name, followed by a
an
It can
shows
/memreserve/
with
dtc
For
to have an explicit
name
property. When
The source
/memory@0.
reg
dtc
mined at runtime.
dtc
performs a number of
already
It checks
rors.
dtc
semantic structure :
dtc
dtc is bad
binary include :
ed by the
properties.
interrupt-parent
platform devices.
macros :
correctly.
These checks are useful to catch simple problems
Future Work
dtc.
References
[2] Benjamin
v0.1, http://ozlabs.org/pipermail/
linuxppc64-dev/2005-May/004073.html.
2005,
not been migrated to the attened device tree apWe plan to remove the
ppc
architecture
[3]
//ozlabs.org/pipermail/linuxppc64-dev/
2005-December/006994.html.
dtc
At
to imple-
proach.
dtc
dtc
Although
[4]
IEEE Standard for Boot (Initialization Conguration) Firmware: Core Requirements and
Practices,
valds.
Other company, product, and service names may
Benjamin Herrenschmidt was a MacOS developer for about 10 years, but ultimately saw the
light and installed Linux on his Apple PowerPC
machine.
Legal Statement
This work represents the view of the author and
does not necessarily represent the view of IBM.
IBM,
PowerPC,
POWER5,
pSeries
PowerPC
and
iSeries
Architecture,
are
trademarks