/** @file\r
PCI Library using PCI CFG2 PPI.\r
\r
- Copyright (c) 2007 - 2008, Intel Corporation All rights\r
+ Copyright (c) 2007 - 2009, Intel Corporation All rights\r
reserved. 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
IN UINTN Address\r
)\r
{\r
+ ASSERT_INVALID_PCI_ADDRESS (Address, 0);\r
return RETURN_UNSUPPORTED;\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
//\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