PCI Bus.
[cascardo/kernel/slides/.git] / 13buses / pci
1 %PCI
2 %Thadeu Cascardo
3
4 # PCI Basics
5
6 * Addressing: bus, device and function
7 * Configuration space
8 * "Firmware" (BIOS, PROM, etc) sets up the devices
9
10 # Files and Tools
11
12 * /sys/bus/pci/
13         - devices/*/
14                 * vendor
15                 * device
16                 * class
17                 * config
18 * /proc/bus/pci/
19 * /proc/bus/pci/devices
20 * lspci
21
22 # Configuration space
23
24 * 64 standardized bytes
25 * Identifiers
26 * Base Addresses
27 * IRQs
28 * Little-endian
29
30 # PCI IDs
31
32 * struct pci\\_device\\_id
33         - vendor
34         - device
35         - subvendor
36         - subdevice
37         - class
38         - class\\_mask
39         - driver\\_data
40 * PCI\\_ANY\\_ID
41 * PCI\\_DEVICE
42 * PCI\\_DEVICE\\_CLASS
43 * DEFINE\\_PCI\\_DEVICE\\_TABLE
44
45 # PCI Drivers
46
47 * struct pci\\_driver
48         - name
49         - id\\_table
50         - probe
51         - remove
52 * pci\\_register\\_driver
53 * pci\\_unregister\\_driver
54
55 # PCI Device
56
57 * struct pci\\_dev
58 * pci\\_enable\\_device
59 * pci\\_disable\\_device
60 * pci\\_set\\_drvdata
61
62 # Accessing the configuration space
63
64 * pci\\_read\\_config\\_byte(dev, where, *val)
65 * pci\\_read\\_config\\_word(dev, where, *val)
66 * pci\\_read\\_config\\_dword(dev, where, *val)
67 * pci\\_write\\_config\\_byte(dev, where, val)
68 * pci\\_write\\_config\\_word(dev, where, val)
69 * pci\\_write\\_config\\_dword(dev, where, val)
70
71 # PCI Resources
72
73 * pci\\_resource\\_start(dev, bar)
74 * pci\\_resource\\_end(dev, bar)
75 * pci\\_resource\\_len(dev, bar)
76 * pci\\_resource\\_flags(dev, bar)
77         - IORESOURCE\\_IO
78         - IORESOURCE\\_MEM
79
80 # Using PCI devices
81
82 * pci\\_request\\_regions
83 * pci\\_release\\_regions
84 * pci\\_iomap
85 * pci\\_ioremap\\_bar
86 * struct pci\\_dev
87         - irq