From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 C55D681B9C for ; Wed, 11 Jan 2017 12:14:49 -0800 (PST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 628636DD95; Wed, 11 Jan 2017 20:14:50 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-80.phx2.redhat.com [10.3.116.80]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0BKEmc8009792; Wed, 11 Jan 2017 15:14:49 -0500 To: "Wu, Hao A" , Ard Biesheuvel , "Ni, Ruiyu" References: <1484100071-33228-1-git-send-email-hao.a.wu@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B87AE3E@SHSMSX104.ccr.corp.intel.com> Cc: "edk2-devel@lists.01.org" From: Laszlo Ersek Message-ID: <4f1275f0-27c0-83bf-5f72-01e6b084ecf6@redhat.com> Date: Wed, 11 Jan 2017 21:14:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 11 Jan 2017 20:14:50 +0000 (UTC) Subject: Re: [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 20:14:49 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 01/11/17 11:59, Wu, Hao A wrote: >> -----Original Message----- >> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >> Sent: Wednesday, January 11, 2017 3:55 PM >> To: Ni, Ruiyu; Laszlo Ersek >> Cc: Wu, Hao A; edk2-devel@lists.01.org >> Subject: Re: [edk2] [PATCH] MdeModulePkg/NonDiscoverable: Compare >> SIZE_4GB with address type >> >> On 11 January 2017 at 02:05, Ni, Ruiyu wrote: >>> One minor comments: put one space after (EFI_PHYSICAL_ADDRESS) and >> (UINTN) as below. >>>> + (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress + *NumberOfBytes > >> SIZE_4GB >>> >> >> I disagree. The EDK2 coding style does not mandate a space after a >> cast, and given the tight binding of the () cast operator in C, it is >> counterinituitive. > > Thanks Ard, I agree with your point. I will leave the patch unchanged. Thanks! I agree those spaces are super counter-intuitive; in the past we've had bugs due to them. It's for best to reflect the tight binding of the cast operator in the source code, by keeping the operand directly adjacent. Cheers Laszlo > Best Regards, > Hao Wu > >> >>> Reviewed-by: Ruiyu Ni >>> >>> >>>> -----Original Message----- >>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >>>> Hao Wu >>>> Sent: Wednesday, January 11, 2017 10:01 AM >>>> To: edk2-devel@lists.01.org >>>> Cc: Wu, Hao A ; Ni, Ruiyu ; Ard >>>> Biesheuvel >>>> Subject: [edk2] [PATCH] MdeModulePkg/NonDiscoverable: Compare >>>> SIZE_4GB with address type >>>> >>>> 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/NonDiscoverable >>>> PciDeviceIo.c >>>> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable >>>> PciDeviceIo.c >>>> index b07c129..c836ad6 100644 >>>> --- >>>> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable >>>> PciDeviceIo.c >>>> +++ >>>> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable >>>> Pc >>>> +++ iDeviceIo.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/NonDisco >>>> verableDeviceRegistrationLib.c >>>> b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco >>>> verableDeviceRegistrationLib.c >>>> index 6f46dfa..4180b0a 100644 >>>> --- >>>> a/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco >>>> verableDeviceRegistrationLib.c >>>> +++ >>>> b/MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDisco >>>> +++ verableDeviceRegistrationLib.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 >>>> >>>> _______________________________________________ >>>> edk2-devel mailing list >>>> edk2-devel@lists.01.org >>>> https://lists.01.org/mailman/listinfo/edk2-devel