]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/S3PciSegmentLib.h
2 The multiple segments PCI configuration Library Services that carry out
3 PCI configuration and enable the PCI operations to be replayed during an
4 S3 resume. This library class maps directly on top of the PciSegmentLib class.
6 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef __S3_PCI_SEGMENT_LIB__
12 #define __S3_PCI_SEGMENT_LIB__
15 Macro that converts PCI Segment, PCI Bus, PCI Device, PCI Function,
16 and PCI Register to an address that can be passed to the S3 PCI Segment Library functions.
18 Computes an address that is compatible with the PCI Segment Library functions.
19 The unused upper bits of Segment, Bus, Device, Function,
20 and Register are stripped prior to the generation of the address.
22 @param Segment PCI Segment number. Range 0..65535.
23 @param Bus PCI Bus number. Range 0..255.
24 @param Device PCI Device number. Range 0..31.
25 @param Function PCI Function number. Range 0..7.
26 @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095 for PCI Express.
28 @return The address that is compatible with the PCI Segment Library functions.
31 #define S3_PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, Function, Register) \
33 ( ((Register) & 0xfff) | \
34 (((Function) & 0x07) << 12) | \
35 (((Device) & 0x1f) << 15) | \
36 (((Bus) & 0xff) << 20) | \
37 (LShiftU64 ((Segment) & 0xffff, 32)) \
39 ( ((Register) & 0xfff) | \
40 (((Function) & 0x07) << 12) | \
41 (((Device) & 0x1f) << 15) | \
42 (((Bus) & 0xff) << 20) \
47 Reads an 8-bit PCI configuration register, and saves the value in the S3 script to
48 be replayed on S3 resume.
50 Reads and returns the 8-bit PCI configuration register specified by Address.
51 This function must guarantee that all PCI read and write operations are serialized.
53 If any reserved bits in Address are set, then ASSERT().
55 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
57 @return The 8-bit PCI configuration register specified by Address.
67 Writes an 8-bit PCI configuration register, and saves the value in the S3 script to
68 be replayed on S3 resume.
70 Writes the 8-bit PCI configuration register specified by Address with the value specified by Value.
71 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
73 If any reserved bits in Address are set, then ASSERT().
75 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
76 @param Value The value to write.
78 @return The value written to the PCI configuration register.
89 Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value, and saves
90 the value in the S3 script to be replayed on S3 resume.
92 Reads the 8-bit PCI configuration register specified by Address,
93 performs a bitwise OR between the read result and the value specified by OrData,
94 and writes the result to the 8-bit PCI configuration register specified by Address.
95 The value written to the PCI configuration register is returned.
96 This function must guarantee that all PCI read and write operations are serialized.
98 If any reserved bits in Address are set, then ASSERT().
100 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
101 @param OrData The value to OR with the PCI configuration register.
103 @return The value written to the PCI configuration register.
114 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value, and
115 saves the value in the S3 script to be replayed on S3 resume.
117 Reads the 8-bit PCI configuration register specified by Address,
118 performs a bitwise AND between the read result and the value specified by AndData,
119 and writes the result to the 8-bit PCI configuration register specified by Address.
120 The value written to the PCI configuration register is returned.
121 This function must guarantee that all PCI read and write operations are serialized.
122 If any reserved bits in Address are set, then ASSERT().
124 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
125 @param AndData The value to AND with the PCI configuration register.
127 @return The value written to the PCI configuration register.
138 Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit value,
139 followed a bitwise OR with another 8-bit value, and saves the value in the S3 script to
140 be replayed on S3 resume.
142 Reads the 8-bit PCI configuration register specified by Address,
143 performs a bitwise AND between the read result and the value specified by AndData,
144 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
145 and writes the result to the 8-bit PCI configuration register specified by Address.
146 The value written to the PCI configuration register is returned.
147 This function must guarantee that all PCI read and write operations are serialized.
149 If any reserved bits in Address are set, then ASSERT().
151 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
152 @param AndData The value to AND with the PCI configuration register.
153 @param OrData The value to OR with the PCI configuration register.
155 @return The value written to the PCI configuration register.
160 S3PciSegmentAndThenOr8 (
167 Reads a bit field of a PCI configuration register, and saves the value in the
168 S3 script to be replayed on S3 resume.
170 Reads the bit field in an 8-bit PCI configuration register. The bit field is
171 specified by the StartBit and the EndBit. The value of the bit field is
174 If any reserved bits in Address are set, then ASSERT().
175 If StartBit is greater than 7, then ASSERT().
176 If EndBit is greater than 7, then ASSERT().
177 If EndBit is less than StartBit, then ASSERT().
179 @param Address PCI configuration register to read.
180 @param StartBit The ordinal of the least significant bit in the bit field.
182 @param EndBit The ordinal of the most significant bit in the bit field.
185 @return The value of the bit field read from the PCI configuration register.
190 S3PciSegmentBitFieldRead8 (
197 Writes a bit field to a PCI configuration register, and saves the value in
198 the S3 script to be replayed on S3 resume.
200 Writes Value to the bit field of the PCI configuration register. The bit
201 field is specified by the StartBit and the EndBit. All other bits in the
202 destination PCI configuration register are preserved. The new value of the
203 8-bit register is returned.
205 If any reserved bits in Address are set, then ASSERT().
206 If StartBit is greater than 7, then ASSERT().
207 If EndBit is greater than 7, then ASSERT().
208 If EndBit is less than StartBit, then ASSERT().
209 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
211 @param Address PCI configuration register to write.
212 @param StartBit The ordinal of the least significant bit in the bit field.
214 @param EndBit The ordinal of the most significant bit in the bit field.
216 @param Value New value of the bit field.
218 @return The value written back to the PCI configuration register.
223 S3PciSegmentBitFieldWrite8 (
231 Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, writes
232 the result back to the bit field in the 8-bit port, and saves the value in the
233 S3 script to be replayed on S3 resume.
235 Reads the 8-bit PCI configuration register specified by Address, performs a
236 bitwise OR between the read result and the value specified by
237 OrData, and writes the result to the 8-bit PCI configuration register
238 specified by Address. The value written to the PCI configuration register is
239 returned. This function must guarantee that all PCI read and write operations
240 are serialized. Extra left bits in OrData are stripped.
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 OrData 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 OrData The value to OR with the PCI configuration register.
255 @return The value written back to the PCI configuration register.
260 S3PciSegmentBitFieldOr8 (
268 Reads a bit field in an 8-bit PCI configuration register, performs a bitwise
269 AND, writes the result back to the bit field in the 8-bit register, and
270 saves the value in the S3 script to be replayed on S3 resume.
272 Reads the 8-bit PCI configuration register specified by Address, performs a
273 bitwise AND between the read result and the value specified by AndData, and
274 writes the result to the 8-bit PCI configuration register specified by
275 Address. The value written to the PCI configuration register is returned.
276 This function must guarantee that all PCI read and write operations are
277 serialized. Extra left bits in AndData are stripped.
279 If any reserved bits in Address are set, then ASSERT().
280 If StartBit is greater than 7, then ASSERT().
281 If EndBit is greater than 7, then ASSERT().
282 If EndBit is less than StartBit, then ASSERT().
283 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
285 @param Address PCI configuration register to write.
286 @param StartBit The ordinal of the least significant bit in the bit field.
288 @param EndBit The ordinal of the most significant bit in the bit field.
290 @param AndData The value to AND with the PCI configuration register.
292 @return The value written back to the PCI configuration register.
297 S3PciSegmentBitFieldAnd8 (
305 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
306 bitwise OR, writes the result back to the bit field in the 8-bit port,
307 and saves the value in the S3 script to be replayed on S3 resume.
309 Reads the 8-bit PCI configuration register specified by Address, performs a
310 bitwise AND followed by a bitwise OR between the read result and
311 the value specified by AndData, and writes the result to the 8-bit PCI
312 configuration register specified by Address. The value written to the PCI
313 configuration register is returned. This function must guarantee that all PCI
314 read and write operations are serialized. Extra left bits in both AndData and
317 If any reserved bits in Address are set, then ASSERT().
318 If StartBit is greater than 7, then ASSERT().
319 If EndBit is greater than 7, then ASSERT().
320 If EndBit is less than StartBit, then ASSERT().
321 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
322 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
324 @param Address PCI configuration register to write.
325 @param StartBit The ordinal of the least significant bit in the bit field.
327 @param EndBit The ordinal of the most significant bit in the bit field.
329 @param AndData The value to AND with the PCI configuration register.
330 @param OrData The value to OR with the result of the AND operation.
332 @return The value written back to the PCI configuration register.
337 S3PciSegmentBitFieldAndThenOr8 (
346 Reads a 16-bit PCI configuration register, and saves the value in the S3 script
347 to be replayed on S3 resume.
349 Reads and returns the 16-bit PCI configuration register specified by Address.
350 This function must guarantee that all PCI read and write operations are serialized.
352 If any reserved bits in Address are set, then ASSERT().
353 If Address is not aligned on a 16-bit boundary, then ASSERT().
355 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
357 @return The 16-bit PCI configuration register specified by Address.
367 Writes a 16-bit PCI configuration register, and saves the value in the S3 script to
368 be replayed on S3 resume.
370 Writes the 16-bit PCI configuration register specified by Address with the value specified by Value.
371 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
373 If any reserved bits in Address are set, then ASSERT().
374 If Address is not aligned on a 16-bit boundary, then ASSERT().
376 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
377 @param Value The value to write.
379 @return The parameter of Value.
384 S3PciSegmentWrite16 (
390 Performs a bitwise OR of a 16-bit PCI configuration register with a 16-bit
391 value, and saves the value in the S3 script to be replayed on S3 resume.
393 Reads the 16-bit PCI configuration register specified by Address, performs a
394 bitwise OR between the read result and the value specified by OrData, and
395 writes the result to the 16-bit PCI configuration register specified by Address.
396 The value written to the PCI configuration register is returned. This function
397 must guarantee that all PCI read and write operations are serialized.
399 If any reserved bits in Address are set, then ASSERT().
400 If Address is not aligned on a 16-bit boundary, then ASSERT().
402 @param Address Address that encodes the PCI Segment, Bus, Device, Function and
404 @param OrData The value to OR with the PCI configuration register.
406 @return The value written back to the PCI configuration register.
417 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value, and
418 saves the value in the S3 script to be replayed on S3 resume.
420 Reads the 16-bit PCI configuration register specified by Address,
421 performs a bitwise AND between the read result and the value specified by AndData,
422 and writes the result to the 16-bit PCI configuration register specified by Address.
423 The value written to the PCI configuration register is returned.
424 This function must guarantee that all PCI read and write operations are serialized.
426 If any reserved bits in Address are set, then ASSERT().
427 If Address is not aligned on a 16-bit boundary, then ASSERT().
429 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
430 @param AndData The value to AND with the PCI configuration register.
432 @return The value written to the PCI configuration register.
443 Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit value,
444 followed a bitwise OR with another 16-bit value, and saves the value in the S3 script to
445 be replayed on S3 resume.
447 Reads the 16-bit PCI configuration register specified by Address,
448 performs a bitwise AND between the read result and the value specified by AndData,
449 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
450 and writes the result to the 16-bit PCI configuration register specified by Address.
451 The value written to the PCI configuration register is returned.
452 This function must guarantee that all PCI read and write operations are serialized.
454 If any reserved bits in Address are set, then ASSERT().
455 If Address is not aligned on a 16-bit boundary, then ASSERT().
457 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
458 @param AndData The value to AND with the PCI configuration register.
459 @param OrData The value to OR with the PCI configuration register.
461 @return The value written to the PCI configuration register.
466 S3PciSegmentAndThenOr16 (
473 Reads a bit field of a PCI configuration register, and saves the value in the
474 S3 script to be replayed on S3 resume.
476 Reads the bit field in a 16-bit PCI configuration register. The bit field is
477 specified by the StartBit and the EndBit. The value of the bit field is
480 If any reserved bits in Address are set, then ASSERT().
481 If Address is not aligned on a 16-bit boundary, then ASSERT().
482 If StartBit is greater than 15, then ASSERT().
483 If EndBit is greater than 15, then ASSERT().
484 If EndBit is less than StartBit, then ASSERT().
486 @param Address PCI configuration register to read.
487 @param StartBit The ordinal of the least significant bit in the bit field.
489 @param EndBit The ordinal of the most significant bit in the bit field.
492 @return The value of the bit field read from the PCI configuration register.
497 S3PciSegmentBitFieldRead16 (
504 Writes a bit field to a PCI configuration register, and saves the value in
505 the S3 script to be replayed on S3 resume.
507 Writes Value to the bit field of the PCI configuration register. The bit
508 field is specified by the StartBit and the EndBit. All other bits in the
509 destination PCI configuration register are preserved. The new value of the
510 16-bit register is returned.
512 If any reserved bits in Address are set, then ASSERT().
513 If Address is not aligned on a 16-bit boundary, then ASSERT().
514 If StartBit is greater than 15, then ASSERT().
515 If EndBit is greater than 15, then ASSERT().
516 If EndBit is less than StartBit, then ASSERT().
517 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
519 @param Address PCI configuration register to write.
520 @param StartBit The ordinal of the least significant bit in the bit field.
522 @param EndBit The ordinal of the most significant bit in the bit field.
524 @param Value New value of the bit field.
526 @return The value written back to the PCI configuration register.
531 S3PciSegmentBitFieldWrite16 (
539 Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes
540 the result back to the bit field in the 16-bit port, and saves the value in the
541 S3 script to be replayed on S3 resume.
543 Reads the 16-bit PCI configuration register specified by Address, performs a
544 bitwise OR between the read result and the value specified by
545 OrData, and writes the result to the 16-bit PCI configuration register
546 specified by Address. The value written to the PCI configuration register is
547 returned. This function must guarantee that all PCI read and write operations
548 are serialized. Extra left bits in OrData are stripped.
550 If any reserved bits in Address are set, then ASSERT().
551 If Address is not aligned on a 16-bit boundary, then ASSERT().
552 If StartBit is greater than 15, then ASSERT().
553 If EndBit is greater than 15, then ASSERT().
554 If EndBit is less than StartBit, then ASSERT().
555 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
557 @param Address PCI configuration register to write.
558 @param StartBit The ordinal of the least significant bit in the bit field.
560 @param EndBit The ordinal of the most significant bit in the bit field.
562 @param OrData The value to OR with the PCI configuration register.
564 @return The value written back to the PCI configuration register.
569 S3PciSegmentBitFieldOr16 (
577 Reads a bit field in a 16-bit PCI configuration register, performs a bitwise
578 AND, writes the result back to the bit field in the 16-bit register, and
579 saves the value in the S3 script to be replayed on S3 resume.
581 Reads the 16-bit PCI configuration register specified by Address, performs a
582 bitwise AND between the read result and the value specified by AndData, and
583 writes the result to the 16-bit PCI configuration register specified by
584 Address. The value written to the PCI configuration register is returned.
585 This function must guarantee that all PCI read and write operations are
586 serialized. Extra left bits in AndData are stripped.
588 If any reserved bits in Address are set, then ASSERT().
589 If Address is not aligned on a 16-bit boundary, then ASSERT().
590 If StartBit is greater than 15, then ASSERT().
591 If EndBit is greater than 15, then ASSERT().
592 If EndBit is less than StartBit, then ASSERT().
593 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
595 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
596 @param StartBit The ordinal of the least significant bit in the bit field.
598 @param EndBit The ordinal of the most significant bit in the bit field.
600 @param AndData The value to AND with the PCI configuration register.
602 @return The value written back to the PCI configuration register.
607 S3PciSegmentBitFieldAnd16 (
615 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
616 bitwise OR, writes the result back to the bit field in the 16-bit port,
617 and saves the value in the S3 script to be replayed on S3 resume.
619 Reads the 16-bit PCI configuration register specified by Address, performs a
620 bitwise AND followed by a bitwise OR between the read result and
621 the value specified by AndData, and writes the result to the 16-bit PCI
622 configuration register specified by Address. The value written to the PCI
623 configuration register is returned. This function must guarantee that all PCI
624 read and write operations are serialized. Extra left bits in both AndData and
627 If any reserved bits in Address are set, then ASSERT().
628 If StartBit is greater than 15, then ASSERT().
629 If EndBit is greater than 15, then ASSERT().
630 If EndBit is less than StartBit, then ASSERT().
631 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
632 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
634 @param Address PCI configuration register to write.
635 @param StartBit The ordinal of the least significant bit in the bit field.
637 @param EndBit The ordinal of the most significant bit in the bit field.
639 @param AndData The value to AND with the PCI configuration register.
640 @param OrData The value to OR with the result of the AND operation.
642 @return The value written back to the PCI configuration register.
647 S3PciSegmentBitFieldAndThenOr16 (
656 Reads a 32-bit PCI configuration register, and saves the value in the S3 script
657 to be replayed on S3 resume.
659 Reads and returns the 32-bit PCI configuration register specified by Address.
660 This function must guarantee that all PCI read and write operations are serialized.
662 If any reserved bits in Address are set, then ASSERT().
663 If Address is not aligned on a 32-bit boundary, then ASSERT().
665 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
667 @return The 32-bit PCI configuration register specified by Address.
677 Writes a 32-bit PCI configuration register, and saves the value in the S3 script to
678 be replayed on S3 resume.
680 Writes the 32-bit PCI configuration register specified by Address with the value specified by Value.
681 Value is returned. This function must guarantee that all PCI read and write operations are serialized.
683 If any reserved bits in Address are set, then ASSERT().
684 If Address is not aligned on a 32-bit boundary, then ASSERT().
686 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
687 @param Value The value to write.
689 @return The parameter of Value.
694 S3PciSegmentWrite32 (
700 Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit
701 value, and saves the value in the S3 script to be replayed on S3 resume.
703 Reads the 32-bit PCI configuration register specified by Address, performs a
704 bitwise OR between the read result and the value specified by OrData, and
705 writes the result to the 32-bit PCI configuration register specified by Address.
706 The value written to the PCI configuration register is returned. This function
707 must guarantee that all PCI read and write operations are serialized.
709 If any reserved bits in Address are set, then ASSERT().
710 If Address is not aligned on a 32-bit boundary, then ASSERT().
712 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and
714 @param OrData The value to OR with the PCI configuration register.
716 @return The value written back to the PCI configuration register.
727 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value, and
728 saves the value in the S3 script to be replayed on S3 resume.
730 Reads the 32-bit PCI configuration register specified by Address,
731 performs a bitwise AND between the read result and the value specified by AndData,
732 and writes the result to the 32-bit PCI configuration register specified by Address.
733 The value written to the PCI configuration register is returned.
734 This function must guarantee that all PCI read and write operations are serialized.
736 If any reserved bits in Address are set, then ASSERT().
737 If Address is not aligned on a 32-bit boundary, then ASSERT().
739 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
740 @param AndData The value to AND with the PCI configuration register.
742 @return The value written to the PCI configuration register.
753 Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit value,
754 followed a bitwise OR with another 32-bit value, and saves the value in the S3 script to
755 be replayed on S3 resume.
757 Reads the 32-bit PCI configuration register specified by Address,
758 performs a bitwise AND between the read result and the value specified by AndData,
759 performs a bitwise OR between the result of the AND operation and the value specified by OrData,
760 and writes the result to the 32-bit PCI configuration register specified by Address.
761 The value written to the PCI configuration register is returned.
762 This function must guarantee that all PCI read and write operations are serialized.
764 If any reserved bits in Address are set, then ASSERT().
765 If Address is not aligned on a 32-bit boundary, then ASSERT().
767 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
768 @param AndData The value to AND with the PCI configuration register.
769 @param OrData The value to OR with the PCI configuration register.
771 @return The value written to the PCI configuration register.
776 S3PciSegmentAndThenOr32 (
783 Reads a bit field of a PCI configuration register, and saves the value in the
784 S3 script to be replayed on S3 resume.
786 Reads the bit field in a 32-bit PCI configuration register. The bit field is
787 specified by the StartBit and the EndBit. The value of the bit field is
790 If any reserved bits in Address are set, then ASSERT().
791 If Address is not aligned on a 32-bit boundary, then ASSERT().
792 If StartBit is greater than 31, then ASSERT().
793 If EndBit is greater than 31, then ASSERT().
794 If EndBit is less than StartBit, then ASSERT().
796 @param Address PCI configuration register to read.
797 @param StartBit The ordinal of the least significant bit in the bit field.
799 @param EndBit The ordinal of the most significant bit in the bit field.
802 @return The value of the bit field read from the PCI configuration register.
807 S3PciSegmentBitFieldRead32 (
814 Writes a bit field to a PCI configuration register, and saves the value in
815 the S3 script to be replayed on S3 resume.
817 Writes Value to the bit field of the PCI configuration register. The bit
818 field is specified by the StartBit and the EndBit. All other bits in the
819 destination PCI configuration register are preserved. The new value of the
820 32-bit register is returned.
822 If any reserved bits in Address are set, then ASSERT().
823 If Address is not aligned on a 32-bit boundary, then ASSERT().
824 If StartBit is greater than 31, then ASSERT().
825 If EndBit is greater than 31, then ASSERT().
826 If EndBit is less than StartBit, then ASSERT().
827 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
829 @param Address PCI configuration register to write.
830 @param StartBit The ordinal of the least significant bit in the bit field.
832 @param EndBit The ordinal of the most significant bit in the bit field.
834 @param Value New value of the bit field.
836 @return The value written back to the PCI configuration register.
841 S3PciSegmentBitFieldWrite32 (
849 Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, writes
850 the result back to the bit field in the 32-bit port, and saves the value in the
851 S3 script to be replayed on S3 resume.
853 Reads the 32-bit PCI configuration register specified by Address, performs a
854 bitwise OR between the read result and the value specified by
855 OrData, and writes the result to the 32-bit PCI configuration register
856 specified by Address. The value written to the PCI configuration register is
857 returned. This function must guarantee that all PCI read and write operations
858 are serialized. Extra left bits in OrData are stripped.
860 If any reserved bits in Address are set, then ASSERT().
861 If Address is not aligned on a 32-bit boundary, then ASSERT().
862 If StartBit is greater than 31, then ASSERT().
863 If EndBit is greater than 31, then ASSERT().
864 If EndBit is less than StartBit, then ASSERT().
865 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
867 @param Address PCI configuration register to write.
868 @param StartBit The ordinal of the least significant bit in the bit field.
870 @param EndBit The ordinal of the most significant bit in the bit field.
872 @param OrData The value to OR with the PCI configuration register.
874 @return The value written back to the PCI configuration register.
879 S3PciSegmentBitFieldOr32 (
887 Reads a bit field in a 32-bit PCI configuration register, performs a bitwise
888 AND, and writes the result back to the bit field in the 32-bit register, and
889 saves the value in the S3 script to be replayed on S3 resume.
891 Reads the 32-bit PCI configuration register specified by Address, performs a
892 bitwise AND between the read result and the value specified by AndData, and
893 writes the result to the 32-bit PCI configuration register specified by
894 Address. The value written to the PCI configuration register is returned.
895 This function must guarantee that all PCI read and write operations are
896 serialized. Extra left bits in AndData are stripped.
898 If any reserved bits in Address are set, then ASSERT().
899 If Address is not aligned on a 32-bit boundary, then ASSERT().
900 If StartBit is greater than 31, then ASSERT().
901 If EndBit is greater than 31, then ASSERT().
902 If EndBit is less than StartBit, then ASSERT().
903 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
905 @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register.
906 @param StartBit The ordinal of the least significant bit in the bit field.
908 @param EndBit The ordinal of the most significant bit in the bit field.
910 @param AndData The value to AND with the PCI configuration register.
912 @return The value written back to the PCI configuration register.
917 S3PciSegmentBitFieldAnd32 (
925 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
926 bitwise OR, writes the result back to the bit field in the 32-bit port,
927 and saves the value in the S3 script to be replayed on S3 resume.
929 Reads the 32-bit PCI configuration register specified by Address, performs a
930 bitwise AND followed by a bitwise OR between the read result and
931 the value specified by AndData, and writes the result to the 32-bit PCI
932 configuration register specified by Address. The value written to the PCI
933 configuration register is returned. This function must guarantee that all PCI
934 read and write operations are serialized. Extra left bits in both AndData and
937 If any reserved bits in Address are set, then ASSERT().
938 If StartBit is greater than 31, then ASSERT().
939 If EndBit is greater than 31, then ASSERT().
940 If EndBit is less than StartBit, then ASSERT().
941 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
942 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
944 @param Address PCI configuration register to write.
945 @param StartBit The ordinal of the least significant bit in the bit field.
947 @param EndBit The ordinal of the most significant bit in the bit field.
949 @param AndData The value to AND with the PCI configuration register.
950 @param OrData The value to OR with the result of the AND operation.
952 @return The value written back to the PCI configuration register.
957 S3PciSegmentBitFieldAndThenOr32 (
966 Reads a range of PCI configuration registers into a caller supplied buffer,
967 and saves the value in the S3 script to be replayed on S3 resume.
969 Reads the range of PCI configuration registers specified by StartAddress and
970 Size into the buffer specified by Buffer. This function only allows the PCI
971 configuration registers from a single PCI function to be read. Size is
972 returned. When possible 32-bit PCI configuration read cycles are used to read
973 from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
974 and 16-bit PCI configuration read cycles may be used at the beginning and the
977 If any reserved bits in StartAddress are set, then ASSERT().
978 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
979 If Size > 0 and Buffer is NULL, then ASSERT().
981 @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,
982 Function and Register.
983 @param Size Size in bytes of the transfer.
984 @param Buffer Pointer to a buffer receiving the data read.
991 S3PciSegmentReadBuffer (
992 IN UINT64 StartAddress
,
998 Copies the data in a caller supplied buffer to a specified range of PCI
999 configuration space, and saves the value in the S3 script to be replayed on S3
1002 Writes the range of PCI configuration registers specified by StartAddress and
1003 Size from the buffer specified by Buffer. This function only allows the PCI
1004 configuration registers from a single PCI function to be written. Size is
1005 returned. When possible 32-bit PCI configuration write cycles are used to
1006 write from StartAdress to StartAddress + Size. Due to alignment restrictions,
1007 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
1008 and the end of the range.
1010 If any reserved bits in StartAddress are set, then ASSERT().
1011 If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
1012 If Size > 0 and Buffer is NULL, then ASSERT().
1014 @param StartAddress Starting address that encodes the PCI Segment, Bus, Device,
1015 Function and Register.
1016 @param Size Size in bytes of the transfer.
1017 @param Buffer Pointer to a buffer containing the data to write.
1019 @return The parameter of Size.
1024 S3PciSegmentWriteBuffer (
1025 IN UINT64 StartAddress
,