X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiPciLibPciCfg2%2FPciLib.c;h=ce9121b63fd75963c0f77100ae5d81cce34e0a30;hp=ddae8dbfc34426a1a0ffa7cd96092893bc676b37;hb=a750b4ae24ce072f7c5ced1b89c18f9cc23debc8;hpb=9638ba6d3f663ba64cb06193f22bc5c70356da64 diff --git a/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c b/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c index ddae8dbfc3..ce9121b63f 100644 --- a/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c +++ b/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c @@ -1,12 +1,12 @@ /** @file PCI Library using PCI CFG2 PPI. - Copyright (c) 2007 - 2008, Intel Corporation All rights - reserved. This program and the accompanying materials are + Copyright (c) 2007 - 2012, 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 + 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. @@ -37,7 +37,7 @@ /** Translate PCI Lib address into format of PCI CFG2 PPI. - @param A Address that encodes the PCI Bus, Device, Function and + @param A The address that encodes the PCI Bus, Device, Function and Register. **/ @@ -51,9 +51,9 @@ It reads and returns the PCI configuration register specified by Address, the width of data is specified by Width. - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. - @param Width Width of data to read + @param Width The width of data to read @return The value read from the PCI configuration register. @@ -90,12 +90,12 @@ PeiPciLibPciCfg2ReadWorker ( This function wraps EFI_PEI_PCI_CFG2_PPI.Write() service. It writes the PCI configuration register specified by Address with the - value specified by Data. The width of data is specifed by Width. + value specified by Data. The width of data is specified by Width. Data is returned. - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. - @param Width Width of data to write + @param Width The width of data to write @param Data The value to write. @return The value written to the PCI configuration register. @@ -129,12 +129,15 @@ PeiPciLibPciCfg2WriteWorker ( } /** - Register a PCI device so PCI configuration registers may be accessed after + Registers a PCI device so PCI configuration registers may be accessed after SetVirtualAddressMap(). + Registers the PCI device specified by Address so all the PCI configuration registers + associated with that PCI device may be accessed after SetVirtualAddressMap() is called. + If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @retval RETURN_SUCCESS The PCI device was registered for runtime access. @@ -152,6 +155,7 @@ PciRegisterForRuntimeAccess ( IN UINTN Address ) { + ASSERT_INVALID_PCI_ADDRESS (Address, 0); return RETURN_UNSUPPORTED; } @@ -164,10 +168,10 @@ PciRegisterForRuntimeAccess ( If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. - @return The value read from the PCI configuration register. + @return The read value from the PCI configuration register. **/ UINT8 @@ -190,9 +194,9 @@ PciRead8 ( If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. - @param Data The value to write. + @param Value The value to write. @return The value written to the PCI configuration register. @@ -201,20 +205,20 @@ UINT8 EFIAPI PciWrite8 ( IN UINTN Address, - IN UINT8 Data + IN UINT8 Value ) { ASSERT_INVALID_PCI_ADDRESS (Address, 0); - return (UINT8) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Data); + return (UINT8) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value); } /** - Performs a bitwise inclusive OR of an 8-bit PCI configuration register with + Performs a bitwise OR of an 8-bit PCI configuration register with an 8-bit value. Reads the 8-bit PCI configuration register specified by Address, performs a - bitwise inclusive OR between the read result and the value specified by + bitwise OR between the read result and the value specified by OrData, and writes the result to the 8-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 @@ -222,7 +226,7 @@ PciWrite8 ( If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param OrData The value to OR with the PCI configuration register. @@ -252,7 +256,7 @@ PciOr8 ( If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @@ -271,11 +275,11 @@ PciAnd8 ( /** Performs a bitwise AND of an 8-bit PCI configuration register with an 8-bit - value, followed a bitwise inclusive OR with another 8-bit value. + value, followed a bitwise OR with another 8-bit value. Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise inclusive OR between the result of the AND operation and + 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 PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI @@ -283,7 +287,7 @@ PciAnd8 ( If Address > 0x0FFFFFFF, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the result of the AND operation. @@ -314,7 +318,7 @@ PciAndThenOr8 ( If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address PCI configuration register to read. + @param Address The 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. @@ -346,13 +350,14 @@ PciBitFieldRead8 ( If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). 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 PCI configuration register to write. + @param Address The 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 New value of the bit field. + @param Value The new value of the bit field. @return The value written back to the PCI configuration register. @@ -377,7 +382,7 @@ PciBitFieldWrite8 ( 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 inclusive OR between the read result and the value specified by + bitwise OR between the read result and the value specified by OrData, and writes the result to the 8-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 @@ -387,8 +392,9 @@ PciBitFieldWrite8 ( If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). 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 PCI configuration register to write. + @param Address The 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. @@ -428,8 +434,9 @@ PciBitFieldOr8 ( If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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 PCI configuration register to write. + @param Address The 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. @@ -456,11 +463,11 @@ PciBitFieldAnd8 ( /** 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 + 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 inclusive OR between the read result and + bitwise AND followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 8-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI @@ -471,8 +478,10 @@ PciBitFieldAnd8 ( If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address PCI configuration register to write. + @param Address The 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. @@ -509,7 +518,7 @@ PciBitFieldAndThenOr8 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @return The read value from the PCI configuration register. @@ -536,7 +545,7 @@ PciRead16 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param Value The value to write. @@ -547,20 +556,20 @@ UINT16 EFIAPI PciWrite16 ( IN UINTN Address, - IN UINT16 Data + IN UINT16 Value ) { ASSERT_INVALID_PCI_ADDRESS (Address, 1); - return (UINT16) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Data); + return (UINT16) PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint16, Value); } /** - Performs a bitwise inclusive OR of a 16-bit PCI configuration register with + Performs a bitwise OR of a 16-bit PCI configuration register with a 16-bit value. Reads the 16-bit PCI configuration register specified by Address, performs a - bitwise inclusive OR between the read result and the value specified by + 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 @@ -569,7 +578,7 @@ PciWrite16 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param OrData The value to OR with the PCI configuration register. @@ -600,7 +609,7 @@ PciOr16 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @@ -619,11 +628,11 @@ PciAnd16 ( /** Performs a bitwise AND of a 16-bit PCI configuration register with a 16-bit - value, followed a bitwise inclusive OR with another 16-bit value. + value, followed a bitwise OR with another 16-bit value. Reads the 16-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise inclusive OR between the result of the AND operation and + 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 PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI @@ -632,7 +641,7 @@ PciAnd16 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the result of the AND operation. @@ -664,7 +673,7 @@ PciAndThenOr16 ( If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address PCI configuration register to read. + @param Address The 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. @@ -697,13 +706,14 @@ PciBitFieldRead16 ( 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address PCI configuration register to write. + @param Address The 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 New value of the bit field. + @param Value The new value of the bit field. @return The value written back to the PCI configuration register. @@ -728,7 +738,7 @@ PciBitFieldWrite16 ( 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 inclusive OR between the read result and the value specified by + 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 @@ -739,8 +749,9 @@ PciBitFieldWrite16 ( 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address PCI configuration register to write. + @param Address The 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. @@ -781,8 +792,9 @@ PciBitFieldOr16 ( 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 PCI configuration register to write. + @param Address The 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. @@ -809,11 +821,11 @@ PciBitFieldAnd16 ( /** 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 + bitwise OR, and 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 AND followed by a bitwise inclusive OR between the read result and + bitwise AND followed by a bitwise OR 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 @@ -825,8 +837,10 @@ PciBitFieldAnd16 ( 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(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address PCI configuration register to write. + @param Address The 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. @@ -863,7 +877,7 @@ PciBitFieldAndThenOr16 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @return The read value from the PCI configuration register. @@ -890,7 +904,7 @@ PciRead32 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param Value The value to write. @@ -901,20 +915,20 @@ UINT32 EFIAPI PciWrite32 ( IN UINTN Address, - IN UINT32 Data + IN UINT32 Value ) { ASSERT_INVALID_PCI_ADDRESS (Address, 3); - return PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint32, Data); + return PeiPciLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint32, Value); } /** - Performs a bitwise inclusive OR of a 32-bit PCI configuration register with + Performs a bitwise OR of a 32-bit PCI configuration register with a 32-bit value. Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise inclusive OR between the read result and the value specified by + bitwise OR between the read result and the value specified by OrData, and writes the result to the 32-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 @@ -923,7 +937,7 @@ PciWrite32 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param OrData The value to OR with the PCI configuration register. @@ -954,7 +968,7 @@ PciOr32 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @@ -973,11 +987,11 @@ PciAnd32 ( /** Performs a bitwise AND of a 32-bit PCI configuration register with a 32-bit - value, followed a bitwise inclusive OR with another 32-bit value. + value, followed a bitwise OR with another 32-bit value. Reads the 32-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, - performs a bitwise inclusive OR between the result of the AND operation and + 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 PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI @@ -986,7 +1000,7 @@ PciAnd32 ( If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). - @param Address Address that encodes the PCI Bus, Device, Function and + @param Address The address that encodes the PCI Bus, Device, Function and Register. @param AndData The value to AND with the PCI configuration register. @param OrData The value to OR with the result of the AND operation. @@ -1018,7 +1032,7 @@ PciAndThenOr32 ( If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). - @param Address PCI configuration register to read. + @param Address The 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. @@ -1051,13 +1065,14 @@ PciBitFieldRead32 ( If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). 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 PCI configuration register to write. + @param Address The 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 New value of the bit field. + @param Value The new value of the bit field. @return The value written back to the PCI configuration register. @@ -1082,7 +1097,7 @@ PciBitFieldWrite32 ( writes the result back to the bit field in the 32-bit port. Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise inclusive OR between the read result and the value specified by + bitwise OR between the read result and the value specified by OrData, and writes the result to the 32-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 @@ -1093,8 +1108,9 @@ PciBitFieldWrite32 ( If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). 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 PCI configuration register to write. + @param Address The 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. @@ -1135,8 +1151,9 @@ PciBitFieldOr32 ( If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, 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 PCI configuration register to write. + @param Address The 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. @@ -1163,11 +1180,11 @@ PciBitFieldAnd32 ( /** 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 + bitwise OR, and writes the result back to the bit field in the 32-bit port. Reads the 32-bit PCI configuration register specified by Address, performs a - bitwise AND followed by a bitwise inclusive OR between the read result and + bitwise AND followed by a bitwise OR between the read result and the value specified by AndData, and writes the result to the 32-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI @@ -1179,8 +1196,10 @@ PciBitFieldAnd32 ( If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, 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(). + If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). - @param Address PCI configuration register to write. + @param Address The 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. @@ -1222,10 +1241,10 @@ PciBitFieldAndThenOr32 ( If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). - @param StartAddress Starting address that encodes the PCI Bus, Device, + @param StartAddress The starting address that encodes the PCI Bus, Device, Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer receiving the data read. + @param Size The size in bytes of the transfer. + @param Buffer The pointer to a buffer receiving the data read. @return Size @@ -1268,7 +1287,7 @@ PciReadBuffer ( // // Read a word if StartAddress is word aligned // - *(volatile UINT16 *)Buffer = PciRead16 (StartAddress); + WriteUnaligned16 (Buffer, PciRead16 (StartAddress)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1278,7 +1297,7 @@ PciReadBuffer ( // // Read as many double words as possible // - *(volatile UINT32 *)Buffer = PciRead32 (StartAddress); + WriteUnaligned32 (Buffer, PciRead32 (StartAddress)); StartAddress += sizeof (UINT32); Size -= sizeof (UINT32); Buffer = (UINT32*)Buffer + 1; @@ -1288,7 +1307,7 @@ PciReadBuffer ( // // Read the last remaining word if exist // - *(volatile UINT16 *)Buffer = PciRead16 (StartAddress); + WriteUnaligned16 (Buffer, PciRead16 (StartAddress)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1320,12 +1339,12 @@ PciReadBuffer ( If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). - @param StartAddress Starting address that encodes the PCI Bus, Device, + @param StartAddress The starting address that encodes the PCI Bus, Device, Function and Register. - @param Size Size in bytes of the transfer. - @param Buffer Pointer to a buffer containing the data to write. + @param Size The size in bytes of the transfer. + @param Buffer The pointer to a buffer containing the data to write. - @return Size + @return Size written to StartAddress. **/ UINTN @@ -1366,7 +1385,7 @@ PciWriteBuffer ( // // Write a word if StartAddress is word aligned // - PciWrite16 (StartAddress, *(UINT16*)Buffer); + PciWrite16 (StartAddress, ReadUnaligned16 (Buffer)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1376,7 +1395,7 @@ PciWriteBuffer ( // // Write as many double words as possible // - PciWrite32 (StartAddress, *(UINT32*)Buffer); + PciWrite32 (StartAddress, ReadUnaligned32 (Buffer)); StartAddress += sizeof (UINT32); Size -= sizeof (UINT32); Buffer = (UINT32*)Buffer + 1; @@ -1386,7 +1405,7 @@ PciWriteBuffer ( // // Write the last remaining word if exist // - PciWrite16 (StartAddress, *(UINT16*)Buffer); + PciWrite16 (StartAddress, ReadUnaligned16 (Buffer)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1;