public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"mikuback@linux.microsoft.com" <mikuback@linux.microsoft.com>
Cc: "Chaganty, Rangasai V" <rangasai.v.chaganty@intel.com>,
	"Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v4 39/41] KabylakeSiliconPkg: Identify flash regions by GUID
Date: Mon, 28 Jun 2021 01:38:40 +0000	[thread overview]
Message-ID: <BN9PR11MB548395C7DDA7AB831996C817E6039@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210625212120.235-40-mikuback@linux.microsoft.com>

Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Saturday, June 26, 2021 5:21 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>
> Subject: [edk2-devel] [edk2-platforms][PATCH v4 39/41] KabylakeSiliconPkg:
> Identify flash regions by GUID
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3307
> 
> Updates the code to identify flash regions by GUID and internally map the GUID
> entries to values specific to KabylakeSiliconPkg.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
>  Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c
> | 106 ++++++++++++++-
> 
> Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/SpiC
> ommon.c             | 140 ++++++++++++++++----
>  Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf
> |   9 ++
> 
> Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLib.
> h                   |  20 +--
> 
> Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/Bas
> ePchSpiCommonLib.inf |  11 ++
>  5 files changed, 247 insertions(+), 39 deletions(-)
> 
> diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c
> b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c
> index a3c9bbebeaa9..ccf63b216f70 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfigura
> +++ tion.c
> @@ -2,11 +2,14 @@
>    This file contains the tests for the SecureMemoryMapConfiguration bit
> 
>  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) Microsoft Corporation.<BR>
> +
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "HstiSiliconDxe.h"
> +#include <Guid/FlashRegion.h>
> 
>  typedef struct {
>    UINT64   Base;
> @@ -100,6 +103,90 @@ MEMORY_RANGE
> mNonLockableMemoryRange[NonLockableMemoryRangeMax] = {  // 14.
> SPI_BAR0 (BDF 0:31:5 + 0x10)  };
> 
> +typedef enum {
> +  FlashRegionDescriptor,
> +  FlashRegionBios,
> +  FlashRegionMe,
> +  FlashRegionGbe,
> +  FlashRegionPlatformData,
> +  FlashRegionDer,
> +  FlashRegionAll,
> +  FlashRegionMax
> +} FLASH_REGION_TYPE;
> +
> +typedef struct {
> +  EFI_GUID            *Guid;
> +  FLASH_REGION_TYPE   Type;
> +} FLASH_REGION_MAPPING;
> +
> +FLASH_REGION_MAPPING mFlashRegionTypes[] = {
> +  {
> +    &gFlashRegionDescriptorGuid,
> +    FlashRegionDescriptor
> +  },
> +  {
> +    &gFlashRegionBiosGuid,
> +    FlashRegionBios
> +  },
> +  {
> +    &gFlashRegionMeGuid,
> +    FlashRegionMe
> +  },
> +  {
> +    &gFlashRegionGbeGuid,
> +    FlashRegionGbe
> +  },
> +  {
> +    &gFlashRegionPlatformDataGuid,
> +    FlashRegionPlatformData
> +  },
> +  {
> +    &gFlashRegionDerGuid,
> +    FlashRegionDer
> +  },
> +  {
> +    &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 to 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 found for
> the given flash region GUID.
> +
> +**/
> +EFI_STATUS
> +GetFlashRegionType (
> +  IN     EFI_GUID           *FlashRegionGuid,
> +  OUT    FLASH_REGION_TYPE  *FlashRegionType
> +  )
> +{
> +  UINTN   Index;
> +
> +  if (FlashRegionGuid == NULL || FlashRegionType == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  for (Index = 0; Index < ARRAY_SIZE (mFlashRegionTypes); Index++) {
> +    if (CompareGuid (mFlashRegionTypes[Index].Guid, FlashRegionGuid)) {
> +      *FlashRegionType = mFlashRegionTypes[Index].Type;
> +      return EFI_SUCCESS;
> +    }
> +  }
> +
> +  return EFI_NOT_FOUND;
> +}
> +
>  /**
>    Check for overlaps in single range array
> 
> @@ -224,7 +311,7 @@ AcquireSpiBar0 (
>  {
>    UINT32                          SpiBar0;
>    UINTN                           PchSpiBase;
> -
> +
>    //
>    // Init PCH spi reserved MMIO address.
>    //
> @@ -270,7 +357,7 @@ ReleaseSpiBar0 (
>    Get the SPI region base and size, based on the enum type
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for for the base
> address which is listed in the Descriptor.
> +  @param[in] FlashRegionGuid      The Flash Region GUID for the base address
> which corresponds to the type in the descriptor.
>    @param[out] BaseAddress         The Flash Linear Address for the Region 'n'
> Base
>    @param[out] RegionSize          The size for the Region 'n'
> 
> @@ -281,13 +368,20 @@ ReleaseSpiBar0 (
>  EFI_STATUS
>  EFIAPI
>  GetRegionAddress (
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    OUT    UINT32             *BaseAddress,
>    OUT    UINT32             *RegionSize
>    )
>  {
> -  UINTN           PchSpiBar0;
> -  UINT32          ReadValue;
> +  EFI_STATUS          Status;
> +  FLASH_REGION_TYPE   FlashRegionType;
> +  UINTN               PchSpiBar0;
> +  UINT32              ReadValue;
> +
> +  Status = GetFlashRegionType (FlashRegionGuid, &FlashRegionType);  if
> + (EFI_ERROR (Status)) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> 
>    if (FlashRegionType >= FlashRegionMax) {
>      return EFI_INVALID_PARAMETER;
> @@ -484,7 +578,7 @@ CheckSecureMemoryMapConfiguration (
>   //
>   // Locate BIOS region size to update High bios base address
>   //
> -    GetRegionAddress (FlashRegionBios, &BaseAddress, &RegionSize);
> +    GetRegionAddress (&gFlashRegionBiosGuid, &BaseAddress,
> + &RegionSize);
>      DEBUG ((DEBUG_INFO, "Bios Region Size %x:\n", RegionSize));
>      mLockableMemoryRange[LockableMemoryRangeHighBios].Base  = SIZE_4GB
> - RegionSize;
>      mLockableMemoryRange[LockableMemoryRangeLowDram].End  =
> (MmioRead32 (MmPciBase (0,SA_MC_DEV,SA_MC_FUN) + R_SA_TOLUD) &
> B_SA_TOLUD_TOLUD_MASK) - 1; diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/S
> piCommon.c
> b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/S
> piCommon.c
> index 58757a8cba39..d2eb8324bf58 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/S
> piCommon.c
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiComm
> +++ onLib/SpiCommon.c
> @@ -2,10 +2,13 @@
>    PCH SPI Common Driver implements the SPI Host Controller Compatibility
> Interface.
> 
>  Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) Microsoft Corporation.<BR>
> +
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
>  #include <Uefi/UefiBaseType.h>
> +#include <Guid/FlashRegion.h>
>  #include <Library/IoLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/BaseMemoryLib.h>
> @@ -16,6 +19,90 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include
> <Protocol/Spi.h>  #include <Library/PchSpiCommonLib.h>
> 
> +typedef enum {
> +  FlashRegionDescriptor,
> +  FlashRegionBios,
> +  FlashRegionMe,
> +  FlashRegionGbe,
> +  FlashRegionPlatformData,
> +  FlashRegionDer,
> +  FlashRegionAll,
> +  FlashRegionMax
> +} FLASH_REGION_TYPE;
> +
> +typedef struct {
> +  EFI_GUID            *Guid;
> +  FLASH_REGION_TYPE   Type;
> +} FLASH_REGION_MAPPING;
> +
> +FLASH_REGION_MAPPING mFlashRegionTypes[] = {
> +  {
> +    &gFlashRegionDescriptorGuid,
> +    FlashRegionDescriptor
> +  },
> +  {
> +    &gFlashRegionBiosGuid,
> +    FlashRegionBios
> +  },
> +  {
> +    &gFlashRegionMeGuid,
> +    FlashRegionMe
> +  },
> +  {
> +    &gFlashRegionGbeGuid,
> +    FlashRegionGbe
> +  },
> +  {
> +    &gFlashRegionPlatformDataGuid,
> +    FlashRegionPlatformData
> +  },
> +  {
> +    &gFlashRegionDerGuid,
> +    FlashRegionDer
> +  },
> +  {
> +    &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 to 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 found for
> the given flash region GUID.
> +
> +**/
> +EFI_STATUS
> +GetFlashRegionType (
> +  IN     EFI_GUID           *FlashRegionGuid,
> +  OUT    FLASH_REGION_TYPE  *FlashRegionType
> +  )
> +{
> +  UINTN   Index;
> +
> +  if (FlashRegionGuid == NULL || FlashRegionType == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  for (Index = 0; Index < ARRAY_SIZE (mFlashRegionTypes); Index++) {
> +    if (CompareGuid (mFlashRegionTypes[Index].Guid, FlashRegionGuid)) {
> +      *FlashRegionType = mFlashRegionTypes[Index].Type;
> +      return EFI_SUCCESS;
> +    }
> +  }
> +
> +  return EFI_NOT_FOUND;
> +}
> +
>  /**
>    Initialize an SPI protocol instance.
> 
> @@ -249,7 +336,7 @@ PchPmTimerStallRuntimeSafe (
>    Read data from the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within 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.
> @@ -263,7 +350,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashRead (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
>    OUT    UINT8              *Buffer
> @@ -276,7 +363,7 @@ SpiProtocolFlashRead (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionType,
> +             FlashRegionGuid,
>               FlashCycleRead,
>               Address,
>               ByteCount,
> @@ -289,7 +376,7 @@ SpiProtocolFlashRead (
>    Write data to the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within 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 containing the
> data sent during the SPI cycle.
> @@ -302,7 +389,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashWrite (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
>    IN     UINT8              *Buffer
> @@ -315,7 +402,7 @@ SpiProtocolFlashWrite (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionType,
> +             FlashRegionGuid,
>               FlashCycleWrite,
>               Address,
>               ByteCount,
> @@ -328,7 +415,7 @@ SpiProtocolFlashWrite (
>    Erase some area on the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within a region
> for which BIOS has access permissions.
>    @param[in] ByteCount            Number of bytes in the data portion of the SPI
> cycle.
> 
> @@ -340,7 +427,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashErase (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount
>    )
> @@ -352,7 +439,7 @@ SpiProtocolFlashErase (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionType,
> +             FlashRegionGuid,
>               FlashCycleErase,
>               Address,
>               ByteCount,
> @@ -407,7 +494,7 @@ SpiProtocolFlashReadSfdp (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionAll,
> +             &gFlashRegionAllGuid,
>               FlashCycleReadSfdp,
>               FlashAddress,
>               ByteCount,
> @@ -460,7 +547,7 @@ SpiProtocolFlashReadJedecId (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionAll,
> +             &gFlashRegionAllGuid,
>               FlashCycleReadJedecId,
>               Address,
>               ByteCount,
> @@ -495,7 +582,7 @@ SpiProtocolFlashWriteStatus (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionAll,
> +             &gFlashRegionAllGuid,
>               FlashCycleWriteStatus,
>               0,
>               ByteCount,
> @@ -530,7 +617,7 @@ SpiProtocolFlashReadStatus (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionAll,
> +             &gFlashRegionAllGuid,
>               FlashCycleReadStatus,
>               0,
>               ByteCount,
> @@ -543,7 +630,7 @@ SpiProtocolFlashReadStatus (
>    Get the SPI region base and size, based on the enum type
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for for the base
> address which is listed in the Descriptor.
> +  @param[in] FlashRegionGuid      The Flash Region GUID for the base address
> which corresponds to the type in the descriptor.
>    @param[out] BaseAddress         The Flash Linear Address for the Region 'n'
> Base
>    @param[out] RegionSize          The size for the Region 'n'
> 
> @@ -555,17 +642,24 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolGetRegionAddress (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  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;
> 
>    SpiInstance     = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
> 
> +  Status = GetFlashRegionType (FlashRegionGuid, &FlashRegionType);  if
> + (EFI_ERROR (Status)) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
>    if (FlashRegionType >= FlashRegionMax) {
>      return EFI_INVALID_PARAMETER;
>    }
> @@ -646,7 +740,7 @@ SpiProtocolReadPchSoftStrap (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionDescriptor,
> +             &gFlashRegionDescriptorGuid,
>               FlashCycleRead,
>               StrapFlashAddr,
>               ByteCount,
> @@ -704,7 +798,7 @@ SpiProtocolReadCpuSoftStrap (
>    //
>    Status = SendSpiCmd (
>               This,
> -             FlashRegionDescriptor,
> +             &gFlashRegionDescriptorGuid,
>               FlashCycleRead,
>               StrapFlashAddr,
>               ByteCount,
> @@ -717,7 +811,7 @@ SpiProtocolReadCpuSoftStrap (
>    This function sends the programmed SPI command to the slave device.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] SpiRegionType        The SPI Region type for flash cycle which is
> listed in the Descriptor
> +  @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 within a region
> for which BIOS has access permissions.
>    @param[in] ByteCount            Number of bytes in the data portion of the SPI
> cycle.
> @@ -731,7 +825,7 @@ SpiProtocolReadCpuSoftStrap (  EFI_STATUS
> SendSpiCmd (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     FLASH_CYCLE_TYPE   FlashCycleType,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
> @@ -795,7 +889,7 @@ SendSpiCmd (
>      goto SendSpiCmdEnd;
>    }
> 
> -  Status = SpiProtocolGetRegionAddress (This, FlashRegionType,
> &HardwareSpiAddr, &FlashRegionSize);
> +  Status = SpiProtocolGetRegionAddress (This, FlashRegionGuid,
> + &HardwareSpiAddr, &FlashRegionSize);
>    if (EFI_ERROR (Status)) {
>      goto SendSpiCmdEnd;
>    }
> diff --git a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf
> b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf
> index bd12fa691d40..09826cdfdf39 100644
> --- a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf
> @@ -2,6 +2,7 @@
>  #  Component description file for Hsti Silicon Driver  #  # Copyright (c) 2017,
> Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -86,6 +87,14 @@
> [LibraryClasses]  [Guids]
>    gEfiEndOfDxeEventGroupGuid
>    gSiMemoryPlatformDataGuid          ## CONSUMES
> +  gFlashRegionDescriptorGuid
> +  gFlashRegionBiosGuid
> +  gFlashRegionMeGuid
> +  gFlashRegionGbeGuid
> +  gFlashRegionPlatformDataGuid
> +  gFlashRegionDerGuid
> +  gFlashRegionAllGuid
> +  gFlashRegionMaxGuid
> 
>  [Protocols]
>    gEfiDxeSmmReadyToLockProtocolGuid  ## CONSUMES diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLi
> b.h
> b/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLi
> b.h
> index d408289ea253..fd991de96016 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLi
> b.h
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpi
> +++ CommonLib.h
> @@ -134,7 +134,7 @@ ReleaseSpiBar0 (
>    Read data from the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within 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.
> @@ -148,7 +148,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashRead (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
>    OUT    UINT8              *Buffer
> @@ -158,7 +158,7 @@ SpiProtocolFlashRead (
>    Write data to the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within 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 containing the
> data sent during the SPI cycle.
> @@ -171,7 +171,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashWrite (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
>    IN     UINT8              *Buffer
> @@ -181,7 +181,7 @@ SpiProtocolFlashWrite (
>    Erase some area on the flash part.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for flash cycle which is
> listed in the Descriptor.
> +  @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 within a region
> for which BIOS has access permissions.
>    @param[in] ByteCount            Number of bytes in the data portion of the SPI
> cycle.
> 
> @@ -193,7 +193,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolFlashErase (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount
>    );
> @@ -286,7 +286,7 @@ SpiProtocolFlashReadStatus (
>    Get the SPI region base and size, based on the enum type
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] FlashRegionType      The Flash Region type for for the base
> address which is listed in the Descriptor.
> +  @param[in] FlashRegionGuid      The Flash Region GUID for flash cycle which
> corresponds to the type in the descriptor.
>    @param[out] BaseAddress         The Flash Linear Address for the Region 'n'
> Base
>    @param[out] RegionSize          The size for the Region 'n'
> 
> @@ -298,7 +298,7 @@ EFI_STATUS
>  EFIAPI
>  SpiProtocolGetRegionAddress (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    OUT    UINT32             *BaseAddress,
>    OUT    UINT32             *RegionSize
>    );
> @@ -353,7 +353,7 @@ SpiProtocolReadCpuSoftStrap (
>    This function sends the programmed SPI command to the slave device.
> 
>    @param[in] This                 Pointer to the PCH_SPI_PROTOCOL instance.
> -  @param[in] SpiRegionType        The SPI Region type for flash cycle which is
> listed in the Descriptor
> +  @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 within a region
> for which BIOS has access permissions.
>    @param[in] ByteCount            Number of bytes in the data portion of the SPI
> cycle.
> @@ -367,7 +367,7 @@ SpiProtocolReadCpuSoftStrap (  EFI_STATUS
> SendSpiCmd (
>    IN     PCH_SPI_PROTOCOL   *This,
> -  IN     FLASH_REGION_TYPE  FlashRegionType,
> +  IN     EFI_GUID           *FlashRegionGuid,
>    IN     FLASH_CYCLE_TYPE   FlashCycleType,
>    IN     UINT32             Address,
>    IN     UINT32             ByteCount,
> diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/B
> asePchSpiCommonLib.inf
> b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/B
> asePchSpiCommonLib.inf
> index 51e2d25a7f8b..67176c879de5 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/B
> asePchSpiCommonLib.inf
> +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiComm
> +++ onLib/BasePchSpiCommonLib.inf
> @@ -2,6 +2,7 @@
>  #  Component description file for the PchSpiCommonLib  #  # Copyright (c) 2017
> - 2020 Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -28,3 +29,13 @@
> [LibraryClasses]
>    IoLib
>    DebugLib
>    PchCycleDecodingLib
> +
> +[Guids]
> +  gFlashRegionDescriptorGuid
> +  gFlashRegionBiosGuid
> +  gFlashRegionMeGuid
> +  gFlashRegionGbeGuid
> +  gFlashRegionPlatformDataGuid
> +  gFlashRegionDerGuid
> +  gFlashRegionAllGuid
> +  gFlashRegionMaxGuid
> --
> 2.28.0.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#77136): https://edk2.groups.io/g/devel/message/77136
> Mute This Topic: https://groups.io/mt/83794828/1777047
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.chiu@intel.com]
> -=-=-=-=-=-=
> 


  reply	other threads:[~2021-06-28  1:38 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 21:20 [edk2-platforms][PATCH v4 00/41] Consolidate SpiFlashCommonLib instances Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 01/41] CometlakeOpenBoardPkg: Remove redundant IntelSiliconPkg.dec entry Michael Kubacki
2021-06-28  1:36   ` [edk2-devel] " Chiu, Chasel
2021-06-28 23:05   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 02/41] WhiskeylakeOpenBoardPkg: " Michael Kubacki
2021-06-28 23:05   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 03/41] CometlakeOpenBoardPkg/PeiPolicyUpdateLib: Add missing GUID to INF Michael Kubacki
2021-06-28  1:36   ` [edk2-devel] " Chiu, Chasel
2021-06-28 23:08   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 04/41] IntelSiliconPkg: Add BIOS area base address and size PCDs Michael Kubacki
2021-06-28 23:10   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 05/41] IntelSiliconPkg: Add microcode FV PCDs Michael Kubacki
2021-06-28 23:50   ` Chaganty, Rangasai V
     [not found]   ` <MW3PR11MB4602324E354DB86D21B3171FB6039@MW3PR11MB4602.namprd11.prod.outlook.com>
2021-06-29  5:09     ` Ni, Ray
2021-06-30  2:26       ` Michael Kubacki
2021-06-30  6:45         ` Ni, Ray
2021-06-30 15:18           ` [edk2-devel] " Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 06/41] IntelSiliconPkg: Add PCH SPI PPI Michael Kubacki
2021-06-28 23:16   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 07/41] IntelSiliconPkg: Add PCH SPI Protocol Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 08/41] IntelSiliconPkg: Add SpiFlashCommonLib Michael Kubacki
2021-06-28 23:26   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 09/41] IntelSiliconPkg: Add SmmSpiFlashCommonLib Michael Kubacki
2021-06-28 23:32   ` Chaganty, Rangasai V
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 10/41] IntelSiliconPkg: Add MM SPI FVB services Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 11/41] CometlakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs Michael Kubacki
2021-06-28  1:34   ` Chiu, Chasel
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 12/41] KabylakeOpenBoardPkg: " Michael Kubacki
2021-06-28  1:36   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 13/41] SimicsOpenBoardPkg: " Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 14/41] TigerlakeOpenBoardPkg: " Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 15/41] WhiskeylakeOpenBoardPkg: " Michael Kubacki
2021-06-28  1:38   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 16/41] CoffeelakeSiliconPkg: " Michael Kubacki
2021-06-28  1:36   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 17/41] KabylakeSiliconPkg: " Michael Kubacki
2021-06-28  1:37   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 18/41] SimicsIch10Pkg: " Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 19/41] TigerlakeSiliconPkg: " Michael Kubacki
2021-06-25 21:20 ` [edk2-platforms][PATCH v4 20/41] CometlakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib Michael Kubacki
2021-06-28  1:33   ` Chiu, Chasel
2021-06-29  0:10   ` Chaganty, Rangasai V
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 21/41] KabylakeOpenBoardPkg: " Michael Kubacki
2021-06-28  1:33   ` Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 22/41] SimicsOpenBoardPkg: " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 23/41] TigerlakeOpenBoardPkg: " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 24/41] WhiskeylakeOpenBoardPkg: " Michael Kubacki
2021-06-28  1:37   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 25/41] MinPlatformPkg: Remove SpiFvbService modules Michael Kubacki
2021-06-28  1:37   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 26/41] CoffeelakeSiliconPkg: Remove SmmSpiFlashCommonLib Michael Kubacki
2021-06-28  1:34   ` Chiu, Chasel
2021-06-29  0:08   ` Chaganty, Rangasai V
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 27/41] KabylakeSiliconPkg: " Michael Kubacki
2021-06-28  1:34   ` Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 28/41] SimicsIch10Pkg: " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 29/41] TigerlakeOpenBoardPkg: " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 30/41] MinPlatformPkg: Remove SpiFlashCommonLibNull Michael Kubacki
2021-06-28  1:38   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 31/41] KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Add IntelSiliconPkg.dec Michael Kubacki
2021-06-28  1:37   ` [edk2-devel] " Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 32/41] CoffeelakeSiliconPkg: Remove PCH SPI PPI and Protocol from package Michael Kubacki
2021-06-28  1:34   ` Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 33/41] KabylakeSiliconPkg: " Michael Kubacki
2021-06-28  1:35   ` Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 34/41] SimicsIch10Pkg: Remove PCH SPI SMM " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 35/41] TigerlakeSiliconPkg: Remove PCH SPI PPI and " Michael Kubacki
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 36/41] IntelSiliconPkg: Add flash region GUIDs Michael Kubacki
2021-06-29  0:07   ` Chaganty, Rangasai V
2021-07-29  0:46   ` Nate DeSimone
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 37/41] IntelSiliconPkg: Identify flash regions by GUID Michael Kubacki
2021-06-29  0:07   ` Chaganty, Rangasai V
2021-07-29  0:47   ` Nate DeSimone
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 38/41] CoffeelakeSiliconPkg/BasePchSpiCommonLib: " Michael Kubacki
2021-06-28  1:35   ` Chiu, Chasel
2021-06-25 21:21 ` [edk2-platforms][PATCH v4 39/41] KabylakeSiliconPkg: " Michael Kubacki
2021-06-28  1:38   ` Chiu, Chasel [this message]
2021-07-28 23:58 ` [edk2-devel] [edk2-platforms][PATCH v4 00/41] Consolidate SpiFlashCommonLib instances Nate DeSimone
2021-07-29  0:08   ` Michael Kubacki
2021-08-02 18:24     ` Michael Kubacki
2021-08-05 23:31       ` Nate DeSimone
     [not found] ` <20210625212120.235-41-mikuback@linux.microsoft.com>
2021-07-29  0:47   ` [edk2-platforms][PATCH v4 40/41] SimicsIch10Pkg/BasePchSpiCommonLib: Identify flash regions by GUID Nate DeSimone
     [not found] ` <20210625212120.235-42-mikuback@linux.microsoft.com>
2021-07-29  0:48   ` [edk2-platforms][PATCH v4 41/41] TigerlakeSiliconPkg/BasePchSpiCommonLib: " Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN9PR11MB548395C7DDA7AB831996C817E6039@BN9PR11MB5483.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox