]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridgeIo.c
clean up PciRootBridgeNoEnumerationDxe:
[mirror_edk2.git] / DuetPkg / PciRootBridgeNoEnumerationDxe / PcatPciRootBridgeIo.c
index 84abcf603a58a3ca3bd2d3b1b821ffaafdceea9f..346aa63ae936e87f8a84a682bdd3138b73867cc2 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation                                                         \r
+Copyright (c) 2005 - 2008, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -189,7 +189,6 @@ PcatRootBridgeIoConfiguration (
 //\r
 // Private Function Prototypes\r
 //\r
-STATIC \r
 EFI_STATUS\r
 EFIAPI\r
 PcatRootBridgeIoMemRW (\r
@@ -291,7 +290,9 @@ PcatRootBridgeIoPollMem (
     return EFI_SUCCESS;\r
   }\r
 \r
-  if ( Delay != 0 ) {\r
+  if (Delay == 0) {\r
+    return EFI_SUCCESS;\r
+  } else {\r
 \r
     NumberOfTicks = DivU64x32Remainder (Delay, 100, &Remainder);\r
     if ( Remainder !=0 ) {\r
@@ -352,7 +353,9 @@ PcatRootBridgeIoPollIo (
     return EFI_SUCCESS;\r
   }\r
 \r
-  if (Delay != 0) {\r
+  if (Delay == 0) {\r
+    return EFI_SUCCESS;\r
+  } else {\r
 \r
     NumberOfTicks = DivU64x32Remainder (Delay, 100, &Remainder);\r
     if ( Remainder !=0 ) {\r
@@ -636,7 +639,7 @@ PcatRootBridgeIoMap (
   // map the DMA transfer to a buffer below 4GB.\r
   //\r
   PhysicalAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress;\r
-  if ((PhysicalAddress + *NumberOfBytes) > 0x100000000) {\r
+  if ((PhysicalAddress + *NumberOfBytes) > 0x100000000ULL) {\r
 \r
     //\r
     // Common Buffer operations can not be remapped.  If the common buffer\r
@@ -654,7 +657,7 @@ PcatRootBridgeIoMap (
     Status = gBS->AllocatePool (\r
                     EfiBootServicesData, \r
                     sizeof(MAP_INFO), \r
-                    &MapInfo\r
+                    (VOID **)&MapInfo\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       *NumberOfBytes = 0;\r
@@ -707,7 +710,7 @@ PcatRootBridgeIoMap (
        Status =gBS->AllocatePool (\r
                     EfiBootServicesData, \r
                     sizeof(MAP_INFO_INSTANCE), \r
-                    &MapInstance\r
+                    (VOID **)&MapInstance\r
                     );                    \r
     if (EFI_ERROR(Status)) {\r
       gBS->FreePages (MapInfo->MappedHostAddress,MapInfo->NumberOfPages);\r
@@ -979,7 +982,6 @@ PcatRootBridgeIoConfiguration (
 // Internal function\r
 //\r
 \r
-STATIC \r
 EFI_STATUS\r
 EFIAPI\r
 PcatRootBridgeIoMemRW (\r
@@ -1015,7 +1017,7 @@ Returns:
   UINTN  OutStride;\r
 \r
 \r
-  Width     = Width & 0x03;\r
+  Width     = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) (Width & 0x03);\r
   Stride    = (UINTN)1 << Width;\r
   InStride  = InStrideFlag  ? Stride : 0;\r
   OutStride = OutStrideFlag ? Stride : 0;\r