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::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-Google-Smtp-Source: AJdET5fHm9k59T9ueQW2rXOG3MMfO/msw77Wfl3YVz2oMQP/qDW/oAmeEN2Ub4aQjj/bYrdwAaHwoA== 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 Cc: leif.lindholm@linaro.org, thomas.abraham@arm.com, nariman.poushin@linaro.org, masahisa.kojima@linaro.org, Ard Biesheuvel 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: [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: , X-List-Received-Date: Wed, 21 Nov 2018 12:01:54 -0000 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(-) 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 } - } }, }; -- 2.17.1