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