Diff markup
1 /* 1 /*
2 * pci.h 2 * pci.h
3 * 3 *
4 * PCI defines and function prototypes 4 * PCI defines and function prototypes
5 * Copyright 1994, Drew Eckhardt 5 * Copyright 1994, Drew Eckhardt
6 * Copyright 1997--1999 Martin Mares <mj@ 6 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
7 * 7 *
8 * For more information, please consult t 8 * For more information, please consult the following manuals (look at
9 * http://www.pcisig.com/ for how to get 9 * http://www.pcisig.com/ for how to get them):
10 * 10 *
11 * PCI BIOS Specification 11 * PCI BIOS Specification
12 * PCI Local Bus Specification 12 * PCI Local Bus Specification
13 * PCI to PCI Bridge Specification 13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide 14 * PCI System Design Guide
15 */ 15 */
16 16
17 #ifndef LINUX_PCI_H 17 #ifndef LINUX_PCI_H
18 #define LINUX_PCI_H 18 #define LINUX_PCI_H
19 19
20 #include <linux/mod_devicetable.h> !! 20 /* Include the pci register defines */
21 !! 21 #include <linux/pci_regs.h>
22 /* <<
23 * Under PCI, each device has 256 bytes of con <<
24 * of which the first 64 bytes are standardize <<
25 */ <<
26 #define PCI_VENDOR_ID 0x00 /* 16 <<
27 #define PCI_DEVICE_ID 0x02 /* 16 <<
28 #define PCI_COMMAND 0x04 /* 16 <<
29 #define PCI_COMMAND_IO 0x1 /* Ena <<
30 #define PCI_COMMAND_MEMORY 0x2 /* Ena <<
31 #define PCI_COMMAND_MASTER 0x4 /* Ena <<
32 #define PCI_COMMAND_SPECIAL 0x8 /* Ena <<
33 #define PCI_COMMAND_INVALIDATE 0x10 /* Use <<
34 #define PCI_COMMAND_VGA_PALETTE 0x20 /* Ena <<
35 #define PCI_COMMAND_PARITY 0x40 /* Ena <<
36 #define PCI_COMMAND_WAIT 0x80 /* Ena <<
37 #define PCI_COMMAND_SERR 0x100 /* Ena <<
38 #define PCI_COMMAND_FAST_BACK 0x200 /* Ena <<
39 #define PCI_COMMAND_INTX_DISABLE 0x400 /* INT <<
40 <<
41 #define PCI_STATUS 0x06 /* 16 <<
42 #define PCI_STATUS_CAP_LIST 0x10 /* Sup <<
43 #define PCI_STATUS_66MHZ 0x20 /* Sup <<
44 #define PCI_STATUS_UDF 0x40 /* Sup <<
45 #define PCI_STATUS_FAST_BACK 0x80 /* Acc <<
46 #define PCI_STATUS_PARITY 0x100 /* Det <<
47 #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEV <<
48 #define PCI_STATUS_DEVSEL_FAST 0x000 <<
49 #define PCI_STATUS_DEVSEL_MEDIUM 0x200 <<
50 #define PCI_STATUS_DEVSEL_SLOW 0x400 <<
51 #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* <<
52 #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* <<
53 #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* <<
54 #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* <<
55 #define PCI_STATUS_DETECTED_PARITY 0x8000 /* <<
56 <<
57 #define PCI_CLASS_REVISION 0x08 /* Hig <<
58 rev <<
59 #define PCI_REVISION_ID 0x08 /* Rev <<
60 #define PCI_CLASS_PROG 0x09 /* Reg <<
61 #define PCI_CLASS_DEVICE 0x0a /* Dev <<
62 <<
63 #define PCI_CACHE_LINE_SIZE 0x0c /* 8 b <<
64 #define PCI_LATENCY_TIMER 0x0d /* 8 b <<
65 #define PCI_HEADER_TYPE 0x0e /* 8 b <<
66 #define PCI_HEADER_TYPE_NORMAL 0 <<
67 #define PCI_HEADER_TYPE_BRIDGE 1 <<
68 #define PCI_HEADER_TYPE_CARDBUS 2 <<
69 <<
70 #define PCI_BIST 0x0f /* 8 b <<
71 #define PCI_BIST_CODE_MASK 0x0f /* Ret <<
72 #define PCI_BIST_START 0x40 /* 1 t <<
73 #define PCI_BIST_CAPABLE 0x80 /* 1 i <<
74 <<
75 /* <<
76 * Base addresses specify locations in memory <<
77 * Decoded size can be determined by writing a <<
78 * 0xffffffff to the register, and reading it <<
79 * 1 bits are decoded. <<
80 */ <<
81 #define PCI_BASE_ADDRESS_0 0x10 /* 32 <<
82 #define PCI_BASE_ADDRESS_1 0x14 /* 32 <<
83 #define PCI_BASE_ADDRESS_2 0x18 /* 32 <<
84 #define PCI_BASE_ADDRESS_3 0x1c /* 32 <<
85 #define PCI_BASE_ADDRESS_4 0x20 /* 32 <<
86 #define PCI_BASE_ADDRESS_5 0x24 /* 32 <<
87 #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = <<
88 #define PCI_BASE_ADDRESS_SPACE_IO 0x01 <<
89 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 <<
90 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 <<
91 #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 <<
92 #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 <<
93 #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 <<
94 #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 <<
95 #define PCI_BASE_ADDRESS_MEM_MASK (~0x0f <<
96 #define PCI_BASE_ADDRESS_IO_MASK (~0x03 <<
97 /* bit 1 is reserved if address_space = 1 */ <<
98 <<
99 /* Header type 0 (normal devices) */ <<
100 #define PCI_CARDBUS_CIS 0x28 <<
101 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c <<
102 #define PCI_SUBSYSTEM_ID 0x2e <<
103 #define PCI_ROM_ADDRESS 0x30 /* Bit <<
104 #define PCI_ROM_ADDRESS_ENABLE 0x01 <<
105 #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) <<
106 <<
107 #define PCI_CAPABILITY_LIST 0x34 /* Off <<
108 <<
109 /* 0x35-0x3b are reserved */ <<
110 #define PCI_INTERRUPT_LINE 0x3c /* 8 b <<
111 #define PCI_INTERRUPT_PIN 0x3d /* 8 b <<
112 #define PCI_MIN_GNT 0x3e /* 8 b <<
113 #define PCI_MAX_LAT 0x3f /* 8 b <<
114 <<
115 /* Header type 1 (PCI-to-PCI bridges) */ <<
116 #define PCI_PRIMARY_BUS 0x18 /* Pri <<
117 #define PCI_SECONDARY_BUS 0x19 /* Sec <<
118 #define PCI_SUBORDINATE_BUS 0x1a /* Hig <<
119 #define PCI_SEC_LATENCY_TIMER 0x1b /* Lat <<
120 #define PCI_IO_BASE 0x1c /* I/O <<
121 #define PCI_IO_LIMIT 0x1d <<
122 #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O <<
123 #define PCI_IO_RANGE_TYPE_16 0x00 <<
124 #define PCI_IO_RANGE_TYPE_32 0x01 <<
125 #define PCI_IO_RANGE_MASK (~0x0fUL) <<
126 #define PCI_SEC_STATUS 0x1e /* Sec <<
127 #define PCI_MEMORY_BASE 0x20 /* Mem <<
128 #define PCI_MEMORY_LIMIT 0x22 <<
129 #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL <<
130 #define PCI_MEMORY_RANGE_MASK (~0x0fUL) <<
131 #define PCI_PREF_MEMORY_BASE 0x24 /* Pre <<
132 #define PCI_PREF_MEMORY_LIMIT 0x26 <<
133 #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL <<
134 #define PCI_PREF_RANGE_TYPE_32 0x00 <<
135 #define PCI_PREF_RANGE_TYPE_64 0x01 <<
136 #define PCI_PREF_RANGE_MASK (~0x0fUL) <<
137 #define PCI_PREF_BASE_UPPER32 0x28 /* Upp <<
138 #define PCI_PREF_LIMIT_UPPER32 0x2c <<
139 #define PCI_IO_BASE_UPPER16 0x30 /* Upp <<
140 #define PCI_IO_LIMIT_UPPER16 0x32 <<
141 /* 0x34 same as for htype 0 */ <<
142 /* 0x35-0x3b is reserved */ <<
143 #define PCI_ROM_ADDRESS1 0x38 /* Sam <<
144 /* 0x3c-0x3d are same as for htype 0 */ <<
145 #define PCI_BRIDGE_CONTROL 0x3e <<
146 #define PCI_BRIDGE_CTL_PARITY 0x01 /* Ena <<
147 #define PCI_BRIDGE_CTL_SERR 0x02 /* The <<
148 #define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Dis <<
149 #define PCI_BRIDGE_CTL_VGA 0x08 /* For <<
150 #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* <<
151 #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Sec <<
152 #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fas <<
153 <<
154 /* Header type 2 (CardBus bridges) */ <<
155 #define PCI_CB_CAPABILITY_LIST 0x14 <<
156 /* 0x15 reserved */ <<
157 #define PCI_CB_SEC_STATUS 0x16 /* Sec <<
158 #define PCI_CB_PRIMARY_BUS 0x18 /* PCI <<
159 #define PCI_CB_CARD_BUS 0x19 /* Car <<
160 #define PCI_CB_SUBORDINATE_BUS 0x1a /* Sub <<
161 #define PCI_CB_LATENCY_TIMER 0x1b /* Car <<
162 #define PCI_CB_MEMORY_BASE_0 0x1c <<
163 #define PCI_CB_MEMORY_LIMIT_0 0x20 <<
164 #define PCI_CB_MEMORY_BASE_1 0x24 <<
165 #define PCI_CB_MEMORY_LIMIT_1 0x28 <<
166 #define PCI_CB_IO_BASE_0 0x2c <<
167 #define PCI_CB_IO_BASE_0_HI 0x2e <<
168 #define PCI_CB_IO_LIMIT_0 0x30 <<
169 #define PCI_CB_IO_LIMIT_0_HI 0x32 <<
170 #define PCI_CB_IO_BASE_1 0x34 <<
171 #define PCI_CB_IO_BASE_1_HI 0x36 <<
172 #define PCI_CB_IO_LIMIT_1 0x38 <<
173 #define PCI_CB_IO_LIMIT_1_HI 0x3a <<
174 #define PCI_CB_IO_RANGE_MASK (~0x03UL) <<
175 /* 0x3c-0x3d are same as for htype 0 */ <<
176 #define PCI_CB_BRIDGE_CONTROL 0x3e <<
177 #define PCI_CB_BRIDGE_CTL_PARITY 0x01 <<
178 #define PCI_CB_BRIDGE_CTL_SERR 0x02 <<
179 #define PCI_CB_BRIDGE_CTL_ISA 0x04 <<
180 #define PCI_CB_BRIDGE_CTL_VGA 0x08 <<
181 #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 <<
182 #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 <<
183 #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 <<
184 #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 <<
185 #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 <<
186 #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 <<
187 #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 <<
188 #define PCI_CB_SUBSYSTEM_ID 0x42 <<
189 #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16- <<
190 /* 0x48-0x7f reserved */ <<
191 <<
192 /* Capability lists */ <<
193 <<
194 #define PCI_CAP_LIST_ID 0 /* Cap <<
195 #define PCI_CAP_ID_PM 0x01 /* Pow <<
196 #define PCI_CAP_ID_AGP 0x02 /* Acc <<
197 #define PCI_CAP_ID_VPD 0x03 /* Vit <<
198 #define PCI_CAP_ID_SLOTID 0x04 /* Slo <<
199 #define PCI_CAP_ID_MSI 0x05 /* Mes <<
200 #define PCI_CAP_ID_CHSWP 0x06 /* Com <<
201 #define PCI_CAP_ID_PCIX 0x07 /* PCI <<
202 #define PCI_CAP_ID_SHPC 0x0C /* PCI <<
203 #define PCI_CAP_ID_EXP 0x10 /* PCI <<
204 #define PCI_CAP_ID_MSIX 0x11 /* MSI <<
205 #define PCI_CAP_LIST_NEXT 1 /* Nex <<
206 #define PCI_CAP_FLAGS 2 /* Cap <<
207 #define PCI_CAP_SIZEOF 4 <<
208 <<
209 /* Power Management Registers */ <<
210 <<
211 #define PCI_PM_PMC 2 /* PM <<
212 #define PCI_PM_CAP_VER_MASK 0x0007 /* Ver <<
213 #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME <<
214 #define PCI_PM_CAP_RESERVED 0x0010 /* Res <<
215 #define PCI_PM_CAP_DSI 0x0020 /* Dev <<
216 #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Aux <<
217 #define PCI_PM_CAP_D1 0x0200 /* D1 <<
218 #define PCI_PM_CAP_D2 0x0400 /* D2 <<
219 #define PCI_PM_CAP_PME 0x0800 /* PME <<
220 #define PCI_PM_CAP_PME_MASK 0xF800 /* PME <<
221 #define PCI_PM_CAP_PME_D0 0x0800 /* PME <<
222 #define PCI_PM_CAP_PME_D1 0x1000 /* PME <<
223 #define PCI_PM_CAP_PME_D2 0x2000 /* PME <<
224 #define PCI_PM_CAP_PME_D3 0x4000 /* PME <<
225 #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME <<
226 #define PCI_PM_CTRL 4 /* PM <<
227 #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Cur <<
228 #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME <<
229 #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 <<
230 #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 <<
231 #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME <<
232 #define PCI_PM_PPB_EXTENSIONS 6 /* PPB <<
233 #define PCI_PM_PPB_B2_B3 0x40 /* Sto <<
234 #define PCI_PM_BPCC_ENABLE 0x80 /* Bus <<
235 #define PCI_PM_DATA_REGISTER 7 /* (?? <<
236 #define PCI_PM_SIZEOF 8 <<
237 <<
238 /* AGP registers */ <<
239 <<
240 #define PCI_AGP_VERSION 2 /* BCD <<
241 #define PCI_AGP_RFU 3 /* Res <<
242 #define PCI_AGP_STATUS 4 /* Sta <<
243 #define PCI_AGP_STATUS_RQ_MASK 0xff000000 <<
244 #define PCI_AGP_STATUS_SBA 0x0200 /* Sid <<
245 #define PCI_AGP_STATUS_64BIT 0x0020 /* 64- <<
246 #define PCI_AGP_STATUS_FW 0x0010 /* FW <<
247 #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x <<
248 #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x <<
249 #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x <<
250 #define PCI_AGP_COMMAND 8 /* Con <<
251 #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 / <<
252 #define PCI_AGP_COMMAND_SBA 0x0200 /* Sid <<
253 #define PCI_AGP_COMMAND_AGP 0x0100 /* All <<
254 #define PCI_AGP_COMMAND_64BIT 0x0020 /* All <<
255 #define PCI_AGP_COMMAND_FW 0x0010 /* For <<
256 #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use <<
257 #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use <<
258 #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use <<
259 #define PCI_AGP_SIZEOF 12 <<
260 <<
261 /* Vital Product Data */ <<
262 <<
263 #define PCI_VPD_ADDR 2 /* Add <<
264 #define PCI_VPD_ADDR_MASK 0x7fff /* Add <<
265 #define PCI_VPD_ADDR_F 0x8000 /* Wri <<
266 #define PCI_VPD_DATA 4 /* 32- <<
267 <<
268 /* Slot Identification */ <<
269 <<
270 #define PCI_SID_ESR 2 /* Exp <<
271 #define PCI_SID_ESR_NSLOTS 0x1f /* Num <<
272 #define PCI_SID_ESR_FIC 0x20 /* Fir <<
273 #define PCI_SID_CHASSIS_NR 3 /* Cha <<
274 <<
275 /* Message Signalled Interrupts registers */ <<
276 <<
277 #define PCI_MSI_FLAGS 2 /* Var <<
278 #define PCI_MSI_FLAGS_64BIT 0x80 /* 64- <<
279 #define PCI_MSI_FLAGS_QSIZE 0x70 /* Mes <<
280 #define PCI_MSI_FLAGS_QMASK 0x0e /* Max <<
281 #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI <<
282 #define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64- <<
283 #define PCI_MSI_RFU 3 /* Res <<
284 #define PCI_MSI_ADDRESS_LO 4 /* Low <<
285 #define PCI_MSI_ADDRESS_HI 8 /* Upp <<
286 #define PCI_MSI_DATA_32 8 /* 16 <<
287 #define PCI_MSI_DATA_64 12 /* 16 <<
288 #define PCI_MSI_MASK_BIT 16 /* Mas <<
289 <<
290 /* CompactPCI Hotswap Register */ <<
291 <<
292 #define PCI_CHSWP_CSR 2 /* Con <<
293 #define PCI_CHSWP_DHA 0x01 /* Dev <<
294 #define PCI_CHSWP_EIM 0x02 /* ENU <<
295 #define PCI_CHSWP_PIE 0x04 /* Pen <<
296 #define PCI_CHSWP_LOO 0x08 /* LED <<
297 #define PCI_CHSWP_PI 0x30 /* Pro <<
298 #define PCI_CHSWP_EXT 0x40 /* ENU <<
299 #define PCI_CHSWP_INS 0x80 /* ENU <<
300 <<
301 /* PCI-X registers */ <<
302 <<
303 #define PCI_X_CMD 2 /* Mod <<
304 #define PCI_X_CMD_DPERR_E 0x0001 /* Dat <<
305 #define PCI_X_CMD_ERO 0x0002 /* Ena <<
306 #define PCI_X_CMD_MAX_READ 0x000c /* Max <<
307 #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max <<
308 #define PCI_X_CMD_VERSION(x) (((x) >> 12) & <<
309 #define PCI_X_STATUS 4 /* PCI <<
310 #define PCI_X_STATUS_DEVFN 0x000000ff <<
311 #define PCI_X_STATUS_BUS 0x0000ff00 <<
312 #define PCI_X_STATUS_64BIT 0x00010000 <<
313 #define PCI_X_STATUS_133MHZ 0x00020000 <<
314 #define PCI_X_STATUS_SPL_DISC 0x00040000 <<
315 #define PCI_X_STATUS_UNX_SPL 0x00080000 <<
316 #define PCI_X_STATUS_COMPLEX 0x00100000 <<
317 #define PCI_X_STATUS_MAX_READ 0x00600000 <<
318 #define PCI_X_STATUS_MAX_SPLIT 0x03800000 <<
319 #define PCI_X_STATUS_MAX_CUM 0x1c000000 <<
320 #define PCI_X_STATUS_SPL_ERR 0x20000000 <<
321 #define PCI_X_STATUS_266MHZ 0x40000000 <<
322 #define PCI_X_STATUS_533MHZ 0x80000000 <<
323 <<
324 /* PCI Express capability registers */ <<
325 <<
326 #define PCI_EXP_FLAGS 2 /* Cap <<
327 #define PCI_EXP_FLAGS_VERS 0x000f /* Cap <<
328 #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Dev <<
329 #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Exp <<
330 #define PCI_EXP_TYPE_LEG_END 0x1 /* Leg <<
331 #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Roo <<
332 #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Ups <<
333 #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Dow <<
334 #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI <<
335 #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slo <<
336 #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Int <<
337 #define PCI_EXP_DEVCAP 4 /* Dev <<
338 #define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max <<
339 #define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Pha <<
340 #define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Ext <<
341 #define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s <<
342 #define PCI_EXP_DEVCAP_L1 0xe00 /* L1 <<
343 #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Att <<
344 #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Att <<
345 #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Pow <<
346 #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* S <<
347 #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* S <<
348 #define PCI_EXP_DEVCTL 8 /* Dev <<
349 #define PCI_EXP_DEVCTL_CERE 0x0001 /* Cor <<
350 #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non <<
351 #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fat <<
352 #define PCI_EXP_DEVCTL_URRE 0x0008 /* Uns <<
353 #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Ena <<
354 #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max <<
355 #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Ext <<
356 #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Pha <<
357 #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Aux <<
358 #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* <<
359 #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max <<
360 #define PCI_EXP_DEVSTA 10 /* Dev <<
361 #define PCI_EXP_DEVSTA_CED 0x01 /* Cor <<
362 #define PCI_EXP_DEVSTA_NFED 0x02 /* Non <<
363 #define PCI_EXP_DEVSTA_FED 0x04 /* Fat <<
364 #define PCI_EXP_DEVSTA_URD 0x08 /* Uns <<
365 #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX <<
366 #define PCI_EXP_DEVSTA_TRPND 0x20 /* Tra <<
367 #define PCI_EXP_LNKCAP 12 /* Lin <<
368 #define PCI_EXP_LNKCTL 16 /* Lin <<
369 #define PCI_EXP_LNKSTA 18 /* Lin <<
370 #define PCI_EXP_SLTCAP 20 /* Slo <<
371 #define PCI_EXP_SLTCTL 24 /* Slo <<
372 #define PCI_EXP_SLTSTA 26 /* Slo <<
373 #define PCI_EXP_RTCTL 28 /* Roo <<
374 #define PCI_EXP_RTCTL_SECEE 0x01 /* Sys <<
375 #define PCI_EXP_RTCTL_SENFEE 0x02 /* Sys <<
376 #define PCI_EXP_RTCTL_SEFEE 0x04 /* Sys <<
377 #define PCI_EXP_RTCTL_PMEIE 0x08 /* PME <<
378 #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS <<
379 #define PCI_EXP_RTCAP 30 /* Roo <<
380 #define PCI_EXP_RTSTA 32 /* Roo <<
381 <<
382 /* Extended Capabilities (PCI-X 2.0 and Expres <<
383 #define PCI_EXT_CAP_ID(header) (heade <<
384 #define PCI_EXT_CAP_VER(header) ((head <<
385 #define PCI_EXT_CAP_NEXT(header) ((head <<
386 <<
387 #define PCI_EXT_CAP_ID_ERR 1 <<
388 #define PCI_EXT_CAP_ID_VC 2 <<
389 #define PCI_EXT_CAP_ID_DSN 3 <<
390 #define PCI_EXT_CAP_ID_PWR 4 <<
391 <<
392 /* Advanced Error Reporting */ <<
393 #define PCI_ERR_UNCOR_STATUS 4 /* Unc <<
394 #define PCI_ERR_UNC_TRAIN 0x00000001 <<
395 #define PCI_ERR_UNC_DLP 0x00000010 <<
396 #define PCI_ERR_UNC_POISON_TLP 0x00001000 <<
397 #define PCI_ERR_UNC_FCP 0x00002000 <<
398 #define PCI_ERR_UNC_COMP_TIME 0x00004000 <<
399 #define PCI_ERR_UNC_COMP_ABORT 0x00008000 <<
400 #define PCI_ERR_UNC_UNX_COMP 0x00010000 <<
401 #define PCI_ERR_UNC_RX_OVER 0x00020000 <<
402 #define PCI_ERR_UNC_MALF_TLP 0x00040000 <<
403 #define PCI_ERR_UNC_ECRC 0x00080000 <<
404 #define PCI_ERR_UNC_UNSUP 0x00100000 <<
405 #define PCI_ERR_UNCOR_MASK 8 /* Unc <<
406 /* Same bits as above */ <<
407 #define PCI_ERR_UNCOR_SEVER 12 /* Unc <<
408 /* Same bits as above */ <<
409 #define PCI_ERR_COR_STATUS 16 /* Cor <<
410 #define PCI_ERR_COR_RCVR 0x00000001 <<
411 #define PCI_ERR_COR_BAD_TLP 0x00000040 <<
412 #define PCI_ERR_COR_BAD_DLLP 0x00000080 <<
413 #define PCI_ERR_COR_REP_ROLL 0x00000100 <<
414 #define PCI_ERR_COR_REP_TIMER 0x00001000 <<
415 #define PCI_ERR_COR_MASK 20 /* Cor <<
416 /* Same bits as above */ <<
417 #define PCI_ERR_CAP 24 /* Adv <<
418 #define PCI_ERR_CAP_FEP(x) ((x) & 31) <<
419 #define PCI_ERR_CAP_ECRC_GENC 0x00000020 <<
420 #define PCI_ERR_CAP_ECRC_GENE 0x00000040 <<
421 #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 <<
422 #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 <<
423 #define PCI_ERR_HEADER_LOG 28 /* Hea <<
424 #define PCI_ERR_ROOT_COMMAND 44 /* Roo <<
425 #define PCI_ERR_ROOT_STATUS 48 <<
426 #define PCI_ERR_ROOT_COR_SRC 52 <<
427 #define PCI_ERR_ROOT_SRC 54 <<
428 <<
429 /* Virtual Channel */ <<
430 #define PCI_VC_PORT_REG1 4 <<
431 #define PCI_VC_PORT_REG2 8 <<
432 #define PCI_VC_PORT_CTRL 12 <<
433 #define PCI_VC_PORT_STATUS 14 <<
434 #define PCI_VC_RES_CAP 16 <<
435 #define PCI_VC_RES_CTRL 20 <<
436 #define PCI_VC_RES_STATUS 26 <<
437 <<
438 /* Power Budgeting */ <<
439 #define PCI_PWR_DSR 4 /* Dat <<
440 #define PCI_PWR_DATA 8 /* Dat <<
441 #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) <<
442 #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & <<
443 #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & <<
444 #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) <<
445 #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & <<
446 #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & <<
447 #define PCI_PWR_CAP 12 /* Cap <<
448 #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) <<
449 <<
450 /* Include the ID list */ <<
451 <<
452 #include <linux/pci_ids.h> <<
453 22
454 /* 23 /*
455 * The PCI interface treats multi-function dev 24 * The PCI interface treats multi-function devices as independent
456 * devices. The slot/function address of each 25 * devices. The slot/function address of each device is encoded
457 * in a single byte as follows: 26 * in a single byte as follows:
458 * 27 *
459 * 7:3 = slot 28 * 7:3 = slot
460 * 2:0 = function 29 * 2:0 = function
461 */ 30 */
462 #define PCI_DEVFN(slot,func) ((((slot) & 0x !! 31 #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
463 #define PCI_SLOT(devfn) (((devfn) >> 3 32 #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
464 #define PCI_FUNC(devfn) ((devfn) & 0x0 33 #define PCI_FUNC(devfn) ((devfn) & 0x07)
465 34
466 /* Ioctls for /proc/bus/pci/X/Y nodes. */ 35 /* Ioctls for /proc/bus/pci/X/Y nodes. */
467 #define PCIIOC_BASE ('P' << 24 | ' 36 #define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8)
468 #define PCIIOC_CONTROLLER (PCIIOC_BASE | 37 #define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */
469 #define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 38 #define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */
470 #define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 39 #define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */
471 #define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 40 #define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */
472 41
473 #ifdef __KERNEL__ 42 #ifdef __KERNEL__
474 43
>> 44 #include <linux/mod_devicetable.h>
>> 45
475 #include <linux/types.h> 46 #include <linux/types.h>
476 #include <linux/config.h> <<
477 #include <linux/ioport.h> 47 #include <linux/ioport.h>
478 #include <linux/list.h> 48 #include <linux/list.h>
>> 49 #include <linux/compiler.h>
479 #include <linux/errno.h> 50 #include <linux/errno.h>
>> 51 #include <asm/atomic.h>
480 #include <linux/device.h> 52 #include <linux/device.h>
481 53
>> 54 /* Include the ID list */
>> 55 #include <linux/pci_ids.h>
>> 56
482 /* File state for mmap()s on /proc/bus/pci/X/Y 57 /* File state for mmap()s on /proc/bus/pci/X/Y */
483 enum pci_mmap_state { 58 enum pci_mmap_state {
484 pci_mmap_io, 59 pci_mmap_io,
485 pci_mmap_mem 60 pci_mmap_mem
486 }; 61 };
487 62
488 /* This defines the direction arg to the DMA m 63 /* This defines the direction arg to the DMA mapping routines. */
489 #define PCI_DMA_BIDIRECTIONAL 0 64 #define PCI_DMA_BIDIRECTIONAL 0
490 #define PCI_DMA_TODEVICE 1 65 #define PCI_DMA_TODEVICE 1
491 #define PCI_DMA_FROMDEVICE 2 66 #define PCI_DMA_FROMDEVICE 2
492 #define PCI_DMA_NONE 3 67 #define PCI_DMA_NONE 3
493 68
494 #define DEVICE_COUNT_COMPATIBLE 4 <<
495 #define DEVICE_COUNT_RESOURCE 12 69 #define DEVICE_COUNT_RESOURCE 12
496 70
497 typedef int __bitwise pci_power_t; 71 typedef int __bitwise pci_power_t;
498 72
499 #define PCI_D0 ((pci_power_t __force) 0) !! 73 #define PCI_D0 ((pci_power_t __force) 0)
500 #define PCI_D1 ((pci_power_t __force) 1) !! 74 #define PCI_D1 ((pci_power_t __force) 1)
501 #define PCI_D2 ((pci_power_t __force) 2) !! 75 #define PCI_D2 ((pci_power_t __force) 2)
502 #define PCI_D3hot ((pci_power_t __force) 76 #define PCI_D3hot ((pci_power_t __force) 3)
503 #define PCI_D3cold ((pci_power_t __force) 77 #define PCI_D3cold ((pci_power_t __force) 4)
>> 78 #define PCI_UNKNOWN ((pci_power_t __force) 5)
>> 79 #define PCI_POWER_ERROR ((pci_power_t __force) -1)
>> 80
>> 81 /** The pci_channel state describes connectivity between the CPU and
>> 82 * the pci device. If some PCI bus between here and the pci device
>> 83 * has crashed or locked up, this info is reflected here.
>> 84 */
>> 85 typedef unsigned int __bitwise pci_channel_state_t;
>> 86
>> 87 enum pci_channel_state {
>> 88 /* I/O channel is in normal state */
>> 89 pci_channel_io_normal = (__force pci_channel_state_t) 1,
>> 90
>> 91 /* I/O to channel is blocked */
>> 92 pci_channel_io_frozen = (__force pci_channel_state_t) 2,
>> 93
>> 94 /* PCI card is dead */
>> 95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
>> 96 };
>> 97
>> 98 typedef unsigned int __bitwise pcie_reset_state_t;
>> 99
>> 100 enum pcie_reset_state {
>> 101 /* Reset is NOT asserted (Use to deassert reset) */
>> 102 pcie_deassert_reset = (__force pcie_reset_state_t) 1,
>> 103
>> 104 /* Use #PERST to reset PCI-E device */
>> 105 pcie_warm_reset = (__force pcie_reset_state_t) 2,
>> 106
>> 107 /* Use PCI-E Hot Reset to reset device */
>> 108 pcie_hot_reset = (__force pcie_reset_state_t) 3
>> 109 };
>> 110
>> 111 typedef unsigned short __bitwise pci_dev_flags_t;
>> 112 enum pci_dev_flags {
>> 113 /* INTX_DISABLE in PCI_COMMAND register disables MSI
>> 114 * generation too.
>> 115 */
>> 116 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
>> 117 };
>> 118
>> 119 typedef unsigned short __bitwise pci_bus_flags_t;
>> 120 enum pci_bus_flags {
>> 121 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
>> 122 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
>> 123 };
>> 124
>> 125 struct pci_cap_saved_state {
>> 126 struct hlist_node next;
>> 127 char cap_nr;
>> 128 u32 data[0];
>> 129 };
504 130
505 /* 131 /*
506 * The pci_dev structure is used to describe P 132 * The pci_dev structure is used to describe PCI devices.
507 */ 133 */
508 struct pci_dev { 134 struct pci_dev {
509 struct list_head global_list; /* nod 135 struct list_head global_list; /* node in list of all PCI devices */
510 struct list_head bus_list; /* nod 136 struct list_head bus_list; /* node in per-bus list */
511 struct pci_bus *bus; /* bus 137 struct pci_bus *bus; /* bus this device is on */
512 struct pci_bus *subordinate; /* bus 138 struct pci_bus *subordinate; /* bus this device bridges to */
513 139
514 void *sysdata; /* hoo 140 void *sysdata; /* hook for sys-specific extension */
515 struct proc_dir_entry *procent; /* dev 141 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
516 142
517 unsigned int devfn; /* enc 143 unsigned int devfn; /* encoded device & function index */
518 unsigned short vendor; 144 unsigned short vendor;
519 unsigned short device; 145 unsigned short device;
520 unsigned short subsystem_vendor; 146 unsigned short subsystem_vendor;
521 unsigned short subsystem_device; 147 unsigned short subsystem_device;
522 unsigned int class; /* 3 b 148 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
>> 149 u8 revision; /* PCI revision, low byte of class word */
523 u8 hdr_type; /* PCI 150 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
>> 151 u8 pcie_type; /* PCI-E device/port type */
524 u8 rom_base_reg; /* whi 152 u8 rom_base_reg; /* which config register controls the ROM */
>> 153 u8 pin; /* which interrupt pin this device uses */
525 154
526 struct pci_driver *driver; /* whi 155 struct pci_driver *driver; /* which driver has allocated this device */
527 u64 dma_mask; /* Mas 156 u64 dma_mask; /* Mask of the bits of bus address this
528 dev 157 device implements. Normally this is
529 0xf 158 0xffffffff. You only need to change
530 thi 159 this if your device has broken DMA
531 or 160 or supports 64-bit transfers. */
532 161
>> 162 struct device_dma_parameters dma_parms;
>> 163
533 pci_power_t current_state; /* Cur 164 pci_power_t current_state; /* Current operating state. In ACPI-speak,
534 thi 165 this is D0-D3, D0 being fully functional,
535 and 166 and D3 being off. */
536 167
>> 168 pci_channel_state_t error_state; /* current connectivity state */
537 struct device dev; /* Gen 169 struct device dev; /* Generic device interface */
538 170
539 /* device is compatible with these IDs <<
540 unsigned short vendor_compatible[DEVIC <<
541 unsigned short device_compatible[DEVIC <<
542 <<
543 int cfg_size; /* Siz 171 int cfg_size; /* Size of configuration space */
544 172
545 /* 173 /*
546 * Instead of touching interrupt line 174 * Instead of touching interrupt line and base address registers
547 * directly, use the values stored her 175 * directly, use the values stored here. They might be different!
548 */ 176 */
549 unsigned int irq; 177 unsigned int irq;
550 struct resource resource[DEVICE_COUNT_ 178 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
551 179
552 char * slot_name; /* poi <<
553 <<
554 /* These fields are used by common fix 180 /* These fields are used by common fixups */
555 unsigned int transparent:1; /* Tra 181 unsigned int transparent:1; /* Transparent PCI bridge */
556 unsigned int multifunction:1;/* Par 182 unsigned int multifunction:1;/* Part of multi-function device */
557 /* keep track of device state */ 183 /* keep track of device state */
558 unsigned int is_enabled:1; /* pci <<
559 unsigned int is_busmaster:1; /* dev 184 unsigned int is_busmaster:1; /* device is busmaster */
560 !! 185 unsigned int no_msi:1; /* device may not use msi */
>> 186 unsigned int no_d1d2:1; /* only allow d0 or d3 */
>> 187 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
>> 188 unsigned int broken_parity_status:1; /* Device generates false positive parity */
>> 189 unsigned int msi_enabled:1;
>> 190 unsigned int msix_enabled:1;
>> 191 unsigned int is_managed:1;
>> 192 unsigned int is_pcie:1;
>> 193 int cached_capabilities[PCI_CAP_LIST_NR_ENTRIES]; /* See pci_find_capability_cached */
>> 194 pci_dev_flags_t dev_flags;
>> 195 atomic_t enable_cnt; /* pci_enable_device has been called */
>> 196
561 u32 saved_config_space[16] 197 u32 saved_config_space[16]; /* config space saved at suspend time */
>> 198 struct hlist_head saved_cap_space;
562 struct bin_attribute *rom_attr; /* att 199 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
563 int rom_attr_enabled; /* has 200 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
564 struct bin_attribute *res_attr[DEVICE_ 201 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
565 #ifdef CONFIG_PCI_NAMES !! 202 #ifdef CONFIG_PCI_MSI
566 #define PCI_NAME_SIZE 96 !! 203 struct list_head msi_list;
567 #define PCI_NAME_HALF __stringify(43) /* les <<
568 char pretty_name[PCI_NAME_S <<
569 #endif 204 #endif
570 }; 205 };
571 206
>> 207 extern struct pci_dev *alloc_pci_dev(void);
>> 208
572 #define pci_dev_g(n) list_entry(n, struct pci_ 209 #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
573 #define pci_dev_b(n) list_entry(n, struct pci_ 210 #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
574 #define to_pci_dev(n) container_of(n, struct p 211 #define to_pci_dev(n) container_of(n, struct pci_dev, dev)
575 #define for_each_pci_dev(d) while ((d = pci_ge 212 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
576 213
>> 214 static inline int pci_channel_offline(struct pci_dev *pdev)
>> 215 {
>> 216 return (pdev->error_state != pci_channel_io_normal);
>> 217 }
>> 218
>> 219 static inline struct pci_cap_saved_state *pci_find_saved_cap(
>> 220 struct pci_dev *pci_dev, char cap)
>> 221 {
>> 222 struct pci_cap_saved_state *tmp;
>> 223 struct hlist_node *pos;
>> 224
>> 225 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
>> 226 if (tmp->cap_nr == cap)
>> 227 return tmp;
>> 228 }
>> 229 return NULL;
>> 230 }
>> 231
>> 232 static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
>> 233 struct pci_cap_saved_state *new_cap)
>> 234 {
>> 235 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
>> 236 }
>> 237
577 /* 238 /*
578 * For PCI devices, the region numbers are as 239 * For PCI devices, the region numbers are assigned this way:
579 * 240 *
580 * 0-5 standard PCI regions 241 * 0-5 standard PCI regions
581 * 6 expansion ROM 242 * 6 expansion ROM
582 * 7-10 bridges: address space assigne 243 * 7-10 bridges: address space assigned to buses behind the bridge
583 */ 244 */
584 245
585 #define PCI_ROM_RESOURCE 6 !! 246 #define PCI_ROM_RESOURCE 6
586 #define PCI_BRIDGE_RESOURCES 7 !! 247 #define PCI_BRIDGE_RESOURCES 7
587 #define PCI_NUM_RESOURCES 11 !! 248 #define PCI_NUM_RESOURCES 11
588 249
589 #ifndef PCI_BUS_NUM_RESOURCES 250 #ifndef PCI_BUS_NUM_RESOURCES
590 #define PCI_BUS_NUM_RESOURCES 4 !! 251 #define PCI_BUS_NUM_RESOURCES 8
591 #endif 252 #endif
592 !! 253
593 #define PCI_REGION_FLAG_MASK 0x0fU /* The !! 254 #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
594 255
595 struct pci_bus { 256 struct pci_bus {
596 struct list_head node; /* nod 257 struct list_head node; /* node in list of buses */
597 struct pci_bus *parent; /* par 258 struct pci_bus *parent; /* parent bus this bridge is on */
598 struct list_head children; /* lis 259 struct list_head children; /* list of child buses */
599 struct list_head devices; /* lis 260 struct list_head devices; /* list of devices on this bus */
600 struct pci_dev *self; /* bri 261 struct pci_dev *self; /* bridge device as seen by parent */
601 struct resource *resource[PCI_BUS_NUM_ 262 struct resource *resource[PCI_BUS_NUM_RESOURCES];
602 /* add 263 /* address space routed to this bus */
603 264
604 struct pci_ops *ops; /* con 265 struct pci_ops *ops; /* configuration access functions */
605 void *sysdata; /* hoo 266 void *sysdata; /* hook for sys-specific extension */
606 struct proc_dir_entry *procdir; /* dir 267 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
607 268
608 unsigned char number; /* bus 269 unsigned char number; /* bus number */
609 unsigned char primary; /* num 270 unsigned char primary; /* number of primary bridge */
610 unsigned char secondary; /* num 271 unsigned char secondary; /* number of secondary bridge */
611 unsigned char subordinate; /* max 272 unsigned char subordinate; /* max number of subordinate buses */
612 273
613 char name[48]; 274 char name[48];
614 275
615 unsigned short bridge_ctl; /* man 276 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
616 unsigned short pad2; !! 277 pci_bus_flags_t bus_flags; /* Inherited by child busses */
617 struct device *bridge; 278 struct device *bridge;
618 struct class_device class_dev; !! 279 struct device dev;
619 struct bin_attribute *legacy_io; /* 280 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
620 struct bin_attribute *legacy_mem; / 281 struct bin_attribute *legacy_mem; /* legacy mem */
>> 282 unsigned int is_added:1;
621 }; 283 };
622 284
623 #define pci_bus_b(n) list_entry(n, struct p 285 #define pci_bus_b(n) list_entry(n, struct pci_bus, node)
624 #define to_pci_bus(n) container_of(n, struct !! 286 #define to_pci_bus(n) container_of(n, struct pci_bus, dev)
625 287
626 /* 288 /*
627 * Error values that may be returned by PCI fu 289 * Error values that may be returned by PCI functions.
628 */ 290 */
629 #define PCIBIOS_SUCCESSFUL 0x00 291 #define PCIBIOS_SUCCESSFUL 0x00
630 #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81 292 #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81
631 #define PCIBIOS_BAD_VENDOR_ID 0x83 293 #define PCIBIOS_BAD_VENDOR_ID 0x83
632 #define PCIBIOS_DEVICE_NOT_FOUND 0x86 294 #define PCIBIOS_DEVICE_NOT_FOUND 0x86
633 #define PCIBIOS_BAD_REGISTER_NUMBER 0x87 295 #define PCIBIOS_BAD_REGISTER_NUMBER 0x87
634 #define PCIBIOS_SET_FAILED 0x88 296 #define PCIBIOS_SET_FAILED 0x88
635 #define PCIBIOS_BUFFER_TOO_SMALL 0x89 297 #define PCIBIOS_BUFFER_TOO_SMALL 0x89
636 298
637 /* Low-level architecture-dependent routines * 299 /* Low-level architecture-dependent routines */
638 300
639 struct pci_ops { 301 struct pci_ops {
640 int (*read)(struct pci_bus *bus, unsig 302 int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
641 int (*write)(struct pci_bus *bus, unsi 303 int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
642 }; 304 };
643 305
644 struct pci_raw_ops { !! 306 /*
645 int (*read)(int dom, int bus, int devf !! 307 * ACPI needs to be able to access PCI config space before we've done a
646 int (*write)(int dom, int bus, int dev !! 308 * PCI bus scan and created pci_bus structures.
647 }; !! 309 */
648 !! 310 extern int raw_pci_read(unsigned int domain, unsigned int bus,
649 extern struct pci_raw_ops *raw_pci_ops; !! 311 unsigned int devfn, int reg, int len, u32 *val);
>> 312 extern int raw_pci_write(unsigned int domain, unsigned int bus,
>> 313 unsigned int devfn, int reg, int len, u32 val);
650 314
651 struct pci_bus_region { 315 struct pci_bus_region {
652 unsigned long start; !! 316 resource_size_t start;
653 unsigned long end; !! 317 resource_size_t end;
654 }; 318 };
655 319
656 struct pci_dynids { 320 struct pci_dynids {
657 spinlock_t lock; /* protect 321 spinlock_t lock; /* protects list, index */
658 struct list_head list; /* for IDs 322 struct list_head list; /* for IDs added at runtime */
659 unsigned int use_driver_data:1; /* pci 323 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
660 }; 324 };
661 325
>> 326 /* ---------------------------------------------------------------- */
>> 327 /** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
>> 328 * a set of callbacks in struct pci_error_handlers, then that device driver
>> 329 * will be notified of PCI bus errors, and will be driven to recovery
>> 330 * when an error occurs.
>> 331 */
>> 332
>> 333 typedef unsigned int __bitwise pci_ers_result_t;
>> 334
>> 335 enum pci_ers_result {
>> 336 /* no result/none/not supported in device driver */
>> 337 PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1,
>> 338
>> 339 /* Device driver can recover without slot reset */
>> 340 PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2,
>> 341
>> 342 /* Device driver wants slot to be reset. */
>> 343 PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3,
>> 344
>> 345 /* Device has completely failed, is unrecoverable */
>> 346 PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4,
>> 347
>> 348 /* Device driver is fully recovered and operational */
>> 349 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
>> 350 };
>> 351
>> 352 /* PCI bus error event callbacks */
>> 353 struct pci_error_handlers {
>> 354 /* PCI bus error detected on this device */
>> 355 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
>> 356 enum pci_channel_state error);
>> 357
>> 358 /* MMIO has been re-enabled, but not DMA */
>> 359 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
>> 360
>> 361 /* PCI Express link has been reset */
>> 362 pci_ers_result_t (*link_reset)(struct pci_dev *dev);
>> 363
>> 364 /* PCI slot has been reset */
>> 365 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
>> 366
>> 367 /* Device driver may resume normal operations */
>> 368 void (*resume)(struct pci_dev *dev);
>> 369 };
>> 370
>> 371 /* ---------------------------------------------------------------- */
>> 372
662 struct module; 373 struct module;
663 struct pci_driver { 374 struct pci_driver {
664 struct list_head node; 375 struct list_head node;
665 char *name; 376 char *name;
666 struct module *owner; <<
667 const struct pci_device_id *id_table; 377 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
668 int (*probe) (struct pci_dev *dev, c 378 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
669 void (*remove) (struct pci_dev *dev); 379 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
670 int (*suspend) (struct pci_dev *dev, 380 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
>> 381 int (*suspend_late) (struct pci_dev *dev, pm_message_t state);
>> 382 int (*resume_early) (struct pci_dev *dev);
671 int (*resume) (struct pci_dev *dev); 383 int (*resume) (struct pci_dev *dev); /* Device woken up */
672 int (*enable_wake) (struct pci_dev *d !! 384 void (*shutdown) (struct pci_dev *dev);
673 385
>> 386 struct pci_error_handlers *err_handler;
674 struct device_driver driver; 387 struct device_driver driver;
675 struct pci_dynids dynids; 388 struct pci_dynids dynids;
676 }; 389 };
677 390
678 #define to_pci_driver(drv) container_of(drv,st !! 391 #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
>> 392
>> 393 /**
>> 394 * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table
>> 395 * @_table: device table name
>> 396 *
>> 397 * This macro is used to create a struct pci_device_id array (a device table)
>> 398 * in a generic manner.
>> 399 */
>> 400 #define DEFINE_PCI_DEVICE_TABLE(_table) \
>> 401 const struct pci_device_id _table[] __devinitconst
679 402
680 /** 403 /**
681 * PCI_DEVICE - macro used to describe a speci 404 * PCI_DEVICE - macro used to describe a specific pci device
682 * @vend: the 16 bit PCI Vendor ID 405 * @vend: the 16 bit PCI Vendor ID
683 * @dev: the 16 bit PCI Device ID 406 * @dev: the 16 bit PCI Device ID
684 * 407 *
685 * This macro is used to create a struct pci_d 408 * This macro is used to create a struct pci_device_id that matches a
686 * specific device. The subvendor and subdevi 409 * specific device. The subvendor and subdevice fields will be set to
687 * PCI_ANY_ID. 410 * PCI_ANY_ID.
688 */ 411 */
689 #define PCI_DEVICE(vend,dev) \ 412 #define PCI_DEVICE(vend,dev) \
690 .vendor = (vend), .device = (dev), \ 413 .vendor = (vend), .device = (dev), \
691 .subvendor = PCI_ANY_ID, .subdevice = 414 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
692 415
693 /** 416 /**
694 * PCI_DEVICE_CLASS - macro used to describe a 417 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class
695 * @dev_class: the class, subclass, prog-if tr 418 * @dev_class: the class, subclass, prog-if triple for this device
696 * @dev_class_mask: the class mask for this de 419 * @dev_class_mask: the class mask for this device
697 * 420 *
698 * This macro is used to create a struct pci_d 421 * This macro is used to create a struct pci_device_id that matches a
699 * specific PCI class. The vendor, device, su !! 422 * specific PCI class. The vendor, device, subvendor, and subdevice
700 * fields will be set to PCI_ANY_ID. 423 * fields will be set to PCI_ANY_ID.
701 */ 424 */
702 #define PCI_DEVICE_CLASS(dev_class,dev_class_m 425 #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
703 .class = (dev_class), .class_mask = (d 426 .class = (dev_class), .class_mask = (dev_class_mask), \
704 .vendor = PCI_ANY_ID, .device = PCI_AN 427 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
705 .subvendor = PCI_ANY_ID, .subdevice = 428 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
706 429
707 /* !! 430 /**
708 * pci_module_init is obsolete, this stays her !! 431 * PCI_VDEVICE - macro used to describe a specific pci device in short form
709 * in the tree. !! 432 * @vend: the vendor name
>> 433 * @dev: the 16 bit PCI Device ID
>> 434 *
>> 435 * This macro is used to create a struct pci_device_id that matches a
>> 436 * specific PCI device. The subvendor, and subdevice fields will be set
>> 437 * to PCI_ANY_ID. The macro allows the next field to follow as the device
>> 438 * private data.
710 */ 439 */
711 #define pci_module_init pci_register_driver !! 440
>> 441 #define PCI_VDEVICE(vendor, device) \
>> 442 PCI_VENDOR_ID_##vendor, (device), \
>> 443 PCI_ANY_ID, PCI_ANY_ID, 0, 0
712 444
713 /* these external functions are only available 445 /* these external functions are only available when PCI support is enabled */
714 #ifdef CONFIG_PCI 446 #ifdef CONFIG_PCI
715 447
716 extern struct bus_type pci_bus_type; 448 extern struct bus_type pci_bus_type;
717 449
718 /* Do NOT directly access these two variables, 450 /* Do NOT directly access these two variables, unless you are arch specific pci
719 * code, or pci core code. */ 451 * code, or pci core code. */
720 extern struct list_head pci_root_buses; /* lis 452 extern struct list_head pci_root_buses; /* list of all known PCI buses */
721 extern struct list_head pci_devices; /* lis 453 extern struct list_head pci_devices; /* list of all devices */
>> 454 /* Some device drivers need know if pci is initiated */
>> 455 extern int no_pci_devices(void);
722 456
723 void pcibios_fixup_bus(struct pci_bus *); 457 void pcibios_fixup_bus(struct pci_bus *);
724 int pcibios_enable_device(struct pci_dev *, in !! 458 int __must_check pcibios_enable_device(struct pci_dev *, int mask);
725 char *pcibios_setup (char *str); !! 459 char *pcibios_setup(char *str);
726 460
727 /* Used only when drivers/pci/setup.c is used 461 /* Used only when drivers/pci/setup.c is used */
728 void pcibios_align_resource(void *, struct res !! 462 void pcibios_align_resource(void *, struct resource *, resource_size_t,
729 unsigned long, uns !! 463 resource_size_t);
730 void pcibios_update_irq(struct pci_dev *, int 464 void pcibios_update_irq(struct pci_dev *, int irq);
731 465
732 /* Generic PCI functions used internally */ 466 /* Generic PCI functions used internally */
733 467
734 extern struct pci_bus *pci_find_bus(int domain 468 extern struct pci_bus *pci_find_bus(int domain, int busnr);
735 struct pci_bus *pci_scan_bus_parented(struct d !! 469 void pci_bus_add_devices(struct pci_bus *bus);
736 static inline struct pci_bus *pci_scan_bus(int !! 470 struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
>> 471 struct pci_ops *ops, void *sysdata);
>> 472 static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
>> 473 void *sysdata)
737 { 474 {
738 return pci_scan_bus_parented(NULL, bus !! 475 struct pci_bus *root_bus;
>> 476 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
>> 477 if (root_bus)
>> 478 pci_bus_add_devices(root_bus);
>> 479 return root_bus;
739 } 480 }
>> 481 struct pci_bus *pci_create_bus(struct device *parent, int bus,
>> 482 struct pci_ops *ops, void *sysdata);
>> 483 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
>> 484 int busnr);
740 int pci_scan_slot(struct pci_bus *bus, int dev 485 int pci_scan_slot(struct pci_bus *bus, int devfn);
741 struct pci_dev * pci_scan_single_device(struct !! 486 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
>> 487 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
742 unsigned int pci_scan_child_bus(struct pci_bus 488 unsigned int pci_scan_child_bus(struct pci_bus *bus);
743 void pci_bus_add_device(struct pci_dev *dev); !! 489 int __must_check pci_bus_add_device(struct pci_dev *dev);
744 void pci_bus_add_devices(struct pci_bus *bus); <<
745 void pci_name_device(struct pci_dev *dev); <<
746 char *pci_class_name(u32 class); <<
747 void pci_read_bridge_bases(struct pci_bus *chi 490 void pci_read_bridge_bases(struct pci_bus *child);
748 struct resource *pci_find_parent_resource(cons !! 491 struct resource *pci_find_parent_resource(const struct pci_dev *dev,
>> 492 struct resource *res);
749 int pci_get_interrupt_pin(struct pci_dev *dev, 493 int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
750 extern struct pci_dev *pci_dev_get(struct pci_ 494 extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
751 extern void pci_dev_put(struct pci_dev *dev); 495 extern void pci_dev_put(struct pci_dev *dev);
752 extern void pci_remove_bus(struct pci_bus *b); 496 extern void pci_remove_bus(struct pci_bus *b);
753 extern void pci_remove_bus_device(struct pci_d 497 extern void pci_remove_bus_device(struct pci_dev *dev);
>> 498 extern void pci_stop_bus_device(struct pci_dev *dev);
>> 499 void pci_setup_cardbus(struct pci_bus *bus);
>> 500 extern void pci_sort_breadthfirst(void);
754 501
755 /* Generic PCI functions exported to card driv 502 /* Generic PCI functions exported to card drivers */
756 503
757 struct pci_dev *pci_find_device (unsigned int !! 504 #ifdef CONFIG_PCI_LEGACY
758 struct pci_dev *pci_find_device_reverse (unsig !! 505 struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
759 struct pci_dev *pci_find_slot (unsigned int bu !! 506 unsigned int device,
760 int pci_find_capability (struct pci_dev *dev, !! 507 const struct pci_dev *from);
761 int pci_find_ext_capability (struct pci_dev *d !! 508 struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
762 struct pci_bus * pci_find_next_bus(const struc !! 509 unsigned int devfn);
>> 510 #endif /* CONFIG_PCI_LEGACY */
>> 511
>> 512 int pci_find_capability(struct pci_dev *dev, int cap);
>> 513 int pci_find_capability_cached(struct pci_dev *dev, int cap);
>> 514 int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
>> 515 int pci_find_ext_capability(struct pci_dev *dev, int cap);
>> 516 int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
>> 517 int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
>> 518 struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
763 519
764 struct pci_dev *pci_get_device (unsigned int v !! 520 struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
765 struct pci_dev *pci_get_subsys (unsigned int v !! 521 struct pci_dev *from);
>> 522 struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
>> 523 struct pci_dev *from);
>> 524
>> 525 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
766 unsigned int s 526 unsigned int ss_vendor, unsigned int ss_device,
767 struct pci_dev 527 struct pci_dev *from);
768 struct pci_dev *pci_get_slot (struct pci_bus * !! 528 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
769 struct pci_dev *pci_get_class (unsigned int cl !! 529 struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
>> 530 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
770 int pci_dev_present(const struct pci_device_id 531 int pci_dev_present(const struct pci_device_id *ids);
>> 532 const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
771 533
772 int pci_bus_read_config_byte (struct pci_bus * !! 534 int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
773 int pci_bus_read_config_word (struct pci_bus * !! 535 int where, u8 *val);
774 int pci_bus_read_config_dword (struct pci_bus !! 536 int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn,
775 int pci_bus_write_config_byte (struct pci_bus !! 537 int where, u16 *val);
776 int pci_bus_write_config_word (struct pci_bus !! 538 int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn,
777 int pci_bus_write_config_dword (struct pci_bus !! 539 int where, u32 *val);
>> 540 int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn,
>> 541 int where, u8 val);
>> 542 int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn,
>> 543 int where, u16 val);
>> 544 int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
>> 545 int where, u32 val);
778 546
779 static inline int pci_read_config_byte(struct 547 static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
780 { 548 {
781 return pci_bus_read_config_byte (dev-> !! 549 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
782 } 550 }
783 static inline int pci_read_config_word(struct 551 static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
784 { 552 {
785 return pci_bus_read_config_word (dev-> !! 553 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
786 } 554 }
787 static inline int pci_read_config_dword(struct !! 555 static inline int pci_read_config_dword(struct pci_dev *dev, int where,
>> 556 u32 *val)
788 { 557 {
789 return pci_bus_read_config_dword (dev- !! 558 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
790 } 559 }
791 static inline int pci_write_config_byte(struct 560 static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val)
792 { 561 {
793 return pci_bus_write_config_byte (dev- !! 562 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
794 } 563 }
795 static inline int pci_write_config_word(struct 564 static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val)
796 { 565 {
797 return pci_bus_write_config_word (dev- !! 566 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
>> 567 }
>> 568 static inline int pci_write_config_dword(struct pci_dev *dev, int where,
>> 569 u32 val)
>> 570 {
>> 571 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
798 } 572 }
799 static inline int pci_write_config_dword(struc !! 573
>> 574 int __must_check pci_enable_device(struct pci_dev *dev);
>> 575 int __must_check pci_enable_device_io(struct pci_dev *dev);
>> 576 int __must_check pci_enable_device_mem(struct pci_dev *dev);
>> 577 int __must_check pci_reenable_device(struct pci_dev *);
>> 578 int __must_check pcim_enable_device(struct pci_dev *pdev);
>> 579 void pcim_pin_device(struct pci_dev *pdev);
>> 580
>> 581 static inline int pci_is_managed(struct pci_dev *pdev)
800 { 582 {
801 return pci_bus_write_config_dword (dev !! 583 return pdev->is_managed;
802 } 584 }
803 585
804 int pci_enable_device(struct pci_dev *dev); <<
805 int pci_enable_device_bars(struct pci_dev *dev <<
806 void pci_disable_device(struct pci_dev *dev); 586 void pci_disable_device(struct pci_dev *dev);
807 void pci_set_master(struct pci_dev *dev); 587 void pci_set_master(struct pci_dev *dev);
>> 588 int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
808 #define HAVE_PCI_SET_MWI 589 #define HAVE_PCI_SET_MWI
809 int pci_set_mwi(struct pci_dev *dev); !! 590 int __must_check pci_set_mwi(struct pci_dev *dev);
>> 591 int pci_try_set_mwi(struct pci_dev *dev);
810 void pci_clear_mwi(struct pci_dev *dev); 592 void pci_clear_mwi(struct pci_dev *dev);
>> 593 void pci_intx(struct pci_dev *dev, int enable);
>> 594 void pci_msi_off(struct pci_dev *dev);
811 int pci_set_dma_mask(struct pci_dev *dev, u64 595 int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
812 int pci_dac_set_dma_mask(struct pci_dev *dev, <<
813 int pci_set_consistent_dma_mask(struct pci_dev 596 int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
814 int pci_assign_resource(struct pci_dev *dev, i !! 597 int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
>> 598 int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
>> 599 int pcix_get_max_mmrbc(struct pci_dev *dev);
>> 600 int pcix_get_mmrbc(struct pci_dev *dev);
>> 601 int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
>> 602 int pcie_get_readrq(struct pci_dev *dev);
>> 603 int pcie_set_readrq(struct pci_dev *dev, int rq);
>> 604 void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
>> 605 int __must_check pci_assign_resource(struct pci_dev *dev, int i);
>> 606 int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
>> 607 int pci_select_bars(struct pci_dev *dev, unsigned long flags);
815 608
816 /* ROM control related routines */ 609 /* ROM control related routines */
817 void __iomem *pci_map_rom(struct pci_dev *pdev !! 610 void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
818 void __iomem *pci_map_rom_copy(struct pci_dev <<
819 void pci_unmap_rom(struct pci_dev *pdev, void 611 void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
820 void pci_remove_rom(struct pci_dev *pdev); !! 612 size_t pci_get_rom_size(void __iomem *rom, size_t size);
821 613
822 /* Power management related routines */ 614 /* Power management related routines */
823 int pci_save_state(struct pci_dev *dev); 615 int pci_save_state(struct pci_dev *dev);
824 int pci_restore_state(struct pci_dev *dev); 616 int pci_restore_state(struct pci_dev *dev);
825 int pci_set_power_state(struct pci_dev *dev, p 617 int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
826 pci_power_t pci_choose_state(struct pci_dev *d 618 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
827 int pci_enable_wake(struct pci_dev *dev, pci_p 619 int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
828 620
>> 621 /* Functions for PCI Hotplug drivers to use */
>> 622 int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
>> 623
829 /* Helper functions for low-level code (driver 624 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
830 void pci_bus_assign_resources(struct pci_bus * 625 void pci_bus_assign_resources(struct pci_bus *bus);
831 void pci_bus_size_bridges(struct pci_bus *bus) 626 void pci_bus_size_bridges(struct pci_bus *bus);
832 int pci_claim_resource(struct pci_dev *, int); 627 int pci_claim_resource(struct pci_dev *, int);
833 void pci_assign_unassigned_resources(void); 628 void pci_assign_unassigned_resources(void);
834 void pdev_enable_device(struct pci_dev *); 629 void pdev_enable_device(struct pci_dev *);
835 void pdev_sort_resources(struct pci_dev *, str 630 void pdev_sort_resources(struct pci_dev *, struct resource_list *);
836 void pci_fixup_irqs(u8 (*)(struct pci_dev *, u 631 void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
837 int (*)(struct pci_dev *, 632 int (*)(struct pci_dev *, u8, u8));
838 #define HAVE_PCI_REQ_REGIONS 2 633 #define HAVE_PCI_REQ_REGIONS 2
839 int pci_request_regions(struct pci_dev *, char !! 634 int __must_check pci_request_regions(struct pci_dev *, const char *);
840 void pci_release_regions(struct pci_dev *); 635 void pci_release_regions(struct pci_dev *);
841 int pci_request_region(struct pci_dev *, int, !! 636 int __must_check pci_request_region(struct pci_dev *, int, const char *);
842 void pci_release_region(struct pci_dev *, int) 637 void pci_release_region(struct pci_dev *, int);
>> 638 int pci_request_selected_regions(struct pci_dev *, int, const char *);
>> 639 void pci_release_selected_regions(struct pci_dev *, int);
843 640
844 /* drivers/pci/bus.c */ 641 /* drivers/pci/bus.c */
845 int pci_bus_alloc_resource(struct pci_bus *bus !! 642 int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
846 unsigned long size, !! 643 struct resource *res, resource_size_t size,
847 unsigned long min, !! 644 resource_size_t align, resource_size_t min,
848 void (*alignf)(void !! 645 unsigned int type_mask,
849 unsi !! 646 void (*alignf)(void *, struct resource *,
850 void *alignf_data); !! 647 resource_size_t, resource_size_t),
>> 648 void *alignf_data);
851 void pci_enable_bridges(struct pci_bus *bus); 649 void pci_enable_bridges(struct pci_bus *bus);
852 650
853 /* New-style probing supporting hot-pluggable !! 651 /* Proper probing supporting hot-pluggable devices */
854 int pci_register_driver(struct pci_driver *); !! 652 int __must_check __pci_register_driver(struct pci_driver *, struct module *,
855 void pci_unregister_driver(struct pci_driver * !! 653 const char *mod_name);
856 void pci_remove_behind_bridge(struct pci_dev * !! 654 static inline int __must_check pci_register_driver(struct pci_driver *driver)
857 struct pci_driver *pci_dev_driver(const struct !! 655 {
858 const struct pci_device_id *pci_match_device(c !! 656 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
859 int pci_scan_bridge(struct pci_bus *bus, struc !! 657 }
>> 658
>> 659 void pci_unregister_driver(struct pci_driver *dev);
>> 660 void pci_remove_behind_bridge(struct pci_dev *dev);
>> 661 struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
>> 662 const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
>> 663 struct pci_dev *dev);
>> 664 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
>> 665 int pass);
>> 666
>> 667 void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
>> 668 void *userdata);
>> 669 int pci_cfg_space_size(struct pci_dev *dev);
>> 670 unsigned char pci_bus_max_busnr(struct pci_bus *bus);
860 671
861 /* kmem_cache style wrapper around pci_alloc_c 672 /* kmem_cache style wrapper around pci_alloc_consistent() */
862 673
863 #include <linux/dmapool.h> 674 #include <linux/dmapool.h>
864 675
865 #define pci_pool dma_pool 676 #define pci_pool dma_pool
866 #define pci_pool_create(name, pdev, size, alig 677 #define pci_pool_create(name, pdev, size, align, allocation) \
867 dma_pool_create(name, &pdev->d 678 dma_pool_create(name, &pdev->dev, size, align, allocation)
868 #define pci_pool_destroy(pool) dma_pool_destro 679 #define pci_pool_destroy(pool) dma_pool_destroy(pool)
869 #define pci_pool_alloc(pool, flags, handle) dm 680 #define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
870 #define pci_pool_free(pool, vaddr, addr) dma_p 681 #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
871 682
872 #if defined(CONFIG_ISA) || defined(CONFIG_EISA !! 683 enum pci_dma_burst_strategy {
873 extern struct pci_dev *isa_bridge; !! 684 PCI_DMA_BURST_INFINITY, /* make bursts as large as possible,
874 #endif !! 685 strategy_parameter is N/A */
>> 686 PCI_DMA_BURST_BOUNDARY, /* disconnect at every strategy_parameter
>> 687 byte boundaries */
>> 688 PCI_DMA_BURST_MULTIPLE, /* disconnect at some multiple of
>> 689 strategy_parameter byte boundaries */
>> 690 };
875 691
876 struct msix_entry { 692 struct msix_entry {
877 u16 vector; /* kernel uses to writ 693 u16 vector; /* kernel uses to write allocated vector */
878 u16 entry; /* driver uses to spec 694 u16 entry; /* driver uses to specify entry, OS writes */
879 }; 695 };
880 696
>> 697
881 #ifndef CONFIG_PCI_MSI 698 #ifndef CONFIG_PCI_MSI
882 static inline void pci_scan_msi_device(struct !! 699 static inline int pci_enable_msi(struct pci_dev *dev)
883 static inline int pci_enable_msi(struct pci_de !! 700 {
884 static inline void pci_disable_msi(struct pci_ !! 701 return -1;
885 static inline int pci_enable_msix(struct pci_d !! 702 }
886 struct msix_entry *entries, int nvec) !! 703
887 static inline void pci_disable_msix(struct pci !! 704 static inline void pci_disable_msi(struct pci_dev *dev)
888 static inline void msi_remove_pci_irq_vectors( !! 705 { }
>> 706
>> 707 static inline int pci_enable_msix(struct pci_dev *dev,
>> 708 struct msix_entry *entries, int nvec)
>> 709 {
>> 710 return -1;
>> 711 }
>> 712
>> 713 static inline void pci_disable_msix(struct pci_dev *dev)
>> 714 { }
>> 715
>> 716 static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
>> 717 { }
>> 718
>> 719 static inline void pci_restore_msi_state(struct pci_dev *dev)
>> 720 { }
889 #else 721 #else
890 extern void pci_scan_msi_device(struct pci_dev <<
891 extern int pci_enable_msi(struct pci_dev *dev) 722 extern int pci_enable_msi(struct pci_dev *dev);
892 extern void pci_disable_msi(struct pci_dev *de 723 extern void pci_disable_msi(struct pci_dev *dev);
893 extern int pci_enable_msix(struct pci_dev* dev !! 724 extern int pci_enable_msix(struct pci_dev *dev,
894 struct msix_entry *entries, int nvec); 725 struct msix_entry *entries, int nvec);
895 extern void pci_disable_msix(struct pci_dev *d 726 extern void pci_disable_msix(struct pci_dev *dev);
896 extern void msi_remove_pci_irq_vectors(struct 727 extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
>> 728 extern void pci_restore_msi_state(struct pci_dev *dev);
897 #endif 729 #endif
898 730
899 #endif /* CONFIG_PCI */ !! 731 #ifdef CONFIG_HT_IRQ
>> 732 /* The functions a driver should call */
>> 733 int ht_create_irq(struct pci_dev *dev, int idx);
>> 734 void ht_destroy_irq(unsigned int irq);
>> 735 #endif /* CONFIG_HT_IRQ */
900 736
901 /* Include architecture-dependent settings and !! 737 extern void pci_block_user_cfg_access(struct pci_dev *dev);
>> 738 extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
902 739
903 #include <asm/pci.h> !! 740 /*
>> 741 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
>> 742 * a PCI domain is defined to be a set of PCI busses which share
>> 743 * configuration space.
>> 744 */
>> 745 #ifdef CONFIG_PCI_DOMAINS
>> 746 extern int pci_domains_supported;
>> 747 #else
>> 748 enum { pci_domains_supported = 0 };
>> 749 static inline int pci_domain_nr(struct pci_bus *bus)
>> 750 {
>> 751 return 0;
>> 752 }
>> 753
>> 754 static inline int pci_proc_domain(struct pci_bus *bus)
>> 755 {
>> 756 return 0;
>> 757 }
>> 758 #endif /* CONFIG_PCI_DOMAINS */
>> 759
>> 760 #else /* CONFIG_PCI is not enabled */
904 761
905 /* 762 /*
906 * If the system does not have PCI, clearly t 763 * If the system does not have PCI, clearly these return errors. Define
907 * these as simple inline functions to avoid 764 * these as simple inline functions to avoid hair in drivers.
908 */ 765 */
909 766
910 #ifndef CONFIG_PCI !! 767 #define _PCI_NOP(o, s, t) \
911 #define _PCI_NOP(o,s,t) \ !! 768 static inline int pci_##o##_config_##s(struct pci_dev *dev, \
912 static inline int pci_##o##_config_##s !! 769 int where, t val) \
913 { return PCIBIOS_FUNC_NOT_SUPP 770 { return PCIBIOS_FUNC_NOT_SUPPORTED; }
914 #define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byt !! 771
915 _PCI_NOP(o,wor !! 772 #define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \
916 _PCI_NOP(o,dwo !! 773 _PCI_NOP(o, word, u16 x) \
>> 774 _PCI_NOP(o, dword, u32 x)
917 _PCI_NOP_ALL(read, *) 775 _PCI_NOP_ALL(read, *)
918 _PCI_NOP_ALL(write,) 776 _PCI_NOP_ALL(write,)
919 777
920 static inline struct pci_dev *pci_find_device( !! 778 static inline struct pci_dev *pci_find_device(unsigned int vendor,
921 { return NULL; } !! 779 unsigned int device,
>> 780 const struct pci_dev *from)
>> 781 {
>> 782 return NULL;
>> 783 }
922 784
923 static inline struct pci_dev *pci_find_slot(un !! 785 static inline struct pci_dev *pci_find_slot(unsigned int bus,
924 { return NULL; } !! 786 unsigned int devfn)
>> 787 {
>> 788 return NULL;
>> 789 }
925 790
926 static inline struct pci_dev *pci_get_device ( !! 791 static inline struct pci_dev *pci_get_device(unsigned int vendor,
927 { return NULL; } !! 792 unsigned int device,
>> 793 struct pci_dev *from)
>> 794 {
>> 795 return NULL;
>> 796 }
928 797
929 static inline struct pci_dev *pci_get_subsys ( !! 798 static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
930 unsigned int ss_vendor, unsigned int ss_device !! 799 unsigned int device,
931 { return NULL; } !! 800 struct pci_dev *from)
>> 801 {
>> 802 return NULL;
>> 803 }
932 804
933 static inline struct pci_dev *pci_get_class(un !! 805 static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
934 { return NULL; } !! 806 unsigned int device,
>> 807 unsigned int ss_vendor,
>> 808 unsigned int ss_device,
>> 809 struct pci_dev *from)
>> 810 {
>> 811 return NULL;
>> 812 }
>> 813
>> 814 static inline struct pci_dev *pci_get_class(unsigned int class,
>> 815 struct pci_dev *from)
>> 816 {
>> 817 return NULL;
>> 818 }
935 819
936 #define pci_dev_present(ids) (0) 820 #define pci_dev_present(ids) (0)
>> 821 #define no_pci_devices() (1)
>> 822 #define pci_find_present(ids) (NULL)
937 #define pci_dev_put(dev) do { } while ( 823 #define pci_dev_put(dev) do { } while (0)
938 824
939 static inline void pci_set_master(struct pci_d !! 825 static inline void pci_set_master(struct pci_dev *dev)
940 static inline int pci_enable_device(struct pci !! 826 { }
941 static inline void pci_disable_device(struct p !! 827
942 static inline int pci_set_dma_mask(struct pci_ !! 828 static inline int pci_enable_device(struct pci_dev *dev)
943 static inline int pci_dac_set_dma_mask(struct !! 829 {
944 static inline int pci_assign_resource(struct p !! 830 return -EIO;
945 static inline int pci_register_driver(struct p !! 831 }
946 static inline void pci_unregister_driver(struc !! 832
947 static inline int pci_find_capability (struct !! 833 static inline void pci_disable_device(struct pci_dev *dev)
948 static inline int pci_find_ext_capability (str !! 834 { }
949 static inline const struct pci_device_id *pci_ !! 835
>> 836 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
>> 837 {
>> 838 return -EIO;
>> 839 }
>> 840
>> 841 static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
>> 842 unsigned int size)
>> 843 {
>> 844 return -EIO;
>> 845 }
>> 846
>> 847 static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
>> 848 unsigned long mask)
>> 849 {
>> 850 return -EIO;
>> 851 }
>> 852
>> 853 static inline int pci_assign_resource(struct pci_dev *dev, int i)
>> 854 {
>> 855 return -EBUSY;
>> 856 }
>> 857
>> 858 static inline int __pci_register_driver(struct pci_driver *drv,
>> 859 struct module *owner)
>> 860 {
>> 861 return 0;
>> 862 }
>> 863
>> 864 static inline int pci_register_driver(struct pci_driver *drv)
>> 865 {
>> 866 return 0;
>> 867 }
>> 868
>> 869 static inline void pci_unregister_driver(struct pci_driver *drv)
>> 870 { }
>> 871
>> 872 static inline int pci_find_capability(struct pci_dev *dev, int cap)
>> 873 {
>> 874 return 0;
>> 875 }
>> 876
>> 877 static inline int pci_find_capability_cached(struct pci_dev *dev, int cap) {
>> 878 return 0;
>> 879 }
>> 880
>> 881 static inline int pci_find_next_capability(struct pci_dev *dev, u8 post,
>> 882 int cap)
>> 883 {
>> 884 return 0;
>> 885 }
>> 886
>> 887 static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
>> 888 {
>> 889 return 0;
>> 890 }
950 891
951 /* Power management related routines */ 892 /* Power management related routines */
952 static inline int pci_save_state(struct pci_de !! 893 static inline int pci_save_state(struct pci_dev *dev)
953 static inline int pci_restore_state(struct pci !! 894 {
954 static inline int pci_set_power_state(struct p !! 895 return 0;
955 static inline pci_power_t pci_choose_state(str !! 896 }
956 static inline int pci_enable_wake(struct pci_d !! 897
>> 898 static inline int pci_restore_state(struct pci_dev *dev)
>> 899 {
>> 900 return 0;
>> 901 }
957 902
958 #define isa_bridge ((struct pci_dev *)NUL !! 903 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
>> 904 {
>> 905 return 0;
>> 906 }
959 907
960 #else !! 908 static inline pci_power_t pci_choose_state(struct pci_dev *dev,
>> 909 pm_message_t state)
>> 910 {
>> 911 return PCI_D0;
>> 912 }
961 913
962 /* !! 914 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
963 * PCI domain support. Sometimes called PCI s !! 915 int enable)
964 * a PCI domain is defined to be a set of PCI <<
965 * configuration space. <<
966 */ <<
967 #ifndef CONFIG_PCI_DOMAINS <<
968 static inline int pci_domain_nr(struct pci_bus <<
969 static inline int pci_name_bus(char *name, str <<
970 { 916 {
971 sprintf(name, "%02x", bus->number); <<
972 return 0; 917 return 0;
973 } 918 }
974 #endif <<
975 919
976 #endif /* !CONFIG_PCI */ !! 920 static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
>> 921 {
>> 922 return -EIO;
>> 923 }
>> 924
>> 925 static inline void pci_release_regions(struct pci_dev *dev)
>> 926 { }
>> 927
>> 928 #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
>> 929
>> 930 static inline void pci_block_user_cfg_access(struct pci_dev *dev)
>> 931 { }
>> 932
>> 933 static inline void pci_unblock_user_cfg_access(struct pci_dev *dev)
>> 934 { }
>> 935
>> 936 static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
>> 937 { return NULL; }
>> 938
>> 939 static inline struct pci_dev *pci_get_slot(struct pci_bus *bus,
>> 940 unsigned int devfn)
>> 941 { return NULL; }
>> 942
>> 943 static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
>> 944 unsigned int devfn)
>> 945 { return NULL; }
>> 946
>> 947 #endif /* CONFIG_PCI */
>> 948
>> 949 /* Include architecture-dependent settings and functions */
>> 950
>> 951 #include <asm/pci.h>
977 952
978 /* these helpers provide future and backwards 953 /* these helpers provide future and backwards compatibility
979 * for accessing popular PCI BAR info */ 954 * for accessing popular PCI BAR info */
980 #define pci_resource_start(dev,bar) ((dev)-> !! 955 #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
981 #define pci_resource_end(dev,bar) ((dev)-> !! 956 #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
982 #define pci_resource_flags(dev,bar) ((dev)-> !! 957 #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
983 #define pci_resource_len(dev,bar) \ 958 #define pci_resource_len(dev,bar) \
984 ((pci_resource_start((dev),(bar)) == 0 !! 959 ((pci_resource_start((dev), (bar)) == 0 && \
985 pci_resource_end((dev),(bar)) == !! 960 pci_resource_end((dev), (bar)) == \
986 pci_resource_start((dev),(bar))) ? 0 !! 961 pci_resource_start((dev), (bar))) ? 0 : \
987 !! 962 \
988 (pci_resource_end((dev),(bar)) - !! 963 (pci_resource_end((dev), (bar)) - \
989 pci_resource_start((dev),(bar)) + 1) !! 964 pci_resource_start((dev), (bar)) + 1))
990 965
991 /* Similar to the helpers above, these manipul 966 /* Similar to the helpers above, these manipulate per-pci_dev
992 * driver-specific data. They are really just 967 * driver-specific data. They are really just a wrapper around
993 * the generic device structure functions of t 968 * the generic device structure functions of these calls.
994 */ 969 */
995 static inline void *pci_get_drvdata (struct pc !! 970 static inline void *pci_get_drvdata(struct pci_dev *pdev)
996 { 971 {
997 return dev_get_drvdata(&pdev->dev); 972 return dev_get_drvdata(&pdev->dev);
998 } 973 }
999 974
1000 static inline void pci_set_drvdata (struct pc !! 975 static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
1001 { 976 {
1002 dev_set_drvdata(&pdev->dev, data); 977 dev_set_drvdata(&pdev->dev, data);
1003 } 978 }
1004 979
1005 /* If you want to know what to call your pci_ 980 /* If you want to know what to call your pci_dev, ask this function.
1006 * Again, it's a wrapper around the generic d 981 * Again, it's a wrapper around the generic device.
1007 */ 982 */
1008 static inline char *pci_name(struct pci_dev * 983 static inline char *pci_name(struct pci_dev *pdev)
1009 { 984 {
1010 return pdev->dev.bus_id; 985 return pdev->dev.bus_id;
1011 } 986 }
1012 987
1013 /* Some archs want to see the pretty pci name !! 988
1014 #ifdef CONFIG_PCI_NAMES !! 989 /* Some archs don't want to expose struct resource to userland as-is
1015 #define pci_pretty_name(dev) ((dev)->pretty_n !! 990 * in sysfs and /proc
1016 #else !! 991 */
1017 #define pci_pretty_name(dev) "" !! 992 #ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
1018 #endif !! 993 static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
>> 994 const struct resource *rsrc, resource_size_t *start,
>> 995 resource_size_t *end)
>> 996 {
>> 997 *start = rsrc->start;
>> 998 *end = rsrc->end;
>> 999 }
>> 1000 #endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */
>> 1001
1019 1002
1020 /* 1003 /*
1021 * The world is not perfect and supplies us 1004 * The world is not perfect and supplies us with broken PCI devices.
1022 * For at least a part of these bugs we need 1005 * For at least a part of these bugs we need a work-around, so both
1023 * generic (drivers/pci/quirks.c) and per-ar 1006 * generic (drivers/pci/quirks.c) and per-architecture code can define
1024 * fixup hooks to be called for particular b 1007 * fixup hooks to be called for particular buggy devices.
1025 */ 1008 */
1026 1009
1027 struct pci_fixup { 1010 struct pci_fixup {
1028 u16 vendor, device; /* You can us 1011 u16 vendor, device; /* You can use PCI_ANY_ID here of course */
1029 void (*hook)(struct pci_dev *dev); 1012 void (*hook)(struct pci_dev *dev);
1030 }; 1013 };
1031 1014
1032 enum pci_fixup_pass { 1015 enum pci_fixup_pass {
1033 pci_fixup_early, /* Before pro 1016 pci_fixup_early, /* Before probing BARs */
1034 pci_fixup_header, /* After read 1017 pci_fixup_header, /* After reading configuration header */
1035 pci_fixup_final, /* Final phas 1018 pci_fixup_final, /* Final phase of device fixups */
1036 pci_fixup_enable, /* pci_enable 1019 pci_fixup_enable, /* pci_enable_device() time */
>> 1020 pci_fixup_resume, /* pci_enable_device() time */
1037 }; 1021 };
1038 1022
1039 /* Anonymous variables would be nice... */ 1023 /* Anonymous variables would be nice... */
1040 #define DECLARE_PCI_FIXUP_SECTION(section, na 1024 #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
1041 static struct pci_fixup __pci_fixup_# !! 1025 static const struct pci_fixup __pci_fixup_##name __used \
1042 __attribute__((__section__(#section)) 1026 __attribute__((__section__(#section))) = { vendor, device, hook };
1043 #define DECLARE_PCI_FIXUP_EARLY(vendor, devic 1027 #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1044 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_ 1028 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1045 vendor##device##hook, 1029 vendor##device##hook, vendor, device, hook)
1046 #define DECLARE_PCI_FIXUP_HEADER(vendor, devi 1030 #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \
1047 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_ 1031 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1048 vendor##device##hook, 1032 vendor##device##hook, vendor, device, hook)
1049 #define DECLARE_PCI_FIXUP_FINAL(vendor, devic 1033 #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
1050 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_ 1034 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1051 vendor##device##hook, 1035 vendor##device##hook, vendor, device, hook)
1052 #define DECLARE_PCI_FIXUP_ENABLE(vendor, devi 1036 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
1053 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_ 1037 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1054 vendor##device##hook, 1038 vendor##device##hook, vendor, device, hook)
>> 1039 #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
>> 1040 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
>> 1041 resume##vendor##device##hook, vendor, device, hook)
1055 1042
1056 1043
1057 void pci_fixup_device(enum pci_fixup_pass pas 1044 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1058 1045
>> 1046 void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
>> 1047 void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
>> 1048 void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
>> 1049 int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
>> 1050 int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask,
>> 1051 const char *name);
>> 1052 void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
>> 1053
1059 extern int pci_pci_problems; 1054 extern int pci_pci_problems;
1060 #define PCIPCI_FAIL 1 !! 1055 #define PCIPCI_FAIL 1 /* No PCI PCI DMA */
1061 #define PCIPCI_TRITON 2 1056 #define PCIPCI_TRITON 2
1062 #define PCIPCI_NATOMA 4 1057 #define PCIPCI_NATOMA 4
1063 #define PCIPCI_VIAETBF 8 1058 #define PCIPCI_VIAETBF 8
1064 #define PCIPCI_VSFX 16 1059 #define PCIPCI_VSFX 16
1065 #define PCIPCI_ALIMAGIK 32 !! 1060 #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */
>> 1061 #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */
>> 1062
>> 1063 extern unsigned long pci_cardbus_io_size;
>> 1064 extern unsigned long pci_cardbus_mem_size;
>> 1065
>> 1066 extern int pcibios_add_platform_entries(struct pci_dev *dev);
1066 1067
1067 #endif /* __KERNEL__ */ 1068 #endif /* __KERNEL__ */
1068 #endif /* LINUX_PCI_H */ 1069 #endif /* LINUX_PCI_H */
1069 1070
|
This page was automatically generated by the
LXR engine.
|