Commit | Line | Data |
---|---|---|
ce292991 WD |
1 | * Generic PCI host controller |
2 | ||
3 | Firmware-initialised PCI host controllers and PCI emulations, such as the | |
4 | virtio-pci implementations found in kvmtool and other para-virtualised | |
5 | systems, do not require driver support for complexities such as regulator | |
6 | and clock management. In fact, the controller may not even require the | |
7 | configuration of a control interface by the operating system, instead | |
8 | presenting a set of fixed windows describing a subset of IO, Memory and | |
9 | Configuration Spaces. | |
10 | ||
11 | Such a controller can be described purely in terms of the standardized device | |
12 | tree bindings communicated in pci.txt: | |
13 | ||
14 | ||
15 | Properties of the host controller node: | |
16 | ||
17 | - compatible : Must be "pci-host-cam-generic" or "pci-host-ecam-generic" | |
18 | depending on the layout of configuration space (CAM vs | |
19 | ECAM respectively). | |
20 | ||
21 | - device_type : Must be "pci". | |
22 | ||
23 | - ranges : As described in IEEE Std 1275-1994, but must provide | |
24 | at least a definition of non-prefetchable memory. One | |
25 | or both of prefetchable Memory and IO Space may also | |
26 | be provided. | |
27 | ||
28 | - bus-range : Optional property (also described in IEEE Std 1275-1994) | |
29 | to indicate the range of bus numbers for this controller. | |
30 | If absent, defaults to <0 255> (i.e. all buses). | |
31 | ||
32 | - #address-cells : Must be 3. | |
33 | ||
34 | - #size-cells : Must be 2. | |
35 | ||
36 | - reg : The Configuration Space base address and size, as accessed | |
37 | from the parent bus. | |
38 | ||
39 | ||
40 | Properties of the /chosen node: | |
41 | ||
42 | - linux,pci-probe-only | |
43 | : Optional property which takes a single-cell argument. | |
44 | If '0', then Linux will assign devices in its usual manner, | |
45 | otherwise it will not try to assign devices and instead use | |
46 | them as they are configured already. | |
47 | ||
48 | Configuration Space is assumed to be memory-mapped (as opposed to being | |
49 | accessed via an ioport) and laid out with a direct correspondence to the | |
50 | geography of a PCI bus address by concatenating the various components to | |
51 | form an offset. | |
52 | ||
53 | For CAM, this 24-bit offset is: | |
54 | ||
55 | cfg_offset(bus, device, function, register) = | |
56 | bus << 16 | device << 11 | function << 8 | register | |
57 | ||
58 | Whilst ECAM extends this by 4 bits to accomodate 4k of function space: | |
59 | ||
60 | cfg_offset(bus, device, function, register) = | |
61 | bus << 20 | device << 15 | function << 12 | register | |
62 | ||
63 | Interrupt mapping is exactly as described in `Open Firmware Recommended | |
64 | Practice: Interrupt Mapping' and requires the following properties: | |
65 | ||
66 | - #interrupt-cells : Must be 1 | |
67 | ||
68 | - interrupt-map : <see aforementioned specification> | |
69 | ||
70 | - interrupt-map-mask : <see aforementioned specification> | |
71 | ||
72 | ||
73 | Example: | |
74 | ||
75 | pci { | |
76 | compatible = "pci-host-cam-generic" | |
77 | device_type = "pci"; | |
78 | #address-cells = <3>; | |
79 | #size-cells = <2>; | |
80 | bus-range = <0x0 0x1>; | |
81 | ||
82 | // CPU_PHYSICAL(2) SIZE(2) | |
83 | reg = <0x0 0x40000000 0x0 0x1000000>; | |
84 | ||
85 | // BUS_ADDRESS(3) CPU_PHYSICAL(2) SIZE(2) | |
86 | ranges = <0x01000000 0x0 0x01000000 0x0 0x01000000 0x0 0x00010000>, | |
87 | <0x02000000 0x0 0x41000000 0x0 0x41000000 0x0 0x3f000000>; | |
88 | ||
89 | ||
90 | #interrupt-cells = <0x1>; | |
91 | ||
92 | // PCI_DEVICE(3) INT#(1) CONTROLLER(PHANDLE) CONTROLLER_DATA(3) | |
93 | interrupt-map = < 0x0 0x0 0x0 0x1 &gic 0x0 0x4 0x1 | |
94 | 0x800 0x0 0x0 0x1 &gic 0x0 0x5 0x1 | |
95 | 0x1000 0x0 0x0 0x1 &gic 0x0 0x6 0x1 | |
96 | 0x1800 0x0 0x0 0x1 &gic 0x0 0x7 0x1>; | |
97 | ||
98 | // PCI_DEVICE(3) INT#(1) | |
99 | interrupt-map-mask = <0xf800 0x0 0x0 0x7>; | |
100 | } |