]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePciCf8Lib/PciLib.c
1. PostCodeLib.
[mirror_edk2.git] / MdePkg / Library / BasePciCf8Lib / PciLib.c
index c5880bdeeee7e49fcc79e970128f291d9bbe4c4c..7b52a7c9256dce90a861da04491a1188ffa82df8 100644 (file)
@@ -53,7 +53,7 @@
 \r
 **/\r
 #define PCI_TO_CF8_ADDRESS(A) \\r
-  ((UINT32)(((A) >> 4) | ((A) & 0xfc) | 0x80000000))\r
+  ((UINT32) ((((A) >> 4) & 0x00ffff00) | ((A) & 0xfc) | 0x80000000))\r
 \r
 /**\r
   Reads an 8-bit PCI configuration register.\r
@@ -1298,6 +1298,10 @@ PciCf8ReadBuffer (
 {\r
   UINTN                             EndAddress;\r
 \r
+  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
+  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
+  ASSERT (Buffer != NULL);\r
+\r
   EndAddress = StartAddress + Size;\r
 \r
   if (StartAddress < EndAddress && (StartAddress & 1)) {\r
@@ -1382,6 +1386,10 @@ PciCf8WriteBuffer (
 {\r
   UINTN                             EndAddress;\r
 \r
+  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
+  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
+  ASSERT (Buffer != NULL);\r
+\r
   EndAddress = StartAddress + Size;\r
 \r
   if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {\r