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, 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().
268 @param Port The I/O port to write.
269 @param StartBit The ordinal of the least significant bit in the bit field.
271 @param EndBit The ordinal of the most significant bit in the bit field.
273 @param Value New value of the bit field.
275 @return The value written back to the I/O port.
287 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldWrite8 (Port
, StartBit
, EndBit
, Value
));
291 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
292 result back to the bit field in the 8-bit port and saves the value in the
293 S3 script to be replayed on S3 resume.
295 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
296 between the read result and the value specified by OrData, and writes the
297 result to the 8-bit I/O port specified by Port. The value written to the I/O
298 port is returned. This function must guarantee that all I/O read and write
299 operations are serialized. Extra left bits in OrData are stripped.
301 If 8-bit I/O port operations are not supported, then ASSERT().
302 If StartBit is greater than 7, then ASSERT().
303 If EndBit is greater than 7, then ASSERT().
304 If EndBit is less than StartBit, then ASSERT().
306 @param Port The I/O port to write.
307 @param StartBit The ordinal of the least significant bit in the bit field.
309 @param EndBit The ordinal of the most significant bit in the bit field.
311 @param OrData The value to OR with the read value from the I/O port.
313 @return The value written back to the I/O port.
325 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldOr8 (Port
, StartBit
, EndBit
, OrData
));
329 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
330 result back to the bit field in the 8-bit port and saves the value in the
331 S3 script to be replayed on S3 resume.
333 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
334 the read result and the value specified by AndData, and writes the result to
335 the 8-bit I/O port specified by Port. The value written to the I/O port is
336 returned. This function must guarantee that all I/O read and write operations
337 are serialized. Extra left bits in AndData are stripped.
339 If 8-bit I/O port operations are not supported, then ASSERT().
340 If StartBit is greater than 7, then ASSERT().
341 If EndBit is greater than 7, then ASSERT().
342 If EndBit is less than StartBit, then ASSERT().
344 @param Port The I/O port to write.
345 @param StartBit The ordinal of the least significant bit in the bit field.
347 @param EndBit The ordinal of the most significant bit in the bit field.
349 @param AndData The value to AND with the read value from the I/O port.
351 @return The value written back to the I/O port.
363 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldAnd8 (Port
, StartBit
, EndBit
, AndData
));
367 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
368 bitwise OR, and writes the result back to the bit field in the
369 8-bit port and saves the value in the S3 script to be replayed on S3 resume.
371 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
372 by a bitwise OR between the read result and the value specified by
373 AndData, and writes the result to the 8-bit I/O port specified by Port. The
374 value written to the I/O port is returned. This function must guarantee that
375 all I/O read and write operations are serialized. Extra left bits in both
376 AndData and OrData are stripped.
378 If 8-bit I/O port operations are not supported, then ASSERT().
379 If StartBit is greater than 7, then ASSERT().
380 If EndBit is greater than 7, then ASSERT().
381 If EndBit is less than StartBit, then ASSERT().
383 @param Port The I/O port to write.
384 @param StartBit The ordinal of the least significant bit in the bit field.
386 @param EndBit The ordinal of the most significant bit in the bit field.
388 @param AndData The value to AND with the read value from the I/O port.
389 @param OrData The value to OR with the result of the AND operation.
391 @return The value written back to the I/O port.
396 S3IoBitFieldAndThenOr8 (
404 return InternalSaveIoWrite8ValueToBootScript (Port
, IoBitFieldAndThenOr8 (Port
, StartBit
, EndBit
, AndData
, OrData
));
408 Saves a 16-bit I/O port value to the boot script.
410 This internal worker function saves a 16-bit I/O port value in the S3 script
411 to be replayed on S3 resume.
413 If the saving process fails, then ASSERT().
415 @param Port The I/O port to write.
416 @param Value The value saved to boot script.
422 InternalSaveIoWrite16ValueToBootScript (
427 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint16
, Port
, &Value
);
433 Reads a 16-bit I/O port and saves the value in the S3 script to be replayed
436 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
437 This function must guarantee that all I/O read and write operations are
440 If 16-bit I/O port operations are not supported, then ASSERT().
442 @param Port The I/O port to read.
444 @return The value read.
453 return InternalSaveIoWrite16ValueToBootScript (Port
, IoRead16 (Port
));
457 Writes a 16-bit I/O port and saves the value in the S3 script to be replayed
460 Writes the 16-bit I/O port specified by Port with the value specified by Value
461 and returns Value. This function must guarantee that all I/O read and write
462 operations are serialized.
464 If 16-bit I/O port operations are not supported, then ASSERT().
466 @param Port The I/O port to write.
467 @param Value The value to write to the I/O port.
469 @return The value written the I/O port.
479 return InternalSaveIoWrite16ValueToBootScript (Port
, IoWrite16 (Port
, Value
));
483 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
484 result back to the 16-bit I/O port and saves the value in the S3 script to
485 be replayed on S3 resume.
487 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
488 between the read result and the value specified by OrData, and writes the
489 result to the 16-bit I/O port specified by Port. The value written to the I/O
490 port is returned. This function must guarantee that all I/O read and write
491 operations are serialized.
493 If 16-bit I/O port operations are not supported, then ASSERT().
495 @param Port The I/O port to write.
496 @param OrData The value to OR with the read value from the I/O port.
498 @return The value written back to the I/O port.
508 return InternalSaveIoWrite16ValueToBootScript (Port
, IoOr16 (Port
, OrData
));
512 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
513 to the 16-bit I/O port and saves the value in the S3 script to be replayed
516 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
517 the read result and the value specified by AndData, and writes the result to
518 the 16-bit I/O port specified by Port. The value written to the I/O port is
519 returned. This function must guarantee that all I/O read and write operations
522 If 16-bit I/O port operations are not supported, then ASSERT().
524 @param Port The I/O port to write.
525 @param AndData The value to AND with the read value from the I/O port.
527 @return The value written back to the I/O port.
537 return InternalSaveIoWrite16ValueToBootScript (Port
, IoAnd16 (Port
, AndData
));
541 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
542 inclusive OR, and writes the result back to the 16-bit I/O port and saves
543 the value in the S3 script to be replayed on S3 resume.
545 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
546 the read result and the value specified by AndData, performs a bitwise OR
547 between the result of the AND operation and the value specified by OrData,
548 and writes the result to the 16-bit I/O port specified by Port. The value
549 written to the I/O port is returned. This function must guarantee that all
550 I/O read and write operations are serialized.
552 If 16-bit I/O port operations are not supported, then ASSERT().
554 @param Port The I/O port to write.
555 @param AndData The value to AND with the read value from the I/O port.
556 @param OrData The value to OR with the result of the AND operation.
558 @return The value written back to the I/O port.
569 return InternalSaveIoWrite16ValueToBootScript (Port
, IoAndThenOr16 (Port
, AndData
, OrData
));
573 Reads a bit field of an I/O register saves the value in the S3 script to be
574 replayed on S3 resume.
576 Reads the bit field in a 16-bit I/O register. The bit field is specified by
577 the StartBit and the EndBit. The value of the bit field is returned.
579 If 16-bit I/O port operations are not supported, then ASSERT().
580 If StartBit is greater than 15, then ASSERT().
581 If EndBit is greater than 15, then ASSERT().
582 If EndBit is less than StartBit, then ASSERT().
584 @param Port The I/O port to read.
585 @param StartBit The ordinal of the least significant bit in the bit field.
587 @param EndBit The ordinal of the most significant bit in the bit field.
590 @return The value read.
601 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldRead16 (Port
, StartBit
, EndBit
));
605 Writes a bit field to an I/O register and saves the value in the S3 script
606 to be replayed on S3 resume.
608 Writes Value to the bit field of the I/O register. The bit field is specified
609 by the StartBit and the EndBit. All other bits in the destination I/O
610 register are preserved. The value written to the I/O port is returned. Extra
611 left bits in Value are stripped.
613 If 16-bit I/O port operations are not supported, then ASSERT().
614 If StartBit is greater than 15, then ASSERT().
615 If EndBit is greater than 15, then ASSERT().
616 If EndBit is less than StartBit, then ASSERT().
618 @param Port The I/O port to write.
619 @param StartBit The ordinal of the least significant bit in the bit field.
621 @param EndBit The ordinal of the most significant bit in the bit field.
623 @param Value New value of the bit field.
625 @return The value written back to the I/O port.
630 S3IoBitFieldWrite16 (
637 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldWrite16 (Port
, StartBit
, EndBit
, Value
));
641 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
642 result back to the bit field in the 16-bit port and saves the value in the
643 S3 script to be replayed on S3 resume.
645 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
646 between the read result and the value specified by OrData, and writes the
647 result to the 16-bit I/O port specified by Port. The value written to the I/O
648 port is returned. This function must guarantee that all I/O read and write
649 operations are serialized. Extra left bits in OrData are stripped.
651 If 16-bit I/O port operations are not supported, then ASSERT().
652 If StartBit is greater than 15, then ASSERT().
653 If EndBit is greater than 15, then ASSERT().
654 If EndBit is less than StartBit, then ASSERT().
656 @param Port The I/O port to write.
657 @param StartBit The ordinal of the least significant bit in the bit field.
659 @param EndBit The ordinal of the most significant bit in the bit field.
661 @param OrData The value to OR with the read value from the I/O port.
663 @return The value written back to the I/O port.
675 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldOr16 (Port
, StartBit
, EndBit
, OrData
));
679 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
680 result back to the bit field in the 16-bit port and saves the value in the
681 S3 script to be replayed on S3 resume.
683 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
684 the read result and the value specified by AndData, and writes the result to
685 the 16-bit I/O port specified by Port. The value written to the I/O port is
686 returned. This function must guarantee that all I/O read and write operations
687 are serialized. Extra left bits in AndData are stripped.
689 If 16-bit I/O port operations are not supported, then ASSERT().
690 If StartBit is greater than 15, then ASSERT().
691 If EndBit is greater than 15, then ASSERT().
692 If EndBit is less than StartBit, then ASSERT().
694 @param Port The I/O port to write.
695 @param StartBit The ordinal of the least significant bit in the bit field.
697 @param EndBit The ordinal of the most significant bit in the bit field.
699 @param AndData The value to AND with the read value from the I/O port.
701 @return The value written back to the I/O port.
713 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldAnd16 (Port
, StartBit
, EndBit
, AndData
));
717 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
718 bitwise OR, and writes the result back to the bit field in the
719 16-bit port and saves the value in the S3 script to be replayed on S3
722 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
723 by a bitwise OR between the read result and the value specified by
724 AndData, and writes the result to the 16-bit I/O port specified by Port. The
725 value written to the I/O port is returned. This function must guarantee that
726 all I/O read and write operations are serialized. Extra left bits in both
727 AndData and OrData are stripped.
729 If 16-bit I/O port operations are not supported, then ASSERT().
730 If StartBit is greater than 15, then ASSERT().
731 If EndBit is greater than 15, then ASSERT().
732 If EndBit is less than StartBit, then ASSERT().
734 @param Port The I/O port to write.
735 @param StartBit The ordinal of the least significant bit in the bit field.
737 @param EndBit The ordinal of the most significant bit in the bit field.
739 @param AndData The value to AND with the read value from the I/O port.
740 @param OrData The value to OR with the result of the AND operation.
742 @return The value written back to the I/O port.
747 S3IoBitFieldAndThenOr16 (
755 return InternalSaveIoWrite16ValueToBootScript (Port
, IoBitFieldAndThenOr16 (Port
, StartBit
, EndBit
, AndData
, OrData
));
759 Saves a 32-bit I/O port value to the boot script.
761 This internal worker function saves a 32-bit I/O port value in the S3 script
762 to be replayed on S3 resume.
764 If the saving process fails, then ASSERT().
766 @param Port The I/O port to write.
767 @param Value The value saved to boot script.
773 InternalSaveIoWrite32ValueToBootScript (
778 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint32
, Port
, &Value
);
784 Reads a 32-bit I/O port and saves the value in the S3 script to be replayed
787 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
788 This function must guarantee that all I/O read and write operations are
791 If 32-bit I/O port operations are not supported, then ASSERT().
793 @param Port The I/O port to read.
795 @return The value read.
804 return InternalSaveIoWrite32ValueToBootScript (Port
, IoRead32 (Port
));
808 Writes a 32-bit I/O port and saves the value in the S3 script to be replayed
811 Writes the 32-bit I/O port specified by Port with the value specified by Value
812 and returns Value. This function must guarantee that all I/O read and write
813 operations are serialized.
815 If 32-bit I/O port operations are not supported, then ASSERT().
817 @param Port The I/O port to write.
818 @param Value The value to write to the I/O port.
820 @return The value written the I/O port.
830 return InternalSaveIoWrite32ValueToBootScript (Port
, IoWrite32 (Port
, Value
));
834 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
835 result back to the 32-bit I/O port and saves the value in the S3 script to
836 be replayed on S3 resume.
838 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
839 between the read result and the value specified by OrData, and writes the
840 result to the 32-bit I/O port specified by Port. The value written to the I/O
841 port is returned. This function must guarantee that all I/O read and write
842 operations are serialized.
844 If 32-bit I/O port operations are not supported, then ASSERT().
846 @param Port The I/O port to write.
847 @param OrData The value to OR with the read value from the I/O port.
849 @return The value written back to the I/O port.
859 return InternalSaveIoWrite32ValueToBootScript (Port
, IoOr32 (Port
, OrData
));
863 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
864 to the 32-bit I/O port and saves the value in the S3 script to be replayed
867 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
868 the read result and the value specified by AndData, and writes the result to
869 the 32-bit I/O port specified by Port. The value written to the I/O port is
870 returned. This function must guarantee that all I/O read and write operations
873 If 32-bit I/O port operations are not supported, then ASSERT().
875 @param Port The I/O port to write.
876 @param AndData The value to AND with the read value from the I/O port.
878 @return The value written back to the I/O port.
888 return InternalSaveIoWrite32ValueToBootScript (Port
, IoAnd32 (Port
, AndData
));
892 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
893 inclusive OR, and writes the result back to the 32-bit I/O port and saves
894 the value in the S3 script to be replayed on S3 resume.
896 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
897 the read result and the value specified by AndData, performs a bitwise OR
898 between the result of the AND operation and the value specified by OrData,
899 and writes the result to the 32-bit I/O port specified by Port. The value
900 written to the I/O port is returned. This function must guarantee that all
901 I/O read and write operations are serialized.
903 If 32-bit I/O port operations are not supported, then ASSERT().
905 @param Port The I/O port to write.
906 @param AndData The value to AND with the read value from the I/O port.
907 @param OrData The value to OR with the result of the AND operation.
909 @return The value written back to the I/O port.
920 return InternalSaveIoWrite32ValueToBootScript (Port
, IoAndThenOr32 (Port
, AndData
, OrData
));
924 Reads a bit field of an I/O register and saves the value in the S3 script to
925 be replayed on S3 resume.
927 Reads the bit field in a 32-bit I/O register. The bit field is specified by
928 the StartBit and the EndBit. The value of the bit field is returned.
930 If 32-bit I/O port operations are not supported, then ASSERT().
931 If StartBit is greater than 31, then ASSERT().
932 If EndBit is greater than 31, then ASSERT().
933 If EndBit is less than StartBit, then ASSERT().
935 @param Port The I/O port to read.
936 @param StartBit The ordinal of the least significant bit in the bit field.
938 @param EndBit The ordinal of the most significant bit in the bit field.
941 @return The value read.
952 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldRead32 (Port
, StartBit
, EndBit
));
956 Writes a bit field to an I/O register and saves the value in the S3 script to
957 be replayed on S3 resume.
959 Writes Value to the bit field of the I/O register. The bit field is specified
960 by the StartBit and the EndBit. All other bits in the destination I/O
961 register are preserved. The value written to the I/O port is returned. Extra
962 left bits in Value are stripped.
964 If 32-bit I/O port operations are not supported, then ASSERT().
965 If StartBit is greater than 31, then ASSERT().
966 If EndBit is greater than 31, then ASSERT().
967 If EndBit is less than StartBit, then ASSERT().
969 @param Port The I/O port to write.
970 @param StartBit The ordinal of the least significant bit in the bit field.
972 @param EndBit The ordinal of the most significant bit in the bit field.
974 @param Value New value of the bit field.
976 @return The value written back to the I/O port.
981 S3IoBitFieldWrite32 (
988 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldWrite32 (Port
, StartBit
, EndBit
, Value
));
992 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
993 result back to the bit field in the 32-bit port and saves the value in the
994 S3 script to be replayed on S3 resume.
996 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
997 between the read result and the value specified by OrData, and writes the
998 result to the 32-bit I/O port specified by Port. The value written to the I/O
999 port is returned. This function must guarantee that all I/O read and write
1000 operations are serialized. Extra left bits in OrData are stripped.
1002 If 32-bit I/O port operations are not supported, then ASSERT().
1003 If StartBit is greater than 31, then ASSERT().
1004 If EndBit is greater than 31, then ASSERT().
1005 If EndBit is less than StartBit, then ASSERT().
1007 @param Port The I/O port to write.
1008 @param StartBit The ordinal of the least significant bit in the bit field.
1010 @param EndBit The ordinal of the most significant bit in the bit field.
1012 @param OrData The value to OR with the read value from the I/O port.
1014 @return The value written back to the I/O port.
1026 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldOr32 (Port
, StartBit
, EndBit
, OrData
));
1030 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
1031 result back to the bit field in the 32-bit port and saves the value in the
1032 S3 script to be replayed on S3 resume.
1034 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
1035 the read result and the value specified by AndData, and writes the result to
1036 the 32-bit I/O port specified by Port. The value written to the I/O port is
1037 returned. This function must guarantee that all I/O read and write operations
1038 are serialized. Extra left bits in AndData are stripped.
1040 If 32-bit I/O port operations are not supported, then ASSERT().
1041 If StartBit is greater than 31, then ASSERT().
1042 If EndBit is greater than 31, then ASSERT().
1043 If EndBit is less than StartBit, then ASSERT().
1045 @param Port The I/O port to write.
1046 @param StartBit The ordinal of the least significant bit in the bit field.
1048 @param EndBit The ordinal of the most significant bit in the bit field.
1050 @param AndData The value to AND with the read value from the I/O port.
1052 @return The value written back to the I/O port.
1064 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldAnd32 (Port
, StartBit
, EndBit
, AndData
));
1068 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
1069 bitwise OR, and writes the result back to the bit field in the
1070 32-bit port and saves the value in the S3 script to be replayed on S3
1073 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
1074 by a bitwise OR between the read result and the value specified by
1075 AndData, and writes the result to the 32-bit I/O port specified by Port. The
1076 value written to the I/O port is returned. This function must guarantee that
1077 all I/O read and write operations are serialized. Extra left bits in both
1078 AndData and OrData are stripped.
1080 If 32-bit I/O port operations are not supported, then ASSERT().
1081 If StartBit is greater than 31, then ASSERT().
1082 If EndBit is greater than 31, then ASSERT().
1083 If EndBit is less than StartBit, then ASSERT().
1085 @param Port The I/O port to write.
1086 @param StartBit The ordinal of the least significant bit in the bit field.
1088 @param EndBit The ordinal of the most significant bit in the bit field.
1090 @param AndData The value to AND with the read value from the I/O port.
1091 @param OrData The value to OR with the result of the AND operation.
1093 @return The value written back to the I/O port.
1098 S3IoBitFieldAndThenOr32 (
1106 return InternalSaveIoWrite32ValueToBootScript (Port
, IoBitFieldAndThenOr32 (Port
, StartBit
, EndBit
, AndData
, OrData
));
1110 Saves a 64-bit I/O port value to the boot script.
1112 This internal worker function saves a 64-bit I/O port value in the S3 script
1113 to be replayed on S3 resume.
1115 If the saving process fails, then ASSERT().
1117 @param Port The I/O port to write.
1118 @param Value The value saved to boot script.
1124 InternalSaveIoWrite64ValueToBootScript (
1129 InternalSaveIoWriteValueToBootScript (S3BootScriptWidthUint64
, Port
, &Value
);
1135 Reads a 64-bit I/O port and saves the value in the S3 script to be replayed
1138 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
1139 This function must guarantee that all I/O read and write operations are
1142 If 64-bit I/O port operations are not supported, then ASSERT().
1144 @param Port The I/O port to read.
1146 @return The value read.
1155 return InternalSaveIoWrite64ValueToBootScript (Port
, IoRead64 (Port
));
1159 Writes a 64-bit I/O port and saves the value in the S3 script to be replayed
1162 Writes the 64-bit I/O port specified by Port with the value specified by Value
1163 and returns Value. This function must guarantee that all I/O read and write
1164 operations are serialized.
1166 If 64-bit I/O port operations are not supported, then ASSERT().
1168 @param Port The I/O port to write.
1169 @param Value The value to write to the I/O port.
1171 @return The value written the I/O port.
1181 return InternalSaveIoWrite64ValueToBootScript (Port
, IoWrite64 (Port
, Value
));
1185 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
1186 result back to the 64-bit I/O port and saves the value in the S3 script to
1187 be replayed on S3 resume.
1189 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1190 between the read result and the value specified by OrData, and writes the
1191 result to the 64-bit I/O port specified by Port. The value written to the I/O
1192 port is returned. This function must guarantee that all I/O read and write
1193 operations are serialized.
1195 If 64-bit I/O port operations are not supported, then ASSERT().
1197 @param Port The I/O port to write.
1198 @param OrData The value to OR with the read value from the I/O port.
1200 @return The value written back to the I/O port.
1210 return InternalSaveIoWrite64ValueToBootScript (Port
, IoOr64 (Port
, OrData
));
1214 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
1215 to the 64-bit I/O port and saves the value in the S3 script to be replayed
1218 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1219 the read result and the value specified by AndData, and writes the result to
1220 the 64-bit I/O port specified by Port. The value written to the I/O port is
1221 returned. This function must guarantee that all I/O read and write operations
1224 If 64-bit I/O port operations are not supported, then ASSERT().
1226 @param Port The I/O port to write.
1227 @param AndData The value to AND with the read value from the I/O port.
1229 @return The value written back to the I/O port.
1239 return InternalSaveIoWrite64ValueToBootScript (Port
, IoAnd64 (Port
, AndData
));
1243 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
1244 inclusive OR, and writes the result back to the 64-bit I/O port and saves
1245 the value in the S3 script to be replayed on S3 resume.
1247 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1248 the read result and the value specified by AndData, performs a bitwise OR
1249 between the result of the AND operation and the value specified by OrData,
1250 and writes the result to the 64-bit I/O port specified by Port. The value
1251 written to the I/O port is returned. This function must guarantee that all
1252 I/O read and write operations are serialized.
1254 If 64-bit I/O port operations are not supported, then ASSERT().
1256 @param Port The I/O port to write.
1257 @param AndData The value to AND with the read value from the I/O port.
1258 @param OrData The value to OR with the result of the AND operation.
1260 @return The value written back to the I/O port.
1271 return InternalSaveIoWrite64ValueToBootScript (Port
, IoAndThenOr64 (Port
, AndData
, OrData
));
1275 Reads a bit field of an I/O register and saves the value in the S3 script to
1276 be replayed on S3 resume.
1278 Reads the bit field in a 64-bit I/O register. The bit field is specified by
1279 the StartBit and the EndBit. The value of the bit field is returned.
1281 If 64-bit I/O port operations are not supported, then ASSERT().
1282 If StartBit is greater than 63, then ASSERT().
1283 If EndBit is greater than 63, then ASSERT().
1284 If EndBit is less than StartBit, then ASSERT().
1286 @param Port The I/O port to read.
1287 @param StartBit The ordinal of the least significant bit in the bit field.
1289 @param EndBit The ordinal of the most significant bit in the bit field.
1292 @return The value read.
1297 S3IoBitFieldRead64 (
1303 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldRead64 (Port
, StartBit
, EndBit
));
1307 Writes a bit field to an I/O register and saves the value in the S3 script to
1308 be replayed on S3 resume.
1310 Writes Value to the bit field of the I/O register. The bit field is specified
1311 by the StartBit and the EndBit. All other bits in the destination I/O
1312 register are preserved. The value written to the I/O port is returned. Extra
1313 left bits in Value are stripped.
1315 If 64-bit I/O port operations are not supported, then ASSERT().
1316 If StartBit is greater than 63, then ASSERT().
1317 If EndBit is greater than 63, then ASSERT().
1318 If EndBit is less than StartBit, then ASSERT().
1320 @param Port The I/O port to write.
1321 @param StartBit The ordinal of the least significant bit in the bit field.
1323 @param EndBit The ordinal of the most significant bit in the bit field.
1325 @param Value New value of the bit field.
1327 @return The value written back to the I/O port.
1332 S3IoBitFieldWrite64 (
1339 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldWrite64 (Port
, StartBit
, EndBit
, Value
));
1343 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1344 result back to the bit field in the 64-bit port and saves the value in the
1345 S3 script to be replayed on S3 resume.
1347 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1348 between the read result and the value specified by OrData, and writes the
1349 result to the 64-bit I/O port specified by Port. The value written to the I/O
1350 port is returned. This function must guarantee that all I/O read and write
1351 operations are serialized. Extra left bits in OrData are stripped.
1353 If 64-bit I/O port operations are not supported, then ASSERT().
1354 If StartBit is greater than 63, then ASSERT().
1355 If EndBit is greater than 63, then ASSERT().
1356 If EndBit is less than StartBit, then ASSERT().
1358 @param Port The I/O port to write.
1359 @param StartBit The ordinal of the least significant bit in the bit field.
1361 @param EndBit The ordinal of the most significant bit in the bit field.
1363 @param OrData The value to OR with the read value from the I/O port.
1365 @return The value written back to the I/O port.
1377 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldOr64 (Port
, StartBit
, EndBit
, OrData
));
1381 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1382 result back to the bit field in the 64-bit port and saves the value in the
1383 S3 script to be replayed on S3 resume.
1385 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1386 the read result and the value specified by AndData, and writes the result to
1387 the 64-bit I/O port specified by Port. The value written to the I/O port is
1388 returned. This function must guarantee that all I/O read and write operations
1389 are serialized. Extra left bits in AndData are stripped.
1391 If 64-bit I/O port operations are not supported, then ASSERT().
1392 If StartBit is greater than 63, then ASSERT().
1393 If EndBit is greater than 63, then ASSERT().
1394 If EndBit is less than StartBit, then ASSERT().
1396 @param Port The I/O port to write.
1397 @param StartBit The ordinal of the least significant bit in the bit field.
1399 @param EndBit The ordinal of the most significant bit in the bit field.
1401 @param AndData The value to AND with the read value from the I/O port.
1403 @return The value written back to the I/O port.
1415 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldAnd64 (Port
, StartBit
, EndBit
, AndData
));
1419 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1420 bitwise OR, and writes the result back to the bit field in the
1421 64-bit port and saves the value in the S3 script to be replayed on S3
1424 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1425 by a bitwise OR between the read result and the value specified by
1426 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1427 value written to the I/O port is returned. This function must guarantee that
1428 all I/O read and write operations are serialized. Extra left bits in both
1429 AndData and OrData are stripped.
1431 If 64-bit I/O port operations are not supported, then ASSERT().
1432 If StartBit is greater than 63, then ASSERT().
1433 If EndBit is greater than 63, then ASSERT().
1434 If EndBit is less than StartBit, then ASSERT().
1436 @param Port The I/O port to write.
1437 @param StartBit The ordinal of the least significant bit in the bit field.
1439 @param EndBit The ordinal of the most significant bit in the bit field.
1441 @param AndData The value to AND with the read value from the I/O port.
1442 @param OrData The value to OR with the result of the AND operation.
1444 @return The value written back to the I/O port.
1449 S3IoBitFieldAndThenOr64 (
1457 return InternalSaveIoWrite64ValueToBootScript (Port
, IoBitFieldAndThenOr64 (Port
, StartBit
, EndBit
, AndData
, OrData
));
1461 Saves an MMIO register value to the boot script.
1463 This internal worker function saves an MMIO register value in the S3 script
1464 to be replayed on S3 resume.
1466 If the saving process fails, then ASSERT().
1468 @param Width The width of MMIO register.
1469 @param Address The MMIO register to write.
1470 @param Buffer The buffer containing value.
1474 InternalSaveMmioWriteValueToBootScript (
1475 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
1480 RETURN_STATUS Status
;
1482 Status
= S3BootScriptSaveMemWrite (
1488 ASSERT (Status
== RETURN_SUCCESS
);
1492 Saves an 8-bit MMIO register value to the boot script.
1494 This internal worker function saves an 8-bit MMIO register value in the S3 script
1495 to be replayed on S3 resume.
1497 If the saving process fails, then ASSERT().
1499 @param Address The MMIO register to write.
1500 @param Value The value saved to boot script.
1506 InternalSaveMmioWrite8ValueToBootScript (
1511 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint8
, Address
, &Value
);
1517 Reads an 8-bit MMIO register and saves the value in the S3 script to be
1518 replayed on S3 resume.
1520 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
1521 returned. This function must guarantee that all MMIO read and write
1522 operations are serialized.
1524 If 8-bit MMIO register operations are not supported, then ASSERT().
1526 @param Address The MMIO register to read.
1528 @return The value read.
1537 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioRead8 (Address
));
1541 Writes an 8-bit MMIO register and saves the value in the S3 script to be
1542 replayed on S3 resume.
1544 Writes the 8-bit MMIO register specified by Address with the value specified
1545 by Value and returns Value. This function must guarantee that all MMIO read
1546 and write operations are serialized.
1548 If 8-bit MMIO register operations are not supported, then ASSERT().
1550 @param Address The MMIO register to write.
1551 @param Value The value to write to the MMIO register.
1553 @return The value written the MMIO register.
1563 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioWrite8 (Address
, Value
));
1567 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1568 result back to the 8-bit MMIO register and saves the value in the S3 script
1569 to be replayed on S3 resume.
1571 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1572 inclusive OR between the read result and the value specified by OrData, and
1573 writes the result to the 8-bit MMIO register specified by Address. The value
1574 written to the MMIO register is returned. This function must guarantee that
1575 all MMIO read and write operations are serialized.
1577 If 8-bit MMIO register operations are not supported, then ASSERT().
1579 @param Address The MMIO register to write.
1580 @param OrData The value to OR with the read value from the MMIO register.
1582 @return The value written back to the MMIO register.
1592 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioOr8 (Address
, OrData
));
1596 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1597 back to the 8-bit MMIO register and saves the value in the S3 script to be
1598 replayed on S3 resume.
1600 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1601 between the read result and the value specified by AndData, and writes the
1602 result to the 8-bit MMIO register specified by Address. The value written to
1603 the MMIO register is returned. This function must guarantee that all MMIO
1604 read and write operations are serialized.
1606 If 8-bit MMIO register operations are not supported, then ASSERT().
1608 @param Address The MMIO register to write.
1609 @param AndData The value to AND with the read value from the MMIO register.
1611 @return The value written back to the MMIO register.
1621 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioAnd8 (Address
, AndData
));
1625 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1626 inclusive OR, and writes the result back to the 8-bit MMIO register and saves
1627 the value in the S3 script to be replayed on S3 resume.
1629 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1630 between the read result and the value specified by AndData, performs a
1631 bitwise OR between the result of the AND operation and the value specified by
1632 OrData, and writes the result to the 8-bit MMIO register specified by
1633 Address. The value written to the MMIO register is returned. This function
1634 must guarantee that all MMIO read and write operations are serialized.
1636 If 8-bit MMIO register operations are not supported, then ASSERT().
1638 @param Address The MMIO register to write.
1639 @param AndData The value to AND with the read value from the MMIO register.
1640 @param OrData The value to OR with the result of the AND operation.
1642 @return The value written back to the MMIO register.
1653 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioAndThenOr8 (Address
, AndData
, OrData
));
1657 Reads a bit field of a MMIO register and saves the value in the S3 script to
1658 be replayed on S3 resume.
1660 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1661 the StartBit and the EndBit. The value of the bit field is returned.
1663 If 8-bit MMIO register operations are not supported, then ASSERT().
1664 If StartBit is greater than 7, then ASSERT().
1665 If EndBit is greater than 7, then ASSERT().
1666 If EndBit is less than StartBit, then ASSERT().
1668 @param Address MMIO register to read.
1669 @param StartBit The ordinal of the least significant bit in the bit field.
1671 @param EndBit The ordinal of the most significant bit in the bit field.
1674 @return The value read.
1679 S3MmioBitFieldRead8 (
1685 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldRead8 (Address
, StartBit
, EndBit
));
1689 Writes a bit field to an MMIO register and saves the value in the S3 script to
1690 be replayed on S3 resume.
1692 Writes Value to the bit field of the MMIO register. The bit field is
1693 specified by the StartBit and the EndBit. All other bits in the destination
1694 MMIO register are preserved. The new value of the 8-bit register is returned.
1696 If 8-bit MMIO register operations are not supported, then ASSERT().
1697 If StartBit is greater than 7, then ASSERT().
1698 If EndBit is greater than 7, then ASSERT().
1699 If EndBit is less than StartBit, then ASSERT().
1701 @param Address The MMIO register to write.
1702 @param StartBit The ordinal of the least significant bit in the bit field.
1704 @param EndBit The ordinal of the most significant bit in the bit field.
1706 @param Value New value of the bit field.
1708 @return The value written back to the MMIO register.
1713 S3MmioBitFieldWrite8 (
1720 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldWrite8 (Address
, StartBit
, EndBit
, Value
));
1724 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1725 writes the result back to the bit field in the 8-bit MMIO register and saves
1726 the value in the S3 script to be replayed on S3 resume.
1728 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1729 inclusive OR between the read result and the value specified by OrData, and
1730 writes the result to the 8-bit MMIO register specified by Address. The value
1731 written to the MMIO register is returned. This function must guarantee that
1732 all MMIO read and write operations are serialized. Extra left bits in OrData
1735 If 8-bit MMIO register operations are not supported, then ASSERT().
1736 If StartBit is greater than 7, then ASSERT().
1737 If EndBit is greater than 7, then ASSERT().
1738 If EndBit is less than StartBit, then ASSERT().
1740 @param Address The MMIO register to write.
1741 @param StartBit The ordinal of the least significant bit in the bit field.
1743 @param EndBit The ordinal of the most significant bit in the bit field.
1745 @param OrData The value to OR with the read value from the MMIO register.
1747 @return The value written back to the MMIO register.
1759 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldOr8 (Address
, StartBit
, EndBit
, OrData
));
1763 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1764 writes the result back to the bit field in the 8-bit MMIO register and saves
1765 the value in the S3 script to be replayed on S3 resume.
1767 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1768 between the read result and the value specified by AndData, and writes the
1769 result to the 8-bit MMIO register specified by Address. The value written to
1770 the MMIO register is returned. This function must guarantee that all MMIO
1771 read and write operations are serialized. Extra left bits in AndData are
1774 If 8-bit MMIO register operations are not supported, then ASSERT().
1775 If StartBit is greater than 7, then ASSERT().
1776 If EndBit is greater than 7, then ASSERT().
1777 If EndBit is less than StartBit, then ASSERT().
1779 @param Address The MMIO register to write.
1780 @param StartBit The ordinal of the least significant bit in the bit field.
1782 @param EndBit The ordinal of the most significant bit in the bit field.
1784 @param AndData The value to AND with the read value from the MMIO register.
1786 @return The value written back to the MMIO register.
1791 S3MmioBitFieldAnd8 (
1798 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldAnd8 (Address
, StartBit
, EndBit
, AndData
));
1802 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1803 by a bitwise OR, and writes the result back to the bit field in the
1804 8-bit MMIO register and saves the value in the S3 script to be replayed
1807 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1808 followed by a bitwise OR between the read result and the value
1809 specified by AndData, and writes the result to the 8-bit MMIO register
1810 specified by Address. The value written to the MMIO register is returned.
1811 This function must guarantee that all MMIO read and write operations are
1812 serialized. Extra left bits in both AndData and OrData are stripped.
1814 If 8-bit MMIO register operations are not supported, then ASSERT().
1815 If StartBit is greater than 7, then ASSERT().
1816 If EndBit is greater than 7, then ASSERT().
1817 If EndBit is less than StartBit, then ASSERT().
1819 @param Address The MMIO register to write.
1820 @param StartBit The ordinal of the least significant bit in the bit field.
1822 @param EndBit The ordinal of the most significant bit in the bit field.
1824 @param AndData The value to AND with the read value from the MMIO register.
1825 @param OrData The value to OR with the result of the AND operation.
1827 @return The value written back to the MMIO register.
1832 S3MmioBitFieldAndThenOr8 (
1840 return InternalSaveMmioWrite8ValueToBootScript (Address
, MmioBitFieldAndThenOr8 (Address
, StartBit
, EndBit
, AndData
, OrData
));
1844 Saves a 16-bit MMIO register value to the boot script.
1846 This internal worker function saves a 16-bit MMIO register value in the S3 script
1847 to be replayed on S3 resume.
1849 If the saving process fails, then ASSERT().
1851 @param Address The MMIO register to write.
1852 @param Value The value saved to boot script.
1858 InternalSaveMmioWrite16ValueToBootScript (
1863 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint16
, Address
, &Value
);
1869 Reads a 16-bit MMIO register and saves the value in the S3 script to be replayed
1872 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
1873 returned. This function must guarantee that all MMIO read and write
1874 operations are serialized.
1876 If 16-bit MMIO register operations are not supported, then ASSERT().
1878 @param Address The MMIO register to read.
1880 @return The value read.
1889 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioRead16 (Address
));
1893 Writes a 16-bit MMIO register and saves the value in the S3 script to be replayed
1896 Writes the 16-bit MMIO register specified by Address with the value specified
1897 by Value and returns Value. This function must guarantee that all MMIO read
1898 and write operations are serialized and saves the value in the S3 script to be
1899 replayed on S3 resume.
1901 If 16-bit MMIO register operations are not supported, then ASSERT().
1903 @param Address The MMIO register to write.
1904 @param Value The value to write to the MMIO register.
1906 @return The value written the MMIO register.
1916 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioWrite16 (Address
, Value
));
1920 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1921 result back to the 16-bit MMIO register and saves the value in the S3 script
1922 to be replayed on S3 resume.
1924 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1925 inclusive OR between the read result and the value specified by OrData, and
1926 writes the result to the 16-bit MMIO register specified by Address. The value
1927 written to the MMIO register is returned. This function must guarantee that
1928 all MMIO read and write operations are serialized.
1930 If 16-bit MMIO register operations are not supported, then ASSERT().
1932 @param Address The MMIO register to write.
1933 @param OrData The value to OR with the read value from the MMIO register.
1935 @return The value written back to the MMIO register.
1945 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioOr16 (Address
, OrData
));
1949 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1950 back to the 16-bit MMIO register and saves the value in the S3 script to be
1951 replayed on S3 resume.
1953 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1954 between the read result and the value specified by AndData, and writes the
1955 result to the 16-bit MMIO register specified by Address. The value written to
1956 the MMIO register is returned. This function must guarantee that all MMIO
1957 read and write operations are serialized.
1959 If 16-bit MMIO register operations are not supported, then ASSERT().
1961 @param Address The MMIO register to write.
1962 @param AndData The value to AND with the read value from the MMIO register.
1964 @return The value written back to the MMIO register.
1974 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioAnd16 (Address
, AndData
));
1978 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1979 inclusive OR, and writes the result back to the 16-bit MMIO register and
1980 saves the value in the S3 script to be replayed on S3 resume.
1982 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1983 between the read result and the value specified by AndData, performs a
1984 bitwise OR between the result of the AND operation and the value specified by
1985 OrData, and writes the result to the 16-bit MMIO register specified by
1986 Address. The value written to the MMIO register is returned. This function
1987 must guarantee that all MMIO read and write operations are serialized.
1989 If 16-bit MMIO register operations are not supported, then ASSERT().
1991 @param Address The MMIO register to write.
1992 @param AndData The value to AND with the read value from the MMIO register.
1993 @param OrData The value to OR with the result of the AND operation.
1995 @return The value written back to the MMIO register.
2006 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioAndThenOr16 (Address
, AndData
, OrData
));
2010 Reads a bit field of a MMIO register and saves the value in the S3 script to
2011 be replayed on S3 resume.
2013 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
2014 the StartBit and the EndBit. The value of the bit field is returned.
2016 If 16-bit MMIO register operations are not supported, then ASSERT().
2017 If StartBit is greater than 15, then ASSERT().
2018 If EndBit is greater than 15, then ASSERT().
2019 If EndBit is less than StartBit, then ASSERT().
2021 @param Address MMIO register to read.
2022 @param StartBit The ordinal of the least significant bit in the bit field.
2024 @param EndBit The ordinal of the most significant bit in the bit field.
2027 @return The value read.
2032 S3MmioBitFieldRead16 (
2038 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldRead16 (Address
, StartBit
, EndBit
));
2042 Writes a bit field to a MMIO register and saves the value in the S3 script to
2043 be replayed on S3 resume.
2045 Writes Value to the bit field of the MMIO register. The bit field is
2046 specified by the StartBit and the EndBit. All other bits in the destination
2047 MMIO register are preserved. The new value of the 16-bit register is returned.
2049 If 16-bit MMIO register operations are not supported, then ASSERT().
2050 If StartBit is greater than 15, then ASSERT().
2051 If EndBit is greater than 15, then ASSERT().
2052 If EndBit is less than StartBit, then ASSERT().
2054 @param Address The MMIO register to write.
2055 @param StartBit The ordinal of the least significant bit in the bit field.
2057 @param EndBit The ordinal of the most significant bit in the bit field.
2059 @param Value New value of the bit field.
2061 @return The value written back to the MMIO register.
2066 S3MmioBitFieldWrite16 (
2073 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldWrite16 (Address
, StartBit
, EndBit
, Value
));
2077 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
2078 writes the result back to the bit field in the 16-bit MMIO register and
2079 saves the value in the S3 script to be replayed on S3 resume.
2081 Reads the 16-bit MMIO register specified by Address, performs a bitwise
2082 inclusive OR between the read result and the value specified by OrData, and
2083 writes the result to the 16-bit MMIO register specified by Address. The value
2084 written to the MMIO register is returned. This function must guarantee that
2085 all MMIO read and write operations are serialized. Extra left bits in OrData
2088 If 16-bit MMIO register operations are not supported, then ASSERT().
2089 If StartBit is greater than 15, then ASSERT().
2090 If EndBit is greater than 15, then ASSERT().
2091 If EndBit is less than StartBit, then ASSERT().
2093 @param Address The MMIO register to write.
2094 @param StartBit The ordinal of the least significant bit in the bit field.
2096 @param EndBit The ordinal of the most significant bit in the bit field.
2098 @param OrData The value to OR with the read value from the MMIO register.
2100 @return The value written back to the MMIO register.
2105 S3MmioBitFieldOr16 (
2112 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldOr16 (Address
, StartBit
, EndBit
, OrData
));
2116 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
2117 writes the result back to the bit field in the 16-bit MMIO register and
2118 saves the value in the S3 script to be replayed on S3 resume.
2120 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
2121 between the read result and the value specified by AndData, and writes the
2122 result to the 16-bit MMIO register specified by Address. The value written to
2123 the MMIO register is returned. This function must guarantee that all MMIO
2124 read and write operations are serialized. Extra left bits in AndData are
2127 If 16-bit MMIO register operations are not supported, then ASSERT().
2128 If StartBit is greater than 15, then ASSERT().
2129 If EndBit is greater than 15, then ASSERT().
2130 If EndBit is less than StartBit, then ASSERT().
2132 @param Address The MMIO register to write.
2133 @param StartBit The ordinal of the least significant bit in the bit field.
2135 @param EndBit The ordinal of the most significant bit in the bit field.
2137 @param AndData The value to AND with the read value from the MMIO register.
2139 @return The value written back to the MMIO register.
2144 S3MmioBitFieldAnd16 (
2151 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldAnd16 (Address
, StartBit
, EndBit
, AndData
));
2155 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
2156 by a bitwise OR, and writes the result back to the bit field in the
2157 16-bit MMIO register and saves the value in the S3 script to be replayed
2160 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
2161 followed by a bitwise OR between the read result and the value
2162 specified by AndData, and writes the result to the 16-bit MMIO register
2163 specified by Address. The value written to the MMIO register is returned.
2164 This function must guarantee that all MMIO read and write operations are
2165 serialized. Extra left bits in both AndData and OrData are stripped.
2167 If 16-bit MMIO register operations are not supported, then ASSERT().
2168 If StartBit is greater than 15, then ASSERT().
2169 If EndBit is greater than 15, then ASSERT().
2170 If EndBit is less than StartBit, then ASSERT().
2172 @param Address The MMIO register to write.
2173 @param StartBit The ordinal of the least significant bit in the bit field.
2175 @param EndBit The ordinal of the most significant bit in the bit field.
2177 @param AndData The value to AND with the read value from the MMIO register.
2178 @param OrData The value to OR with the result of the AND operation.
2180 @return The value written back to the MMIO register.
2185 S3MmioBitFieldAndThenOr16 (
2193 return InternalSaveMmioWrite16ValueToBootScript (Address
, MmioBitFieldAndThenOr16 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2197 Saves a 32-bit MMIO register value to the boot script.
2199 This internal worker function saves a 32-bit MMIO register value in the S3 script
2200 to be replayed on S3 resume.
2202 If the saving process fails, then ASSERT().
2204 @param Address The MMIO register to write.
2205 @param Value The value saved to boot script.
2211 InternalSaveMmioWrite32ValueToBootScript (
2216 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint32
, Address
, &Value
);
2222 Reads a 32-bit MMIO register saves the value in the S3 script to be
2223 replayed on S3 resume.
2225 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
2226 returned. This function must guarantee that all MMIO read and write
2227 operations are serialized.
2229 If 32-bit MMIO register operations are not supported, then ASSERT().
2231 @param Address The MMIO register to read.
2233 @return The value read.
2242 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioRead32 (Address
));
2246 Writes a 32-bit MMIO register and saves the value in the S3 script to be
2247 replayed on S3 resume.
2249 Writes the 32-bit MMIO register specified by Address with the value specified
2250 by Value and returns Value. This function must guarantee that all MMIO read
2251 and write operations are serialized.
2253 If 32-bit MMIO register operations are not supported, then ASSERT().
2255 @param Address The MMIO register to write.
2256 @param Value The value to write to the MMIO register.
2258 @return The value written the MMIO register.
2268 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioWrite32 (Address
, Value
));
2272 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
2273 result back to the 32-bit MMIO register and saves the value in the S3 script
2274 to be replayed on S3 resume.
2276 Reads the 32-bit MMIO register specified by Address, performs a bitwise
2277 inclusive OR between the read result and the value specified by OrData, and
2278 writes the result to the 32-bit MMIO register specified by Address. The value
2279 written to the MMIO register is returned. This function must guarantee that
2280 all MMIO read and write operations are serialized.
2282 If 32-bit MMIO register operations are not supported, then ASSERT().
2284 @param Address The MMIO register to write.
2285 @param OrData The value to OR with the read value from the MMIO register.
2287 @return The value written back to the MMIO register.
2297 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioOr32 (Address
, OrData
));
2301 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
2302 back to the 32-bit MMIO register and saves the value in the S3 script to be
2303 replayed on S3 resume.
2305 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2306 between the read result and the value specified by AndData, and writes the
2307 result to the 32-bit MMIO register specified by Address. The value written to
2308 the MMIO register is returned. This function must guarantee that all MMIO
2309 read and write operations are serialized.
2311 If 32-bit MMIO register operations are not supported, then ASSERT().
2313 @param Address The MMIO register to write.
2314 @param AndData The value to AND with the read value from the MMIO register.
2316 @return The value written back to the MMIO register.
2326 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioAnd32 (Address
, AndData
));
2330 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
2331 inclusive OR, and writes the result back to the 32-bit MMIO register and
2332 saves the value in the S3 script to be replayed on S3 resume.
2334 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2335 between the read result and the value specified by AndData, performs a
2336 bitwise OR between the result of the AND operation and the value specified by
2337 OrData, and writes the result to the 32-bit MMIO register specified by
2338 Address. The value written to the MMIO register is returned. This function
2339 must guarantee that all MMIO 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.
2345 @param OrData The value to OR with the result of the AND operation.
2347 @return The value written back to the MMIO register.
2358 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioAndThenOr32 (Address
, AndData
, OrData
));
2362 Reads a bit field of a MMIO register and saves the value in the S3 script
2363 to be replayed on S3 resume.
2365 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
2366 the StartBit and the EndBit. The value of the bit field is returned.
2368 If 32-bit MMIO register operations are not supported, then ASSERT().
2369 If StartBit is greater than 31, then ASSERT().
2370 If EndBit is greater than 31, then ASSERT().
2371 If EndBit is less than StartBit, then ASSERT().
2373 @param Address MMIO register to read.
2374 @param StartBit The ordinal of the least significant bit in the bit field.
2376 @param EndBit The ordinal of the most significant bit in the bit field.
2379 @return The value read.
2384 S3MmioBitFieldRead32 (
2390 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldRead32 (Address
, StartBit
, EndBit
));
2394 Writes a bit field to a MMIO register and saves the value in the S3 script
2395 to be replayed on S3 resume.
2397 Writes Value to the bit field of the MMIO register. The bit field is
2398 specified by the StartBit and the EndBit. All other bits in the destination
2399 MMIO register are preserved. The new value of the 32-bit register is returned.
2401 If 32-bit MMIO register operations are not supported, then ASSERT().
2402 If StartBit is greater than 31, then ASSERT().
2403 If EndBit is greater than 31, then ASSERT().
2404 If EndBit is less than StartBit, then ASSERT().
2406 @param Address The MMIO register to write.
2407 @param StartBit The ordinal of the least significant bit in the bit field.
2409 @param EndBit The ordinal of the most significant bit in the bit field.
2411 @param Value New value of the bit field.
2413 @return The value written back to the MMIO register.
2418 S3MmioBitFieldWrite32 (
2425 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldWrite32 (Address
, StartBit
, EndBit
, Value
));
2429 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
2430 writes the result back to the bit field in the 32-bit MMIO register and
2431 saves the value in the S3 script to be replayed on S3 resume.
2433 Reads the 32-bit MMIO register specified by Address, performs a bitwise
2434 inclusive OR between the read result and the value specified by OrData, and
2435 writes the result to the 32-bit MMIO register specified by Address. The value
2436 written to the MMIO register is returned. This function must guarantee that
2437 all MMIO read and write operations are serialized. Extra left bits in OrData
2440 If 32-bit MMIO register operations are not supported, then ASSERT().
2441 If StartBit is greater than 31, then ASSERT().
2442 If EndBit is greater than 31, then ASSERT().
2443 If EndBit is less than StartBit, then ASSERT().
2445 @param Address The MMIO register to write.
2446 @param StartBit The ordinal of the least significant bit in the bit field.
2448 @param EndBit The ordinal of the most significant bit in the bit field.
2450 @param OrData The value to OR with the read value from the MMIO register.
2452 @return The value written back to the MMIO register.
2457 S3MmioBitFieldOr32 (
2464 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldOr32 (Address
, StartBit
, EndBit
, OrData
));
2468 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
2469 writes the result back to the bit field in the 32-bit MMIO register and
2470 saves the value in the S3 script to be replayed on S3 resume.
2472 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2473 between the read result and the value specified by AndData, and writes the
2474 result to the 32-bit MMIO register specified by Address. The value written to
2475 the MMIO register is returned. This function must guarantee that all MMIO
2476 read and write operations are serialized. Extra left bits in AndData are
2479 If 32-bit MMIO register operations are not supported, then ASSERT().
2480 If StartBit is greater than 31, then ASSERT().
2481 If EndBit is greater than 31, then ASSERT().
2482 If EndBit is less than StartBit, then ASSERT().
2484 @param Address The MMIO register to write.
2485 @param StartBit The ordinal of the least significant bit in the bit field.
2487 @param EndBit The ordinal of the most significant bit in the bit field.
2489 @param AndData The value to AND with the read value from the MMIO register.
2491 @return The value written back to the MMIO register.
2496 S3MmioBitFieldAnd32 (
2503 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldAnd32 (Address
, StartBit
, EndBit
, AndData
));
2507 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
2508 by a bitwise OR, and writes the result back to the bit field in the
2509 32-bit MMIO register and saves the value in the S3 script to be replayed
2512 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2513 followed by a bitwise OR between the read result and the value
2514 specified by AndData, and writes the result to the 32-bit MMIO register
2515 specified by Address. The value written to the MMIO register is returned.
2516 This function must guarantee that all MMIO read and write operations are
2517 serialized. Extra left bits in both AndData and OrData are stripped.
2519 If 32-bit MMIO register operations are not supported, then ASSERT().
2520 If StartBit is greater than 31, then ASSERT().
2521 If EndBit is greater than 31, then ASSERT().
2522 If EndBit is less than StartBit, then ASSERT().
2524 @param Address The MMIO register to write.
2525 @param StartBit The ordinal of the least significant bit in the bit field.
2527 @param EndBit The ordinal of the most significant bit in the bit field.
2529 @param AndData The value to AND with the read value from the MMIO register.
2530 @param OrData The value to OR with the result of the AND operation.
2532 @return The value written back to the MMIO register.
2537 S3MmioBitFieldAndThenOr32 (
2545 return InternalSaveMmioWrite32ValueToBootScript (Address
, MmioBitFieldAndThenOr32 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2549 Saves a 64-bit MMIO register value to the boot script.
2551 This internal worker function saves a 64-bit MMIO register value in the S3 script
2552 to be replayed on S3 resume.
2554 If the saving process fails, then ASSERT().
2556 @param Address The MMIO register to write.
2557 @param Value The value saved to boot script.
2563 InternalSaveMmioWrite64ValueToBootScript (
2568 InternalSaveMmioWriteValueToBootScript (S3BootScriptWidthUint64
, Address
, &Value
);
2574 Reads a 64-bit MMIO register and saves the value in the S3 script to be
2575 replayed on S3 resume.
2577 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
2578 returned. This function must guarantee that all MMIO read and write
2579 operations are serialized.
2581 If 64-bit MMIO register operations are not supported, then ASSERT().
2583 @param Address The MMIO register to read.
2585 @return The value read.
2594 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioRead64 (Address
));
2598 Writes a 64-bit MMIO register and saves the value in the S3 script to be
2599 replayed on S3 resume.
2601 Writes the 64-bit MMIO register specified by Address with the value specified
2602 by Value and returns Value. This function must guarantee that all MMIO read
2603 and write operations are serialized.
2605 If 64-bit MMIO register operations are not supported, then ASSERT().
2607 @param Address The MMIO register to write.
2608 @param Value The value to write to the MMIO register.
2610 @return The value written the MMIO register.
2620 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioWrite64 (Address
, Value
));
2624 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2625 result back to the 64-bit MMIO register and saves the value in the S3 script
2626 to be replayed on S3 resume.
2628 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2629 inclusive OR between the read result and the value specified by OrData, and
2630 writes the result to the 64-bit MMIO register specified by Address. The value
2631 written to the MMIO register is returned. This function must guarantee that
2632 all MMIO read and write operations are serialized.
2634 If 64-bit MMIO register operations are not supported, then ASSERT().
2636 @param Address The MMIO register to write.
2637 @param OrData The value to OR with the read value from the MMIO register.
2639 @return The value written back to the MMIO register.
2649 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioOr64 (Address
, OrData
));
2653 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2654 back to the 64-bit MMIO register and saves the value in the S3 script to be
2655 replayed on S3 resume.
2657 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2658 between the read result and the value specified by AndData, and writes the
2659 result to the 64-bit MMIO register specified by Address. The value written to
2660 the MMIO register is returned. This function must guarantee that all MMIO
2661 read and write operations are serialized.
2663 If 64-bit MMIO register operations are not supported, then ASSERT().
2665 @param Address The MMIO register to write.
2666 @param AndData The value to AND with the read value from the MMIO register.
2668 @return The value written back to the MMIO register.
2678 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioAnd64 (Address
, AndData
));
2682 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2683 inclusive OR, and writes the result back to the 64-bit MMIO register and
2684 saves the value in the S3 script to be replayed on S3 resume.
2686 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2687 between the read result and the value specified by AndData, performs a
2688 bitwise OR between the result of the AND operation and the value specified by
2689 OrData, and writes the result to the 64-bit MMIO register specified by
2690 Address. The value written to the MMIO register is returned. This function
2691 must guarantee that all MMIO read and write operations are serialized.
2693 If 64-bit MMIO register operations are not supported, then ASSERT().
2695 @param Address The MMIO register to write.
2696 @param AndData The value to AND with the read value from the MMIO register.
2697 @param OrData The value to OR with the result of the AND operation.
2699 @return The value written back to the MMIO register.
2710 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioAndThenOr64 (Address
, AndData
, OrData
));
2714 Reads a bit field of a MMIO register saves the value in the S3 script to
2715 be replayed on S3 resume.
2717 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2718 the StartBit and the EndBit. The value of the bit field is returned.
2720 If 64-bit MMIO register operations are not supported, then ASSERT().
2721 If StartBit is greater than 63, then ASSERT().
2722 If EndBit is greater than 63, then ASSERT().
2723 If EndBit is less than StartBit, then ASSERT().
2725 @param Address MMIO register to read.
2726 @param StartBit The ordinal of the least significant bit in the bit field.
2728 @param EndBit The ordinal of the most significant bit in the bit field.
2731 @return The value read.
2736 S3MmioBitFieldRead64 (
2742 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldRead64 (Address
, StartBit
, EndBit
));
2746 Writes a bit field to a MMIO register and saves the value in the S3 script to
2747 be replayed on S3 resume.
2749 Writes Value to the bit field of the MMIO register. The bit field is
2750 specified by the StartBit and the EndBit. All other bits in the destination
2751 MMIO register are preserved. The new value of the 64-bit register is returned.
2753 If 64-bit MMIO register operations are not supported, then ASSERT().
2754 If StartBit is greater than 63, then ASSERT().
2755 If EndBit is greater than 63, then ASSERT().
2756 If EndBit is less than StartBit, then ASSERT().
2758 @param Address The MMIO register to write.
2759 @param StartBit The ordinal of the least significant bit in the bit field.
2761 @param EndBit The ordinal of the most significant bit in the bit field.
2763 @param Value New value of the bit field.
2765 @return The value written back to the MMIO register.
2770 S3MmioBitFieldWrite64 (
2777 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldWrite64 (Address
, StartBit
, EndBit
, Value
));
2781 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2782 writes the result back to the bit field in the 64-bit MMIO register and
2783 saves the value in the S3 script to be replayed on S3 resume.
2785 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2786 inclusive OR between the read result and the value specified by OrData, and
2787 writes the result to the 64-bit MMIO register specified by Address. The value
2788 written to the MMIO register is returned. This function must guarantee that
2789 all MMIO read and write operations are serialized. Extra left bits in OrData
2792 If 64-bit MMIO register operations are not supported, then ASSERT().
2793 If StartBit is greater than 63, then ASSERT().
2794 If EndBit is greater than 63, then ASSERT().
2795 If EndBit is less than StartBit, then ASSERT().
2797 @param Address The MMIO register to write.
2798 @param StartBit The ordinal of the least significant bit in the bit field.
2800 @param EndBit The ordinal of the most significant bit in the bit field.
2802 @param OrData The value to OR with the read value from the MMIO register.
2804 @return The value written back to the MMIO register.
2809 S3MmioBitFieldOr64 (
2816 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldOr64 (Address
, StartBit
, EndBit
, OrData
));
2820 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2821 writes the result back to the bit field in the 64-bit MMIO register and saves
2822 the value in the S3 script to be replayed on S3 resume.
2824 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2825 between the read result and the value specified by AndData, and writes the
2826 result to the 64-bit MMIO register specified by Address. The value written to
2827 the MMIO register is returned. This function must guarantee that all MMIO
2828 read and write operations are serialized. Extra left bits in AndData are
2831 If 64-bit MMIO register operations are not supported, then ASSERT().
2832 If StartBit is greater than 63, then ASSERT().
2833 If EndBit is greater than 63, then ASSERT().
2834 If EndBit is less than StartBit, then ASSERT().
2836 @param Address The MMIO register to write.
2837 @param StartBit The ordinal of the least significant bit in the bit field.
2839 @param EndBit The ordinal of the most significant bit in the bit field.
2841 @param AndData The value to AND with the read value from the MMIO register.
2843 @return The value written back to the MMIO register.
2848 S3MmioBitFieldAnd64 (
2855 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldAnd64 (Address
, StartBit
, EndBit
, AndData
));
2859 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2860 by a bitwise OR, and writes the result back to the bit field in the
2861 64-bit MMIO register and saves the value in the S3 script to be replayed
2864 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2865 followed by a bitwise OR between the read result and the value
2866 specified by AndData, and writes the result to the 64-bit MMIO register
2867 specified by Address. The value written to the MMIO register is returned.
2868 This function must guarantee that all MMIO read and write operations are
2869 serialized. Extra left bits in both AndData and OrData are stripped.
2871 If 64-bit MMIO register operations are not supported, then ASSERT().
2872 If StartBit is greater than 63, then ASSERT().
2873 If EndBit is greater than 63, then ASSERT().
2874 If EndBit is less than StartBit, then ASSERT().
2876 @param Address The MMIO register to write.
2877 @param StartBit The ordinal of the least significant bit in the bit field.
2879 @param EndBit The ordinal of the most significant bit in the bit field.
2881 @param AndData The value to AND with the read value from the MMIO register.
2882 @param OrData The value to OR with the result of the AND operation.
2884 @return The value written back to the MMIO register.
2889 S3MmioBitFieldAndThenOr64 (
2897 return InternalSaveMmioWrite64ValueToBootScript (Address
, MmioBitFieldAndThenOr64 (Address
, StartBit
, EndBit
, AndData
, OrData
));
2901 Copy data from MMIO region to system memory by using 8-bit access
2902 and saves the value in the S3 script to be replayed on S3 resume.
2904 Copy data from MMIO region specified by starting address StartAddress
2905 to system memory specified by Buffer by using 8-bit access. The total
2906 number of byte to be copied is specified by Length. Buffer is returned.
2908 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2909 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2912 @param StartAddress Starting address for the MMIO region to be copied from.
2913 @param Length Size in bytes of the copy.
2914 @param Buffer Pointer to a system memory buffer receiving the data read.
2922 IN UINTN StartAddress
,
2927 UINT8
*ReturnBuffer
;
2928 RETURN_STATUS Status
;
2930 ReturnBuffer
= MmioReadBuffer8 (StartAddress
, Length
, Buffer
);
2932 Status
= S3BootScriptSaveMemWrite (
2933 S3BootScriptWidthUint8
,
2935 Length
/ sizeof (UINT8
),
2938 ASSERT (Status
== RETURN_SUCCESS
);
2940 return ReturnBuffer
;
2944 Copy data from MMIO region to system memory by using 16-bit access
2945 and saves the value in the S3 script to be replayed on S3 resume.
2947 Copy data from MMIO region specified by starting address StartAddress
2948 to system memory specified by Buffer by using 16-bit access. The total
2949 number of byte to be copied is specified by Length. Buffer is returned.
2951 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
2953 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
2954 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2956 If Length is not aligned on a 16-bit boundary, then ASSERT().
2957 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
2959 @param StartAddress Starting address for the MMIO region to be copied from.
2960 @param Length Size in bytes of the copy.
2961 @param Buffer Pointer to a system memory buffer receiving the data read.
2968 S3MmioReadBuffer16 (
2969 IN UINTN StartAddress
,
2974 UINT16
*ReturnBuffer
;
2975 RETURN_STATUS Status
;
2977 ReturnBuffer
= MmioReadBuffer16 (StartAddress
, Length
, Buffer
);
2979 Status
= S3BootScriptSaveMemWrite (
2980 S3BootScriptWidthUint16
,
2982 Length
/ sizeof (UINT16
),
2985 ASSERT (Status
== RETURN_SUCCESS
);
2987 return ReturnBuffer
;
2991 Copy data from MMIO region to system memory by using 32-bit access
2992 and saves the value in the S3 script to be replayed on S3 resume.
2994 Copy data from MMIO region specified by starting address StartAddress
2995 to system memory specified by Buffer by using 32-bit access. The total
2996 number of byte to be copied is specified by Length. Buffer is returned.
2998 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
3000 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3001 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
3003 If Length is not aligned on a 32-bit boundary, then ASSERT().
3004 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
3006 @param StartAddress Starting address for the MMIO region to be copied from.
3007 @param Length Size in bytes of the copy.
3008 @param Buffer Pointer to a system memory buffer receiving the data read.
3015 S3MmioReadBuffer32 (
3016 IN UINTN StartAddress
,
3021 UINT32
*ReturnBuffer
;
3022 RETURN_STATUS Status
;
3024 ReturnBuffer
= MmioReadBuffer32 (StartAddress
, Length
, Buffer
);
3026 Status
= S3BootScriptSaveMemWrite (
3027 S3BootScriptWidthUint32
,
3029 Length
/ sizeof (UINT32
),
3032 ASSERT (Status
== RETURN_SUCCESS
);
3034 return ReturnBuffer
;
3038 Copy data from MMIO region to system memory by using 64-bit access
3039 and saves the value in the S3 script to be replayed on S3 resume.
3041 Copy data from MMIO region specified by starting address StartAddress
3042 to system memory specified by Buffer by using 64-bit access. The total
3043 number of byte to be copied is specified by Length. Buffer is returned.
3045 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
3047 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3048 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
3050 If Length is not aligned on a 64-bit boundary, then ASSERT().
3051 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
3053 @param StartAddress Starting address for the MMIO region to be copied from.
3054 @param Length Size in bytes of the copy.
3055 @param Buffer Pointer to a system memory buffer receiving the data read.
3062 S3MmioReadBuffer64 (
3063 IN UINTN StartAddress
,
3068 UINT64
*ReturnBuffer
;
3069 RETURN_STATUS Status
;
3071 ReturnBuffer
= MmioReadBuffer64 (StartAddress
, Length
, Buffer
);
3073 Status
= S3BootScriptSaveMemWrite (
3074 S3BootScriptWidthUint64
,
3076 Length
/ sizeof (UINT64
),
3079 ASSERT (Status
== RETURN_SUCCESS
);
3081 return ReturnBuffer
;
3086 Copy data from system memory to MMIO region by using 8-bit access
3087 and saves the value in the S3 script to be replayed on S3 resume.
3089 Copy data from system memory specified by Buffer to MMIO region specified
3090 by starting address StartAddress by using 8-bit access. The total number
3091 of byte to be copied is specified by Length. Buffer is returned.
3093 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3094 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3097 @param StartAddress Starting address for the MMIO region to be copied to.
3098 @param Length Size in bytes of the copy.
3099 @param Buffer Pointer to a system memory buffer containing the data to write.
3106 S3MmioWriteBuffer8 (
3107 IN UINTN StartAddress
,
3109 IN CONST UINT8
*Buffer
3112 UINT8
*ReturnBuffer
;
3113 RETURN_STATUS Status
;
3115 ReturnBuffer
= MmioWriteBuffer8 (StartAddress
, Length
, Buffer
);
3117 Status
= S3BootScriptSaveMemWrite (
3118 S3BootScriptWidthUint8
,
3120 Length
/ sizeof (UINT8
),
3123 ASSERT (Status
== RETURN_SUCCESS
);
3125 return ReturnBuffer
;
3129 Copy data from system memory to MMIO region by using 16-bit access
3130 and saves the value in the S3 script to be replayed on S3 resume.
3132 Copy data from system memory specified by Buffer to MMIO region specified
3133 by starting address StartAddress by using 16-bit access. The total number
3134 of byte to be copied is specified by Length. Buffer is returned.
3136 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
3138 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3139 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3141 If Length is not aligned on a 16-bit boundary, then ASSERT().
3143 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
3145 @param StartAddress Starting address for the MMIO region to be copied to.
3146 @param Length Size in bytes of the copy.
3147 @param Buffer Pointer to a system memory buffer containing the data to write.
3154 S3MmioWriteBuffer16 (
3155 IN UINTN StartAddress
,
3157 IN CONST UINT16
*Buffer
3160 UINT16
*ReturnBuffer
;
3161 RETURN_STATUS Status
;
3163 ReturnBuffer
= MmioWriteBuffer16 (StartAddress
, Length
, Buffer
);
3165 Status
= S3BootScriptSaveMemWrite (
3166 S3BootScriptWidthUint16
,
3168 Length
/ sizeof (UINT16
),
3171 ASSERT (Status
== RETURN_SUCCESS
);
3173 return ReturnBuffer
;
3178 Copy data from system memory to MMIO region by using 32-bit access
3179 and saves the value in the S3 script to be replayed on S3 resume.
3181 Copy data from system memory specified by Buffer to MMIO region specified
3182 by starting address StartAddress by using 32-bit access. The total number
3183 of byte to be copied is specified by Length. Buffer is returned.
3185 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
3187 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3188 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3190 If Length is not aligned on a 32-bit boundary, then ASSERT().
3192 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
3194 @param StartAddress Starting address for the MMIO region to be copied to.
3195 @param Length Size in bytes of the copy.
3196 @param Buffer Pointer to a system memory buffer containing the data to write.
3203 S3MmioWriteBuffer32 (
3204 IN UINTN StartAddress
,
3206 IN CONST UINT32
*Buffer
3209 UINT32
*ReturnBuffer
;
3210 RETURN_STATUS Status
;
3212 ReturnBuffer
= MmioWriteBuffer32 (StartAddress
, Length
, Buffer
);
3214 Status
= S3BootScriptSaveMemWrite (
3215 S3BootScriptWidthUint32
,
3217 Length
/ sizeof (UINT32
),
3220 ASSERT (Status
== RETURN_SUCCESS
);
3222 return ReturnBuffer
;
3226 Copy data from system memory to MMIO region by using 64-bit access
3227 and saves the value in the S3 script to be replayed on S3 resume.
3229 Copy data from system memory specified by Buffer to MMIO region specified
3230 by starting address StartAddress by using 64-bit access. The total number
3231 of byte to be copied is specified by Length. Buffer is returned.
3233 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
3235 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
3236 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
3238 If Length is not aligned on a 64-bit boundary, then ASSERT().
3240 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
3242 @param StartAddress Starting address for the MMIO region to be copied to.
3243 @param Length Size in bytes of the copy.
3244 @param Buffer Pointer to a system memory buffer containing the data to write.
3251 S3MmioWriteBuffer64 (
3252 IN UINTN StartAddress
,
3254 IN CONST UINT64
*Buffer
3257 UINT64
*ReturnBuffer
;
3258 RETURN_STATUS Status
;
3260 ReturnBuffer
= MmioWriteBuffer64 (StartAddress
, Length
, Buffer
);
3262 Status
= S3BootScriptSaveMemWrite (
3263 S3BootScriptWidthUint64
,
3265 Length
/ sizeof (UINT64
),
3268 ASSERT (Status
== RETURN_SUCCESS
);
3270 return ReturnBuffer
;