]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/S3IoLib.h
MdePkg: Add S3 library interfaces and base implementations
[mirror_edk2.git] / MdePkg / Include / Library / S3IoLib.h
diff --git a/MdePkg/Include/Library/S3IoLib.h b/MdePkg/Include/Library/S3IoLib.h
new file mode 100644 (file)
index 0000000..ab6e126
--- /dev/null
@@ -0,0 +1,2637 @@
+/** @file\r
+  I/O and MMIO Library Services that do I/O and also enable the I/O operation\r
+  to be replayed during an S3 resume. This library class maps directly on top\r
+  of the IoLib class. \r
+\r
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions\r
+  of the BSD License which accompanies this distribution.  The\r
+  full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __S3_IO_LIB_H__\r
+#define __S3_IO_LIB_H__\r
+\r
+/**\r
+  Reads an 8-bit I/O port and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
+  This function must guarantee that all I/O read and write operations are\r
+  serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port   The I/O port to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoRead8 (\r
+  IN UINTN  Port\r
+  );\r
+\r
+/**\r
+  Writes an 8-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Writes the 8-bit I/O port specified by Port with the value specified by Value\r
+  and returns Value. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port    The I/O port to write.\r
+  @param[in]  Value   The value to write to the I/O port.\r
+\r
+  @return   The value written the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoWrite8 (\r
+  IN UINTN  Port,\r
+  IN UINT8  Value\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit I/O port, performs a bitwise OR, writes the\r
+  result back to the 8-bit I/O port, and saves the value in the S3 script to be\r
+  replayed on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 8-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port     The I/O port to write.\r
+  @param[in]  OrData   The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoOr8 (\r
+  IN UINTN  Port,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit I/O port, performs a bitwise AND, writes the result back\r
+  to the 8-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 8-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoAnd8 (\r
+  IN UINTN  Port,\r
+  IN UINT8  AndData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 8-bit I/O port, and saves \r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, performs a bitwise OR\r
+  between the result of the AND operation and the value specified by OrData,\r
+  and writes the result to the 8-bit I/O port specified by Port. The value\r
+  written to the I/O port is returned. This function must guarantee that all\r
+  I/O read and write operations are serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoAndThenOr8 (\r
+  IN UINTN  Port,\r
+  IN UINT8  AndData,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of an I/O register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in an 8-bit I/O register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoBitFieldRead8 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to an I/O register and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the I/O register. The bit field is specified\r
+  by the StartBit and the EndBit. All other bits in the destination I/O\r
+  register are preserved. The value written to the I/O port is returned. \r
+  Remaining bits in Value are stripped.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoBitFieldWrite8 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit port, performs a bitwise OR, writes the\r
+  result back to the bit field in the 8-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 8-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized. Extra left bits in OrData are stripped.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  OrData     The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoBitFieldOr8 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit port, performs a bitwise AND, writes the\r
+  result back to the bit field in the 8-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 8-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized. Extra left bits in AndData are stripped.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoBitFieldAnd8 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r
+  bitwise OR, writes the result back to the bit field in the\r
+  8-bit port, and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed\r
+  by a bitwise OR between the read result and the value specified by\r
+  AndData, and writes the result to the 8-bit I/O port specified by Port. The\r
+  value written to the I/O port is returned. This function must guarantee that\r
+  all I/O read and write operations are serialized. Extra left bits in both\r
+  AndData and OrData are stripped.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3IoBitFieldAndThenOr8 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  AndData,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
+  This function must guarantee that all I/O read and write operations are\r
+  serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port   The I/O port to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoRead16 (\r
+  IN UINTN  Port\r
+  );\r
+\r
+/**\r
+  Writes a 16-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Writes the 16-bit I/O port specified by Port with the value specified by Value\r
+  and returns Value. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port    The I/O port to write.\r
+  @param[in]  Value   The value to write to the I/O port.\r
+\r
+  @return   The value written the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoWrite16 (\r
+  IN UINTN   Port,\r
+  IN UINT16  Value\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit I/O port, performs a bitwise OR, writes the\r
+  result back to the 16-bit I/O port, and saves the value in the S3 script to \r
+  be replayed on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 16-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port     The I/O port to write.\r
+  @param[in]  OrData   The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoOr16 (\r
+  IN UINTN   Port,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit I/O port, performs a bitwise AND, writes the result back\r
+  to the 16-bit I/O port , and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 16-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoAnd16 (\r
+  IN UINTN   Port,\r
+  IN UINT16  AndData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 16-bit I/O port, and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, performs a bitwise OR\r
+  between the result of the AND operation and the value specified by OrData,\r
+  and writes the result to the 16-bit I/O port specified by Port. The value\r
+  written to the I/O port is returned. This function must guarantee that all\r
+  I/O read and write operations are serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoAndThenOr16 (\r
+  IN UINTN   Port,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of an I/O register saves the value in the S3 script to be\r
+  replayed on S3 resume.\r
+\r
+  Reads the bit field in a 16-bit I/O register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoBitFieldRead16 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to an I/O register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the I/O register. The bit field is specified\r
+  by the StartBit and the EndBit. All other bits in the destination I/O\r
+  register are preserved. The value written to the I/O port is returned. Extra\r
+  left bits in Value are stripped.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoBitFieldWrite16 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit port, performs a bitwise OR, writes the\r
+  result back to the bit field in the 16-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 16-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized. Extra left bits in OrData are stripped.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  OrData     The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoBitFieldOr16 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit port, performs a bitwise AND, writes the\r
+  result back to the bit field in the 16-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 16-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized. Extra left bits in AndData are stripped.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoBitFieldAnd16 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r
+  bitwise OR, writes the result back to the bit field in the\r
+  16-bit port, and saves the value in the S3 script to be replayed on S3 \r
+  resume.\r
+\r
+  Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed\r
+  by a bitwise OR between the read result and the value specified by\r
+  AndData, and writes the result to the 16-bit I/O port specified by Port. The\r
+  value written to the I/O port is returned. This function must guarantee that\r
+  all I/O read and write operations are serialized. Extra left bits in both\r
+  AndData and OrData are stripped.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3IoBitFieldAndThenOr16 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
+  This function must guarantee that all I/O read and write operations are\r
+  serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port   The I/O port to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoRead32 (\r
+  IN UINTN  Port\r
+  );\r
+\r
+/**\r
+  Writes a 32-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Writes the 32-bit I/O port specified by Port with the value specified by Value\r
+  and returns Value. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port    The I/O port to write.\r
+  @param[in]  Value   The value to write to the I/O port.\r
+\r
+  @return   The value written the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoWrite32 (\r
+  IN UINTN   Port,\r
+  IN UINT32  Value\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit I/O port, performs a bitwise OR, writes the\r
+  result back to the 32-bit I/O port, and saves the value in the S3 script to \r
+  be replayed on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 32-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port     The I/O port to write.\r
+  @param[in]  OrData   The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoOr32 (\r
+  IN UINTN   Port,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit I/O port, performs a bitwise AND, writes the result back\r
+  to the 32-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 32-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoAnd32 (\r
+  IN UINTN   Port,\r
+  IN UINT32  AndData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 32-bit I/O port, and saves \r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, performs a bitwise OR\r
+  between the result of the AND operation and the value specified by OrData,\r
+  and writes the result to the 32-bit I/O port specified by Port. The value\r
+  written to the I/O port is returned. This function must guarantee that all\r
+  I/O read and write operations are serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoAndThenOr32 (\r
+  IN UINTN   Port,\r
+  IN UINT32  AndData,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of an I/O register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in a 32-bit I/O register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoBitFieldRead32 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to an I/O register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the I/O register. The bit field is specified\r
+  by the StartBit and the EndBit. All other bits in the destination I/O\r
+  register are preserved. The value written to the I/O port is returned. Extra\r
+  left bits in Value are stripped.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoBitFieldWrite32 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit port, performs a bitwise OR, writes the\r
+  result back to the bit field in the 32-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 32-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized. Extra left bits in OrData are stripped.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  OrData     The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoBitFieldOr32 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit port, performs a bitwise AND, writes the\r
+  result back to the bit field in the 32-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 32-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized. Extra left bits in AndData are stripped.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoBitFieldAnd32 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r
+  bitwise OR, writes the result back to the bit field in the\r
+  32-bit port, and saves the value in the S3 script to be replayed on S3 \r
+  resume.\r
+\r
+  Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed\r
+  by a bitwise OR between the read result and the value specified by\r
+  AndData, and writes the result to the 32-bit I/O port specified by Port. The\r
+  value written to the I/O port is returned. This function must guarantee that\r
+  all I/O read and write operations are serialized. Extra left bits in both\r
+  AndData and OrData are stripped.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3IoBitFieldAndThenOr32 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
+  This function must guarantee that all I/O read and write operations are\r
+  serialized.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port   The I/O port to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoRead64 (\r
+  IN UINTN  Port\r
+  );\r
+\r
+/**\r
+  Writes a 64-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Writes the 64-bit I/O port specified by Port with the value specified by Value\r
+  and returns Value. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port    The I/O port to write.\r
+  @param[in]  Value   The value to write to the I/O port.\r
+\r
+  @return   The value written to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoWrite64 (\r
+  IN UINTN   Port,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, performs a bitwise OR, writes the\r
+  result back to the 64-bit I/O port, and saves the value in the S3 script to \r
+  be replayed on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 64-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port     The I/O port to write.\r
+  @param[in]  OrData   The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoOr64 (\r
+  IN UINTN   Port,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, performs a bitwise AND, writes the result back\r
+  to the 64-bit I/O port, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 64-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoAnd64 (\r
+  IN UINTN   Port,\r
+  IN UINT64  AndData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 64-bit I/O port, and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, performs a bitwise OR\r
+  between the result of the AND operation and the value specified by OrData,\r
+  and writes the result to the 64-bit I/O port specified by Port. The value\r
+  written to the I/O port is returned. This function must guarantee that all\r
+  I/O read and write operations are serialized.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Port      The I/O port to write.\r
+  @param[in]  AndData   The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoAndThenOr64 (\r
+  IN UINTN   Port,\r
+  IN UINT64  AndData,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of an I/O register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in a 64-bit I/O register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoBitFieldRead64 (\r
+  IN UINTN  Port,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to an I/O register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the I/O register. The bit field is specified\r
+  by the StartBit and the EndBit. All other bits in the destination I/O\r
+  register are preserved. The value written to the I/O port is returned. Extra\r
+  left bits in Value are stripped.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoBitFieldWrite64 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit port, performs a bitwise OR, writes the\r
+  result back to the bit field in the 64-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 64-bit I/O port specified by Port. The value written to the I/O\r
+  port is returned. This function must guarantee that all I/O read and write\r
+  operations are serialized. Extra left bits in OrData are stripped.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  OrData     The value to OR with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoBitFieldOr64 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit port, performs a bitwise AND, writes the\r
+  result back to the bit field in the 64-bit port, and saves the value in the \r
+  S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
+  the read result and the value specified by AndData, and writes the result to\r
+  the 64-bit I/O port specified by Port. The value written to the I/O port is\r
+  returned. This function must guarantee that all I/O read and write operations\r
+  are serialized. Extra left bits in AndData are stripped.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoBitFieldAnd64 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit port, performs a bitwise AND followed by a\r
+  bitwise OR, writes the result back to the bit field in the\r
+  64-bit port, and saves the value in the S3 script to be replayed on S3 \r
+  resume.\r
+\r
+  Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed\r
+  by a bitwise OR between the read result and the value specified by\r
+  AndData, and writes the result to the 64-bit I/O port specified by Port. The\r
+  value written to the I/O port is returned. This function must guarantee that\r
+  all I/O read and write operations are serialized. Extra left bits in both\r
+  AndData and OrData are stripped.\r
+\r
+  If 64-bit I/O port operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Port       The I/O port to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  AndData    The value to AND with the read value from the I/O port.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3IoBitFieldAndThenOr64 (\r
+  IN UINTN   Port,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  AndData,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
+  returned. This function must guarantee that all MMIO read and write\r
+  operations are serialized.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioRead8 (\r
+  IN UINTN  Address\r
+  );\r
+\r
+/**\r
+  Writes an 8-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Writes the 8-bit MMIO register specified by Address with the value specified\r
+  by Value and returns Value. This function must guarantee that all MMIO read\r
+  and write operations are serialized.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  Value     The value to write to the MMIO register.\r
+\r
+  @return   The value written the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioWrite8 (\r
+  IN UINTN  Address,\r
+  IN UINT8  Value\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit MMIO register, performs a bitwise OR, writes the\r
+  result back to the 8-bit MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 8-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  OrData    The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioOr8 (\r
+  IN UINTN  Address,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit MMIO register, performs a bitwise AND, writes the result\r
+  back to the 8-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 8-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioAnd8 (\r
+  IN UINTN  Address,\r
+  IN UINT8  AndData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 8-bit MMIO register, and saves \r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, performs a\r
+  bitwise OR between the result of the AND operation and the value specified by\r
+  OrData, and writes the result to the 8-bit MMIO register specified by\r
+  Address. The value written to the MMIO register is returned. This function\r
+  must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioAndThenOr8 (\r
+  IN UINTN  Address,\r
+  IN UINT8  AndData,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in an 8-bit MMIO register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    MMIO register to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioBitFieldRead8 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to an MMIO register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the MMIO register. The bit field is\r
+  specified by the StartBit and the EndBit. All other bits in the destination\r
+  MMIO register are preserved. The new value of the 8-bit register is returned.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioBitFieldWrite8 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, \r
+  writes the result back to the bit field in the 8-bit MMIO register, and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 8-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized. Extra left bits in OrData\r
+  are stripped.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  OrData     The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioBitFieldOr8 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and\r
+  writes the result back to the bit field in the 8-bit MMIO register, and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 8-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized. Extra left bits in AndData are\r
+  stripped.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioBitFieldAnd8 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed\r
+  by a bitwise OR, writes the result back to the bit field in the\r
+  8-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
+  followed by a bitwise OR between the read result and the value\r
+  specified by AndData, and writes the result to the 8-bit MMIO register\r
+  specified by Address. The value written to the MMIO register is returned.\r
+  This function must guarantee that all MMIO read and write operations are\r
+  serialized. Extra left bits in both AndData and OrData are stripped.\r
+\r
+  If 8-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 7, then ASSERT().\r
+  If EndBit is greater than 7, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..7.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+S3MmioBitFieldAndThenOr8 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit,\r
+  IN UINT8  AndData,\r
+  IN UINT8  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
+  returned. This function must guarantee that all MMIO read and write\r
+  operations are serialized.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioRead16 (\r
+  IN UINTN  Address\r
+  );\r
+\r
+/**\r
+  Writes a 16-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Writes the 16-bit MMIO register specified by Address with the value specified\r
+  by Value and returns Value. This function must guarantee that all MMIO read\r
+  and write operations are serialized, and saves the value in the S3 script to be\r
+  replayed on S3 resume.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  Value     The value to write to the MMIO register.\r
+\r
+  @return   The value written the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioWrite16 (\r
+  IN UINTN   Address,\r
+  IN UINT16  Value\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit MMIO register, performs a bitwise OR, writes the\r
+  result back to the 16-bit MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 16-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  OrData    The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioOr16 (\r
+  IN UINTN   Address,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit MMIO register, performs a bitwise AND, writes the result\r
+  back to the 16-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 16-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioAnd16 (\r
+  IN UINTN   Address,\r
+  IN UINT16  AndData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 16-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, performs a\r
+  bitwise OR between the result of the AND operation and the value specified by\r
+  OrData, and writes the result to the 16-bit MMIO register specified by\r
+  Address. The value written to the MMIO register is returned. This function\r
+  must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioAndThenOr16 (\r
+  IN UINTN   Address,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in a 16-bit MMIO register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    MMIO register to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioBitFieldRead16 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the MMIO register. The bit field is\r
+  specified by the StartBit and the EndBit. All other bits in the destination\r
+  MMIO register are preserved. The new value of the 16-bit register is returned.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioBitFieldWrite16 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, \r
+  writes the result back to the bit field in the 16-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 16-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized. Extra left bits in OrData\r
+  are stripped.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  OrData     The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioBitFieldOr16 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and\r
+  writes the result back to the bit field in the 16-bit MMIO register and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 16-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized. Extra left bits in AndData are\r
+  stripped.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioBitFieldAnd16 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed\r
+  by a bitwise OR, writes the result back to the bit field in the\r
+  16-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
+  followed by a bitwise OR between the read result and the value\r
+  specified by AndData, and writes the result to the 16-bit MMIO register\r
+  specified by Address. The value written to the MMIO register is returned.\r
+  This function must guarantee that all MMIO read and write operations are\r
+  serialized. Extra left bits in both AndData and OrData are stripped.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 15, then ASSERT().\r
+  If EndBit is greater than 15, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..15.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+S3MmioBitFieldAndThenOr16 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT16  AndData,\r
+  IN UINT16  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit MMIO register saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
+  returned. This function must guarantee that all MMIO read and write\r
+  operations are serialized.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioRead32 (\r
+  IN UINTN  Address\r
+  );\r
+\r
+/**\r
+  Writes a 32-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Writes the 32-bit MMIO register specified by Address with the value specified\r
+  by Value and returns Value. This function must guarantee that all MMIO read\r
+  and write operations are serialized.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  Value     The value to write to the MMIO register.\r
+\r
+  @return   The value written the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioWrite32 (\r
+  IN UINTN   Address,\r
+  IN UINT32  Value\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit MMIO register, performs a bitwise OR, writes the\r
+  result back to the 32-bit MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 32-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  OrData    The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioOr32 (\r
+  IN UINTN   Address,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit MMIO register, performs a bitwise AND, writes the result\r
+  back to the 32-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 32-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioAnd32 (\r
+  IN UINTN   Address,\r
+  IN UINT32  AndData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 32-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, performs a\r
+  bitwise OR between the result of the AND operation and the value specified by\r
+  OrData, and writes the result to the 32-bit MMIO register specified by\r
+  Address. The value written to the MMIO register is returned. This function\r
+  must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioAndThenOr32 (\r
+  IN UINTN    Address,\r
+  IN UINT32   AndData,\r
+  IN UINT32   OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Reads the bit field in a 32-bit MMIO register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    MMIO register to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioBitFieldRead32 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the MMIO register. The bit field is\r
+  specified by the StartBit and the EndBit. All other bits in the destination\r
+  MMIO register are preserved. The new value of the 32-bit register is returned.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioBitFieldWrite32 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, \r
+  writes the result back to the bit field in the 32-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 32-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized. Extra left bits in OrData\r
+  are stripped.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  OrData     The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioBitFieldOr32 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and\r
+  writes the result back to the bit field in the 32-bit MMIO register and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 32-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized. Extra left bits in AndData are\r
+  stripped.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioBitFieldAnd32 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed\r
+  by a bitwise OR, writes the result back to the bit field in the\r
+  32-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
+  followed by a bitwise OR between the read result and the value\r
+  specified by AndData, and writes the result to the 32-bit MMIO register\r
+  specified by Address. The value written to the MMIO register is returned.\r
+  This function must guarantee that all MMIO read and write operations are\r
+  serialized. Extra left bits in both AndData and OrData are stripped.\r
+\r
+  If 32-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..31.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+S3MmioBitFieldAndThenOr32 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT32  AndData,\r
+  IN UINT32  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
+  returned. This function must guarantee that all MMIO read and write\r
+  operations are serialized.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to read.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioRead64 (\r
+  IN UINTN  Address\r
+  );\r
+\r
+/**\r
+  Writes a 64-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Writes the 64-bit MMIO register specified by Address with the value specified\r
+  by Value and returns Value. This function must guarantee that all MMIO read\r
+  and write operations are serialized.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  Value     The value to write to the MMIO register.\r
+\r
+  @return   The value written the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioWrite64 (\r
+  IN UINTN   Address,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit MMIO register, performs a bitwise OR, writes the\r
+  result back to the 64-bit MMIO register, and saves the value in the S3 script \r
+  to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 64-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  OrData    The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioOr64 (\r
+  IN UINTN   Address,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit MMIO register, performs a bitwise AND, writes the result\r
+  back to the 64-bit MMIO register, and saves the value in the S3 script to be \r
+  replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 64-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioAnd64 (\r
+  IN UINTN              Address,\r
+  IN UINT64             AndData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r
+  inclusive OR, writes the result back to the 64-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, performs a\r
+  bitwise OR between the result of the AND operation and the value specified by\r
+  OrData, and writes the result to the 64-bit MMIO register specified by\r
+  Address. The value written to the MMIO register is returned. This function\r
+  must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+\r
+  @param[in]  Address   The MMIO register to write.\r
+  @param[in]  AndData   The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioAndThenOr64 (\r
+  IN UINTN   Address,\r
+  IN UINT64  AndData,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Reads the bit field in a 64-bit MMIO register. The bit field is specified by\r
+  the StartBit and the EndBit. The value of the bit field is returned.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    MMIO register to read.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+\r
+  @return   The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioBitFieldRead64 (\r
+  IN UINTN  Address,\r
+  IN UINTN  StartBit,\r
+  IN UINTN  EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register, and saves the value in the S3 script to\r
+  be replayed on S3 resume.\r
+\r
+  Writes Value to the bit field of the MMIO register. The bit field is\r
+  specified by the StartBit and the EndBit. All other bits in the destination\r
+  MMIO register are preserved. The new value of the 64-bit register is returned.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  Value      New value of the bit field.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioBitFieldWrite64 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, \r
+  writes the result back to the bit field in the 64-bit MMIO register, and \r
+  saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
+  inclusive OR between the read result and the value specified by OrData, and\r
+  writes the result to the 64-bit MMIO register specified by Address. The value\r
+  written to the MMIO register is returned. This function must guarantee that\r
+  all MMIO read and write operations are serialized. Extra left bits in OrData\r
+  are stripped.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  OrData     The value to OR with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioBitFieldOr64 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and\r
+  writes the result back to the bit field in the 64-bit MMIO register, and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
+  between the read result and the value specified by AndData, and writes the\r
+  result to the 64-bit MMIO register specified by Address. The value written to\r
+  the MMIO register is returned. This function must guarantee that all MMIO\r
+  read and write operations are serialized. Extra left bits in AndData are\r
+  stripped.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioBitFieldAnd64 (\r
+  IN UINTN    Address,\r
+  IN UINTN    StartBit,\r
+  IN UINTN    EndBit,\r
+  IN UINT64   AndData\r
+  );\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed\r
+  by a bitwise OR, writes the result back to the bit field in the\r
+  64-bit MMIO register, and saves the value in the S3 script to be replayed\r
+  on S3 resume.\r
+\r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
+  followed by a bitwise OR between the read result and the value\r
+  specified by AndData, and writes the result to the 64-bit MMIO register\r
+  specified by Address. The value written to the MMIO register is returned.\r
+  This function must guarantee that all MMIO read and write operations are\r
+  serialized. Extra left bits in both AndData and OrData are stripped.\r
+\r
+  If 64-bit MMIO register operations are not supported, then ASSERT().\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param[in]  Address    The MMIO register to write.\r
+  @param[in]  StartBit   The ordinal of the least significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  EndBit     The ordinal of the most significant bit in the bit field.\r
+                         Range 0..63.\r
+  @param[in]  AndData    The value to AND with the read value from the MMIO register.\r
+  @param[in]  OrData     The value to OR with the result of the AND operation.\r
+\r
+  @return   The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+S3MmioBitFieldAndThenOr64 (\r
+  IN UINTN   Address,\r
+  IN UINTN   StartBit,\r
+  IN UINTN   EndBit,\r
+  IN UINT64  AndData,\r
+  IN UINT64  OrData\r
+  );\r
+\r
+/**\r
+  Copies data from MMIO region to system memory by using 8-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from MMIO region specified by starting address StartAddress \r
+  to system memory specified by Buffer by using 8-bit access. The total \r
+  number of bytes to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied from.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[out] Buffer         Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+S3MmioReadBuffer8 (\r
+  IN  UINTN  StartAddress,\r
+  IN  UINTN  Length,\r
+  OUT UINT8  *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from MMIO region to system memory by using 16-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from MMIO region specified by starting address StartAddress \r
+  to system memory specified by Buffer by using 16-bit access. The total \r
+  number of bytes to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 16-bit boundary, then ASSERT().\r
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied from.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[out] Buffer         Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT16 *\r
+EFIAPI\r
+S3MmioReadBuffer16 (\r
+  IN  UINTN   StartAddress,\r
+  IN  UINTN   Length,\r
+  OUT UINT16  *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from MMIO region to system memory by using 32-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from MMIO region specified by starting address StartAddress \r
+  to system memory specified by Buffer by using 32-bit access. The total \r
+  number of byte to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied from.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[out] Buffer         Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT32 *\r
+EFIAPI\r
+S3MmioReadBuffer32 (\r
+  IN  UINTN   StartAddress,\r
+  IN  UINTN   Length,\r
+  OUT UINT32  *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from MMIO region to system memory by using 64-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from MMIO region specified by starting address StartAddress \r
+  to system memory specified by Buffer by using 64-bit access. The total \r
+  number of byte to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 64-bit boundary, then ASSERT().\r
+  If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied from.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[out] Buffer         Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT64 *\r
+EFIAPI\r
+S3MmioReadBuffer64 (\r
+  IN  UINTN       StartAddress,\r
+  IN  UINTN       Length,\r
+  OUT UINT64      *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from system memory to MMIO region by using 8-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from system memory specified by Buffer to MMIO region specified \r
+  by starting address StartAddress by using 8-bit access. The total number \r
+  of byte to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
+\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied to.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[in]  Buffer         Pointer to a system memory buffer containing the data to write.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+S3MmioWriteBuffer8 (\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT8   *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from system memory to MMIO region by using 16-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from system memory specified by Buffer to MMIO region specified \r
+  by starting address StartAddress by using 16-bit access. The total number \r
+  of bytes to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied to.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[in]  Buffer         Pointer to a system memory buffer containing the data to write.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT16 *\r
+EFIAPI\r
+S3MmioWriteBuffer16 (\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT16  *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from system memory to MMIO region by using 32-bit access,\r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from system memory specified by Buffer to MMIO region specified \r
+  by starting address StartAddress by using 32-bit access. The total number \r
+  of bytes to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied to.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[in]  Buffer         Pointer to a system memory buffer containing the data to write.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT32 *\r
+EFIAPI\r
+S3MmioWriteBuffer32 (\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT32  *Buffer\r
+  );\r
+\r
+/**\r
+  Copies data from system memory to MMIO region by using 64-bit access, \r
+  and saves the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Copy data from system memory specified by Buffer to MMIO region specified \r
+  by starting address StartAddress by using 64-bit access. The total number \r
+  of bytes to be copied is specified by Length. Buffer is returned.\r
+  \r
+  If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
+\r
+  If Length is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param[in]  StartAddress   Starting address for the MMIO region to be copied to.\r
+  @param[in]  Length         Size in bytes of the copy.\r
+  @param[in]  Buffer         Pointer to a system memory buffer containing the data to write.\r
+\r
+  @return   Buffer.\r
+\r
+**/\r
+UINT64 *\r
+EFIAPI\r
+S3MmioWriteBuffer64 (\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT64  *Buffer\r
+  );\r
+\r
+#endif\r