]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type
authorHao Wu <hao.a.wu@intel.com>
Wed, 11 Jan 2017 01:54:39 +0000 (09:54 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 12 Jan 2017 13:26:30 +0000 (21:26 +0800)
Refine the codes to compare the definition 'SIZE_4GB' with type
EFI_PHYSICAL_ADDRESS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.c

index b07c1293d6102f5ac3c0eda41d5eb927e4f2a546..c836ad6a9162fa7b2b346598cb42932263a7f9c7 100644 (file)
@@ -598,7 +598,7 @@ CoherentPciIoMap (
   //\r
   Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);\r
   if ((Dev->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) == 0 &&\r
-      (UINTN)HostAddress + *NumberOfBytes > SIZE_4GB) {\r
+      (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress + *NumberOfBytes > SIZE_4GB) {\r
 \r
     //\r
     // Bounce buffering is not possible for consistent mappings\r
@@ -1006,7 +1006,7 @@ NonCoherentPciIoMap (
   // a bounce buffer and copy over the data in case HostAddress >= 4 GB.\r
   //\r
   Bounce = ((Dev->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) == 0 &&\r
-            (UINTN)HostAddress + *NumberOfBytes > SIZE_4GB);\r
+            (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress + *NumberOfBytes > SIZE_4GB);\r
 \r
   if (!Bounce) {\r
     switch (Operation) {\r
index 6f46dfac0f07b7dfb3169d9adc8ec9e15223ca5b..536dfc7297bab1f78eceecd783532a13a9f8ce74 100644 (file)
@@ -163,7 +163,7 @@ RegisterNonDiscoverableMmioDevice (
     Desc->AddrLen               = Size;\r
     Desc->AddrRangeMax          = Base + Size - 1;\r
     Desc->ResType               = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
-    Desc->AddrSpaceGranularity  = (Base + Size > SIZE_4GB) ? 64 : 32;\r
+    Desc->AddrSpaceGranularity  = ((EFI_PHYSICAL_ADDRESS)Base + Size > SIZE_4GB) ? 64 : 32;\r
     Desc->AddrTranslationOffset = 0;\r
   }\r
   VA_END (Args);\r