summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiPciLibPciRootBridgeIo
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-19 07:09:45 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-19 07:09:45 +0000
commit5dc4fd785603177d77d186f0d8d56ce7613db2cf (patch)
tree47c9d5cf594bc5ff7aa8cabe36b46c7cf5904a09 /MdePkg/Library/UefiPciLibPciRootBridgeIo
parentdfbb47dbd515a8c6bb0468bc72c537830c82baf1 (diff)
downloadedk2-5dc4fd785603177d77d186f0d8d56ce7613db2cf.tar.gz
edk2-5dc4fd785603177d77d186f0d8d56ce7613db2cf.tar.bz2
edk2-5dc4fd785603177d77d186f0d8d56ce7613db2cf.zip
Fix the unaligned issue of PCI read/write buffer.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8333 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiPciLibPciRootBridgeIo')
-rw-r--r--MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c b/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
index 1f23675364..913b97cc1a 100644
--- a/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
+++ b/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
@@ -1286,7 +1286,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;
@@ -1296,7 +1296,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;
@@ -1306,7 +1306,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;
@@ -1384,7 +1384,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;
@@ -1394,7 +1394,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;
@@ -1404,7 +1404,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;