From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.939.1635459065520564619 for ; Thu, 28 Oct 2021 15:11:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=bQfQFz0f; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (c-73-27-179-174.hsd1.fl.comcast.net [73.27.179.174]) by linux.microsoft.com (Postfix) with ESMTPSA id BA5B4209F33F; Thu, 28 Oct 2021 15:11:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BA5B4209F33F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1635459065; bh=T5zbffCzE1PqwKmcaBR6Yn/7hVapVa2ORi1LKgLnWtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQfQFz0fr3tvPrzlstuRrxzDCCBU0E1chVnoI8pJ8UtyfK3vdoqls6RxaL6QU60aI 0XzjITC69TO3SaisxLaQ3pAEVaooTv8DBm1c7mVp9QszXBs8nWXAFUAX42Nlppo3Rd umWpaXfVUBMut9lfdVT1ifGYp9w+mLA+CDltC1OQ= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Rangasai V Chaganty , Nate DeSimone , Heng Luo Subject: [PATCH v6 50/52] TigerlakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by GUID Date: Thu, 28 Oct 2021 18:08:44 -0400 Message-Id: <20211028220846.753-15-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211028220846.753-1-mikuback@linux.microsoft.com> References: <20211028220846.753-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307 Updates the library to identify flash regions by GUID and internally map the GUID entries to values specific to TigerlakeSiliconPkg. Cc: Rangasai V Chaganty Cc: Nate DeSimone Cc: Heng Luo Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiComm= onLib/SpiCommon.c | 224 +++++++++++++++----- Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/Spi= CommonLib.h | 60 +++--- Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiComm= onLib/BaseSpiCommonLib.inf | 18 +- 3 files changed, 223 insertions(+), 79 deletions(-) diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate= /BaseSpiCommonLib/SpiCommon.c b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock= /Spi/LibraryPrivate/BaseSpiCommonLib/SpiCommon.c index 954b349e7c8a..490af6beb8ac 100644 --- a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSp= iCommonLib/SpiCommon.c +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSp= iCommonLib/SpiCommon.c @@ -2,9 +2,12 @@ PCH SPI Common Driver implements the SPI Host Controller Compatibility= Interface. =20 Copyright (c) 2021, Intel Corporation. All rights reserved.
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include +#include #include #include #include @@ -12,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -21,6 +24,125 @@ #include #include =20 +typedef enum { + FlashRegionDescriptor, + FlashRegionBios, + FlashRegionMe, + FlashRegionGbe, + FlashRegionPlatformData, + FlashRegionDer, + FlashRegionSecondaryBios, + FlashRegionMicrocodePatch, + FlashRegionEc, + FlashRegionDeviceExpansion, + FlashRegionIe, + FlashRegion10GbeA, + FlashRegion10GbeB, + FlashRegionAll =3D 16, + FlashRegionMax +} FLASH_REGION_TYPE; + +typedef struct { + EFI_GUID *Guid; + FLASH_REGION_TYPE Type; +} FLASH_REGION_MAPPING; + +FLASH_REGION_MAPPING mFlashRegionTypes[] =3D { + { + &gFlashRegionDescriptorGuid, + FlashRegionDescriptor + }, + { + &gFlashRegionBiosGuid, + FlashRegionBios + }, + { + &gFlashRegionMeGuid, + FlashRegionMe + }, + { + &gFlashRegionGbeGuid, + FlashRegionGbe + }, + { + &gFlashRegionPlatformDataGuid, + FlashRegionPlatformData + }, + { + &gFlashRegionDerGuid, + FlashRegionDer + }, + { + &gFlashRegionSecondaryBiosGuid, + FlashRegionSecondaryBios + }, + { + &gFlashRegionMicrocodePatchGuid, + FlashRegionMicrocodePatch + }, + { + &gFlashRegionEcGuid, + FlashRegionEc + }, + { + &gFlashRegionDeviceExpansionGuid, + FlashRegionDeviceExpansion + }, + { + &gFlashRegionIeGuid, + FlashRegionIe + }, + { + &gFlashRegion10GbeAGuid, + FlashRegion10GbeA + }, + { + &gFlashRegion10GbeBGuid, + FlashRegion10GbeB + }, + { + &gFlashRegionAllGuid, + FlashRegionAll + }, + { + &gFlashRegionMaxGuid, + FlashRegionMax + } +}; + +/** + Returns the type of a flash region given its GUID. + + @param[in] FlashRegionGuid Pointer to the flash region GUID. + @param[out] FlashRegionType Pointer to a buffer that will be set t= o the flash region type value. + + @retval EFI_SUCCESS The flash region type was found = for the given flash region GUID. + @retval EFI_INVALID_PARAMETER A pointer argument passed to the= function is NULL. + @retval EFI_NOT_FOUND The flash region type was not fo= und for the given flash region GUID. + +**/ +EFI_STATUS +GetFlashRegionType ( + IN EFI_GUID *FlashRegionGuid, + OUT FLASH_REGION_TYPE *FlashRegionType + ) +{ + UINTN Index; + + if (FlashRegionGuid =3D=3D NULL || FlashRegionType =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + for (Index =3D 0; Index < ARRAY_SIZE (mFlashRegionTypes); Index++) { + if (CompareGuid (mFlashRegionTypes[Index].Guid, FlashRegionGuid)) { + *FlashRegionType =3D mFlashRegionTypes[Index].Type; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Initialize an SPI protocol instance. =20 @@ -179,7 +301,7 @@ SpiProtocolConstructor ( ASSERT (SpiInstance->CpuStrapBaseAddr !=3D 0); =20 if (SpiInstance->CpuStrapBaseAddr !=3D 0x300) { - Status =3D SpiProtocolFlashRead (&(SpiInstance->SpiProtocol), FlashR= egionAll, R_FLASH_UMAP1, sizeof (Data32), (UINT8 *) (&Data32)); + Status =3D SpiProtocolFlashRead (&(SpiInstance->SpiProtocol), &gFlas= hRegionAllGuid, R_FLASH_UMAP1, sizeof (Data32), (UINT8 *) (&Data32)); ASSERT_EFI_ERROR (Status); Mdtba =3D (UINT16)(((Data32 & B_FLASH_UMAP1_MDTBA) >> N_FLASH_UMAP1_= MDTBA) << N_FLASH_UMAP1_MDTBA_REPR); DEBUG ((DEBUG_INFO, "Mdtba : %0x\n", Mdtba)); @@ -274,7 +396,7 @@ PchPmTimerStallRuntimeSafe ( STATIC BOOLEAN WaitForSpiCycleComplete ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINTN PchSpiBar0, IN BOOLEAN ErrorCheck ) @@ -311,8 +433,8 @@ WaitForSpiCycleComplete ( /** This function sends the programmed SPI command to the slave device. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] SpiRegionType The SPI Region type for flash cycle wh= ich is listed in the Descriptor + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] FlashCycleType The Flash SPI cycle type list in HSFC = (Hardware Sequencing Flash Control Register) register @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. @@ -326,8 +448,8 @@ WaitForSpiCycleComplete ( STATIC EFI_STATUS SendSpiCmd ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN FLASH_CYCLE_TYPE FlashCycleType, IN UINT32 Address, IN UINT32 ByteCount, @@ -413,7 +535,7 @@ SendSpiCmd ( } } =20 - Status =3D SpiProtocolGetRegionAddress (This, FlashRegionType, &Hardwa= reSpiAddr, &FlashRegionSize); + Status =3D SpiProtocolGetRegionAddress (This, FlashRegionGuid, &Hardwa= reSpiAddr, &FlashRegionSize); if (EFI_ERROR (Status)) { goto SendSpiCmdEnd; } @@ -625,8 +747,8 @@ SendSpiCmd ( /** Read data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. @param[out] Buffer The Pointer to caller-allocated buffer= containing the dada received. @@ -639,8 +761,8 @@ SendSpiCmd ( EFI_STATUS EFIAPI SpiProtocolFlashRead ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, OUT UINT8 *Buffer @@ -653,7 +775,7 @@ SpiProtocolFlashRead ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleRead, Address, ByteCount, @@ -665,8 +787,8 @@ SpiProtocolFlashRead ( /** Write data to the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. @param[in] Buffer Pointer to caller-allocated buffer con= taining the data sent during the SPI cycle. @@ -678,8 +800,8 @@ SpiProtocolFlashRead ( EFI_STATUS EFIAPI SpiProtocolFlashWrite ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, IN UINT8 *Buffer @@ -692,7 +814,7 @@ SpiProtocolFlashWrite ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleWrite, Address, ByteCount, @@ -704,8 +826,8 @@ SpiProtocolFlashWrite ( /** Erase some area on the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. =20 @@ -716,8 +838,8 @@ SpiProtocolFlashWrite ( EFI_STATUS EFIAPI SpiProtocolFlashErase ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount ) @@ -729,7 +851,7 @@ SpiProtocolFlashErase ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleErase, Address, ByteCount, @@ -741,7 +863,7 @@ SpiProtocolFlashErase ( /** Read SFDP data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ComponentNumber The Componen Number for chip select @param[in] Address The starting byte address for SFDP dat= a read. @param[in] ByteCount Number of bytes in SFDP data portion o= f the SPI cycle @@ -756,7 +878,7 @@ SpiProtocolFlashErase ( EFI_STATUS EFIAPI SpiProtocolFlashReadSfdp ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 Address, IN UINT32 ByteCount, @@ -790,7 +912,7 @@ SpiProtocolFlashReadSfdp ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadSfdp, FlashAddress, ByteCount, @@ -802,7 +924,7 @@ SpiProtocolFlashReadSfdp ( /** Read Jedec Id from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ComponentNumber The Componen Number for chip select @param[in] ByteCount Number of bytes in JedecId data portio= n of the SPI cycle, the data size is 3 typically @param[out] JedecId The Pointer to caller-allocated buffer= containing JEDEC ID received @@ -816,7 +938,7 @@ SpiProtocolFlashReadSfdp ( EFI_STATUS EFIAPI SpiProtocolFlashReadJedecId ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *JedecId @@ -849,7 +971,7 @@ SpiProtocolFlashReadJedecId ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadJedecId, Address, ByteCount, @@ -861,7 +983,7 @@ SpiProtocolFlashReadJedecId ( /** Write the status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ByteCount Number of bytes in Status data portion= of the SPI cycle, the data size is 1 typically @param[in] StatusValue The Pointer to caller-allocated buffer= containing the value of Status register writing =20 @@ -873,7 +995,7 @@ SpiProtocolFlashReadJedecId ( EFI_STATUS EFIAPI SpiProtocolFlashWriteStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, IN UINT8 *StatusValue ) @@ -890,7 +1012,7 @@ SpiProtocolFlashWriteStatus ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleWriteStatus, 0, ByteCount, @@ -902,7 +1024,7 @@ SpiProtocolFlashWriteStatus ( /** Read status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ByteCount Number of bytes in Status data portion= of the SPI cycle, the data size is 1 typically @param[out] StatusValue The Pointer to caller-allocated buffer= containing the value of Status register received. =20 @@ -914,7 +1036,7 @@ SpiProtocolFlashWriteStatus ( EFI_STATUS EFIAPI SpiProtocolFlashReadStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, OUT UINT8 *StatusValue ) @@ -931,7 +1053,7 @@ SpiProtocolFlashReadStatus ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadStatus, 0, ByteCount, @@ -943,8 +1065,8 @@ SpiProtocolFlashReadStatus ( /** Get the SPI region base and size, based on the enum type =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for for the base= address which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for the base add= ress which corresponds to the type in the descriptor. @param[out] BaseAddress The Flash Linear Address for the Regio= n 'n' Base @param[out] RegionSize The size for the Region 'n' =20 @@ -955,18 +1077,24 @@ SpiProtocolFlashReadStatus ( EFI_STATUS EFIAPI SpiProtocolGetRegionAddress ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, OUT UINT32 *BaseAddress, OUT UINT32 *RegionSize ) { - SPI_INSTANCE *SpiInstance; - UINTN PchSpiBar0; - UINT32 ReadValue; + EFI_STATUS Status; + FLASH_REGION_TYPE FlashRegionType; + SPI_INSTANCE *SpiInstance; + UINTN PchSpiBar0; + UINT32 ReadValue; =20 SpiInstance =3D SPI_INSTANCE_FROM_SPIPROTOCOL (This); =20 + Status =3D GetFlashRegionType (FlashRegionGuid, &FlashRegionType); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } if (FlashRegionType >=3D FlashRegionMax) { return EFI_INVALID_PARAMETER; } @@ -1001,7 +1129,7 @@ SpiProtocolGetRegionAddress ( /** Read PCH Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] SoftStrapAddr PCH Soft Strap address offset from FPS= BA. @param[in] ByteCount Number of bytes in SoftStrap data port= ion of the SPI cycle @param[out] SoftStrapValue The Pointer to caller-allocated buffer= containing PCH Soft Strap Value. @@ -1015,7 +1143,7 @@ SpiProtocolGetRegionAddress ( EFI_STATUS EFIAPI SpiProtocolReadPchSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -1047,7 +1175,7 @@ SpiProtocolReadPchSoftStrap ( // Status =3D SendSpiCmd ( This, - FlashRegionDescriptor, + &gFlashRegionDescriptorGuid, FlashCycleRead, StrapFlashAddr, ByteCount, @@ -1059,7 +1187,7 @@ SpiProtocolReadPchSoftStrap ( /** Read CPU Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] SoftStrapAddr CPU Soft Strap address offset from FCP= USBA. @param[in] ByteCount Number of bytes in SoftStrap data port= ion of the SPI cycle. @param[out] SoftStrapValue The Pointer to caller-allocated buffer= containing CPU Soft Strap Value. @@ -1073,7 +1201,7 @@ SpiProtocolReadPchSoftStrap ( EFI_STATUS EFIAPI SpiProtocolReadCpuSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -1105,7 +1233,7 @@ SpiProtocolReadCpuSoftStrap ( // Status =3D SendSpiCmd ( This, - FlashRegionDescriptor, + &gFlashRegionDescriptorGuid, FlashCycleRead, StrapFlashAddr, ByteCount, diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/IncludePrivate= /Library/SpiCommonLib.h b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/I= ncludePrivate/Library/SpiCommonLib.h index 3290f7712280..41b2018367bb 100644 --- a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Librar= y/SpiCommonLib.h +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Librar= y/SpiCommonLib.h @@ -7,7 +7,7 @@ #ifndef _SPI_COMMON_LIB_H_ #define _SPI_COMMON_LIB_H_ =20 -#include +#include =20 // // Maximum time allowed while waiting the SPI cycle to complete @@ -48,7 +48,7 @@ typedef enum { typedef struct { UINT32 Signature; EFI_HANDLE Handle; - PCH_SPI_PROTOCOL SpiProtocol; + PCH_SPI2_PROTOCOL SpiProtocol; UINT16 PchAcpiBase; UINT64 PchSpiBase; UINT8 ReadPermission; @@ -145,8 +145,8 @@ IsSpiFlashWriteGranted ( /** Read data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. @param[out] Buffer The Pointer to caller-allocated buffer= containing the dada received. @@ -159,8 +159,8 @@ IsSpiFlashWriteGranted ( EFI_STATUS EFIAPI SpiProtocolFlashRead ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, OUT UINT8 *Buffer @@ -169,8 +169,8 @@ SpiProtocolFlashRead ( /** Write data to the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. @param[in] Buffer Pointer to caller-allocated buffer con= taining the data sent during the SPI cycle. @@ -182,8 +182,8 @@ SpiProtocolFlashRead ( EFI_STATUS EFIAPI SpiProtocolFlashWrite ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, IN UINT8 *Buffer @@ -192,8 +192,8 @@ SpiProtocolFlashWrite ( /** Erase some area on the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for flash cycle = which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall wit= hin a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of= the SPI cycle. =20 @@ -204,8 +204,8 @@ SpiProtocolFlashWrite ( EFI_STATUS EFIAPI SpiProtocolFlashErase ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount ); @@ -213,7 +213,7 @@ SpiProtocolFlashErase ( /** Read SFDP data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ComponentNumber The Componen Number for chip select @param[in] Address The starting byte address for SFDP dat= a read. @param[in] ByteCount Number of bytes in SFDP data portion o= f the SPI cycle @@ -227,7 +227,7 @@ SpiProtocolFlashErase ( EFI_STATUS EFIAPI SpiProtocolFlashReadSfdp ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 Address, IN UINT32 ByteCount, @@ -237,7 +237,7 @@ SpiProtocolFlashReadSfdp ( /** Read Jedec Id from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ComponentNumber The Componen Number for chip select @param[in] ByteCount Number of bytes in JedecId data portio= n of the SPI cycle, the data size is 3 typically @param[out] JedecId The Pointer to caller-allocated buffer= containing JEDEC ID received @@ -250,7 +250,7 @@ SpiProtocolFlashReadSfdp ( EFI_STATUS EFIAPI SpiProtocolFlashReadJedecId ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *JedecId @@ -259,7 +259,7 @@ SpiProtocolFlashReadJedecId ( /** Write the status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ByteCount Number of bytes in Status data portion= of the SPI cycle, the data size is 1 typically @param[in] StatusValue The Pointer to caller-allocated buffer= containing the value of Status register writing =20 @@ -270,7 +270,7 @@ SpiProtocolFlashReadJedecId ( EFI_STATUS EFIAPI SpiProtocolFlashWriteStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, IN UINT8 *StatusValue ); @@ -278,7 +278,7 @@ SpiProtocolFlashWriteStatus ( /** Read status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] ByteCount Number of bytes in Status data portion= of the SPI cycle, the data size is 1 typically @param[out] StatusValue The Pointer to caller-allocated buffer= containing the value of Status register received. =20 @@ -289,7 +289,7 @@ SpiProtocolFlashWriteStatus ( EFI_STATUS EFIAPI SpiProtocolFlashReadStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, OUT UINT8 *StatusValue ); @@ -297,8 +297,8 @@ SpiProtocolFlashReadStatus ( /** Get the SPI region base and size, based on the enum type =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. - @param[in] FlashRegionType The Flash Region type for for the base= address which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. + @param[in] FlashRegionGuid The Flash Region GUID for the base add= ress which corresponds to the type in the descriptor. @param[out] BaseAddress The Flash Linear Address for the Regio= n 'n' Base @param[out] RegionSize The size for the Region 'n' =20 @@ -309,8 +309,8 @@ SpiProtocolFlashReadStatus ( EFI_STATUS EFIAPI SpiProtocolGetRegionAddress ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, OUT UINT32 *BaseAddress, OUT UINT32 *RegionSize ); @@ -318,7 +318,7 @@ SpiProtocolGetRegionAddress ( /** Read PCH Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] SoftStrapAddr PCH Soft Strap address offset from FPS= BA. @param[in] ByteCount Number of bytes in SoftStrap data port= ion of the SPI cycle @param[out] SoftStrapValue The Pointer to caller-allocated buffer= containing PCH Soft Strap Value. @@ -332,7 +332,7 @@ SpiProtocolGetRegionAddress ( EFI_STATUS EFIAPI SpiProtocolReadPchSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -341,7 +341,7 @@ SpiProtocolReadPchSoftStrap ( /** Read CPU Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL insta= nce. @param[in] SoftStrapAddr CPU Soft Strap address offset from FCP= USBA. @param[in] ByteCount Number of bytes in SoftStrap data port= ion of the SPI cycle. @param[out] SoftStrapValue The Pointer to caller-allocated buffer= containing CPU Soft Strap Value. @@ -355,7 +355,7 @@ SpiProtocolReadPchSoftStrap ( EFI_STATUS EFIAPI SpiProtocolReadCpuSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate= /BaseSpiCommonLib/BaseSpiCommonLib.inf b/Silicon/Intel/TigerlakeSiliconPk= g/IpBlock/Spi/LibraryPrivate/BaseSpiCommonLib/BaseSpiCommonLib.inf index 2686dff41e25..4981276e13e8 100644 --- a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSp= iCommonLib/BaseSpiCommonLib.inf +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSp= iCommonLib/BaseSpiCommonLib.inf @@ -2,6 +2,7 @@ # Component description file for the PchSpiCommonLib # # Copyright (c) 2021, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -29,4 +30,19 @@ [LibraryClasses] PchPciBdfLib SpiAccessLib =20 -[Pcd] +[Guids] + gFlashRegionDescriptorGuid + gFlashRegionBiosGuid + gFlashRegionMeGuid + gFlashRegionGbeGuid + gFlashRegionPlatformDataGuid + gFlashRegionDerGuid + gFlashRegionSecondaryBiosGuid + gFlashRegionMicrocodePatchGuid + gFlashRegionEcGuid + gFlashRegionDeviceExpansionGuid + gFlashRegionIeGuid + gFlashRegion10GbeAGuid + gFlashRegion10GbeBGuid + gFlashRegionAllGuid + gFlashRegionMaxGuid --=20 2.28.0.windows.1