Update the PciXXXReadBuffer() for better coding style.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4449 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2007-12-29 06:11:52 +00:00
parent ab4a8f3357
commit af2bb549ad
2 changed files with 6 additions and 14 deletions

View File

@ -1302,7 +1302,6 @@ PciCf8ReadBuffer (
) )
{ {
UINTN ReturnValue; UINTN ReturnValue;
UINTN Value;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);
@ -1332,8 +1331,7 @@ PciCf8ReadBuffer (
// //
// Read a word if StartAddress is word aligned // Read a word if StartAddress is word aligned
// //
Value = (UINTN) PciCf8Read16 (StartAddress); WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress));
WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) Value);
StartAddress += sizeof (UINT16); StartAddress += sizeof (UINT16);
Size -= sizeof (UINT16); Size -= sizeof (UINT16);
@ -1344,8 +1342,7 @@ PciCf8ReadBuffer (
// //
// Read as many double words as possible // Read as many double words as possible
// //
Value = (UINTN) PciCf8Read32 (StartAddress); WriteUnaligned32 ((UINT32 *)Buffer, (UINT32) PciCf8Read32 (StartAddress));
WriteUnaligned32 ((UINT32 *)Buffer, (UINT32) Value);
StartAddress += sizeof (UINT32); StartAddress += sizeof (UINT32);
Size -= sizeof (UINT32); Size -= sizeof (UINT32);
Buffer = (UINT32*)Buffer + 1; Buffer = (UINT32*)Buffer + 1;
@ -1355,8 +1352,7 @@ PciCf8ReadBuffer (
// //
// Read the last remaining word if exist // Read the last remaining word if exist
// //
Value = (UINTN) PciCf8Read16 (StartAddress); WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress));
WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) Value);
StartAddress += sizeof (UINT16); StartAddress += sizeof (UINT16);
Size -= sizeof (UINT16); Size -= sizeof (UINT16);
Buffer = (UINT16*)Buffer + 1; Buffer = (UINT16*)Buffer + 1;

View File

@ -1210,7 +1210,6 @@ PciExpressReadBuffer (
) )
{ {
UINTN ReturnValue; UINTN ReturnValue;
UINTN Value;
ASSERT_INVALID_PCI_ADDRESS (StartAddress); ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
@ -1240,8 +1239,7 @@ PciExpressReadBuffer (
// //
// Read a word if StartAddress is word aligned // Read a word if StartAddress is word aligned
// //
Value = (UINTN) PciExpressRead16 (StartAddress); WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) Value);
StartAddress += sizeof (UINT16); StartAddress += sizeof (UINT16);
Size -= sizeof (UINT16); Size -= sizeof (UINT16);
@ -1252,8 +1250,7 @@ PciExpressReadBuffer (
// //
// Read as many double words as possible // Read as many double words as possible
// //
Value = (UINTN) PciExpressRead32 (StartAddress); WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) Value);
StartAddress += sizeof (UINT32); StartAddress += sizeof (UINT32);
Size -= sizeof (UINT32); Size -= sizeof (UINT32);
@ -1264,8 +1261,7 @@ PciExpressReadBuffer (
// //
// Read the last remaining word if exist // Read the last remaining word if exist
// //
Value = (UINTN) PciExpressRead16 (StartAddress); WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) Value);
StartAddress += sizeof (UINT16); StartAddress += sizeof (UINT16);
Size -= sizeof (UINT16); Size -= sizeof (UINT16);
Buffer = (UINT16*)Buffer + 1; Buffer = (UINT16*)Buffer + 1;