Chapter 6: Device Drivers
parent
sibling
parentchild
parent
sibling
child
parent
71: *(*(struc...->parent
name = 0xc11e7300 "PCI Bus #01"start = 4094689280
end = 4095737855flags = 512
parent = sibling = 0xc02f12340xc11e645c
child = 0xc11e345c
57: *(*(struc....sibling
name = 0xc11e661c "Intel Corp. 82815 CGC [Chipset Graphics Controller]"start = 4160749568
end = 4227858431flags = 4616
parent = sibling = 0xc02f12340xc0002120
child = 0x0
60: *(*(struc...8].child
name = start = 40946892800xc11e361c "Intel Corp. 82820 (ICH2) Chipset Ethernet Controller"
end = 4094693375flags = 512
parent = sibling = 0xc11e693c0xc11e485c
child = 0xc11fad60
68: *(*(struc...>sibling
name = 0xc11e4a1c "PCI device 104c:8021 (Texas Instruments)"start = 4094693376
end = 4094695423flags = 512
parent = 0xc11e693csibling = 0xc11e4c5c
child = 0x0
69: *(*(struc...d->child
name = 0xc02c60af "eepro100"start = 4094689280
end = 4094693375flags = 2147483648
parent = sibling = 0x00xc11e345c
child = 0x0
58: *(*(struc...].parent
name = 0xc02aa2a7 "PCI mem"start = 0
end = 4294967295flags = 512
parent = 0x0sibling = 0x0
child = 0xc0002000
Figure 6-21: Allocated resources of a PCI network card.
Even after I/O areas have been mapped, it is necessary on some platforms to use
special methods rather than direct pointer de-referencing to access the individual
memory areas. Table 6-3 shows the functions declared to do this on all platforms
(generally in<asm-arch/io.h>). They should always be used by portable drivers
even if they boil down to simple pointer de-referencing on some architectures
because no other steps are needed to communicate with the I/O areas (as on IA-32
systems, for example).
6.6.3 I/O Ports
I/O ports are a popular way of communicating with devices and buses, above all in the IA-32 world. As
with I/O memory, the required region must first be registered before it can be accessed by a driver in
good faith — unfortunately, the processor is again unable to check whether this has been done.
ioport_resourcefromkernel/resource.cacts as the root element of a resource tree. Theioportsfile
in theprocfilesystem reveals the reserved port addresses.
wolfgang@meitner>cat /proc/ioports
0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
...