]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to access PCI Configuration Space.\r |
badcbfb2 | 3 | \r |
4 | These functions perform PCI configuration cycles using the default PCI configuration \r | |
5 | access method. This may use I/O ports 0xCF8 and 0xCFC to perform PCI configuration accesses, \r | |
6 | or it may use MMIO registers relative to the PcdPciExpressBaseAddress, or it may use some \r | |
7 | alternate access method. Modules will typically use the PCI Library for its PCI configuration \r | |
8 | accesses. However, if a module requires a mix of PCI access methods, the PCI CF8 Library or \r | |
9 | PCI Express Library may be used in conjunction with the PCI Library. The functionality of \r | |
10 | these three libraries is identical. The PCI CF8 Library and PCI Express Library simply use \r | |
11 | explicit access methods.\r | |
fb3df220 | 12 | \r |
94952554 | 13 | Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 14 | This program and the accompanying materials\r |
50a64e5b | 15 | are licensed and made available under the terms and conditions of the BSD License\r |
16 | which accompanies this distribution. The full text of the license may be found at\r | |
17 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 18 | \r |
50a64e5b | 19 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
20 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 21 | \r |
fb3df220 | 22 | **/\r |
23 | \r | |
24 | #ifndef __PCI_LIB_H__\r | |
25 | #define __PCI_LIB_H__\r | |
26 | \r | |
27 | /**\r | |
28 | Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an\r | |
29 | address that can be passed to the PCI Library functions.\r | |
30 | \r | |
31 | @param Bus PCI Bus number. Range 0..255.\r | |
32 | @param Device PCI Device number. Range 0..31.\r | |
33 | @param Function PCI Function number. Range 0..7.\r | |
34 | @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095\r | |
35 | for PCI Express.\r | |
36 | \r | |
37 | @return The encoded PCI address.\r | |
38 | \r | |
39 | **/\r | |
f754f721 | 40 | #define PCI_LIB_ADDRESS(Bus,Device,Function,Register) \\r |
41 | (((Register) & 0xfff) | (((Function) & 0x07) << 12) | (((Device) & 0x1f) << 15) | (((Bus) & 0xff) << 20))\r | |
fb3df220 | 42 | \r |
f926e538 | 43 | /**\r |
d11195a3 | 44 | Registers a PCI device so PCI configuration registers may be accessed after \r |
f926e538 | 45 | SetVirtualAddressMap().\r |
46 | \r | |
d11195a3 | 47 | Registers the PCI device specified by Address so all the PCI configuration registers \r |
48 | associated with that PCI device may be accessed after SetVirtualAddressMap() is called.\r | |
49 | \r | |
f926e538 | 50 | If Address > 0x0FFFFFFF, then ASSERT().\r |
51 | \r | |
52 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
53 | Register.\r | |
54 | \r | |
55 | @retval RETURN_SUCCESS The PCI device was registered for runtime access.\r | |
56 | @retval RETURN_UNSUPPORTED An attempt was made to call this function \r | |
57 | after ExitBootServices().\r | |
58 | @retval RETURN_UNSUPPORTED The resources required to access the PCI device\r | |
59 | at runtime could not be mapped.\r | |
60 | @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to\r | |
61 | complete the registration.\r | |
62 | \r | |
63 | **/\r | |
64 | RETURN_STATUS\r | |
65 | EFIAPI\r | |
66 | PciRegisterForRuntimeAccess (\r | |
67 | IN UINTN Address\r | |
68 | );\r | |
69 | \r | |
fb3df220 | 70 | /**\r |
71 | Reads an 8-bit PCI configuration register.\r | |
72 | \r | |
73 | Reads and returns the 8-bit PCI configuration register specified by Address.\r | |
74 | This function must guarantee that all PCI read and write operations are\r | |
75 | serialized.\r | |
76 | \r | |
77 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
78 | \r | |
79 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
80 | Register.\r | |
81 | \r | |
82 | @return The read value from the PCI configuration register.\r | |
83 | \r | |
84 | **/\r | |
85 | UINT8\r | |
86 | EFIAPI\r | |
87 | PciRead8 (\r | |
88 | IN UINTN Address\r | |
89 | );\r | |
90 | \r | |
91 | /**\r | |
92 | Writes an 8-bit PCI configuration register.\r | |
93 | \r | |
94 | Writes the 8-bit PCI configuration register specified by Address with the\r | |
95 | value specified by Value. Value is returned. This function must guarantee\r | |
96 | that all PCI read and write operations are serialized.\r | |
97 | \r | |
98 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
99 | \r | |
100 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
101 | Register.\r | |
102 | @param Value The value to write.\r | |
103 | \r | |
104 | @return The value written to the PCI configuration register.\r | |
105 | \r | |
106 | **/\r | |
107 | UINT8\r | |
108 | EFIAPI\r | |
109 | PciWrite8 (\r | |
110 | IN UINTN Address,\r | |
94646ec0 | 111 | IN UINT8 Value\r |
fb3df220 | 112 | );\r |
113 | \r | |
114 | /**\r | |
62991af2 | 115 | Performs a bitwise OR of an 8-bit PCI configuration register with\r |
fb3df220 | 116 | an 8-bit value.\r |
117 | \r | |
118 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 119 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 120 | OrData, and writes the result to the 8-bit PCI configuration register\r |
121 | specified by Address. The value written to the PCI configuration register is\r | |
122 | returned. This function must guarantee that all PCI read and write operations\r | |
123 | are serialized.\r | |
124 | \r | |
125 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
126 | \r | |
127 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
128 | Register.\r | |
129 | @param OrData The value to OR with the PCI configuration register.\r | |
130 | \r | |
131 | @return The value written back to the PCI configuration register.\r | |
132 | \r | |
133 | **/\r | |
134 | UINT8\r | |
135 | EFIAPI\r | |
136 | PciOr8 (\r | |
137 | IN UINTN Address,\r | |
138 | IN UINT8 OrData\r | |
139 | );\r | |
140 | \r | |
141 | /**\r | |
142 | Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit\r | |
143 | value.\r | |
144 | \r | |
145 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
146 | bitwise AND between the read result and the value specified by AndData, and\r | |
147 | writes the result to the 8-bit PCI configuration register specified by\r | |
148 | Address. The value written to the PCI configuration register is returned.\r | |
149 | This function must guarantee that all PCI read and write operations are\r | |
150 | serialized.\r | |
151 | \r | |
152 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
153 | \r | |
154 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
155 | Register.\r | |
156 | @param AndData The value to AND with the PCI configuration register.\r | |
157 | \r | |
158 | @return The value written back to the PCI configuration register.\r | |
159 | \r | |
160 | **/\r | |
161 | UINT8\r | |
162 | EFIAPI\r | |
163 | PciAnd8 (\r | |
164 | IN UINTN Address,\r | |
165 | IN UINT8 AndData\r | |
166 | );\r | |
167 | \r | |
168 | /**\r | |
169 | Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit\r | |
f754f721 | 170 | value, followed by a bitwise OR with another 8-bit value.\r |
fb3df220 | 171 | \r |
172 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
173 | bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 174 | performs a bitwise OR between the result of the AND operation and\r |
fb3df220 | 175 | the value specified by OrData, and writes the result to the 8-bit PCI\r |
176 | configuration register specified by Address. The value written to the PCI\r | |
177 | configuration register is returned. This function must guarantee that all PCI\r | |
178 | read and write operations are serialized.\r | |
179 | \r | |
180 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
181 | \r | |
182 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
183 | Register.\r | |
184 | @param AndData The value to AND with the PCI configuration register.\r | |
185 | @param OrData The value to OR with the result of the AND operation.\r | |
186 | \r | |
187 | @return The value written back to the PCI configuration register.\r | |
188 | \r | |
189 | **/\r | |
190 | UINT8\r | |
191 | EFIAPI\r | |
192 | PciAndThenOr8 (\r | |
193 | IN UINTN Address,\r | |
194 | IN UINT8 AndData,\r | |
195 | IN UINT8 OrData\r | |
196 | );\r | |
197 | \r | |
198 | /**\r | |
199 | Reads a bit field of a PCI configuration register.\r | |
200 | \r | |
201 | Reads the bit field in an 8-bit PCI configuration register. The bit field is\r | |
202 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
203 | returned.\r | |
204 | \r | |
205 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
206 | If StartBit is greater than 7, then ASSERT().\r | |
207 | If EndBit is greater than 7, then ASSERT().\r | |
208 | If EndBit is less than StartBit, then ASSERT().\r | |
209 | \r | |
210 | @param Address PCI configuration register to read.\r | |
211 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
212 | Range 0..7.\r | |
213 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
214 | Range 0..7.\r | |
215 | \r | |
216 | @return The value of the bit field read from the PCI configuration register.\r | |
217 | \r | |
218 | **/\r | |
219 | UINT8\r | |
220 | EFIAPI\r | |
221 | PciBitFieldRead8 (\r | |
222 | IN UINTN Address,\r | |
223 | IN UINTN StartBit,\r | |
224 | IN UINTN EndBit\r | |
225 | );\r | |
226 | \r | |
227 | /**\r | |
228 | Writes a bit field to a PCI configuration register.\r | |
229 | \r | |
230 | Writes Value to the bit field of the PCI configuration register. The bit\r | |
231 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
232 | destination PCI configuration register are preserved. The new value of the\r | |
233 | 8-bit register is returned.\r | |
234 | \r | |
235 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
236 | If StartBit is greater than 7, then ASSERT().\r | |
237 | If EndBit is greater than 7, then ASSERT().\r | |
238 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 239 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 240 | \r |
241 | @param Address PCI configuration register to write.\r | |
242 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
243 | Range 0..7.\r | |
244 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
245 | Range 0..7.\r | |
246 | @param Value New value of the bit field.\r | |
247 | \r | |
248 | @return The value written back to the PCI configuration register.\r | |
249 | \r | |
250 | **/\r | |
251 | UINT8\r | |
252 | EFIAPI\r | |
253 | PciBitFieldWrite8 (\r | |
254 | IN UINTN Address,\r | |
255 | IN UINTN StartBit,\r | |
256 | IN UINTN EndBit,\r | |
257 | IN UINT8 Value\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and\r | |
262 | writes the result back to the bit field in the 8-bit port.\r | |
263 | \r | |
264 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 265 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 266 | OrData, and writes the result to the 8-bit PCI configuration register\r |
267 | specified by Address. The value written to the PCI configuration register is\r | |
268 | returned. This function must guarantee that all PCI read and write operations\r | |
269 | are serialized. Extra left bits in OrData are stripped.\r | |
270 | \r | |
271 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
272 | If StartBit is greater than 7, then ASSERT().\r | |
273 | If EndBit is greater than 7, then ASSERT().\r | |
274 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 275 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 276 | \r |
277 | @param Address PCI configuration register to write.\r | |
278 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
279 | Range 0..7.\r | |
280 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
281 | Range 0..7.\r | |
282 | @param OrData The value to OR with the PCI configuration register.\r | |
283 | \r | |
284 | @return The value written back to the PCI configuration register.\r | |
285 | \r | |
286 | **/\r | |
287 | UINT8\r | |
288 | EFIAPI\r | |
289 | PciBitFieldOr8 (\r | |
290 | IN UINTN Address,\r | |
291 | IN UINTN StartBit,\r | |
292 | IN UINTN EndBit,\r | |
293 | IN UINT8 OrData\r | |
294 | );\r | |
295 | \r | |
296 | /**\r | |
297 | Reads a bit field in an 8-bit PCI configuration register, performs a bitwise\r | |
298 | AND, and writes the result back to the bit field in the 8-bit register.\r | |
299 | \r | |
300 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
301 | bitwise AND between the read result and the value specified by AndData, and\r | |
302 | writes the result to the 8-bit PCI configuration register specified by\r | |
303 | Address. The value written to the PCI configuration register is returned.\r | |
304 | This function must guarantee that all PCI read and write operations are\r | |
305 | serialized. Extra left bits in AndData are stripped.\r | |
306 | \r | |
307 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
308 | If StartBit is greater than 7, then ASSERT().\r | |
309 | If EndBit is greater than 7, then ASSERT().\r | |
310 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 311 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 312 | \r |
313 | @param Address PCI configuration register to write.\r | |
314 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
315 | Range 0..7.\r | |
316 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
317 | Range 0..7.\r | |
318 | @param AndData The value to AND with the PCI configuration register.\r | |
319 | \r | |
320 | @return The value written back to the PCI configuration register.\r | |
321 | \r | |
322 | **/\r | |
323 | UINT8\r | |
324 | EFIAPI\r | |
325 | PciBitFieldAnd8 (\r | |
326 | IN UINTN Address,\r | |
327 | IN UINTN StartBit,\r | |
328 | IN UINTN EndBit,\r | |
329 | IN UINT8 AndData\r | |
330 | );\r | |
331 | \r | |
332 | /**\r | |
333 | Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 334 | bitwise OR, and writes the result back to the bit field in the\r |
fb3df220 | 335 | 8-bit port.\r |
336 | \r | |
337 | Reads the 8-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 338 | bitwise AND followed by a bitwise OR between the read result and\r |
fb3df220 | 339 | the value specified by AndData, and writes the result to the 8-bit PCI\r |
340 | configuration register specified by Address. The value written to the PCI\r | |
341 | configuration register is returned. This function must guarantee that all PCI\r | |
342 | read and write operations are serialized. Extra left bits in both AndData and\r | |
343 | OrData are stripped.\r | |
344 | \r | |
345 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
346 | If StartBit is greater than 7, then ASSERT().\r | |
347 | If EndBit is greater than 7, then ASSERT().\r | |
348 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
349 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
350 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 351 | \r |
352 | @param Address PCI configuration register to write.\r | |
353 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
354 | Range 0..7.\r | |
355 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
356 | Range 0..7.\r | |
357 | @param AndData The value to AND with the PCI configuration register.\r | |
358 | @param OrData The value to OR with the result of the AND operation.\r | |
359 | \r | |
360 | @return The value written back to the PCI configuration register.\r | |
361 | \r | |
362 | **/\r | |
363 | UINT8\r | |
364 | EFIAPI\r | |
365 | PciBitFieldAndThenOr8 (\r | |
366 | IN UINTN Address,\r | |
367 | IN UINTN StartBit,\r | |
368 | IN UINTN EndBit,\r | |
369 | IN UINT8 AndData,\r | |
370 | IN UINT8 OrData\r | |
371 | );\r | |
372 | \r | |
373 | /**\r | |
374 | Reads a 16-bit PCI configuration register.\r | |
375 | \r | |
376 | Reads and returns the 16-bit PCI configuration register specified by Address.\r | |
377 | This function must guarantee that all PCI read and write operations are\r | |
378 | serialized.\r | |
379 | \r | |
380 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
381 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
382 | \r | |
383 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
384 | Register.\r | |
385 | \r | |
386 | @return The read value from the PCI configuration register.\r | |
387 | \r | |
388 | **/\r | |
389 | UINT16\r | |
390 | EFIAPI\r | |
391 | PciRead16 (\r | |
392 | IN UINTN Address\r | |
393 | );\r | |
394 | \r | |
395 | /**\r | |
396 | Writes a 16-bit PCI configuration register.\r | |
397 | \r | |
398 | Writes the 16-bit PCI configuration register specified by Address with the\r | |
399 | value specified by Value. Value is returned. This function must guarantee\r | |
400 | that all PCI read and write operations are serialized.\r | |
401 | \r | |
402 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
403 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
404 | \r | |
405 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
406 | Register.\r | |
407 | @param Value The value to write.\r | |
408 | \r | |
409 | @return The value written to the PCI configuration register.\r | |
410 | \r | |
411 | **/\r | |
412 | UINT16\r | |
413 | EFIAPI\r | |
414 | PciWrite16 (\r | |
415 | IN UINTN Address,\r | |
94646ec0 | 416 | IN UINT16 Value\r |
fb3df220 | 417 | );\r |
418 | \r | |
419 | /**\r | |
62991af2 | 420 | Performs a bitwise OR of a 16-bit PCI configuration register with\r |
fb3df220 | 421 | a 16-bit value.\r |
422 | \r | |
423 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 424 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 425 | OrData, and writes the result to the 16-bit PCI configuration register\r |
426 | specified by Address. The value written to the PCI configuration register is\r | |
427 | returned. This function must guarantee that all PCI read and write operations\r | |
428 | are serialized.\r | |
429 | \r | |
430 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
431 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
432 | \r | |
433 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
434 | Register.\r | |
435 | @param OrData The value to OR with the PCI configuration register.\r | |
436 | \r | |
437 | @return The value written back to the PCI configuration register.\r | |
438 | \r | |
439 | **/\r | |
440 | UINT16\r | |
441 | EFIAPI\r | |
442 | PciOr16 (\r | |
443 | IN UINTN Address,\r | |
444 | IN UINT16 OrData\r | |
445 | );\r | |
446 | \r | |
447 | /**\r | |
448 | Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit\r | |
449 | value.\r | |
450 | \r | |
451 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
452 | bitwise AND between the read result and the value specified by AndData, and\r | |
453 | writes the result to the 16-bit PCI configuration register specified by\r | |
454 | Address. The value written to the PCI configuration register is returned.\r | |
455 | This function must guarantee that all PCI read and write operations are\r | |
456 | serialized.\r | |
457 | \r | |
458 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
459 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
460 | \r | |
461 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
462 | Register.\r | |
463 | @param AndData The value to AND with the PCI configuration register.\r | |
464 | \r | |
465 | @return The value written back to the PCI configuration register.\r | |
466 | \r | |
467 | **/\r | |
468 | UINT16\r | |
469 | EFIAPI\r | |
470 | PciAnd16 (\r | |
471 | IN UINTN Address,\r | |
472 | IN UINT16 AndData\r | |
473 | );\r | |
474 | \r | |
475 | /**\r | |
476 | Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit\r | |
62991af2 | 477 | value, followed a bitwise OR with another 16-bit value.\r |
fb3df220 | 478 | \r |
479 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
480 | bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 481 | performs a bitwise OR between the result of the AND operation and\r |
fb3df220 | 482 | the value specified by OrData, and writes the result to the 16-bit PCI\r |
483 | configuration register specified by Address. The value written to the PCI\r | |
484 | configuration register is returned. This function must guarantee that all PCI\r | |
485 | read and write operations are serialized.\r | |
486 | \r | |
487 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
488 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
489 | \r | |
490 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
491 | Register.\r | |
492 | @param AndData The value to AND with the PCI configuration register.\r | |
493 | @param OrData The value to OR with the result of the AND operation.\r | |
494 | \r | |
495 | @return The value written back to the PCI configuration register.\r | |
496 | \r | |
497 | **/\r | |
498 | UINT16\r | |
499 | EFIAPI\r | |
500 | PciAndThenOr16 (\r | |
501 | IN UINTN Address,\r | |
502 | IN UINT16 AndData,\r | |
503 | IN UINT16 OrData\r | |
504 | );\r | |
505 | \r | |
506 | /**\r | |
507 | Reads a bit field of a PCI configuration register.\r | |
508 | \r | |
509 | Reads the bit field in a 16-bit PCI configuration register. The bit field is\r | |
510 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
511 | returned.\r | |
512 | \r | |
513 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
514 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
515 | If StartBit is greater than 15, then ASSERT().\r | |
516 | If EndBit is greater than 15, then ASSERT().\r | |
517 | If EndBit is less than StartBit, then ASSERT().\r | |
518 | \r | |
519 | @param Address PCI configuration register to read.\r | |
520 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
521 | Range 0..15.\r | |
522 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
523 | Range 0..15.\r | |
524 | \r | |
525 | @return The value of the bit field read from the PCI configuration register.\r | |
526 | \r | |
527 | **/\r | |
528 | UINT16\r | |
529 | EFIAPI\r | |
530 | PciBitFieldRead16 (\r | |
531 | IN UINTN Address,\r | |
532 | IN UINTN StartBit,\r | |
533 | IN UINTN EndBit\r | |
534 | );\r | |
535 | \r | |
536 | /**\r | |
537 | Writes a bit field to a PCI configuration register.\r | |
538 | \r | |
539 | Writes Value to the bit field of the PCI configuration register. The bit\r | |
540 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
541 | destination PCI configuration register are preserved. The new value of the\r | |
542 | 16-bit register is returned.\r | |
543 | \r | |
544 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
545 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
546 | If StartBit is greater than 15, then ASSERT().\r | |
547 | If EndBit is greater than 15, then ASSERT().\r | |
548 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 549 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 550 | \r |
551 | @param Address PCI configuration register to write.\r | |
552 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
553 | Range 0..15.\r | |
554 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
555 | Range 0..15.\r | |
556 | @param Value New value of the bit field.\r | |
557 | \r | |
558 | @return The value written back to the PCI configuration register.\r | |
559 | \r | |
560 | **/\r | |
561 | UINT16\r | |
562 | EFIAPI\r | |
563 | PciBitFieldWrite16 (\r | |
564 | IN UINTN Address,\r | |
565 | IN UINTN StartBit,\r | |
566 | IN UINTN EndBit,\r | |
567 | IN UINT16 Value\r | |
568 | );\r | |
569 | \r | |
570 | /**\r | |
571 | Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and\r | |
572 | writes the result back to the bit field in the 16-bit port.\r | |
573 | \r | |
574 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 575 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 576 | OrData, and writes the result to the 16-bit PCI configuration register\r |
577 | specified by Address. The value written to the PCI configuration register is\r | |
578 | returned. This function must guarantee that all PCI read and write operations\r | |
579 | are serialized. Extra left bits in OrData are stripped.\r | |
580 | \r | |
581 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
582 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
583 | If StartBit is greater than 15, then ASSERT().\r | |
584 | If EndBit is greater than 15, then ASSERT().\r | |
585 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 586 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 587 | \r |
588 | @param Address PCI configuration register to write.\r | |
589 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
590 | Range 0..15.\r | |
591 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
592 | Range 0..15.\r | |
593 | @param OrData The value to OR with the PCI configuration register.\r | |
594 | \r | |
595 | @return The value written back to the PCI configuration register.\r | |
596 | \r | |
597 | **/\r | |
598 | UINT16\r | |
599 | EFIAPI\r | |
600 | PciBitFieldOr16 (\r | |
601 | IN UINTN Address,\r | |
602 | IN UINTN StartBit,\r | |
603 | IN UINTN EndBit,\r | |
604 | IN UINT16 OrData\r | |
605 | );\r | |
606 | \r | |
607 | /**\r | |
608 | Reads a bit field in a 16-bit PCI configuration register, performs a bitwise\r | |
609 | AND, and writes the result back to the bit field in the 16-bit register.\r | |
610 | \r | |
611 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
612 | bitwise AND between the read result and the value specified by AndData, and\r | |
613 | writes the result to the 16-bit PCI configuration register specified by\r | |
614 | Address. The value written to the PCI configuration register is returned.\r | |
615 | This function must guarantee that all PCI read and write operations are\r | |
616 | serialized. Extra left bits in AndData are stripped.\r | |
617 | \r | |
618 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
619 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
620 | If StartBit is greater than 15, then ASSERT().\r | |
621 | If EndBit is greater than 15, then ASSERT().\r | |
622 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 623 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 624 | \r |
625 | @param Address PCI configuration register to write.\r | |
626 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
627 | Range 0..15.\r | |
628 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
629 | Range 0..15.\r | |
630 | @param AndData The value to AND with the PCI configuration register.\r | |
631 | \r | |
632 | @return The value written back to the PCI configuration register.\r | |
633 | \r | |
634 | **/\r | |
635 | UINT16\r | |
636 | EFIAPI\r | |
637 | PciBitFieldAnd16 (\r | |
638 | IN UINTN Address,\r | |
639 | IN UINTN StartBit,\r | |
640 | IN UINTN EndBit,\r | |
641 | IN UINT16 AndData\r | |
642 | );\r | |
643 | \r | |
644 | /**\r | |
645 | Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 646 | bitwise OR, and writes the result back to the bit field in the\r |
fb3df220 | 647 | 16-bit port.\r |
648 | \r | |
649 | Reads the 16-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 650 | bitwise AND followed by a bitwise OR between the read result and\r |
fb3df220 | 651 | the value specified by AndData, and writes the result to the 16-bit PCI\r |
652 | configuration register specified by Address. The value written to the PCI\r | |
653 | configuration register is returned. This function must guarantee that all PCI\r | |
654 | read and write operations are serialized. Extra left bits in both AndData and\r | |
655 | OrData are stripped.\r | |
656 | \r | |
657 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
658 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r | |
659 | If StartBit is greater than 15, then ASSERT().\r | |
660 | If EndBit is greater than 15, then ASSERT().\r | |
661 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
662 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
663 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 664 | \r |
665 | @param Address PCI configuration register to write.\r | |
666 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
667 | Range 0..15.\r | |
668 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
669 | Range 0..15.\r | |
670 | @param AndData The value to AND with the PCI configuration register.\r | |
671 | @param OrData The value to OR with the result of the AND operation.\r | |
672 | \r | |
673 | @return The value written back to the PCI configuration register.\r | |
674 | \r | |
675 | **/\r | |
676 | UINT16\r | |
677 | EFIAPI\r | |
678 | PciBitFieldAndThenOr16 (\r | |
679 | IN UINTN Address,\r | |
680 | IN UINTN StartBit,\r | |
681 | IN UINTN EndBit,\r | |
682 | IN UINT16 AndData,\r | |
683 | IN UINT16 OrData\r | |
684 | );\r | |
685 | \r | |
686 | /**\r | |
687 | Reads a 32-bit PCI configuration register.\r | |
688 | \r | |
689 | Reads and returns the 32-bit PCI configuration register specified by Address.\r | |
690 | This function must guarantee that all PCI read and write operations are\r | |
691 | serialized.\r | |
692 | \r | |
693 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
694 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
695 | \r | |
696 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
697 | Register.\r | |
698 | \r | |
699 | @return The read value from the PCI configuration register.\r | |
700 | \r | |
701 | **/\r | |
702 | UINT32\r | |
703 | EFIAPI\r | |
704 | PciRead32 (\r | |
705 | IN UINTN Address\r | |
706 | );\r | |
707 | \r | |
708 | /**\r | |
709 | Writes a 32-bit PCI configuration register.\r | |
710 | \r | |
711 | Writes the 32-bit PCI configuration register specified by Address with the\r | |
712 | value specified by Value. Value is returned. This function must guarantee\r | |
713 | that all PCI read and write operations are serialized.\r | |
714 | \r | |
715 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
716 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
717 | \r | |
718 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
719 | Register.\r | |
720 | @param Value The value to write.\r | |
721 | \r | |
722 | @return The value written to the PCI configuration register.\r | |
723 | \r | |
724 | **/\r | |
725 | UINT32\r | |
726 | EFIAPI\r | |
727 | PciWrite32 (\r | |
728 | IN UINTN Address,\r | |
94646ec0 | 729 | IN UINT32 Value\r |
fb3df220 | 730 | );\r |
731 | \r | |
732 | /**\r | |
62991af2 | 733 | Performs a bitwise OR of a 32-bit PCI configuration register with\r |
fb3df220 | 734 | a 32-bit value.\r |
735 | \r | |
736 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 737 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 738 | OrData, and writes the result to the 32-bit PCI configuration register\r |
739 | specified by Address. The value written to the PCI configuration register is\r | |
740 | returned. This function must guarantee that all PCI read and write operations\r | |
741 | are serialized.\r | |
742 | \r | |
743 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
744 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
745 | \r | |
746 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
747 | Register.\r | |
748 | @param OrData The value to OR with the PCI configuration register.\r | |
749 | \r | |
750 | @return The value written back to the PCI configuration register.\r | |
751 | \r | |
752 | **/\r | |
753 | UINT32\r | |
754 | EFIAPI\r | |
755 | PciOr32 (\r | |
756 | IN UINTN Address,\r | |
757 | IN UINT32 OrData\r | |
758 | );\r | |
759 | \r | |
760 | /**\r | |
761 | Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit\r | |
762 | value.\r | |
763 | \r | |
764 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
765 | bitwise AND between the read result and the value specified by AndData, and\r | |
766 | writes the result to the 32-bit PCI configuration register specified by\r | |
767 | Address. The value written to the PCI configuration register is returned.\r | |
768 | This function must guarantee that all PCI read and write operations are\r | |
769 | serialized.\r | |
770 | \r | |
771 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
772 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
773 | \r | |
774 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
775 | Register.\r | |
776 | @param AndData The value to AND with the PCI configuration register.\r | |
777 | \r | |
778 | @return The value written back to the PCI configuration register.\r | |
779 | \r | |
780 | **/\r | |
781 | UINT32\r | |
782 | EFIAPI\r | |
783 | PciAnd32 (\r | |
784 | IN UINTN Address,\r | |
785 | IN UINT32 AndData\r | |
786 | );\r | |
787 | \r | |
788 | /**\r | |
789 | Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit\r | |
62991af2 | 790 | value, followed a bitwise OR with another 32-bit value.\r |
fb3df220 | 791 | \r |
792 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
793 | bitwise AND between the read result and the value specified by AndData,\r | |
62991af2 | 794 | performs a bitwise OR between the result of the AND operation and\r |
fb3df220 | 795 | the value specified by OrData, and writes the result to the 32-bit PCI\r |
796 | configuration register specified by Address. The value written to the PCI\r | |
797 | configuration register is returned. This function must guarantee that all PCI\r | |
798 | read and write operations are serialized.\r | |
799 | \r | |
800 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
801 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
802 | \r | |
803 | @param Address Address that encodes the PCI Bus, Device, Function and\r | |
804 | Register.\r | |
805 | @param AndData The value to AND with the PCI configuration register.\r | |
806 | @param OrData The value to OR with the result of the AND operation.\r | |
807 | \r | |
808 | @return The value written back to the PCI configuration register.\r | |
809 | \r | |
810 | **/\r | |
811 | UINT32\r | |
812 | EFIAPI\r | |
813 | PciAndThenOr32 (\r | |
814 | IN UINTN Address,\r | |
815 | IN UINT32 AndData,\r | |
816 | IN UINT32 OrData\r | |
817 | );\r | |
818 | \r | |
819 | /**\r | |
820 | Reads a bit field of a PCI configuration register.\r | |
821 | \r | |
822 | Reads the bit field in a 32-bit PCI configuration register. The bit field is\r | |
823 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
824 | returned.\r | |
825 | \r | |
826 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
827 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
828 | If StartBit is greater than 31, then ASSERT().\r | |
829 | If EndBit is greater than 31, then ASSERT().\r | |
830 | If EndBit is less than StartBit, then ASSERT().\r | |
831 | \r | |
832 | @param Address PCI configuration register to read.\r | |
833 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
834 | Range 0..31.\r | |
835 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
836 | Range 0..31.\r | |
837 | \r | |
838 | @return The value of the bit field read from the PCI configuration register.\r | |
839 | \r | |
840 | **/\r | |
841 | UINT32\r | |
842 | EFIAPI\r | |
843 | PciBitFieldRead32 (\r | |
844 | IN UINTN Address,\r | |
845 | IN UINTN StartBit,\r | |
846 | IN UINTN EndBit\r | |
847 | );\r | |
848 | \r | |
849 | /**\r | |
850 | Writes a bit field to a PCI configuration register.\r | |
851 | \r | |
852 | Writes Value to the bit field of the PCI configuration register. The bit\r | |
853 | field is specified by the StartBit and the EndBit. All other bits in the\r | |
854 | destination PCI configuration register are preserved. The new value of the\r | |
855 | 32-bit register is returned.\r | |
856 | \r | |
857 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
858 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
859 | If StartBit is greater than 31, then ASSERT().\r | |
860 | If EndBit is greater than 31, then ASSERT().\r | |
861 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 862 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 863 | \r |
864 | @param Address PCI configuration register to write.\r | |
865 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
866 | Range 0..31.\r | |
867 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
868 | Range 0..31.\r | |
869 | @param Value New value of the bit field.\r | |
870 | \r | |
871 | @return The value written back to the PCI configuration register.\r | |
872 | \r | |
873 | **/\r | |
874 | UINT32\r | |
875 | EFIAPI\r | |
876 | PciBitFieldWrite32 (\r | |
877 | IN UINTN Address,\r | |
878 | IN UINTN StartBit,\r | |
879 | IN UINTN EndBit,\r | |
880 | IN UINT32 Value\r | |
881 | );\r | |
882 | \r | |
883 | /**\r | |
884 | Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and\r | |
885 | writes the result back to the bit field in the 32-bit port.\r | |
886 | \r | |
887 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 888 | bitwise OR between the read result and the value specified by\r |
fb3df220 | 889 | OrData, and writes the result to the 32-bit PCI configuration register\r |
890 | specified by Address. The value written to the PCI configuration register is\r | |
891 | returned. This function must guarantee that all PCI read and write operations\r | |
892 | are serialized. Extra left bits in OrData are stripped.\r | |
893 | \r | |
894 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
895 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
896 | If StartBit is greater than 31, then ASSERT().\r | |
897 | If EndBit is greater than 31, then ASSERT().\r | |
898 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 899 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 900 | \r |
901 | @param Address PCI configuration register to write.\r | |
902 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
903 | Range 0..31.\r | |
904 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
905 | Range 0..31.\r | |
906 | @param OrData The value to OR with the PCI configuration register.\r | |
907 | \r | |
908 | @return The value written back to the PCI configuration register.\r | |
909 | \r | |
910 | **/\r | |
911 | UINT32\r | |
912 | EFIAPI\r | |
913 | PciBitFieldOr32 (\r | |
914 | IN UINTN Address,\r | |
915 | IN UINTN StartBit,\r | |
916 | IN UINTN EndBit,\r | |
917 | IN UINT32 OrData\r | |
918 | );\r | |
919 | \r | |
920 | /**\r | |
921 | Reads a bit field in a 32-bit PCI configuration register, performs a bitwise\r | |
922 | AND, and writes the result back to the bit field in the 32-bit register.\r | |
923 | \r | |
924 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
925 | bitwise AND between the read result and the value specified by AndData, and\r | |
926 | writes the result to the 32-bit PCI configuration register specified by\r | |
927 | Address. The value written to the PCI configuration register is returned.\r | |
928 | This function must guarantee that all PCI read and write operations are\r | |
929 | serialized. Extra left bits in AndData are stripped.\r | |
930 | \r | |
931 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
932 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
933 | If StartBit is greater than 31, then ASSERT().\r | |
934 | If EndBit is greater than 31, then ASSERT().\r | |
935 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 936 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
fb3df220 | 937 | \r |
938 | @param Address PCI configuration register to write.\r | |
939 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
940 | Range 0..31.\r | |
941 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
942 | Range 0..31.\r | |
943 | @param AndData The value to AND with the PCI configuration register.\r | |
944 | \r | |
945 | @return The value written back to the PCI configuration register.\r | |
946 | \r | |
947 | **/\r | |
948 | UINT32\r | |
949 | EFIAPI\r | |
950 | PciBitFieldAnd32 (\r | |
951 | IN UINTN Address,\r | |
952 | IN UINTN StartBit,\r | |
953 | IN UINTN EndBit,\r | |
954 | IN UINT32 AndData\r | |
955 | );\r | |
956 | \r | |
957 | /**\r | |
958 | Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 959 | bitwise OR, and writes the result back to the bit field in the\r |
fb3df220 | 960 | 32-bit port.\r |
961 | \r | |
962 | Reads the 32-bit PCI configuration register specified by Address, performs a\r | |
62991af2 | 963 | bitwise AND followed by a bitwise OR between the read result and\r |
fb3df220 | 964 | the value specified by AndData, and writes the result to the 32-bit PCI\r |
965 | configuration register specified by Address. The value written to the PCI\r | |
966 | configuration register is returned. This function must guarantee that all PCI\r | |
967 | read and write operations are serialized. Extra left bits in both AndData and\r | |
968 | OrData are stripped.\r | |
969 | \r | |
970 | If Address > 0x0FFFFFFF, then ASSERT().\r | |
971 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r | |
972 | If StartBit is greater than 31, then ASSERT().\r | |
973 | If EndBit is greater than 31, then ASSERT().\r | |
974 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
975 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
976 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
fb3df220 | 977 | \r |
978 | @param Address PCI configuration register to write.\r | |
979 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
980 | Range 0..31.\r | |
981 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
982 | Range 0..31.\r | |
983 | @param AndData The value to AND with the PCI configuration register.\r | |
984 | @param OrData The value to OR with the result of the AND operation.\r | |
985 | \r | |
986 | @return The value written back to the PCI configuration register.\r | |
987 | \r | |
988 | **/\r | |
989 | UINT32\r | |
990 | EFIAPI\r | |
991 | PciBitFieldAndThenOr32 (\r | |
992 | IN UINTN Address,\r | |
993 | IN UINTN StartBit,\r | |
994 | IN UINTN EndBit,\r | |
995 | IN UINT32 AndData,\r | |
996 | IN UINT32 OrData\r | |
997 | );\r | |
998 | \r | |
999 | /**\r | |
1000 | Reads a range of PCI configuration registers into a caller supplied buffer.\r | |
1001 | \r | |
1002 | Reads the range of PCI configuration registers specified by StartAddress and\r | |
1003 | Size into the buffer specified by Buffer. This function only allows the PCI\r | |
1004 | configuration registers from a single PCI function to be read. Size is\r | |
1005 | returned. When possible 32-bit PCI configuration read cycles are used to read\r | |
1006 | from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit\r | |
1007 | and 16-bit PCI configuration read cycles may be used at the beginning and the\r | |
1008 | end of the range.\r | |
1009 | \r | |
1010 | If StartAddress > 0x0FFFFFFF, then ASSERT().\r | |
1011 | If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r | |
1012 | If Size > 0 and Buffer is NULL, then ASSERT().\r | |
1013 | \r | |
1014 | @param StartAddress Starting address that encodes the PCI Bus, Device,\r | |
1015 | Function and Register.\r | |
1016 | @param Size Size in bytes of the transfer.\r | |
1017 | @param Buffer Pointer to a buffer receiving the data read.\r | |
1018 | \r | |
1019 | @return Size\r | |
1020 | \r | |
1021 | **/\r | |
1022 | UINTN\r | |
1023 | EFIAPI\r | |
1024 | PciReadBuffer (\r | |
1025 | IN UINTN StartAddress,\r | |
1026 | IN UINTN Size,\r | |
1027 | OUT VOID *Buffer\r | |
1028 | );\r | |
1029 | \r | |
1030 | /**\r | |
1031 | Copies the data in a caller supplied buffer to a specified range of PCI\r | |
1032 | configuration space.\r | |
1033 | \r | |
1034 | Writes the range of PCI configuration registers specified by StartAddress and\r | |
1035 | Size from the buffer specified by Buffer. This function only allows the PCI\r | |
1036 | configuration registers from a single PCI function to be written. Size is\r | |
1037 | returned. When possible 32-bit PCI configuration write cycles are used to\r | |
1038 | write from StartAdress to StartAddress + Size. Due to alignment restrictions,\r | |
1039 | 8-bit and 16-bit PCI configuration write cycles may be used at the beginning\r | |
1040 | and the end of the range.\r | |
1041 | \r | |
1042 | If StartAddress > 0x0FFFFFFF, then ASSERT().\r | |
1043 | If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().\r | |
1044 | If Size > 0 and Buffer is NULL, then ASSERT().\r | |
1045 | \r | |
1046 | @param StartAddress Starting address that encodes the PCI Bus, Device,\r | |
1047 | Function and Register.\r | |
1048 | @param Size Size in bytes of the transfer.\r | |
1049 | @param Buffer Pointer to a buffer containing the data to write.\r | |
1050 | \r | |
9199040c | 1051 | @return Size written to StartAddress.\r |
fb3df220 | 1052 | \r |
1053 | **/\r | |
1054 | UINTN\r | |
1055 | EFIAPI\r | |
1056 | PciWriteBuffer (\r | |
1057 | IN UINTN StartAddress,\r | |
1058 | IN UINTN Size,\r | |
1059 | IN VOID *Buffer\r | |
1060 | );\r | |
1061 | \r | |
1062 | #endif\r |