/** @file\r
PCI Library using PCI Root Bridge I/O Protocol.\r
\r
- Copyright (c) 2007 - 2008, Intel Corporation All rights\r
- reserved. This program and the accompanying materials are\r
+ Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are\r
licensed and made available under the terms and conditions of\r
the BSD License which accompanies this distribution. The full\r
text of the license may be found at\r
}\r
\r
/**\r
- Register a PCI device so PCI configuration registers may be accessed after \r
+ Registers a PCI device so PCI configuration registers may be accessed after \r
SetVirtualAddressMap().\r
\r
+ Registers the PCI device specified by Address so all the PCI configuration registers \r
+ associated with that PCI device may be accessed after SetVirtualAddressMap() is called.\r
+ \r
If Address > 0x0FFFFFFF, then ASSERT().\r
\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
IN UINTN Address\r
)\r
{\r
+ ASSERT_INVALID_PCI_ADDRESS (Address, 0);\r
return RETURN_UNSUPPORTED;\r
}\r
\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
\r
- @return The value read from the PCI configuration register.\r
+ @return The read value from the PCI configuration register.\r
\r
**/\r
UINT8\r
\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
- @param Data The value to write.\r
+ @param Value The value to write.\r
\r
@return The value written to the PCI configuration register.\r
\r
EFIAPI\r
PciWrite8 (\r
IN UINTN Address,\r
- IN UINT8 Data\r
+ IN UINT8 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address, 0);\r
\r
- return (UINT8) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Data);\r
+ return (UINT8) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value);\r
}\r
\r
/**\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
\r
- @return The value read from the PCI configuration register.\r
+ @return The read value from the PCI configuration register.\r
\r
**/\r
UINT16\r
\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
- @param Data The value to write.\r
+ @param Value The value to write.\r
\r
@return The value written to the PCI configuration register.\r
\r
EFIAPI\r
PciWrite16 (\r
IN UINTN Address,\r
- IN UINT16 Data\r
+ IN UINT16 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address, 1);\r
\r
- return (UINT16) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Data);\r
+ return (UINT16) DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint16, Value);\r
}\r
\r
/**\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
\r
- @return The value read from the PCI configuration register.\r
+ @return The read value from the PCI configuration register.\r
\r
**/\r
UINT32\r
\r
@param Address Address that encodes the PCI Bus, Device, Function and\r
Register.\r
- @param Data The value to write.\r
+ @param Value The value to write.\r
\r
@return The value written to the PCI configuration register.\r
\r
EFIAPI\r
PciWrite32 (\r
IN UINTN Address,\r
- IN UINT32 Data\r
+ IN UINT32 Value\r
)\r
{\r
ASSERT_INVALID_PCI_ADDRESS (Address, 3);\r
\r
- return DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Data);\r
+ return DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value);\r
}\r
\r
/**\r
//\r
// Read a word if StartAddress is word aligned\r
//\r
- *(volatile UINT16 *)Buffer = PciRead16 (StartAddress);\r
+ WriteUnaligned16 (Buffer, PciRead16 (StartAddress));\r
StartAddress += sizeof (UINT16);\r
Size -= sizeof (UINT16);\r
Buffer = (UINT16*)Buffer + 1;\r
//\r
// Read as many double words as possible\r
//\r
- *(volatile UINT32 *)Buffer = PciRead32 (StartAddress);\r
+ WriteUnaligned32 (Buffer, PciRead32 (StartAddress));\r
StartAddress += sizeof (UINT32);\r
Size -= sizeof (UINT32);\r
Buffer = (UINT32*)Buffer + 1;\r
//\r
// Read the last remaining word if exist\r
//\r
- *(volatile UINT16 *)Buffer = PciRead16 (StartAddress);\r
+ WriteUnaligned16 (Buffer, PciRead16 (StartAddress));\r
StartAddress += sizeof (UINT16);\r
Size -= sizeof (UINT16);\r
Buffer = (UINT16*)Buffer + 1;\r
@param Size Size in bytes of the transfer.\r
@param Buffer Pointer to a buffer containing the data to write.\r
\r
- @return Size\r
+ @return Size written to StartAddress.\r
\r
**/\r
UINTN\r
//\r
// Write a word if StartAddress is word aligned\r
//\r
- PciWrite16 (StartAddress, *(UINT16*)Buffer);\r
+ PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));\r
StartAddress += sizeof (UINT16);\r
Size -= sizeof (UINT16);\r
Buffer = (UINT16*)Buffer + 1;\r
//\r
// Write as many double words as possible\r
//\r
- PciWrite32 (StartAddress, *(UINT32*)Buffer);\r
+ PciWrite32 (StartAddress, ReadUnaligned32 (Buffer));\r
StartAddress += sizeof (UINT32);\r
Size -= sizeof (UINT32);\r
Buffer = (UINT32*)Buffer + 1;\r
//\r
// Write the last remaining word if exist\r
//\r
- PciWrite16 (StartAddress, *(UINT16*)Buffer);\r
+ PciWrite16 (StartAddress, ReadUnaligned16 (Buffer));\r
StartAddress += sizeof (UINT16);\r
Size -= sizeof (UINT16);\r
Buffer = (UINT16*)Buffer + 1;\r