From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.221.68; helo=mail-wr1-f68.google.com; envelope-from=philmd@redhat.com; receiver=edk2-devel@lists.01.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (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 53A122118F366 for ; Thu, 22 Nov 2018 07:54:33 -0800 (PST) Received: by mail-wr1-f68.google.com with SMTP id l9so9714115wrt.13 for ; Thu, 22 Nov 2018 07:54:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GyVZF/TOTI4R/yHyREuK2FbG0DzLaUPYHXFFx2tQK/Y=; b=Zdw1tdfsk0ZtBZUpBzJaFTC7Rh2ZuU2nlYgtaqsWuUbTCK/Ith9rBGE9uTBJMOvZGn QUqUC28NAn8xHEc+Lz8gar6Z6cVLGJzzk/nHcx+b42iJ4499x3fFXhTb5gY3bM2XZcJh BTCFHh3jStQQujSyuZHzLV/8bQZe1GSGoW8+Ney0eq0NKzFuSwLV8ByKCYG4pdkrGki8 Ro4/hdflQ7ORIwQb3VmbqqGzR1t5Lk3vWuwPu036UBMw4lo3+fOBSMtWKkN6wIMCYVYN S7BZZj3gvwEPvn+Tgs82XPjZ9gsnu5j7bxeopdtk+aTVh2VeTkANpNutyZP/N2u5dKXq mhsg== X-Gm-Message-State: AA+aEWZjAFcqL6nsq5PmYBjhpZEQJRh84m59uc/Ig0oQK/5IkXwK5WFd EFPhjssADiV7qSV+3uol/hK72kKbIdY= X-Google-Smtp-Source: AFSGD/UU427AZM0I54lR5eEByGZ1zHI722yX1XzmdWMNcIZY15XKeW8OJO/kyN9eabnJtbnO8yUDlA== X-Received: by 2002:a5d:6988:: with SMTP id g8mr9905545wru.33.1542902071731; Thu, 22 Nov 2018 07:54:31 -0800 (PST) Received: from [192.168.1.33] (75.red-83-57-172.dynamicip.rima-tde.net. [83.57.172.75]) by smtp.gmail.com with ESMTPSA id k7sm33655150wrl.51.2018.11.22.07.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 07:54:30 -0800 (PST) To: Ard Biesheuvel , edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, lersek@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: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Openpgp: url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: <30b496d1-5274-3095-b2d8-6c9d2e5ceb26@redhat.com> Date: Thu, 22 Nov 2018 16:54:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181121115828.3026-2-ard.biesheuvel@linaro.org> 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: Thu, 22 Nov 2018 15:54:33 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 21/11/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 Reviewed-by: Philippe Mathieu-Daudé > --- > 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; >