]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PciCf8Lib.h
2 Provides services to access PCI Configuration Space using the I/O ports 0xCF8 and 0xCFC.
4 This library is identical to the PCI Library, except the access method for performing PCI
5 configuration cycles must be through I/O ports 0xCF8 and 0xCFC. This library only allows
6 access to PCI Segment #0.
8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #ifndef __PCI_CF8_LIB_H__
14 #define __PCI_CF8_LIB_H__
17 Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an
18 address that can be passed to the PCI Library functions.
20 Computes an address that is compatible with the PCI Library functions. The
21 unused upper bits of Bus, Device, Function and Register are stripped prior to
22 the generation of the address.
24 @param Bus PCI Bus number. Range 0..255.
25 @param Device PCI Device number. Range 0..31.
26 @param Function PCI Function number. Range 0..7.
27 @param Register PCI Register number. Range 0..255.
29 @return The encode PCI address.
32 #define PCI_CF8_LIB_ADDRESS(Bus, Device, Function, Offset) \
33 (((Offset) & 0xfff) | (((Function) & 0x07) << 12) | (((Device) & 0x1f) << 15) | (((Bus) & 0xff) << 20))
36 Registers a PCI device so PCI configuration registers may be accessed after
37 SetVirtualAddressMap().
39 Registers the PCI device specified by Address so all the PCI configuration registers
40 associated with that PCI device may be accessed after SetVirtualAddressMap() is called.
42 If Address > 0x0FFFFFFF, then ASSERT().
43 If the register specified by Address >= 0x100, then ASSERT().
45 @param Address Address that encodes the PCI Bus, Device, Function and
48 @retval RETURN_SUCCESS The PCI device was registered for runtime access.
49 @retval RETURN_UNSUPPORTED An attempt was made to call this function
50 after ExitBootServices().
51 @retval RETURN_UNSUPPORTED The resources required to access the PCI device
52 at runtime could not be mapped.
53 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
54 complete the registration.
59 PciCf8RegisterForRuntimeAccess (
64 Reads an 8-bit PCI configuration register.
66 Reads and returns the 8-bit PCI configuration register specified by Address.
67 This function must guarantee that all PCI read and write operations are
70 If Address > 0x0FFFFFFF, then ASSERT().
71 If the register specified by Address >= 0x100, then ASSERT().
73 @param Address Address that encodes the PCI Bus, Device, Function and
76 @return The read value from the PCI configuration register.
86 Writes an 8-bit PCI configuration register.
88 Writes the 8-bit PCI configuration register specified by Address with the
89 value specified by Value. Value is returned. This function must guarantee
90 that all PCI read and write operations are serialized.
92 If Address > 0x0FFFFFFF, then ASSERT().
93 If the register specified by Address >= 0x100, then ASSERT().
95 @param Address Address that encodes the PCI Bus, Device, Function and
97 @param Value The value to write.
99 @return The value written to the PCI configuration register.
110 Performs a bitwise OR of an 8-bit PCI configuration register with
113 Reads the 8-bit PCI configuration register specified by Address, performs a
114 bitwise OR between the read result and the value specified by
115 OrData, and writes the result to the 8-bit PCI configuration register
116 specified by Address. The value written to the PCI configuration register is
117 returned. This function must guarantee that all PCI read and write operations
120 If Address > 0x0FFFFFFF, then ASSERT().
121 If the register specified by Address >= 0x100, then ASSERT().
123 @param Address Address that encodes the PCI Bus, Device, Function and
125 @param OrData The value to OR with the PCI configuration register.
127 @return The value written back to the PCI configuration register.
138 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
141 Reads the 8-bit PCI configuration register specified by Address, performs a
142 bitwise AND between the read result and the value specified by AndData, and
143 writes the result to the 8-bit PCI configuration register specified by
144 Address. The value written to the PCI configuration register is returned.
145 This function must guarantee that all PCI read and write operations are
148 If Address > 0x0FFFFFFF, then ASSERT().
149 If the register specified by Address >= 0x100, then ASSERT().
151 @param Address Address that encodes the PCI Bus, Device, Function and
153 @param AndData The value to AND with the PCI configuration register.
155 @return The value written back to the PCI configuration register.
166 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
167 value, followed a bitwise OR with another 8-bit value.
169 Reads the 8-bit PCI configuration register specified by Address, performs a
170 bitwise AND between the read result and the value specified by AndData,
171 performs a bitwise OR between the result of the AND operation and
172 the value specified by OrData, and writes the result to the 8-bit PCI
173 configuration register specified by Address. The value written to the PCI
174 configuration register is returned. This function must guarantee that all PCI
175 read and write operations are serialized.
177 If Address > 0x0FFFFFFF, then ASSERT().
178 If the register specified by Address >= 0x100, then ASSERT().
180 @param Address Address that encodes the PCI Bus, Device, Function and
182 @param AndData The value to AND with the PCI configuration register.
183 @param OrData The value to OR with the result of the AND operation.
185 @return The value written back to the PCI configuration register.
197 Reads a bit field of a PCI configuration register.
199 Reads the bit field in an 8-bit PCI configuration register. The bit field is
200 specified by the StartBit and the EndBit. The value of the bit field is
203 If Address > 0x0FFFFFFF, then ASSERT().
204 If the register specified by Address >= 0x100, then ASSERT().
205 If StartBit is greater than 7, then ASSERT().
206 If EndBit is greater than 7, then ASSERT().
207 If EndBit is less than StartBit, then ASSERT().
209 @param Address PCI configuration register to read.
210 @param StartBit The ordinal of the least significant bit in the bit field.
212 @param EndBit The ordinal of the most significant bit in the bit field.
215 @return The value of the bit field read from the PCI configuration register.
220 PciCf8BitFieldRead8 (
227 Writes a bit field to a PCI configuration register.
229 Writes Value to the bit field of the PCI configuration register. The bit
230 field is specified by the StartBit and the EndBit. All other bits in the
231 destination PCI configuration register are preserved. The new value of the
232 8-bit register is returned.
234 If Address > 0x0FFFFFFF, then ASSERT().
235 If the register specified by Address >= 0x100, then ASSERT().
236 If StartBit is greater than 7, then ASSERT().
237 If EndBit is greater than 7, then ASSERT().
238 If EndBit is less than StartBit, then ASSERT().
239 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
241 @param Address PCI configuration register to write.
242 @param StartBit The ordinal of the least significant bit in the bit field.
244 @param EndBit The ordinal of the most significant bit in the bit field.
246 @param Value New value of the bit field.
248 @return The value written back to the PCI configuration register.
253 PciCf8BitFieldWrite8 (
261 Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and
262 writes the result back to the bit field in the 8-bit port.
264 Reads the 8-bit PCI configuration register specified by Address, performs a
265 bitwise OR between the read result and the value specified by
266 OrData, and writes the result to the 8-bit PCI configuration register
267 specified by Address. The value written to the PCI configuration register is
268 returned. This function must guarantee that all PCI read and write operations
269 are serialized. Extra left bits in OrData are stripped.
271 If Address > 0x0FFFFFFF, then ASSERT().
272 If the register specified by Address >= 0x100, then ASSERT().
273 If StartBit is greater than 7, then ASSERT().
274 If EndBit is greater than 7, then ASSERT().
275 If EndBit is less than StartBit, then ASSERT().
276 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
278 @param Address PCI configuration register to write.
279 @param StartBit The ordinal of the least significant bit in the bit field.
281 @param EndBit The ordinal of the most significant bit in the bit field.
283 @param OrData The value to OR with the PCI configuration register.
285 @return The value written back to the PCI configuration register.
298 Reads a bit field in an 8-bit PCI configuration register, performs a bitwise
299 AND, and writes the result back to the bit field in the 8-bit register.
301 Reads the 8-bit PCI configuration register specified by Address, performs a
302 bitwise AND between the read result and the value specified by AndData, and
303 writes the result to the 8-bit PCI configuration register specified by
304 Address. The value written to the PCI configuration register is returned.
305 This function must guarantee that all PCI read and write operations are
306 serialized. Extra left bits in AndData are stripped.
308 If Address > 0x0FFFFFFF, then ASSERT().
309 If the register specified by Address >= 0x100, then ASSERT().
310 If StartBit is greater than 7, then ASSERT().
311 If EndBit is greater than 7, then ASSERT().
312 If EndBit is less than StartBit, then ASSERT().
313 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
315 @param Address PCI configuration register to write.
316 @param StartBit The ordinal of the least significant bit in the bit field.
318 @param EndBit The ordinal of the most significant bit in the bit field.
320 @param AndData The value to AND with the PCI configuration register.
322 @return The value written back to the PCI configuration register.
335 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
336 bitwise OR, and writes the result back to the bit field in the
339 Reads the 8-bit PCI configuration register specified by Address, performs a
340 bitwise AND followed by a bitwise OR between the read result and
341 the value specified by AndData, and writes the result to the 8-bit PCI
342 configuration register specified by Address. The value written to the PCI
343 configuration register is returned. This function must guarantee that all PCI
344 read and write operations are serialized. Extra left bits in both AndData and
347 If Address > 0x0FFFFFFF, then ASSERT().
348 If the register specified by Address >= 0x100, then ASSERT().
349 If StartBit is greater than 7, then ASSERT().
350 If EndBit is greater than 7, then ASSERT().
351 If EndBit is less than StartBit, then ASSERT().
352 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
353 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
355 @param Address PCI configuration register to write.
356 @param StartBit The ordinal of the least significant bit in the bit field.
358 @param EndBit The ordinal of the most significant bit in the bit field.
360 @param AndData The value to AND with the PCI configuration register.
361 @param OrData The value to OR with the result of the AND operation.
363 @return The value written back to the PCI configuration register.
368 PciCf8BitFieldAndThenOr8 (
377 Reads a 16-bit PCI configuration register.
379 Reads and returns the 16-bit PCI configuration register specified by Address.
380 This function must guarantee that all PCI read and write operations are
383 If Address > 0x0FFFFFFF, then ASSERT().
384 If Address is not aligned on a 16-bit boundary, then ASSERT().
385 If the register specified by Address >= 0x100, then ASSERT().
387 @param Address Address that encodes the PCI Bus, Device, Function and
390 @return The read value from the PCI configuration register.
400 Writes a 16-bit PCI configuration register.
402 Writes the 16-bit PCI configuration register specified by Address with the
403 value specified by Value. Value is returned. This function must guarantee
404 that all PCI read and write operations are serialized.
406 If Address > 0x0FFFFFFF, then ASSERT().
407 If Address is not aligned on a 16-bit boundary, then ASSERT().
408 If the register specified by Address >= 0x100, then ASSERT().
410 @param Address Address that encodes the PCI Bus, Device, Function and
412 @param Value The value to write.
414 @return The value written to the PCI configuration register.
425 Performs a bitwise OR of a 16-bit PCI configuration register with
428 Reads the 16-bit PCI configuration register specified by Address, performs a
429 bitwise OR between the read result and the value specified by
430 OrData, and writes the result to the 16-bit PCI configuration register
431 specified by Address. The value written to the PCI configuration register is
432 returned. This function must guarantee that all PCI read and write operations
435 If Address > 0x0FFFFFFF, then ASSERT().
436 If Address is not aligned on a 16-bit boundary, then ASSERT().
437 If the register specified by Address >= 0x100, then ASSERT().
439 @param Address Address that encodes the PCI Bus, Device, Function and
441 @param OrData The value to OR with the PCI configuration register.
443 @return The value written back to the PCI configuration register.
454 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
457 Reads the 16-bit PCI configuration register specified by Address, performs a
458 bitwise AND between the read result and the value specified by AndData, and
459 writes the result to the 16-bit PCI configuration register specified by
460 Address. The value written to the PCI configuration register is returned.
461 This function must guarantee that all PCI read and write operations are
464 If Address > 0x0FFFFFFF, then ASSERT().
465 If Address is not aligned on a 16-bit boundary, then ASSERT().
466 If the register specified by Address >= 0x100, then ASSERT().
468 @param Address Address that encodes the PCI Bus, Device, Function and
470 @param AndData The value to AND with the PCI configuration register.
472 @return The value written back to the PCI configuration register.
483 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
484 value, followed a bitwise OR with another 16-bit value.
486 Reads the 16-bit PCI configuration register specified by Address, performs a
487 bitwise AND between the read result and the value specified by AndData,
488 performs a bitwise OR between the result of the AND operation and
489 the value specified by OrData, and writes the result to the 16-bit PCI
490 configuration register specified by Address. The value written to the PCI
491 configuration register is returned. This function must guarantee that all PCI
492 read and write operations are serialized.
494 If Address > 0x0FFFFFFF, then ASSERT().
495 If Address is not aligned on a 16-bit boundary, then ASSERT().
496 If the register specified by Address >= 0x100, then ASSERT().
498 @param Address Address that encodes the PCI Bus, Device, Function and
500 @param AndData The value to AND with the PCI configuration register.
501 @param OrData The value to OR with the result of the AND operation.
503 @return The value written back to the PCI configuration register.
515 Reads a bit field of a PCI configuration register.
517 Reads the bit field in a 16-bit PCI configuration register. The bit field is
518 specified by the StartBit and the EndBit. The value of the bit field is
521 If Address > 0x0FFFFFFF, then ASSERT().
522 If Address is not aligned on a 16-bit boundary, then ASSERT().
523 If the register specified by Address >= 0x100, then ASSERT().
524 If StartBit is greater than 15, then ASSERT().
525 If EndBit is greater than 15, then ASSERT().
526 If EndBit is less than StartBit, then ASSERT().
528 @param Address PCI configuration register to read.
529 @param StartBit The ordinal of the least significant bit in the bit field.
531 @param EndBit The ordinal of the most significant bit in the bit field.
534 @return The value of the bit field read from the PCI configuration register.
539 PciCf8BitFieldRead16 (
546 Writes a bit field to a PCI configuration register.
548 Writes Value to the bit field of the PCI configuration register. The bit
549 field is specified by the StartBit and the EndBit. All other bits in the
550 destination PCI configuration register are preserved. The new value of the
551 16-bit register is returned.
553 If Address > 0x0FFFFFFF, then ASSERT().
554 If Address is not aligned on a 16-bit boundary, then ASSERT().
555 If the register specified by Address >= 0x100, then ASSERT().
556 If StartBit is greater than 15, then ASSERT().
557 If EndBit is greater than 15, then ASSERT().
558 If EndBit is less than StartBit, then ASSERT().
559 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
561 @param Address PCI configuration register to write.
562 @param StartBit The ordinal of the least significant bit in the bit field.
564 @param EndBit The ordinal of the most significant bit in the bit field.
566 @param Value New value of the bit field.
568 @return The value written back to the PCI configuration register.
573 PciCf8BitFieldWrite16 (
581 Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and
582 writes the result back to the bit field in the 16-bit port.
584 Reads the 16-bit PCI configuration register specified by Address, performs a
585 bitwise OR between the read result and the value specified by
586 OrData, and writes the result to the 16-bit PCI configuration register
587 specified by Address. The value written to the PCI configuration register is
588 returned. This function must guarantee that all PCI read and write operations
589 are serialized. Extra left bits in OrData are stripped.
591 If Address > 0x0FFFFFFF, then ASSERT().
592 If Address is not aligned on a 16-bit boundary, then ASSERT().
593 If the register specified by Address >= 0x100, then ASSERT().
594 If StartBit is greater than 15, then ASSERT().
595 If EndBit is greater than 15, then ASSERT().
596 If EndBit is less than StartBit, then ASSERT().
597 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
599 @param Address PCI configuration register to write.
600 @param StartBit The ordinal of the least significant bit in the bit field.
602 @param EndBit The ordinal of the most significant bit in the bit field.
604 @param OrData The value to OR with the PCI configuration register.
606 @return The value written back to the PCI configuration register.
619 Reads a bit field in a 16-bit PCI configuration register, performs a bitwise
620 AND, and writes the result back to the bit field in the 16-bit register.
622 Reads the 16-bit PCI configuration register specified by Address, performs a
623 bitwise AND between the read result and the value specified by AndData, and
624 writes the result to the 16-bit PCI configuration register specified by
625 Address. The value written to the PCI configuration register is returned.
626 This function must guarantee that all PCI read and write operations are
627 serialized. Extra left bits in AndData are stripped.
629 If Address > 0x0FFFFFFF, then ASSERT().
630 If Address is not aligned on a 16-bit boundary, then ASSERT().
631 If the register specified by Address >= 0x100, then ASSERT().
632 If StartBit is greater than 15, then ASSERT().
633 If EndBit is greater than 15, then ASSERT().
634 If EndBit is less than StartBit, then ASSERT().
635 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
637 @param Address PCI configuration register to write.
638 @param StartBit The ordinal of the least significant bit in the bit field.
640 @param EndBit The ordinal of the most significant bit in the bit field.
642 @param AndData The value to AND with the PCI configuration register.
644 @return The value written back to the PCI configuration register.
649 PciCf8BitFieldAnd16 (
657 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
658 bitwise OR, and writes the result back to the bit field in the
661 Reads the 16-bit PCI configuration register specified by Address, performs a
662 bitwise AND followed by a bitwise OR between the read result and
663 the value specified by AndData, and writes the result to the 16-bit PCI
664 configuration register specified by Address. The value written to the PCI
665 configuration register is returned. This function must guarantee that all PCI
666 read and write operations are serialized. Extra left bits in both AndData and
669 If Address > 0x0FFFFFFF, then ASSERT().
670 If Address is not aligned on a 16-bit boundary, then ASSERT().
671 If the register specified by Address >= 0x100, then ASSERT().
672 If StartBit is greater than 15, then ASSERT().
673 If EndBit is greater than 15, then ASSERT().
674 If EndBit is less than StartBit, then ASSERT().
675 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
676 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
678 @param Address PCI configuration register to write.
679 @param StartBit The ordinal of the least significant bit in the bit field.
681 @param EndBit The ordinal of the most significant bit in the bit field.
683 @param AndData The value to AND with the PCI configuration register.
684 @param OrData The value to OR with the result of the AND operation.
686 @return The value written back to the PCI configuration register.
691 PciCf8BitFieldAndThenOr16 (
700 Reads a 32-bit PCI configuration register.
702 Reads and returns the 32-bit PCI configuration register specified by Address.
703 This function must guarantee that all PCI read and write operations are
706 If Address > 0x0FFFFFFF, then ASSERT().
707 If Address is not aligned on a 32-bit boundary, then ASSERT().
708 If the register specified by Address >= 0x100, then ASSERT().
710 @param Address Address that encodes the PCI Bus, Device, Function and
713 @return The read value from the PCI configuration register.
723 Writes a 32-bit PCI configuration register.
725 Writes the 32-bit PCI configuration register specified by Address with the
726 value specified by Value. Value is returned. This function must guarantee
727 that all PCI read and write operations are serialized.
729 If Address > 0x0FFFFFFF, then ASSERT().
730 If Address is not aligned on a 32-bit boundary, then ASSERT().
731 If the register specified by Address >= 0x100, then ASSERT().
733 @param Address Address that encodes the PCI Bus, Device, Function and
735 @param Value The value to write.
737 @return The value written to the PCI configuration register.
748 Performs a bitwise OR of a 32-bit PCI configuration register with
751 Reads the 32-bit PCI configuration register specified by Address, performs a
752 bitwise OR between the read result and the value specified by
753 OrData, and writes the result to the 32-bit PCI configuration register
754 specified by Address. The value written to the PCI configuration register is
755 returned. This function must guarantee that all PCI read and write operations
758 If Address > 0x0FFFFFFF, then ASSERT().
759 If Address is not aligned on a 32-bit boundary, then ASSERT().
760 If the register specified by Address >= 0x100, then ASSERT().
762 @param Address Address that encodes the PCI Bus, Device, Function and
764 @param OrData The value to OR with the PCI configuration register.
766 @return The value written back to the PCI configuration register.
777 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
780 Reads the 32-bit PCI configuration register specified by Address, performs a
781 bitwise AND between the read result and the value specified by AndData, and
782 writes the result to the 32-bit PCI configuration register specified by
783 Address. The value written to the PCI configuration register is returned.
784 This function must guarantee that all PCI read and write operations are
787 If Address > 0x0FFFFFFF, then ASSERT().
788 If Address is not aligned on a 32-bit boundary, then ASSERT().
789 If the register specified by Address >= 0x100, then ASSERT().
791 @param Address Address that encodes the PCI Bus, Device, Function and
793 @param AndData The value to AND with the PCI configuration register.
795 @return The value written back to the PCI configuration register.
806 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
807 value, followed a bitwise OR with another 32-bit value.
809 Reads the 32-bit PCI configuration register specified by Address, performs a
810 bitwise AND between the read result and the value specified by AndData,
811 performs a bitwise OR between the result of the AND operation and
812 the value specified by OrData, and writes the result to the 32-bit PCI
813 configuration register specified by Address. The value written to the PCI
814 configuration register is returned. This function must guarantee that all PCI
815 read and write operations are serialized.
817 If Address > 0x0FFFFFFF, then ASSERT().
818 If Address is not aligned on a 32-bit boundary, then ASSERT().
819 If the register specified by Address >= 0x100, then ASSERT().
821 @param Address Address that encodes the PCI Bus, Device, Function and
823 @param AndData The value to AND with the PCI configuration register.
824 @param OrData The value to OR with the result of the AND operation.
826 @return The value written back to the PCI configuration register.
838 Reads a bit field of a PCI configuration register.
840 Reads the bit field in a 32-bit PCI configuration register. The bit field is
841 specified by the StartBit and the EndBit. The value of the bit field is
844 If Address > 0x0FFFFFFF, then ASSERT().
845 If Address is not aligned on a 32-bit boundary, then ASSERT().
846 If the register specified by Address >= 0x100, then ASSERT().
847 If StartBit is greater than 31, then ASSERT().
848 If EndBit is greater than 31, then ASSERT().
849 If EndBit is less than StartBit, then ASSERT().
851 @param Address PCI configuration register to read.
852 @param StartBit The ordinal of the least significant bit in the bit field.
854 @param EndBit The ordinal of the most significant bit in the bit field.
857 @return The value of the bit field read from the PCI configuration register.
862 PciCf8BitFieldRead32 (
869 Writes a bit field to a PCI configuration register.
871 Writes Value to the bit field of the PCI configuration register. The bit
872 field is specified by the StartBit and the EndBit. All other bits in the
873 destination PCI configuration register are preserved. The new value of the
874 32-bit register is returned.
876 If Address > 0x0FFFFFFF, then ASSERT().
877 If Address is not aligned on a 32-bit boundary, then ASSERT().
878 If the register specified by Address >= 0x100, then ASSERT().
879 If StartBit is greater than 31, then ASSERT().
880 If EndBit is greater than 31, then ASSERT().
881 If EndBit is less than StartBit, then ASSERT().
882 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
884 @param Address PCI configuration register to write.
885 @param StartBit The ordinal of the least significant bit in the bit field.
887 @param EndBit The ordinal of the most significant bit in the bit field.
889 @param Value New value of the bit field.
891 @return The value written back to the PCI configuration register.
896 PciCf8BitFieldWrite32 (
904 Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and
905 writes the result back to the bit field in the 32-bit port.
907 Reads the 32-bit PCI configuration register specified by Address, performs a
908 bitwise OR between the read result and the value specified by
909 OrData, and writes the result to the 32-bit PCI configuration register
910 specified by Address. The value written to the PCI configuration register is
911 returned. This function must guarantee that all PCI read and write operations
912 are serialized. Extra left bits in OrData are stripped.
914 If Address > 0x0FFFFFFF, then ASSERT().
915 If Address is not aligned on a 32-bit boundary, then ASSERT().
916 If the register specified by Address >= 0x100, then ASSERT().
917 If StartBit is greater than 31, then ASSERT().
918 If EndBit is greater than 31, then ASSERT().
919 If EndBit is less than StartBit, then ASSERT().
920 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
922 @param Address PCI configuration register to write.
923 @param StartBit The ordinal of the least significant bit in the bit field.
925 @param EndBit The ordinal of the most significant bit in the bit field.
927 @param OrData The value to OR with the PCI configuration register.
929 @return The value written back to the PCI configuration register.
942 Reads a bit field in a 32-bit PCI configuration register, performs a bitwise
943 AND, and writes the result back to the bit field in the 32-bit register.
945 Reads the 32-bit PCI configuration register specified by Address, performs a
946 bitwise AND between the read result and the value specified by AndData, and
947 writes the result to the 32-bit PCI configuration register specified by
948 Address. The value written to the PCI configuration register is returned.
949 This function must guarantee that all PCI read and write operations are
950 serialized. Extra left bits in AndData are stripped.
952 If Address > 0x0FFFFFFF, then ASSERT().
953 If Address is not aligned on a 32-bit boundary, then ASSERT().
954 If the register specified by Address >= 0x100, then ASSERT().
955 If StartBit is greater than 31, then ASSERT().
956 If EndBit is greater than 31, then ASSERT().
957 If EndBit is less than StartBit, then ASSERT().
958 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
960 @param Address PCI configuration register to write.
961 @param StartBit The ordinal of the least significant bit in the bit field.
963 @param EndBit The ordinal of the most significant bit in the bit field.
965 @param AndData The value to AND with the PCI configuration register.
967 @return The value written back to the PCI configuration register.
972 PciCf8BitFieldAnd32 (
980 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
981 bitwise OR, and writes the result back to the bit field in the
984 Reads the 32-bit PCI configuration register specified by Address, performs a
985 bitwise AND followed by a bitwise OR between the read result and
986 the value specified by AndData, and writes the result to the 32-bit PCI
987 configuration register specified by Address. The value written to the PCI
988 configuration register is returned. This function must guarantee that all PCI
989 read and write operations are serialized. Extra left bits in both AndData and
992 If Address > 0x0FFFFFFF, then ASSERT().
993 If Address is not aligned on a 32-bit boundary, then ASSERT().
994 If the register specified by Address >= 0x100, then ASSERT().
995 If StartBit is greater than 31, then ASSERT().
996 If EndBit is greater than 31, then ASSERT().
997 If EndBit is less than StartBit, then ASSERT().
998 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
999 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1001 @param Address PCI configuration register to write.
1002 @param StartBit The ordinal of the least significant bit in the bit field.
1004 @param EndBit The ordinal of the most significant bit in the bit field.
1006 @param AndData The value to AND with the PCI configuration register.
1007 @param OrData The value to OR with the result of the AND operation.
1009 @return The value written back to the PCI configuration register.
1014 PciCf8BitFieldAndThenOr32 (
1023 Reads a range of PCI configuration registers into a caller supplied buffer.
1025 Reads the range of PCI configuration registers specified by StartAddress and
1026 Size into the buffer specified by Buffer. This function only allows the PCI
1027 configuration registers from a single PCI function to be read. Size is
1028 returned. When possible 32-bit PCI configuration read cycles are used to read
1029 from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
1030 and 16-bit PCI configuration read cycles may be used at the beginning and the
1033 If StartAddress > 0x0FFFFFFF, then ASSERT().
1034 If the register specified by StartAddress >= 0x100, then ASSERT().
1035 If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT().
1036 If Size > 0 and Buffer is NULL, then ASSERT().
1038 @param StartAddress Starting address that encodes the PCI Bus, Device,
1039 Function and Register.
1040 @param Size Size in bytes of the transfer.
1041 @param Buffer Pointer to a buffer receiving the data read.
1043 @return Size read from StartAddress.
1049 IN UINTN StartAddress
,
1055 Copies the data in a caller supplied buffer to a specified range of PCI
1056 configuration space.
1058 Writes the range of PCI configuration registers specified by StartAddress and
1059 Size from the buffer specified by Buffer. This function only allows the PCI
1060 configuration registers from a single PCI function to be written. Size is
1061 returned. When possible 32-bit PCI configuration write cycles are used to
1062 write from StartAddress to StartAddress + Size. Due to alignment restrictions,
1063 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
1064 and the end of the range.
1066 If StartAddress > 0x0FFFFFFF, then ASSERT().
1067 If the register specified by StartAddress >= 0x100, then ASSERT().
1068 If ((StartAddress & 0xFFF) + Size) > 0x100, then ASSERT().
1069 If Size > 0 and Buffer is NULL, then ASSERT().
1071 @param StartAddress Starting address that encodes the PCI Bus, Device,
1072 Function and Register.
1073 @param Size Size in bytes of the transfer.
1074 @param Buffer Pointer to a buffer containing the data to write.
1076 @return Size written to StartAddress.
1082 IN UINTN StartAddress
,