From: "Michael Kubacki" <mikuback@linux.microsoft.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>,
Rangasai V Chaganty <rangasai.v.chaganty@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms][PATCH v5 40/46] IntelSiliconPkg: Identify flash regions by GUID
Date: Mon, 2 Aug 2021 22:39:08 -0400 [thread overview]
Message-ID: <20210803023914.1569-41-mikuback@linux.microsoft.com> (raw)
In-Reply-To: <20210803023914.1569-1-mikuback@linux.microsoft.com>
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3307
Updates the SPI protocol to identify flash regions by GUID instead
of fixed values defined in an enum. Packages consuming
IntelSiliconPkg are able to associate a given GUID with their chosen
values based on their SPI flash details as implemented in their
PCH_SPI_PROTOCOL instance.
Cc: Ray Ni <ray.ni@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: Sai Chaganty <rangasai.v.chaganty@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.c | 2 +-
Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c | 4 +-
Silicon/Intel/IntelSiliconPkg/Include/Protocol/Spi.h | 43 ++++----------------
Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf | 3 ++
4 files changed, 14 insertions(+), 38 deletions(-)
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.c b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.c
index 7941b8f8720c..2c9c889e7f48 100644
--- a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.c
+++ b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.c
@@ -52,7 +52,7 @@ SmmSpiFlashCommonLibConstructor (
);
ASSERT_EFI_ERROR (Status);
- mSpiProtocol->GetRegionAddress (mSpiProtocol, FlashRegionBios, &BaseAddr, &RegionSize);
+ mSpiProtocol->GetRegionAddress (mSpiProtocol, &gFlashRegionBiosGuid, &BaseAddr, &RegionSize);
mBiosOffset = BaseAddr;
return Status;
}
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c
index daebaf8e5e33..62c1d099fc2c 100644
--- a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c
+++ b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c
@@ -127,7 +127,7 @@ SpiFlashWrite (
}
Status = mSpiProtocol->FlashWrite (
mSpiProtocol,
- FlashRegionBios,
+ &gFlashRegionBiosGuid,
(UINT32) Offset,
Length,
Buffer
@@ -201,7 +201,7 @@ SpiFlashBlockErase (
Status = mSpiProtocol->FlashErase (
mSpiProtocol,
- FlashRegionBios,
+ &gFlashRegionBiosGuid,
(UINT32) Offset,
(UINT32) RemainingBytes
);
diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Protocol/Spi.h b/Silicon/Intel/IntelSiliconPkg/Include/Protocol/Spi.h
index c13dc5a5f5f5..2b09ca1faf02 100644
--- a/Silicon/Intel/IntelSiliconPkg/Include/Protocol/Spi.h
+++ b/Silicon/Intel/IntelSiliconPkg/Include/Protocol/Spi.h
@@ -19,33 +19,6 @@ extern EFI_GUID gPchSmmSpiProtocolGuid;
//
typedef struct _PCH_SPI_PROTOCOL PCH_SPI_PROTOCOL;
-//
-// SPI protocol data structures and definitions
-//
-
-/**
- Flash Region Type
-**/
-typedef enum {
- FlashRegionDescriptor,
- FlashRegionBios,
- FlashRegionMe,
- FlashRegionGbE,
- FlashRegionPlatformData,
- FlashRegionDer,
- FlashRegionSecondaryBios,
- FlashRegionuCodePatch,
- FlashRegionEC,
- FlashRegionDeviceExpansion2,
- FlashRegionIE,
- FlashRegion10Gbe_A,
- FlashRegion10Gbe_B,
- FlashRegion13,
- FlashRegion14,
- FlashRegion15,
- FlashRegionAll,
- FlashRegionMax
-} FLASH_REGION_TYPE;
//
// Protocol member functions
//
@@ -54,7 +27,7 @@ typedef enum {
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.
@@ -68,7 +41,7 @@ typedef
EFI_STATUS
(EFIAPI *PCH_SPI_FLASH_READ) (
IN PCH_SPI_PROTOCOL *This,
- IN FLASH_REGION_TYPE FlashRegionType,
+ IN EFI_GUID *FlashRegionGuid,
IN UINT32 Address,
IN UINT32 ByteCount,
OUT UINT8 *Buffer
@@ -78,7 +51,7 @@ EFI_STATUS
Write data to the flash part. Remark: Erase may be needed before write 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.
@@ -91,7 +64,7 @@ typedef
EFI_STATUS
(EFIAPI *PCH_SPI_FLASH_WRITE) (
IN PCH_SPI_PROTOCOL *This,
- IN FLASH_REGION_TYPE FlashRegionType,
+ IN EFI_GUID *FlashRegionGuid,
IN UINT32 Address,
IN UINT32 ByteCount,
IN UINT8 *Buffer
@@ -101,7 +74,7 @@ EFI_STATUS
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.
@@ -113,7 +86,7 @@ typedef
EFI_STATUS
(EFIAPI *PCH_SPI_FLASH_ERASE) (
IN PCH_SPI_PROTOCOL *This,
- IN FLASH_REGION_TYPE FlashRegionType,
+ IN EFI_GUID *FlashRegionGuid,
IN UINT32 Address,
IN UINT32 ByteCount
);
@@ -206,7 +179,7 @@ EFI_STATUS
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'
@@ -218,7 +191,7 @@ typedef
EFI_STATUS
(EFIAPI *PCH_SPI_GET_REGION_ADDRESS) (
IN PCH_SPI_PROTOCOL *This,
- IN FLASH_REGION_TYPE FlashRegionType,
+ IN EFI_GUID *FlashRegionGuid,
OUT UINT32 *BaseAddress,
OUT UINT32 *RegionSize
);
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
index f6a06351ace5..b28ea3c2719d 100644
--- a/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
+++ b/Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf
@@ -37,6 +37,9 @@ [Pcd]
gIntelSiliconPkgTokenSpaceGuid.PcdBiosAreaBaseAddress ## CONSUMES
gIntelSiliconPkgTokenSpaceGuid.PcdBiosSize ## CONSUMES
+[Guids]
+ gFlashRegionBiosGuid
+
[Sources]
SmmSpiFlashCommonLib.c
SpiFlashCommon.c
--
2.28.0.windows.1
next prev parent reply other threads:[~2021-08-03 3:18 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210803023914.1569-1-mikuback@linux.microsoft.com>
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 01/46] CometlakeOpenBoardPkg: Remove redundant IntelSiliconPkg.dec entry Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 02/46] WhiskeylakeOpenBoardPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 03/46] CometlakeOpenBoardPkg/PeiPolicyUpdateLib: Add missing GUID to INF Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 04/46] IntelSiliconPkg: Add BIOS area base address and size PCDs Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 05/46] IntelSiliconPkg: Add microcode FV PCDs Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 06/46] IntelSiliconPkg: Add PCH SPI PPI Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 07/46] IntelSiliconPkg: Add PCH SPI Protocol Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 08/46] IntelSiliconPkg: Add SpiFlashCommonLib Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 09/46] IntelSiliconPkg: Add SmmSpiFlashCommonLib Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 12/46] KabylakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 13/46] SimicsOpenBoardPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 14/46] TigerlakeOpenBoardPkg: " Michael Kubacki
2021-08-23 3:15 ` Heng Luo
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 16/46] CoffeelakeSiliconPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 17/46] KabylakeSiliconPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 18/46] SimicsIch10Pkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 19/46] TigerlakeSiliconPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 20/46] CometlakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 21/46] KabylakeOpenBoardPkg: " Michael Kubacki
2021-08-03 7:38 ` Chiu, Chasel
2021-08-03 15:09 ` [edk2-devel] " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 22/46] SimicsOpenBoardPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 24/46] WhiskeylakeOpenBoardPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 25/46] PurleyOpenBoardPkg: Use IntelSiliconPkg SpiFvbServiceSmm Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 26/46] WhitleyOpenBoardPkg: UseIntelSiliconPkg SpiFvbServiceSmm Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 27/46] MinPlatformPkg: Remove SpiFvbService modules Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 28/46] CoffeelakeSiliconPkg: Remove SmmSpiFlashCommonLib Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 29/46] KabylakeSiliconPkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 30/46] SimicsIch10Pkg: " Michael Kubacki
2021-08-03 2:38 ` [edk2-platforms][PATCH v5 31/46] TigerlakeOpenBoardPkg: " Michael Kubacki
2021-08-23 2:56 ` Chaganty, Rangasai V
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 33/46] PurleyOpenBoardPkg: Add SpiFlashCommonLib.h Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 34/46] KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Add IntelSiliconPkg.dec Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 35/46] CoffeelakeSiliconPkg: Remove PCH SPI PPI and Protocol from package Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 36/46] KabylakeSiliconPkg: " Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 37/46] SimicsIch10Pkg: Remove PCH SPI SMM " Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 38/46] TigerlakeSiliconPkg: Remove PCH SPI PPI and " Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 39/46] IntelSiliconPkg: Add flash region GUIDs Michael Kubacki
2021-08-03 2:39 ` Michael Kubacki [this message]
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 41/46] CoffeelakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by GUID Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 42/46] KabylakeSiliconPkg: " Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 44/46] KabylakeOpenBoardPkg/KabylakeRvp3: Add PeiSerialPortlibSpiFlash to build Michael Kubacki
2021-08-06 2:44 ` Chiu, Chasel
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 45/46] SimicsIch10Pkg/BasePchSpiCommonLib: Identify flash regions by GUID Michael Kubacki
2021-08-03 2:39 ` [edk2-platforms][PATCH v5 46/46] TigerlakeSiliconPkg/BasePchSpiCommonLib: " Michael Kubacki
[not found] ` <20210803023914.1569-44-mikuback@linux.microsoft.com>
2021-08-06 2:44 ` [edk2-platforms][PATCH v5 43/46] KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Update for new SPI PPI API Chiu, Chasel
[not found] ` <20210803023914.1569-24-mikuback@linux.microsoft.com>
2021-08-23 2:57 ` [edk2-platforms][PATCH v5 23/46] TigerlakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib Chaganty, Rangasai V
2021-10-22 0:21 ` [edk2-platforms][PATCH v5 00/46] Consolidate SpiFlashCommonLib instances Nate DeSimone
2021-10-28 22:13 ` Michael Kubacki
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=20210803023914.1569-41-mikuback@linux.microsoft.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