From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9902081B56 for ; Tue, 10 Jan 2017 23:55:06 -0800 (PST) Received: by mail-it0-x229.google.com with SMTP id r185so67327484ita.0 for ; Tue, 10 Jan 2017 23:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+0z8j2I/ZIkGSHLtUeVjQpzNZrGd65e0s9UL+UWzdKY=; b=OEhqVFQ0j6RvDXImdT9BvaW2rJTuEI9MDx3pZuBIacAmyIPUiKIT1Ih+NK/OHgbbCd z48rgKrgcBt2eY9ghIiaLdTeWzNArC1vJWxXoJKtvYBjQaXS2NF+HGbMq8pR2i1Od0/2 Ch027Md34YE7nLqAy/U4/X4ZccuK6ssg7IrEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+0z8j2I/ZIkGSHLtUeVjQpzNZrGd65e0s9UL+UWzdKY=; b=PH0El6TM5AnAxQQT71/r+Z87TyCSqcQjfuu2zyD7o2YIPtluHmN5Tqvf1dK1bHgpwf KN+9XvVLN/tDN7QhidljzzTOmWb95v3hQYoLvt/vfJG9Gr8FEKjOutqq3lS4R3yA0XkB 9PgC/6DLZMhbKMfuQDv3p8eiMFH0lERzOiaq3ZCnWPx2XjkBqKVFlupNWfn96QvBGU8O 5KsNmyxL4Vm782Og9T4RzC5g8E9LrOugWFJEcYV15HmY+iBZvXaclp4Nq84RjNJn1M1S i0rdmLOLXhsxeuVzPah/NntptUeJ9+HCHA+FNphH4AHOt4ahB5EPXYbzbWmK1krhe1KS JMxg== X-Gm-Message-State: AIkVDXJSAN8oN3XymOkLO//WmjqwhDwzOMPHgvukkYOL9+I0JFhdB6yu3O/ksOGuSysJuD52PjXP9TCEFpaQP6Ap X-Received: by 10.36.74.67 with SMTP id k64mr6860589itb.37.1484121306123; Tue, 10 Jan 2017 23:55:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.144.135 with HTTP; Tue, 10 Jan 2017 23:55:05 -0800 (PST) In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5B87AE3E@SHSMSX104.ccr.corp.intel.com> References: <1484100071-33228-1-git-send-email-hao.a.wu@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B87AE3E@SHSMSX104.ccr.corp.intel.com> From: Ard Biesheuvel Date: Wed, 11 Jan 2017 07:55:05 +0000 Message-ID: To: "Ni, Ruiyu" , Laszlo Ersek Cc: "Wu, Hao A" , "edk2-devel@lists.01.org" 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 07:55:06 -0000 Content-Type: text/plain; charset=UTF-8 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. > 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