]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/IoLib.h
Code have been checked with spec
[mirror_edk2.git] / MdePkg / Include / Library / IoLib.h
index e86068c5f1a1c40811e3d2ff1ecbc7409cdfcf22..e484bef9ecc3cc49b17f947eca502c6cd22939b7 100644 (file)
-/** @file
-  I/O and MMIO Library Services
-
-  Copyright (c) 2006 - 2007, Intel Corporation
-  All rights reserved. This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD License
-  which accompanies this distribution.  The full text of the license may be found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-  Module Name:  IoLib.h
-
-**/
-
-#ifndef __IO_LIB_H__
-#define __IO_LIB_H__
-
-#define IO_LIB_ADDRESS(Segment,Port) \
-  ( ((Port) & 0xffff) | (((Segment) & 0xffff) << 16) )
-
-/**
-  Reads an 8-bit I/O port.
-
-  Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
-  This function must guarantee that all I/O read and write operations are
-  serialized.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-IoRead8 (
-  IN      UINTN                     Port
-  );
-
-/**
-  Writes an 8-bit I/O port.
-
-  Writes the 8-bit I/O port specified by Port with the value specified by Value
-  and returns Value. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to write.
-  @param  Value The value to write to the I/O port.
-
-  @return The value written the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoWrite8 (
-  IN      UINTN                     Port,
-  IN      UINT8                     Value
-  );
-
-/**
-  Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
-  result back to the 8-bit I/O port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 8-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  OrData  The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoOr8 (
-  IN      UINTN                     Port,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
-  to the 8-bit I/O port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 8-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoAnd8 (
-  IN      UINTN                     Port,
-  IN      UINT8                     AndData
-  );
-
-/**
-  Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 8-bit I/O port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, performs a bitwise OR
-  between the result of the AND operation and the value specified by OrData,
-  and writes the result to the 8-bit I/O port specified by Port. The value
-  written to the I/O port is returned. This function must guarantee that all
-  I/O read and write operations are serialized.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoAndThenOr8 (
-  IN      UINTN                     Port,
-  IN      UINT8                     AndData,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a bit field of an I/O register.
-
-  Reads the bit field in an 8-bit I/O register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldRead8 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to an I/O register.
-
-  Writes Value to the bit field of the I/O register. The bit field is specified
-  by the StartBit and the EndBit. All other bits in the destination I/O
-  register are preserved. The value written to the I/O port is returned. Extra
-  left bits in Value are stripped.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldWrite8 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     Value
-  );
-
-/**
-  Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
-  result back to the bit field in the 8-bit port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 8-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized. Extra left bits in OrData are stripped.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  OrData    The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldOr8 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
-  result back to the bit field in the 8-bit port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 8-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized. Extra left bits in AndData are stripped.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  AndData   The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldAnd8 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     AndData
-  );
-
-/**
-  Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
-  bitwise inclusive OR, and writes the result back to the bit field in the
-  8-bit port.
-
-  Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
-  by a bitwise inclusive OR between the read result and the value specified by
-  AndData, and writes the result to the 8-bit I/O port specified by Port. The
-  value written to the I/O port is returned. This function must guarantee that
-  all I/O read and write operations are serialized. Extra left bits in both
-  AndData and OrData are stripped.
-
-  If 8-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  AndData   The value to AND with the read value from the I/O port.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldAndThenOr8 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     AndData,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a 16-bit I/O port.
-
-  Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
-  This function must guarantee that all I/O read and write operations are
-  serialized.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT16
-EFIAPI
-IoRead16 (
-  IN      UINTN                     Port
-  );
-
-/**
-  Writes a 16-bit I/O port.
-
-  Writes the 16-bit I/O port specified by Port with the value specified by Value
-  and returns Value. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to write.
-  @param  Value The value to write to the I/O port.
-
-  @return The value written the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoWrite16 (
-  IN      UINTN                     Port,
-  IN      UINT16                    Value
-  );
-
-/**
-  Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
-  result back to the 16-bit I/O port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 16-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  OrData  The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoOr16 (
-  IN      UINTN                     Port,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
-  to the 16-bit I/O port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 16-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoAnd16 (
-  IN      UINTN                     Port,
-  IN      UINT16                    AndData
-  );
-
-/**
-  Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 16-bit I/O port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, performs a bitwise OR
-  between the result of the AND operation and the value specified by OrData,
-  and writes the result to the 16-bit I/O port specified by Port. The value
-  written to the I/O port is returned. This function must guarantee that all
-  I/O read and write operations are serialized.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoAndThenOr16 (
-  IN      UINTN                     Port,
-  IN      UINT16                    AndData,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a bit field of an I/O register.
-
-  Reads the bit field in a 16-bit I/O register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-
-  @return The value read.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldRead16 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to an I/O register.
-
-  Writes Value to the bit field of the I/O register. The bit field is specified
-  by the StartBit and the EndBit. All other bits in the destination I/O
-  register are preserved. The value written to the I/O port is returned. Extra
-  left bits in Value are stripped.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldWrite16 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    Value
-  );
-
-/**
-  Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
-  result back to the bit field in the 16-bit port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 16-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized. Extra left bits in OrData are stripped.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  OrData    The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldOr16 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
-  result back to the bit field in the 16-bit port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 16-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized. Extra left bits in AndData are stripped.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  AndData   The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldAnd16 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    AndData
-  );
-
-/**
-  Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
-  bitwise inclusive OR, and writes the result back to the bit field in the
-  16-bit port.
-
-  Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
-  by a bitwise inclusive OR between the read result and the value specified by
-  AndData, and writes the result to the 16-bit I/O port specified by Port. The
-  value written to the I/O port is returned. This function must guarantee that
-  all I/O read and write operations are serialized. Extra left bits in both
-  AndData and OrData are stripped.
-
-  If 16-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  AndData   The value to AND with the read value from the I/O port.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldAndThenOr16 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    AndData,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a 32-bit I/O port.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
-  This function must guarantee that all I/O read and write operations are
-  serialized.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-EFIAPI
-IoRead32 (
-  IN      UINTN                     Port
-  );
-
-/**
-  Writes a 32-bit I/O port.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by Value
-  and returns Value. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to write.
-  @param  Value The value to write to the I/O port.
-
-  @return The value written the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  );
-
-/**
-  Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the
-  result back to the 32-bit I/O port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 32-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  OrData  The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoOr32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
-  to the 32-bit I/O port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 32-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoAnd32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    AndData
-  );
-
-/**
-  Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 32-bit I/O port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, performs a bitwise OR
-  between the result of the AND operation and the value specified by OrData,
-  and writes the result to the 32-bit I/O port specified by Port. The value
-  written to the I/O port is returned. This function must guarantee that all
-  I/O read and write operations are serialized.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoAndThenOr32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    AndData,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a bit field of an I/O register.
-
-  Reads the bit field in a 32-bit I/O register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-
-  @return The value read.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldRead32 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to an I/O register.
-
-  Writes Value to the bit field of the I/O register. The bit field is specified
-  by the StartBit and the EndBit. All other bits in the destination I/O
-  register are preserved. The value written to the I/O port is returned. Extra
-  left bits in Value are stripped.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldWrite32 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    Value
-  );
-
-/**
-  Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
-  result back to the bit field in the 32-bit port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 32-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized. Extra left bits in OrData are stripped.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  OrData    The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldOr32 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
-  result back to the bit field in the 32-bit port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 32-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized. Extra left bits in AndData are stripped.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  AndData   The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldAnd32 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    AndData
-  );
-
-/**
-  Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
-  bitwise inclusive OR, and writes the result back to the bit field in the
-  32-bit port.
-
-  Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
-  by a bitwise inclusive OR between the read result and the value specified by
-  AndData, and writes the result to the 32-bit I/O port specified by Port. The
-  value written to the I/O port is returned. This function must guarantee that
-  all I/O read and write operations are serialized. Extra left bits in both
-  AndData and OrData are stripped.
-
-  If 32-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  AndData   The value to AND with the read value from the I/O port.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldAndThenOr32 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    AndData,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a 64-bit I/O port.
-
-  Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
-  This function must guarantee that all I/O read and write operations are
-  serialized.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT64
-EFIAPI
-IoRead64 (
-  IN      UINTN                     Port
-  );
-
-/**
-  Writes a 64-bit I/O port.
-
-  Writes the 64-bit I/O port specified by Port with the value specified by Value
-  and returns Value. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port  The I/O port to write.
-  @param  Value The value to write to the I/O port.
-
-  @return The value written the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoWrite64 (
-  IN      UINTN                     Port,
-  IN      UINT64                    Value
-  );
-
-/**
-  Reads a 64-bit I/O port, performs a bitwise inclusive OR, and writes the
-  result back to the 64-bit I/O port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 64-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  OrData  The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoOr64 (
-  IN      UINTN                     Port,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
-  to the 64-bit I/O port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 64-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoAnd64 (
-  IN      UINTN                     Port,
-  IN      UINT64                    AndData
-  );
-
-/**
-  Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 64-bit I/O port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, performs a bitwise OR
-  between the result of the AND operation and the value specified by OrData,
-  and writes the result to the 64-bit I/O port specified by Port. The value
-  written to the I/O port is returned. This function must guarantee that all
-  I/O read and write operations are serialized.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-
-  @param  Port    The I/O port to write.
-  @param  AndData The value to AND with the read value from the I/O port.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoAndThenOr64 (
-  IN      UINTN                     Port,
-  IN      UINT64                    AndData,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a bit field of an I/O register.
-
-  Reads the bit field in a 64-bit I/O register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-
-  @return The value read.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldRead64 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to an I/O register.
-
-  Writes Value to the bit field of the I/O register. The bit field is specified
-  by the StartBit and the EndBit. All other bits in the destination I/O
-  register are preserved. The value written to the I/O port is returned. Extra
-  left bits in Value are stripped.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldWrite64 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    Value
-  );
-
-/**
-  Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
-  result back to the bit field in the 64-bit port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
-  between the read result and the value specified by OrData, and writes the
-  result to the 64-bit I/O port specified by Port. The value written to the I/O
-  port is returned. This function must guarantee that all I/O read and write
-  operations are serialized. Extra left bits in OrData are stripped.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  OrData    The value to OR with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldOr64 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
-  result back to the bit field in the 64-bit port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
-  the read result and the value specified by AndData, and writes the result to
-  the 64-bit I/O port specified by Port. The value written to the I/O port is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized. Extra left bits in AndData are stripped.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  AndData   The value to AND with the read value from the I/O port.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldAnd64 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    AndData
-  );
-
-/**
-  Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
-  bitwise inclusive OR, and writes the result back to the bit field in the
-  64-bit port.
-
-  Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
-  by a bitwise inclusive OR between the read result and the value specified by
-  AndData, and writes the result to the 64-bit I/O port specified by Port. The
-  value written to the I/O port is returned. This function must guarantee that
-  all I/O read and write operations are serialized. Extra left bits in both
-  AndData and OrData are stripped.
-
-  If 64-bit I/O port operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Port      The I/O port to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  AndData   The value to AND with the read value from the I/O port.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldAndThenOr64 (
-  IN      UINTN                     Port,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    AndData,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads an 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
-  returned. This function must guarantee that all MMIO read and write
-  operations are serialized.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to read.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-MmioRead8 (
-  IN      UINTN                     Address
-  );
-
-/**
-  Writes an 8-bit MMIO register.
-
-  Writes the 8-bit MMIO register specified by Address with the value specified
-  by Value and returns Value. This function must guarantee that all MMIO read
-  and write operations are serialized.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  Value   The value to write to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioWrite8 (
-  IN      UINTN                     Address,
-  IN      UINT8                     Value
-  );
-
-/**
-  Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
-  result back to the 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 8-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  OrData  The value to OR with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioOr8 (
-  IN      UINTN                     Address,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
-  back to the 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 8-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioAnd8 (
-  IN      UINTN                     Address,
-  IN      UINT8                     AndData
-  );
-
-/**
-  Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, performs a
-  bitwise OR between the result of the AND operation and the value specified by
-  OrData, and writes the result to the 8-bit MMIO register specified by
-  Address. The value written to the MMIO register is returned. This function
-  must guarantee that all MMIO read and write operations are serialized.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioAndThenOr8 (
-  IN      UINTN                     Address,
-  IN      UINT8                     AndData,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a bit field of a MMIO register.
-
-  Reads the bit field in an 8-bit MMIO register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldRead8 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to a MMIO register.
-
-  Writes Value to the bit field of the MMIO register. The bit field is
-  specified by the StartBit and the EndBit. All other bits in the destination
-  MMIO register are preserved. The new value of the 8-bit register is returned.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldWrite8 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     Value
-  );
-
-/**
-  Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
-  writes the result back to the bit field in the 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 8-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized. Extra left bits in OrData
-  are stripped.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  OrData    The value to OR with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldOr8 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
-  writes the result back to the bit field in the 8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 8-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized. Extra left bits in AndData are
-  stripped.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  AndData   The value to AND with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldAnd8 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     AndData
-  );
-
-/**
-  Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
-  by a bitwise inclusive OR, and writes the result back to the bit field in the
-  8-bit MMIO register.
-
-  Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
-  followed by a bitwise inclusive OR between the read result and the value
-  specified by AndData, and writes the result to the 8-bit MMIO register
-  specified by Address. The value written to the MMIO register is returned.
-  This function must guarantee that all MMIO read and write operations are
-  serialized. Extra left bits in both AndData and OrData are stripped.
-
-  If 8-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 7, then ASSERT().
-  If EndBit is greater than 7, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..7.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..7.
-  @param  AndData   The value to AND with read value from the MMIO register.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldAndThenOr8 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT8                     AndData,
-  IN      UINT8                     OrData
-  );
-
-/**
-  Reads a 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
-  returned. This function must guarantee that all MMIO read and write
-  operations are serialized.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to read.
-
-  @return The value read.
-
-**/
-UINT16
-EFIAPI
-MmioRead16 (
-  IN      UINTN                     Address
-  );
-
-/**
-  Writes a 16-bit MMIO register.
-
-  Writes the 16-bit MMIO register specified by Address with the value specified
-  by Value and returns Value. This function must guarantee that all MMIO read
-  and write operations are serialized.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  Value   The value to write to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioWrite16 (
-  IN      UINTN                     Address,
-  IN      UINT16                    Value
-  );
-
-/**
-  Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
-  result back to the 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 16-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  OrData  The value to OR with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioOr16 (
-  IN      UINTN                     Address,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
-  back to the 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 16-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioAnd16 (
-  IN      UINTN                     Address,
-  IN      UINT16                    AndData
-  );
-
-/**
-  Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, performs a
-  bitwise OR between the result of the AND operation and the value specified by
-  OrData, and writes the result to the 16-bit MMIO register specified by
-  Address. The value written to the MMIO register is returned. This function
-  must guarantee that all MMIO read and write operations are serialized.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioAndThenOr16 (
-  IN      UINTN                     Address,
-  IN      UINT16                    AndData,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a bit field of a MMIO register.
-
-  Reads the bit field in a 16-bit MMIO register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-
-  @return The value read.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldRead16 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to a MMIO register.
-
-  Writes Value to the bit field of the MMIO register. The bit field is
-  specified by the StartBit and the EndBit. All other bits in the destination
-  MMIO register are preserved. The new value of the 16-bit register is returned.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldWrite16 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    Value
-  );
-
-/**
-  Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
-  writes the result back to the bit field in the 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 16-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized. Extra left bits in OrData
-  are stripped.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  OrData    The value to OR with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldOr16 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
-  writes the result back to the bit field in the 16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 16-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized. Extra left bits in AndData are
-  stripped.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  AndData   The value to AND with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldAnd16 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    AndData
-  );
-
-/**
-  Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
-  by a bitwise inclusive OR, and writes the result back to the bit field in the
-  16-bit MMIO register.
-
-  Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
-  followed by a bitwise inclusive OR between the read result and the value
-  specified by AndData, and writes the result to the 16-bit MMIO register
-  specified by Address. The value written to the MMIO register is returned.
-  This function must guarantee that all MMIO read and write operations are
-  serialized. Extra left bits in both AndData and OrData are stripped.
-
-  If 16-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 15, then ASSERT().
-  If EndBit is greater than 15, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..15.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..15.
-  @param  AndData   The value to AND with read value from the MMIO register.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldAndThenOr16 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT16                    AndData,
-  IN      UINT16                    OrData
-  );
-
-/**
-  Reads a 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
-  returned. This function must guarantee that all MMIO read and write
-  operations are serialized.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to read.
-
-  @return The value read.
-
-**/
-UINT32
-EFIAPI
-MmioRead32 (
-  IN      UINTN                     Address
-  );
-
-/**
-  Writes a 32-bit MMIO register.
-
-  Writes the 32-bit MMIO register specified by Address with the value specified
-  by Value and returns Value. This function must guarantee that all MMIO read
-  and write operations are serialized.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  Value   The value to write to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioWrite32 (
-  IN      UINTN                     Address,
-  IN      UINT32                    Value
-  );
-
-/**
-  Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
-  result back to the 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 32-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  OrData  The value to OR with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioOr32 (
-  IN      UINTN                     Address,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
-  back to the 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 32-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioAnd32 (
-  IN      UINTN                     Address,
-  IN      UINT32                    AndData
-  );
-
-/**
-  Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, performs a
-  bitwise OR between the result of the AND operation and the value specified by
-  OrData, and writes the result to the 32-bit MMIO register specified by
-  Address. The value written to the MMIO register is returned. This function
-  must guarantee that all MMIO read and write operations are serialized.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioAndThenOr32 (
-  IN      UINTN                     Address,
-  IN      UINT32                    AndData,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a bit field of a MMIO register.
-
-  Reads the bit field in a 32-bit MMIO register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-
-  @return The value read.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldRead32 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to a MMIO register.
-
-  Writes Value to the bit field of the MMIO register. The bit field is
-  specified by the StartBit and the EndBit. All other bits in the destination
-  MMIO register are preserved. The new value of the 32-bit register is returned.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldWrite32 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    Value
-  );
-
-/**
-  Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
-  writes the result back to the bit field in the 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 32-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized. Extra left bits in OrData
-  are stripped.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  OrData    The value to OR with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldOr32 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
-  writes the result back to the bit field in the 32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 32-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized. Extra left bits in AndData are
-  stripped.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  AndData   The value to AND with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldAnd32 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    AndData
-  );
-
-/**
-  Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
-  by a bitwise inclusive OR, and writes the result back to the bit field in the
-  32-bit MMIO register.
-
-  Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
-  followed by a bitwise inclusive OR between the read result and the value
-  specified by AndData, and writes the result to the 32-bit MMIO register
-  specified by Address. The value written to the MMIO register is returned.
-  This function must guarantee that all MMIO read and write operations are
-  serialized. Extra left bits in both AndData and OrData are stripped.
-
-  If 32-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 31, then ASSERT().
-  If EndBit is greater than 31, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..31.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..31.
-  @param  AndData   The value to AND with read value from the MMIO register.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldAndThenOr32 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT32                    AndData,
-  IN      UINT32                    OrData
-  );
-
-/**
-  Reads a 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
-  returned. This function must guarantee that all MMIO read and write
-  operations are serialized.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to read.
-
-  @return The value read.
-
-**/
-UINT64
-EFIAPI
-MmioRead64 (
-  IN      UINTN                     Address
-  );
-
-/**
-  Writes a 64-bit MMIO register.
-
-  Writes the 64-bit MMIO register specified by Address with the value specified
-  by Value and returns Value. This function must guarantee that all MMIO read
-  and write operations are serialized.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  Value   The value to write to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioWrite64 (
-  IN      UINTN                     Address,
-  IN      UINT64                    Value
-  );
-
-/**
-  Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
-  result back to the 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 64-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  OrData  The value to OR with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioOr64 (
-  IN      UINTN                     Address,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
-  back to the 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 64-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioAnd64 (
-  IN      UINTN                     Address,
-  IN      UINT64                    AndData
-  );
-
-/**
-  Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
-  inclusive OR, and writes the result back to the 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, performs a
-  bitwise OR between the result of the AND operation and the value specified by
-  OrData, and writes the result to the 64-bit MMIO register specified by
-  Address. The value written to the MMIO register is returned. This function
-  must guarantee that all MMIO read and write operations are serialized.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-
-
-  @param  Address The MMIO register to write.
-  @param  AndData The value to AND with the read value from the MMIO register.
-  @param  OrData  The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioAndThenOr64 (
-  IN      UINTN                     Address,
-  IN      UINT64                    AndData,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a bit field of a MMIO register.
-
-  Reads the bit field in a 64-bit MMIO register. The bit field is specified by
-  the StartBit and the EndBit. The value of the bit field is returned.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to read.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-
-  @return The value read.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldRead64 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit
-  );
-
-/**
-  Writes a bit field to a MMIO register.
-
-  Writes Value to the bit field of the MMIO register. The bit field is
-  specified by the StartBit and the EndBit. All other bits in the destination
-  MMIO register are preserved. The new value of the 64-bit register is returned.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  Value     New value of the bit field.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldWrite64 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    Value
-  );
-
-/**
-  Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
-  writes the result back to the bit field in the 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise
-  inclusive OR between the read result and the value specified by OrData, and
-  writes the result to the 64-bit MMIO register specified by Address. The value
-  written to the MMIO register is returned. This function must guarantee that
-  all MMIO read and write operations are serialized. Extra left bits in OrData
-  are stripped.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  OrData    The value to OR with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldOr64 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
-  writes the result back to the bit field in the 64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
-  between the read result and the value specified by AndData, and writes the
-  result to the 64-bit MMIO register specified by Address. The value written to
-  the MMIO register is returned. This function must guarantee that all MMIO
-  read and write operations are serialized. Extra left bits in AndData are
-  stripped.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  AndData   The value to AND with read value from the MMIO register.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldAnd64 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    AndData
-  );
-
-/**
-  Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
-  by a bitwise inclusive OR, and writes the result back to the bit field in the
-  64-bit MMIO register.
-
-  Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
-  followed by a bitwise inclusive OR between the read result and the value
-  specified by AndData, and writes the result to the 64-bit MMIO register
-  specified by Address. The value written to the MMIO register is returned.
-  This function must guarantee that all MMIO read and write operations are
-  serialized. Extra left bits in both AndData and OrData are stripped.
-
-  If 64-bit MMIO register operations are not supported, then ASSERT().
-  If StartBit is greater than 63, then ASSERT().
-  If EndBit is greater than 63, then ASSERT().
-  If EndBit is less than StartBit, then ASSERT().
-
-  @param  Address   MMIO register to write.
-  @param  StartBit  The ordinal of the least significant bit in the bit field.
-                    Range 0..63.
-  @param  EndBit    The ordinal of the most significant bit in the bit field.
-                    Range 0..63.
-  @param  AndData   The value to AND with read value from the MMIO register.
-  @param  OrData    The value to OR with the result of the AND operation.
-
-  @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldAndThenOr64 (
-  IN      UINTN                     Address,
-  IN      UINTN                     StartBit,
-  IN      UINTN                     EndBit,
-  IN      UINT64                    AndData,
-  IN      UINT64                    OrData
-  );
-
-/**
-  Copy data from MMIO region to system memory by using 8-bit access.
-
-  Copy data from MMIO region specified by starting address StartAddress 
-  to system memory specified by Buffer by using 8-bit access. The total 
-  number of byte to be copied is specified by Length. Buffer is returned.
-  
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
-
-  @param  StartAddress    Starting address for the MMIO region to be copied from.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.
-
-  @return Buffer
-
-**/
-UINT8 *
-EFIAPI
-MmioReadBuffer8 (
-  IN  UINTN       StartAddress,
-  IN  UINTN       Length,
-  OUT UINT8       *Buffer
-  );
-
-/**
-  Copy data from MMIO region to system memory by using 16-bit access.
-
-  Copy data from MMIO region specified by starting address StartAddress 
-  to system memory specified by Buffer by using 16-bit access. The total 
-  number of byte to be copied is specified by Length. Buffer is returned.
-  
-  If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 16-bit boundary, then ASSERT().
-  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied from.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.
-
-  @return Buffer
-
-**/
-UINT16 *
-EFIAPI
-MmioReadBuffer16 (
-  IN  UINTN       StartAddress,
-  IN  UINTN       Length,
-  OUT UINT16      *Buffer
-  );
-
-/**
-  Copy data from MMIO region to system memory by using 32-bit access.
-
-  Copy data from MMIO region specified by starting address StartAddress 
-  to system memory specified by Buffer by using 32-bit access. The total 
-  number of byte to be copied is specified by Length. Buffer is returned.
-  
-  If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 32-bit boundary, then ASSERT().
-  If Buffer is not aligned on a 32-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied from.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.
-
-  @return Buffer
-
-**/
-UINT32 *
-EFIAPI
-MmioReadBuffer32 (
-  IN  UINTN       StartAddress,
-  IN  UINTN       Length,
-  OUT UINT32      *Buffer
-  );
-
-/**
-  Copy data from MMIO region to system memory by using 64-bit access.
-
-  Copy data from MMIO region specified by starting address StartAddress 
-  to system memory specified by Buffer by using 64-bit access. The total 
-  number of byte to be copied is specified by Length. Buffer is returned.
-  
-  If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 64-bit boundary, then ASSERT().
-  If Buffer is not aligned on a 64-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied from.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer receiving the data read.
-
-  @return Buffer
-
-**/
-UINT64 *
-EFIAPI
-MmioReadBuffer64 (
-  IN  UINTN       StartAddress,
-  IN  UINTN       Length,
-  OUT UINT64      *Buffer
-  );
-
-/**
-  Copy data from system memory to MMIO region by using 8-bit access.
-
-  Copy data from system memory specified by Buffer to MMIO region specified 
-  by starting address StartAddress by using 8-bit access. The total number 
-  of byte to be copied is specified by Length. Buffer is returned.
-  
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
-
-  @param  StartAddress    Starting address for the MMIO region to be copied to.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.
-
-  @return Size in bytes of the copy.
-
-**/
-UINT8 *
-EFIAPI
-MmioWriteBuffer8 (
-  IN  UINTN         StartAddress,
-  IN  UINTN         Length,
-  IN  CONST UINT8   *Buffer
-  );
-
-/**
-  Copy data from system memory to MMIO region by using 16-bit access.
-
-  Copy data from system memory specified by Buffer to MMIO region specified 
-  by starting address StartAddress by using 16-bit access. The total number 
-  of byte to be copied is specified by Length. Length is returned.
-  
-  If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 16-bit boundary, then ASSERT().
-
-  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied to.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.
-
-  @return Size in bytes of the copy.
-
-**/
-UINT16 *
-EFIAPI
-MmioWriteBuffer16 (
-  IN  UINTN        StartAddress,
-  IN  UINTN        Length,
-  IN  CONST UINT16 *Buffer
-  );
-
-/**
-  Copy data from system memory to MMIO region by using 32-bit access.
-
-  Copy data from system memory specified by Buffer to MMIO region specified 
-  by starting address StartAddress by using 32-bit access. The total number 
-  of byte to be copied is specified by Length. Length is returned.
-  
-  If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 32-bit boundary, then ASSERT().
-
-  If Buffer is not aligned on a 32-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied to.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.
-
-  @return Size in bytes of the copy.
-
-**/
-UINT32 *
-EFIAPI
-MmioWriteBuffer32 (
-  IN  UINTN        StartAddress,
-  IN  UINTN        Length,
-  IN  CONST UINT32 *Buffer
-  );
-
-/**
-  Copy data from system memory to MMIO region by using 64-bit access.
-
-  Copy data from system memory specified by Buffer to MMIO region specified 
-  by starting address StartAddress by using 64-bit access. The total number 
-  of byte to be copied is specified by Length. Length is returned.
-  
-  If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
-
-  If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). 
-  If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
-  If Length is not aligned on a 64-bit boundary, then ASSERT().
-
-  If Buffer is not aligned on a 64-bit boundary, then ASSERT().
-
-  @param  StartAddress    Starting address for the MMIO region to be copied to.
-  @param  Length          Size in bytes of the copy.
-  @param  Buffer          Pointer to a system memory buffer containing the data to write.
-
-  @return Size in bytes of the copy.
-
-**/
-UINT64 *
-EFIAPI
-MmioWriteBuffer64 (
-  IN  UINTN        StartAddress,
-  IN  UINTN        Length,
-  IN  CONST UINT64 *Buffer
-  );
-
-
-#endif
-
+/** @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
+\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 __IO_LIB_H__\r
+#define __IO_LIB_H__\r
+\r
+/**\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
+  generation of the address.\r
+  \r
+  @param  Segment   PCI Segment number.  Range 0..65535.\r
+  @param  Port      I/O Port number.  Range 0..65535.\r
+  \r
+  @return An address that the I/o Library functions need.\r
+\r
+**/\r
+\r
+#define IO_LIB_ADDRESS(Segment,Port) \\r
+  ( ((Port) & 0xffff) | (((Segment) & 0xffff) << 16) )\r
+\r
+/**\r
+  Reads an 8-bit I/O port.\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  Port  The I/O port to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+IoRead8 (\r
+  IN      UINTN                     Port\r
+  );\r
+\r
+/**\r
+  Writes an 8-bit I/O port.\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  Port  The I/O port to write.\r
+  @param  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
+IoWrite8 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT8                     Value\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
+\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  Port    The I/O port to write.\r
+  @param  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
+IoOr8 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT8                     OrData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back\r
+  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
+  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  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
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+IoAnd8 (\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
+  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
+  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  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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+IoAndThenOr8 (\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.\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  Port      The I/O port to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+IoBitFieldRead8 (\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.\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
+\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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+IoBitFieldWrite8 (\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, and writes the\r
+  result back to the bit field in the 8-bit port.\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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+IoBitFieldOr8 (\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, and writes the\r
+  result back to the bit field in the 8-bit port.\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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+IoBitFieldAnd8 (\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, and writes the result back to the bit field in the\r
+  8-bit port.\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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+IoBitFieldAndThenOr8 (\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.\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
+  If Port is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Port  The I/O port to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+IoRead16 (\r
+  IN      UINTN                     Port\r
+  );\r
+\r
+/**\r
+  Writes a 16-bit I/O port.\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
+  If Port is not aligned on a 16-bit boundary, then ASSERT().\r
+  \r
+  @param  Port  The I/O port to write.\r
+  @param  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
+IoWrite16 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT16                    Value\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
+\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
+  If Port is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  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
+IoOr16 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT16                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back\r
+  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
+  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
+  If Port is not aligned on a 16-bit boundary, then ASSERT().\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
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+IoAnd16 (\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
+  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
+  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
+  If Port is not aligned on a 16-bit boundary, then ASSERT().\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+IoAndThenOr16 (\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.\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 Port is not aligned on a 16-bit boundary, 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  Port      The I/O port to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+IoBitFieldRead16 (\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.\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 Port is not aligned on a 16-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+IoBitFieldWrite16 (\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, and writes the\r
+  result back to the bit field in the 16-bit port.\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 Port is not aligned on a 16-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+IoBitFieldOr16 (\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, and writes the\r
+  result back to the bit field in the 16-bit port.\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 Port is not aligned on a 16-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+IoBitFieldAnd16 (\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, and writes the result back to the bit field in the\r
+  16-bit port.\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 Port is not aligned on a 16-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+IoBitFieldAndThenOr16 (\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.\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
+  If Port is not aligned on a 32-bit boundary, then ASSERT().\r
+  \r
+  @param  Port  The I/O port to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+IoRead32 (\r
+  IN      UINTN                     Port\r
+  );\r
+\r
+/**\r
+  Writes a 32-bit I/O port.\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
+  If Port is not aligned on a 32-bit boundary, then ASSERT().\r
+  \r
+  @param  Port  The I/O port to write.\r
+  @param  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
+IoWrite32 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT32                    Value\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
+\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
+  If Port is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  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
+IoOr32 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT32                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back\r
+  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
+  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
+  If Port is not aligned on a 32-bit boundary, then ASSERT().\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
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+IoAnd32 (\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
+  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
+  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
+  If Port is not aligned on a 32-bit boundary, then ASSERT().\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+IoAndThenOr32 (\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.\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 Port is not aligned on a 32-bit boundary, 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  Port      The I/O port to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+IoBitFieldRead32 (\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.\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 Port is not aligned on a 32-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+IoBitFieldWrite32 (\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, and writes the\r
+  result back to the bit field in the 32-bit port.\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 Port is not aligned on a 32-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+IoBitFieldOr32 (\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, and writes the\r
+  result back to the bit field in the 32-bit port.\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 Port is not aligned on a 32-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+IoBitFieldAnd32 (\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, and writes the result back to the bit field in the\r
+  32-bit port.\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 Port is not aligned on a 32-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+IoBitFieldAndThenOr32 (\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.\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
+  If Port is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Port  The I/O port to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoRead64 (\r
+  IN      UINTN                     Port\r
+  );\r
+\r
+/**\r
+  Writes a 64-bit I/O port.\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
+  If Port is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Port  The I/O port to write.\r
+  @param  Value The value to write to the I/O port.\r
+\r
+  @return The value written the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoWrite64 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT64                    Value\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, performs a bitwise OR, and writes the\r
+  result back to the 64-bit I/O port.\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
+  If Port is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Port    The I/O port to write.\r
+  @param  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
+IoOr64 (\r
+  IN      UINTN                     Port,\r
+  IN      UINT64                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back\r
+  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
+  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
+  If Port is not aligned on a 64-bit boundary, then ASSERT().\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
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoAnd64 (\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
+  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
+  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
+  If Port is not aligned on a 64-bit boundary, then ASSERT().\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoAndThenOr64 (\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.\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 Port is not aligned on a 64-bit boundary, 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  Port      The I/O port to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+IoBitFieldRead64 (\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.\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 Port is not aligned on a 64-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+IoBitFieldWrite64 (\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, and writes the\r
+  result back to the bit field in the 64-bit port.\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 Port is not aligned on a 64-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+IoBitFieldOr64 (\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, and writes the\r
+  result back to the bit field in the 64-bit port.\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 Port is not aligned on a 64-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+IoBitFieldAnd64 (\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, and writes the result back to the bit field in the\r
+  64-bit port.\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 Port is not aligned on a 64-bit boundary, 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  Port      The I/O port to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\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
+\r
+  @return The value written back to the I/O port.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoBitFieldAndThenOr64 (\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.\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  Address The MMIO register to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+MmioRead8 (\r
+  IN      UINTN                     Address\r
+  );\r
+\r
+/**\r
+  Writes an 8-bit MMIO register.\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  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
+MmioWrite8 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT8                     Value\r
+  );\r
+\r
+/**\r
+  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
+  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  Address The MMIO register to write.\r
+  @param  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
+MmioOr8 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT8                     OrData\r
+  );\r
+\r
+/**\r
+  Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result\r
+  back to the 8-bit MMIO register.\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  Address The MMIO register to write.\r
+  @param  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
+MmioAnd8 (\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
+  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
+  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
+\r
+  @param  Address The MMIO register to write.\r
+  @param  AndData The value to AND with the read value from the MMIO register.\r
+  @param  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
+MmioAndThenOr8 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT8                     AndData,\r
+  IN      UINT8                     OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register.\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  Address   MMIO register to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+MmioBitFieldRead8 (\r
+  IN      UINTN                     Address,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register.\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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  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
+MmioBitFieldWrite8 (\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, 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
+  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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  OrData    The value to OR with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+MmioBitFieldOr8 (\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.\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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+MmioBitFieldAnd8 (\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, and writes the result back to the bit field in the\r
+  8-bit MMIO register.\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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..7.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+  @param  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
+MmioBitFieldAndThenOr8 (\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.\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
+  If Address is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+MmioRead16 (\r
+  IN      UINTN                     Address\r
+  );\r
+\r
+/**\r
+  Writes a 16-bit MMIO register.\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.\r
+\r
+  If 16-bit MMIO register operations are not supported, then ASSERT().\r
+  If Address is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @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
+MmioWrite16 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT16                    Value\r
+  );\r
+\r
+/**\r
+  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
+  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
+  If Address is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioOr16 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT16                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result\r
+  back to the 16-bit MMIO register.\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
+  If Address is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioAnd16 (\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
+  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
+  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
+  If Address is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  AndData The value to AND with the read value from the MMIO register.\r
+  @param  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
+MmioAndThenOr16 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT16                    AndData,\r
+  IN      UINT16                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register.\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 Address is not aligned on a 16-bit boundary, 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  Address   MMIO register to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+MmioBitFieldRead16 (\r
+  IN      UINTN                     Address,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register.\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 Address is not aligned on a 16-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  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
+MmioBitFieldWrite16 (\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, 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
+  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 Address is not aligned on a 16-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  OrData    The value to OR with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+MmioBitFieldOr16 (\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.\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 Address is not aligned on a 16-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+MmioBitFieldAnd16 (\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, and writes the result back to the bit field in the\r
+  16-bit MMIO register.\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 Address is not aligned on a 16-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..15.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+  @param  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
+MmioBitFieldAndThenOr16 (\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.\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
+  If Address is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+MmioRead32 (\r
+  IN      UINTN                     Address\r
+  );\r
+\r
+/**\r
+  Writes a 32-bit MMIO register.\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
+  If Address is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @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
+MmioWrite32 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT32                    Value\r
+  );\r
+\r
+/**\r
+  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
+  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
+  If Address is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioOr32 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT32                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result\r
+  back to the 32-bit MMIO register.\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
+  If Address is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioAnd32 (\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
+  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
+  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
+  If Address is not aligned on a 32-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  AndData The value to AND with the read value from the MMIO register.\r
+  @param  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
+MmioAndThenOr32 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT32                    AndData,\r
+  IN      UINT32                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register.\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 Address is not aligned on a 32-bit boundary, 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  Address   MMIO register to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+MmioBitFieldRead32 (\r
+  IN      UINTN                     Address,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register.\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 Address is not aligned on a 32-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  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
+MmioBitFieldWrite32 (\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, 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
+  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 Address is not aligned on a 32-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  OrData    The value to OR with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+MmioBitFieldOr32 (\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.\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 Address is not aligned on a 32-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+MmioBitFieldAnd32 (\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, and writes the result back to the bit field in the\r
+  32-bit MMIO register.\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 Address is not aligned on a 32-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+  @param  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
+MmioBitFieldAndThenOr32 (\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.\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
+  If Address is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to read.\r
+\r
+  @return The value read.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioRead64 (\r
+  IN      UINTN                     Address\r
+  );\r
+\r
+/**\r
+  Writes a 64-bit MMIO register.\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
+  If Address is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  Value   The value to write to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioWrite64 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT64                    Value\r
+  );\r
+\r
+/**\r
+  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
+  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
+  If Address is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioOr64 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT64                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result\r
+  back to the 64-bit MMIO register.\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
+  If Address is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  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
+MmioAnd64 (\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
+  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
+  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
+  If Address is not aligned on a 64-bit boundary, then ASSERT().\r
+\r
+  @param  Address The MMIO register to write.\r
+  @param  AndData The value to AND with the read value from the MMIO register.\r
+  @param  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
+MmioAndThenOr64 (\r
+  IN      UINTN                     Address,\r
+  IN      UINT64                    AndData,\r
+  IN      UINT64                    OrData\r
+  );\r
+\r
+/**\r
+  Reads a bit field of a MMIO register.\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 Address is not aligned on a 64-bit boundary, 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  Address   MMIO register to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+MmioBitFieldRead64 (\r
+  IN      UINTN                     Address,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  );\r
+\r
+/**\r
+  Writes a bit field to a MMIO register.\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 Address is not aligned on a 64-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  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
+MmioBitFieldWrite64 (\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, 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
+  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 Address is not aligned on a 64-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  OrData    The value to OR with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioBitFieldOr64 (\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.\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 Address is not aligned on a 64-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+\r
+  @return The value written back to the MMIO register.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioBitFieldAnd64 (\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, and writes the result back to the bit field in the\r
+  64-bit MMIO register.\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 Address is not aligned on a 64-bit boundary, 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  Address   MMIO register to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  AndData   The value to AND with read value from the MMIO register.\r
+  @param  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
+MmioBitFieldAndThenOr64 (\r
+  IN      UINTN                     Address,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT64                    AndData,\r
+  IN      UINT64                    OrData\r
+  );\r
+\r
+/**\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
+  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
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+\r
+  @param  StartAddress    Starting address for the MMIO region to be copied from.\r
+  @param  Length          The size, in bytes, of Buffer.\r
+  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+MmioReadBuffer8 (\r
+  IN  UINTN       StartAddress,\r
+  IN  UINTN       Length,\r
+  OUT UINT8       *Buffer\r
+  );\r
+\r
+/**\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
+  number 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 - 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  StartAddress    Starting address for the MMIO region to be copied from.\r
+  @param  Length          The size, in bytes, of Buffer.\r
+  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+UINT16 *\r
+EFIAPI\r
+MmioReadBuffer16 (\r
+  IN  UINTN       StartAddress,\r
+  IN  UINTN       Length,\r
+  OUT UINT16      *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied from.\r
+  @param  Length          The size, in bytes, of Buffer.\r
+  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+UINT32 *\r
+EFIAPI\r
+MmioReadBuffer32 (\r
+  IN  UINTN       StartAddress,\r
+  IN  UINTN       Length,\r
+  OUT UINT32      *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied from.\r
+  @param  Length          The size, in bytes, of Buffer.\r
+  @param  Buffer          Pointer to a system memory buffer receiving the data read.\r
+\r
+  @return Buffer\r
+\r
+**/\r
+UINT64 *\r
+EFIAPI\r
+MmioReadBuffer64 (\r
+  IN  UINTN       StartAddress,\r
+  IN  UINTN       Length,\r
+  OUT UINT64      *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied to.\r
+  @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
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+MmioWriteBuffer8 (\r
+  IN  UINTN         StartAddress,\r
+  IN  UINTN         Length,\r
+  IN  CONST UINT8   *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied to.\r
+  @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
+\r
+**/\r
+UINT16 *\r
+EFIAPI\r
+MmioWriteBuffer16 (\r
+  IN  UINTN        StartAddress,\r
+  IN  UINTN        Length,\r
+  IN  CONST UINT16 *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied to.\r
+  @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
+\r
+**/\r
+UINT32 *\r
+EFIAPI\r
+MmioWriteBuffer32 (\r
+  IN  UINTN        StartAddress,\r
+  IN  UINTN        Length,\r
+  IN  CONST UINT32 *Buffer\r
+  );\r
+\r
+/**\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
+  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  StartAddress    Starting address for the MMIO region to be copied to.\r
+  @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
+\r
+**/\r
+UINT64 *\r
+EFIAPI\r
+MmioWriteBuffer64 (\r
+  IN  UINTN        StartAddress,\r
+  IN  UINTN        Length,\r
+  IN  CONST UINT64 *Buffer\r
+  );\r
+\r
+\r
+#endif\r
+\r