From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 85681817E4 for ; Tue, 10 Jan 2017 18:01:14 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP; 10 Jan 2017 18:01:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="51829855" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by fmsmga005.fm.intel.com with ESMTP; 10 Jan 2017 18:01:13 -0800 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Ard Biesheuvel , Ruiyu Ni Date: Wed, 11 Jan 2017 10:01:11 +0800 Message-Id: <1484100071-33228-1-git-send-email-hao.a.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.0 Subject: [PATCH] MdeModulePkg/NonDiscoverable: Compare SIZE_4GB with address type X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 02:01:14 -0000 Refine the codes to compare the definition 'SIZE_4GB' with type EFI_PHYSICAL_ADDRESS. Cc: Ard Biesheuvel Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- .../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