From nobody Sat May 18 19:24:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95387+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95387+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666180307; cv=none; d=zohomail.com; s=zohoarc; b=TsOCy5CZjGjX5zY+QqUw21KswCE91CqHm+DJNKtXrSp/y7HSp2EHERJNMrFad9nfWCbkB0xo2qNkS2wkut2g53bnRgjZG7qVL4sDjJ3h6pUgdJ5KtwR23/nhg3tAO5jADzATeC2HszoLaqgnamjSDnvuWA7KExgEBqLyeacnSCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666180307; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=+MhMoK9kaVhZRn+f0TvA8vL9SqEUVJ4s8TWlMh/ow44=; b=esI8Ba+ocOUZXqwtgJdFUBUP9x1IuYRVaMhKfLCqbGRpeFspSk9TuXo27a1x/gft9TLHYi4Nfoc65Dd8UfgCt8haqK5ffXgYhYEWD2jG15UTPz6wBTsvGjrtlNqy5bKWPZyhE9dW+C3vfPokkeNF+bVcrPA7PiYqMH7OhRXVYaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95387+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666180307450365.42681979154145; Wed, 19 Oct 2022 04:51:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id enNKYY1788612xZlX1VftNbt; Wed, 19 Oct 2022 04:51:47 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.6984.1666180305974136011 for ; Wed, 19 Oct 2022 04:51:46 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8766DB82187; Wed, 19 Oct 2022 11:51:43 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EC9AC433C1; Wed, 19 Oct 2022 11:51:41 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib Date: Wed, 19 Oct 2022 13:51:36 +0200 Message-Id: <20221019115136.513007-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: 5h2BaGz5tHhYMrj5Q1ExuiKVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666180307; bh=qjBdqKF+tZDGm60pXFU9Wuib0B3eUZPkJYboNUlp82s=; h=Cc:Date:From:Reply-To:Subject:To; b=PYfjPADOveYl/4Y0+K5Pjrn85wED30w7epIMO16Mbj+RbJePgCqkW94eSsDSvItabKk ATQa6Hmv/4KpUoo9JRrUtTdGZ4PxX7kMrcbRIDEVw5kWejkFWUnDBTSih2buRjP2sTKNq lrdC4IE4UF9OYYucJtDqobgWF3dssMbEiqw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666180308019100001 Content-Type: text/plain; charset="utf-8" Fip006Dxe is part of the SynQuacer platform, which is its only user, and yet, it relies on NorFlashPlatformLib to carry the platform specific NOR geometry. This library is tied to ArmPlatformPkg's NorFlashDxe, which will be going away, so let's stop using it. Since the abstraction serves no purpose here, let's just merge the library with its only user. Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- .../SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf | 3 +- .../Drivers/Fip006Dxe/Fip006StandaloneMm.inf | 2 +- .../NorFlashSynQuacerLib.inf | 35 ---------- .../SynQuacer/Drivers/Fip006Dxe/NorFlash.h | 14 +++- .../SynQuacer/Drivers/Fip006Dxe/NorFlash.c | 44 +++++++++++++ .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 7 -- .../SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c | 7 -- .../NorFlashSynQuacerLib/NorFlashSynQuacer.c | 64 ------------------- 8 files changed, 59 insertions(+), 117 deletions(-) delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLi= b/NorFlashSynQuacerLib.inf delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLi= b/NorFlashSynQuacer.c diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf index f91fdcfbc46d..6c7ce663d8b0 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf @@ -24,11 +24,11 @@ [Sources] NorFlashFvb.c =20 [Packages] - ArmPlatformPkg/ArmPlatformPkg.dec EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec + Silicon/Socionext/SynQuacer/SynQuacer.dec =20 [LibraryClasses] BaseLib @@ -40,7 +40,6 @@ [LibraryClasses] IoLib MemoryAllocationLib NorFlashInfoLib - NorFlashPlatformLib UefiBootServicesTableLib UefiDriverEntryPoint UefiLib diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Standalone= Mm.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.i= nf index 8f4184dcbd8b..014ad791defc 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf @@ -30,6 +30,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec + Silicon/Socionext/SynQuacer/SynQuacer.dec StandaloneMmPkg/StandaloneMmPkg.dec =20 [LibraryClasses] @@ -40,7 +41,6 @@ [LibraryClasses] MemoryAllocationLib MmServicesTableLib NorFlashInfoLib - NorFlashPlatformLib StandaloneMmDriverEntryPoint =20 [Guids] diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFl= ashSynQuacerLib.inf b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacer= Lib/NorFlashSynQuacerLib.inf deleted file mode 100644 index c1ed3c4d1ca8..000000000000 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQ= uacerLib.inf +++ /dev/null @@ -1,35 +0,0 @@ -#/** @file -# -# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -#**/ - -[Defines] - INF_VERSION =3D 0x0001001A - BASE_NAME =3D NorFlashSynQuacerLib - FILE_GUID =3D 8279227C-C555-4D75-B439-D8A959635CDD - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D NorFlashPlatformLib - -[Sources] - NorFlashSynQuacer.c - -[Packages] - ArmPlatformPkg/ArmPlatformPkg.dec - ArmPkg/ArmPkg.dec - MdeModulePkg/MdeModulePkg.dec - MdePkg/MdePkg.dec - Silicon/Socionext/SynQuacer/SynQuacer.dec - -[LibraryClasses] - BaseLib - -[FixedPcd] - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h b/Sil= icon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h index 3cb86ab588e0..a287b9e396fb 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h @@ -22,7 +22,6 @@ =20 #include #include -#include =20 #include "Fip006Reg.h" =20 @@ -291,6 +290,19 @@ NorFlashReadID ( OUT UINT8 JedecId[3] ); =20 +typedef struct { + UINTN DeviceBaseAddress; // Start address of the Device Base Ad= dress (DBA) + UINTN RegionBaseAddress; // Start address of one single region + UINTN Size; + UINTN BlockSize; +} NOR_FLASH_DESCRIPTION; + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ); + #define SPINOR_SR_WIP BIT0 // Write in progress #define SPINOR_FSR_READY BIT7 // Flag Status Register: ready =20 diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Sil= icon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c index b2ca0033ac13..978b2e1e4c63 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c @@ -15,8 +15,35 @@ #include #include =20 +#include + #include "NorFlash.h" =20 +#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE +#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE) + +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase) +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize)= + \ + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSiz= e) + \ + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) + +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D { + { + // UEFI code region + SYNQUACER_SPI_NOR_BASE, // device base + FW_CODE_REGION_BASE, // region base + FW_CODE_REGION_SIZE, // region size + SIZE_64KB, // block size + }, + { + // Environment variable region + SYNQUACER_SPI_NOR_BASE, // device base + FW_ENV_REGION_BASE, // region base + FW_ENV_REGION_SIZE, // region size + SIZE_64KB, // block size + }, +}; + STATIC CONST UINT16 mFip006NullCmdSeq[] =3D { CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE), CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE), @@ -995,3 +1022,20 @@ NorFlashReadID ( NorFlashSetHostCommand (Instance, SPINOR_OP_READ_4B); return EFI_SUCCESS; } + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if (NorFlashDevices =3D=3D NULL || + Count =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *Count =3D ARRAY_SIZE (mNorFlashDevices); + *NorFlashDevices =3D mNorFlashDevices; + + return EFI_SUCCESS; +} diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c index d87b62956ded..aa380cd9aec3 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c @@ -229,13 +229,6 @@ NorFlashInitialise ( EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); ASSERT_EFI_ERROR (Status); =20 - Status =3D NorFlashPlatformInitialization (); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, - "NorFlashInitialise: Fail to initialize Nor Flash devices\n")); - return Status; - } - // Initialize NOR flash instances Status =3D NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDevic= eCount); if (EFI_ERROR (Status)) { diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c index 7daec948a995..718b19b33117 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c @@ -106,13 +106,6 @@ NorFlashInitialise ( NOR_FLASH_DESCRIPTION* NorFlashDevices; BOOLEAN ContainVariableStorage; =20 - Status =3D NorFlashPlatformInitialization (); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, - "NorFlashInitialise: Fail to initialize Nor Flash devices\n")); - return Status; - } - // Initialize NOR flash instances Status =3D NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDevic= eCount); if (EFI_ERROR (Status)) { diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFl= ashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/N= orFlashSynQuacer.c deleted file mode 100644 index b2d1c39e2c61..000000000000 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQ= uacer.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file - - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - - **/ - -#include -#include -#include -#include - -#include - -#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE -#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE) - -#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase) -#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize)= + \ - FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSiz= e) + \ - FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) - -STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D { - { - // UEFI code region - SYNQUACER_SPI_NOR_BASE, // device base - FW_CODE_REGION_BASE, // region base - FW_CODE_REGION_SIZE, // region size - SIZE_64KB, // block size - }, - { - // Environment variable region - SYNQUACER_SPI_NOR_BASE, // device base - FW_ENV_REGION_BASE, // region base - FW_ENV_REGION_SIZE, // region size - SIZE_64KB, // block size - }, -}; - -EFI_STATUS -NorFlashPlatformInitialization ( - VOID - ) -{ - return EFI_SUCCESS; -} - -EFI_STATUS -NorFlashPlatformGetDevices ( - OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, - OUT UINT32 *Count - ) -{ - if (NorFlashDevices =3D=3D NULL || - Count =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - *Count =3D ARRAY_SIZE (mNorFlashDevices); - *NorFlashDevices =3D mNorFlashDevices; - - return EFI_SUCCESS; -} --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95387): https://edk2.groups.io/g/devel/message/95387 Mute This Topic: https://groups.io/mt/94428762/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-