From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web12.8165.1666187403420328732 for ; Wed, 19 Oct 2022 06:50:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eJEcfK+m; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.168.131, mailfrom: quic_llindhol@quicinc.com) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29J9CXkf030565; Wed, 19 Oct 2022 13:50:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=yF8KIf83KWZAmXcy9nLzxJeYsqRdd1psqZlyfZ83uO0=; b=eJEcfK+m44Z/BTtdP7UcYqJe2UvwwTfg1+4ySXgMOYdhEvbUK9XcsjPoE21JUVyUMgyA xlI2TWnjDxIiKiDRkdDgpYeS3d3BfKhychB6hyWRb0gP/8/Dxkk6TfAx6v9VCH4s8KuH oDEQ9iHIr/k87r4PfcZFCEraiyp20D8BGf5co0yXnz1Ac4zLGJKfY3JCO5mYM2h7VbnP r8iM7uTlf53lp4/aGvrEH4xh1/Jv8k8AUhvzjmApCKpJK7AuT4hOy2kcV/arNkcMNqXL zb4EfiKiAwlFj9eaHxf4Xpo5Gqx5ZVUsiOiy12w9jrJdD1EwSd3Inr9blJRjOReDkqaC dg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kaed8s4y6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 13:50:02 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 29JDo2KZ025209 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 13:50:02 GMT Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 06:50:01 -0700 Date: Wed, 19 Oct 2022 14:49:58 +0100 From: "Leif Lindholm" To: Ard Biesheuvel CC: Subject: Re: [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib Message-ID: References: <20221019115136.513007-1-ardb@kernel.org> MIME-Version: 1.0 In-Reply-To: <20221019115136.513007-1-ardb@kernel.org> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: C5AQFvIv6wOKNgaR2LJltA3_tP4RQhdW X-Proofpoint-GUID: C5AQFvIv6wOKNgaR2LJltA3_tP4RQhdW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-19_08,2022-10-19_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210190077 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Wed, Oct 19, 2022 at 13:51:36 +0200, Ard Biesheuvel wrote: > 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 / Leif > --- > .../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/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf > delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/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 > > [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 > > [LibraryClasses] > BaseLib > @@ -40,7 +40,6 @@ [LibraryClasses] > IoLib > MemoryAllocationLib > NorFlashInfoLib > - NorFlashPlatformLib > UefiBootServicesTableLib > UefiDriverEntryPoint > UefiLib > diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf > 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 > > [LibraryClasses] > @@ -40,7 +41,6 @@ [LibraryClasses] > MemoryAllocationLib > MmServicesTableLib > NorFlashInfoLib > - NorFlashPlatformLib > StandaloneMmDriverEntryPoint > > [Guids] > diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf > deleted file mode 100644 > index c1ed3c4d1ca8..000000000000 > --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.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 = 0x0001001A > - BASE_NAME = NorFlashSynQuacerLib > - FILE_GUID = 8279227C-C555-4D75-B439-D8A959635CDD > - MODULE_TYPE = BASE > - VERSION_STRING = 1.0 > - LIBRARY_CLASS = 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/Silicon/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 @@ > > #include > #include > -#include > > #include "Fip006Reg.h" > > @@ -291,6 +290,19 @@ NorFlashReadID ( > OUT UINT8 JedecId[3] > ); > > +typedef struct { > + UINTN DeviceBaseAddress; // Start address of the Device Base Address (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 > > diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Silicon/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 > > +#include > + > #include "NorFlash.h" > > +#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 (PcdFlashNvStorageFtwWorkingSize) + \ > + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) > + > +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { > + { > + // 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[] = { > 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 == NULL || > + Count == NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + *Count = ARRAY_SIZE (mNorFlashDevices); > + *NorFlashDevices = 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); > > - Status = NorFlashPlatformInitialization (); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, > - "NorFlashInitialise: Fail to initialize Nor Flash devices\n")); > - return Status; > - } > - > // Initialize NOR flash instances > Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount); > 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; > > - Status = NorFlashPlatformInitialization (); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, > - "NorFlashInitialise: Fail to initialize Nor Flash devices\n")); > - return Status; > - } > - > // Initialize NOR flash instances > Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount); > if (EFI_ERROR (Status)) { > diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c > deleted file mode 100644 > index b2d1c39e2c61..000000000000 > --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.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 (PcdFlashNvStorageFtwWorkingSize) + \ > - FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) > - > -STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { > - { > - // 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 == NULL || > - Count == NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - *Count = ARRAY_SIZE (mNorFlashDevices); > - *NorFlashDevices = mNorFlashDevices; > - > - return EFI_SUCCESS; > -} > -- > 2.35.1 >