From patchwork Wed Nov 21 11:58:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151671 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1828941ljp; Wed, 21 Nov 2018 03:58:46 -0800 (PST) X-Google-Smtp-Source: AJdET5crirwzdCxYgoJZUzuWhujXJ6VrD6jVRIkel/n8ZkVtTYm50lGxHhBlkc4RWEE7JYW1SkhY X-Received: by 2002:a62:d504:: with SMTP id d4mr6493474pfg.38.1542801526565; Wed, 21 Nov 2018 03:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542801526; cv=none; d=google.com; s=arc-20160816; b=u+eeRbueQVShcy85ZJXEysxdv48wD8KEEbNVt/wDVeU6g+fNjsVboVlN37GjUS9mxo QTcySP90z16yI2ANNynHdBJTCoA0jBHDo4IZz1ZUP/lGRy2QLB5OrczML+FVEp940BQ/ 5zbtGVXzlPmyoccRfGMHqUygpCw+1AWznEip9MqL6KfOwh/B3HceM0k9NwytZgOGYLbk 3VaKHiTeganLYQ1PtCw2C1LJEJVhgMTeSIWT0eM1V3yr3Gjg4WIa4CuA3s5JN14UJFNi THV0Q6v7oxh8J5hhjD8gTQeawhGpIGqQAyI7xMXfgrf8ecCMW/JFbe5CQVmDok6NP1a+ Pv1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=nFgrfJuuTEBNJlVbmvRCk18GMsLHqOEDt7+hPN+ZrFI=; b=k6GZYe/KU/xC4jbcFve513lhLtT+eTanHNMFH0L1uaaWBpNSHr9XO0Amq30lameLea BrxG/CTuF0IumEYEJ5Es9QmbfneHzRkx/3gsRhELoJED5PjIDqmqJAE/DBC5a5QT2kU7 ubb2FTTG+BW1raqDwQ6uvDYA4+V++k2JwziqQrMIvCCKPJxbLHgK5m9m3Zg30X6hh+Mz kobR/soPsLobgbHFauONUVvpH0gOoVszY3MCTGm9bcVoOFeZWiR/sTtMPiY/Y8lQlLWh RKEaQfj5/sBkiejKWVot5kR0pZtpFSQxc7098H7EVIkvpspp9Tbd5ohxIYXEyFvng+Hl Y6TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H66Pd+dA; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c190-v6si16326123pfa.0.2018.11.21.03.58.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 03:58:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H66Pd+dA; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F26C121193781; Wed, 21 Nov 2018 03:58:43 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::543; helo=mail-ed1-x543.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (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 630962119377D for ; Wed, 21 Nov 2018 03:58:41 -0800 (PST) Received: by mail-ed1-x543.google.com with SMTP id h50so4660829ede.5 for ; Wed, 21 Nov 2018 03:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vWFOMqBVKz/PfsGLyHlpAU1qnj+bpsHP14OqCs/pMAw=; b=H66Pd+dAr9ZXoZJvsk5sXwzD+SN16OADRdcIDfNuaXibEGtpzpvcEobZvJT6n72Bjz Vw6P24Ck/Svx3dXyaeDLUIZ+3x2Ob0He1KUV5C/g+epmc3WvQUwu92FRyPlHPfPMKwGy 4rsD3ZiSCAHyIyatLWDB/ADulsFN9+6rRuIDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vWFOMqBVKz/PfsGLyHlpAU1qnj+bpsHP14OqCs/pMAw=; b=qKqHja/IommF7NYsSrRBaYk7DCy7QYzRiNneKkns3shqPCiaRO8lpu1HAaVeRjglA0 KbDaGFO7qBI/Rw+ZvEBdBWTPi4wS1vqLjfiUIhkgCHtZYwLiqVxf/VEcoDbB02wBjAau cAnIocfdbt3tRRsQS0AwmZaW4NXYW9rDn1c/UIyOB9QizMuqNu7IpC3W0DiRxOXTzGBC 7q/JCQcYWwohg9xVIlQh+AJfZeMDgupWmjKTGfHWVdYGx5GjRSXyZXq0BgUqRhPvOvyi JNXXO5Agy+zgM/lXe8J/TU9YuQHX78DHKywVzjDk+rN0BH7o9pUQz1kNXXX621oyNXP9 roMw== X-Gm-Message-State: AGRZ1gJT4s8hiFsQMvGb36s3WxJs96/vr3niH+hlEvRwpIMHDSDdOEo3 zzz+/HkGVXN4IYL+7bwhdi/i7djeOEe6nQ== X-Received: by 2002:a17:906:198b:: with SMTP id g11-v6mr4915984ejd.166.1542801519519; Wed, 21 Nov 2018 03:58:39 -0800 (PST) Received: from mba13.wifi.ns.nl (dhcp-077-251-017-237.chello.nl. [77.251.17.237]) by smtp.gmail.com with ESMTPSA id x90sm4090716ede.35.2018.11.21.03.58.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 03:58:38 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 21 Nov 2018 12:58:25 +0100 Message-Id: <20181121115828.3026-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181121115828.3026-1-ard.biesheuvel@linaro.org> References: <20181121115828.3026-1-ard.biesheuvel@linaro.org> Subject: [edk2] [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: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Philippe Mathieu-Daudé 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()