]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/IoLib.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Library / IoLib.h
index 289c10ff54386aa52d9958ff808d44616f5ce988..afdb0d83a73b24af1191109804329f5641b6eac6 100644 (file)
@@ -1,14 +1,10 @@
 /** @file\r
   Provide services to access I/O Ports and MMIO registers.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\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
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -18,14 +14,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\r
   Macro that converts PCI Segment and I/O Port to an address that can be\r
   passed to the I/O Library functions.\r
-  \r
-  Computes an address that is compatible with the I/O Library functions.  \r
-  The unused upper bits of Segment, and Port are stripped prior to the \r
+\r
+  Computes an address that is compatible with the I/O Library functions.\r
+  The unused upper bits of Segment, and Port are stripped prior to the\r
   generation of the address.\r
-  \r
+\r
   @param  Segment   PCI Segment number.  Range 0..65535.\r
   @param  Port      I/O Port number.  Range 0..65535.\r
-  \r
+\r
   @return An address that the I/o Library functions need.\r
 \r
 **/\r
@@ -75,6 +71,56 @@ IoWrite8 (
   IN      UINT8                     Value\r
   );\r
 \r
+/**\r
+  Reads an 8-bit I/O port fifo into a block of memory.\r
+\r
+  Reads the 8-bit I/O fifo port specified by Port.\r
+  The port is read Count times, and the read data is\r
+  stored in the provided Buffer.\r
+\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  Port    The I/O port to read.\r
+  @param  Count   The number of times to read I/O port.\r
+  @param  Buffer  The buffer to store the read data into.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoReadFifo8 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  OUT     VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Writes a block of memory into an 8-bit I/O port fifo.\r
+\r
+  Writes the 8-bit I/O fifo port specified by Port.\r
+  The port is written Count times, and the write data is\r
+  retrieved from the provided Buffer.\r
+\r
+  This function must guarantee that all I/O write and write operations are\r
+  serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  Count   The number of times to write I/O port.\r
+  @param  Buffer  The buffer to retrieve the write data from.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoWriteFifo8 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  IN      VOID                      *Buffer\r
+  );\r
+\r
 /**\r
   Reads an 8-bit I/O port, performs a bitwise OR, and writes the\r
   result back to the 8-bit I/O port.\r
@@ -126,7 +172,7 @@ IoAnd8 (
   );\r
 \r
 /**\r
-  Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise \r
+  Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 8-bit I/O port.\r
 \r
   Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
@@ -186,12 +232,13 @@ IoBitFieldRead8 (
 \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
+  register are preserved. The value written to the I/O port 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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -226,6 +273,7 @@ IoBitFieldWrite8 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -260,6 +308,7 @@ IoBitFieldOr8 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -296,6 +345,8 @@ IoBitFieldAnd8 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -348,7 +399,7 @@ IoRead16 (
 \r
   If 16-bit I/O port operations are not supported, then ASSERT().\r
   If Port is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
+\r
   @param  Port  The I/O port to write.\r
   @param  Value The value to write to the I/O port.\r
 \r
@@ -362,6 +413,56 @@ IoWrite16 (
   IN      UINT16                    Value\r
   );\r
 \r
+/**\r
+  Reads a 16-bit I/O port fifo into a block of memory.\r
+\r
+  Reads the 16-bit I/O fifo port specified by Port.\r
+  The port is read Count times, and the read data is\r
+  stored in the provided Buffer.\r
+\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  Port    The I/O port to read.\r
+  @param  Count   The number of times to read I/O port.\r
+  @param  Buffer  The buffer to store the read data into.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoReadFifo16 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  OUT     VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Writes a block of memory into a 16-bit I/O port fifo.\r
+\r
+  Writes the 16-bit I/O fifo port specified by Port.\r
+  The port is written Count times, and the write data is\r
+  retrieved from the provided Buffer.\r
+\r
+  This function must guarantee that all I/O write and write operations are\r
+  serialized.\r
+\r
+  If 16-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  Count   The number of times to write I/O port.\r
+  @param  Buffer  The buffer to retrieve the write data from.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoWriteFifo16 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  IN      VOID                      *Buffer\r
+  );\r
+\r
 /**\r
   Reads a 16-bit I/O port, performs a bitwise OR, and writes the\r
   result back to the 16-bit I/O port.\r
@@ -400,7 +501,7 @@ IoOr16 (
 \r
   If 16-bit I/O port operations are not supported, then ASSERT().\r
   If Port is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
+\r
   @param  Port    The I/O port to write.\r
   @param  AndData The value to AND with the read value from the I/O port.\r
 \r
@@ -415,7 +516,7 @@ IoAnd16 (
   );\r
 \r
 /**\r
-  Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise \r
+  Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 16-bit I/O port.\r
 \r
   Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
@@ -427,7 +528,7 @@ IoAnd16 (
 \r
   If 16-bit I/O port operations are not supported, then ASSERT().\r
   If Port is not aligned on a 16-bit boundary, then ASSERT().\r
-  \r
+\r
   @param  Port    The I/O port to write.\r
   @param  AndData The value to AND with the read value from the I/O port.\r
   @param  OrData  The value to OR with the result of the AND operation.\r
@@ -485,6 +586,7 @@ IoBitFieldRead16 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -520,6 +622,7 @@ IoBitFieldWrite16 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -555,6 +658,7 @@ IoBitFieldOr16 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -592,6 +696,8 @@ IoBitFieldAnd16 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -623,7 +729,7 @@ IoBitFieldAndThenOr16 (
 \r
   If 32-bit I/O port operations are not supported, then ASSERT().\r
   If Port is not aligned on a 32-bit boundary, then ASSERT().\r
-  \r
+\r
   @param  Port  The I/O port to read.\r
 \r
   @return The value read.\r
@@ -644,7 +750,7 @@ IoRead32 (
 \r
   If 32-bit I/O port operations are not supported, then ASSERT().\r
   If Port is not aligned on a 32-bit boundary, then ASSERT().\r
-  \r
+\r
   @param  Port  The I/O port to write.\r
   @param  Value The value to write to the I/O port.\r
 \r
@@ -658,6 +764,56 @@ IoWrite32 (
   IN      UINT32                    Value\r
   );\r
 \r
+/**\r
+  Reads a 32-bit I/O port fifo into a block of memory.\r
+\r
+  Reads the 32-bit I/O fifo port specified by Port.\r
+  The port is read Count times, and the read data is\r
+  stored in the provided Buffer.\r
+\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  Port    The I/O port to read.\r
+  @param  Count   The number of times to read I/O port.\r
+  @param  Buffer  The buffer to store the read data into.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoReadFifo32 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  OUT     VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Writes a block of memory into a 32-bit I/O port fifo.\r
+\r
+  Writes the 32-bit I/O fifo port specified by Port.\r
+  The port is written Count times, and the write data is\r
+  retrieved from the provided Buffer.\r
+\r
+  This function must guarantee that all I/O write and write operations are\r
+  serialized.\r
+\r
+  If 32-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  Count   The number of times to write I/O port.\r
+  @param  Buffer  The buffer to retrieve the write data from.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoWriteFifo32 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  IN      VOID                      *Buffer\r
+  );\r
+\r
 /**\r
   Reads a 32-bit I/O port, performs a bitwise OR, and writes the\r
   result back to the 32-bit I/O port.\r
@@ -711,7 +867,7 @@ IoAnd32 (
   );\r
 \r
 /**\r
-  Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise \r
+  Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 32-bit I/O port.\r
 \r
   Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
@@ -781,6 +937,7 @@ IoBitFieldRead32 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -816,6 +973,7 @@ IoBitFieldWrite32 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -851,6 +1009,7 @@ IoBitFieldOr32 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -888,6 +1047,8 @@ IoBitFieldAnd32 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1007,7 +1168,7 @@ IoAnd64 (
   );\r
 \r
 /**\r
-  Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise \r
+  Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 64-bit I/O port.\r
 \r
   Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
@@ -1077,6 +1238,7 @@ IoBitFieldRead64 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1112,6 +1274,7 @@ IoBitFieldWrite64 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1147,6 +1310,7 @@ IoBitFieldOr64 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1184,6 +1348,8 @@ IoBitFieldAnd64 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1238,6 +1404,8 @@ MmioRead8 (
   @param  Address The MMIO register to write.\r
   @param  Value   The value to write to the MMIO register.\r
 \r
+  @return Value.\r
+\r
 **/\r
 UINT8\r
 EFIAPI\r
@@ -1250,7 +1418,7 @@ MmioWrite8 (
   Reads an 8-bit MMIO register, performs a bitwise OR, and writes the\r
   result back to the 8-bit MMIO register.\r
 \r
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1297,7 +1465,7 @@ MmioAnd8 (
   );\r
 \r
 /**\r
-  Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise \r
+  Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 8-bit MMIO register.\r
 \r
   Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
@@ -1364,6 +1532,7 @@ MmioBitFieldRead8 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1388,7 +1557,7 @@ MmioBitFieldWrite8 (
   Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and\r
   writes the result back to the bit field in the 8-bit MMIO register.\r
 \r
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1399,6 +1568,7 @@ MmioBitFieldWrite8 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1434,6 +1604,7 @@ MmioBitFieldOr8 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1470,6 +1641,8 @@ MmioBitFieldAnd8 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1526,6 +1699,8 @@ MmioRead16 (
   @param  Address The MMIO register to write.\r
   @param  Value   The value to write to the MMIO register.\r
 \r
+  @return Value.\r
+\r
 **/\r
 UINT16\r
 EFIAPI\r
@@ -1538,7 +1713,7 @@ MmioWrite16 (
   Reads a 16-bit MMIO register, performs a bitwise OR, and writes the\r
   result back to the 16-bit MMIO register.\r
 \r
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1587,7 +1762,7 @@ MmioAnd16 (
   );\r
 \r
 /**\r
-  Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise \r
+  Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 16-bit MMIO register.\r
 \r
   Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
@@ -1656,6 +1831,7 @@ MmioBitFieldRead16 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1680,7 +1856,7 @@ MmioBitFieldWrite16 (
   Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and\r
   writes the result back to the bit field in the 16-bit MMIO register.\r
 \r
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1692,6 +1868,7 @@ MmioBitFieldWrite16 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1728,6 +1905,7 @@ MmioBitFieldOr16 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1765,6 +1943,8 @@ MmioBitFieldAnd16 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1821,6 +2001,8 @@ MmioRead32 (
   @param  Address The MMIO register to write.\r
   @param  Value   The value to write to the MMIO register.\r
 \r
+  @return Value.\r
+\r
 **/\r
 UINT32\r
 EFIAPI\r
@@ -1833,7 +2015,7 @@ MmioWrite32 (
   Reads a 32-bit MMIO register, performs a bitwise OR, and writes the\r
   result back to the 32-bit MMIO register.\r
 \r
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1882,7 +2064,7 @@ MmioAnd32 (
   );\r
 \r
 /**\r
-  Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise \r
+  Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 32-bit MMIO register.\r
 \r
   Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
@@ -1951,6 +2133,7 @@ MmioBitFieldRead32 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1975,7 +2158,7 @@ MmioBitFieldWrite32 (
   Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and\r
   writes the result back to the bit field in the 32-bit MMIO register.\r
 \r
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -1987,6 +2170,7 @@ MmioBitFieldWrite32 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2023,6 +2207,7 @@ MmioBitFieldOr32 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2060,6 +2245,8 @@ MmioBitFieldAnd32 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2128,7 +2315,7 @@ MmioWrite64 (
   Reads a 64-bit MMIO register, performs a bitwise OR, and writes the\r
   result back to the 64-bit MMIO register.\r
 \r
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -2177,7 +2364,7 @@ MmioAnd64 (
   );\r
 \r
 /**\r
-  Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise \r
+  Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r
   OR, and writes the result back to the 64-bit MMIO register.\r
 \r
   Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
@@ -2246,6 +2433,7 @@ MmioBitFieldRead64 (
   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
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2270,7 +2458,7 @@ MmioBitFieldWrite64 (
   Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and\r
   writes the result back to the bit field in the 64-bit MMIO register.\r
 \r
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise \r
+  Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
   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
@@ -2282,6 +2470,7 @@ MmioBitFieldWrite64 (
   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
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2318,6 +2507,7 @@ MmioBitFieldOr64 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2355,6 +2545,8 @@ MmioBitFieldAnd64 (
   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
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2380,11 +2572,11 @@ MmioBitFieldAndThenOr64 (
 /**\r
   Copy data from MMIO region to system memory by using 8-bit access.\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
+  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 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
+\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
@@ -2406,13 +2598,13 @@ MmioReadBuffer8 (
 /**\r
   Copy data from MMIO region to system memory by using 16-bit access.\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
+  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 byte to be copied is specified by Length. Buffer is returned.\r
-  \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 - 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
@@ -2436,13 +2628,13 @@ MmioReadBuffer16 (
 /**\r
   Copy data from MMIO region to system memory by using 32-bit access.\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
+  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
+\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 - 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
@@ -2466,13 +2658,13 @@ MmioReadBuffer32 (
 /**\r
   Copy data from MMIO region to system memory by using 64-bit access.\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
+  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
+\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 - 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
@@ -2496,11 +2688,11 @@ MmioReadBuffer64 (
 /**\r
   Copy data from system memory to MMIO region by using 8-bit access.\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
+  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
+\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
@@ -2508,7 +2700,7 @@ MmioReadBuffer64 (
   @param  Length          The size, in bytes, of Buffer.\r
   @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
 \r
-  @return Size in bytes of the copy.\r
+  @return Buffer\r
 \r
 **/\r
 UINT8 *\r
@@ -2522,13 +2714,13 @@ MmioWriteBuffer8 (
 /**\r
   Copy data from system memory to MMIO region by using 16-bit access.\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 byte to be copied is specified by Length. Length is returned.\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 byte 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 - 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
@@ -2539,7 +2731,7 @@ MmioWriteBuffer8 (
   @param  Length          The size, in bytes, of Buffer.\r
   @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
 \r
-  @return Size in bytes of the copy.\r
+  @return Buffer\r
 \r
 **/\r
 UINT16 *\r
@@ -2553,13 +2745,13 @@ MmioWriteBuffer16 (
 /**\r
   Copy data from system memory to MMIO region by using 32-bit access.\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 byte to be copied is specified by Length. Length is returned.\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 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 - 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
@@ -2570,7 +2762,7 @@ MmioWriteBuffer16 (
   @param  Length          The size, in bytes, of Buffer.\r
   @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
 \r
-  @return Size in bytes of the copy.\r
+  @return Buffer\r
 \r
 **/\r
 UINT32 *\r
@@ -2584,13 +2776,13 @@ MmioWriteBuffer32 (
 /**\r
   Copy data from system memory to MMIO region by using 64-bit access.\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 byte to be copied is specified by Length. Length is returned.\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 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 - 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
@@ -2601,7 +2793,7 @@ MmioWriteBuffer32 (
   @param  Length          The size, in bytes, of Buffer.\r
   @param  Buffer          Pointer to a system memory buffer containing the data to write.\r
 \r
-  @return Size in bytes of the copy.\r
+  @return Buffer\r
 \r
 **/\r
 UINT64 *\r