From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org 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 3D3FC21B02822 for ; Wed, 21 Nov 2018 09:01:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AB352D2BEB; Wed, 21 Nov 2018 17:01:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-240.rdu2.redhat.com [10.10.120.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id 974CB10021B1; Wed, 21 Nov 2018 17:01:50 +0000 (UTC) To: Ard Biesheuvel , edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, philmd@redhat.com, hongbo.zhang@linaro.org, nariman.poushin@linaro.org, thomas.abraham@arm.com References: <20181121115828.3026-1-ard.biesheuvel@linaro.org> <20181121115828.3026-2-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <3875cc55-6b13-6c1a-9609-23d0caaeea43@redhat.com> Date: Wed, 21 Nov 2018 18:01:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181121115828.3026-2-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 21 Nov 2018 17:01:55 +0000 (UTC) Subject: Re: [PATCH v2 1/5] ArmPlatformPkg/NorFlashDxe: prepare for devicepath format change X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 17:01:57 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/21/18 12:58, Ard Biesheuvel wrote: > A subsequent patch will change the layout of devicepath nodes > produced by this driver. In preparation, make some tweaks to > the code to use a packed struct for the devicepath and to pass > the device index to NorFlashCreateInstance(). These are cosmetic > changes only, the resulting binaries should be identical. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > Reviewed-by: Laszlo Ersek > --- > ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 9 ++++++--- > ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h | 2 ++ > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > index 46e815beb343..53753a4721ac 100644 > --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > @@ -82,7 +82,10 @@ NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = { > { > HARDWARE_DEVICE_PATH, > HW_VENDOR_DP, > - { (UINT8)sizeof(VENDOR_DEVICE_PATH), (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) } > + { > + (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End)), > + (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End) >> 8) > + } > }, > { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED > }, > @@ -99,7 +102,7 @@ NorFlashCreateInstance ( > IN UINTN NorFlashDeviceBase, > IN UINTN NorFlashRegionBase, > IN UINTN NorFlashSize, > - IN UINT32 MediaId, > + IN UINT32 Index, > IN UINT32 BlockSize, > IN BOOLEAN SupportFvb, > IN CONST GUID *NorFlashGuid, > @@ -121,7 +124,7 @@ NorFlashCreateInstance ( > Instance->Size = NorFlashSize; > > Instance->BlockIoProtocol.Media = &Instance->Media; > - Instance->Media.MediaId = MediaId; > + Instance->Media.MediaId = Index; > Instance->Media.BlockSize = BlockSize; > Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1; > > diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > index 5c07694fbfaa..910681fd4412 100644 > --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > @@ -122,10 +122,12 @@ > > typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; > > +#pragma pack(1) > typedef struct { > VENDOR_DEVICE_PATH Vendor; > EFI_DEVICE_PATH_PROTOCOL End; > } NOR_FLASH_DEVICE_PATH; > +#pragma pack() > > struct _NOR_FLASH_INSTANCE { > UINT32 Signature; > We tend to insert a space character between "pack" and "(1)"/"()" too. Feel free to update the patch when you push it, or not at all. My R-b stands either way. Thanks! Laszlo