From patchwork Wed Nov 21 12:01:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151681 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1832452ljp; Wed, 21 Nov 2018 04:01:58 -0800 (PST) X-Google-Smtp-Source: AJdET5dVI5PMMVMf767YbTKvI1PEKvYFqXwjru0ZGLITOgK+0Ct4x7S0DWkpSvZ+H7FgIMpqGx0s X-Received: by 2002:a24:2ecf:: with SMTP id i198-v6mr5078893ita.74.1542801718160; Wed, 21 Nov 2018 04:01:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542801718; cv=none; d=google.com; s=arc-20160816; b=xOQxXFHHf6DJSWAnmp7IWmE65/gC17Q5SmyhlvooaNrCQFv3E6TcqVZNpbZccG6Bft fBNENwQVghcTZxhHDsN8jmnXooHscxNNv6ypZ0zlfnr3BIz3aQgatv9G8NaaICcWxzv/ GUaptyzRhbsfz1OiMFSTSaJXY09i0TVxMo6xkXzTQtMYQztds+NHCrVKntnW/DFNM1gG L7ehfp102hay9Sl9WIzAvDq/lCoRcHGhxbez6u+VOzQonAcocXci0YEIXf85UfXSZ3R+ ddBZTxvDazMmeJN8IjeNDYV1+hkpEz1By5nWLoPVbb+dvnp6DGG5anva5zFeW1ImB15R TbUA== 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=JaTuv3bqqQAbSVnCjgk9xaLSHsskwRBnURm16S9hxIQ=; b=XShjlBuav9Qae/mZjOCr5Whm0jZBd6DvFVxaQlLhOHhQnDcUknX4YspXGDlM+yHdP1 lETrv4wUR33jPKNC0LKJHkzh7lrJKr+P8wGcvp5QoVDiG0qO/vl3bErdXT/TW2FjwLHP I6cuiBlzPRk2KBbnl4fQ0ekbApk/sEAG0VUQw0qVNzatmmxMUvyTwCKmQQO3Zh+e6MJO chFQ1dQKcrLAY26wNVn6DW/b74aCCU+kTUJPtLe46UZmZWc9DT0euh1C3Vr9Nk5MfMtP KVyjb426TR/G1zttQAWJ9tHJ9bu0GPurfBg3HzPnp0f0KUXoholAR+hheB64HmjuZlQN T7TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QYHSurIy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 70-v6si32640423jay.69.2018.11.21.04.01.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 04:01:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QYHSurIy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 6AA7321193782; Wed, 21 Nov 2018 04:01:55 -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::541; helo=mail-ed1-x541.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (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 1C6AD2119377C for ; Wed, 21 Nov 2018 04:01:54 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id z28so4654210edi.8 for ; Wed, 21 Nov 2018 04:01:53 -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=XbhndgSsfYJVM4LqLqu6mFJ7pBh67V2qsOWMF1kPcG8=; b=QYHSurIy+rKhzrRiHuXEjtGY0Eq2/nDU3QLaRN3fjrKe90mWemqZLMr8eLsnxwIhIZ Lh00e/3xUEu/I7hVBZL/6kt6x+XcMN1/W4QEkk0GT/fiWsbnR/VDDKMD/CK3qjFuydhM OzLlap2XnKSXRZhqUOVcARMK0HhootasBbT4Y= 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=XbhndgSsfYJVM4LqLqu6mFJ7pBh67V2qsOWMF1kPcG8=; b=qTeR8eC0b8q6JMg8SDkRmnM5pu2BtY54bi4/qP6V4kuT/sIufa7U05R6p1gqF7YrBN 1Xr+lN/H53UTUg/9Es4Kk6x+UiEP0Wm+GXvm2K4aK/+V2IvpNRhutkCbnt9FogJFn/m7 CyTRCRLShGnxZPt3cJTpeerPvZpDfSADzgZEqqq04+0XEqGXu4kVMTWCCTb8NTKqN4LJ 6fLiWJIPZMqIB7MhN20xT/sC89ZJL+ZxIwh1jk10ONvT4S4enBd1iIQkgeqoQBJRHlX7 noBu5JMfB0X+n9q3cyqu64gVlTNMaS9Kb6og5hKRFZFr1P8mJJb+lxXif7CNZZZJ4XJ9 wFqQ== X-Gm-Message-State: AGRZ1gLTaFLbGnD010sytGIy/hJdKcCbZMOP1saNjvUm4tUra0soKMFN v6faNqsHNW8rw0N9JLWu9blnrLlkDfjICw== X-Received: by 2002:a17:906:351a:: with SMTP id r26-v6mr4804076eja.193.1542801712200; Wed, 21 Nov 2018 04:01:52 -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 c2sm13044290edv.14.2018.11.21.04.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 04:01:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 21 Nov 2018 13:01:44 +0100 Message-Id: <20181121120145.3148-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181121120145.3148-1-ard.biesheuvel@linaro.org> References: <20181121120145.3148-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 2/3] Silicon/SynQuacer: drop per-bank NOR flash GUIDs 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: nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Give the SynQuacer NOR flash driver the same treatment as we gave the one in ArmPlatformPkg: identify NOR flash banks by a single GUID identifying the driver, and use indexes to identify each device instance owned by the driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 14 +++++++------- Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h | 3 +++ Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c | 6 ------ 3 files changed, 10 insertions(+), 13 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c index 8d6bca8739d0..98f3e4d5a012 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c @@ -1093,12 +1093,13 @@ STATIC CONST 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 } }, }, + 0, // Index { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, @@ -1118,10 +1119,9 @@ NorFlashCreateInstance ( IN UINTN NorFlashDeviceBase, IN UINTN NorFlashRegionBase, IN UINTN NorFlashSize, - IN UINT32 MediaId, + IN UINT32 Index, IN UINT32 BlockSize, IN BOOLEAN HasVarStore, - IN CONST GUID *NorFlashGuid, IN CONST CSDC_DEFINITION *CommandTable, IN UINTN CommandTableSize, OUT NOR_FLASH_INSTANCE** NorFlashInstance @@ -1146,12 +1146,13 @@ 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; Instance->OffsetLba = (NorFlashRegionBase - NorFlashDeviceBase) / BlockSize; - CopyGuid (&Instance->DevicePath.Vendor.Guid, NorFlashGuid); + CopyGuid (&Instance->DevicePath.Vendor.Guid, &gEfiCallerIdGuid); + Instance->DevicePath.Index = (UINT8)Index; Instance->CmdTable = CommandTable; Instance->CmdTableSize = CommandTableSize; @@ -1360,7 +1361,6 @@ NorFlashInitialise ( Index, NorFlashDevices[Index].BlockSize, ContainVariableStorage, - &NorFlashDevices[Index].Guid, mN25qCSDCDefTable, ARRAY_SIZE (mN25qCSDCDefTable), &mNorFlashInstances[Index] diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h index 5e1e6adecf67..ef1257a64904 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.h @@ -83,10 +83,13 @@ typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; typedef EFI_STATUS (*NOR_FLASH_INITIALIZE) (NOR_FLASH_INSTANCE* Instance); +#pragma pack(1) typedef struct { VENDOR_DEVICE_PATH Vendor; + UINT8 Index; EFI_DEVICE_PATH_PROTOCOL End; } NOR_FLASH_DEVICE_PATH; +#pragma pack() struct _NOR_FLASH_INSTANCE { UINT32 Signature; diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c index d44fe3e4e94c..1b3995d799de 100644 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c +++ b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c @@ -34,9 +34,6 @@ STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { FW_CODE_REGION_BASE, // region base FW_CODE_REGION_SIZE, // region size SIZE_64KB, // block size - { - 0x19c118b0, 0xc423, 0x42be, { 0xb8, 0x0f, 0x70, 0x6f, 0x1f, 0xcb, 0x59, 0x9a } - } }, { // Environment variable region @@ -44,9 +41,6 @@ STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { FW_ENV_REGION_BASE, // region base FW_ENV_REGION_SIZE, // region size SIZE_64KB, // block size - { - 0x3105bd7a, 0x82c3, 0x486f, { 0xb1, 0x03, 0x1e, 0x09, 0x54, 0xec, 0x85, 0x75 } - } }, };