2 I/O and MMIO Library Services that do I/O and also enable the I/O operatation
3 to be replayed during an S3 resume.
5 Copyright (c) 2006 -2012, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions
9 of the BSD License which accompanies this distribution. The
10 full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Library/S3IoLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/IoLib.h>
23 #include <Library/S3BootScriptLib.h>
27 Saves an I/O port value to the boot script.
29 This internal worker function saves an I/O port value in the S3 script
30 to be replayed on S3 resume.
32 If the saving process fails, then ASSERT().
34 @param Width The width of I/O port.
35 @param Port The I/O port to write.
36 @param Buffer The buffer containing value.
40 InternalSaveIoWriteValueToBootScript (
41 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
48 Status
= S3BootScriptSaveIoWrite (
54 ASSERT (Status
== RETURN_SUCCESS
);
58 Saves an 8-bit I/O port value to the boot script.
60 This internal worker function saves an 8-bit I/O port value in the S3 script
61 to be replayed on S3 resume.
63 If the saving process fails, then ASSERT().
65 @param Port The I/O port to write.
66 @param Value The value saved to boot script.
72 InternalSaveIoWrite8ValueToBootScript (
77 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint8
, Port
, &Value
);
83 Reads an 8-bit I/O port and saves the value in the S3 script to be replayed
86 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
87 This function must guarantee that all I/O read and write operations are
90 If 8-bit I/O port operations are not supported, then ASSERT().
92 @param Port The I/O port to read.
94 @return The value read.
103 return InternalSaveIoWrite8ValueToBootScript (Port
, IoRead8 (Port
));
107 Writes an 8-bit I/O port and saves the value in the S3 script to be replayed
110 Writes the 8-bit I/O port specified by Port with the value specified by Value
111 and returns Value. This function must guarantee that all I/O read and write
112 operations are serialized.
114 If 8-bit I/O port operations are not supported, then ASSERT().
116 @param Port The I/O port to write.
117 @param Value The value to write to the I/O port.
119 @return The value written the I/O port.
129 return InternalSaveIoWrite8ValueToBootScript (Port
, IoWrite8 (Port
, Value
));
133 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
134 result back to the 8-bit I/O port and saves the value in the S3 script to be
135 replayed on S3 resume.
137 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
138 between the read result and the value specified by OrData, and writes the
139 result to the 8-bit I/O port specified by Port. The value written to the I/O
140 port is returned. This function must guarantee that all I/O read and write
141 operations are serialized.
143 If 8-bit I/O port operations are not supported, then ASSERT().
145 @param Port The I/O port to write.
146 @param OrData The value to OR with the read value from the I/O port.
148 @return The value written back to the I/O port.
158 return InternalSaveIoWrite8ValueToBootScript (Port
, IoOr8 (Port
, OrData
));
162 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
163 to the 8-bit I/O port and saves the value in the S3 script to be replayed
166 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
167 the read result and the value specified by AndData, and writes the result to
168 the 8-bit I/O port specified by Port. The value written to the I/O port is
169 returned. This function must guarantee that all I/O read and write operations
172 If 8-bit I/O port operations are not supported, then ASSERT().
174 @param Port The I/O port to write.
175 @param AndData The value to AND with the read value from the I/O port.
177 @return The value written back to the I/O port.
187 return InternalSaveIoWrite8ValueToBootScript (Port
, IoAnd8 (Port
, AndData
));
191 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
192 inclusive OR, and writes the result back to the 8-bit I/O port and saves
193 the value in the S3 script to be replayed on S3 resume.
195 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
196 the read result and the value specified by AndData, performs a bitwise OR
197 between the result of the AND operation and the value specified by OrData,
198 and writes the result to the 8-bit I/O port specified by Port. The value
199 written to the I/O port is returned. This function must guarantee that all
200 I/O read and write operations are serialized.
202 If 8-bit I/O port operations are not supported, then ASSERT().
204 @param Port The I/O port to write.
205 @param AndData The value to AND with the read value from the I/O port.
206 @param OrData The value to OR with the result of the AND operation.
208 @return The value written back to the I/O port.
219 return InternalSaveIoWrite8ValueToBootScript (Port
, IoAndThenOr8 (Port
, AndData
, OrData
));
223 Reads a bit field of an I/O register and saves the value in the S3 script to
224 be replayed on S3 resume.
226 Reads the bit field in an 8-bit I/O register. The bit field is specified by
227 the StartBit and the EndBit. The value of the bit field is returned.
229 If 8-bit I/O port operations are not supported, then ASSERT().
230 If StartBit is greater than 7, then ASSERT().
231 If EndBit is greater than 7, then ASSERT().
232 If EndBit is less than StartBit, then ASSERT().
234 @param Port The I/O port to read.
235 @param StartBit The ordinal of the least significant bit in the bit field.
237 @param EndBit The ordinal of the most significant bit in the bit field.
240 @return The value read.
251 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldRead8 (Port
, StartBit
, EndBit
));
255 Writes a bit field to an I/O register and saves the value in the S3 script to
256 be replayed on S3 resume.
258 Writes Value to the bit field of the I/O register. The bit field is specified
259 by the StartBit and the EndBit. All other bits in the destination I/O
260 register are preserved. The value written to the I/O port is returned. Extra
261 left bits in Value are stripped.
263 If 8-bit I/O port operations are not supported, then ASSERT().
264 If StartBit is greater than 7, then ASSERT().
265 If EndBit is greater than 7, then ASSERT().
266 If EndBit is less than StartBit, then ASSERT().
267 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
269 @param Port The I/O port to write.
270 @param StartBit The ordinal of the least significant bit in the bit field.
272 @param EndBit The ordinal of the most significant bit in the bit field.
274 @param Value New value of the bit field.
276 @return The value written back to the I/O port.
288 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldWrite8 (Port
, StartBit
, EndBit
, Value
));
292 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
293 result back to the bit field in the 8-bit port and saves the value in the
294 S3 script to be replayed on S3 resume.
296 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
297 between the read result and the value specified by OrData, and writes the
298 result to the 8-bit I/O port specified by Port. The value written to the I/O
299 port is returned. This function must guarantee that all I/O read and write
300 operations are serialized. Extra left bits in OrData are stripped.
302 If 8-bit I/O port operations are not supported, 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
308 @param Port The I/O port 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 OrData The value to OR with the read value from the I/O port.
315 @return The value written back to the I/O port.
327 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldOr8 (Port
, StartBit
, EndBit
, OrData
));
331 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
332 result back to the bit field in the 8-bit port and saves the value in the
333 S3 script to be replayed on S3 resume.
335 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
336 the read result and the value specified by AndData, and writes the result to
337 the 8-bit I/O port specified by Port. The value written to the I/O port is
338 returned. This function must guarantee that all I/O read and write operations
339 are serialized. Extra left bits in AndData are stripped.
341 If 8-bit I/O port operations are not supported, then ASSERT().
342 If StartBit is greater than 7, then ASSERT().
343 If EndBit is greater than 7, then ASSERT().
344 If EndBit is less than StartBit, then ASSERT().
345 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
347 @param Port The I/O port 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 read value from the I/O port.
354 @return The value written back to the I/O port.
366 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldAnd8 (Port
, StartBit
, EndBit
, AndData
));
370 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
371 bitwise OR, and writes the result back to the bit field in the
372 8-bit port and saves the value in the S3 script to be replayed on S3 resume.
374 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
375 by a bitwise OR between the read result and the value specified by
376 AndData, and writes the result to the 8-bit I/O port specified by Port. The
377 value written to the I/O port is returned. This function must guarantee that
378 all I/O read and write operations are serialized. Extra left bits in both
379 AndData and OrData are stripped.
381 If 8-bit I/O port operations are not supported, then ASSERT().
382 If StartBit is greater than 7, then ASSERT().
383 If EndBit is greater than 7, then ASSERT().
384 If EndBit is less than StartBit, then ASSERT().
385 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
386 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
388 @param Port The I/O port to write.
389 @param StartBit The ordinal of the least significant bit in the bit field.
391 @param EndBit The ordinal of the most significant bit in the bit field.
393 @param AndData The value to AND with the read value from the I/O port.
394 @param OrData The value to OR with the result of the AND operation.
396 @return The value written back to the I/O port.
401 S3IoBitFieldAndThenOr8 (
409 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldAndThenOr8 (Port
, StartBit
, EndBit
, AndData
, OrData
));
413 Saves a 16-bit I/O port value to the boot script.
415 This internal worker function saves a 16-bit I/O port value in the S3 script
416 to be replayed on S3 resume.
418 If the saving process fails, then ASSERT().
420 @param Port The I/O port to write.
421 @param Value The value saved to boot script.
427 InternalSaveIoWrite16ValueToBootScript (
432 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint16
, Port
, &Value
);
438 Reads a 16-bit I/O port and saves the value in the S3 script to be replayed
441 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
442 This function must guarantee that all I/O read and write operations are
445 If 16-bit I/O port operations are not supported, then ASSERT().
447 @param Port The I/O port to read.
449 @return The value read.
458 return InternalSaveIoWrite16ValueToBootScript (Port
, IoRead16 (Port
));
462 Writes a 16-bit I/O port and saves the value in the S3 script to be replayed
465 Writes the 16-bit I/O port specified by Port with the value specified by Value
466 and returns Value. This function must guarantee that all I/O read and write
467 operations are serialized.
469 If 16-bit I/O port operations are not supported, then ASSERT().
471 @param Port The I/O port to write.
472 @param Value The value to write to the I/O port.
474 @return The value written the I/O port.
484 return InternalSaveIoWrite16ValueToBootScript (Port
, IoWrite16 (Port
, Value
));
488 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
489 result back to the 16-bit I/O port and saves the value in the S3 script to
490 be replayed on S3 resume.
492 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
493 between the read result and the value specified by OrData, and writes the
494 result to the 16-bit I/O port specified by Port. The value written to the I/O
495 port is returned. This function must guarantee that all I/O read and write
496 operations are serialized.
498 If 16-bit I/O port operations are not supported, then ASSERT().
500 @param Port The I/O port to write.
501 @param OrData The value to OR with the read value from the I/O port.
503 @return The value written back to the I/O port.
513 return InternalSaveIoWrite16ValueToBootScript (Port
, IoOr16 (Port
, OrData
));
517 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
518 to the 16-bit I/O port and saves the value in the S3 script to be replayed
521 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
522 the read result and the value specified by AndData, and writes the result to
523 the 16-bit I/O port specified by Port. The value written to the I/O port is
524 returned. This function must guarantee that all I/O read and write operations
527 If 16-bit I/O port operations are not supported, then ASSERT().
529 @param Port The I/O port to write.
530 @param AndData The value to AND with the read value from the I/O port.
532 @return The value written back to the I/O port.
542 return InternalSaveIoWrite16ValueToBootScript (Port
, IoAnd16 (Port
, AndData
));
546 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
547 inclusive OR, and writes the result back to the 16-bit I/O port and saves
548 the value in the S3 script to be replayed on S3 resume.
550 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
551 the read result and the value specified by AndData, performs a bitwise OR
552 between the result of the AND operation and the value specified by OrData,
553 and writes the result to the 16-bit I/O port specified by Port. The value
554 written to the I/O port is returned. This function must guarantee that all
555 I/O read and write operations are serialized.
557 If 16-bit I/O port operations are not supported, then ASSERT().
559 @param Port The I/O port to write.
560 @param AndData The value to AND with the read value from the I/O port.
561 @param OrData The value to OR with the result of the AND operation.
563 @return The value written back to the I/O port.
574 return InternalSaveIoWrite16ValueToBootScript (Port
, IoAndThenOr16 (Port
, AndData
, OrData
));
578 Reads a bit field of an I/O register saves the value in the S3 script to be
579 replayed on S3 resume.
581 Reads the bit field in a 16-bit I/O register. The bit field is specified by
582 the StartBit and the EndBit. The value of the bit field is returned.
584 If 16-bit I/O port operations are not supported, then ASSERT().
585 If StartBit is greater than 15, then ASSERT().
586 If EndBit is greater than 15, then ASSERT().
587 If EndBit is less than StartBit, then ASSERT().
589 @param Port The I/O port to read.
590 @param StartBit The ordinal of the least significant bit in the bit field.
592 @param EndBit The ordinal of the most significant bit in the bit field.
595 @return The value read.
606 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldRead16 (Port
, StartBit
, EndBit
));
610 Writes a bit field to an I/O register and saves the value in the S3 script
611 to be replayed on S3 resume.
613 Writes Value to the bit field of the I/O register. The bit field is specified
614 by the StartBit and the EndBit. All other bits in the destination I/O
615 register are preserved. The value written to the I/O port is returned. Extra
616 left bits in Value are stripped.
618 If 16-bit I/O port operations are not supported, then ASSERT().
619 If StartBit is greater than 15, then ASSERT().
620 If EndBit is greater than 15, then ASSERT().
621 If EndBit is less than StartBit, then ASSERT().
622 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
624 @param Port The I/O port to write.
625 @param StartBit The ordinal of the least significant bit in the bit field.
627 @param EndBit The ordinal of the most significant bit in the bit field.
629 @param Value New value of the bit field.
631 @return The value written back to the I/O port.
636 S3IoBitFieldWrite16 (
643 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldWrite16 (Port
, StartBit
, EndBit
, Value
));
647 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
648 result back to the bit field in the 16-bit port and saves the value in the
649 S3 script to be replayed on S3 resume.
651 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
652 between the read result and the value specified by OrData, and writes the
653 result to the 16-bit I/O port specified by Port. The value written to the I/O
654 port is returned. This function must guarantee that all I/O read and write
655 operations are serialized. Extra left bits in OrData are stripped.
657 If 16-bit I/O port operations are not supported, then ASSERT().
658 If StartBit is greater than 15, then ASSERT().
659 If EndBit is greater than 15, then ASSERT().
660 If EndBit is less than StartBit, then ASSERT().
661 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
663 @param Port The I/O port to write.
664 @param StartBit The ordinal of the least significant bit in the bit field.
666 @param EndBit The ordinal of the most significant bit in the bit field.
668 @param OrData The value to OR with the read value from the I/O port.
670 @return The value written back to the I/O port.
682 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldOr16 (Port
, StartBit
, EndBit
, OrData
));
686 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
687 result back to the bit field in the 16-bit port and saves the value in the
688 S3 script to be replayed on S3 resume.
690 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
691 the read result and the value specified by AndData, and writes the result to
692 the 16-bit I/O port specified by Port. The value written to the I/O port is
693 returned. This function must guarantee that all I/O read and write operations
694 are serialized. Extra left bits in AndData are stripped.
696 If 16-bit I/O port operations are not supported, then ASSERT().
697 If StartBit is greater than 15, then ASSERT().
698 If EndBit is greater than 15, then ASSERT().
699 If EndBit is less than StartBit, then ASSERT().
700 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
702 @param Port The I/O port to write.
703 @param StartBit The ordinal of the least significant bit in the bit field.
705 @param EndBit The ordinal of the most significant bit in the bit field.
707 @param AndData The value to AND with the read value from the I/O port.
709 @return The value written back to the I/O port.
721 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldAnd16 (Port
, StartBit
, EndBit
, AndData
));
725 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
726 bitwise OR, and writes the result back to the bit field in the
727 16-bit port and saves the value in the S3 script to be replayed on S3
730 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
731 by a bitwise OR between the read result and the value specified by
732 AndData, and writes the result to the 16-bit I/O port specified by Port. The
733 value written to the I/O port is returned. This function must guarantee that
734 all I/O read and write operations are serialized. Extra left bits in both
735 AndData and OrData are stripped.
737 If 16-bit I/O port operations are not supported, then ASSERT().
738 If StartBit is greater than 15, then ASSERT().
739 If EndBit is greater than 15, then ASSERT().
740 If EndBit is less than StartBit, then ASSERT().
741 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
742 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
744 @param Port The I/O port to write.
745 @param StartBit The ordinal of the least significant bit in the bit field.
747 @param EndBit The ordinal of the most significant bit in the bit field.
749 @param AndData The value to AND with the read value from the I/O port.
750 @param OrData The value to OR with the result of the AND operation.
752 @return The value written back to the I/O port.
757 S3IoBitFieldAndThenOr16 (
765 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldAndThenOr16 (Port
, StartBit
, EndBit
, AndData
, OrData
));
769 Saves a 32-bit I/O port value to the boot script.
771 This internal worker function saves a 32-bit I/O port value in the S3 script
772 to be replayed on S3 resume.
774 If the saving process fails, then ASSERT().
776 @param Port The I/O port to write.
777 @param Value The value saved to boot script.
783 InternalSaveIoWrite32ValueToBootScript (
788 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint32
, Port
, &Value
);
794 Reads a 32-bit I/O port and saves the value in the S3 script to be replayed
797 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
798 This function must guarantee that all I/O read and write operations are
801 If 32-bit I/O port operations are not supported, then ASSERT().
803 @param Port The I/O port to read.
805 @return The value read.
814 return InternalSaveIoWrite32ValueToBootScript (Port
, IoRead32 (Port
));
818 Writes a 32-bit I/O port and saves the value in the S3 script to be replayed
821 Writes the 32-bit I/O port specified by Port with the value specified by Value
822 and returns Value. This function must guarantee that all I/O read and write
823 operations are serialized.
825 If 32-bit I/O port operations are not supported, then ASSERT().
827 @param Port The I/O port to write.
828 @param Value The value to write to the I/O port.
830 @return The value written the I/O port.
840 return InternalSaveIoWrite32ValueToBootScript (Port
, IoWrite32 (Port
, Value
));
844 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
845 result back to the 32-bit I/O port and saves the value in the S3 script to
846 be replayed on S3 resume.
848 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
849 between the read result and the value specified by OrData, and writes the
850 result to the 32-bit I/O port specified by Port. The value written to the I/O
851 port is returned. This function must guarantee that all I/O read and write
852 operations are serialized.
854 If 32-bit I/O port operations are not supported, then ASSERT().
856 @param Port The I/O port to write.
857 @param OrData The value to OR with the read value from the I/O port.
859 @return The value written back to the I/O port.
869 return InternalSaveIoWrite32ValueToBootScript (Port
, IoOr32 (Port
, OrData
));
873 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
874 to the 32-bit I/O port and saves the value in the S3 script to be replayed
877 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
878 the read result and the value specified by AndData, and writes the result to
879 the 32-bit I/O port specified by Port. The value written to the I/O port is
880 returned. This function must guarantee that all I/O read and write operations
883 If 32-bit I/O port operations are not supported, then ASSERT().
885 @param Port The I/O port to write.
886 @param AndData The value to AND with the read value from the I/O port.
888 @return The value written back to the I/O port.
898 return InternalSaveIoWrite32ValueToBootScript (Port
, IoAnd32 (Port
, AndData
));
902 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
903 inclusive OR, and writes the result back to the 32-bit I/O port and saves
904 the value in the S3 script to be replayed on S3 resume.
906 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
907 the read result and the value specified by AndData, performs a bitwise OR
908 between the result of the AND operation and the value specified by OrData,
909 and writes the result to the 32-bit I/O port specified by Port. The value
910 written to the I/O port is returned. This function must guarantee that all
911 I/O read and write operations are serialized.
913 If 32-bit I/O port operations are not supported, then ASSERT().
915 @param Port The I/O port to write.
916 @param AndData The value to AND with the read value from the I/O port.
917 @param OrData The value to OR with the result of the AND operation.
919 @return The value written back to the I/O port.
930 return InternalSaveIoWrite32ValueToBootScript (Port
, IoAndThenOr32 (Port
, AndData
, OrData
));
934 Reads a bit field of an I/O register and saves the value in the S3 script to
935 be replayed on S3 resume.
937 Reads the bit field in a 32-bit I/O register. The bit field is specified by
938 the StartBit and the EndBit. The value of the bit field is returned.
940 If 32-bit I/O port operations are not supported, then ASSERT().
941 If StartBit is greater than 31, then ASSERT().
942 If EndBit is greater than 31, then ASSERT().
943 If EndBit is less than StartBit, then ASSERT().
945 @param Port The I/O port to read.
946 @param StartBit The ordinal of the least significant bit in the bit field.
948 @param EndBit The ordinal of the most significant bit in the bit field.
951 @return The value read.
962 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldRead32 (Port
, StartBit
, EndBit
));
966 Writes a bit field to an I/O register and saves the value in the S3 script to
967 be replayed on S3 resume.
969 Writes Value to the bit field of the I/O register. The bit field is specified
970 by the StartBit and the EndBit. All other bits in the destination I/O
971 register are preserved. The value written to the I/O port is returned. Extra
972 left bits in Value are stripped.
974 If 32-bit I/O port operations are not supported, then ASSERT().
975 If StartBit is greater than 31, then ASSERT().
976 If EndBit is greater than 31, then ASSERT().
977 If EndBit is less than StartBit, then ASSERT().
978 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
980 @param Port The I/O port to write.
981 @param StartBit The ordinal of the least significant bit in the bit field.
983 @param EndBit The ordinal of the most significant bit in the bit field.
985 @param Value New value of the bit field.
987 @return The value written back to the I/O port.
992 S3IoBitFieldWrite32 (
999 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldWrite32 (Port
, StartBit
, EndBit
, Value
));
1003 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
1004 result back to the bit field in the 32-bit port and saves the value in the
1005 S3 script to be replayed on S3 resume.
1007 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
1008 between the read result and the value specified by OrData, and writes the
1009 result to the 32-bit I/O port specified by Port. The value written to the I/O
1010 port is returned. This function must guarantee that all I/O read and write
1011 operations are serialized. Extra left bits in OrData are stripped.
1013 If 32-bit I/O port operations are not supported, then ASSERT().
1014 If StartBit is greater than 31, then ASSERT().
1015 If EndBit is greater than 31, then ASSERT().
1016 If EndBit is less than StartBit, then ASSERT().
1017 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1019 @param Port The I/O port to write.
1020 @param StartBit The ordinal of the least significant bit in the bit field.
1022 @param EndBit The ordinal of the most significant bit in the bit field.
1024 @param OrData The value to OR with the read value from the I/O port.
1026 @return The value written back to the I/O port.
1038 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldOr32 (Port
, StartBit
, EndBit
, OrData
));
1042 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
1043 result back to the bit field in the 32-bit port and saves the value in the
1044 S3 script to be replayed on S3 resume.
1046 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
1047 the read result and the value specified by AndData, and writes the result to
1048 the 32-bit I/O port specified by Port. The value written to the I/O port is
1049 returned. This function must guarantee that all I/O read and write operations
1050 are serialized. Extra left bits in AndData are stripped.
1052 If 32-bit I/O port operations are not supported, then ASSERT().
1053 If StartBit is greater than 31, then ASSERT().
1054 If EndBit is greater than 31, then ASSERT().
1055 If EndBit is less than StartBit, then ASSERT().
1056 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1058 @param Port The I/O port to write.
1059 @param StartBit The ordinal of the least significant bit in the bit field.
1061 @param EndBit The ordinal of the most significant bit in the bit field.
1063 @param AndData The value to AND with the read value from the I/O port.
1065 @return The value written back to the I/O port.
1077 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldAnd32 (Port
, StartBit
, EndBit
, AndData
));
1081 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
1082 bitwise OR, and writes the result back to the bit field in the
1083 32-bit port and saves the value in the S3 script to be replayed on S3
1086 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
1087 by a bitwise OR between the read result and the value specified by
1088 AndData, and writes the result to the 32-bit I/O port specified by Port. The
1089 value written to the I/O port is returned. This function must guarantee that
1090 all I/O read and write operations are serialized. Extra left bits in both
1091 AndData and OrData are stripped.
1093 If 32-bit I/O port operations are not supported, then ASSERT().
1094 If StartBit is greater than 31, then ASSERT().
1095 If EndBit is greater than 31, then ASSERT().
1096 If EndBit is less than StartBit, then ASSERT().
1097 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1098 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1100 @param Port The I/O port to write.
1101 @param StartBit The ordinal of the least significant bit in the bit field.
1103 @param EndBit The ordinal of the most significant bit in the bit field.
1105 @param AndData The value to AND with the read value from the I/O port.
1106 @param OrData The value to OR with the result of the AND operation.
1108 @return The value written back to the I/O port.
1113 S3IoBitFieldAndThenOr32 (
1121 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldAndThenOr32 (Port
, StartBit
, EndBit
, AndData
, OrData
));
1125 Saves a 64-bit I/O port value to the boot script.
1127 This internal worker function saves a 64-bit I/O port value in the S3 script
1128 to be replayed on S3 resume.
1130 If the saving process fails, then ASSERT().
1132 @param Port The I/O port to write.
1133 @param Value The value saved to boot script.
1139 InternalSaveIoWrite64ValueToBootScript (
1144 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint64
, Port
, &Value
);
1150 Reads a 64-bit I/O port and saves the value in the S3 script to be replayed
1153 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
1154 This function must guarantee that all I/O read and write operations are
1157 If 64-bit I/O port operations are not supported, then ASSERT().
1159 @param Port The I/O port to read.
1161 @return The value read.
1170 return InternalSaveIoWrite64ValueToBootScript (Port
, IoRead64 (Port
));
1174 Writes a 64-bit I/O port and saves the value in the S3 script to be replayed
1177 Writes the 64-bit I/O port specified by Port with the value specified by Value
1178 and returns Value. This function must guarantee that all I/O read and write
1179 operations are serialized.
1181 If 64-bit I/O port operations are not supported, then ASSERT().
1183 @param Port The I/O port to write.
1184 @param Value The value to write to the I/O port.
1186 @return The value written the I/O port.
1196 return InternalSaveIoWrite64ValueToBootScript (Port
, IoWrite64 (Port
, Value
));
1200 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
1201 result back to the 64-bit I/O port and saves the value in the S3 script to
1202 be replayed on S3 resume.
1204 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1205 between the read result and the value specified by OrData, and writes the
1206 result to the 64-bit I/O port specified by Port. The value written to the I/O
1207 port is returned. This function must guarantee that all I/O read and write
1208 operations are serialized.
1210 If 64-bit I/O port operations are not supported, then ASSERT().
1212 @param Port The I/O port to write.
1213 @param OrData The value to OR with the read value from the I/O port.
1215 @return The value written back to the I/O port.
1225 return InternalSaveIoWrite64ValueToBootScript (Port
, IoOr64 (Port
, OrData
));
1229 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
1230 to the 64-bit I/O port and saves the value in the S3 script to be replayed
1233 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1234 the read result and the value specified by AndData, and writes the result to
1235 the 64-bit I/O port specified by Port. The value written to the I/O port is
1236 returned. This function must guarantee that all I/O read and write operations
1239 If 64-bit I/O port operations are not supported, then ASSERT().
1241 @param Port The I/O port to write.
1242 @param AndData The value to AND with the read value from the I/O port.
1244 @return The value written back to the I/O port.
1254 return InternalSaveIoWrite64ValueToBootScript (Port
, IoAnd64 (Port
, AndData
));
1258 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
1259 inclusive OR, and writes the result back to the 64-bit I/O port and saves
1260 the value in the S3 script to be replayed on S3 resume.
1262 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1263 the read result and the value specified by AndData, performs a bitwise OR
1264 between the result of the AND operation and the value specified by OrData,
1265 and writes the result to the 64-bit I/O port specified by Port. The value
1266 written to the I/O port is returned. This function must guarantee that all
1267 I/O read and write operations are serialized.
1269 If 64-bit I/O port operations are not supported, then ASSERT().
1271 @param Port The I/O port to write.
1272 @param AndData The value to AND with the read value from the I/O port.
1273 @param OrData The value to OR with the result of the AND operation.
1275 @return The value written back to the I/O port.
1286 return InternalSaveIoWrite64ValueToBootScript (Port
, IoAndThenOr64 (Port
, AndData
, OrData
));
1290 Reads a bit field of an I/O register and saves the value in the S3 script to
1291 be replayed on S3 resume.
1293 Reads the bit field in a 64-bit I/O register. The bit field is specified by
1294 the StartBit and the EndBit. The value of the bit field is returned.
1296 If 64-bit I/O port operations are not supported, then ASSERT().
1297 If StartBit is greater than 63, then ASSERT().
1298 If EndBit is greater than 63, then ASSERT().
1299 If EndBit is less than StartBit, then ASSERT().
1301 @param Port The I/O port to read.
1302 @param StartBit The ordinal of the least significant bit in the bit field.
1304 @param EndBit The ordinal of the most significant bit in the bit field.
1307 @return The value read.
1312 S3IoBitFieldRead64 (
1318 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldRead64 (Port
, StartBit
, EndBit
));
1322 Writes a bit field to an I/O register and saves the value in the S3 script to
1323 be replayed on S3 resume.
1325 Writes Value to the bit field of the I/O register. The bit field is specified
1326 by the StartBit and the EndBit. All other bits in the destination I/O
1327 register are preserved. The value written to the I/O port is returned. Extra
1328 left bits in Value are stripped.
1330 If 64-bit I/O port operations are not supported, then ASSERT().
1331 If StartBit is greater than 63, then ASSERT().
1332 If EndBit is greater than 63, then ASSERT().
1333 If EndBit is less than StartBit, then ASSERT().
1334 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1336 @param Port The I/O port to write.
1337 @param StartBit The ordinal of the least significant bit in the bit field.
1339 @param EndBit The ordinal of the most significant bit in the bit field.
1341 @param Value New value of the bit field.
1343 @return The value written back to the I/O port.
1348 S3IoBitFieldWrite64 (
1355 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldWrite64 (Port
, StartBit
, EndBit
, Value
));
1359 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1360 result back to the bit field in the 64-bit port and saves the value in the
1361 S3 script to be replayed on S3 resume.
1363 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1364 between the read result and the value specified by OrData, and writes the
1365 result to the 64-bit I/O port specified by Port. The value written to the I/O
1366 port is returned. This function must guarantee that all I/O read and write
1367 operations are serialized. Extra left bits in OrData are stripped.
1369 If 64-bit I/O port operations are not supported, then ASSERT().
1370 If StartBit is greater than 63, then ASSERT().
1371 If EndBit is greater than 63, then ASSERT().
1372 If EndBit is less than StartBit, then ASSERT().
1373 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1375 @param Port The I/O port to write.
1376 @param StartBit The ordinal of the least significant bit in the bit field.
1378 @param EndBit The ordinal of the most significant bit in the bit field.
1380 @param OrData The value to OR with the read value from the I/O port.
1382 @return The value written back to the I/O port.
1394 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldOr64 (Port
, StartBit
, EndBit
, OrData
));
1398 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1399 result back to the bit field in the 64-bit port and saves the value in the
1400 S3 script to be replayed on S3 resume.
1402 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1403 the read result and the value specified by AndData, and writes the result to
1404 the 64-bit I/O port specified by Port. The value written to the I/O port is
1405 returned. This function must guarantee that all I/O read and write operations
1406 are serialized. Extra left bits in AndData are stripped.
1408 If 64-bit I/O port operations are not supported, then ASSERT().
1409 If StartBit is greater than 63, then ASSERT().
1410 If EndBit is greater than 63, then ASSERT().
1411 If EndBit is less than StartBit, then ASSERT().
1412 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1414 @param Port The I/O port to write.
1415 @param StartBit The ordinal of the least significant bit in the bit field.
1417 @param EndBit The ordinal of the most significant bit in the bit field.
1419 @param AndData The value to AND with the read value from the I/O port.
1421 @return The value written back to the I/O port.
1433 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldAnd64 (Port
, StartBit
, EndBit
, AndData
));
1437 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1438 bitwise OR, and writes the result back to the bit field in the
1439 64-bit port and saves the value in the S3 script to be replayed on S3
1442 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1443 by a bitwise OR between the read result and the value specified by
1444 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1445 value written to the I/O port is returned. This function must guarantee that
1446 all I/O read and write operations are serialized. Extra left bits in both
1447 AndData and OrData are stripped.
1449 If 64-bit I/O port operations are not supported, then ASSERT().
1450 If StartBit is greater than 63, then ASSERT().
1451 If EndBit is greater than 63, then ASSERT().
1452 If EndBit is less than StartBit, then ASSERT().
1453 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1454 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1456 @param Port The I/O port to write.
1457 @param StartBit The ordinal of the least significant bit in the bit field.
1459 @param EndBit The ordinal of the most significant bit in the bit field.
1461 @param AndData The value to AND with the read value from the I/O port.
1462 @param OrData The value to OR with the result of the AND operation.
1464 @return The value written back to the I/O port.
1469 S3IoBitFieldAndThenOr64 (
1477 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldAndThenOr64 (Port
, StartBit
, EndBit
, AndData
, OrData
));
1481 Saves an MMIO register value to the boot script.
1483 This internal worker function saves an MMIO register value in the S3 script
1484 to be replayed on S3 resume.
1486 If the saving process fails, then ASSERT().
1488 @param Width The width of MMIO register.
1489 @param Address The MMIO register to write.
1490 @param Buffer The buffer containing value.
1494 InternalSaveMmioWriteValueToBootScript (
1495 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
1500 RETURN_STATUS Status
;
1502 Status
= S3BootScriptSaveMemWrite (
1508 ASSERT (Status
== RETURN_SUCCESS
);
1512 Saves an 8-bit MMIO register value to the boot script.
1514 This internal worker function saves an 8-bit MMIO register value in the S3 script
1515 to be replayed on S3 resume.
1517 If the saving process fails, then ASSERT().
1519 @param Address The MMIO register to write.
1520 @param Value The value saved to boot script.
1526 InternalSaveMmioWrite8ValueToBootScript (
1531 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint8
, Address
, &Value
);
1537 Reads an 8-bit MMIO register and saves the value in the S3 script to be
1538 replayed on S3 resume.
1540 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
1541 returned. This function must guarantee that all MMIO read and write
1542 operations are serialized.
1544 If 8-bit MMIO register operations are not supported, then ASSERT().
1546 @param Address The MMIO register to read.
1548 @return The value read.
1557 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioRead8 (Address
));
1561 Writes an 8-bit MMIO register and saves the value in the S3 script to be
1562 replayed on S3 resume.
1564 Writes the 8-bit MMIO register specified by Address with the value specified
1565 by Value and returns Value. This function must guarantee that all MMIO read
1566 and write operations are serialized.
1568 If 8-bit MMIO register operations are not supported, then ASSERT().
1570 @param Address The MMIO register to write.
1571 @param Value The value to write to the MMIO register.
1573 @return The value written the MMIO register.
1583 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioWrite8 (Address
, Value
));
1587 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1588 result back to the 8-bit MMIO register and saves the value in the S3 script
1589 to be replayed on S3 resume.
1591 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1592 inclusive OR between the read result and the value specified by OrData, and
1593 writes the result to the 8-bit MMIO register specified by Address. The value
1594 written to the MMIO register is returned. This function must guarantee that
1595 all MMIO read and write operations are serialized.
1597 If 8-bit MMIO register operations are not supported, then ASSERT().
1599 @param Address The MMIO register to write.
1600 @param OrData The value to OR with the read value from the MMIO register.
1602 @return The value written back to the MMIO register.
1612 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioOr8 (Address
, OrData
));
1616 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1617 back to the 8-bit MMIO register and saves the value in the S3 script to be
1618 replayed on S3 resume.
1620 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1621 between the read result and the value specified by AndData, and writes the
1622 result to the 8-bit MMIO register specified by Address. The value written to
1623 the MMIO register is returned. This function must guarantee that all MMIO
1624 read and write operations are serialized.
1626 If 8-bit MMIO register operations are not supported, then ASSERT().
1628 @param Address The MMIO register to write.
1629 @param AndData The value to AND with the read value from the MMIO register.
1631 @return The value written back to the MMIO register.
1641 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioAnd8 (Address
, AndData
));
1645 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1646 inclusive OR, and writes the result back to the 8-bit MMIO register and saves
1647 the value in the S3 script to be replayed on S3 resume.
1649 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1650 between the read result and the value specified by AndData, performs a
1651 bitwise OR between the result of the AND operation and the value specified by
1652 OrData, and writes the result to the 8-bit MMIO register specified by
1653 Address. The value written to the MMIO register is returned. This function
1654 must guarantee that all MMIO read and write operations are serialized.
1656 If 8-bit MMIO register operations are not supported, then ASSERT().
1658 @param Address The MMIO register to write.
1659 @param AndData The value to AND with the read value from the MMIO register.
1660 @param OrData The value to OR with the result of the AND operation.
1662 @return The value written back to the MMIO register.
1673 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioAndThenOr8 (Address
, AndData
, OrData
));
1677 Reads a bit field of a MMIO register and saves the value in the S3 script to
1678 be replayed on S3 resume.
1680 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1681 the StartBit and the EndBit. The value of the bit field is returned.
1683 If 8-bit MMIO register operations are not supported, then ASSERT().
1684 If StartBit is greater than 7, then ASSERT().
1685 If EndBit is greater than 7, then ASSERT().
1686 If EndBit is less than StartBit, then ASSERT().
1688 @param Address MMIO register to read.
1689 @param StartBit The ordinal of the least significant bit in the bit field.
1691 @param EndBit The ordinal of the most significant bit in the bit field.
1694 @return The value read.
1699 S3MmioBitFieldRead8 (
1705 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldRead8 (Address
, StartBit
, EndBit
));
1709 Writes a bit field to an MMIO register and saves the value in the S3 script to
1710 be replayed on S3 resume.
1712 Writes Value to the bit field of the MMIO register. The bit field is
1713 specified by the StartBit and the EndBit. All other bits in the destination
1714 MMIO register are preserved. The new value of the 8-bit register is returned.
1716 If 8-bit MMIO register operations are not supported, then ASSERT().
1717 If StartBit is greater than 7, then ASSERT().
1718 If EndBit is greater than 7, then ASSERT().
1719 If EndBit is less than StartBit, then ASSERT().
1720 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1722 @param Address The MMIO register to write.
1723 @param StartBit The ordinal of the least significant bit in the bit field.
1725 @param EndBit The ordinal of the most significant bit in the bit field.
1727 @param Value New value of the bit field.
1729 @return The value written back to the MMIO register.
1734 S3MmioBitFieldWrite8 (
1741 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldWrite8 (Address
, StartBit
, EndBit
, Value
));
1745 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1746 writes the result back to the bit field in the 8-bit MMIO register and saves
1747 the value in the S3 script to be replayed on S3 resume.
1749 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1750 inclusive OR between the read result and the value specified by OrData, and
1751 writes the result to the 8-bit MMIO register specified by Address. The value
1752 written to the MMIO register is returned. This function must guarantee that
1753 all MMIO read and write operations are serialized. Extra left bits in OrData
1756 If 8-bit MMIO register operations are not supported, then ASSERT().
1757 If StartBit is greater than 7, then ASSERT().
1758 If EndBit is greater than 7, then ASSERT().
1759 If EndBit is less than StartBit, then ASSERT().
1760 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1762 @param Address The MMIO register to write.
1763 @param StartBit The ordinal of the least significant bit in the bit field.
1765 @param EndBit The ordinal of the most significant bit in the bit field.
1767 @param OrData The value to OR with the read value from the MMIO register.
1769 @return The value written back to the MMIO register.
1781 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldOr8 (Address
, StartBit
, EndBit
, OrData
));
1785 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1786 writes the result back to the bit field in the 8-bit MMIO register and saves
1787 the value in the S3 script to be replayed on S3 resume.
1789 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1790 between the read result and the value specified by AndData, and writes the
1791 result to the 8-bit MMIO register specified by Address. The value written to
1792 the MMIO register is returned. This function must guarantee that all MMIO
1793 read and write operations are serialized. Extra left bits in AndData are
1796 If 8-bit MMIO register operations are not supported, then ASSERT().
1797 If StartBit is greater than 7, then ASSERT().
1798 If EndBit is greater than 7, then ASSERT().
1799 If EndBit is less than StartBit, then ASSERT().
1800 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1802 @param Address The MMIO register to write.
1803 @param StartBit The ordinal of the least significant bit in the bit field.
1805 @param EndBit The ordinal of the most significant bit in the bit field.
1807 @param AndData The value to AND with the read value from the MMIO register.
1809 @return The value written back to the MMIO register.
1814 S3MmioBitFieldAnd8 (
1821 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldAnd8 (Address
, StartBit
, EndBit
, AndData
));
1825 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1826 by a bitwise OR, and writes the result back to the bit field in the
1827 8-bit MMIO register and saves the value in the S3 script to be replayed
1830 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1831 followed by a bitwise OR between the read result and the value
1832 specified by AndData, and writes the result to the 8-bit MMIO register
1833 specified by Address. The value written to the MMIO register is returned.
1834 This function must guarantee that all MMIO read and write operations are
1835 serialized. Extra left bits in both AndData and OrData are stripped.
1837 If 8-bit MMIO register operations are not supported, then ASSERT().
1838 If StartBit is greater than 7, then ASSERT().
1839 If EndBit is greater than 7, then ASSERT().
1840 If EndBit is less than StartBit, then ASSERT().
1841 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1842 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1844 @param Address The MMIO register to write.
1845 @param StartBit The ordinal of the least significant bit in the bit field.
1847 @param EndBit The ordinal of the most significant bit in the bit field.
1849 @param AndData The value to AND with the read value from the MMIO register.
1850 @param OrData The value to OR with the result of the AND operation.
1852 @return The value written back to the MMIO register.
1857 S3MmioBitFieldAndThenOr8 (
1865 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldAndThenOr8 (Address
, StartBit
, EndBit
, AndData
, OrData
));
1869 Saves a 16-bit MMIO register value to the boot script.
1871 This internal worker function saves a 16-bit MMIO register value in the S3 script
1872 to be replayed on S3 resume.
1874 If the saving process fails, then ASSERT().
1876 @param Address The MMIO register to write.
1877 @param Value The value saved to boot script.
1883 InternalSaveMmioWrite16ValueToBootScript (
1888 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint16
, Address
, &Value
);
1894 Reads a 16-bit MMIO register and saves the value in the S3 script to be replayed
1897 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
1898 returned. This function must guarantee that all MMIO read and write
1899 operations are serialized.
1901 If 16-bit MMIO register operations are not supported, then ASSERT().
1903 @param Address The MMIO register to read.
1905 @return The value read.
1914 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioRead16 (Address
));
1918 Writes a 16-bit MMIO register and saves the value in the S3 script to be replayed
1921 Writes the 16-bit MMIO register specified by Address with the value specified
1922 by Value and returns Value. This function must guarantee that all MMIO read
1923 and write operations are serialized and saves the value in the S3 script to be
1924 replayed on S3 resume.
1926 If 16-bit MMIO register operations are not supported, then ASSERT().
1928 @param Address The MMIO register to write.
1929 @param Value The value to write to the MMIO register.
1931 @return The value written the MMIO register.
1941 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioWrite16 (Address
, Value
));
1945 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1946 result back to the 16-bit MMIO register and saves the value in the S3 script
1947 to be replayed on S3 resume.
1949 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1950 inclusive OR between the read result and the value specified by OrData, and
1951 writes the result to the 16-bit MMIO register specified by Address. The value
1952 written to the MMIO register is returned. This function must guarantee that
1953 all MMIO read and write operations are serialized.
1955 If 16-bit MMIO register operations are not supported, then ASSERT().
1957 @param Address The MMIO register to write.
1958 @param OrData The value to OR with the read value from the MMIO register.
1960 @return The value written back to the MMIO register.
1970 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioOr16 (Address
, OrData
));
1974 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1975 back to the 16-bit MMIO register and saves the value in the S3 script to be
1976 replayed on S3 resume.
1978 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1979 between the read result and the value specified by AndData, and writes the
1980 result to the 16-bit MMIO register specified by Address. The value written to
1981 the MMIO register is returned. This function must guarantee that all MMIO
1982 read and write operations are serialized.
1984 If 16-bit MMIO register operations are not supported, then ASSERT().
1986 @param Address The MMIO register to write.
1987 @param AndData The value to AND with the read value from the MMIO register.
1989 @return The value written back to the MMIO register.
1999 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioAnd16 (Address
, AndData
));
2003 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
2004 inclusive OR, and writes the result back to the 16-bit MMIO register and
2005 saves the value in the S3 script to be replayed on S3 resume.
2007 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
2008 between the read result and the value specified by AndData, performs a
2009 bitwise OR between the result of the AND operation and the value specified by
2010 OrData, and writes the result to the 16-bit MMIO register specified by
2011 Address. The value written to the MMIO register is returned. This function
2012 must guarantee that all MMIO read and write operations are serialized.
2014 If 16-bit MMIO register operations are not supported, then ASSERT().
2016 @param Address The MMIO register to write.
2017 @param AndData The value to AND with the read value from the MMIO register.
2018 @param OrData The value to OR with the result of the AND operation.
2020 @return The value written back to the MMIO register.
2031 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioAndThenOr16 (Address
, AndData
, OrData
));
2035 Reads a bit field of a MMIO register and saves the value in the S3 script to
2036 be replayed on S3 resume.
2038 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
2039 the StartBit and the EndBit. The value of the bit field is returned.
2041 If 16-bit MMIO register operations are not supported, then ASSERT().
2042 If StartBit is greater than 15, then ASSERT().
2043 If EndBit is greater than 15, then ASSERT().
2044 If EndBit is less than StartBit, then ASSERT().
2046 @param Address MMIO register to read.
2047 @param StartBit The ordinal of the least significant bit in the bit field.
2049 @param EndBit The ordinal of the most significant bit in the bit field.
2052 @return The value read.
2057 S3MmioBitFieldRead16 (
2063 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldRead16 (Address
, StartBit
, EndBit
));
2067 Writes a bit field to a MMIO register and saves the value in the S3 script to
2068 be replayed on S3 resume.
2070 Writes Value to the bit field of the MMIO register. The bit field is
2071 specified by the StartBit and the EndBit. All other bits in the destination
2072 MMIO register are preserved. The new value of the 16-bit register is returned.
2074 If 16-bit MMIO register operations are not supported, then ASSERT().
2075 If StartBit is greater than 15, then ASSERT().
2076 If EndBit is greater than 15, then ASSERT().
2077 If EndBit is less than StartBit, then ASSERT().
2078 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2080 @param Address The MMIO register to write.
2081 @param StartBit The ordinal of the least significant bit in the bit field.
2083 @param EndBit The ordinal of the most significant bit in the bit field.
2085 @param Value New value of the bit field.
2087 @return The value written back to the MMIO register.
2092 S3MmioBitFieldWrite16 (
2099 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldWrite16 (Address
, StartBit
, EndBit
, Value
));
2103 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
2104 writes the result back to the bit field in the 16-bit MMIO register and
2105 saves the value in the S3 script to be replayed on S3 resume.
2107 Reads the 16-bit MMIO register specified by Address, performs a bitwise
2108 inclusive OR between the read result and the value specified by OrData, and
2109 writes the result to the 16-bit MMIO register specified by Address. The value
2110 written to the MMIO register is returned. This function must guarantee that
2111 all MMIO read and write operations are serialized. Extra left bits in OrData
2114 If 16-bit MMIO register operations are not supported, then ASSERT().
2115 If StartBit is greater than 15, then ASSERT().
2116 If EndBit is greater than 15, then ASSERT().
2117 If EndBit is less than StartBit, then ASSERT().
2118 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2120 @param Address The MMIO register to write.
2121 @param StartBit The ordinal of the least significant bit in the bit field.
2123 @param EndBit The ordinal of the most significant bit in the bit field.
2125 @param OrData The value to OR with the read value from the MMIO register.
2127 @return The value written back to the MMIO register.
2132 S3MmioBitFieldOr16 (
2139 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldOr16 (Address
, StartBit
, EndBit
, OrData
));
2143 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
2144 writes the result back to the bit field in the 16-bit MMIO register and
2145 saves the value in the S3 script to be replayed on S3 resume.
2147 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
2148 between the read result and the value specified by AndData, and writes the
2149 result to the 16-bit MMIO register specified by Address. The value written to
2150 the MMIO register is returned. This function must guarantee that all MMIO
2151 read and write operations are serialized. Extra left bits in AndData are
2154 If 16-bit MMIO register operations are not supported, then ASSERT().
2155 If StartBit is greater than 15, then ASSERT().
2156 If EndBit is greater than 15, then ASSERT().
2157 If EndBit is less than StartBit, then ASSERT().
2158 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2160 @param Address The MMIO register to write.
2161 @param StartBit The ordinal of the least significant bit in the bit field.
2163 @param EndBit The ordinal of the most significant bit in the bit field.
2165 @param AndData The value to AND with the read value from the MMIO register.
2167 @return The value written back to the MMIO register.
2172 S3MmioBitFieldAnd16 (
2179 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldAnd16 (Address
, StartBit
, EndBit
, AndData
));
2183 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
2184 by a bitwise OR, and writes the result back to the bit field in the
2185 16-bit MMIO register and saves the value in the S3 script to be replayed
2188 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
2189 followed by a bitwise OR between the read result and the value
2190 specified by AndData, and writes the result to the 16-bit MMIO register
2191 specified by Address. The value written to the MMIO register is returned.
2192 This function must guarantee that all MMIO read and write operations are
2193 serialized. Extra left bits in both AndData and OrData are stripped.
2195 If 16-bit MMIO register operations are not supported, then ASSERT().
2196 If StartBit is greater than 15, then ASSERT().
2197 If EndBit is greater than 15, then ASSERT().
2198 If EndBit is less than StartBit, then ASSERT().
2199 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2200 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2202 @param Address The MMIO register to write.
2203 @param StartBit The ordinal of the least significant bit in the bit field.
2205 @param EndBit The ordinal of the most significant bit in the bit field.
2207 @param AndData The value to AND with the read value from the MMIO register.
2208 @param OrData The value to OR with the result of the AND operation.
2210 @return The value written back to the MMIO register.
2215 S3MmioBitFieldAndThenOr16 (
2223 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldAndThenOr16 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2227 Saves a 32-bit MMIO register value to the boot script.
2229 This internal worker function saves a 32-bit MMIO register value in the S3 script
2230 to be replayed on S3 resume.
2232 If the saving process fails, then ASSERT().
2234 @param Address The MMIO register to write.
2235 @param Value The value saved to boot script.
2241 InternalSaveMmioWrite32ValueToBootScript (
2246 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint32
, Address
, &Value
);
2252 Reads a 32-bit MMIO register saves the value in the S3 script to be
2253 replayed on S3 resume.
2255 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
2256 returned. This function must guarantee that all MMIO read and write
2257 operations are serialized.
2259 If 32-bit MMIO register operations are not supported, then ASSERT().
2261 @param Address The MMIO register to read.
2263 @return The value read.
2272 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioRead32 (Address
));
2276 Writes a 32-bit MMIO register and saves the value in the S3 script to be
2277 replayed on S3 resume.
2279 Writes the 32-bit MMIO register specified by Address with the value specified
2280 by Value and returns Value. This function must guarantee that all MMIO read
2281 and write operations are serialized.
2283 If 32-bit MMIO register operations are not supported, then ASSERT().
2285 @param Address The MMIO register to write.
2286 @param Value The value to write to the MMIO register.
2288 @return The value written the MMIO register.
2298 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioWrite32 (Address
, Value
));
2302 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
2303 result back to the 32-bit MMIO register and saves the value in the S3 script
2304 to be replayed on S3 resume.
2306 Reads the 32-bit MMIO register specified by Address, performs a bitwise
2307 inclusive OR between the read result and the value specified by OrData, and
2308 writes the result to the 32-bit MMIO register specified by Address. The value
2309 written to the MMIO register is returned. This function must guarantee that
2310 all MMIO read and write operations are serialized.
2312 If 32-bit MMIO register operations are not supported, then ASSERT().
2314 @param Address The MMIO register to write.
2315 @param OrData The value to OR with the read value from the MMIO register.
2317 @return The value written back to the MMIO register.
2327 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioOr32 (Address
, OrData
));
2331 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
2332 back to the 32-bit MMIO register and saves the value in the S3 script to be
2333 replayed on S3 resume.
2335 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2336 between the read result and the value specified by AndData, and writes the
2337 result to the 32-bit MMIO register specified by Address. The value written to
2338 the MMIO register is returned. This function must guarantee that all MMIO
2339 read and write operations are serialized.
2341 If 32-bit MMIO register operations are not supported, then ASSERT().
2343 @param Address The MMIO register to write.
2344 @param AndData The value to AND with the read value from the MMIO register.
2346 @return The value written back to the MMIO register.
2356 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioAnd32 (Address
, AndData
));
2360 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
2361 inclusive OR, and writes the result back to the 32-bit MMIO register and
2362 saves the value in the S3 script to be replayed on S3 resume.
2364 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2365 between the read result and the value specified by AndData, performs a
2366 bitwise OR between the result of the AND operation and the value specified by
2367 OrData, and writes the result to the 32-bit MMIO register specified by
2368 Address. The value written to the MMIO register is returned. This function
2369 must guarantee that all MMIO read and write operations are serialized.
2371 If 32-bit MMIO register operations are not supported, then ASSERT().
2373 @param Address The MMIO register to write.
2374 @param AndData The value to AND with the read value from the MMIO register.
2375 @param OrData The value to OR with the result of the AND operation.
2377 @return The value written back to the MMIO register.
2388 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioAndThenOr32 (Address
, AndData
, OrData
));
2392 Reads a bit field of a MMIO register and saves the value in the S3 script
2393 to be replayed on S3 resume.
2395 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
2396 the StartBit and the EndBit. The value of the bit field is returned.
2398 If 32-bit MMIO register operations are not supported, then ASSERT().
2399 If StartBit is greater than 31, then ASSERT().
2400 If EndBit is greater than 31, then ASSERT().
2401 If EndBit is less than StartBit, then ASSERT().
2403 @param Address MMIO register to read.
2404 @param StartBit The ordinal of the least significant bit in the bit field.
2406 @param EndBit The ordinal of the most significant bit in the bit field.
2409 @return The value read.
2414 S3MmioBitFieldRead32 (
2420 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldRead32 (Address
, StartBit
, EndBit
));
2424 Writes a bit field to a MMIO register and saves the value in the S3 script
2425 to be replayed on S3 resume.
2427 Writes Value to the bit field of the MMIO register. The bit field is
2428 specified by the StartBit and the EndBit. All other bits in the destination
2429 MMIO register are preserved. The new value of the 32-bit register is returned.
2431 If 32-bit MMIO register operations are not supported, then ASSERT().
2432 If StartBit is greater than 31, then ASSERT().
2433 If EndBit is greater than 31, then ASSERT().
2434 If EndBit is less than StartBit, then ASSERT().
2435 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2437 @param Address The MMIO register to write.
2438 @param StartBit The ordinal of the least significant bit in the bit field.
2440 @param EndBit The ordinal of the most significant bit in the bit field.
2442 @param Value New value of the bit field.
2444 @return The value written back to the MMIO register.
2449 S3MmioBitFieldWrite32 (
2456 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldWrite32 (Address
, StartBit
, EndBit
, Value
));
2460 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
2461 writes the result back to the bit field in the 32-bit MMIO register and
2462 saves the value in the S3 script to be replayed on S3 resume.
2464 Reads the 32-bit MMIO register specified by Address, performs a bitwise
2465 inclusive OR between the read result and the value specified by OrData, and
2466 writes the result to the 32-bit MMIO register specified by Address. The value
2467 written to the MMIO register is returned. This function must guarantee that
2468 all MMIO read and write operations are serialized. Extra left bits in OrData
2471 If 32-bit MMIO register operations are not supported, then ASSERT().
2472 If StartBit is greater than 31, then ASSERT().
2473 If EndBit is greater than 31, then ASSERT().
2474 If EndBit is less than StartBit, then ASSERT().
2475 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2477 @param Address The MMIO register to write.
2478 @param StartBit The ordinal of the least significant bit in the bit field.
2480 @param EndBit The ordinal of the most significant bit in the bit field.
2482 @param OrData The value to OR with the read value from the MMIO register.
2484 @return The value written back to the MMIO register.
2489 S3MmioBitFieldOr32 (
2496 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldOr32 (Address
, StartBit
, EndBit
, OrData
));
2500 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
2501 writes the result back to the bit field in the 32-bit MMIO register and
2502 saves the value in the S3 script to be replayed on S3 resume.
2504 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2505 between the read result and the value specified by AndData, and writes the
2506 result to the 32-bit MMIO register specified by Address. The value written to
2507 the MMIO register is returned. This function must guarantee that all MMIO
2508 read and write operations are serialized. Extra left bits in AndData are
2511 If 32-bit MMIO register operations are not supported, then ASSERT().
2512 If StartBit is greater than 31, then ASSERT().
2513 If EndBit is greater than 31, then ASSERT().
2514 If EndBit is less than StartBit, then ASSERT().
2515 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2517 @param Address The MMIO register to write.
2518 @param StartBit The ordinal of the least significant bit in the bit field.
2520 @param EndBit The ordinal of the most significant bit in the bit field.
2522 @param AndData The value to AND with the read value from the MMIO register.
2524 @return The value written back to the MMIO register.
2529 S3MmioBitFieldAnd32 (
2536 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldAnd32 (Address
, StartBit
, EndBit
, AndData
));
2540 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
2541 by a bitwise OR, and writes the result back to the bit field in the
2542 32-bit MMIO register and saves the value in the S3 script to be replayed
2545 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2546 followed by a bitwise OR between the read result and the value
2547 specified by AndData, and writes the result to the 32-bit MMIO register
2548 specified by Address. The value written to the MMIO register is returned.
2549 This function must guarantee that all MMIO read and write operations are
2550 serialized. Extra left bits in both AndData and OrData are stripped.
2552 If 32-bit MMIO register operations are not supported, then ASSERT().
2553 If StartBit is greater than 31, then ASSERT().
2554 If EndBit is greater than 31, then ASSERT().
2555 If EndBit is less than StartBit, then ASSERT().
2556 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2557 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2559 @param Address The MMIO register to write.
2560 @param StartBit The ordinal of the least significant bit in the bit field.
2562 @param EndBit The ordinal of the most significant bit in the bit field.
2564 @param AndData The value to AND with the read value from the MMIO register.
2565 @param OrData The value to OR with the result of the AND operation.
2567 @return The value written back to the MMIO register.
2572 S3MmioBitFieldAndThenOr32 (
2580 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldAndThenOr32 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2584 Saves a 64-bit MMIO register value to the boot script.
2586 This internal worker function saves a 64-bit MMIO register value in the S3 script
2587 to be replayed on S3 resume.
2589 If the saving process fails, then ASSERT().
2591 @param Address The MMIO register to write.
2592 @param Value The value saved to boot script.
2598 InternalSaveMmioWrite64ValueToBootScript (
2603 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint64
, Address
, &Value
);
2609 Reads a 64-bit MMIO register and saves the value in the S3 script to be
2610 replayed on S3 resume.
2612 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
2613 returned. This function must guarantee that all MMIO read and write
2614 operations are serialized.
2616 If 64-bit MMIO register operations are not supported, then ASSERT().
2618 @param Address The MMIO register to read.
2620 @return The value read.
2629 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioRead64 (Address
));
2633 Writes a 64-bit MMIO register and saves the value in the S3 script to be
2634 replayed on S3 resume.
2636 Writes the 64-bit MMIO register specified by Address with the value specified
2637 by Value and returns Value. This function must guarantee that all MMIO read
2638 and write operations are serialized.
2640 If 64-bit MMIO register operations are not supported, then ASSERT().
2642 @param Address The MMIO register to write.
2643 @param Value The value to write to the MMIO register.
2645 @return The value written the MMIO register.
2655 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioWrite64 (Address
, Value
));
2659 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2660 result back to the 64-bit MMIO register and saves the value in the S3 script
2661 to be replayed on S3 resume.
2663 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2664 inclusive OR between the read result and the value specified by OrData, and
2665 writes the result to the 64-bit MMIO register specified by Address. The value
2666 written to the MMIO register is returned. This function must guarantee that
2667 all MMIO read and write operations are serialized.
2669 If 64-bit MMIO register operations are not supported, then ASSERT().
2671 @param Address The MMIO register to write.
2672 @param OrData The value to OR with the read value from the MMIO register.
2674 @return The value written back to the MMIO register.
2684 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioOr64 (Address
, OrData
));
2688 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2689 back to the 64-bit MMIO register and saves the value in the S3 script to be
2690 replayed on S3 resume.
2692 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2693 between the read result and the value specified by AndData, and writes the
2694 result to the 64-bit MMIO register specified by Address. The value written to
2695 the MMIO register is returned. This function must guarantee that all MMIO
2696 read and write operations are serialized.
2698 If 64-bit MMIO register operations are not supported, then ASSERT().
2700 @param Address The MMIO register to write.
2701 @param AndData The value to AND with the read value from the MMIO register.
2703 @return The value written back to the MMIO register.
2713 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioAnd64 (Address
, AndData
));
2717 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2718 inclusive OR, and writes the result back to the 64-bit MMIO register and
2719 saves the value in the S3 script to be replayed on S3 resume.
2721 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2722 between the read result and the value specified by AndData, performs a
2723 bitwise OR between the result of the AND operation and the value specified by
2724 OrData, and writes the result to the 64-bit MMIO register specified by
2725 Address. The value written to the MMIO register is returned. This function
2726 must guarantee that all MMIO read and write operations are serialized.
2728 If 64-bit MMIO register operations are not supported, then ASSERT().
2730 @param Address The MMIO register to write.
2731 @param AndData The value to AND with the read value from the MMIO register.
2732 @param OrData The value to OR with the result of the AND operation.
2734 @return The value written back to the MMIO register.
2745 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioAndThenOr64 (Address
, AndData
, OrData
));
2749 Reads a bit field of a MMIO register saves the value in the S3 script to
2750 be replayed on S3 resume.
2752 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2753 the StartBit and the EndBit. The value of the bit field is returned.
2755 If 64-bit MMIO register operations are not supported, then ASSERT().
2756 If StartBit is greater than 63, then ASSERT().
2757 If EndBit is greater than 63, then ASSERT().
2758 If EndBit is less than StartBit, then ASSERT().
2760 @param Address MMIO register to read.
2761 @param StartBit The ordinal of the least significant bit in the bit field.
2763 @param EndBit The ordinal of the most significant bit in the bit field.
2766 @return The value read.
2771 S3MmioBitFieldRead64 (
2777 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldRead64 (Address
, StartBit
, EndBit
));
2781 Writes a bit field to a MMIO register and saves the value in the S3 script to
2782 be replayed on S3 resume.
2784 Writes Value to the bit field of the MMIO register. The bit field is
2785 specified by the StartBit and the EndBit. All other bits in the destination
2786 MMIO register are preserved. The new value of the 64-bit register is returned.
2788 If 64-bit MMIO register operations are not supported, then ASSERT().
2789 If StartBit is greater than 63, then ASSERT().
2790 If EndBit is greater than 63, then ASSERT().
2791 If EndBit is less than StartBit, then ASSERT().
2792 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2794 @param Address The MMIO register to write.
2795 @param StartBit The ordinal of the least significant bit in the bit field.
2797 @param EndBit The ordinal of the most significant bit in the bit field.
2799 @param Value New value of the bit field.
2801 @return The value written back to the MMIO register.
2806 S3MmioBitFieldWrite64 (
2813 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldWrite64 (Address
, StartBit
, EndBit
, Value
));
2817 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2818 writes the result back to the bit field in the 64-bit MMIO register and
2819 saves the value in the S3 script to be replayed on S3 resume.
2821 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2822 inclusive OR between the read result and the value specified by OrData, and
2823 writes the result to the 64-bit MMIO register specified by Address. The value
2824 written to the MMIO register is returned. This function must guarantee that
2825 all MMIO read and write operations are serialized. Extra left bits in OrData
2828 If 64-bit MMIO register operations are not supported, then ASSERT().
2829 If StartBit is greater than 63, then ASSERT().
2830 If EndBit is greater than 63, then ASSERT().
2831 If EndBit is less than StartBit, then ASSERT().
2832 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2834 @param Address The MMIO register to write.
2835 @param StartBit The ordinal of the least significant bit in the bit field.
2837 @param EndBit The ordinal of the most significant bit in the bit field.
2839 @param OrData The value to OR with the read value from the MMIO register.
2841 @return The value written back to the MMIO register.
2846 S3MmioBitFieldOr64 (
2853 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldOr64 (Address
, StartBit
, EndBit
, OrData
));
2857 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2858 writes the result back to the bit field in the 64-bit MMIO register and saves
2859 the value in the S3 script to be replayed on S3 resume.
2861 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2862 between the read result and the value specified by AndData, and writes the
2863 result to the 64-bit MMIO register specified by Address. The value written to
2864 the MMIO register is returned. This function must guarantee that all MMIO
2865 read and write operations are serialized. Extra left bits in AndData are
2868 If 64-bit MMIO register operations are not supported, then ASSERT().
2869 If StartBit is greater than 63, then ASSERT().
2870 If EndBit is greater than 63, then ASSERT().
2871 If EndBit is less than StartBit, then ASSERT().
2872 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2874 @param Address The MMIO register to write.
2875 @param StartBit The ordinal of the least significant bit in the bit field.
2877 @param EndBit The ordinal of the most significant bit in the bit field.
2879 @param AndData The value to AND with the read value from the MMIO register.
2881 @return The value written back to the MMIO register.
2886 S3MmioBitFieldAnd64 (
2893 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldAnd64 (Address
, StartBit
, EndBit
, AndData
));
2897 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2898 by a bitwise OR, and writes the result back to the bit field in the
2899 64-bit MMIO register and saves the value in the S3 script to be replayed
2902 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2903 followed by a bitwise OR between the read result and the value
2904 specified by AndData, and writes the result to the 64-bit MMIO register
2905 specified by Address. The value written to the MMIO register is returned.
2906 This function must guarantee that all MMIO read and write operations are
2907 serialized. Extra left bits in both AndData and OrData are stripped.
2909 If 64-bit MMIO register operations are not supported, then ASSERT().
2910 If StartBit is greater than 63, then ASSERT().
2911 If EndBit is greater than 63, then ASSERT().
2912 If EndBit is less than StartBit, then ASSERT().
2913 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2914 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2916 @param Address The MMIO register to write.
2917 @param StartBit The ordinal of the least significant bit in the bit field.
2919 @param EndBit The ordinal of the most significant bit in the bit field.
2921 @param AndData The value to AND with the read value from the MMIO register.
2922 @param OrData The value to OR with the result of the AND operation.
2924 @return The value written back to the MMIO register.
2929 S3MmioBitFieldAndThenOr64 (
2937 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldAndThenOr64 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2941 Copy data from MMIO region to system memory by using 8-bit access
2942 and saves the value in the S3 script to be replayed on S3 resume.
2944 Copy data from MMIO region specified by starting address StartAddress
2945 to system memory specified by Buffer by using 8-bit access. The total
2946 number of byte to be copied is specified by Length. Buffer is returned.
2948 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2949 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2952 @param StartAddress Starting address for the MMIO region to be copied from.
2953 @param Length Size in bytes of the copy.
2954 @param Buffer Pointer to a system memory buffer receiving the data read.
2962 IN UINTN StartAddress
,
2967 UINT8
*ReturnBuffer
;
2968 RETURN_STATUS Status
;
2970 ReturnBuffer
= MmioReadBuffer8 (StartAddress
, Length
, Buffer
);
2972 Status
= S3BootScriptSaveMemWrite (
2973 S3BootScriptWidthUint8
,
2975 Length
/ sizeof (UINT8
),
2978 ASSERT (Status
== RETURN_SUCCESS
);
2980 return ReturnBuffer
;
2984 Copy data from MMIO region to system memory by using 16-bit access
2985 and saves the value in the S3 script to be replayed on S3 resume.
2987 Copy data from MMIO region specified by starting address StartAddress
2988 to system memory specified by Buffer by using 16-bit access. The total
2989 number of byte to be copied is specified by Length. Buffer is returned.
2991 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
2993 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2994 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2996 If Length is not aligned on a 16-bit boundary, then ASSERT().
2997 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
2999 @param StartAddress Starting address for the MMIO region to be copied from.
3000 @param Length Size in bytes of the copy.
3001 @param Buffer Pointer to a system memory buffer receiving the data read.
3008 S3MmioReadBuffer16 (
3009 IN UINTN StartAddress
,
3014 UINT16
*ReturnBuffer
;
3015 RETURN_STATUS Status
;
3017 ReturnBuffer
= MmioReadBuffer16 (StartAddress
, Length
, Buffer
);
3019 Status
= S3BootScriptSaveMemWrite (
3020 S3BootScriptWidthUint16
,
3022 Length
/ sizeof (UINT16
),
3025 ASSERT (Status
== RETURN_SUCCESS
);
3027 return ReturnBuffer
;
3031 Copy data from MMIO region to system memory by using 32-bit access
3032 and saves the value in the S3 script to be replayed on S3 resume.
3034 Copy data from MMIO region specified by starting address StartAddress
3035 to system memory specified by Buffer by using 32-bit access. The total
3036 number of byte to be copied is specified by Length. Buffer is returned.
3038 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
3040 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3041 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
3043 If Length is not aligned on a 32-bit boundary, then ASSERT().
3044 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
3046 @param StartAddress Starting address for the MMIO region to be copied from.
3047 @param Length Size in bytes of the copy.
3048 @param Buffer Pointer to a system memory buffer receiving the data read.
3055 S3MmioReadBuffer32 (
3056 IN UINTN StartAddress
,
3061 UINT32
*ReturnBuffer
;
3062 RETURN_STATUS Status
;
3064 ReturnBuffer
= MmioReadBuffer32 (StartAddress
, Length
, Buffer
);
3066 Status
= S3BootScriptSaveMemWrite (
3067 S3BootScriptWidthUint32
,
3069 Length
/ sizeof (UINT32
),
3072 ASSERT (Status
== RETURN_SUCCESS
);
3074 return ReturnBuffer
;
3078 Copy data from MMIO region to system memory by using 64-bit access
3079 and saves the value in the S3 script to be replayed on S3 resume.
3081 Copy data from MMIO region specified by starting address StartAddress
3082 to system memory specified by Buffer by using 64-bit access. The total
3083 number of byte to be copied is specified by Length. Buffer is returned.
3085 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
3087 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3088 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
3090 If Length is not aligned on a 64-bit boundary, then ASSERT().
3091 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
3093 @param StartAddress Starting address for the MMIO region to be copied from.
3094 @param Length Size in bytes of the copy.
3095 @param Buffer Pointer to a system memory buffer receiving the data read.
3102 S3MmioReadBuffer64 (
3103 IN UINTN StartAddress
,
3108 UINT64
*ReturnBuffer
;
3109 RETURN_STATUS Status
;
3111 ReturnBuffer
= MmioReadBuffer64 (StartAddress
, Length
, Buffer
);
3113 Status
= S3BootScriptSaveMemWrite (
3114 S3BootScriptWidthUint64
,
3116 Length
/ sizeof (UINT64
),
3119 ASSERT (Status
== RETURN_SUCCESS
);
3121 return ReturnBuffer
;
3126 Copy data from system memory to MMIO region by using 8-bit access
3127 and saves the value in the S3 script to be replayed on S3 resume.
3129 Copy data from system memory specified by Buffer to MMIO region specified
3130 by starting address StartAddress by using 8-bit access. The total number
3131 of byte to be copied is specified by Length. Buffer is returned.
3133 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3134 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3137 @param StartAddress Starting address for the MMIO region to be copied to.
3138 @param Length Size in bytes of the copy.
3139 @param Buffer Pointer to a system memory buffer containing the data to write.
3146 S3MmioWriteBuffer8 (
3147 IN UINTN StartAddress
,
3149 IN CONST UINT8
*Buffer
3152 UINT8
*ReturnBuffer
;
3153 RETURN_STATUS Status
;
3155 ReturnBuffer
= MmioWriteBuffer8 (StartAddress
, Length
, Buffer
);
3157 Status
= S3BootScriptSaveMemWrite (
3158 S3BootScriptWidthUint8
,
3160 Length
/ sizeof (UINT8
),
3163 ASSERT (Status
== RETURN_SUCCESS
);
3165 return ReturnBuffer
;
3169 Copy data from system memory to MMIO region by using 16-bit access
3170 and saves the value in the S3 script to be replayed on S3 resume.
3172 Copy data from system memory specified by Buffer to MMIO region specified
3173 by starting address StartAddress by using 16-bit access. The total number
3174 of byte to be copied is specified by Length. Buffer is returned.
3176 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
3178 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3179 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3181 If Length is not aligned on a 16-bit boundary, then ASSERT().
3183 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
3185 @param StartAddress Starting address for the MMIO region to be copied to.
3186 @param Length Size in bytes of the copy.
3187 @param Buffer Pointer to a system memory buffer containing the data to write.
3194 S3MmioWriteBuffer16 (
3195 IN UINTN StartAddress
,
3197 IN CONST UINT16
*Buffer
3200 UINT16
*ReturnBuffer
;
3201 RETURN_STATUS Status
;
3203 ReturnBuffer
= MmioWriteBuffer16 (StartAddress
, Length
, Buffer
);
3205 Status
= S3BootScriptSaveMemWrite (
3206 S3BootScriptWidthUint16
,
3208 Length
/ sizeof (UINT16
),
3211 ASSERT (Status
== RETURN_SUCCESS
);
3213 return ReturnBuffer
;
3218 Copy data from system memory to MMIO region by using 32-bit access
3219 and saves the value in the S3 script to be replayed on S3 resume.
3221 Copy data from system memory specified by Buffer to MMIO region specified
3222 by starting address StartAddress by using 32-bit access. The total number
3223 of byte to be copied is specified by Length. Buffer is returned.
3225 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
3227 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3228 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3230 If Length is not aligned on a 32-bit boundary, then ASSERT().
3232 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
3234 @param StartAddress Starting address for the MMIO region to be copied to.
3235 @param Length Size in bytes of the copy.
3236 @param Buffer Pointer to a system memory buffer containing the data to write.
3243 S3MmioWriteBuffer32 (
3244 IN UINTN StartAddress
,
3246 IN CONST UINT32
*Buffer
3249 UINT32
*ReturnBuffer
;
3250 RETURN_STATUS Status
;
3252 ReturnBuffer
= MmioWriteBuffer32 (StartAddress
, Length
, Buffer
);
3254 Status
= S3BootScriptSaveMemWrite (
3255 S3BootScriptWidthUint32
,
3257 Length
/ sizeof (UINT32
),
3260 ASSERT (Status
== RETURN_SUCCESS
);
3262 return ReturnBuffer
;
3266 Copy data from system memory to MMIO region by using 64-bit access
3267 and saves the value in the S3 script to be replayed on S3 resume.
3269 Copy data from system memory specified by Buffer to MMIO region specified
3270 by starting address StartAddress by using 64-bit access. The total number
3271 of byte to be copied is specified by Length. Buffer is returned.
3273 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
3275 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3276 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3278 If Length is not aligned on a 64-bit boundary, then ASSERT().
3280 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
3282 @param StartAddress Starting address for the MMIO region to be copied to.
3283 @param Length Size in bytes of the copy.
3284 @param Buffer Pointer to a system memory buffer containing the data to write.
3291 S3MmioWriteBuffer64 (
3292 IN UINTN StartAddress
,
3294 IN CONST UINT64
*Buffer
3297 UINT64
*ReturnBuffer
;
3298 RETURN_STATUS Status
;
3300 ReturnBuffer
= MmioWriteBuffer64 (StartAddress
, Length
, Buffer
);
3302 Status
= S3BootScriptSaveMemWrite (
3303 S3BootScriptWidthUint64
,
3305 Length
/ sizeof (UINT64
),
3308 ASSERT (Status
== RETURN_SUCCESS
);
3310 return ReturnBuffer
;