]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiPciLibPciCfg2/PciLib.c
Refine new library instances according to review comments.
[mirror_edk2.git] / MdePkg / Library / PeiPciLibPciCfg2 / PciLib.c
index d3d96790c51701ce194d9ebd81ca9d293d85819a..63b1b9fc172807f2de4446818327d88d59243426 100644 (file)
@@ -42,7 +42,7 @@
 \r
 **/\r
 #define PCI_TO_PCICFG2_ADDRESS(A) \\r
-  (((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | ((UINT64)((A) & 0xFFF) << 32)\r
+  ((((A) << 4) & 0xff000000) | (((A) >> 4) & 0x00000700) | (((A) << 1) & 0x001f0000) | (LShiftU64((A) & 0xfff, 32)))\r
 \r
 /**\r
   Internal worker function to read a PCI configuration register.\r
@@ -1210,7 +1210,7 @@ PciReadBuffer (
   UINTN                             ReturnValue;\r
 \r
   ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
-  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
+  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
 \r
   if (Size == 0) {\r
     return Size;\r
@@ -1223,7 +1223,7 @@ PciReadBuffer (
   //\r
   ReturnValue = Size;\r
 \r
-  if ((StartAddress & 1) != 0) {\r
+  if ((StartAddress & BIT0) != 0) {\r
     //\r
     // Read a byte if StartAddress is byte aligned\r
     //\r
@@ -1233,7 +1233,7 @@ PciReadBuffer (
     Buffer = (UINT8*)Buffer + 1;\r
   }\r
 \r
-  if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {\r
+  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {\r
     //\r
     // Read a word if StartAddress is word aligned\r
     //\r
@@ -1308,7 +1308,7 @@ PciWriteBuffer (
   UINTN                             ReturnValue;\r
 \r
   ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);\r
-  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x100);\r
+  ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);\r
 \r
   if (Size == 0) {\r
     return 0;\r
@@ -1321,7 +1321,7 @@ PciWriteBuffer (
   //\r
   ReturnValue = Size;\r
 \r
-  if ((StartAddress & 1) != 0) {\r
+  if ((StartAddress & BIT0) != 0) {\r
     //\r
     // Write a byte if StartAddress is byte aligned\r
     //\r
@@ -1331,7 +1331,7 @@ PciWriteBuffer (
     Buffer = (UINT8*)Buffer + 1;\r
   }\r
 \r
-  if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {\r
+  if (Size >= sizeof (UINT16) && (StartAddress & BIT1) != 0) {\r
     //\r
     // Write a word if StartAddress is word aligned\r
     //\r