]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PciSegmentLib.h
2 Provides services to access PCI Configuration Space on a platform with multiple PCI segments.
4 The PCI Segment Library function provide services to read, write, and modify the PCI configuration
5 registers on PCI root bridges on any supported PCI segment. These library services take a single
6 address parameter that encodes the PCI Segment, PCI Bus, PCI Device, PCI Function, and PCI Register.
7 The layout of this address parameter is as follows:
9 PCI Register: Bits 0..11
10 PCI Function Bits 12..14
11 PCI Device Bits 15..19
13 Reserved Bits 28..31. Must be 0.
14 PCI Segment Bits 32..47
15 Reserved Bits 48..63. Must be 0.
17 | Reserved (MBZ) | Segment | Reserved (MBZ) | Bus | Device | Function | Register |
18 63 48 47 32 31 28 27 20 19 15 14 12 11 0
20 These functions perform PCI configuration cycles using the default PCI configuration access
21 method. This may use I/O ports 0xCF8 and 0xCFC to perform PCI configuration accesses, or it
22 may use MMIO registers relative to the PcdPciExpressBaseAddress, or it may use some alternate
23 access method. Modules will typically use the PCI Segment Library for its PCI configuration
24 accesses when PCI Segments other than Segment #0 must be accessed.
26 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
27 SPDX-License-Identifier: BSD-2-Clause-Patent
31 #ifndef __PCI_SEGMENT_LIB__
32 #define __PCI_SEGMENT_LIB__
35 Macro that converts PCI Segment, PCI Bus, PCI Device, PCI Function,
36 and PCI Register to an address that can be passed to the PCI Segment Library functions.
38 Computes an address that is compatible with the PCI Segment Library functions.
39 The unused upper bits of Segment, Bus, Device, Function,
40 and Register are stripped prior to the generation of the address.
42 @param Segment PCI Segment number. Range 0..65535.
43 @param Bus PCI Bus number. Range 0..255.
44 @param Device PCI Device number. Range 0..31.
45 @param Function PCI Function number. Range 0..7.
46 @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095 for PCI Express.
48 @return The address that is compatible with the PCI Segment Library functions.
51 #define PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, Function, Register) \
53 ( ((Register) & 0xfff) | \
54 (((Function) & 0x07) << 12) | \
55 (((Device) & 0x1f) << 15) | \
56 (((Bus) & 0xff) << 20) | \
57 (LShiftU64 ((Segment) & 0xffff, 32)) \
59 ( ((Register) & 0xfff) | \
60 (((Function) & 0x07) << 12) | \
61 (((Device) & 0x1f) << 15) | \
62 (((Bus) & 0xff) << 20) \
67 Register a PCI device so PCI configuration registers may be accessed after
68 SetVirtualAddressMap().
70 If any reserved bits in Address are set, then ASSERT().
72 @param Address Address that encodes the PCI Bus, Device, Function and
75 @retval RETURN_SUCCESS The PCI device was registered for runtime access.
76 @retval RETURN_UNSUPPORTED An attempt was made to call this function
77 after ExitBootServices().
78 @retval RETURN_UNSUPPORTED The resources required to access the PCI device
79 at runtime could not be mapped.
80 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to
81 complete the registration.
86 PciSegmentRegisterForRuntimeAccess (
91 Reads an 8-bit PCI configuration register.
93 Reads and returns the 8-bit PCI configuration register specified by Address.
94 This function must guarantee that all PCI read and write operations are serialized.
96 If any reserved bits in Address are set, then ASSERT().
98 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
100 @return The 8-bit PCI configuration register specified by Address.
110 Writes an 8-bit PCI configuration register.
112 Writes the 8-bit PCI configuration register specified by Address with the value specified by Value.
113 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
115 If any reserved bits in Address are set, then ASSERT().
117 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
118 @param Value The value to write.
120 @return The value written to the PCI configuration register.
131 Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value.
133 Reads the 8-bit PCI configuration register specified by Address,
134 performs a bitwise OR between the read result and the value specified by OrData,
135 and writes the result to the 8-bit PCI configuration register specified by Address.
136 The value written to the PCI configuration register is returned.
137 This function must guarantee that all PCI read and write operations are serialized.
139 If any reserved bits in Address are set, then ASSERT().
141 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
142 @param OrData The value to OR with the PCI configuration register.
144 @return The value written to the PCI configuration register.
155 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value.
157 Reads the 8-bit PCI configuration register specified by Address,
158 performs a bitwise AND between the read result and the value specified by AndData,
159 and writes the result to the 8-bit PCI configuration register specified by Address.
160 The value written to the PCI configuration register is returned.
161 This function must guarantee that all PCI read and write operations are serialized.
162 If any reserved bits in Address are set, then ASSERT().
164 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
165 @param AndData The value to AND with the PCI configuration register.
167 @return The value written to the PCI configuration register.
178 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value,
179 followed a bitwise OR with another 8-bit value.
181 Reads the 8-bit PCI configuration register specified by Address,
182 performs a bitwise AND between the read result and the value specified by AndData,
183 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
184 and writes the result to the 8-bit PCI configuration register specified by Address.
185 The value written to the PCI configuration register is returned.
186 This function must guarantee that all PCI read and write operations are serialized.
188 If any reserved bits in Address are set, then ASSERT().
190 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
191 @param AndData The value to AND with the PCI configuration register.
192 @param OrData The value to OR with the PCI configuration register.
194 @return The value written to the PCI configuration register.
199 PciSegmentAndThenOr8 (
206 Reads a bit field of a PCI configuration register.
208 Reads the bit field in an 8-bit PCI configuration register. The bit field is
209 specified by the StartBit and the EndBit. The value of the bit field is
212 If any reserved bits in Address are set, then ASSERT().
213 If StartBit is greater than 7, then ASSERT().
214 If EndBit is greater than 7, then ASSERT().
215 If EndBit is less than StartBit, then ASSERT().
217 @param Address PCI configuration register to read.
218 @param StartBit The ordinal of the least significant bit in the bit field.
220 @param EndBit The ordinal of the most significant bit in the bit field.
223 @return The value of the bit field read from the PCI configuration register.
228 PciSegmentBitFieldRead8 (
235 Writes a bit field to a PCI configuration register.
237 Writes Value to the bit field of the PCI configuration register. The bit
238 field is specified by the StartBit and the EndBit. All other bits in the
239 destination PCI configuration register are preserved. The new value of the
240 8-bit register is returned.
242 If any reserved bits in Address are set, then ASSERT().
243 If StartBit is greater than 7, then ASSERT().
244 If EndBit is greater than 7, then ASSERT().
245 If EndBit is less than StartBit, then ASSERT().
246 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
248 @param Address PCI configuration register to write.
249 @param StartBit The ordinal of the least significant bit in the bit field.
251 @param EndBit The ordinal of the most significant bit in the bit field.
253 @param Value New value of the bit field.
255 @return The value written back to the PCI configuration register.
260 PciSegmentBitFieldWrite8 (
268 Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, and
269 writes the result back to the bit field in the 8-bit port.
271 Reads the 8-bit PCI configuration register specified by Address, performs a
272 bitwise OR between the read result and the value specified by
273 OrData, and writes the result to the 8-bit PCI configuration register
274 specified by Address. The value written to the PCI configuration register is
275 returned. This function must guarantee that all PCI read and write operations
276 are serialized. Extra left bits in OrData are stripped.
278 If any reserved bits in Address are set, then ASSERT().
279 If StartBit is greater than 7, then ASSERT().
280 If EndBit is greater than 7, then ASSERT().
281 If EndBit is less than StartBit, then ASSERT().
282 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
284 @param Address PCI configuration register to write.
285 @param StartBit The ordinal of the least significant bit in the bit field.
287 @param EndBit The ordinal of the most significant bit in the bit field.
289 @param OrData The value to OR with the PCI configuration register.
291 @return The value written back to the PCI configuration register.
296 PciSegmentBitFieldOr8 (
304 Reads a bit field in an 8-bit PCI configuration register, performs a bitwise
305 AND, and writes the result back to the bit field in the 8-bit register.
307 Reads the 8-bit PCI configuration register specified by Address, performs a
308 bitwise AND between the read result and the value specified by AndData, and
309 writes the result to the 8-bit PCI configuration register specified by
310 Address. The value written to the PCI configuration register is returned.
311 This function must guarantee that all PCI read and write operations are
312 serialized. Extra left bits in AndData are stripped.
314 If any reserved bits in Address are set, then ASSERT().
315 If StartBit is greater than 7, then ASSERT().
316 If EndBit is greater than 7, then ASSERT().
317 If EndBit is less than StartBit, then ASSERT().
318 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
320 @param Address PCI configuration register to write.
321 @param StartBit The ordinal of the least significant bit in the bit field.
323 @param EndBit The ordinal of the most significant bit in the bit field.
325 @param AndData The value to AND with the PCI configuration register.
327 @return The value written back to the PCI configuration register.
332 PciSegmentBitFieldAnd8 (
340 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
341 bitwise OR, and writes the result back to the bit field in the 8-bit port.
343 Reads the 8-bit PCI configuration register specified by Address, performs a
344 bitwise AND followed by a bitwise OR between the read result and
345 the value specified by AndData, and writes the result to the 8-bit PCI
346 configuration register specified by Address. The value written to the PCI
347 configuration register is returned. This function must guarantee that all PCI
348 read and write operations are serialized. Extra left bits in both AndData and
351 If any reserved bits in Address are set, then ASSERT().
352 If StartBit is greater than 7, then ASSERT().
353 If EndBit is greater than 7, then ASSERT().
354 If EndBit is less than StartBit, then ASSERT().
355 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
356 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
358 @param Address PCI configuration register to write.
359 @param StartBit The ordinal of the least significant bit in the bit field.
361 @param EndBit The ordinal of the most significant bit in the bit field.
363 @param AndData The value to AND with the PCI configuration register.
364 @param OrData The value to OR with the result of the AND operation.
366 @return The value written back to the PCI configuration register.
371 PciSegmentBitFieldAndThenOr8 (
380 Reads a 16-bit PCI configuration register.
382 Reads and returns the 16-bit PCI configuration register specified by Address.
383 This function must guarantee that all PCI read and write operations are serialized.
385 If any reserved bits in Address are set, then ASSERT().
386 If Address is not aligned on a 16-bit boundary, then ASSERT().
388 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
390 @return The 16-bit PCI configuration register specified by Address.
400 Writes a 16-bit PCI configuration register.
402 Writes the 16-bit PCI configuration register specified by Address with the value specified by Value.
403 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
405 If any reserved bits in Address are set, then ASSERT().
406 If Address is not aligned on a 16-bit boundary, then ASSERT().
408 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
409 @param Value The value to write.
411 @return The parameter of Value.
422 Performs a bitwise OR of a 16-bit PCI configuration register with
425 Reads the 16-bit PCI configuration register specified by Address, performs a
426 bitwise OR between the read result and the value specified by OrData, and
427 writes the result to the 16-bit PCI configuration register specified by Address.
428 The value written to the PCI configuration register is returned. This function
429 must guarantee that all PCI read and write operations are serialized.
431 If any reserved bits in Address are set, then ASSERT().
432 If Address is not aligned on a 16-bit boundary, then ASSERT().
434 @param Address Address that encodes the PCI Segment, Bus, Device, Function and
436 @param OrData The value to OR with the PCI configuration register.
438 @return The value written back to the PCI configuration register.
449 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value.
451 Reads the 16-bit PCI configuration register specified by Address,
452 performs a bitwise AND between the read result and the value specified by AndData,
453 and writes the result to the 16-bit PCI configuration register specified by Address.
454 The value written to the PCI configuration register is returned.
455 This function must guarantee that all PCI read and write operations are serialized.
457 If any reserved bits in Address are set, then ASSERT().
458 If Address is not aligned on a 16-bit boundary, then ASSERT().
460 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
461 @param AndData The value to AND with the PCI configuration register.
463 @return The value written to the PCI configuration register.
474 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value,
475 followed a bitwise OR with another 16-bit value.
477 Reads the 16-bit PCI configuration register specified by Address,
478 performs a bitwise AND between the read result and the value specified by AndData,
479 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
480 and writes the result to the 16-bit PCI configuration register specified by Address.
481 The value written to the PCI configuration register is returned.
482 This function must guarantee that all PCI read and write operations are serialized.
484 If any reserved bits in Address are set, then ASSERT().
485 If Address is not aligned on a 16-bit boundary, then ASSERT().
487 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
488 @param AndData The value to AND with the PCI configuration register.
489 @param OrData The value to OR with the PCI configuration register.
491 @return The value written to the PCI configuration register.
496 PciSegmentAndThenOr16 (
503 Reads a bit field of a PCI configuration register.
505 Reads the bit field in a 16-bit PCI configuration register. The bit field is
506 specified by the StartBit and the EndBit. The value of the bit field is
509 If any reserved bits in Address are set, then ASSERT().
510 If Address is not aligned on a 16-bit boundary, then ASSERT().
511 If StartBit is greater than 15, then ASSERT().
512 If EndBit is greater than 15, then ASSERT().
513 If EndBit is less than StartBit, then ASSERT().
515 @param Address PCI configuration register to read.
516 @param StartBit The ordinal of the least significant bit in the bit field.
518 @param EndBit The ordinal of the most significant bit in the bit field.
521 @return The value of the bit field read from the PCI configuration register.
526 PciSegmentBitFieldRead16 (
533 Writes a bit field to a PCI configuration register.
535 Writes Value to the bit field of the PCI configuration register. The bit
536 field is specified by the StartBit and the EndBit. All other bits in the
537 destination PCI configuration register are preserved. The new value of the
538 16-bit register is returned.
540 If any reserved bits in Address are set, then ASSERT().
541 If Address is not aligned on a 16-bit boundary, then ASSERT().
542 If StartBit is greater than 15, then ASSERT().
543 If EndBit is greater than 15, then ASSERT().
544 If EndBit is less than StartBit, then ASSERT().
545 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
547 @param Address PCI configuration register to write.
548 @param StartBit The ordinal of the least significant bit in the bit field.
550 @param EndBit The ordinal of the most significant bit in the bit field.
552 @param Value New value of the bit field.
554 @return The value written back to the PCI configuration register.
559 PciSegmentBitFieldWrite16 (
567 Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes
568 the result back to the bit field in the 16-bit port.
570 Reads the 16-bit PCI configuration register specified by Address, performs a
571 bitwise OR between the read result and the value specified by
572 OrData, and writes the result to the 16-bit PCI configuration register
573 specified by Address. The value written to the PCI configuration register is
574 returned. This function must guarantee that all PCI read and write operations
575 are serialized. Extra left bits in OrData are stripped.
577 If any reserved bits in Address are set, then ASSERT().
578 If Address is not aligned on a 16-bit boundary, then ASSERT().
579 If StartBit is greater than 15, then ASSERT().
580 If EndBit is greater than 15, then ASSERT().
581 If EndBit is less than StartBit, then ASSERT().
582 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
584 @param Address PCI configuration register to write.
585 @param StartBit The ordinal of the least significant bit in the bit field.
587 @param EndBit The ordinal of the most significant bit in the bit field.
589 @param OrData The value to OR with the PCI configuration register.
591 @return The value written back to the PCI configuration register.
596 PciSegmentBitFieldOr16 (
604 Reads a bit field in a 16-bit PCI configuration register, performs a bitwise
605 AND, writes the result back to the bit field in the 16-bit register.
607 Reads the 16-bit PCI configuration register specified by Address, performs a
608 bitwise AND between the read result and the value specified by AndData, and
609 writes the result to the 16-bit PCI configuration register specified by
610 Address. The value written to the PCI configuration register is returned.
611 This function must guarantee that all PCI read and write operations are
612 serialized. Extra left bits in AndData are stripped.
614 If any reserved bits in Address are set, then ASSERT().
615 If Address is not aligned on a 16-bit boundary, then ASSERT().
616 If StartBit is greater than 15, then ASSERT().
617 If EndBit is greater than 15, then ASSERT().
618 If EndBit is less than StartBit, then ASSERT().
619 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
621 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
622 @param StartBit The ordinal of the least significant bit in the bit field.
624 @param EndBit The ordinal of the most significant bit in the bit field.
626 @param AndData The value to AND with the PCI configuration register.
628 @return The value written back to the PCI configuration register.
633 PciSegmentBitFieldAnd16 (
641 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
642 bitwise OR, and writes the result back to the bit field in the
645 Reads the 16-bit PCI configuration register specified by Address, performs a
646 bitwise AND followed by a bitwise OR between the read result and
647 the value specified by AndData, and writes the result to the 16-bit PCI
648 configuration register specified by Address. The value written to the PCI
649 configuration register is returned. This function must guarantee that all PCI
650 read and write operations are serialized. Extra left bits in both AndData and
653 If any reserved bits in Address are set, 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 PciSegmentBitFieldAndThenOr16 (
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 serialized.
687 If any reserved bits in Address are set, then ASSERT().
688 If Address is not aligned on a 32-bit boundary, then ASSERT().
690 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
692 @return The 32-bit PCI configuration register specified by Address.
702 Writes a 32-bit PCI configuration register.
704 Writes the 32-bit PCI configuration register specified by Address with the value specified by Value.
705 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
707 If any reserved bits in Address are set, then ASSERT().
708 If Address is not aligned on a 32-bit boundary, then ASSERT().
710 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
711 @param Value The value to write.
713 @return The parameter of Value.
724 Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value.
726 Reads the 32-bit PCI configuration register specified by Address,
727 performs a bitwise OR between the read result and the value specified by OrData,
728 and writes the result to the 32-bit PCI configuration register specified by Address.
729 The value written to the PCI configuration register is returned.
730 This function must guarantee that all PCI read and write operations are serialized.
732 If any reserved bits in Address are set, then ASSERT().
733 If Address is not aligned on a 32-bit boundary, then ASSERT().
735 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
736 @param OrData The value to OR with the PCI configuration register.
738 @return The value written to the PCI configuration register.
749 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value.
751 Reads the 32-bit PCI configuration register specified by Address,
752 performs a bitwise AND between the read result and the value specified by AndData,
753 and writes the result to the 32-bit PCI configuration register specified by Address.
754 The value written to the PCI configuration register is returned.
755 This function must guarantee that all PCI read and write operations are serialized.
757 If any reserved bits in Address are set, then ASSERT().
758 If Address is not aligned on a 32-bit boundary, then ASSERT().
760 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
761 @param AndData The value to AND with the PCI configuration register.
763 @return The value written to the PCI configuration register.
774 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value,
775 followed a bitwise OR with another 32-bit value.
777 Reads the 32-bit PCI configuration register specified by Address,
778 performs a bitwise AND between the read result and the value specified by AndData,
779 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
780 and writes the result to the 32-bit PCI configuration register specified by Address.
781 The value written to the PCI configuration register is returned.
782 This function must guarantee that all PCI read and write operations are serialized.
784 If any reserved bits in Address are set, then ASSERT().
785 If Address is not aligned on a 32-bit boundary, then ASSERT().
787 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
788 @param AndData The value to AND with the PCI configuration register.
789 @param OrData The value to OR with the PCI configuration register.
791 @return The value written to the PCI configuration register.
796 PciSegmentAndThenOr32 (
803 Reads a bit field of a PCI configuration register.
805 Reads the bit field in a 32-bit PCI configuration register. The bit field is
806 specified by the StartBit and the EndBit. The value of the bit field is
809 If any reserved bits in Address are set, then ASSERT().
810 If Address is not aligned on a 32-bit boundary, then ASSERT().
811 If StartBit is greater than 31, then ASSERT().
812 If EndBit is greater than 31, then ASSERT().
813 If EndBit is less than StartBit, then ASSERT().
815 @param Address PCI configuration register to read.
816 @param StartBit The ordinal of the least significant bit in the bit field.
818 @param EndBit The ordinal of the most significant bit in the bit field.
821 @return The value of the bit field read from the PCI configuration register.
826 PciSegmentBitFieldRead32 (
833 Writes a bit field to a PCI configuration register.
835 Writes Value to the bit field of the PCI configuration register. The bit
836 field is specified by the StartBit and the EndBit. All other bits in the
837 destination PCI configuration register are preserved. The new value of the
838 32-bit register is returned.
840 If any reserved bits in Address are set, then ASSERT().
841 If Address is not aligned on a 32-bit boundary, then ASSERT().
842 If StartBit is greater than 31, then ASSERT().
843 If EndBit is greater than 31, then ASSERT().
844 If EndBit is less than StartBit, then ASSERT().
845 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
847 @param Address PCI configuration register to write.
848 @param StartBit The ordinal of the least significant bit in the bit field.
850 @param EndBit The ordinal of the most significant bit in the bit field.
852 @param Value New value of the bit field.
854 @return The value written back to the PCI configuration register.
859 PciSegmentBitFieldWrite32 (
867 Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, and
868 writes the result back to the bit field in the 32-bit port.
870 Reads the 32-bit PCI configuration register specified by Address, performs a
871 bitwise OR between the read result and the value specified by
872 OrData, and writes the result to the 32-bit PCI configuration register
873 specified by Address. The value written to the PCI configuration register is
874 returned. This function must guarantee that all PCI read and write operations
875 are serialized. Extra left bits in OrData are stripped.
877 If any reserved bits in Address are set, then ASSERT().
878 If StartBit is greater than 31, then ASSERT().
879 If EndBit is greater than 31, then ASSERT().
880 If EndBit is less than StartBit, then ASSERT().
881 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
883 @param Address PCI configuration register to write.
884 @param StartBit The ordinal of the least significant bit in the bit field.
886 @param EndBit The ordinal of the most significant bit in the bit field.
888 @param OrData The value to OR with the PCI configuration register.
890 @return The value written back to the PCI configuration register.
895 PciSegmentBitFieldOr32 (
903 Reads a bit field in a 32-bit PCI configuration register, performs a bitwise
904 AND, and writes the result back to the bit field in the 32-bit register.
907 Reads the 32-bit PCI configuration register specified by Address, performs a bitwise
908 AND between the read result and the value specified by AndData, and writes the result
909 to the 32-bit PCI configuration register specified by Address. The value written to
910 the PCI configuration register is returned. This function must guarantee that all PCI
911 read and write operations are serialized. Extra left bits in AndData are stripped.
912 If any reserved bits in Address are set, then ASSERT().
913 If Address is not aligned on a 32-bit boundary, then ASSERT().
914 If StartBit is greater than 31, then ASSERT().
915 If EndBit is greater than 31, then ASSERT().
916 If EndBit is less than StartBit, then ASSERT().
917 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
919 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
920 @param StartBit The ordinal of the least significant bit in the bit field.
922 @param EndBit The ordinal of the most significant bit in the bit field.
924 @param AndData The value to AND with the PCI configuration register.
926 @return The value written back to the PCI configuration register.
931 PciSegmentBitFieldAnd32 (
939 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
940 bitwise OR, and writes the result back to the bit field in the
943 Reads the 32-bit PCI configuration register specified by Address, performs a
944 bitwise AND followed by a bitwise OR between the read result and
945 the value specified by AndData, and writes the result to the 32-bit PCI
946 configuration register specified by Address. The value written to the PCI
947 configuration register is returned. This function must guarantee that all PCI
948 read and write operations are serialized. Extra left bits in both AndData and
951 If any reserved bits in Address are set, then ASSERT().
952 If StartBit is greater than 31, then ASSERT().
953 If EndBit is greater than 31, then ASSERT().
954 If EndBit is less than StartBit, then ASSERT().
955 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
956 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
958 @param Address PCI configuration register to write.
959 @param StartBit The ordinal of the least significant bit in the bit field.
961 @param EndBit The ordinal of the most significant bit in the bit field.
963 @param AndData The value to AND with the PCI configuration register.
964 @param OrData The value to OR with the result of the AND operation.
966 @return The value written back to the PCI configuration register.
971 PciSegmentBitFieldAndThenOr32 (
980 Reads a range of PCI configuration registers into a caller supplied buffer.
982 Reads the range of PCI configuration registers specified by StartAddress and
983 Size into the buffer specified by Buffer. This function only allows the PCI
984 configuration registers from a single PCI function to be read. Size is
985 returned. When possible 32-bit PCI configuration read cycles are used to read
986 from StartAddress to StartAddress + Size. Due to alignment restrictions, 8-bit
987 and 16-bit PCI configuration read cycles may be used at the beginning and the
990 If any reserved bits in StartAddress are set, then ASSERT().
991 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
992 If Size > 0 and Buffer is NULL, then ASSERT().
994 @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,
995 Function and Register.
996 @param Size Size in bytes of the transfer.
997 @param Buffer Pointer to a buffer receiving the data read.
1004 PciSegmentReadBuffer (
1005 IN UINT64 StartAddress
,
1011 Copies the data in a caller supplied buffer to a specified range of PCI
1012 configuration space.
1014 Writes the range of PCI configuration registers specified by StartAddress and
1015 Size from the buffer specified by Buffer. This function only allows the PCI
1016 configuration registers from a single PCI function to be written. Size is
1017 returned. When possible 32-bit PCI configuration write cycles are used to
1018 write from StartAddress to StartAddress + Size. Due to alignment restrictions,
1019 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
1020 and the end of the range.
1022 If any reserved bits in StartAddress are set, then ASSERT().
1023 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
1024 If Size > 0 and Buffer is NULL, then ASSERT().
1026 @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,
1027 Function and Register.
1028 @param Size Size in bytes of the transfer.
1029 @param Buffer Pointer to a buffer containing the data to write.
1031 @return The parameter of Size.
1036 PciSegmentWriteBuffer (
1037 IN UINT64 StartAddress
,