From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AJdET5d84Sj7YasBvgwDpSgw2Kce5Px9chFCdkrWYZdxlz6aHpjirUv0dIdhxWV5ZzuG0HaA+XhaDw== 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 Cc: leif.lindholm@linaro.org, lersek@redhat.com, philmd@redhat.com, hongbo.zhang@linaro.org, nariman.poushin@linaro.org, thomas.abraham@arm.com, Ard Biesheuvel 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: [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 11:58:41 -0000 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() -- 2.17.1