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 D2F272194D3AE for ; Thu, 22 Nov 2018 07:36:37 -0800 (PST) Received: by mail-wr1-f68.google.com with SMTP id t3so9678965wrr.3 for ; Thu, 22 Nov 2018 07:36:37 -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=hUinG5C5YeiHk4K5NLwyP7uOZiJD0rCmTV/bAZuGpMU=; b=mYKMSqyCnny6ISpZEMCrlPk3sKVVehNmdACsGJmoQdSqO6PkwmMKmyArl6b+ipCucx 2ed4gS5JsYhqHY45UiIZugWzu7JqstoLhZ3gauJb0SD+/tcSllIX4MsO0wio1epOdWA4 wsj1G+L+rg27WNXX4wRmMIrv1kq+oGd+9m/56Zh/FGxNSMmqgafLuQ8NkDwU8ef3h9td TkEh2Diei5nZnU88fv7cf+mSpsHf9n9265BO6DwnxcyrQ41smgwAxxyHsWNT4ApVinbf Kxi1voQp/wAHHFPJ3vF+z49k6D9pjZqavaG+DIblERBII6q2sVLK1jFHkDtTkjTy6R6h JcLw== X-Gm-Message-State: AA+aEWad49Jy6+Y1X/PG3aIvRTEAhdsqUqQLWmNKhhe6ShqmXI6ueMXJ gaCPd/hfzjOj32g6y7I6XHDnpA== X-Google-Smtp-Source: AFSGD/WSrqD8s2S3BVnPlP1PSX5el262SYxSkCJ7IvsTD7GEDhMCmM+TwoUfKIryONtGhhUGBfx/7g== X-Received: by 2002:adf:f449:: with SMTP id f9mr10490220wrp.40.1542900996141; Thu, 22 Nov 2018 07:36:36 -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 m65sm6706418wmb.4.2018.11.22.07.36.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 07:36:35 -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-3-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: <512d9b6d-9825-43dd-9feb-59d1cb6353f7@redhat.com> Date: Thu, 22 Nov 2018 16:36:34 +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-3-ard.biesheuvel@linaro.org> 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: Thu, 22 Nov 2018 15:36:38 -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: > 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 Reviewed-by: Philippe Mathieu-Daudé > --- > 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() >