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 49EB321A07A80 for ; Wed, 21 Nov 2018 09:03:49 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C198530842AC; Wed, 21 Nov 2018 17:03:48 +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 4C64A6607E; Wed, 21 Nov 2018 17:03:44 +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-3-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <03a51a83-894c-0ef0-d68a-55b024620004@redhat.com> Date: Wed, 21 Nov 2018 18:03:43 +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-3-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 21 Nov 2018 17:03:48 +0000 (UTC) Subject: Re: [PATCH v2 2/5] ArmPlatformPkg/NorFlashDxe: use one GUID plus index to identify flash banks 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:03:49 -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: > Currently, each flash bank controlled by ArmPlatformPkg/NorFlashDxe > has its own VendorHw GUID, and instances of NorFlashPlatformLib > describe each bank to the driver, along with the GUID for each. > > This works ok for bare metal platforms, but it would be useful for > virtual platforms if we could obtain this information from a > device tree, which would require us to invent GUIDs on the fly, > given that the 'cfi-flash' binding does not include a GUID. > > So instead, let's switch to a single GUID for all flash banks, > and update the driver's device path handling to include an index > to identify each bank uniquely. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > Reviewed-by: Laszlo Ersek > Reviewed-by: Leif Lindholm > --- > ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 6 +++--- > ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h | 1 + > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > index 53753a4721ac..af40a4c88412 100644 > --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c > @@ -89,6 +89,7 @@ NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = { > }, > { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED > }, > + 0, // Index > { > END_DEVICE_PATH_TYPE, > END_ENTIRE_DEVICE_PATH_SUBTYPE, > @@ -105,7 +106,6 @@ NorFlashCreateInstance ( > IN UINT32 Index, > IN UINT32 BlockSize, > IN BOOLEAN SupportFvb, > - IN CONST GUID *NorFlashGuid, > OUT NOR_FLASH_INSTANCE** NorFlashInstance > ) > { > @@ -128,7 +128,8 @@ NorFlashCreateInstance ( > Instance->Media.BlockSize = BlockSize; > Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1; > > - CopyGuid (&Instance->DevicePath.Vendor.Guid, NorFlashGuid); > + CopyGuid (&Instance->DevicePath.Vendor.Guid, &gEfiCallerIdGuid); > + Instance->DevicePath.Index = (UINT8)Index; > > Instance->ShadowBuffer = AllocateRuntimePool (BlockSize);; > if (Instance->ShadowBuffer == NULL) { > @@ -1314,7 +1315,6 @@ NorFlashInitialise ( > Index, > NorFlashDevices[Index].BlockSize, > ContainVariableStorage, > - &NorFlashDevices[Index].Guid, > &mNorFlashInstances[Index] > ); > if (EFI_ERROR(Status)) { > diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > index 910681fd4412..8886aa43d9f3 100644 > --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h > @@ -125,6 +125,7 @@ typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; > #pragma pack(1) > typedef struct { > VENDOR_DEVICE_PATH Vendor; > + UINT8 Index; > EFI_DEVICE_PATH_PROTOCOL End; > } NOR_FLASH_DEVICE_PATH; > #pragma pack() > looks good, thanks!