]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PciExpressLib.h
2 Provides services to access PCI Configuration Space using the MMIO PCI Express window.
4 This library is identical to the PCI Library, except the access method for performing PCI
5 configuration cycles must be through the PCI Express MMIO window whose base address
6 is defined by PcdPciExpressBaseAddress and size defined by PcdPciExpressBaseSize.
9 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #ifndef __PCI_EXPRESS_LIB_H__
15 #define __PCI_EXPRESS_LIB_H__
17 #include <IndustryStandard/PciExpress21.h>
20 Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an
21 address that can be passed to the PCI Library functions.
23 Computes an address that is compatible with the PCI Library functions. The
24 unused upper bits of Bus, Device, Function and Register are stripped prior to
25 the generation of the address.
27 @param Bus PCI Bus number. Range 0..255.
28 @param Device PCI Device number. Range 0..31.
29 @param Function PCI Function number. Range 0..7.
30 @param Register PCI Register number. Range 0..4095.
32 @return The encode PCI address.
35 #define PCI_EXPRESS_LIB_ADDRESS(Bus, Device, Function, Offset) PCI_ECAM_ADDRESS ((Bus), (Device), (Function), (Offset))
38 Registers a PCI device so PCI configuration registers may be accessed after
39 SetVirtualAddressMap().
41 Registers the PCI device specified by Address so all the PCI configuration
42 registers associated with that PCI device may be accessed after SetVirtualAddressMap()
45 If Address > 0x0FFFFFFF, then ASSERT().
47 @param Address Address that encodes the PCI Bus, Device, Function and
50 @retval RETURN_SUCCESS The PCI device was registered for runtime access.
51 @retval RETURN_UNSUPPORTED An attempt was made to call this function
52 after ExitBootServices().
53 @retval RETURN_UNSUPPORTED The resources required to access the PCI device
54 at runtime could not be mapped.
55 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
56 complete the registration.
61 PciExpressRegisterForRuntimeAccess (
66 Reads an 8-bit PCI configuration register.
68 Reads and returns the 8-bit PCI configuration register specified by Address.
69 This function must guarantee that all PCI read and write operations are
72 If Address > 0x0FFFFFFF, then ASSERT().
74 @param Address Address that encodes the PCI Bus, Device, Function and
77 @return The read value from the PCI configuration register.
87 Writes an 8-bit PCI configuration register.
89 Writes the 8-bit PCI configuration register specified by Address with the
90 value specified by Value. Value is returned. This function must guarantee
91 that all PCI read and write operations are serialized.
93 If Address > 0x0FFFFFFF, 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().
122 @param Address Address that encodes the PCI Bus, Device, Function and
124 @param OrData The value to OR with the PCI configuration register.
126 @return The value written back to the PCI configuration register.
137 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
140 Reads the 8-bit PCI configuration register specified by Address, performs a
141 bitwise AND between the read result and the value specified by AndData, and
142 writes the result to the 8-bit PCI configuration register specified by
143 Address. The value written to the PCI configuration register is returned.
144 This function must guarantee that all PCI read and write operations are
147 If Address > 0x0FFFFFFF, then ASSERT().
149 @param Address Address that encodes the PCI Bus, Device, Function and
151 @param AndData The value to AND with the PCI configuration register.
153 @return The value written back to the PCI configuration register.
164 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit
165 value, followed a bitwise OR with another 8-bit value.
167 Reads the 8-bit PCI configuration register specified by Address, performs a
168 bitwise AND between the read result and the value specified by AndData,
169 performs a bitwise OR between the result of the AND operation and
170 the value specified by OrData, and writes the result to the 8-bit PCI
171 configuration register specified by Address. The value written to the PCI
172 configuration register is returned. This function must guarantee that all PCI
173 read and write operations are serialized.
175 If Address > 0x0FFFFFFF, then ASSERT().
177 @param Address Address that encodes the PCI Bus, Device, Function and
179 @param AndData The value to AND with the PCI configuration register.
180 @param OrData The value to OR with the result of the AND operation.
182 @return The value written back to the PCI configuration register.
187 PciExpressAndThenOr8 (
194 Reads a bit field of a PCI configuration register.
196 Reads the bit field in an 8-bit PCI configuration register. The bit field is
197 specified by the StartBit and the EndBit. The value of the bit field is
200 If Address > 0x0FFFFFFF, then ASSERT().
201 If StartBit is greater than 7, then ASSERT().
202 If EndBit is greater than 7, then ASSERT().
203 If EndBit is less than StartBit, then ASSERT().
205 @param Address PCI configuration register to read.
206 @param StartBit The ordinal of the least significant bit in the bit field.
208 @param EndBit The ordinal of the most significant bit in the bit field.
211 @return The value of the bit field read from the PCI configuration register.
216 PciExpressBitFieldRead8 (
223 Writes a bit field to a PCI configuration register.
225 Writes Value to the bit field of the PCI configuration register. The bit
226 field is specified by the StartBit and the EndBit. All other bits in the
227 destination PCI configuration register are preserved. The new value of the
228 8-bit register is returned.
230 If Address > 0x0FFFFFFF, then ASSERT().
231 If StartBit is greater than 7, then ASSERT().
232 If EndBit is greater than 7, then ASSERT().
233 If EndBit is less than StartBit, then ASSERT().
234 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
236 @param Address PCI configuration register to write.
237 @param StartBit The ordinal of the least significant bit in the bit field.
239 @param EndBit The ordinal of the most significant bit in the bit field.
241 @param Value New value of the bit field.
243 @return The value written back to the PCI configuration register.
248 PciExpressBitFieldWrite8 (
256 Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and
257 writes the result back to the bit field in the 8-bit port.
259 Reads the 8-bit PCI configuration register specified by Address, performs a
260 bitwise OR between the read result and the value specified by
261 OrData, and writes the result to the 8-bit PCI configuration register
262 specified by Address. The value written to the PCI configuration register is
263 returned. This function must guarantee that all PCI read and write operations
264 are serialized. Extra left bits in OrData are stripped.
266 If Address > 0x0FFFFFFF, then ASSERT().
267 If StartBit is greater than 7, then ASSERT().
268 If EndBit is greater than 7, then ASSERT().
269 If EndBit is less than StartBit, then ASSERT().
270 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
272 @param Address PCI configuration register to write.
273 @param StartBit The ordinal of the least significant bit in the bit field.
275 @param EndBit The ordinal of the most significant bit in the bit field.
277 @param OrData The value to OR with the PCI configuration register.
279 @return The value written back to the PCI configuration register.
284 PciExpressBitFieldOr8 (
292 Reads a bit field in an 8-bit PCI configuration register, performs a bitwise
293 AND, and writes the result back to the bit field in the 8-bit register.
295 Reads the 8-bit PCI configuration register specified by Address, performs a
296 bitwise AND between the read result and the value specified by AndData, and
297 writes the result to the 8-bit PCI configuration register specified by
298 Address. The value written to the PCI configuration register is returned.
299 This function must guarantee that all PCI read and write operations are
300 serialized. Extra left bits in AndData are stripped.
302 If Address > 0x0FFFFFFF, then ASSERT().
303 If StartBit is greater than 7, then ASSERT().
304 If EndBit is greater than 7, then ASSERT().
305 If EndBit is less than StartBit, then ASSERT().
306 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
308 @param Address PCI configuration register to write.
309 @param StartBit The ordinal of the least significant bit in the bit field.
311 @param EndBit The ordinal of the most significant bit in the bit field.
313 @param AndData The value to AND with the PCI configuration register.
315 @return The value written back to the PCI configuration register.
320 PciExpressBitFieldAnd8 (
328 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
329 bitwise OR, and writes the result back to the bit field in the
332 Reads the 8-bit PCI configuration register specified by Address, performs a
333 bitwise AND followed by a bitwise OR between the read result and
334 the value specified by AndData, and writes the result to the 8-bit PCI
335 configuration register specified by Address. The value written to the PCI
336 configuration register is returned. This function must guarantee that all PCI
337 read and write operations are serialized. Extra left bits in both AndData and
340 If Address > 0x0FFFFFFF, then ASSERT().
341 If StartBit is greater than 7, then ASSERT().
342 If EndBit is greater than 7, then ASSERT().
343 If EndBit is less than StartBit, then ASSERT().
344 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
345 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
347 @param Address PCI configuration register to write.
348 @param StartBit The ordinal of the least significant bit in the bit field.
350 @param EndBit The ordinal of the most significant bit in the bit field.
352 @param AndData The value to AND with the PCI configuration register.
353 @param OrData The value to OR with the result of the AND operation.
355 @return The value written back to the PCI configuration register.
360 PciExpressBitFieldAndThenOr8 (
369 Reads a 16-bit PCI configuration register.
371 Reads and returns the 16-bit PCI configuration register specified by Address.
372 This function must guarantee that all PCI read and write operations are
375 If Address > 0x0FFFFFFF, then ASSERT().
376 If Address is not aligned on a 16-bit boundary, then ASSERT().
378 @param Address Address that encodes the PCI Bus, Device, Function and
381 @return The read value from the PCI configuration register.
391 Writes a 16-bit PCI configuration register.
393 Writes the 16-bit PCI configuration register specified by Address with the
394 value specified by Value. Value is returned. This function must guarantee
395 that all PCI read and write operations are serialized.
397 If Address > 0x0FFFFFFF, then ASSERT().
398 If Address is not aligned on a 16-bit boundary, then ASSERT().
400 @param Address Address that encodes the PCI Bus, Device, Function and
402 @param Value The value to write.
404 @return The value written to the PCI configuration register.
415 Performs a bitwise OR of a 16-bit PCI configuration register with
418 Reads the 16-bit PCI configuration register specified by Address, performs a
419 bitwise OR between the read result and the value specified by
420 OrData, and writes the result to the 16-bit PCI configuration register
421 specified by Address. The value written to the PCI configuration register is
422 returned. This function must guarantee that all PCI read and write operations
425 If Address > 0x0FFFFFFF, then ASSERT().
426 If Address is not aligned on a 16-bit boundary, then ASSERT().
428 @param Address Address that encodes the PCI Bus, Device, Function and
430 @param OrData The value to OR with the PCI configuration register.
432 @return The value written back to the PCI configuration register.
443 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
446 Reads the 16-bit PCI configuration register specified by Address, performs a
447 bitwise AND between the read result and the value specified by AndData, and
448 writes the result to the 16-bit PCI configuration register specified by
449 Address. The value written to the PCI configuration register is returned.
450 This function must guarantee that all PCI read and write operations are
453 If Address > 0x0FFFFFFF, then ASSERT().
454 If Address is not aligned on a 16-bit boundary, then ASSERT().
456 @param Address Address that encodes the PCI Bus, Device, Function and
458 @param AndData The value to AND with the PCI configuration register.
460 @return The value written back to the PCI configuration register.
471 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit
472 value, followed a bitwise OR with another 16-bit value.
474 Reads the 16-bit PCI configuration register specified by Address, performs a
475 bitwise AND between the read result and the value specified by AndData,
476 performs a bitwise OR between the result of the AND operation and
477 the value specified by OrData, and writes the result to the 16-bit PCI
478 configuration register specified by Address. The value written to the PCI
479 configuration register is returned. This function must guarantee that all PCI
480 read and write operations are serialized.
482 If Address > 0x0FFFFFFF, then ASSERT().
483 If Address is not aligned on a 16-bit boundary, then ASSERT().
485 @param Address Address that encodes the PCI Bus, Device, Function and
487 @param AndData The value to AND with the PCI configuration register.
488 @param OrData The value to OR with the result of the AND operation.
490 @return The value written back to the PCI configuration register.
495 PciExpressAndThenOr16 (
502 Reads a bit field of a PCI configuration register.
504 Reads the bit field in a 16-bit PCI configuration register. The bit field is
505 specified by the StartBit and the EndBit. The value of the bit field is
508 If Address > 0x0FFFFFFF, then ASSERT().
509 If Address is not aligned on a 16-bit boundary, then ASSERT().
510 If StartBit is greater than 15, then ASSERT().
511 If EndBit is greater than 15, then ASSERT().
512 If EndBit is less than StartBit, then ASSERT().
514 @param Address PCI configuration register to read.
515 @param StartBit The ordinal of the least significant bit in the bit field.
517 @param EndBit The ordinal of the most significant bit in the bit field.
520 @return The value of the bit field read from the PCI configuration register.
525 PciExpressBitFieldRead16 (
532 Writes a bit field to a PCI configuration register.
534 Writes Value to the bit field of the PCI configuration register. The bit
535 field is specified by the StartBit and the EndBit. All other bits in the
536 destination PCI configuration register are preserved. The new value of the
537 16-bit register is returned.
539 If Address > 0x0FFFFFFF, then ASSERT().
540 If Address is not aligned on a 16-bit boundary, then ASSERT().
541 If StartBit is greater than 15, then ASSERT().
542 If EndBit is greater than 15, then ASSERT().
543 If EndBit is less than StartBit, then ASSERT().
544 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
546 @param Address PCI configuration register to write.
547 @param StartBit The ordinal of the least significant bit in the bit field.
549 @param EndBit The ordinal of the most significant bit in the bit field.
551 @param Value New value of the bit field.
553 @return The value written back to the PCI configuration register.
558 PciExpressBitFieldWrite16 (
566 Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, and
567 writes the result back to the bit field in the 16-bit port.
569 Reads the 16-bit PCI configuration register specified by Address, performs a
570 bitwise OR between the read result and the value specified by
571 OrData, and writes the result to the 16-bit PCI configuration register
572 specified by Address. The value written to the PCI configuration register is
573 returned. This function must guarantee that all PCI read and write operations
574 are serialized. Extra left bits in OrData are stripped.
576 If Address > 0x0FFFFFFF, then ASSERT().
577 If Address is not aligned on a 16-bit boundary, then ASSERT().
578 If StartBit is greater than 15, then ASSERT().
579 If EndBit is greater than 15, then ASSERT().
580 If EndBit is less than StartBit, then ASSERT().
581 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
583 @param Address PCI configuration register to write.
584 @param StartBit The ordinal of the least significant bit in the bit field.
586 @param EndBit The ordinal of the most significant bit in the bit field.
588 @param OrData The value to OR with the PCI configuration register.
590 @return The value written back to the PCI configuration register.
595 PciExpressBitFieldOr16 (
603 Reads a bit field in a 16-bit PCI configuration register, performs a bitwise
604 AND, and writes the result back to the bit field in the 16-bit register.
606 Reads the 16-bit PCI configuration register specified by Address, performs a
607 bitwise AND between the read result and the value specified by AndData, and
608 writes the result to the 16-bit PCI configuration register specified by
609 Address. The value written to the PCI configuration register is returned.
610 This function must guarantee that all PCI read and write operations are
611 serialized. Extra left bits in AndData are stripped.
613 If Address > 0x0FFFFFFF, then ASSERT().
614 If Address is not aligned on a 16-bit boundary, then ASSERT().
615 If StartBit is greater than 15, then ASSERT().
616 If EndBit is greater than 15, then ASSERT().
617 If EndBit is less than StartBit, then ASSERT().
618 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
620 @param Address PCI configuration register to write.
621 @param StartBit The ordinal of the least significant bit in the bit field.
623 @param EndBit The ordinal of the most significant bit in the bit field.
625 @param AndData The value to AND with the PCI configuration register.
627 @return The value written back to the PCI configuration register.
632 PciExpressBitFieldAnd16 (
640 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
641 bitwise OR, and writes the result back to the bit field in the
644 Reads the 16-bit PCI configuration register specified by Address, performs a
645 bitwise AND followed by a bitwise OR between the read result and
646 the value specified by AndData, and writes the result to the 16-bit PCI
647 configuration register specified by Address. The value written to the PCI
648 configuration register is returned. This function must guarantee that all PCI
649 read and write operations are serialized. Extra left bits in both AndData and
652 If Address > 0x0FFFFFFF, then ASSERT().
653 If Address is not aligned on a 16-bit boundary, then ASSERT().
654 If StartBit is greater than 15, then ASSERT().
655 If EndBit is greater than 15, then ASSERT().
656 If EndBit is less than StartBit, then ASSERT().
657 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
658 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
660 @param Address PCI configuration register to write.
661 @param StartBit The ordinal of the least significant bit in the bit field.
663 @param EndBit The ordinal of the most significant bit in the bit field.
665 @param AndData The value to AND with the PCI configuration register.
666 @param OrData The value to OR with the result of the AND operation.
668 @return The value written back to the PCI configuration register.
673 PciExpressBitFieldAndThenOr16 (
682 Reads a 32-bit PCI configuration register.
684 Reads and returns the 32-bit PCI configuration register specified by Address.
685 This function must guarantee that all PCI read and write operations are
688 If Address > 0x0FFFFFFF, then ASSERT().
689 If Address is not aligned on a 32-bit boundary, then ASSERT().
691 @param Address Address that encodes the PCI Bus, Device, Function and
694 @return The read value from the PCI configuration register.
704 Writes a 32-bit PCI configuration register.
706 Writes the 32-bit PCI configuration register specified by Address with the
707 value specified by Value. Value is returned. This function must guarantee
708 that all PCI read and write operations are serialized.
710 If Address > 0x0FFFFFFF, then ASSERT().
711 If Address is not aligned on a 32-bit boundary, then ASSERT().
713 @param Address Address that encodes the PCI Bus, Device, Function and
715 @param Value The value to write.
717 @return The value written to the PCI configuration register.
728 Performs a bitwise OR of a 32-bit PCI configuration register with
731 Reads the 32-bit PCI configuration register specified by Address, performs a
732 bitwise OR between the read result and the value specified by
733 OrData, and writes the result to the 32-bit PCI configuration register
734 specified by Address. The value written to the PCI configuration register is
735 returned. This function must guarantee that all PCI read and write operations
738 If Address > 0x0FFFFFFF, then ASSERT().
739 If Address is not aligned on a 32-bit boundary, then ASSERT().
741 @param Address Address that encodes the PCI Bus, Device, Function and
743 @param OrData The value to OR with the PCI configuration register.
745 @return The value written back to the PCI configuration register.
756 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
759 Reads the 32-bit PCI configuration register specified by Address, performs a
760 bitwise AND between the read result and the value specified by AndData, and
761 writes the result to the 32-bit PCI configuration register specified by
762 Address. The value written to the PCI configuration register is returned.
763 This function must guarantee that all PCI read and write operations are
766 If Address > 0x0FFFFFFF, then ASSERT().
767 If Address is not aligned on a 32-bit boundary, then ASSERT().
769 @param Address Address that encodes the PCI Bus, Device, Function and
771 @param AndData The value to AND with the PCI configuration register.
773 @return The value written back to the PCI configuration register.
784 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit
785 value, followed a bitwise OR with another 32-bit value.
787 Reads the 32-bit PCI configuration register specified by Address, performs a
788 bitwise AND between the read result and the value specified by AndData,
789 performs a bitwise OR between the result of the AND operation and
790 the value specified by OrData, and writes the result to the 32-bit PCI
791 configuration register specified by Address. The value written to the PCI
792 configuration register is returned. This function must guarantee that all PCI
793 read and write operations are serialized.
795 If Address > 0x0FFFFFFF, then ASSERT().
796 If Address is not aligned on a 32-bit boundary, then ASSERT().
798 @param Address Address that encodes the PCI Bus, Device, Function and
800 @param AndData The value to AND with the PCI configuration register.
801 @param OrData The value to OR with the result of the AND operation.
803 @return The value written back to the PCI configuration register.
808 PciExpressAndThenOr32 (
815 Reads a bit field of a PCI configuration register.
817 Reads the bit field in a 32-bit PCI configuration register. The bit field is
818 specified by the StartBit and the EndBit. The value of the bit field is
821 If Address > 0x0FFFFFFF, then ASSERT().
822 If Address is not aligned on a 32-bit boundary, then ASSERT().
823 If StartBit is greater than 31, then ASSERT().
824 If EndBit is greater than 31, then ASSERT().
825 If EndBit is less than StartBit, then ASSERT().
827 @param Address PCI configuration register to read.
828 @param StartBit The ordinal of the least significant bit in the bit field.
830 @param EndBit The ordinal of the most significant bit in the bit field.
833 @return The value of the bit field read from the PCI configuration register.
838 PciExpressBitFieldRead32 (
845 Writes a bit field to a PCI configuration register.
847 Writes Value to the bit field of the PCI configuration register. The bit
848 field is specified by the StartBit and the EndBit. All other bits in the
849 destination PCI configuration register are preserved. The new value of the
850 32-bit register is returned.
852 If Address > 0x0FFFFFFF, then ASSERT().
853 If Address is not aligned on a 32-bit boundary, then ASSERT().
854 If StartBit is greater than 31, then ASSERT().
855 If EndBit is greater than 31, then ASSERT().
856 If EndBit is less than StartBit, then ASSERT().
857 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
859 @param Address PCI configuration register to write.
860 @param StartBit The ordinal of the least significant bit in the bit field.
862 @param EndBit The ordinal of the most significant bit in the bit field.
864 @param Value New value of the bit field.
866 @return The value written back to the PCI configuration register.
871 PciExpressBitFieldWrite32 (
879 Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and
880 writes the result back to the bit field in the 32-bit port.
882 Reads the 32-bit PCI configuration register specified by Address, performs a
883 bitwise OR between the read result and the value specified by
884 OrData, and writes the result to the 32-bit PCI configuration register
885 specified by Address. The value written to the PCI configuration register is
886 returned. This function must guarantee that all PCI read and write operations
887 are serialized. Extra left bits in OrData are stripped.
889 If Address > 0x0FFFFFFF, then ASSERT().
890 If Address is not aligned on a 32-bit boundary, then ASSERT().
891 If StartBit is greater than 31, then ASSERT().
892 If EndBit is greater than 31, then ASSERT().
893 If EndBit is less than StartBit, then ASSERT().
894 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
896 @param Address PCI configuration register to write.
897 @param StartBit The ordinal of the least significant bit in the bit field.
899 @param EndBit The ordinal of the most significant bit in the bit field.
901 @param OrData The value to OR with the PCI configuration register.
903 @return The value written back to the PCI configuration register.
908 PciExpressBitFieldOr32 (
916 Reads a bit field in a 32-bit PCI configuration register, performs a bitwise
917 AND, and writes the result back to the bit field in the 32-bit register.
919 Reads the 32-bit PCI configuration register specified by Address, performs a
920 bitwise AND between the read result and the value specified by AndData, and
921 writes the result to the 32-bit PCI configuration register specified by
922 Address. The value written to the PCI configuration register is returned.
923 This function must guarantee that all PCI read and write operations are
924 serialized. Extra left bits in AndData are stripped.
926 If Address > 0x0FFFFFFF, then ASSERT().
927 If Address is not aligned on a 32-bit boundary, then ASSERT().
928 If StartBit is greater than 31, then ASSERT().
929 If EndBit is greater than 31, then ASSERT().
930 If EndBit is less than StartBit, then ASSERT().
931 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
933 @param Address PCI configuration register to write.
934 @param StartBit The ordinal of the least significant bit in the bit field.
936 @param EndBit The ordinal of the most significant bit in the bit field.
938 @param AndData The value to AND with the PCI configuration register.
940 @return The value written back to the PCI configuration register.
945 PciExpressBitFieldAnd32 (
953 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
954 bitwise OR, and writes the result back to the bit field in the
957 Reads the 32-bit PCI configuration register specified by Address, performs a
958 bitwise AND followed by a bitwise OR between the read result and
959 the value specified by AndData, and writes the result to the 32-bit PCI
960 configuration register specified by Address. The value written to the PCI
961 configuration register is returned. This function must guarantee that all PCI
962 read and write operations are serialized. Extra left bits in both AndData and
965 If Address > 0x0FFFFFFF, then ASSERT().
966 If Address is not aligned on a 32-bit boundary, then ASSERT().
967 If StartBit is greater than 31, then ASSERT().
968 If EndBit is greater than 31, then ASSERT().
969 If EndBit is less than StartBit, then ASSERT().
970 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
971 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
973 @param Address PCI configuration register to write.
974 @param StartBit The ordinal of the least significant bit in the bit field.
976 @param EndBit The ordinal of the most significant bit in the bit field.
978 @param AndData The value to AND with the PCI configuration register.
979 @param OrData The value to OR with the result of the AND operation.
981 @return The value written back to the PCI configuration register.
986 PciExpressBitFieldAndThenOr32 (
995 Reads a range of PCI configuration registers into a caller supplied buffer.
997 Reads the range of PCI configuration registers specified by StartAddress and
998 Size into the buffer specified by Buffer. This function only allows the PCI
999 configuration registers from a single PCI function to be read. Size is
1000 returned. When possible 32-bit PCI configuration read cycles are used to read
1001 from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
1002 and 16-bit PCI configuration read cycles may be used at the beginning and the
1005 If StartAddress > 0x0FFFFFFF, then ASSERT().
1006 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
1007 If Size > 0 and Buffer is NULL, then ASSERT().
1009 @param StartAddress Starting address that encodes the PCI Bus, Device,
1010 Function and Register.
1011 @param Size Size in bytes of the transfer.
1012 @param Buffer Pointer to a buffer receiving the data read.
1014 @return Size read data from StartAddress.
1019 PciExpressReadBuffer (
1020 IN UINTN StartAddress
,
1026 Copies the data in a caller supplied buffer to a specified range of PCI
1027 configuration space.
1029 Writes the range of PCI configuration registers specified by StartAddress and
1030 Size from the buffer specified by Buffer. This function only allows the PCI
1031 configuration registers from a single PCI function to be written. Size is
1032 returned. When possible 32-bit PCI configuration write cycles are used to
1033 write from StartAddress to StartAddress + Size. Due to alignment restrictions,
1034 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
1035 and the end of the range.
1037 If StartAddress > 0x0FFFFFFF, then ASSERT().
1038 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
1039 If Size > 0 and Buffer is NULL, then ASSERT().
1041 @param StartAddress Starting address that encodes the PCI Bus, Device,
1042 Function and Register.
1043 @param Size Size in bytes of the transfer.
1044 @param Buffer Pointer to a buffer containing the data to write.
1046 @return Size written to StartAddress.
1051 PciExpressWriteBuffer (
1052 IN UINTN StartAddress
,