X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBasePciCf8Lib%2FPciLib.c;h=64bd1557fc5d86ca5c0ea47cdd90993c3175c1e7;hp=bbd1e01d915e7712d6abe21a07cfb76cae3a0c2d;hb=af2bb549adeefd4e4ae266b8574270218dd5da7c;hpb=d5b86e43cf23787da85fcf862807c1f6714bfac2 diff --git a/MdePkg/Library/BasePciCf8Lib/PciLib.c b/MdePkg/Library/BasePciCf8Lib/PciLib.c index bbd1e01d91..64bd1557fc 100644 --- a/MdePkg/Library/BasePciCf8Lib/PciLib.c +++ b/MdePkg/Library/BasePciCf8Lib/PciLib.c @@ -12,16 +12,10 @@ **/ -// -// The package level header files this module uses -// + #include -// -// The protocols, PPI and GUID defintions for this module -// -// -// The Library classes this module consumes -// + +#include #include #include #include @@ -1307,7 +1301,7 @@ PciCf8ReadBuffer ( OUT VOID *Buffer ) { - UINTN ReturnValue; + UINTN ReturnValue; ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); @@ -1337,7 +1331,8 @@ PciCf8ReadBuffer ( // // Read a word if StartAddress is word aligned // - *(volatile UINT16 *)Buffer = PciCf8Read16 (StartAddress); + WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress)); + StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1347,7 +1342,7 @@ PciCf8ReadBuffer ( // // Read as many double words as possible // - *(volatile UINT32 *)Buffer = PciCf8Read32 (StartAddress); + WriteUnaligned32 ((UINT32 *)Buffer, (UINT32) PciCf8Read32 (StartAddress)); StartAddress += sizeof (UINT32); Size -= sizeof (UINT32); Buffer = (UINT32*)Buffer + 1; @@ -1357,7 +1352,7 @@ PciCf8ReadBuffer ( // // Read the last remaining word if exist // - *(volatile UINT16 *)Buffer = PciCf8Read16 (StartAddress); + WriteUnaligned16 ((UINT16 *)Buffer, (UINT16) PciCf8Read16 (StartAddress)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1406,7 +1401,7 @@ PciCf8WriteBuffer ( IN VOID *Buffer ) { - UINTN ReturnValue; + UINTN ReturnValue; ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100); @@ -1436,7 +1431,7 @@ PciCf8WriteBuffer ( // // Write a word if StartAddress is word aligned // - PciCf8Write16 (StartAddress, *(UINT16*)Buffer); + PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1; @@ -1446,7 +1441,7 @@ PciCf8WriteBuffer ( // // Write as many double words as possible // - PciCf8Write32 (StartAddress, *(UINT32*)Buffer); + PciCf8Write32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer)); StartAddress += sizeof (UINT32); Size -= sizeof (UINT32); Buffer = (UINT32*)Buffer + 1; @@ -1456,7 +1451,7 @@ PciCf8WriteBuffer ( // // Write the last remaining word if exist // - PciCf8Write16 (StartAddress, *(UINT16*)Buffer); + PciCf8Write16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer)); StartAddress += sizeof (UINT16); Size -= sizeof (UINT16); Buffer = (UINT16*)Buffer + 1;