diff options
Diffstat (limited to 'MdePkg/Include/Library/IoLib.h')
-rw-r--r-- | MdePkg/Include/Library/IoLib.h | 134 |
1 files changed, 64 insertions, 70 deletions
diff --git a/MdePkg/Include/Library/IoLib.h b/MdePkg/Include/Library/IoLib.h index 7c27f1cf6531..d0ffe98ecb14 100644 --- a/MdePkg/Include/Library/IoLib.h +++ b/MdePkg/Include/Library/IoLib.h @@ -1,16 +1,10 @@ /** @file Provide services to access I/O Ports and MMIO registers. -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> -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. +SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -20,14 +14,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /** Macro that converts PCI Segment and I/O Port to an address that can be passed to the I/O Library functions. - - Computes an address that is compatible with the I/O Library functions. - The unused upper bits of Segment, and Port are stripped prior to the + + Computes an address that is compatible with the I/O Library functions. + The unused upper bits of Segment, and Port are stripped prior to the generation of the address. - + @param Segment PCI Segment number. Range 0..65535. @param Port I/O Port number. Range 0..65535. - + @return An address that the I/o Library functions need. **/ @@ -178,7 +172,7 @@ IoAnd8 ( ); /** - Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise + Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise 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 @@ -238,7 +232,7 @@ IoBitFieldRead8 ( 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. + register are preserved. The value written to the I/O port is returned. If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). @@ -405,7 +399,7 @@ IoRead16 ( If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, then ASSERT(). - + @param Port The I/O port to write. @param Value The value to write to the I/O port. @@ -507,7 +501,7 @@ IoOr16 ( If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, 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. @@ -522,7 +516,7 @@ IoAnd16 ( ); /** - Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise + Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise 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 @@ -534,7 +528,7 @@ IoAnd16 ( If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, 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. @@ -735,7 +729,7 @@ IoBitFieldAndThenOr16 ( If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). - + @param Port The I/O port to read. @return The value read. @@ -756,7 +750,7 @@ IoRead32 ( If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). - + @param Port The I/O port to write. @param Value The value to write to the I/O port. @@ -873,7 +867,7 @@ IoAnd32 ( ); /** - Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise + Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise 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 @@ -1174,7 +1168,7 @@ IoAnd64 ( ); /** - Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise + Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise 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 @@ -1409,7 +1403,7 @@ MmioRead8 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. - + @return Value. **/ @@ -1424,7 +1418,7 @@ MmioWrite8 ( Reads an 8-bit MMIO register, performs a bitwise OR, and writes the result back to the 8-bit MMIO register. - Reads the 8-bit MMIO register specified by Address, performs a bitwise + Reads the 8-bit MMIO register specified by Address, performs a bitwise 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 @@ -1471,7 +1465,7 @@ MmioAnd8 ( ); /** - Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise + Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise 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 @@ -1563,7 +1557,7 @@ MmioBitFieldWrite8 ( 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 + Reads the 8-bit MMIO register specified by Address, performs a bitwise 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 @@ -1704,7 +1698,7 @@ MmioRead16 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. - + @return Value. **/ @@ -1719,7 +1713,7 @@ MmioWrite16 ( Reads a 16-bit MMIO register, performs a bitwise OR, and writes the result back to the 16-bit MMIO register. - Reads the 16-bit MMIO register specified by Address, performs a bitwise + Reads the 16-bit MMIO register specified by Address, performs a bitwise 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 @@ -1768,7 +1762,7 @@ MmioAnd16 ( ); /** - Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise + Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise 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 @@ -1862,7 +1856,7 @@ MmioBitFieldWrite16 ( 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 + Reads the 16-bit MMIO register specified by Address, performs a bitwise 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 @@ -2006,7 +2000,7 @@ MmioRead32 ( @param Address The MMIO register to write. @param Value The value to write to the MMIO register. - + @return Value. **/ @@ -2021,7 +2015,7 @@ MmioWrite32 ( Reads a 32-bit MMIO register, performs a bitwise OR, and writes the result back to the 32-bit MMIO register. - Reads the 32-bit MMIO register specified by Address, performs a bitwise + Reads the 32-bit MMIO register specified by Address, performs a bitwise 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 @@ -2070,7 +2064,7 @@ MmioAnd32 ( ); /** - Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise + Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise 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 @@ -2164,7 +2158,7 @@ MmioBitFieldWrite32 ( 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 + Reads the 32-bit MMIO register specified by Address, performs a bitwise 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 @@ -2321,7 +2315,7 @@ MmioWrite64 ( Reads a 64-bit MMIO register, performs a bitwise OR, and writes the result back to the 64-bit MMIO register. - Reads the 64-bit MMIO register specified by Address, performs a bitwise + Reads the 64-bit MMIO register specified by Address, performs a bitwise 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 @@ -2370,7 +2364,7 @@ MmioAnd64 ( ); /** - Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise + Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise 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 @@ -2464,7 +2458,7 @@ MmioBitFieldWrite64 ( 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 + Reads the 64-bit MMIO register specified by Address, performs a bitwise 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 @@ -2578,11 +2572,11 @@ MmioBitFieldAndThenOr64 ( /** 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 + 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 - StartAddress + 1), then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @@ -2604,13 +2598,13 @@ MmioReadBuffer8 ( /** 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 + 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 - 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(). @@ -2634,13 +2628,13 @@ MmioReadBuffer16 ( /** 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 + 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 - 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(). @@ -2664,13 +2658,13 @@ MmioReadBuffer32 ( /** 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 + 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 - 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(). @@ -2694,11 +2688,11 @@ MmioReadBuffer64 ( /** 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 + 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 - StartAddress + 1), then ASSERT(). If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT(). @@ -2720,13 +2714,13 @@ MmioWriteBuffer8 ( /** 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 + 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. 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 - 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(). @@ -2751,13 +2745,13 @@ MmioWriteBuffer16 ( /** 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 + 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. 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 - 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(). @@ -2782,13 +2776,13 @@ MmioWriteBuffer32 ( /** 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 + 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. 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 - 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(). |