How to do I/O.
[cascardo/kernel/slides/.git] / 11io / io
1 %I/O
2 %Thadeu Cascardo
3
4 # I/O Ports versus Memory Mapped Devices
5
6 * Separate I/O space in x86 architecture
7 * Other architectures emulate this I/O space access
8
9 # Resource allocation
10
11 * Different drivers must not conflict when using device resources, like I/O
12   ports or memory space
13 * They must request these resources and release them
14
15 # I/O port allocation
16
17 * linux/ioport.h
18 * request\\_region(port, num, name)
19 * release\\_region(port, num)
20 * /proc/ioports
21
22 # I/O ports access
23
24 * asm/io.h
25 * inb(port)
26 * outb(data, port)
27 * inw(port)
28 * outw(data, port)
29 * inl(port)
30 * outl(port)
31 * String operations
32 * Pausing I/O
33 * Platform Issues
34
35 # Memory Region Allocation
36
37 * request\\_mem\\_region(start, len, name)
38 * release\\_mem\\_region(start, len)
39
40 # Memory Mapping
41
42 * ioremap(phys\\_addr, size)
43 * iounmap(virt\\_addr)
44
45 # Memory Access
46
47 * ioread8(addr)
48 * ioread16(addr)
49 * ioread32(addr)
50 * iowrite8(val, addr)
51 * iowrite16(val, addr)
52 * iowrite32(val, addr)
53 * memset\\_io(addr, val, cnt)
54 * memcpy\\_fromio(dst, src, cnt)
55 * memcpy\\_toio(dst, src, cnt)
56
57 # Mapping I/O Ports to Memory
58
59 * ioport\\_map(port, cnt)
60 * ioport\\_unmap(addr)
61
62 # Memory Barries
63
64 * linux/kernel.h
65 * barrier()
66 * asm/system.h
67 * rmb()
68 * wmb()
69 * mb()
70 * smp\\_rmb
71 * smp\\_wmb
72 * smp\\_mb