1pci(4) File Formats pci(4)
2
3
4
6 pci, pcie - configuration files for PCI and PCI Express device drivers
7
9 The Peripheral Component Interconnect (PCI) bus is a little endian bus.
10 PCI Express (PCIe) and PCI-X are successors to PCI. All three types of
11 devices share the same configuration parameters. What is specified here
12 for PCI devices applies to PCI-X 1.0 devices as well. All three types
13 of devices are self-identifying, which means that these devices provide
14 configuration parameters to the system that allow the system to iden‐
15 tify the device and its driver. The configuration parameters are repre‐
16 sented in the form of name-value pairs that can be retrieved using the
17 DDI property interfaces. See ddi_prop_lookup(9F) for details.
18
19
20 The bus properties of PCI devices or logical bus properties of PCIe
21 devices are derived from PCI configuration space, or supplied by the
22 Fcode PROM, if it exists. Therefore, driver configuration files are not
23 necessary for these devices.
24
25
26 On some occasions, drivers for PCI and PCIe devices can use driver con‐
27 figuration files to provide driver private properties through the
28 global property mechanism. See driver.conf(4) for further details.
29 Driver configuration files can also be used to augment or override
30 properties for a specific instance of a driver.
31
32
33 All bus drivers of PCI and PCIe devices recognize the following proper‐
34 ties:
35
36 reg An arbitrary length array where each element of the array
37 consists of a 5-tuple of 32-bit values. Each array ele‐
38 ment describes a logically contiguous mappable resource
39 on the PCI bus or PCIe device tree.
40
41 The first three values in the 5-tuple describe the PCI
42 address of the mappable resource. The first tuple con‐
43 tains the following information:
44
45
46
47
48 Bits 0 - 7 8-bit register number
49 Bits 8 - 10 3-bit function number
50 Bits 11 - 15 5-bit device number
51 Bits 16 - 23 8-bit bus number
52 Bits 24 - 25 2-bit address space type identifier
53 Bits 31 - 28 Register number extended bits 8:11
54 for extended config space. Zero for
55 conventional configuration space.
56
57 The address space type identifier can be interpreted as
58 follows:
59
60
61
62
63 0x0 configuration space
64 0x1 I/O space
65 0x2 32-bit memory space address
66
67 0x3 64-bit memory space address
68
69 The bus number is a unique identifying number assigned to
70 each PCI bus or PCIe logical bus within its domain.
71
72 The device number is a unique identifying number assigned
73 to each device on a PCI bus or PCIe logical bus. Note
74 that a device number is unique only within the set of
75 device numbers for a particular bus or logical bus.
76
77 Each PCI or PCIe device can have one to eight logically
78 independent functions, each with its own independent set
79 of configuration registers. Each function on a device is
80 assigned a function number. For a device with only one
81 function, the function number must be 0.
82
83 The register number fields select a particular register
84 within the set of configuration registers corresponding
85 to the selected function. When the address space type
86 identifier indicates configuration space, non-zero regis‐
87 ter number extended bits select registers in extended
88 configuration space.
89
90 The second and third values in the reg property 5-tuple
91 specify the 64-bit address of the mappable resource
92 within the PCI or PCIe address domain. The second 32-bit
93 tuple corresponds to the high order four bytes of the
94 64-bit address. The third 32-bit tuple corresponds to the
95 low order bytes.
96
97 The fourth and fifth 32-bit values in the 5-tuple reg
98 property specify the size of the mappable resource. The
99 size is a 64-bit value, where the fourth tuple corre‐
100 sponds to the high order bytes of the 64-bit size and the
101 fifth corresponds to the low order.
102
103 The driver can refer to the elements of this array by
104 index, and construct kernel mappings to these addresses
105 using ddi_regs_map_setup(9F). The index into the array is
106 passed as the rnumber argument of ddi_regs_map_setup(9F).
107
108 At a high-level interrupt context, you can use the
109 ddi_get* and ddi_put* family of functions to access I/O
110 and memory space. However, access to configuration space
111 is not allowed when running at a high-interrupt level.
112
113
114 interrupts This property consists of a single-integer element array.
115 Valid interrupt property values are 1, 2, 3, and 4. This
116 value is derived directly from the contents of the
117 device's configuration-interrupt-pin register.
118
119 A driver should use an index value of 0 when registering
120 its interrupt handler with the DDI interrupt interfaces.
121
122
123
124 All PCI and PCIe devices support the reg property. The device number
125 and function number as derived from the reg property are used to con‐
126 struct the address part of the device name under /devices.
127
128
129 Only devices that generate interrupts support an interrupts property.
130
131
132 Occasionally it might be necessary to override or augment the configu‐
133 ration information supplied by a PCI or PCIe device. This change can be
134 achieved by writing a driver configuration file that describes a proto‐
135 type device node specification containing the additional properties
136 required.
137
138
139 For the system to merge the prototype node specification into an actual
140 device node, certain conditions must be met.
141
142 o First, the name property must be identical. The value of the
143 name property needs to match the binding name of the device.
144 The binding name is the name chosen by the system to bind a
145 driver to a device and is either an alias associated with
146 the driver or the hardware node name of the device.
147
148 o Second, the parent property must identify the PCI bus or
149 PCIe logical bus.
150
151 o Third, the unit-address property must identify the card. The
152 format of the unit-address property is:
153
154
155 DD[,F]
156
157
158 where DD is the device number and F is the function number. If the
159 function number is 0, only DD is specified.
160
162 Example 1 Sample Configuration File
163
164
165 An example configuration file called ACME,scsi-hba.conf for a PCI
166 driver called ACME,scsi-hba follows:
167
168
169 #
170 # Copyright (c) 1995, ACME SCSI Host Bus Adaptor
171 # ident "@(#)ACME,scsi-hba.conf 1.1 96/02/04"
172 name="ACME,scsi-hba" parent="/pci@1,0/pci@1f,4000"
173 unit-address="3" scsi-initiator-id=6;
174 hba-advanced-mode="on";
175 hba-dma-speed=10;
176
177
178
179
180 In this example, a property scsi-initiator-id specifies the SCSI bus
181 initiator id that the adapter should use, for just one particular
182 instance of adapter installed in the machine. The name property identi‐
183 fies the driver and the parent property to identify the particular bus
184 the card is plugged into. This example uses the parent's full path name
185 to identify the bus. The unit-address property identifies the card
186 itself, with device number of 3 and function number of 0.
187
188
189
190 Two global driver properties are also created: hba-advanced-mode (which
191 has the string value on) and hba-dma-speed (which has the value 10 M
192 bit/s). These properties apply to all device nodes of the ACME,scsi-
193 hba.
194
195
196
197 Configuration files for PCIe devices are similar. Shown below is an
198 example configuration file called ACME,pcie-widget.conf for a PCIe
199 driver called ACME,pcie-widget.
200
201
202 #
203 # Copyright (c) 2005, ACME PCIe Widget Adapter
204 # ident "@(#)ACME,pcie-widget.conf 1.1 05/11/14"
205 name="ACME,pcie-widget" parent="/pci@780" unit-address="2,1"
206 debug-mode=12;
207
208
209
210
211 In this example, we provide a property debug-mode for a particular PCIe
212 device. As before, the logical bus is identified by the pathname of the
213 parent of the device. The device has a device number of 2, and a func‐
214 tion number of 1.
215
216
218 See attributes(5) for descriptions of the following attributes:
219
220
221
222
223 ┌─────────────────────────────┬─────────────────────────────┐
224 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
225 ├─────────────────────────────┼─────────────────────────────┤
226 │Architecture │SPARC, x86 │
227 └─────────────────────────────┴─────────────────────────────┘
228
230 driver.conf(4), attributes(5), ddi_intr_add_handler(9F),
231 ddi_prop_lookup(9F), ddi_regs_map_setup(9F)
232
233
234 Writing Device Drivers
235
236
237 IEEE 1275 PCI Bus Binding
238
239
240 http://playground.sun.com/1275/bindings/pci/pci-express.txt
241
243 PCIe devices support an extended configuration space unavailable to PCI
244 devices. While PCIe devices can be operated using a PCI device driver,
245 operating them using a PCIe device driver can make use of the extended
246 properties and features made available only in the extended configura‐
247 tion space.
248
249
250
251SunOS 5.11 13 May 2005 pci(4)