public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type
@ 2017-01-11  2:01 Hao Wu
  2017-01-11  2:05 ` Ni, Ruiyu
  0 siblings, 1 reply; 6+ messages in thread
From: Hao Wu @ 2017-01-11  2:01 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Ard Biesheuvel, Ruiyu Ni

Refine the codes to compare the definition 'SIZE_4GB' with type
EFI_PHYSICAL_ADDRESS.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 .../Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c  | 4 ++--
 .../NonDiscoverableDeviceRegistrationLib.c                            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
index b07c129..c836ad6 100644
--- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
+++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
@@ -598,7 +598,7 @@ CoherentPciIoMap (
   //
   Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);
   if ((Dev->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) == 0 &&
-      (UINTN)HostAddress + *NumberOfBytes > SIZE_4GB) {
+      (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress + *NumberOfBytes > SIZE_4GB) {
 
     //
     // Bounce buffering is not possible for consistent mappings
@@ -1006,7 +1006,7 @@ NonCoherentPciIoMap (
   // a bounce buffer and copy over the data in case HostAddress >= 4 GB.
   //
   Bounce = ((Dev->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) == 0 &&
-            (UINTN)HostAddress + *NumberOfBytes > SIZE_4GB);
+            (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress + *NumberOfBytes > SIZE_4GB);
 
   if (!Bounce) {
     switch (Operation) {
diff --git a/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.c b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.c
index 6f46dfa..4180b0a 100644
--- a/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.c
+++ b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.c
@@ -163,7 +163,7 @@ RegisterNonDiscoverableMmioDevice (
     Desc->AddrLen               = Size;
     Desc->AddrRangeMax          = Base + Size - 1;
     Desc->ResType               = ACPI_ADDRESS_SPACE_TYPE_MEM;
-    Desc->AddrSpaceGranularity  = (Base + Size > SIZE_4GB) ? 64 : 32;
+    Desc->AddrSpaceGranularity  = ((EFI_PHYSICAL_ADDRESS) Base + Size > SIZE_4GB) ? 64 : 32;
     Desc->AddrTranslationOffset = 0;
   }
   VA_END (Args);
-- 
1.9.5.msysgit.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-11 20:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11  2:01 [PATCH] MdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type Hao Wu
2017-01-11  2:05 ` Ni, Ruiyu
2017-01-11  2:08   ` Wu, Hao A
2017-01-11  7:55   ` Ard Biesheuvel
2017-01-11 10:59     ` Wu, Hao A
2017-01-11 20:14       ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox