Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 6: Device Drivers


0170-0177 : ide1
...
0378-037a : parport0
03c0-03df : vga+
...
0cf8-0cff : PCI conf1
1800-180f : Intel Corp. 82820 820 (Camino 2) Chipset IDE U100 (-M)
1800-1807 : ide0
1808-180f : ide1
1810-181f : Intel Corp. 82820 820 (Camino 2) Chipset SMBus
1820-183f : Intel Corp. 82820 820 (Camino 2) Chipset USB (Hub A)
...
3000-3fff : PCI Bus #01
3000-303f : Intel Corp. 82820 (ICH2) Chipset Ethernet Controller
3000-303f : eepro100

Table 6-3: Functions for Accessing I/O Memory Areas.


Function Meaning

readb(addr)

readw(addr)

readl(addr) Reads a byte, word, or long from the specified I/O addressaddr.

writeb(val, addr)

writew(val, addr)

writel(val, addr) Writes a byte, word, or long value specified byvalto the I/O
addressaddr.

memcpy_fromio(dest, src, num) Movesnumbytes from the I/O addressssrctodestin normal
address space.

memcpy_toio(dst, src, nun) Copiesnumbytes fromdstin normal address space tosrcin the
I/O area.

memset_io(addr, value, count) Fillscountbytes withvaluestarting at positionaddr.

Again the kernel makes use of indentation to reflect the parent/child and sibling relationships. The
list was generated on the same system as the I/O memory areas shown above. It is interesting that the
list includes not only standard system components such as keyboard and timer but also a few familiar
devices from the I/O mapping such as the Ethernet controller — after all, there’s no reason why a device
cannot be addressed via ports and I/O memory.


Usually ports must be accessed by means of special processor commands on the assembler level. The
kernel therefore provides corresponding macros to make a system-independent interface available to
driver programmers. They are listed in Table 6-4.

Free download pdf