diff options
Diffstat (limited to 'MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c')
-rw-r--r-- | MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c | 145 |
1 files changed, 71 insertions, 74 deletions
diff --git a/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c b/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c index 69cfef136c3d..721eebfd255f 100644 --- a/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c +++ b/MdePkg/Library/BasePciSegmentLibPci/PciSegmentLib.c @@ -2,15 +2,8 @@ PCI Segment Library that layers on top of the PCI Library which only supports segment 0 PCI configuration access. - Copyright (c) 2016, Intel Corporation. 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. + Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -75,7 +68,7 @@ PciSegmentRegisterForRuntimeAccess ( If any reserved bits in Address are set, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @return The 8-bit PCI configuration register specified by Address. @@ -99,7 +92,7 @@ PciSegmentRead8 ( If any reserved bits in Address are set, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param Value The value to write. @return The value written to the PCI configuration register. @@ -128,7 +121,7 @@ PciSegmentWrite8 ( If any reserved bits in Address are set, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param OrData The value to OR with the PCI configuration register. @return The value written to the PCI configuration register. @@ -154,7 +147,7 @@ PciSegmentOr8 ( This function must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param AndData The value to AND with the PCI configuration register. @return The value written to the PCI configuration register. @@ -183,8 +176,8 @@ PciSegmentAnd8 ( If any reserved bits in Address are set, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the PCI configuration register. @return The value written to the PCI configuration register. @@ -213,7 +206,7 @@ PciSegmentAndThenOr8 ( If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address The PCI configuration register to read. + @param Address PCI configuration 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. @@ -247,12 +240,12 @@ PciSegmentBitFieldRead8 ( If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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 The new value of the bit field. + @param Value New value of the bit field. @return The value written back to the PCI configuration register. @@ -289,7 +282,7 @@ PciSegmentBitFieldWrite8 ( If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -331,7 +324,7 @@ PciSegmentBitFieldOr8 ( If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -358,8 +351,7 @@ PciSegmentBitFieldAnd8 ( /** Reads a bit field in an 8-bit port, performs a bitwise AND followed by a - bitwise OR, and writes the result back to the bit field in the - 8-bit port. + bitwise OR, and writes the result back to the bit field in the 8-bit port. Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND followed by a bitwise OR between the read result and @@ -376,7 +368,7 @@ PciSegmentBitFieldAnd8 ( If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -412,7 +404,7 @@ PciSegmentBitFieldAndThenOr8 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @return The 16-bit PCI configuration register specified by Address. @@ -437,7 +429,7 @@ PciSegmentRead16 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param Value The value to write. @return The parameter of Value. @@ -460,16 +452,15 @@ PciSegmentWrite16 ( a 16-bit value. Reads the 16-bit PCI configuration 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 PCI configuration register - specified by Address. The value written to the PCI configuration register is - returned. This function must guarantee that all PCI read and write operations - are serialized. + bitwise OR between the read result and the value specified by OrData, and + writes the result to the 16-bit PCI configuration register specified by Address. + The value written to the PCI configuration register is returned. This function + must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function and + @param Address Address that encodes the PCI Segment, Bus, Device, Function and Register. @param OrData The value to OR with the PCI configuration register. @@ -498,7 +489,7 @@ PciSegmentOr16 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param AndData The value to AND with the PCI configuration register. @return The value written to the PCI configuration register. @@ -528,8 +519,8 @@ PciSegmentAnd16 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. - @param AndData The value to AND with the PCI configuration register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the PCI configuration register. @return The value written to the PCI configuration register. @@ -559,7 +550,7 @@ PciSegmentAndThenOr16 ( If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address The PCI configuration register to read. + @param Address PCI configuration 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. @@ -594,12 +585,12 @@ PciSegmentBitFieldRead16 ( If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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 The new value of the bit field. + @param Value New value of the bit field. @return The value written back to the PCI configuration register. @@ -620,9 +611,15 @@ PciSegmentBitFieldWrite16 ( } /** - Reads the 16-bit PCI configuration 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 PCI configuration register specified by Address. + Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, writes + the result back to the bit field in the 16-bit port. + + Reads the 16-bit PCI configuration 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 PCI configuration register + specified by Address. The value written to the PCI configuration register is + returned. This function must guarantee that all PCI read and write operations + are serialized. Extra left bits in OrData are stripped. If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). @@ -631,7 +628,7 @@ PciSegmentBitFieldWrite16 ( If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -657,31 +654,31 @@ PciSegmentBitFieldOr16 ( } /** - Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, - and writes the result back to the bit field in the 16-bit port. + Reads a bit field in a 16-bit PCI configuration register, performs a bitwise + AND, writes the result back to the bit field in the 16-bit register. - Reads the 16-bit PCI configuration 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 PCI configuration register specified by Address. - The value written to the PCI configuration register is returned. - This function must guarantee that all PCI read and write operations are serialized. - Extra left bits in OrData are stripped. + Reads the 16-bit PCI configuration 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 PCI configuration register specified by + Address. The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are + serialized. Extra left bits in AndData are stripped. If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - If StartBit is greater than 7, then ASSERT(). - If EndBit is greater than 7, 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(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param StartBit The ordinal of the least significant bit in the bit field. - The ordinal of the least significant bit in a byte is bit 0. + Range 0..15. @param EndBit The ordinal of the most significant bit in the bit field. - The ordinal of the most significant bit in a byte is bit 7. - @param AndData The value to AND with the read value from the PCI configuration register. + Range 0..15. + @param AndData The value to AND with the PCI configuration register. - @return The value written to the PCI configuration register. + @return The value written back to the PCI configuration register. **/ UINT16 @@ -719,7 +716,7 @@ PciSegmentBitFieldAnd16 ( If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -755,7 +752,7 @@ PciSegmentBitFieldAndThenOr16 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @return The 32-bit PCI configuration register specified by Address. @@ -780,7 +777,7 @@ PciSegmentRead32 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param Value The value to write. @return The parameter of Value. @@ -810,7 +807,7 @@ PciSegmentWrite32 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param OrData The value to OR with the PCI configuration register. @return The value written to the PCI configuration register. @@ -838,7 +835,7 @@ PciSegmentOr32 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param AndData The value to AND with the PCI configuration register. @return The value written to the PCI configuration register. @@ -868,7 +865,7 @@ PciSegmentAnd32 ( If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address The address that encodes the PCI Segment, Bus, Device, Function, and Register. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the PCI configuration register. @@ -899,7 +896,7 @@ PciSegmentAndThenOr32 ( If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address The PCI configuration register to read. + @param Address PCI configuration 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. @@ -934,12 +931,12 @@ PciSegmentBitFieldRead32 ( If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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 The new value of the bit field. + @param Value New value of the bit field. @return The value written back to the PCI configuration register. @@ -976,7 +973,7 @@ PciSegmentBitFieldWrite32 ( If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -1018,7 +1015,7 @@ PciSegmentBitFieldOr32 ( If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address Address that encodes the PCI Segment, Bus, Device, Function, and Register. @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. @@ -1063,7 +1060,7 @@ PciSegmentBitFieldAnd32 ( If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address The PCI configuration register to write. + @param Address PCI configuration 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. @@ -1105,10 +1102,10 @@ PciSegmentBitFieldAndThenOr32 ( If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). - @param StartAddress The starting address that encodes the PCI Segment, Bus, Device, + @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer receiving the data read. + @param Size Size in bytes of the transfer. + @param Buffer Pointer to a buffer receiving the data read. @return Size @@ -1203,10 +1200,10 @@ PciSegmentReadBuffer ( If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). - @param StartAddress The starting address that encodes the PCI Segment, Bus, Device, + @param StartAddress Starting address that encodes the PCI Segment, Bus, Device, Function and Register. - @param Size The size in bytes of the transfer. - @param Buffer The pointer to a buffer containing the data to write. + @param Size Size in bytes of the transfer. + @param Buffer Pointer to a buffer containing the data to write. @return The parameter of Size. |