]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePciCf8Lib/PciLib.c
Fix invalid return status to sync with newest UEFI spec 2.1
[mirror_edk2.git] / MdePkg / Library / BasePciCf8Lib / PciLib.c
index ca9b17abe25494c598b8220afa9f075e5df6b0cf..d95f8366b1d9e1cce9dc5aa150b284becc8775a6 100644 (file)
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:  PciLib.c\r
-\r
 **/\r
 \r
+\r
+#include <Base.h>\r
+\r
+\r
+#include <Library/PciCf8Lib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
 //\r
 // Declare I/O Ports used to perform PCI Confguration Cycles\r
 //\r
@@ -1297,7 +1303,7 @@ PciCf8ReadBuffer (
 {\r
   UINTN                             ReturnValue;\r
 \r
-  ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
+  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
 \r
   if (Size == 0) {\r
@@ -1315,7 +1321,7 @@ PciCf8ReadBuffer (
     //\r
     // Read a byte if StartAddress is byte aligned\r
     //\r
-    *(UINT8*)Buffer = PciCf8Read8 (StartAddress);\r
+    *(volatile UINT8 *)Buffer = PciCf8Read8 (StartAddress);\r
     StartAddress += sizeof (UINT8);\r
     Size -= sizeof (UINT8);\r
     Buffer = (UINT8*)Buffer + 1;\r
@@ -1325,7 +1331,7 @@ PciCf8ReadBuffer (
     //\r
     // Read a word if StartAddress is word aligned\r
     //\r
-    *(UINT16*)Buffer = PciCf8Read16 (StartAddress);\r
+    *(volatile UINT16 *)Buffer = PciCf8Read16 (StartAddress);\r
     StartAddress += sizeof (UINT16);\r
     Size -= sizeof (UINT16);\r
     Buffer = (UINT16*)Buffer + 1;\r
@@ -1335,7 +1341,7 @@ PciCf8ReadBuffer (
     //\r
     // Read as many double words as possible\r
     //\r
-    *(UINT32*)Buffer = PciCf8Read32 (StartAddress);\r
+    *(volatile UINT32 *)Buffer = PciCf8Read32 (StartAddress);\r
     StartAddress += sizeof (UINT32);\r
     Size -= sizeof (UINT32);\r
     Buffer = (UINT32*)Buffer + 1;\r
@@ -1345,7 +1351,7 @@ PciCf8ReadBuffer (
     //\r
     // Read the last remaining word if exist\r
     //\r
-    *(UINT16*)Buffer = PciCf8Read16 (StartAddress);\r
+    *(volatile UINT16 *)Buffer = PciCf8Read16 (StartAddress);\r
     StartAddress += sizeof (UINT16);\r
     Size -= sizeof (UINT16);\r
     Buffer = (UINT16*)Buffer + 1;\r
@@ -1355,7 +1361,7 @@ PciCf8ReadBuffer (
     //\r
     // Read the last remaining byte if exist\r
     //\r
-    *(UINT8*)Buffer = PciCf8Read8 (StartAddress);\r
+    *(volatile UINT8 *)Buffer = PciCf8Read8 (StartAddress);\r
   }\r
 \r
   return ReturnValue;\r
@@ -1396,7 +1402,7 @@ PciCf8WriteBuffer (
 {\r
   UINTN                             ReturnValue;\r
 \r
-  ASSERT_INVALID_PCI_ADDRESS (StartAddress);\r
+  ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
   ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
 \r
   if (Size == 0) {\r