Date   

[edk2-platforms][PATCH v5 10/46] IntelSiliconPkg: Add MM SPI FVB services

Michael Kubacki
 

From: Michael Kubacki <michael.kubacki@...>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307

Adds a Traditional MM and Standalone MM SPI FVB Service driver to
IntelSiliconPkg. These drivers produce the firmware volume block
protocol for SPI flash devices compliant with the Intel Serial
Flash Interface Compatibility Specification.

Cc: Ray Ni <ray.ni@...>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>
---
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/FvbInfo.c =
| 94 ++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceC=
ommon.c | 903 ++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceM=
m.c | 271 ++++++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceS=
tandaloneMm.c | 32 +
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceT=
raditionalMm.c | 32 +
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceC=
ommon.h | 158 ++++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceM=
m.h | 22 +
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceS=
mm.inf | 68 ++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceS=
tandaloneMm.inf | 67 ++
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc =
| 11 +
10 files changed, 1658 insertions(+)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Fv=
bInfo.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/FvbIn=
fo.c
new file mode 100644
index 000000000000..7f2678fa9e5a
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/FvbInfo.c
@@ -0,0 +1,94 @@
+/**@file
+ Defines data structure that is the volume header found.
+ These data is intent to decouple FVB driver with FV header.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SpiFvbServiceCommon.h"
+
+#define FIRMWARE_BLOCK_SIZE 0x10000
+#define FVB_MEDIA_BLOCK_SIZE FIRMWARE_BLOCK_SIZE
+
+#define NV_STORAGE_BASE_ADDRESS FixedPcdGet32(PcdFlashNvStorageVaria=
bleBase)
+#define SYSTEM_NV_BLOCK_NUM ((FixedPcdGet32(PcdFlashNvStorageVar=
iableSize)+ FixedPcdGet32(PcdFlashNvStorageFtwWorkingSize) + FixedPcdGet3=
2(PcdFlashNvStorageFtwSpareSize))/ FVB_MEDIA_BLOCK_SIZE)
+
+typedef struct {
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ EFI_FIRMWARE_VOLUME_HEADER FvbInfo;
+ EFI_FV_BLOCK_MAP_ENTRY End[1];
+} EFI_FVB2_MEDIA_INFO;
+
+//
+// This data structure contains a template of all correct FV headers, wh=
ich is used to restore
+// Fv header if it's corrupted.
+//
+EFI_FVB2_MEDIA_INFO mPlatformFvbMediaInfo[] =3D {
+ //
+ // Systen NvStorage FVB
+ //
+ {
+ NV_STORAGE_BASE_ADDRESS,
+ {
+ {0,}, //ZeroVector[16]
+ EFI_SYSTEM_NV_DATA_FV_GUID,
+ FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,
+ EFI_FVH_SIGNATURE,
+ 0x0004feff, // check MdePkg/Include/Pi/PiFirmwareVolume.h for deta=
ils on EFI_FVB_ATTRIBUTES_2
+ sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENT=
RY),
+ 0, //CheckSum which will be calucated dynamically.
+ 0, //ExtHeaderOffset
+ {0,}, //Reserved[1]
+ 2, //Revision
+ {
+ {
+ SYSTEM_NV_BLOCK_NUM,
+ FVB_MEDIA_BLOCK_SIZE,
+ }
+ }
+ },
+ {
+ {
+ 0,
+ 0
+ }
+ }
+ }
+};
+
+EFI_STATUS
+GetFvbInfo (
+ IN EFI_PHYSICAL_ADDRESS FvBaseAddress,
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
+ )
+{
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+
+ for (Index =3D 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI=
_FVB2_MEDIA_INFO); Index++) {
+ if (mPlatformFvbMediaInfo[Index].BaseAddress =3D=3D FvBaseAddress) {
+ FvHeader =3D &mPlatformFvbMediaInfo[Index].FvbInfo;
+
+ //
+ // Update the checksum value of FV header.
+ //
+ FvHeader->Checksum =3D CalculateCheckSum16 ( (UINT16 *) FvHeader, =
FvHeader->HeaderLength);
+
+ *FvbInfo =3D FvHeader;
+
+ DEBUG ((DEBUG_INFO, "BaseAddr: 0x%lx \n", FvBaseAddress));
+ DEBUG ((DEBUG_INFO, "FvLength: 0x%lx \n", (*FvbInfo)->FvLength));
+ DEBUG ((DEBUG_INFO, "HeaderLength: 0x%x \n", (*FvbInfo)->HeaderLen=
gth));
+ DEBUG ((DEBUG_INFO, "Header Checksum: 0x%X\n", (*FvbInfo)->Checksu=
m));
+ DEBUG ((DEBUG_INFO, "FvBlockMap[0].NumBlocks: 0x%x \n", (*FvbInfo)=
->BlockMap[0].NumBlocks));
+ DEBUG ((DEBUG_INFO, "FvBlockMap[0].BlockLength: 0x%x \n", (*FvbInf=
o)->BlockMap[0].Length));
+ DEBUG ((DEBUG_INFO, "FvBlockMap[1].NumBlocks: 0x%x \n", (*FvbInfo)=
->BlockMap[1].NumBlocks));
+ DEBUG ((DEBUG_INFO, "FvBlockMap[1].BlockLength: 0x%x \n\n", (*FvbI=
nfo)->BlockMap[1].Length));
+
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_NOT_FOUND;
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceCommon.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbS=
ervice/SpiFvbServiceCommon.c
new file mode 100644
index 000000000000..dab818e98087
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceCommon.c
@@ -0,0 +1,903 @@
+/** @file
+ Common driver source for several Serial Flash devices
+ which are compliant with the Intel(R) Serial Flash Interface Compatibi=
lity Specification.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SpiFvbServiceCommon.h"
+
+//
+// Global variable for this FVB driver which contains
+// the private data of all firmware volume block instances
+//
+FVB_GLOBAL mFvbModuleGlobal;
+
+//
+// This platform driver knows there are multiple FVs on FD.
+// Now we only provide FVs on Variable region and MicorCode region for p=
erformance issue.
+//
+FV_INFO mPlatformFvBaseAddress[] =3D {
+ {0, 0}, // {FixedPcdGet32(PcdFlashNvStorageVariableBase), FixedPcdGet3=
2(PcdFlashNvStorageVariableSize)},
+ {0, 0}, // {FixedPcdGet32(PcdFlashMicrocodeFvBase), FixedPcdGet32(PcdF=
lashMicrocodeFvSize)},
+ {0, 0}
+};
+
+FV_INFO mPlatformDefaultBaseAddress[] =3D {
+ {0, 0}, // {FixedPcdGet32(PcdFlashNvStorageVariableBase), FixedPcdGet3=
2(PcdFlashNvStorageVariableSize)},
+ {0, 0}, // {FixedPcdGet32(PcdFlashMicrocodeFvBase), FixedPcdGet32(PcdF=
lashMicrocodeFvSize)},
+ {0, 0}
+};
+
+FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate =3D {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
+ {
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH)),
+ (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8)
+ }
+ },
+ EfiMemoryMappedIO,
+ (EFI_PHYSICAL_ADDRESS) 0,
+ (EFI_PHYSICAL_ADDRESS) 0,
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+ }
+};
+
+FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate =3D {
+ {
+ {
+ MEDIA_DEVICE_PATH,
+ MEDIA_PIWG_FW_VOL_DP,
+ {
+ (UINT8)(sizeof (MEDIA_FW_VOL_DEVICE_PATH)),
+ (UINT8)(sizeof (MEDIA_FW_VOL_DEVICE_PATH) >> 8)
+ }
+ },
+ { 0 }
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+ }
+};
+
+//
+// Template structure used when installing FVB protocol
+//
+EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL mFvbProtocolTemplate =3D {
+ FvbProtocolGetAttributes,
+ FvbProtocolSetAttributes,
+ FvbProtocolGetPhysicalAddress,
+ FvbProtocolGetBlockSize,
+ FvbProtocolRead,
+ FvbProtocolWrite,
+ FvbProtocolEraseBlocks,
+ NULL
+};
+
+/**
+ Get the EFI_FVB_ATTRIBUTES_2 of a FV.
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTANCE.
+
+ @return Attributes of the FV identified by FvbInstance.
+
+**/
+EFI_FVB_ATTRIBUTES_2
+FvbGetVolumeAttributes (
+ IN EFI_FVB_INSTANCE *FvbInstance
+ )
+{
+ return FvbInstance->FvHeader.Attributes;
+}
+
+/**
+ Retrieves the starting address of an LBA in an FV. It also
+ return a few other attribut of the FV.
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTANCE.
+ @param[in] Lba The logical block address
+ @param[out] LbaAddress On output, contains the physical starting =
address
+ of the Lba
+ @param[out] LbaLength On output, contains the length of the bloc=
k
+ @param[out] NumOfBlocks A pointer to a caller allocated UINTN in w=
hich the
+ number of consecutive blocks starting with=
Lba is
+ returned. All blocks in this range have a =
size of
+ BlockSize
+
+ @retval EFI_SUCCESS Successfully returns
+ @retval EFI_INVALID_PARAMETER Instance not found
+
+**/
+EFI_STATUS
+FvbGetLbaAddress (
+ IN EFI_FVB_INSTANCE *FvbInstance,
+ IN EFI_LBA Lba,
+ OUT UINTN *LbaAddress,
+ OUT UINTN *LbaLength,
+ OUT UINTN *NumOfBlocks
+ )
+{
+ UINT32 NumBlocks;
+ UINT32 BlockLength;
+ UINTN Offset;
+ EFI_LBA StartLba;
+ EFI_LBA NextLba;
+ EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
+
+ StartLba =3D 0;
+ Offset =3D 0;
+ BlockMap =3D &(FvbInstance->FvHeader.BlockMap[0]);
+
+ //
+ // Parse the blockmap of the FV to find which map entry the Lba belong=
s to
+ //
+ while (TRUE) {
+ NumBlocks =3D BlockMap->NumBlocks;
+ BlockLength =3D BlockMap->Length;
+
+ if ( NumBlocks =3D=3D 0 || BlockLength =3D=3D 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ NextLba =3D StartLba + NumBlocks;
+
+ //
+ // The map entry found
+ //
+ if (Lba >=3D StartLba && Lba < NextLba) {
+ Offset =3D Offset + (UINTN)MultU64x32((Lba - StartLba), BlockLengt=
h);
+ if (LbaAddress ) {
+ *LbaAddress =3D FvbInstance->FvBase + Offset;
+ }
+
+ if (LbaLength ) {
+ *LbaLength =3D BlockLength;
+ }
+
+ if (NumOfBlocks ) {
+ *NumOfBlocks =3D (UINTN)(NextLba - Lba);
+ }
+ return EFI_SUCCESS;
+ }
+
+ StartLba =3D NextLba;
+ Offset =3D Offset + NumBlocks * BlockLength;
+ BlockMap++;
+ }
+}
+
+/**
+ Reads specified number of bytes into a buffer from the specified block=
.
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTA=
NCE
+ @param[in] Lba The logical block address to be =
read from
+ @param[in] BlockOffset Offset into the block at which t=
o begin reading
+ @param[in] NumBytes Pointer that on input contains t=
he total size of
+ the buffer. On output, it contai=
ns the total number
+ of bytes read
+ @param[in] Buffer Pointer to a caller allocated bu=
ffer that will be
+ used to hold the data read
+
+
+ @retval EFI_SUCCESS The firmware volume was read suc=
cessfully and
+ contents are in Buffer
+ @retval EFI_BAD_BUFFER_SIZE Read attempted across a LBA boun=
dary. On output,
+ NumBytes contains the total numb=
er of bytes returned
+ in Buffer
+ @retval EFI_ACCESS_DENIED The firmware volume is in the Re=
adDisabled state
+ @retval EFI_DEVICE_ERROR The block device is not function=
ing correctly and
+ could not be read
+ @retval EFI_INVALID_PARAMETER Instance not found, or NumBytes,=
Buffer are NULL
+
+**/
+EFI_STATUS
+FvbReadBlock (
+ IN EFI_FVB_INSTANCE *FvbInstance,
+ IN EFI_LBA Lba,
+ IN UINTN BlockOffset,
+ IN OUT UINTN *NumBytes,
+ IN UINT8 *Buffer
+ )
+{
+ EFI_FVB_ATTRIBUTES_2 Attributes;
+ UINTN LbaAddress;
+ UINTN LbaLength;
+ EFI_STATUS Status;
+ BOOLEAN BadBufferSize =3D FALSE;
+
+ if ((NumBytes =3D=3D NULL) || (Buffer =3D=3D NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (*NumBytes =3D=3D 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status =3D FvbGetLbaAddress (FvbInstance, Lba, &LbaAddress, &LbaLength=
, NULL);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Attributes =3D FvbGetVolumeAttributes (FvbInstance);
+
+ if ((Attributes & EFI_FVB2_READ_STATUS) =3D=3D 0) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ if (BlockOffset > LbaLength) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (LbaLength < (*NumBytes + BlockOffset)) {
+ DEBUG ((DEBUG_INFO,
+ "FvReadBlock: Reducing Numbytes from 0x%x to 0x%x\n",
+ *NumBytes,
+ (UINT32)(LbaLength - BlockOffset))
+ );
+ *NumBytes =3D (UINT32) (LbaLength - BlockOffset);
+ BadBufferSize =3D TRUE;
+ }
+
+ Status =3D SpiFlashRead (LbaAddress + BlockOffset, (UINT32 *)NumBytes,=
Buffer);
+
+ if (!EFI_ERROR (Status) && BadBufferSize) {
+ return EFI_BAD_BUFFER_SIZE;
+ } else {
+ return Status;
+ }
+}
+
+/**
+ Writes specified number of bytes from the input buffer to the block.
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTANCE
+ @param[in] Lba The starting logical block index to =
write to
+ @param[in] BlockOffset Offset into the block at which to be=
gin writing
+ @param[in] NumBytes Pointer that on input contains the t=
otal size of
+ the buffer. On output, it contains t=
he total number
+ of bytes actually written
+ @param[in] Buffer Pointer to a caller allocated buffer=
that contains
+ the source for the write
+ @retval EFI_SUCCESS The firmware volume was written succ=
essfully
+ @retval EFI_BAD_BUFFER_SIZE Write attempted across a LBA boundar=
y. On output,
+ NumBytes contains the total number o=
f bytes
+ actually written
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteD=
isabled state
+ @retval EFI_DEVICE_ERROR The block device is not functioning =
correctly and
+ could not be written
+ @retval EFI_INVALID_PARAMETER Instance not found, or NumBytes, Buf=
fer are NULL
+
+**/
+EFI_STATUS
+FvbWriteBlock (
+ IN EFI_FVB_INSTANCE *FvbInstance,
+ IN EFI_LBA Lba,
+ IN UINTN BlockOffset,
+ IN OUT UINTN *NumBytes,
+ IN UINT8 *Buffer
+ )
+{
+ EFI_FVB_ATTRIBUTES_2 Attributes;
+ UINTN LbaAddress;
+ UINTN LbaLength;
+ EFI_STATUS Status;
+ BOOLEAN BadBufferSize =3D FALSE;
+
+ if ((NumBytes =3D=3D NULL) || (Buffer =3D=3D NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (*NumBytes =3D=3D 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status =3D FvbGetLbaAddress (FvbInstance, Lba, &LbaAddress, &LbaLength=
, NULL);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Check if the FV is write enabled
+ //
+ Attributes =3D FvbGetVolumeAttributes (FvbInstance);
+ if ((Attributes & EFI_FVB2_WRITE_STATUS) =3D=3D 0) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ //
+ // Perform boundary checks and adjust NumBytes
+ //
+ if (BlockOffset > LbaLength) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (LbaLength < (*NumBytes + BlockOffset)) {
+ DEBUG ((DEBUG_INFO,
+ "FvWriteBlock: Reducing Numbytes from 0x%x to 0x%x\n",
+ *NumBytes,
+ (UINT32)(LbaLength - BlockOffset))
+ );
+ *NumBytes =3D (UINT32) (LbaLength - BlockOffset);
+ BadBufferSize =3D TRUE;
+ }
+
+ Status =3D SpiFlashWrite (LbaAddress + BlockOffset, (UINT32 *)NumBytes=
, Buffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status =3D SpiFlashLock ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ WriteBackInvalidateDataCacheRange ((VOID *) (LbaAddress + BlockOffset)=
, *NumBytes);
+
+ if (!EFI_ERROR (Status) && BadBufferSize) {
+ return EFI_BAD_BUFFER_SIZE;
+ } else {
+ return Status;
+ }
+}
+
+
+
+/**
+ Erases and initializes a firmware volume block.
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTANCE
+ @param[in] Lba The logical block index to be erased
+
+ @retval EFI_SUCCESS The erase request was successfully com=
pleted
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDis=
abled state
+ @retval EFI_DEVICE_ERROR The block device is not functioning co=
rrectly and
+ could not be written. Firmware device =
may have been
+ partially erased
+ @retval EFI_INVALID_PARAMETER Instance not found
+
+**/
+EFI_STATUS
+FvbEraseBlock (
+ IN EFI_FVB_INSTANCE *FvbInstance,
+ IN EFI_LBA Lba
+ )
+{
+
+ EFI_FVB_ATTRIBUTES_2 Attributes;
+ UINTN LbaAddress;
+ UINTN LbaLength;
+ EFI_STATUS Status;
+
+ //
+ // Check if the FV is write enabled
+ //
+ Attributes =3D FvbGetVolumeAttributes (FvbInstance);
+
+ if( (Attributes & EFI_FVB2_WRITE_STATUS) =3D=3D 0) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ //
+ // Get the starting address of the block for erase.
+ //
+ Status =3D FvbGetLbaAddress (FvbInstance, Lba, &LbaAddress, &LbaLength=
, NULL);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status =3D SpiFlashBlockErase (LbaAddress, &LbaLength);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status =3D SpiFlashLock ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ WriteBackInvalidateDataCacheRange ((VOID *) LbaAddress, LbaLength);
+
+ return Status;
+}
+
+/**
+ Modifies the current settings of the firmware volume according to the
+ input parameter, and returns the new setting of the volume
+
+ @param[in] FvbInstance The pointer to the EFI_FVB_INSTANCE.
+ @param[in] Attributes On input, it is a pointer to EFI_FVB=
_ATTRIBUTES_2
+ containing the desired firmware volu=
me settings.
+ On successful return, it contains th=
e new settings
+ of the firmware volume
+
+ @retval EFI_SUCCESS Successfully returns
+ @retval EFI_ACCESS_DENIED The volume setting is locked and can=
not be modified
+ @retval EFI_INVALID_PARAMETER Instance not found, or The attribute=
s requested are
+ in conflict with the capabilities as=
declared in the
+ firmware volume header
+
+**/
+EFI_STATUS
+FvbSetVolumeAttributes (
+ IN EFI_FVB_INSTANCE *FvbInstance,
+ IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ )
+{
+ EFI_FVB_ATTRIBUTES_2 OldAttributes;
+ EFI_FVB_ATTRIBUTES_2 *AttribPtr;
+ EFI_FVB_ATTRIBUTES_2 UnchangedAttributes;
+ UINT32 Capabilities;
+ UINT32 OldStatus, NewStatus;
+
+ AttribPtr =3D (EFI_FVB_ATTRIBUTES_2 *) &(FvbInstance->FvHeader.Att=
ributes);
+ OldAttributes =3D *AttribPtr;
+ Capabilities =3D OldAttributes & EFI_FVB2_CAPABILITIES;
+ OldStatus =3D OldAttributes & EFI_FVB2_STATUS;
+ NewStatus =3D *Attributes & EFI_FVB2_STATUS;
+
+ UnchangedAttributes =3D EFI_FVB2_READ_DISABLED_CAP | \
+ EFI_FVB2_READ_ENABLED_CAP | \
+ EFI_FVB2_WRITE_DISABLED_CAP | \
+ EFI_FVB2_WRITE_ENABLED_CAP | \
+ EFI_FVB2_LOCK_CAP | \
+ EFI_FVB2_STICKY_WRITE | \
+ EFI_FVB2_MEMORY_MAPPED | \
+ EFI_FVB2_ERASE_POLARITY | \
+ EFI_FVB2_READ_LOCK_CAP | \
+ EFI_FVB2_WRITE_LOCK_CAP | \
+ EFI_FVB2_ALIGNMENT;
+
+ //
+ // Some attributes of FV is read only can *not* be set
+ //
+ if ((OldAttributes & UnchangedAttributes) ^ (*Attributes & UnchangedAt=
tributes)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // If firmware volume is locked, no status bit can be updated
+ //
+ if ( OldAttributes & EFI_FVB2_LOCK_STATUS ) {
+ if ( OldStatus ^ NewStatus ) {
+ return EFI_ACCESS_DENIED;
+ }
+ }
+
+ //
+ // Test read disable
+ //
+ if ((Capabilities & EFI_FVB2_READ_DISABLED_CAP) =3D=3D 0) {
+ if ((NewStatus & EFI_FVB2_READ_STATUS) =3D=3D 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ //
+ // Test read enable
+ //
+ if ((Capabilities & EFI_FVB2_READ_ENABLED_CAP) =3D=3D 0) {
+ if (NewStatus & EFI_FVB2_READ_STATUS) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ //
+ // Test write disable
+ //
+ if ((Capabilities & EFI_FVB2_WRITE_DISABLED_CAP) =3D=3D 0) {
+ if ((NewStatus & EFI_FVB2_WRITE_STATUS) =3D=3D 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ //
+ // Test write enable
+ //
+ if ((Capabilities & EFI_FVB2_WRITE_ENABLED_CAP) =3D=3D 0) {
+ if (NewStatus & EFI_FVB2_WRITE_STATUS) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ //
+ // Test lock
+ //
+ if ((Capabilities & EFI_FVB2_LOCK_CAP) =3D=3D 0) {
+ if (NewStatus & EFI_FVB2_LOCK_STATUS) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ *AttribPtr =3D (*AttribPtr) & (0xFFFFFFFF & (~EFI_FVB2_STATUS));
+ *AttribPtr =3D (*AttribPtr) | NewStatus;
+ *Attributes =3D *AttribPtr;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check the integrity of firmware volume header
+
+ @param[in] FvHeader A pointer to a firmware volume header
+
+ @retval TRUE The firmware volume is consistent
+ @retval FALSE The firmware volume has corrupted.
+
+**/
+BOOLEAN
+IsFvHeaderValid (
+ IN EFI_PHYSICAL_ADDRESS FvBase,
+ IN CONST EFI_FIRMWARE_VOLUME_HEADER *FvHeader
+ )
+{
+ if (FvBase =3D=3D PcdGet32(PcdFlashNvStorageVariableBase)) {
+ if (CompareMem (&FvHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid, =
sizeof(EFI_GUID)) !=3D 0 ) {
+ return FALSE;
+ }
+ } else {
+ if (CompareMem (&FvHeader->FileSystemGuid, &gEfiFirmwareFileSystem2G=
uid, sizeof(EFI_GUID)) !=3D 0 ) {
+ return FALSE;
+ }
+ }
+ if ( (FvHeader->Revision !=3D EFI_FVH_REVISION) ||
+ (FvHeader->Signature !=3D EFI_FVH_SIGNATURE) ||
+ (FvHeader->FvLength =3D=3D ((UINTN) -1)) ||
+ ((FvHeader->HeaderLength & 0x01 ) !=3D0) ) {
+ return FALSE;
+ }
+
+ if (CalculateCheckSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength) =
!=3D 0) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+//
+// FVB protocol APIs
+//
+
+/**
+ Retrieves the physical address of the device.
+
+ @param[in] This A pointer to EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL.
+ @param[out] Address Output buffer containing the address.
+
+ retval EFI_SUCCESS The function always return successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolGetPhysicalAddress (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ OUT EFI_PHYSICAL_ADDRESS *Address
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ *Address =3D FvbInstance->FvBase;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Retrieve the size of a logical block
+
+ @param[in] This Calling context
+ @param[in] Lba Indicates which block to return the size for.
+ @param[out] BlockSize A pointer to a caller allocated UINTN in which
+ the size of the block is returned
+ @param[out] NumOfBlocks A pointer to a caller allocated UINTN in which=
the
+ number of consecutive blocks starting with Lba=
is
+ returned. All blocks in this range have a size=
of
+ BlockSize
+
+ @retval EFI_SUCCESS The function always return successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolGetBlockSize (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ OUT UINTN *BlockSize,
+ OUT UINTN *NumOfBlocks
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ DEBUG((DEBUG_INFO,
+ "FvbProtocolGetBlockSize: Lba: 0x%lx BlockSize: 0x%x NumOfBlocks: 0x=
%x\n",
+ Lba,
+ BlockSize,
+ NumOfBlocks)
+ );
+
+ return FvbGetLbaAddress (
+ FvbInstance,
+ Lba,
+ NULL,
+ BlockSize,
+ NumOfBlocks
+ );
+}
+
+/**
+ Retrieves Volume attributes. No polarity translations are done.
+
+ @param[in] This Calling context
+ @param[out] Attributes Output buffer which contains attributes
+
+ @retval EFI_SUCCESS The function always return successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolGetAttributes (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ *Attributes =3D FvbGetVolumeAttributes (FvbInstance);
+
+ DEBUG ((DEBUG_INFO,
+ "FvbProtocolGetAttributes: This: 0x%x Attributes: 0x%x\n",
+ This,
+ *Attributes)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Sets Volume attributes. No polarity translations are done.
+
+ @param[in] This Calling context
+ @param[out] Attributes Output buffer which contains attributes
+
+ @retval EFI_SUCCESS The function always return successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolSetAttributes (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ )
+{
+ EFI_STATUS Status;
+ EFI_FVB_INSTANCE *FvbInstance;
+
+ DEBUG((DEBUG_INFO,
+ "FvbProtocolSetAttributes: Before SET - This: 0x%x Attributes: 0x%x=
\n",
+ This,
+ *Attributes)
+ );
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ Status =3D FvbSetVolumeAttributes (FvbInstance, Attributes);
+
+ DEBUG((DEBUG_INFO,
+ "FvbProtocolSetAttributes: After SET - This: 0x%x Attributes: 0x%x\=
n",
+ This,
+ *Attributes)
+ );
+
+ return Status;
+}
+
+/**
+ The EraseBlock() function erases one or more blocks as denoted by the
+ variable argument list. The entire parameter list of blocks must be ve=
rified
+ prior to erasing any blocks. If a block is requested that does not ex=
ist
+ within the associated firmware volume (it has a larger index than the =
last
+ block of the firmware volume), the EraseBlock() function must return
+ EFI_INVALID_PARAMETER without modifying the contents of the firmware v=
olume.
+
+ @param[in] This Calling context
+ @param[in] ... Starting LBA followed by Number of Lba to eras=
e.
+ a -1 to terminate the list.
+
+ @retval EFI_SUCCESS The erase request was successfully completed
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled =
state
+ @retval EFI_DEVICE_ERROR The block device is not functioning correctl=
y and
+ could not be written. Firmware device may ha=
ve been
+ partially erased
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolEraseBlocks (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ ...
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+ UINTN NumOfBlocks;
+ VA_LIST Args;
+ EFI_LBA StartingLba;
+ UINTN NumOfLba;
+ EFI_STATUS Status;
+
+ DEBUG((DEBUG_INFO, "FvbProtocolEraseBlocks: \n"));
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ NumOfBlocks =3D FvbInstance->NumOfBlocks;
+
+ VA_START (Args, This);
+
+ do {
+ StartingLba =3D VA_ARG (Args, EFI_LBA);
+ if ( StartingLba =3D=3D EFI_LBA_LIST_TERMINATOR ) {
+ break;
+ }
+
+ NumOfLba =3D VA_ARG (Args, UINT32);
+
+ //
+ // Check input parameters
+ //
+ if (NumOfLba =3D=3D 0) {
+ VA_END (Args);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ( ( StartingLba + NumOfLba ) > NumOfBlocks ) {
+ return EFI_INVALID_PARAMETER;
+ }
+ } while ( 1 );
+
+ VA_END (Args);
+
+ VA_START (Args, This);
+ do {
+ StartingLba =3D VA_ARG (Args, EFI_LBA);
+ if (StartingLba =3D=3D EFI_LBA_LIST_TERMINATOR) {
+ break;
+ }
+
+ NumOfLba =3D VA_ARG (Args, UINT32);
+
+ while ( NumOfLba > 0 ) {
+ Status =3D FvbEraseBlock (FvbInstance, StartingLba);
+ if ( EFI_ERROR(Status)) {
+ VA_END (Args);
+ return Status;
+ }
+ StartingLba ++;
+ NumOfLba --;
+ }
+
+ } while ( 1 );
+
+ VA_END (Args);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Writes data beginning at Lba:Offset from FV. The write terminates eith=
er
+ when *NumBytes of data have been written, or when a block boundary is
+ reached. *NumBytes is updated to reflect the actual number of bytes
+ written. The write opertion does not include erase. This routine will
+ attempt to write only the specified bytes. If the writes do not stick,
+ it will return an error.
+
+ @param[in] This Calling context
+ @param[in] Lba Block in which to begin write
+ @param[in] Offset Offset in the block at which to begin write
+ @param[in,out] NumBytes On input, indicates the requested write size=
. On
+ output, indicates the actual number of bytes=
written
+ @param[in] Buffer Buffer containing source data for the write.
+
+ @retval EFI_SUCCESS The firmware volume was written successf=
ully
+ @retval EFI_BAD_BUFFER_SIZE Write attempted across a LBA boundary. O=
n output,
+ NumBytes contains the total number of by=
tes
+ actually written
+ @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisab=
led state
+ @retval EFI_DEVICE_ERROR The block device is not functioning corr=
ectly and
+ could not be written
+ @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolWrite (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ IN UINT8 *Buffer
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+
+ DEBUG((DEBUG_INFO,
+ "FvbProtocolWrite: Lba: 0x%lx Offset: 0x%x NumBytes: 0x%x, Buffer: 0=
x%x\n",
+ Lba,
+ Offset,
+ *NumBytes,
+ Buffer)
+ );
+
+ return FvbWriteBlock (FvbInstance, Lba, Offset, NumBytes, Buffer);
+}
+
+/**
+ Reads data beginning at Lba:Offset from FV. The Read terminates either
+ when *NumBytes of data have been read, or when a block boundary is
+ reached. *NumBytes is updated to reflect the actual number of bytes
+ written. The write opertion does not include erase. This routine will
+ attempt to write only the specified bytes. If the writes do not stick,
+ it will return an error.
+
+ @param[in] This Calling context
+ @param[in] Lba Block in which to begin write
+ @param[in] Offset Offset in the block at which to begin write
+ @param[in,out] NumBytes On input, indicates the requested write size=
. On
+ output, indicates the actual number of bytes=
written
+ @param[in] Buffer Buffer containing source data for the write.
+
+ @retval EFI_SUCCESS The firmware volume was read successfull=
y and
+ contents are in Buffer
+ @retval EFI_BAD_BUFFER_SIZE Read attempted across a LBA boundary. On=
output,
+ NumBytes contains the total number of by=
tes returned
+ in Buffer
+ @retval EFI_ACCESS_DENIED The firmware volume is in the ReadDisabl=
ed state
+ @retval EFI_DEVICE_ERROR The block device is not functioning corr=
ectly and
+ could not be read
+ @retval EFI_INVALID_PARAMETER NumBytes or Buffer are NULL
+
+**/
+EFI_STATUS
+EFIAPI
+FvbProtocolRead (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ OUT UINT8 *Buffer
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+ EFI_STATUS Status;
+
+ FvbInstance =3D FVB_INSTANCE_FROM_THIS (This);
+ Status =3D FvbReadBlock (FvbInstance, Lba, Offset, NumBytes, Buffer);
+ DEBUG((DEBUG_INFO,
+ "FvbProtocolRead: Lba: 0x%lx Offset: 0x%x NumBytes: 0x%x, Buffer: 0x=
%x\n",
+ Lba,
+ Offset,
+ *NumBytes,
+ Buffer)
+ );
+
+ return Status;
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceMm.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbServi=
ce/SpiFvbServiceMm.c
new file mode 100644
index 000000000000..42a0828c6fae
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceMm.c
@@ -0,0 +1,271 @@
+/** @file
+ MM driver source for several Serial Flash devices
+ which are compliant with the Intel(R) Serial Flash Interface Compatibi=
lity Specification.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SpiFvbServiceCommon.h"
+#include <Library/MmServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Protocol/SmmFirmwareVolumeBlock.h>
+
+/**
+ The function installs EFI_FIRMWARE_VOLUME_BLOCK protocol
+ for each FV in the system.
+
+ @param[in] FvbInstance The pointer to a FW volume instance structur=
e,
+ which contains the information about one FV.
+
+ @retval VOID
+
+**/
+VOID
+InstallFvbProtocol (
+ IN EFI_FVB_INSTANCE *FvbInstance
+ )
+{
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+ EFI_STATUS Status;
+ EFI_HANDLE FvbHandle;
+
+ ASSERT (FvbInstance !=3D NULL);
+ if (FvbInstance =3D=3D NULL) {
+ return;
+ }
+
+ CopyMem (&FvbInstance->FvbProtocol, &mFvbProtocolTemplate, sizeof (EFI=
_FIRMWARE_VOLUME_BLOCK_PROTOCOL));
+
+ FvHeader =3D &FvbInstance->FvHeader;
+ if (FvHeader =3D=3D NULL) {
+ return;
+ }
+
+ //
+ // Set up the devicepath
+ //
+ DEBUG ((DEBUG_INFO, "FwBlockService.c: Setting up DevicePath for 0x%lx=
:\n", FvbInstance->FvBase));
+ if (FvHeader->ExtHeaderOffset =3D=3D 0) {
+ //
+ // FV does not contains extension header, then produce MEMMAP_DEVICE=
_PATH
+ //
+ FvbInstance->DevicePath =3D (EFI_DEVICE_PATH_PROTOCOL *) AllocateRun=
timeCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplat=
e);
+ if (FvbInstance->DevicePath =3D=3D NULL) {
+ DEBUG ((DEBUG_INFO, "SpiFvbServiceSmm.c: Memory allocation for MEM=
MAP_DEVICE_PATH failed\n"));
+ return;
+ }
+ ((FV_MEMMAP_DEVICE_PATH *) FvbInstance->DevicePath)->MemMapDevPath.S=
tartingAddress =3D FvbInstance->FvBase;
+ ((FV_MEMMAP_DEVICE_PATH *) FvbInstance->DevicePath)->MemMapDevPath.E=
ndingAddress =3D FvbInstance->FvBase + FvHeader->FvLength - 1;
+ } else {
+ FvbInstance->DevicePath =3D (EFI_DEVICE_PATH_PROTOCOL *) AllocateRun=
timeCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
+ if (FvbInstance->DevicePath =3D=3D NULL) {
+ DEBUG ((DEBUG_INFO, "SpiFvbServiceSmm.c: Memory allocation for FV_=
PIWG_DEVICE_PATH failed\n"));
+ return;
+ }
+ CopyGuid (
+ &((FV_PIWG_DEVICE_PATH *)FvbInstance->DevicePath)->FvDevPath.FvNam=
e,
+ (GUID *)(UINTN)(FvbInstance->FvBase + FvHeader->ExtHeaderOffset)
+ );
+ }
+
+ //
+ // LocateDevicePath fails so install a new interface and device path
+ //
+ FvbHandle =3D NULL;
+
+ Status =3D gMmst->MmInstallProtocolInterface (
+ &FvbHandle,
+ &gEfiSmmFirmwareVolumeBlockProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &(FvbInstance->FvbProtocol)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status =3D gMmst->MmInstallProtocolInterface (
+ &FvbHandle,
+ &gEfiDevicePathProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &(FvbInstance->DevicePath)
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ The function does the necessary initialization work for
+ Firmware Volume Block Driver.
+
+**/
+VOID
+FvbInitialize (
+ VOID
+ )
+{
+ EFI_FVB_INSTANCE *FvbInstance;
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+ EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ UINTN Idx;
+ UINT32 MaxLbaSize;
+ UINT32 BytesWritten;
+ UINTN BytesErased;
+
+ mPlatformFvBaseAddress[0].FvBase =3D PcdGet32(PcdFlashNvStorageVariabl=
eBase);
+ mPlatformFvBaseAddress[0].FvSize =3D PcdGet32(PcdFlashNvStorageVariabl=
eSize);
+ mPlatformFvBaseAddress[1].FvBase =3D PcdGet32(PcdFlashMicrocodeFvBase)=
;
+ mPlatformFvBaseAddress[1].FvSize =3D PcdGet32(PcdFlashMicrocodeFvSize)=
;
+ mPlatformDefaultBaseAddress[0].FvBase =3D PcdGet32(PcdFlashNvStorageVa=
riableBase);
+ mPlatformDefaultBaseAddress[0].FvSize =3D PcdGet32(PcdFlashNvStorageVa=
riableSize);
+ mPlatformDefaultBaseAddress[1].FvBase =3D PcdGet32(PcdFlashMicrocodeFv=
Base);
+ mPlatformDefaultBaseAddress[1].FvSize =3D PcdGet32(PcdFlashMicrocodeFv=
Size);
+
+ //
+ // We will only continue with FVB installation if the
+ // SPI is the active BIOS state
+ //
+ {
+ //
+ // Make sure all FVB are valid and/or fix if possible
+ //
+ for (Idx =3D 0;; Idx++) {
+ if (mPlatformFvBaseAddress[Idx].FvSize =3D=3D 0 && mPlatformFvBase=
Address[Idx].FvBase =3D=3D 0) {
+ break;
+ }
+
+ BaseAddress =3D mPlatformFvBaseAddress[Idx].FvBase;
+ FvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+ if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
+ BytesWritten =3D 0;
+ BytesErased =3D 0;
+ DEBUG ((DEBUG_ERROR, "ERROR - The FV in 0x%x is invalid!\n", FvH=
eader));
+ Status =3D GetFvbInfo (BaseAddress, &FvHeader);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "ERROR - Can't recovery FV header at 0x%x.=
GetFvbInfo Status %r\n", BaseAddress, Status));
+ continue;
+ }
+ DEBUG ((DEBUG_INFO, "Rewriting FV header at 0x%X with static dat=
a\n", BaseAddress));
+ //
+ // Spi erase
+ //
+ BytesErased =3D (UINTN) FvHeader->BlockMap->Length;
+ Status =3D SpiFlashBlockErase( (UINTN) BaseAddress, &BytesErased=
);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "ERROR - SpiFlashBlockErase Error %r\n", =
Status));
+ continue;
+ }
+ if (BytesErased !=3D FvHeader->BlockMap->Length) {
+ DEBUG ((DEBUG_WARN, "ERROR - BytesErased !=3D FvHeader->BlockM=
ap->Length\n"));
+ DEBUG ((DEBUG_INFO, " BytesErased =3D 0x%X\n Length =3D 0x%X\n=
", BytesErased, FvHeader->BlockMap->Length));
+ continue;
+ }
+ BytesWritten =3D FvHeader->HeaderLength;
+ Status =3D SpiFlashWrite ((UINTN)BaseAddress, &BytesWritten, (UI=
NT8*)FvHeader);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "ERROR - SpiFlashWrite Error %r\n", Statu=
s));
+ continue;
+ }
+ if (BytesWritten !=3D FvHeader->HeaderLength) {
+ DEBUG ((DEBUG_WARN, "ERROR - BytesWritten !=3D HeaderLength\n"=
));
+ DEBUG ((DEBUG_INFO, " BytesWritten =3D 0x%X\n HeaderLength =3D=
0x%X\n", BytesWritten, FvHeader->HeaderLength));
+ continue;
+ }
+ Status =3D SpiFlashLock ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN, "ERROR - SpiFlashLock Error %r\n", Status=
));
+ continue;
+ }
+ DEBUG ((DEBUG_INFO, "FV Header @ 0x%X restored with static data\=
n", BaseAddress));
+ //
+ // Clear cache for this range.
+ //
+ WriteBackInvalidateDataCacheRange ( (VOID *) (UINTN) BaseAddress=
, FvHeader->BlockMap->Length);
+ }
+ }
+
+ //
+ // Calculate the total size for all firmware volume block instances
+ //
+ BufferSize =3D 0;
+ for (Idx =3D 0; ; Idx++) {
+ if (mPlatformFvBaseAddress[Idx].FvSize =3D=3D 0 && mPlatformFvBase=
Address[Idx].FvBase =3D=3D 0) {
+ break;
+ }
+ BaseAddress =3D mPlatformFvBaseAddress[Idx].FvBase;
+ FvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+ if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
+ DEBUG ((DEBUG_WARN, "ERROR - The FV in 0x%x is invalid!\n", FvHe=
ader));
+ continue;
+ }
+
+ BufferSize +=3D (FvHeader->HeaderLength +
+ sizeof (EFI_FVB_INSTANCE) -
+ sizeof (EFI_FIRMWARE_VOLUME_HEADER)
+ );
+ }
+
+ mFvbModuleGlobal.FvbInstance =3D (EFI_FVB_INSTANCE *) AllocateRunti=
meZeroPool (BufferSize);
+ if (mFvbModuleGlobal.FvbInstance =3D=3D NULL) {
+ ASSERT (FALSE);
+ return;
+ }
+
+ MaxLbaSize =3D 0;
+ FvbInstance =3D mFvbModuleGlobal.FvbInstance;
+ mFvbModuleGlobal.NumFv =3D 0;
+
+ for (Idx =3D 0; ; Idx++) {
+ if (mPlatformFvBaseAddress[Idx].FvSize =3D=3D 0 && mPlatformFvBase=
Address[Idx].FvBase =3D=3D 0) {
+ break;
+ }
+ BaseAddress =3D mPlatformFvBaseAddress[Idx].FvBase;
+ FvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+ if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
+ DEBUG ((DEBUG_WARN, "ERROR - The FV in 0x%x is invalid!\n", FvHe=
ader));
+ continue;
+ }
+
+ FvbInstance->Signature =3D FVB_INSTANCE_SIGNATURE;
+ CopyMem (&(FvbInstance->FvHeader), FvHeader, FvHeader->HeaderLengt=
h);
+
+ FvHeader =3D &(FvbInstance->FvHeader);
+ FvbInstance->FvBase =3D (UINTN)BaseAddress;
+
+ //
+ // Process the block map for each FV
+ //
+ FvbInstance->NumOfBlocks =3D 0;
+ for (PtrBlockMapEntry =3D FvHeader->BlockMap;
+ PtrBlockMapEntry->NumBlocks !=3D 0;
+ PtrBlockMapEntry++) {
+ //
+ // Get the maximum size of a block.
+ //
+ if (MaxLbaSize < PtrBlockMapEntry->Length) {
+ MaxLbaSize =3D PtrBlockMapEntry->Length;
+ }
+ FvbInstance->NumOfBlocks +=3D PtrBlockMapEntry->NumBlocks;
+ }
+
+ //
+ // Add a FVB Protocol Instance
+ //
+ InstallFvbProtocol (FvbInstance);
+ mFvbModuleGlobal.NumFv++;
+
+ //
+ // Move on to the next FvbInstance
+ //
+ FvbInstance =3D (EFI_FVB_INSTANCE *) ((UINTN)((UINT8 *)FvbInstance=
) +
+ FvHeader->HeaderLength +
+ (sizeof (EFI_FVB_INSTANCE) -=
sizeof (EFI_FIRMWARE_VOLUME_HEADER)));
+
+ }
+ }
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceStandaloneMm.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/S=
piFvbService/SpiFvbServiceStandaloneMm.c
new file mode 100644
index 000000000000..252c818d6551
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceStandaloneMm.c
@@ -0,0 +1,32 @@
+/** @file
+ MM driver source for several Serial Flash devices
+ which are compliant with the Intel(R) Serial Flash Interface Compatibi=
lity Specification.
+
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SpiFvbServiceCommon.h"
+#include "SpiFvbServiceMm.h"
+
+/**
+ The driver Standalone MM entry point.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] MmSystemTable A pointer to the MM system table.
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCE=
SS.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFvbStandaloneMmInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *MmSystemTable
+ )
+{
+ FvbInitialize ();
+
+ return EFI_SUCCESS;
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceTraditionalMm.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/=
SpiFvbService/SpiFvbServiceTraditionalMm.c
new file mode 100644
index 000000000000..1c2dac70e3c6
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceTraditionalMm.c
@@ -0,0 +1,32 @@
+/** @file
+ MM driver source for several Serial Flash devices
+ which are compliant with the Intel(R) Serial Flash Interface Compatibi=
lity Specification.
+
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SpiFvbServiceCommon.h"
+#include "SpiFvbServiceMm.h"
+
+/**
+ The driver Traditional MM entry point.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable A pointer to the EFI system table.
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCE=
SS.
+
+**/
+EFI_STATUS
+EFIAPI
+SpiFvbTraditionalMmInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ FvbInitialize ();
+
+ return EFI_SUCCESS;
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceCommon.h b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbS=
ervice/SpiFvbServiceCommon.h
new file mode 100644
index 000000000000..e9d69e985814
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceCommon.h
@@ -0,0 +1,158 @@
+/** @file
+ Common source definitions used in serial flash drivers
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SPI_FVB_SERVICE_COMMON_H
+#define _SPI_FVB_SERVICE_COMMON_H
+
+#include <Guid/EventGroup.h>
+#include <Guid/FirmwareFileSystem2.h>
+#include <Guid/SystemNvDataGuid.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/FirmwareVolumeBlock.h>
+
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IoLib.h>
+#include <Library/CacheMaintenanceLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/HobLib.h>
+
+#include <Library/SpiFlashCommonLib.h>
+
+//
+// Define two helper macro to extract the Capability field or Status fie=
ld in FVB
+// bit fields
+//
+#define EFI_FVB2_CAPABILITIES (EFI_FVB2_READ_DISABLED_CAP | \
+ EFI_FVB2_READ_ENABLED_CAP | \
+ EFI_FVB2_WRITE_DISABLED_CAP | \
+ EFI_FVB2_WRITE_ENABLED_CAP | \
+ EFI_FVB2_LOCK_CAP \
+ )
+
+#define EFI_FVB2_STATUS (EFI_FVB2_READ_STATUS | EFI_FVB2_WRITE_STATUS | =
EFI_FVB2_LOCK_STATUS)
+
+#define FVB_INSTANCE_SIGNATURE SIGNATURE_32('F','V','B','I')
+
+typedef struct {
+ UINT32 Signature;
+ UINTN FvBase;
+ UINTN NumOfBlocks;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FvbProtocol;
+ EFI_FIRMWARE_VOLUME_HEADER FvHeader;
+} EFI_FVB_INSTANCE;
+
+typedef struct {
+ EFI_FVB_INSTANCE *FvbInstance;
+ UINT32 NumFv;
+} FVB_GLOBAL;
+
+//
+// Fvb Protocol instance data
+//
+#define FVB_INSTANCE_FROM_THIS(a) CR(a, EFI_FVB_INSTANCE, FvbProtocol, F=
VB_INSTANCE_SIGNATURE)
+
+typedef struct {
+ MEDIA_FW_VOL_DEVICE_PATH FvDevPath;
+ EFI_DEVICE_PATH_PROTOCOL EndDevPath;
+} FV_PIWG_DEVICE_PATH;
+
+typedef struct {
+ MEMMAP_DEVICE_PATH MemMapDevPath;
+ EFI_DEVICE_PATH_PROTOCOL EndDevPath;
+} FV_MEMMAP_DEVICE_PATH;
+
+typedef struct {
+ UINT32 FvBase;
+ UINT32 FvSize;
+} FV_INFO;
+
+//
+// Protocol APIs
+//
+EFI_STATUS
+EFIAPI
+FvbProtocolGetAttributes (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolSetAttributes (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolGetPhysicalAddress (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ OUT EFI_PHYSICAL_ADDRESS *Address
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolGetBlockSize (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ OUT UINTN *BlockSize,
+ OUT UINTN *NumOfBlocks
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolRead (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ OUT UINT8 *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolWrite (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN EFI_LBA Lba,
+ IN UINTN Offset,
+ IN OUT UINTN *NumBytes,
+ IN UINT8 *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+FvbProtocolEraseBlocks (
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ ...
+ );
+
+BOOLEAN
+IsFvHeaderValid (
+ IN EFI_PHYSICAL_ADDRESS FvBase,
+ IN CONST EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
+ );
+
+EFI_STATUS
+GetFvbInfo (
+ IN EFI_PHYSICAL_ADDRESS FvBaseAddress,
+ OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
+ );
+
+extern FVB_GLOBAL mFvbModuleGlobal;
+extern FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate;
+extern FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate;
+extern EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL mFvbProtocolTemplate;
+extern FV_INFO mPlatformFvBaseAddress[];
+extern FV_INFO mPlatformDefaultBaseAddress[];
+
+#endif
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceMm.h b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbServi=
ce/SpiFvbServiceMm.h
new file mode 100644
index 000000000000..36af1130c8ee
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceMm.h
@@ -0,0 +1,22 @@
+/** @file
+ Definitions common to MM implementation in this driver.
+
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _SPI_FVB_SERVICE_MM_H_
+#define _SPI_FVB_SERVICE_MM_H_
+
+/**
+ The function does the necessary initialization work for
+ Firmware Volume Block Driver.
+
+**/
+VOID
+FvbInitialize (
+ VOID
+ );
+
+#endif
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceSmm.inf b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbSe=
rvice/SpiFvbServiceSmm.inf
new file mode 100644
index 000000000000..bf1306f00201
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceSmm.inf
@@ -0,0 +1,68 @@
+### @file
+# Component description file for the Serial Flash device Runtime driver.
+#
+# Copyright (c) 2017-2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION =3D 0x00010017
+ BASE_NAME =3D SpiFvbServiceSmm
+ FILE_GUID =3D 68A10D85-6858-4402-B070-028B3EA2174=
7
+ VERSION_STRING =3D 1.0
+ MODULE_TYPE =3D DXE_SMM_DRIVER
+ PI_SPECIFICATION_VERSION =3D 1.10
+ ENTRY_POINT =3D SpiFvbTraditionalMmInitialize
+
+#
+# The following information is for reference only and not required by th=
e build tools.
+#
+# VALID_ARCHITECTURES =3D IA32 X64
+#
+
+[LibraryClasses]
+ PcdLib
+ MemoryAllocationLib
+ CacheMaintenanceLib
+ BaseMemoryLib
+ DebugLib
+ BaseLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ SpiFlashCommonLib
+ MmServicesTableLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ IntelSiliconPkg/IntelSiliconPkg.dec
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONS=
UMES
+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase ## CONS=
UMES
+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize ## CONS=
UMES
+
+[Sources]
+ FvbInfo.c
+ SpiFvbServiceCommon.h
+ SpiFvbServiceCommon.c
+ SpiFvbServiceMm.h
+ SpiFvbServiceMm.c
+ SpiFvbServiceTraditionalMm.c
+
+[Protocols]
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiSmmFirmwareVolumeBlockProtocolGuid ## PRODUCES
+
+[Guids]
+ gEfiFirmwareFileSystem2Guid ## CONSUMES
+ gEfiSystemNvDataFvGuid ## CONSUMES
+
+[Depex]
+ TRUE
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/Sp=
iFvbServiceStandaloneMm.inf b/Silicon/Intel/IntelSiliconPkg/Feature/Flash=
/SpiFvbService/SpiFvbServiceStandaloneMm.inf
new file mode 100644
index 000000000000..b66233968247
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSer=
viceStandaloneMm.inf
@@ -0,0 +1,67 @@
+### @file
+# Component description file for the Serial Flash device Standalone MM d=
river.
+#
+# Copyright (c) 2017-2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION =3D 0x0001001B
+ BASE_NAME =3D SpiFvbServiceStandaloneMm
+ FILE_GUID =3D E6313655-8BD0-4EAB-B319-AD5E212CE6A=
B
+ VERSION_STRING =3D 1.0
+ MODULE_TYPE =3D MM_STANDALONE
+ PI_SPECIFICATION_VERSION =3D 0x00010032
+ ENTRY_POINT =3D SpiFvbStandaloneMmInitialize
+
+#
+# The following information is for reference only and not required by th=
e build tools.
+#
+# VALID_ARCHITECTURES =3D IA32 X64
+#
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ CacheMaintenanceLib
+ DebugLib
+ MemoryAllocationLib
+ PcdLib
+ MmServicesTableLib
+ SpiFlashCommonLib
+ StandaloneMmDriverEntryPoint
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ IntelSiliconPkg/IntelSiliconPkg.dec
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONS=
UMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONS=
UMES
+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase ## CONS=
UMES
+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize ## CONS=
UMES
+
+[Sources]
+ FvbInfo.c
+ SpiFvbServiceCommon.h
+ SpiFvbServiceCommon.c
+ SpiFvbServiceMm.h
+ SpiFvbServiceMm.c
+ SpiFvbServiceStandaloneMm.c
+
+[Protocols]
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiSmmFirmwareVolumeBlockProtocolGuid ## PRODUCES
+
+[Guids]
+ gEfiFirmwareFileSystem2Guid ## CONSUMES
+ gEfiSystemNvDataFvGuid ## CONSUMES
+
+[Depex]
+ TRUE
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/=
Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
index d4e15100bfde..1e826a080f28 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -40,6 +40,9 @@ [LibraryClasses]
PeiGetVtdPmrAlignmentLib|IntelSiliconPkg/Library/PeiGetVtdPmrAlignment=
Lib/PeiGetVtdPmrAlignmentLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasur=
ementLibNull.inf
MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
+ SpiFlashCommonLib|IntelSiliconPkg/Library/SpiFlashCommonLibNull/SpiFla=
shCommonLibNull.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB=
ootServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt=
ryPoint.inf
=20
[LibraryClasses.common.PEIM]
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
@@ -61,8 +64,14 @@ [LibraryClasses.common.DXE_DRIVER]
=20
[LibraryClasses.common.DXE_SMM_DRIVER]
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAll=
ocationLib.inf
+ MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLi=
b.inf
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTabl=
eLib.inf
=20
+[LibraryClasses.common.MM_STANDALONE]
+ MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocati=
onLib/StandaloneMmMemoryAllocationLib.inf
+ MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standal=
oneMmServicesTableLib.inf
+ StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoi=
nt/StandaloneMmDriverEntryPoint.inf
+
########################################################################=
###########################
#
# Components Section - list of the modules and components that will be p=
rocessed by compilation
@@ -86,6 +95,8 @@ [Components]
IntelSiliconPkg/Library/DxeSmbiosDataHobLib/DxeSmbiosDataHobLib.inf
IntelSiliconPkg/Feature/PcieSecurity/IntelPciDeviceSecurityDxe/IntelPc=
iDeviceSecurityDxe.inf
IntelSiliconPkg/Feature/PcieSecurity/SamplePlatformDevicePolicyDxe/Sam=
plePlatformDevicePolicyDxe.inf
+ IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+ IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.=
inf
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf
IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/IntelVTdDmarPei.inf
IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
--=20
2.28.0.windows.1


[edk2-platforms][PATCH v5 00/46] Consolidate SpiFlashCommonLib instances

Michael Kubacki
 

From: Michael Kubacki <michael.kubacki@...>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307

SpiFlashCommonLib is duplicated in multiple places across the MinPlatform
design in edk2-platforms. I'm planning to build some additional
functionality on top of SpiFlashCommonLib and, ideally, this duplication
will be consolidated into a single instance usable across all current lib=
rary
consumers.

This patch series focuses on consolidating the various SpiFlashCommonLib
instances as agreed upon in https://edk2.groups.io/g/devel/message/71701.

Read the BZ for more general background around this series.

I only have an UpXtreme board on hand so maintainers/reviewers of other
board packages should test these changes on those boards.

V5 changes:
- Added build support for PurleyOpenBoardPkg and WhitleyOpenBoardPkg
(added to edk2-platforms during the lifetime of this patch series).
- Updated KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlash to
use the new SPI PPI interface that identifies SPI flash regions
by GUID.
- Added new Reviewed-by replies that came in to existing patches
during v4.

V4 changes:
- Assigned new GUID values to the PCH SPI PPI and Protocols to
differentiate from previous instances. This was done because
the interface changed to identify SPI flash regions by GUID.

V3 changes:
- Added support to IntelSiliconPkg to identify flash regions by GUID as
requested in v2 review feedback.
V2 changes:
- Rebased patch series on current edk2-platforms master (32183bdaa91)

Note: Previous patch series only received a couple review comments after
being on the mailing list for over 2 months. Please be respectful of
contributors time and efforts and review in a timely manner.

Cc: Agyeman Prince <prince.agyeman@...>
Cc: Chasel Chiu <chasel.chiu@...>
Cc: Deepika Kethi Reddy <deepika.kethi.reddy@...>
Cc: Eric Dong <eric.dong@...>
Cc: Heng Luo <heng.luo@...>
Cc: Jeremy Soller <jeremy@...>
Cc: Kathappan Esakkithevar <kathappan.esakkithevar@...>
Cc: Liming Gao <gaoliming@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>

Michael Kubacki (46):
CometlakeOpenBoardPkg: Remove redundant IntelSiliconPkg.dec entry
WhiskeylakeOpenBoardPkg: Remove redundant IntelSiliconPkg.dec entry
CometlakeOpenBoardPkg/PeiPolicyUpdateLib: Add missing GUID to INF
IntelSiliconPkg: Add BIOS area base address and size PCDs
IntelSiliconPkg: Add microcode FV PCDs
IntelSiliconPkg: Add PCH SPI PPI
IntelSiliconPkg: Add PCH SPI Protocol
IntelSiliconPkg: Add SpiFlashCommonLib
IntelSiliconPkg: Add SmmSpiFlashCommonLib
IntelSiliconPkg: Add MM SPI FVB services
CometlakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
KabylakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
SimicsOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
TigerlakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
WhiskeylakeOpenBoardPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
CoffeelakeSiliconPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
KabylakeSiliconPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
SimicsIch10Pkg: Use IntelSiliconPkg BIOS area and ucode PCDs
TigerlakeSiliconPkg: Use IntelSiliconPkg BIOS area and ucode PCDs
CometlakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib
KabylakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib
SimicsOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib
TigerlakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib
WhiskeylakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib
PurleyOpenBoardPkg: Use IntelSiliconPkg SpiFvbServiceSmm
WhitleyOpenBoardPkg: UseIntelSiliconPkg SpiFvbServiceSmm
MinPlatformPkg: Remove SpiFvbService modules
CoffeelakeSiliconPkg: Remove SmmSpiFlashCommonLib
KabylakeSiliconPkg: Remove SmmSpiFlashCommonLib
SimicsIch10Pkg: Remove SmmSpiFlashCommonLib
TigerlakeOpenBoardPkg: Remove SmmSpiFlashCommonLib
MinPlatformPkg: Remove SpiFlashCommonLibNull
PurleyOpenBoardPkg: Add SpiFlashCommonLib.h
KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Add IntelSiliconPkg.dec
CoffeelakeSiliconPkg: Remove PCH SPI PPI and Protocol from package
KabylakeSiliconPkg: Remove PCH SPI PPI and Protocol from package
SimicsIch10Pkg: Remove PCH SPI SMM Protocol from package
TigerlakeSiliconPkg: Remove PCH SPI PPI and Protocol from package
IntelSiliconPkg: Add flash region GUIDs
IntelSiliconPkg: Identify flash regions by GUID
CoffeelakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by
GUID
KabylakeSiliconPkg: Identify flash regions by GUID
KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Update for new SPI PPI
API
KabylakeOpenBoardPkg/KabylakeRvp3: Add PeiSerialPortlibSpiFlash to
build
SimicsIch10Pkg/BasePchSpiCommonLib: Identify flash regions by GUID
TigerlakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by
GUID

Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlash/Pei=
SerialPortLibSpiFlash.c =
| 4 +-
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommonL=
ib/SpiCommon.c =
| 144 ++++++++--
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SpiF=
lashCommon.c =
| 196 -------------
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SpiF=
lashCommonSmmLib.c =
| 54 ----
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/FvbInfo.c =
| 0
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceCommon.c =
| 4 +-
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceMm.c =
| 8 +-
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c =
| 0
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c =
| 0
Platform/Intel/TigerlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/SpiFla=
shCommonSmmLib.c =3D> Silicon/Intel/IntelSiliconPkg/Library/SmmSpiFlashCo=
mmonLib/SmmSpiFlashCommonLib.c | 2 +-
{Platform/Intel/TigerlakeOpenBoardPkg =3D> Silicon/Intel/IntelSiliconPkg=
}/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c =
| 7 +-
{Platform/Intel/MinPlatformPkg/Flash =3D> Silicon/Intel/IntelSiliconPkg}=
/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.c =
| 12 +-
Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c=
=
| 106 ++++++-
Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SpiFla=
shCommon.c =
| 196 -------------
Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SpiFla=
shCommonSmmLib.c =
| 54 ----
Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/=
SpiCommon.c =
| 140 +++++++--
Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon=
.c =
| 194 -------------
Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommonLib/SpiFlashCommon=
SmmLib.c =
| 54 ----
Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCommo=
n.c =
| 165 ++++++++---
Silicon/Intel/SimicsIch10Pkg/Spi/Smm/PchSpi.c =
=
| 4 +-
Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiComm=
onLib/SpiCommon.c =
| 176 ++++++++++--
Platform/Intel/CometlakeOpenBoardPkg/BiosInfo/BiosInfo.inf =
=
| 4 +-
Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/Include/Fdf/FlashMapI=
nclude.fdf =
| 4 +-
Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc =
=
| 7 +-
Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.fdf =
=
| 38 +--
Platform/Intel/CometlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/P=
eiPolicyUpdateLib.inf =
| 2 +-
Platform/Intel/CometlakeOpenBoardPkg/Policy/PolicyInitDxe/PolicyInitDxe.=
inf =
| 4 +-
Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf =
=
| 4 +-
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Include/Fdf/FlashMapInclu=
de.fdf =
| 4 +-
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc =
=
| 7 +-
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf =
=
| 40 +--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Include/Fdf/FlashMapInc=
lude.fdf =
| 4 +-
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc =
=
| 9 +-
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf =
=
| 40 +--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSilic=
onPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf =
| 4 +-
Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlash/Pei=
SerialPortLibSpiFlash.inf =
| 2 +
Platform/Intel/MinPlatformPkg/Include/Library/SpiFlashCommonLib.h =
=
| 98 -------
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec =
=
| 2 -
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc =
=
| 6 -
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc =
=
| 2 +-
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf =
=
| 2 +-
Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc =
=
| 4 +-
Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.fdf =
=
| 5 +-
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc =
=
| 6 +-
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf =
=
| 2 +-
Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf.inc =
=
| 8 +-
Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf =
=
| 8 +-
Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/Include/Fdf/FlashMapI=
nclude.fdf =
| 4 +-
Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc =
=
| 7 +-
Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.fdf =
=
| 40 +--
Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf =
=
| 4 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib=
/PeiPolicyUpdateLib.inf =
| 1 -
Platform/Intel/WhiskeylakeOpenBoardPkg/Policy/PolicyInitDxe/PolicyInitDx=
e.inf =
| 4 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapIncl=
ude.fdf =
| 4 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Library/BoardInitLib/Pei=
MultiBoardInitPreMemLib.inf =
| 2 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc =
=
| 7 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf =
=
| 38 +--
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Include/Fdf/Flash=
MapInclude.fdf =
| 4 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc =
=
| 7 +-
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf =
=
| 38 +--
{Silicon/Intel/CoffeelakeSiliconPkg/Pch =3D> Platform/Intel/WhitleyOpenB=
oardPkg}/Include/Library/SpiFlashCommonLib.h =
| 2 +-
Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc =
=
| 2 +-
Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.fdf =
=
| 5 +-
Silicon/Intel/CoffeelakeSiliconPkg/Cpu/Library/PeiCpuPolicyLib/PeiCpuPol=
icyLib.inf =
| 4 +-
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/PchSpiCom=
monLib.h =
| 16 +-
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/PeiSpiLib/PeiSpiLib.inf =
=
| 1 +
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommonL=
ib/BasePchSpiCommonLib.inf =
| 13 +
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SmmS=
piFlashCommonLib.inf =
| 51 ----
Silicon/Intel/CoffeelakeSiliconPkg/Pch/Spi/Smm/PchSpiSmm.inf =
=
| 1 +
Silicon/Intel/CoffeelakeSiliconPkg/SiPkg.dec =
=
| 8 -
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceCommon.h =
| 0
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceMm.h =
| 0
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceSmm.inf =
| 6 +-
{Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg/Featur=
e}/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf =
| 6 +-
Silicon/Intel/IntelSiliconPkg/Include/Guid/FlashRegion.h =
=
| 45 +++
Silicon/Intel/{SimicsIch10Pkg =3D> IntelSiliconPkg}/Include/Library/SpiF=
lashCommonLib.h =
| 2 +-
Silicon/Intel/{CoffeelakeSiliconPkg/Pch =3D> IntelSiliconPkg}/Include/Pp=
i/Spi.h =
| 4 +-
Silicon/Intel/{CoffeelakeSiliconPkg/Pch =3D> IntelSiliconPkg}/Include/Pr=
otocol/Spi.h =
| 39 +--
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec =
=
| 37 +++
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc =
=
| 17 ++
{Platform/Intel/TigerlakeOpenBoardPkg =3D> Silicon/Intel/IntelSiliconPkg=
}/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf =
| 24 +-
{Platform/Intel/MinPlatformPkg/Flash =3D> Silicon/Intel/IntelSiliconPkg}=
/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf =
| 3 +-
Silicon/Intel/KabylakeSiliconPkg/Cpu/Library/PeiCpuPolicyLib/PeiCpuPolic=
yLib.inf =
| 4 +-
Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf =
=
| 12 +-
Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/SpiFlashCommonLib.h=
=
| 98 -------
Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Ppi/Spi.h =
=
| 26 --
Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Protocol/Spi.h =
=
| 293 -------------------
Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommon=
Lib.h =
| 20 +-
Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiSpiLib/PeiSpiLib.inf =
=
| 1 +
Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFlashCommonLib/SmmSpi=
FlashCommonLib.inf =
| 53 ----
Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/=
BasePchSpiCommonLib.inf =
| 11 +
Silicon/Intel/KabylakeSiliconPkg/Pch/Spi/Smm/PchSpiSmm.inf =
=
| 1 +
Silicon/Intel/KabylakeSiliconPkg/SiPkg.dec =
=
| 13 +-
Silicon/Intel/SimicsIch10Pkg/Ich10Pkg.dec =
=
| 11 -
Silicon/Intel/SimicsIch10Pkg/Include/Protocol/Spi.h =
=
| 295 -------------------
Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLib.h =
=
| 46 +--
Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommonLib/SmmSpiFlashCom=
monLib.inf =
| 50 ----
Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/BasePchS=
piCommonLib.inf =
| 16 +-
Silicon/Intel/SimicsIch10Pkg/Spi/Smm/PchSpiSmm.inf =
=
| 3 +-
Silicon/Intel/TigerlakeSiliconPkg/Include/Protocol/Spi.h =
=
| 301 --------------------
Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/Spi=
CommonLib.h =
| 16 +-
Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiComm=
onLib/BaseSpiCommonLib.inf =
| 19 +-
Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf =
=
| 1 +
Silicon/Intel/TigerlakeSiliconPkg/Pch/PchInit/Dxe/PchInitDxeTgl.inf =
=
| 1 +
Silicon/Intel/TigerlakeSiliconPkg/SiPkg.dec =
=
| 8 -
105 files changed, 1101 insertions(+), 2480 deletions(-)
delete mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpi=
FlashCommonLib/SpiFlashCommon.c
delete mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpi=
FlashCommonLib/SpiFlashCommonSmmLib.c
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/FvbInfo.c (100%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceCommon.c (96%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceMm.c (94%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c (100%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c (100%)
rename Platform/Intel/TigerlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib=
/SpiFlashCommonSmmLib.c =3D> Silicon/Intel/IntelSiliconPkg/Library/SmmSpi=
FlashCommonLib/SmmSpiFlashCommonLib.c (90%)
rename {Platform/Intel/TigerlakeOpenBoardPkg =3D> Silicon/Intel/IntelSil=
iconPkg}/Library/SmmSpiFlashCommonLib/SpiFlashCommon.c (93%)
rename {Platform/Intel/MinPlatformPkg/Flash =3D> Silicon/Intel/IntelSili=
conPkg}/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.c (83%)
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFl=
ashCommonLib/SpiFlashCommon.c
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFl=
ashCommonLib/SpiFlashCommonSmmLib.c
delete mode 100644 Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommo=
nLib/SpiFlashCommon.c
delete mode 100644 Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommo=
nLib/SpiFlashCommonSmmLib.c
delete mode 100644 Platform/Intel/MinPlatformPkg/Include/Library/SpiFlas=
hCommonLib.h
rename {Silicon/Intel/CoffeelakeSiliconPkg/Pch =3D> Platform/Intel/Whitl=
eyOpenBoardPkg}/Include/Library/SpiFlashCommonLib.h (96%)
delete mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/SmmSpi=
FlashCommonLib/SmmSpiFlashCommonLib.inf
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceCommon.h (100%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceMm.h (100%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceSmm.inf (88%)
rename {Platform/Intel/MinPlatformPkg =3D> Silicon/Intel/IntelSiliconPkg=
/Feature}/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf (88%)
create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Guid/FlashRegio=
n.h
rename Silicon/Intel/{SimicsIch10Pkg =3D> IntelSiliconPkg}/Include/Libra=
ry/SpiFlashCommonLib.h (96%)
rename Silicon/Intel/{CoffeelakeSiliconPkg/Pch =3D> IntelSiliconPkg}/Inc=
lude/Ppi/Spi.h (85%)
rename Silicon/Intel/{CoffeelakeSiliconPkg/Pch =3D> IntelSiliconPkg}/Inc=
lude/Protocol/Spi.h (89%)
rename {Platform/Intel/TigerlakeOpenBoardPkg =3D> Silicon/Intel/IntelSil=
iconPkg}/Library/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf (67%)
rename {Platform/Intel/MinPlatformPkg/Flash =3D> Silicon/Intel/IntelSili=
conPkg}/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf (91%)
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/=
SpiFlashCommonLib.h
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Ppi/Spi.=
h
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Protocol=
/Spi.h
delete mode 100644 Silicon/Intel/KabylakeSiliconPkg/Pch/Library/SmmSpiFl=
ashCommonLib/SmmSpiFlashCommonLib.inf
delete mode 100644 Silicon/Intel/SimicsIch10Pkg/Include/Protocol/Spi.h
delete mode 100644 Silicon/Intel/SimicsIch10Pkg/Library/SmmSpiFlashCommo=
nLib/SmmSpiFlashCommonLib.inf
delete mode 100644 Silicon/Intel/TigerlakeSiliconPkg/Include/Protocol/Sp=
i.h

--=20
2.28.0.windows.1


Re: [PATCH v2 3/4] ArmPlatformPkg: retreive error source descriptors from MM

Sami Mujawar
 

Hi Omkar,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar


On 10/07/2021 05:18 PM, Omkar Anand Kulkarni wrote:
Add a driver that retreives error source descriptors from MM and
populates those into the HEST ACPI table. The error source descriptors
that are available from the MM side are retreived using MM Communicate 2
protocol.

The first call into the MM returns the size of MM Communicate buffer
required to hold all error source descriptor info. The communication
buffer of that size is then allocated and the second call into MM
returns the error source descriptors in the communication buffer.
The retreived error source descriptors are then appended to the HEST
table.

Co-authored-by: Thomas Abraham <thomas.abraham@...>
Signed-off-by: Omkar Anand Kulkarni <omkar.kulkarni@...>
---
 ArmPlatformPkg/ArmPlatformPkg.dec                                         |   7 +
 ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf          |  44 +++
 ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.inf |  51 ++++
 ArmPlatformPkg/Drivers/HestMmErrorSources/HestMmErrorSourceCommon.h       |  37 +++
 ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.c            | 308 +++++++++++++++++++
 ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.c   | 312 ++++++++++++++++++++
[SAMI] Should this patch be split into 2?
 6 files changed, 759 insertions(+)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index 4f062292663b..846b3e863aa9 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -52,6 +52,8 @@
 
 [Guids.common]
   gArmPlatformTokenSpaceGuid   = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }
+  gArmPlatformHestErrorSourcesGuid = { 0x76b8ab43, 0x822d, 0x4b00, { 0x9f, 0xd0, 0xf4, 0xa5, 0x35, 0x82, 0x47, 0x0a } }
+  gMmHestGetErrorSourceInfoGuid = { 0x7d602951, 0x678e, 0x4cc4, { 0x98, 0xd9, 0xe3, 0x76, 0x04, 0xf6, 0x93, 0x0d } }
 
 [PcdsFeatureFlag.common]
   gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|FALSE|BOOLEAN|0x00000004
@@ -128,6 +130,11 @@
 
   gArmPlatformTokenSpaceGuid.PcdWatchdogCount|0x0|UINT32|0x00000033
 
+[PcdsFixedAtBuild, PcdsPatchableInModule]
+  ## ACPI CPER memory space
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase|0x00000000|UINT64|0x00000046
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize|0x00000000|UINT64|0x00000047
+
 [Protocols.common]
   ## Arm Platform HEST table generation protocol
   gHestTableProtocolGuid = { 0x705bdcd9, 0x8c47, 0x457e, { 0xad, 0x0d, 0xf7, 0x86, 0xf3, 0x4a, 0x0d, 0x63 } }
diff --git a/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf
new file mode 100644
index 000000000000..5227dea91630
--- /dev/null
+++ b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf
@@ -0,0 +1,44 @@
+## @file
+#  DXE driver to get secure error sources.
+#
+#  DXE driver to retrieve the error source descriptors from Standalone MM and
+#  append those to the HEST table.
+#
+#  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = HestMmErrorSourceDxe
+  FILE_GUID                      = 76b8ab43-822d-4b00-9fd0-f4a53582470a
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = HestErrorSourceInitialize
+
+[Sources.common]
+  HestErrorSourceDxe.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  DxeServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Guids]
+  gMmHestGetErrorSourceInfoGuid                  ## PRODUCES
+
+[Protocols]
+  gHestTableProtocolGuid                         ## CONSUMES
+  gEfiMmCommunication2ProtocolGuid
+
+[Depex]
+  gHestTableProtocolGuid AND gEfiMmCommunication2ProtocolGuid
diff --git a/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.inf b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.inf
new file mode 100644
index 000000000000..9d566de9bec3
--- /dev/null
+++ b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.inf
@@ -0,0 +1,51 @@
+## @file
+#  HEST error source gateway Standalone MM driver.
+#
+#  Collects HEST error source descriptors,by communicating with all the MM
+#  drivers implementing the HEST error source descriptor protocol.
+#
+#  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = HestErrorSourceStandaloneMm
+  FILE_GUID                      = 3ddbebcc-9841-4ef8-87fa-305843c1922d
+  MODULE_TYPE                    = MM_STANDALONE
+  VERSION_STRING                 = 1.0
+  PI_SPECIFICATION_VERSION       = 0x00010032
+  ENTRY_POINT                    = StandaloneMmHestErrorSourceInitialize
+
+[Sources]
+  HestErrorSourceStandaloneMm.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  ArmSvcLib
+  BaseMemoryLib
+  DebugLib
+  MemoryAllocationLib
+  StandaloneMmDriverEntryPoint
+
+[Protocols]
+  gMmHestErrorSourceDescProtocolGuid
+
+[Guids]
+  gMmHestGetErrorSourceInfoGuid               ##PRODUCES
+  gEfiStandaloneMmNonSecureBufferGuid
+
+[FixedPcd]
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase
+  gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize
+
+[Depex]
+  TRUE
diff --git a/ArmPlatformPkg/Drivers/HestMmErrorSources/HestMmErrorSourceCommon.h b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestMmErrorSourceCommon.h
new file mode 100644
index 000000000000..6ddc6bd21922
--- /dev/null
+++ b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestMmErrorSourceCommon.h
@@ -0,0 +1,37 @@
+/** @file
+  Data structures for error source descriptor information.
+
+  This data structure forms the CommBuffer part of the MM Communication
+  protocol used for communicating the Hardware Error sources form MM to
+  Non-MM environment.
+
+  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef HEST_ERROR_SOURCE_DESCRIPTOR_H_
+#define HEST_ERROR_SOURCE_DESCRIPTOR_H_
+
+#define HEST_ERROR_SOURCE_DESC_INFO_SIZE \
+  (OFFSET_OF (HEST_ERROR_SOURCE_DESC_INFO, ErrSourceDescList))
[SAMI] I feel there can be a simple way to do this, see the comments below.
+
+//
+// Data Structure to communicate the error source descriptor information from
+// Standalone MM.
+//
+typedef struct {
+  //
+  // Total count of error source descriptors.
+  //
+  UINTN ErrSourceDescCount;
+  //
+  // Total size of all the error source descriptors.
+  //
[SAMI] Does the Total size also include the size of ErrSourceDescCount and ErrSourceDescSize? 
+  UINTN ErrSourceDescSize;
[SAMI] Can the first 2 fields of this structure be moved to a structure called HEST_ERROR_SOURCE_DESC_HEADER? I think it may simplify computing of the size of HEST_ERROR_SOURCE_DESC_INFO.
[/SAMI]
+  //
+  // Array of error source descriptors that is ErrSourceDescSize in size.
+  //
+  UINT8 ErrSourceDescList[1];
+} HEST_ERROR_SOURCE_DESC_INFO;
+
+#endif // HEST_ERROR_SOURCE_DESCRIPTOR_H_
diff --git a/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.c b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.c
new file mode 100644
index 000000000000..acfb0fc9e838
--- /dev/null
+++ b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.c
@@ -0,0 +1,308 @@
+/** @file
+  Collects and appends the HEST error source descriptors from the MM drivers.
+
+  The drivers entry point locates the MM Communication protocol and calls into
+  Standalone MM to get the HEST error sources length and count. It also
+  retrieves descriptor information. The information is then used to build the
+  HEST table using the HEST table generation protocol.
+
+  This driver collects the secure error source descriptor information from the
+  MM drviers that implement HEST error source protocol. Instead of directly
+  communicating with the individual MM drivers, it calls into
+  HestErrorSourceStandaloneMM driver which is a gatway MM driver. This MM driver
+  in-turn communicates with individual MM drivers collecting the error source
+  descriptor information.
+
+  Once all the error source descriptor information is retrieved the driver
+  appends the descriptors to HEST table using the HestDxe driver.
+
+  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <IndustryStandard/Acpi.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DxeServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/MmCommunication2.h>
+#include <Protocol/HestTable.h>
+#include "HestMmErrorSourceCommon.h"
+
+#define MM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data))
[SAMI] Can this definition be moved to MdePkg\Include\Protocol\MmCommunication.h, please ?
+
+STATIC HEST_TABLE_PROTOCOL *mHestProtocol;
+STATIC EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2;
+
+/**
+  Retrieve the error source descriptors from Standalone MM.
+
+  Initialize the MM comminication buffer by assigning the MM service to
+  invoke as gMmHestGetErrorSourceInfoGuid. Use the MM communication
+  protocol to retrieve the error source descriptors.
+
+  @param[in]       CommBuffSize  Size of communicate buffer.
+  @param[in, out]  CommBuffer    The communicate buffer.
+
+  @retval  EFI_SUCCESS  MM Communicate protocol call successful.
+  @retval  Other        MM Communicate protocol call failed.
+**/
+STATIC
+EFI_STATUS
+GetErrorSourceDescriptors (
+  IN     UINTN                     CommBuffSize,
+  IN OUT EFI_MM_COMMUNICATE_HEADER **CommBuffer
+  )
+{
+  EFI_STATUS Status;
+
+  //
+  // Initialize the CommBuffer with MM Communicate metadata.
+  //
+  CopyGuid (&(*CommBuffer)->HeaderGuid, &gMmHestGetErrorSourceInfoGuid);
+  (*CommBuffer)->MessageLength =
+    CommBuffSize -
+    sizeof ((*CommBuffer)->HeaderGuid) -
+    sizeof ((*CommBuffer)->MessageLength);
+
+  //
+  // Call into the Standalone MM using the MM Communicate protocol.
+  //
+  Status = mMmCommunication2->Communicate (
+                                mMmCommunication2,
+                                (VOID *)*CommBuffer,
+                                (VOID *)*CommBuffer,
[SAMI] Can you check if the third parameter to Communicate() is correct, please?
+                                NULL
+                                );
+
+  return Status;
+}
+
+/**
+  Collect HEST error source descriptors from all Standalone MM drivers and
+  append them to the HEST table.
+
+  Use MM Communication Protocol to communicate and collect the error source
+  descriptor information from Standalone MM. Check for the required buffer size
+  returned by the MM driver. Allocate buffer of adequate size and call again
+  into MM.
+
+  @retval  EFI_SUCCESS           Successful to collect and append the error
+                                 source.
+                                 descriptors to HEST table.
+  @retval  EFI_OUT_OF_RESOURCES  Memory allocation failure.
+  @retval  Other                 For any other error.
+**/
+STATIC
+EFI_STATUS
+AppendMmErrorSources (VOID)
[SAMI] VOID and ) should be on a separate line. Can you check the other patches in this series as well, please?
+{
+  EFI_MM_COMMUNICATE_HEADER   *CommunicationHeader = NULL;
+  HEST_ERROR_SOURCE_DESC_INFO *ErrorSourceDescInfo;
+  EFI_STATUS                  Status;
+  UINTN                       CommBufferSize;
+
+  //
+  // Retrieve the count, length and the actual eror source descriptors from
+  // the MM drivers. Do this by performing two MM Communicate calls, in the
+  // first call pass CommBuffer which is atleast of the size of error source
+  // descriptor info structure. Followed by another communicate call with
+  // CommBuffer allocated to required buffer size to hold all descriptors.
+  //
+  // Allocate CommBuffer atleast the size of error source descriptor info
+  // structure.
+  CommBufferSize =
+    MM_COMMUNICATE_HEADER_SIZE + HEST_ERROR_SOURCE_DESC_INFO_SIZE;
+  CommunicationHeader = AllocatePool (CommBufferSize);
[SAMI] Would it be better to use AllocateZeroPool() ?
+  if (CommunicationHeader == NULL) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to allocate memory for CommunicationHeader\n",
+      __FUNCTION__
+      ));
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  //
+  // Make the first MM Communicate call to HestErrorSourceStandaloneMM gateway
+  // driver, which returns the required buffer size adequate to hold all the
+  // desctriptor information.
+  //
+  Status = GetErrorSourceDescriptors (CommBufferSize, &CommunicationHeader);
+  if ((EFI_ERROR (Status)) &&
+      (Status != EFI_BAD_BUFFER_SIZE)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: MM Communicate protocol call failed, status: %r\n",
+      __FUNCTION__,
+      Status
+      ));
+    FreePool (CommunicationHeader);
+    return Status;
+  }
+
+  // Check for the length of Error Source descriptors.
+  ErrorSourceDescInfo =
+    (HEST_ERROR_SOURCE_DESC_INFO *)(CommunicationHeader->Data);
+  if ((ErrorSourceDescInfo->ErrSourceDescSize == 0) ||
+      (ErrorSourceDescInfo->ErrSourceDescCount == 0)) {
+    DEBUG ((
+      DEBUG_INFO,
+      "HesErrorSourceDxe: HEST error source(s) not found\n"
+      ));
+    FreePool (CommunicationHeader);
+    return EFI_SUCCESS;
[SAMI] return EFI_NOT_FOUND ?
+  }
+
+  //
+  // Allocate CommBuffer of required size to accomodate all the error source
+  // descriptors. Required size of communication buffer =
+  // MM communicate metadata. + (error source desc info struct + error source
+  // descriptor size).
+  //
+  CommBufferSize =
+    MM_COMMUNICATE_HEADER_SIZE +
+    HEST_ERROR_SOURCE_DESC_INFO_SIZE +
+    ErrorSourceDescInfo->ErrSourceDescSize;
+
+  // Free old MM Communicate buffer and allocate a new buffer of required size.
+  FreePool (CommunicationHeader);
+  CommunicationHeader = AllocatePool (CommBufferSize);
+  if (CommunicationHeader == NULL) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to allocate memory for CommunicationHeader\n",
+      __FUNCTION__
+      ));
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  //
+  // Make second MM Communicate call to HestErrorSourceStandaloneMM driver to
+  // get the error source descriptors from the MM drivers.
+  //
+  Status = GetErrorSourceDescriptors (CommBufferSize, &CommunicationHeader);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: MM Communicate protocol failed, status: %r\n",
+      __FUNCTION__,
+      Status
+      ));
+    FreePool (CommunicationHeader);
+    return Status;
+  }
+
+  //
+  // Retrieve the HEST error source descriptor information. Ensure that there
+  // is a valid list of error source descriptors.
+  //
+  ErrorSourceDescInfo =
+    (HEST_ERROR_SOURCE_DESC_INFO *)(CommunicationHeader->Data);
+  if (ErrorSourceDescInfo->ErrSourceDescList == NULL) {
+    DEBUG ((
+      DEBUG_INFO,
+      "HestErrorSourceDxe: Error source descriptor list is empty"
+      ));
+    FreePool (CommunicationHeader);
+    return EFI_SUCCESS;
[SAMI] Can EFI_NOT_FOUND be returned here?
+  }
+
+  DEBUG ((
+    DEBUG_INFO,
+    "HestErrorSourceDxe: ErrorSources: TotalCount = %d TotalLength = %d \n",
+    ErrorSourceDescInfo->ErrSourceDescCount,
+    ErrorSourceDescInfo->ErrSourceDescSize
+    ));
+
+  //
+  // Append the error source descriptors to HEST table using the HEST table
+  // generation protocol.
+  //
+  Status = mHestProtocol->AppendErrorSourceDescriptors (
+                            ErrorSourceDescInfo->ErrSourceDescList,
+                            ErrorSourceDescInfo->ErrSourceDescSize,
+                            ErrorSourceDescInfo->ErrSourceDescCount
+                            );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to append error source(s), status: %r\n",
+      __FUNCTION__,
+      Status
+      ));
+  }
+
+  FreePool (CommunicationHeader);
+  return Status;
+}
+
+/**
+  The Entry Point for HEST Error Source Dxe driver.
+
+  Locates the HEST Table generation and MM Communication2 protocols. Using the
+  MM Communication2, the driver collects the Error Source Descriptor(s) from
+  Standalone MM. It then appends those Error Source Descriptor(s) to the Hest
+  table using the HEST Table generation protocol.
+
+  @param[in]  ImageHandle  The firmware allocated handle for the Efi image.
+  @param[in]  SystemTable  A pointer to the Efi System Table.
+
+  @retval  EFI_SUCCESS  The entry point is executed successfully.
+  @retval  Other        Some error occurred when executing this entry point.
+**/
+EFI_STATUS
+EFIAPI
+HestErrorSourceInitialize (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_STATUS Status;
+
+  Status = gBS->LocateProtocol (
+                  &gHestTableProtocolGuid,
+                  NULL,
+                  (VOID **)&mHestProtocol
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to locate HEST table generation protocol, status:%r\n",
+      __FUNCTION__,
+      Status
+      ));
+    return Status;
+  }
+
+  Status = gBS->LocateProtocol (
+                  &gEfiMmCommunication2ProtocolGuid,
+                  NULL,
+                  (VOID **)&mMmCommunication2
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to locate MMCommunication2 driver protocol, status:%r\n",
+      __FUNCTION__,
+      Status
+      ));
+    return Status;
+  }
+
+  //
+  // Append HEST error sources retrieved from StandaloneMM, if any, into the
+  // HEST ACPI table.
+  //
+  Status = AppendMmErrorSources ();
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed appending error source desc to HEST table, status:%r\n",
+      __FUNCTION__,
+      Status
+      ));
+  }
+  return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.c b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.c
new file mode 100644
index 000000000000..c7b2304fc494
--- /dev/null
+++ b/ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.c
@@ -0,0 +1,312 @@
+/** @file
+  MM HEST error source gateway driver.
+
+  This MM driver installs a handler which can be used to retrieve the error
+  source descriptors from the all MM drivers implementing the HEST error source
+  descriptor protocol.
+
+  The MM driver acts as a single point of contact to collect secure hardware
+  error sources from the MM drivers. It loops over all the MM drivers that
+  implement HEST error source descriptor protocol and collects error source
+  descriptor information along with the error source count and length.
+
+  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Base.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Protocol/HestErrorSourceInfo.h>
+
+#include "HestMmErrorSourceCommon.h"
+
+STATIC EFI_MM_SYSTEM_TABLE *mMmst = NULL;
+
+/**
+  Returns an array of handles that implement the HEST error source descriptor
+  protocol.
+
+  Passing HandleBuffer as NULL will return the actual size of the buffer
+  required to hold the array of handles implementing the protocol.
+
+  @param[in, out]  HandleBufferSize  The size of the HandleBuffer.
+  @param[out]      HandleBuffer      A pointer to the buffer containing the list
+                                    of handles.
+
+  @retval  EFI_SUCCESS    The array of handles returned in HandleBuffer.
+  @retval  EFI_NOT_FOUND  No implementation present for the protocol.
+  @retval  Other          For any other error.
+**/
+STATIC
+EFI_STATUS
+GetHestErrorSourceProtocolHandles (
+  IN OUT UINTN      *HandleBufferSize,
+  OUT    EFI_HANDLE **HandleBuffer
+  )
+{
+  EFI_STATUS Status;
+
+  Status = mMmst->MmLocateHandle (
+                    ByProtocol,
+                    &gMmHestErrorSourceDescProtocolGuid,
+                    NULL,
+                    HandleBufferSize,
+                    *HandleBuffer
+                    );
+  if ((EFI_ERROR (Status)) &&
+      (Status != EFI_BUFFER_TOO_SMALL))
+  {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: No implementation of MmHestErrorSourceDescProtocol found, \
+       Status:%r\n",
+      __FUNCTION__,
+      Status
+      ));
+    return EFI_NOT_FOUND;
+  }
+
+  return Status;
+}
+
+/**
+  Mmi handler to retrieve HEST error source descriptor information.
+
+  Handler for Mmi service that returns the supported HEST error source
+  descriptors in MM. This handler populates the CommBuffer with the
+  list of all error source descriptors, prepended with the length and
+  the number of descriptors populated into CommBuffer.
+
+  @param[in]       DispatchHandle  The unique handle assigned to this handler by
+                                   MmiHandlerRegister().
+  @param[in]       Context         Points to an optional handler context that
+                                   is specified when the handler was registered.
+  @param[in, out]  CommBuffer      Buffer used for communication of HEST error
+                                   source descriptors.
+  @param[in, out]  CommBufferSize  The size of the CommBuffer.
+
+  @retval  EFI_SUCCESS            CommBuffer has valid data.
+  @retval  EFI_BAD_BUFFER_SIZE    CommBufferSize not adequate.
+  @retval  EFI_OUT_OF_RESOURCES   System out of memory resources.
+  @retval  EFI_INVALID_PARAMETER  Invalid CommBufferSize recieved.
+  @retval  Other                  For any other error.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HestErrorSourcesInfoMmiHandler (
+  IN     EFI_HANDLE DispatchHandle,
+  IN     CONST VOID *Context,       OPTIONAL
+  IN OUT VOID       *CommBuffer,    OPTIONAL
+  IN OUT UINTN      *CommBufferSize OPTIONAL
+  )
+{
+  MM_HEST_ERROR_SOURCE_DESC_PROTOCOL *HestErrSourceDescProtocolHandle;
+  HEST_ERROR_SOURCE_DESC_INFO        *ErrorSourceInfoList;
+  EFI_HANDLE                         *HandleBuffer;
+  EFI_STATUS                         Status;
+  UINTN                              HandleCount;
+  UINTN                              HandleBufferSize;
+  UINTN                              Index;
+  UINTN                              SourceCount = 0;
+  UINTN                              SourceLength = 0;
+  VOID                               *ErrorSourcePtr;
+  UINTN                              TotalSourceLength = 0;
+  UINTN                              TotalSourceCount = 0;
+
+  if (*CommBufferSize < HEST_ERROR_SOURCE_DESC_INFO_SIZE) {
+    //
+    // Ensures that the communication buffer has enough space to atleast hold
+    // the ErrSourceDescCount and ErrSourceDescSize elements of the
+    // HEST_ERROR_SOURCE_DESC_INFO structure.
+    //
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Invalid CommBufferSize parameter\n",
+      __FUNCTION__
+      ));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Get all handles that implement the HEST error source descriptor protocol.
+  // Get the buffer size required to store list of handles for the protocol.
+  //
+  HandleBuffer = NULL;
+  HandleBufferSize = 0;
+  Status = GetHestErrorSourceProtocolHandles (&HandleBufferSize, &HandleBuffer);
+  if ((Status == EFI_NOT_FOUND) ||
+      (HandleBufferSize == 0))
+  {
+    return Status;
+  }
+
+  // Allocate memory for HandleBuffer of size HandleBufferSize.
+  HandleBuffer = AllocatePool (HandleBufferSize);
[SAMI] AllocateZeroPool() ?
+  if (HandleBuffer == NULL) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Failed to allocate memory for HandleBuffer\n",
+      __FUNCTION__
+      ));
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  // Get the list of handles.
+  Status = GetHestErrorSourceProtocolHandles (&HandleBufferSize, &HandleBuffer);
+  if ((EFI_ERROR (Status)) ||
+      (HandleBuffer == NULL))
[SAMI] Is check for HandleBuffer == NULL right here?
+  {
+    FreePool (HandleBuffer);
+    return Status;
+  }
+
+  // Count of handles for the protocol.
+  HandleCount = HandleBufferSize / sizeof (EFI_HANDLE);
+
+  //
+  // Loop to get the count and length of the error source descriptors.
+  //
+  // This loop collects and adds the length of error source descriptors and
+  // its count from all the the MM drivers implementing HEST error source.
+  // descriptor protocol. The total length and count values retrieved help
+  // to determine weather the CommBuffer is big enough to hold the descriptor
+  // information.
+  // As mentioned in the HEST error source descriptor protocol definition,
+  // Buffer parameter set to NULL ensures only length and the count values
+  // are returned from the driver and no error source information is copied to
+  // Buffer.
+  //
+  for (Index = 0; Index < HandleCount; ++Index) {
+    Status = mMmst->MmHandleProtocol (
+                      HandleBuffer[Index],
+                      &gMmHestErrorSourceDescProtocolGuid,
+                      (VOID **)&HestErrSourceDescProtocolHandle
+                      );
+    if (EFI_ERROR (Status)) {
+      continue;
+    }
+
+    //
+    // Protocol called with Buffer parameter passed as NULL, must return
+    // error source length and error count for that driver.
+    //
+    Status = HestErrSourceDescProtocolHandle->GetHestErrorSourceDescriptors (
+                                                HestErrSourceDescProtocolHandle,
+                                                NULL,
+                                                &SourceLength,
+                                                &SourceCount
+                                                );
+    if (Status == EFI_INVALID_PARAMETER) {
[SAMI] I think the error handling in this function and the error return implementation in GetHestErrorSourceDescriptors() could be improved.
e.g. GetHestErrorSourceDescriptors() could first check for the SourceLength & SourceCount and if it is less than what is required, it returns EFI_BUFFER_TOO_SMALL.
The next check would be to check ErrorSourcePtr and return EFI_INVALID_PARAMETER if it is NULL.
 [/SAMI]
+      TotalSourceLength += SourceLength;
+      TotalSourceCount += SourceCount;
+    }
+  }
+
+  // Set the count and length in the error source descriptor.
+  ErrorSourceInfoList = (HEST_ERROR_SOURCE_DESC_INFO *)(CommBuffer);
+  ErrorSourceInfoList->ErrSourceDescCount = TotalSourceCount;
+  ErrorSourceInfoList->ErrSourceDescSize = TotalSourceLength;
+
+  //
+  // Check the size of CommBuffer, it should atleast be of size
+  // TotalSourceLength + HEST_ERROR_SOURCE_DESC_INFO_SIZE.
+  //
+  TotalSourceLength = TotalSourceLength + HEST_ERROR_SOURCE_DESC_INFO_SIZE;
+  if ((*CommBufferSize) < TotalSourceLength) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Invalid CommBufferSize parameter\n",
+      __FUNCTION__
+      ));
+    FreePool (HandleBuffer);
+    return EFI_BAD_BUFFER_SIZE;
[SAMI] Should the return code be EFI_BUFFER_TOO_SMALL? The difference being, the caller can attempt to call again with a larger buffer if EFI_BUFFER_TOO_SMALL is returned.
CommBufferSize is declared as an OUT paramter, was the intent to return the required buffer size?
[/SAMI]
+  }
+
+  //
+  // CommBuffer size is adequate to return all the error source descriptors.
+  // So go ahead and populate it with the error source descriptor information.
+  //
+
+  // Buffer pointer to append the Error Descriptors data.
+  ErrorSourcePtr =  ErrorSourceInfoList->ErrSourceDescList;
+
+  //
+  // Loop to retrieve error source descriptors information.
+  //
+  // Calls into each MM driver that implement the HEST error source descriptor
+  // protocol. Here the Buffer parameter passed to the protocol service is
+  // valid. So the MM driver when called copies the descriptor information.
+  //
+  for (Index = 0; Index < HandleCount; ++Index) {
+    Status = mMmst->MmHandleProtocol (
+                      HandleBuffer[Index],
+                      &gMmHestErrorSourceDescProtocolGuid,
+                      (VOID **)&HestErrSourceDescProtocolHandle
+                      );
+    if (EFI_ERROR (Status)) {
+      continue;
+    }
+
+    Status = HestErrSourceDescProtocolHandle->GetHestErrorSourceDescriptors (
+                                                HestErrSourceDescProtocolHandle,
+                                                (VOID **)&ErrorSourcePtr,
+                                                &SourceLength,
+                                                &SourceCount
+                                                );
+    if (Status == EFI_SUCCESS) {
+      ErrorSourcePtr += SourceLength;
+    }
+  }
+
+  // Free the buffer holding all the protocol handles.
+  FreePool (HandleBuffer);
+
+  return EFI_SUCCESS;
[SAMI] return Status of last operation.
+}
+
+/**
+  Entry point for this Stanalone MM driver.
+
+  Registers an Mmi handler that retrieves the error source descriptors from all
+  the MM drivers implementing the MM_HEST_ERROR_SOURCE_DESC_PROTOCOL.
+
+  @param[in]  ImageHandle  The firmware allocated handle for the EFI image.
+  @param[in]  SystemTable  A pointer to the EFI System Table.
+
+  @retval  EFI_SUCCESS  The entry point registered handler successfully.
+  @retval  Other        Some error occurred when executing this entry point.
+**/
+EFI_STATUS
+EFIAPI
+StandaloneMmHestErrorSourceInitialize (
+  IN EFI_HANDLE          ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_HANDLE DispatchHandle;
+  EFI_STATUS Status;
+
+  ASSERT (SystemTable != NULL);
+  mMmst = SystemTable;
+
+  Status = mMmst->MmiHandlerRegister (
+                    HestErrorSourcesInfoMmiHandler,
+                    &gMmHestGetErrorSourceInfoGuid,
+                    &DispatchHandle
+                    );
+  if (EFI_ERROR(Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: Mmi handler registration failed with status : %r\n",
+      __FUNCTION__,
+      Status
+      ));
+    return Status;
+  }
+
+  return EFI_SUCCESS;
[SAMI] return Status of last operation.
+}


Re: [PATCH v2 2/4] ArmPlatformPkg: add definition for MM_HEST_ERROR_SOURCE_DESC_PROTOCOL

Sami Mujawar
 

Hi Omkar,

Please find my response below marked [SAMI]

Regards,

Sami Mujawar
On 10/07/2021 05:18 PM, Omkar Anand Kulkarni wrote:
Add the protocol definition of the MM_HEST_ERROR_SOURCE_DESC_PROTOCOL
protocol. This protocol can be implemented by MM drivers to publish
error source descriptors that have to be populated into HEST table.

Co-authored-by: Thomas Abraham <thomas.abraham@...>
Signed-off-by: Omkar Anand Kulkarni <omkar.kulkarni@...>
---
 ArmPlatformPkg/ArmPlatformPkg.dec                     |  1 +
 ArmPlatformPkg/Include/Protocol/HestErrorSourceInfo.h | 64 ++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index e4afe5da8e11..4f062292663b 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -131,3 +131,4 @@
 [Protocols.common]
   ## Arm Platform HEST table generation protocol
   gHestTableProtocolGuid = { 0x705bdcd9, 0x8c47, 0x457e, { 0xad, 0x0d, 0xf7, 0x86, 0xf3, 0x4a, 0x0d, 0x63 } }
+  gMmHestErrorSourceDescProtocolGuid = { 0x560bf236, 0xa4a8, 0x4d69, { 0xbc, 0xf6, 0xc2, 0x97, 0x24, 0x10, 0x9d, 0x91 } }
diff --git a/ArmPlatformPkg/Include/Protocol/HestErrorSourceInfo.h b/ArmPlatformPkg/Include/Protocol/HestErrorSourceInfo.h
new file mode 100644
index 000000000000..95afd4dffe9c
--- /dev/null
+++ b/ArmPlatformPkg/Include/Protocol/HestErrorSourceInfo.h
@@ -0,0 +1,64 @@
+/** @file
+  MM protocol to get the secure error source descriptor information.
+
+  MM Drivers must implement this protocol in order to publish secure side
+  error source descriptor information to OSPM through the HEST ACPI table.
+
+  Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MM_HEST_ERROR_SOURCE_DESC_
+#define MM_HEST_ERROR_SOURCE_DESC_
+
+#define MM_HEST_ERROR_SOURCE_DESC_PROTOCOL_GUID \
+  { \
+    0x560bf236, 0xa4a8, 0x4d69, { 0xbc, 0xf6, 0xc2, 0x97, 0x24, 0x10, 0x9d, 0x91 } \
+  }
+
+typedef struct MM_HEST_ERROR_SOURCE_DESC_PROTOCOL_
[SAMI] Not sure if a trailing underscore would be right to use for the name tag. Can MmHestErrorSourceDescProtocol be used as the name tag?
Also see https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/56_declarations_and_types#5-6-3-2-structure-declaration-with-forward-reference-or-self-reference
+                 MM_HEST_ERROR_SOURCE_DESC_PROTOCOL;
+
+/**
+  Get HEST Secure Error Source Descriptors.
+
+  The MM drivers implementing this protocol must convey the total count and
+  total length of the error sources the driver has along with the actual error
+  source descriptor(s).
+
+  Passing NULL as Buffer parameter shall return EFI_INVALID_PARAMETR with the
+  total length and count of the error source descriptor(s) it supports.
+
+  @param[in]   This                MM_HEST_ERROR_SOURCE_DESC_PROTOCOL instance.
+  @param[out]  Buffer              Buffer to be appended with the error
+                                   source descriptors information.
+  @param[out]  ErrorSourcesLength  Total length of all the error source
+                                   descriptors.
+  @param[out]  ErrorSourceCount    Count of total error source descriptors
+                                   supported by the driver.
+
+  retval  EFI_SUCCESS           If the Buffer is valid and is filled with valid
+                                Error Source descriptor data.
+  retval  EFI_INVALID_PARAMTER  Buffer is NULL.
+  retval  Other                 If no error source descriptor information is
+                                available.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *MM_HEST_GET_ERROR_SOURCE_DESCRIPTORS) (
+  IN  MM_HEST_ERROR_SOURCE_DESC_PROTOCOL *This,
+  OUT VOID                               **Buffer,
+  OUT UINTN                              *ErrorSourcesLength,
+  OUT UINTN                              *ErrorSourcesCount
+  );
+
+//
+// Protocol declaration
+//
+struct MM_HEST_ERROR_SOURCE_DESC_PROTOCOL_ {
+  MM_HEST_GET_ERROR_SOURCE_DESCRIPTORS GetHestErrorSourceDescriptors;
+};
+
+extern EFI_GUID gMmHestErrorSourceDescProtocolGuid;
+
+#endif // MM_HEST_ERROR_SOURCE_DESC_



Re: [edk2-platforms PATCH v6 0/4] Secure Boot default keys

Sunny Wang
 

Hi Ard and Maintainers,

For this patchset,
1/4 - Intel Platforms: add SecureBootVariableLib class resolution
2/4 - ARM Silicon and Platforms: add SecureBootVariableLib class resolution
3/4 - RISC-V Platforms: add SecureBootVariableLib class resolution
4/4 - Platform/RaspberryPi: Enable default Secure Boot variables initialization

Only Intel platform patch (1/4) hasn't got all Review-bys. I offline sent a reminder to Intel platform Maintainers. I think they may be busy with other things or need more time to review it.

Therefore, how about we merge another three patches (2/4, 3/4, and 4/4) first?

Best Regards,
Sunny Wang

-----Original Message-----
From: Grzegorz Bernacki <gjb@...>
Sent: Wednesday, July 14, 2021 8:31 PM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>; Sunny Wang <Sunny.Wang@...>; mw@...; upstream@...; jiewen.yao@...; jian.j.wang@...; min.m.xu@...; lersek@...; Sami Mujawar <Sami.Mujawar@...>; afish@...; ray.ni@...; jordan.l.justen@...; rebecca@...; grehan@...; Thomas Abraham <thomas.abraham@...>; chasel.chiu@...; nathaniel.l.desimone@...; gaoliming@...; eric.dong@...; michael.d.kinney@...; zailiang.sun@...; yi.qian@...; graeme@...; rad@...; pete@...; Grzegorz Bernacki <gjb@...>
Subject: [edk2-platforms PATCH v6 0/4] Secure Boot default keys

This patchset is a consequence of "Secure Boot default keys"
patchset in edk2. It adds SecureBootVariableLib class resolution
for each platform which uses SecureBootConfigDxe and also
enables Secure Boot variables initialization for RPi4.
Previously these commits were part of edk2 patchset, but since
number of commits increased in v5 version, it is now separate
patchset.

Changes related to both edk2 & edk-platform versions:
Changes since v1:
- change names:
SecBootVariableLib => SecureBootVariableLib
SecBootDefaultKeysDxe => SecureBootDefaultKeysDxe
SecEnrollDefaultKeysApp => EnrollFromDefaultKeysApp
- change name of function CheckSetupMode to GetSetupMode
- remove ShellPkg dependecy from EnrollFromDefaultKeysApp
- rebase to master

Changes since v2:
- fix coding style for functions headers in SecureBootVariableLib.h
- add header to SecureBootDefaultKeys.fdf.inc
- remove empty line spaces in SecureBootDefaultKeysDxe files
- revert FAIL macro in EnrollFromDefaultKeysApp
- remove functions duplicates and add SecureBootVariableLib
to platforms which used it

Changes since v3:
- move SecureBootDefaultKeys.fdf.inc to ArmPlatformPkg
- leave duplicate of CreateTimeBasedPayload in PlatformVarCleanupLib
- fix typo in guid description

Changes since v4:
- reorder patches to make it bisectable
- split commits related to more than one platform
- move edk2-platform commits to separate patchset

Changes since v5:
- split SecureBootVariableLib into SecureBootVariableLib and
SecureBootVariableProvisionLib

Grzegorz Bernacki (4):
Intel Platforms: add SecureBootVariableLib class resolution
ARM Silicon and Platforms: add SecureBootVariableLib class resolution
RISC-V Platforms: add SecureBootVariableLib class resolution
Platform/RaspberryPi: Enable default Secure Boot variables
initialization

Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 2 ++
Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 2 ++
Platform/Intel/QuarkPlatformPkg/Quark.dsc | 2 ++
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 2 ++
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 2 ++
Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 2 ++
Platform/RaspberryPi/RPi3/RPi3.dsc | 2 ++
Platform/RaspberryPi/RPi4/RPi4.dsc | 4 ++++
Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc | 2 ++
Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 2 ++
Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 5 +++++
Platform/RaspberryPi/RPi4/RPi4.fdf | 2 ++
12 files changed, 29 insertions(+)

--
2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [staging/edk2-redfish-client PATCH v2 2/2] edk2: Update Maintainers.txt

Abner Chang
 

Thanks Leif, I remove the description from the package name.

Abner

-----Original Message-----
From: Leif Lindholm [mailto:leif@...]
Sent: Tuesday, August 3, 2021 7:16 PM
To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
<abner.chang@...>
Cc: Wang, Nickle (HPS SW) <nickle.wang@...>; Liming Gao
<gaoliming@...>; Andrew Fish <afish@...>; Michael D
Kinney <michael.d.kinney@...>
Subject: Re: [edk2-devel] [staging/edk2-redfish-client PATCH v2 2/2] edk2:
Update Maintainers.txt

On Tue, Jul 20, 2021 at 11:53:58 +0800, Abner Chang wrote:
Add maintainer and reviewer to RedfishClinetPkg.

Signed-off-by: Abner Chang <abner.chang@...>
Cc: Nickle Wang <nickle.wang@...>
Cc: Liming Gao <gaoliming@...>
Cc: Andrew Fish <afish@...>
Cc: Leif Lindholm <leif@...>
Cc: Michael D Kinney <michael.d.kinney@...>
---
Maintainers.txt | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index e9dda5c5ca..55068c9140 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -519,6 +519,11 @@ F: RedfishPkg/
M: Abner Chang <abner.chang@...>
R: Nickle Wang <nickle.wang@...>

+RedfishClientPkg: Redfish Client related modules
My interpretation of the normal use of this field is that we can add a
comment if the entry applies only to a subset of a package.
This adds an entry for a whole new package, and as such should only
state the name of the package.

With everything from the : until the end of line dropped:
Reviewed-by: Leif Lindholm <leif@...>

/
Leif

+F: RedfishClientPkg/
+M: Abner Chang <abner.chang@...>
+R: Nickle Wang <nickle.wang@...>
+
SecurityPkg
F: SecurityPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/SecurityPkg
--
2.17.1






Re: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot Discovery Policy.

Ard Biesheuvel
 

On Tue, 3 Aug 2021 at 15:08, Pete Batard <pete@...> wrote:

Hi Ard,

I thought the R-b from Sunny was enough.

For what is worth, I briefly tested these changes for v4.
Thus:

On 2021.08.03 14:03, Ard Biesheuvel wrote:
On Tue, 3 Aug 2021 at 15:00, Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...> wrote:

Ard,

Now that the EDK2 changes are merged (aaecef38b9440a65809cbdaf9d97029f4eeb), I think these RPi specific changes are ready to be merged as well.
I only see acks from Sunny though. This is why I asked Pete and Andrei
to chime in as well.
...

Reviewed-by: Pete Batard <pete@...>
Tested-by: Pete Batard <pete@...>
Thanks Pete. I did not want to assume that stakeholders like yourself
are ok with such changes if they did not get involved in the
discussion.

I will merge these now.


Re: [edk2-test][PATCH v1 1/1] uefi-sct/SctPkg: Update page alignment calculations

Samer El-Haj-Mahmoud
 

+Heinrich

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sunny
Wang via groups.io
Sent: Monday, July 19, 2021 4:08 AM
To: devel@edk2.groups.io
Cc: Sunny Wang <Sunny.Wang@...>; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; G Edhaya Chandran
<Edhaya.Chandran@...>; Barton Gao <gaojie@...>;
Sunny Wang <Sunny.Wang@...>
Subject: [edk2-devel] [edk2-test][PATCH v1 1/1] uefi-sct/SctPkg: Update
page alignment calculations

This is to fix the SCT BS.AllocatePages failures (not found) with the
case that the Start address is not aligned to 64k.
For example,
The following is available memory region for testing:
0000000082012000-00000000EB6D9FFF 00000000000696C8
With the current page alignment calculation, we will get:
Start address is 0x82020000
PageNum is 0x696B8
In BS.AllocatePages, it will make the end address align with 64k,
so PageNum will be changed from 0x696B8 to 0x696C0. Therefore, the
end address will become 0xEB6E0000 which is larger than 0xEB6D9FFF,
so we get not found error in the end.

Therefore, the calculation for getting the PageNum should be updated
to PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000)) so that we won't get a
wrong PageNum to allocate a memory with a size larger than available
space's size.

With this solution, the example above will get 0x696A8 as calculated
PageNum. Then, in BS.AllocatePages, the PageNum will be changed from
0x696A8 to 0x696B0. Therefore, the end address will become 0xEB6D0000
that is smaller than 0xEB6D9FFF, so we get not found error in the end.

I also tested this solution on two ARM platforms (NXP1046A and RPi4).

Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@...>
Cc: G Edhaya Chandran <edhaya.chandran@...>
Cc: Barton Gao <gaojie@...>
Signed-off-by: Sunny Wang <sunny.wang@...>
---
.../MemoryAllocationServicesBBTestFunction.c | 110 +++++++++++-------
1 file changed, 66 insertions(+), 44 deletions(-)

diff --git a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/Blac
kBoxTest/MemoryAllocationServicesBBTestFunction.c b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/Blac
kBoxTest/MemoryAllocationServicesBBTestFunction.c
index bf8cd3b3..cdfac992 100644
--- a/uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/Blac
kBoxTest/MemoryAllocationServicesBBTestFunction.c
+++ b/uefi-
sct/SctPkg/TestCase/UEFI/EFI/BootServices/MemoryAllocationServices/Blac
kBoxTest/MemoryAllocationServicesBBTestFunction.c
@@ -2,6 +2,7 @@

Copyright 2006 - 2013 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2021, ARM Limited. All rights reserved.

This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD
License
@@ -24,7 +25,7 @@ Abstract:

--*/

-#include "SctLib.h"
+#include "SctLib.h"
#include "MemoryAllocationServicesBBTestMain.h"

#define ALLOCATEPAGES_MEMORYTYPE_NUM 16
@@ -700,14 +701,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start;

@@ -830,14 +834,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start;

@@ -953,14 +960,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start + (SctLShiftU64 (PageNum/3, EFI_PAGE_SHIFT) &
0xFFFFFFFFFFFF0000);

@@ -1076,14 +1086,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start + (SctLShiftU64 (PageNum * 2 / 3, EFI_PAGE_SHIFT) &
0xFFFFFFFFFFFF0000);

@@ -1206,14 +1219,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start;

@@ -1329,14 +1345,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start;

@@ -1468,14 +1487,17 @@ BBTestAllocatePagesInterfaceTest (
PageNum = (UINTN)Descriptor.NumberOfPages;
Start = Descriptor.PhysicalStart;

- //
- // Some memory types need more alignment than 4K, so
- //
- if (PageNum <= 0x10) {
+ //
+ // Calculate New Start address and PageNum with 64k alignment to
+ // cover the case that some memory types' alignment is more than
+ // 4k. If the available memory is less than 192k, the memory
+ // allocation call will be skipped.
+ //
+ if (PageNum < (3 * EFI_SIZE_TO_PAGES(0x10000))) {
break;
}
- Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
- PageNum = PageNum - EFI_SIZE_TO_PAGES(0x10000);
+ Start = (Start + 0xFFFF) & 0xFFFFFFFFFFFF0000;
+ PageNum = PageNum - (2 * EFI_SIZE_TO_PAGES(0x10000));

Memory = Start;

@@ -1923,4 +1945,4 @@ BBTestFreePoolInterfaceTest (

FreeMemoryMap ();
return EFI_SUCCESS;
-}
+}
--
2.31.0.windows.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77876): https://edk2.groups.io/g/devel/message/77876
Mute This Topic: https://groups.io/mt/84303611/1945644
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [samer.el-haj-
mahmoud@...]
-=-=-=-=-=-=
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: Proposing a new area of the edk2-test repository

Samer El-Haj-Mahmoud
 

I would think just sending the code contribution patch is sufficient.

 

 

From: Nelson, Eric <eric.nelson@...>
Sent: Wednesday, July 28, 2021 3:05 PM
To: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>; Bret Barkelew <Bret.Barkelew@...>; devel@edk2.groups.io; G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

 

Adding ResumeOK.efi tool under /edk2-test/test-tools/TestToolsPkg would be great.

 

Should I propose this in the RFC and DEVEL mailing lists as a next step?

 

Thanks,

__e

 

 

From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Sent: Friday, July 9, 2021 1:12 PM
To: Bret Barkelew <Bret.Barkelew@...>; devel@edk2.groups.io; Nelson, Eric <eric.nelson@...>; G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

Interesting, thanks for sharing Bret. Some of those tests seem to be x64 specific (SMM tests), and some can be more generic like MorLockTestApp

 

Like I said earlier, I am not against adding test tools to edk2-test. That in fact is welcomed, especially if their usefulness in validating the solutions extend beyond specific implementations.

 

What would a good tree structure look like to accommodate misc tools? Today we have

 

/edk2-test/uefi-sct/SctPkg

 

How about something like this?

/edk2-test/test-tools/TestToolsPkg

or /edk2-test/ TestToolsPkg

 

The “ResumeOK” can be placed there

 

Any other ideas?

 

 

From: Bret Barkelew <Bret.Barkelew@...>
Sent: Thursday, June 24, 2021 12:25 AM
To: devel@edk2.groups.io; eric.nelson@...; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>; G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...; Kinney, Michael D <michael.d.kinney@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

Fun fact! Mu also has a number of apps and things that we could work on moving to EDK2 if there were a suitable location. Right now, many of them are here:

mu_plus/UefiTestingPkg at release/202102 · microsoft/mu_plus (github.com)

 

- Bret

 

From: Nelson, Eric via groups.io
Sent: Wednesday, June 23, 2021 3:38 PM
To: Samer El-Haj-Mahmoud; G Edhaya Chandran; gaojie@...; devel@edk2.groups.io; Kinney, Michael D
Subject: [EXTERNAL] Re: [edk2-devel] Proposing a new area of the edk2-test repository

 

 

I have created a few other internal apps that build under WinTestPkg, although ResumeOK.efi is the only one I have received permissions to release sources for at this time.

And yes, they are primarily intended for validating Windows requirements.

I had some issues with my apps, needing to use different libraries than MdeModulePkg, and found it easier to create my own package, and use the libs I want.

 

__e

 

 

From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Sent: Wednesday, June 23, 2021 1:56 PM
To: Nelson, Eric <eric.nelson@...>; G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...; devel@edk2.groups.io
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

+edk2 list

 

I am not against adding additional test tools to edk2-test. Just feel like there is a need to organize and have a strategy, rather than just use edk2-test as a dumping group of miscellaneous tools.

 

There is already a place for apps under https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Application

 

We also have a number of EDK2 misc applications that use edk2-libc in https://github.com/tianocore/edk2-libc/tree/master/AppPkg/Applications

 

A couple of questions:

  • Do you expect more apps from WinTestPkg to be contributed to TianoCore? And are they all around testing specific Windows requirements? If so, then having an edk2-test/WinTestPkg makes sense to me, as you will have a collection of useful testing app targeting specific area.
    • But what about other OSes?
  • If this is a one-off test app and other WinTestPkg apps are not going to be contributed, then does it make sense to put this under MdeModulePkg/Application ?

 

 

 

From: Nelson, Eric <eric.nelson@...>
Sent: Wednesday, June 23, 2021 3:10 PM
To: G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

 

Hi Edhay,

 

Do you have any more questions?

What do you think of creating another directory in edk2-test, for other test apps, in addition to uefi-sct, such as ResumeOK.efi?

 

Thanks,

__e

 

 

From: Nelson, Eric
Sent: Tuesday, June 15, 2021 12:00 PM
To: G Edhaya Chandran <Edhaya.Chandran@...>; gaojie@...
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

 

Hi Edhay,

 

ResumeOK.efi is a tool I wrote from the HelloWorld example, that validates Windows resume from S4 requirements, specifically that the memory-map run-time memory regions don’t change, and secondly that PCI devices don’t disappear from the system, both conditions would cause Windows to fail to resume from S4.

 

You install the tool to the root of the ESP, and set it as the default/top entry in the boot manager, and launch it.  (Disable Secure Boot.)

 

It runs warm, cold, and 60s ACPI RTC wake cycles, infinitely looking for errors.

 

ResumeOK.efi writes a file to the root of the ESP, ResumeOK.map, which contains the ACPI Facs->HardwareSignature, a list of the PCI devices in the system, and a copy of its memory map, from the first time it runs.

 

During each test pass, it runs a barrage of tests:

 

  1. Free memory test – does the available memory match the memory map saved in ResumeOK.map
  2. HW signature check – does the system still have the same HW signature as saved in the ResumeOK.map
  3. Allocation test – all the available memory is allocated, and then the memory map is checked if the run-time regions match ResumeOK.map.

 

If any of the tests fail, then the new/missing PCI devices are listed (HW signature fail case), or the memory descriptor that changed, it’s location, and current and previous type and size.

 

I have received permission from Intel to *try* to release the source under Edk2-test.

 

I’ve included a 64-bit binary, if you want to give it a test drive.

 

Make sure Secure Boot is off.

Also, it is required to manually delete any ResumeOK.map on the ESP, before beginning a new test pass.

 

The tool also supports a host of EFI Shell commands:

 

Resumeok.efi MEMMAP – displays Windows coalesced view of the current memory map

ResumeOK.efi ROKMAP – displays Windows coalesced view of the memory saved in ResumeOK.map

ResumeOK.efi RTDATA – displays an analysis of RT_Data pool usage

ResumeOK.efi NORESET – run one test pass, but suppress automatic SX cycling

 

These are the files that build it:

 

Edk2\WinTestPkg\Application

Edk2\WinTestPkg\WinTestPkg.dec

Edk2\WinTestPkg\WinTestPkg.dsc

Edk2\WinTestPkg\Application\ResumeOK

Edk2\WinTestPkg\Application\ResumeOK\AcpiTbl.c

Edk2\WinTestPkg\Application\ResumeOK\AcpiTbl.h

Edk2\WinTestPkg\Application\ResumeOK\AppSupport.c

Edk2\WinTestPkg\Application\ResumeOK\BitMap.c

Edk2\WinTestPkg\Application\ResumeOK\BitMap.h

Edk2\WinTestPkg\Application\ResumeOK\EfiFileLib.c

Edk2\WinTestPkg\Application\ResumeOK\EfiFileLib.h

Edk2\WinTestPkg\Application\ResumeOK\pci.c

Edk2\WinTestPkg\Application\ResumeOK\Pci.h

Edk2\WinTestPkg\Application\ResumeOK\ResumeOK.c

Edk2\WinTestPkg\Application\ResumeOK\ResumeOK.h

Edk2\WinTestPkg\Application\ResumeOK\ResumeOK.inf

Edk2\WinTestPkg\Application\ResumeOK\ResumeOK.uni

Edk2\WinTestPkg\Application\ResumeOK\ResumeOKExtra.uni

Edk2\WinTestPkg\Application\ResumeOK\RtData.c

Edk2\WinTestPkg\Application\ResumeOK\TimeBaseLib.c

 

Thanks,

__e

 

 

From: G Edhaya Chandran <Edhaya.Chandran@...>
Sent: Monday, June 14, 2021 9:36 PM
To: Nelson, Eric <eric.nelson@...>; gaojie@...
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>
Subject: RE: Proposing a new area of the edk2-test repository

 

Hi Eric,

 

    Thanks for reaching out to us.

Can we get more details of the tool?

 

Is this tool already open sourced or could you send us the basic documentation pertaining to it.

 

With Warm Regards,
Edhay

 

 

From: Nelson, Eric <eric.nelson@...>
Sent: 15 June 2021 04:23
To: gaojie@...; G Edhaya Chandran <Edhaya.Chandran@...>
Subject: Proposing a new area of the edk2-test repository

 

 

Hello SCT maintainers,

 

I’m looking to release source to a UEFI validation tool that has been a big hit with platform BIOS validation teams, so it can help other PC vendors.

 

My coworker Michael Kinney suggested I reach out to you directly about the idea of creating a new top level directory in the edk2-test repro for other test apps, and I could be maintainer.

 

What do you think of creating another directory in edk2-test, for other test apps, in addition to uefi-sct?

 

Thanks!

__e

 

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

 

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot Discovery Policy.

Pete Batard
 

Hi Ard,

I thought the R-b from Sunny was enough.

For what is worth, I briefly tested these changes for v4.
Thus:

On 2021.08.03 14:03, Ard Biesheuvel wrote:
On Tue, 3 Aug 2021 at 15:00, Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...> wrote:

Ard,

Now that the EDK2 changes are merged (aaecef38b9440a65809cbdaf9d97029f4eeb), I think these RPi specific changes are ready to be merged as well.
I only see acks from Sunny though. This is why I asked Pete and Andrei
to chime in as well.

-----Original Message-----
From: Grzegorz Bernacki <gjb@...>
Sent: Monday, August 2, 2021 8:19 AM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; Sunny Wang
<Sunny.Wang@...>; mw@...; upstream@...;
pete@...; jian.j.wang@...; hao.a.wu@...;
dandan.bi@...; eric.dong@...; Grzegorz Bernacki
<gjb@...>; Sunny Wang <Sunny.Wang@...>
Subject: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot
Discovery Policy.

This commit modify platform boot to check the value of
BootDiscoveryPolicy variable and use BootPolicyManager
Protocol to connect devices specified by the variable.

Signed-off-by: Grzegorz Bernacki <gjb@...>
Reviewed-by: Sunny Wang <sunny.wang@...>
---
Platform/RaspberryPi/RPi4/RPi4.dsc | 3 +
Platform/RaspberryPi/RPi4/RPi4.fdf | 1 +

Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootManag
erLib.inf | 5 ++
Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
| 91 ++++++++++++++++++++
4 files changed, 100 insertions(+)

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc
b/Platform/RaspberryPi/RPi4/RPi4.dsc
index fd73c4d14b..8b9beac64a 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -555,6 +555,7 @@

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRasp
berryPiTokenSpaceGuid|0x0|80

gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspb
erryPiTokenSpaceGuid|0x0|25

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPi
TokenSpaceGuid|0x0|25
+
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|L"BootDiscove
ryPolicy"|gBootDiscoveryPolicyMgrFormsetGuid|0

[PcdsDynamicDefault.common]
#
@@ -682,6 +683,7 @@
#
# Bds
#
+
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
@@ -690,6 +692,7 @@
Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
+
NULL|MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
yUiLib.inf

NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf

NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.inf
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf
b/Platform/RaspberryPi/RPi4/RPi4.fdf
index 1e13909a57..371197a93e 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -253,6 +253,7 @@ READ_LOCK_STATUS = TRUE
#
# Bds
#
+ INF
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
index fbf510ab96..4ef2f791ae 100644
---
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
+++
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
@@ -61,11 +61,13 @@
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType

[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
gRaspberryPiTokenSpaceGuid.PcdBootPolicy

[Guids]
+ gBootDiscoveryPolicyMgrFormsetGuid
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gEfiFileSystemVolumeLabelInfoIdGuid
@@ -73,8 +75,11 @@
gEfiTtyTermGuid
gUefiShellFileGuid
gEfiEventExitBootServicesGuid
+ gEfiBootManagerPolicyNetworkGuid
+ gEfiBootManagerPolicyConnectAllGuid

[Protocols]
+ gEfiBootManagerPolicyProtocolGuid
gEfiDevicePathProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiLoadedImageProtocolGuid
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index d081fdae63..d944d1a38d 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -6,6 +6,7 @@
* Copyright (c) 2015-2016, Red Hat, Inc.
* Copyright (c) 2014-2021, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
+ * Copyright (c) 2021, Semihalf All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -19,10 +20,12 @@
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
+#include <Protocol/BootManagerPolicy.h>
#include <Protocol/DevicePath.h>
#include <Protocol/EsrtManagement.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/LoadedImage.h>
+#include <Guid/BootDiscoveryPolicy.h>
#include <Guid/EventGroup.h>
#include <Guid/TtyTerm.h>
#include <ConfigVars.h>
@@ -598,6 +601,89 @@ PlatformBootManagerBeforeConsole (
FilterAndProcess (&gEfiUsb2HcProtocolGuid, NULL, Connect);
}

+/**
+ Connect device specified by BootDiscoverPolicy variable and refresh
+ Boot order for newly discovered boot device.
+
+ @retval EFI_SUCCESS Devices connected succesfully or connection
+ not required.
+ @retval others Return values from GetVariable(), LocateProtocol()
+ and ConnectDeviceClass().
+--*/
+STATIC
+EFI_STATUS
+BootDiscoveryPolicyHandler (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DiscoveryPolicy;
+ UINTN Size;
+ EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
+ EFI_GUID *Class;
+
+ Size = sizeof (DiscoveryPolicy);
+ Status = gRT->GetVariable (
+ BOOT_DISCOVERY_POLICY_VAR,
+ &gBootDiscoveryPolicyMgrFormsetGuid,
+ NULL,
+ &Size,
+ &DiscoveryPolicy
+ );
+ if (Status == EFI_NOT_FOUND) {
+ Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32
(PcdBootDiscoveryPolicy));
+ DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
+ return EFI_SUCCESS;
+ }
+
+ switch (DiscoveryPolicy) {
+ case BDP_CONNECT_NET:
+ Class = &gEfiBootManagerPolicyNetworkGuid;
+ break;
+ case BDP_CONNECT_ALL:
+ Class = &gEfiBootManagerPolicyConnectAllGuid;
+ break;
+ default:
+ DEBUG ((
+ DEBUG_INFO,
+ "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery
Policy\n",
+ __FUNCTION__,
+ DiscoveryPolicy
+ ));
+ return EFI_SUCCESS;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiBootManagerPolicyProtocolGuid,
+ NULL,
+ (VOID **)&BMPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a - Failed to locate
gEfiBootManagerPolicyProtocolGuid - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
+ if (EFI_ERROR (Status)){
+ DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n",
__FUNCTION__, Status));
+ return Status;
+ }
+
+ EfiBootManagerRefreshAllBootOption();
+
+ return EFI_SUCCESS;
+}
+
/**
Do the platform specific action after the console is ready
Possible things that can be done in PlatformBootManagerAfterConsole:
@@ -644,6 +730,11 @@ PlatformBootManagerAfterConsole (
DEBUG ((DEBUG_INFO, "Boot Policy is Fast Boot. Skip connecting all
devices\n"));
}

+ Status = BootDiscoveryPolicyHandler ();
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_INFO, "Error applying Boot Discovery Policy:%r\n",
Status));
+ }
+
Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,
(VOID**)&EsrtManagement);
if (!EFI_ERROR (Status)) {
EsrtManagement->SyncEsrtFmp ();
--
2.25.1
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Reviewed-by: Pete Batard <pete@...>
Tested-by: Pete Batard <pete@...>


Re: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot Discovery Policy.

Ard Biesheuvel
 

On Tue, 3 Aug 2021 at 15:00, Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...> wrote:

Ard,

Now that the EDK2 changes are merged (aaecef38b9440a65809cbdaf9d97029f4eeb), I think these RPi specific changes are ready to be merged as well.
I only see acks from Sunny though. This is why I asked Pete and Andrei
to chime in as well.

-----Original Message-----
From: Grzegorz Bernacki <gjb@...>
Sent: Monday, August 2, 2021 8:19 AM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; Sunny Wang
<Sunny.Wang@...>; mw@...; upstream@...;
pete@...; jian.j.wang@...; hao.a.wu@...;
dandan.bi@...; eric.dong@...; Grzegorz Bernacki
<gjb@...>; Sunny Wang <Sunny.Wang@...>
Subject: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot
Discovery Policy.

This commit modify platform boot to check the value of
BootDiscoveryPolicy variable and use BootPolicyManager
Protocol to connect devices specified by the variable.

Signed-off-by: Grzegorz Bernacki <gjb@...>
Reviewed-by: Sunny Wang <sunny.wang@...>
---
Platform/RaspberryPi/RPi4/RPi4.dsc | 3 +
Platform/RaspberryPi/RPi4/RPi4.fdf | 1 +

Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootManag
erLib.inf | 5 ++
Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
| 91 ++++++++++++++++++++
4 files changed, 100 insertions(+)

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc
b/Platform/RaspberryPi/RPi4/RPi4.dsc
index fd73c4d14b..8b9beac64a 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -555,6 +555,7 @@

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRasp
berryPiTokenSpaceGuid|0x0|80

gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspb
erryPiTokenSpaceGuid|0x0|25

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPi
TokenSpaceGuid|0x0|25
+
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|L"BootDiscove
ryPolicy"|gBootDiscoveryPolicyMgrFormsetGuid|0

[PcdsDynamicDefault.common]
#
@@ -682,6 +683,7 @@
#
# Bds
#
+
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
@@ -690,6 +692,7 @@
Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
+
NULL|MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
yUiLib.inf

NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf

NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.inf
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf
b/Platform/RaspberryPi/RPi4/RPi4.fdf
index 1e13909a57..371197a93e 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -253,6 +253,7 @@ READ_LOCK_STATUS = TRUE
#
# Bds
#
+ INF
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
index fbf510ab96..4ef2f791ae 100644
---
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
+++
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
@@ -61,11 +61,13 @@
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType

[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
gRaspberryPiTokenSpaceGuid.PcdBootPolicy

[Guids]
+ gBootDiscoveryPolicyMgrFormsetGuid
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gEfiFileSystemVolumeLabelInfoIdGuid
@@ -73,8 +75,11 @@
gEfiTtyTermGuid
gUefiShellFileGuid
gEfiEventExitBootServicesGuid
+ gEfiBootManagerPolicyNetworkGuid
+ gEfiBootManagerPolicyConnectAllGuid

[Protocols]
+ gEfiBootManagerPolicyProtocolGuid
gEfiDevicePathProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiLoadedImageProtocolGuid
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index d081fdae63..d944d1a38d 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -6,6 +6,7 @@
* Copyright (c) 2015-2016, Red Hat, Inc.
* Copyright (c) 2014-2021, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
+ * Copyright (c) 2021, Semihalf All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -19,10 +20,12 @@
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
+#include <Protocol/BootManagerPolicy.h>
#include <Protocol/DevicePath.h>
#include <Protocol/EsrtManagement.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/LoadedImage.h>
+#include <Guid/BootDiscoveryPolicy.h>
#include <Guid/EventGroup.h>
#include <Guid/TtyTerm.h>
#include <ConfigVars.h>
@@ -598,6 +601,89 @@ PlatformBootManagerBeforeConsole (
FilterAndProcess (&gEfiUsb2HcProtocolGuid, NULL, Connect);
}

+/**
+ Connect device specified by BootDiscoverPolicy variable and refresh
+ Boot order for newly discovered boot device.
+
+ @retval EFI_SUCCESS Devices connected succesfully or connection
+ not required.
+ @retval others Return values from GetVariable(), LocateProtocol()
+ and ConnectDeviceClass().
+--*/
+STATIC
+EFI_STATUS
+BootDiscoveryPolicyHandler (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DiscoveryPolicy;
+ UINTN Size;
+ EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
+ EFI_GUID *Class;
+
+ Size = sizeof (DiscoveryPolicy);
+ Status = gRT->GetVariable (
+ BOOT_DISCOVERY_POLICY_VAR,
+ &gBootDiscoveryPolicyMgrFormsetGuid,
+ NULL,
+ &Size,
+ &DiscoveryPolicy
+ );
+ if (Status == EFI_NOT_FOUND) {
+ Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32
(PcdBootDiscoveryPolicy));
+ DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
+ return EFI_SUCCESS;
+ }
+
+ switch (DiscoveryPolicy) {
+ case BDP_CONNECT_NET:
+ Class = &gEfiBootManagerPolicyNetworkGuid;
+ break;
+ case BDP_CONNECT_ALL:
+ Class = &gEfiBootManagerPolicyConnectAllGuid;
+ break;
+ default:
+ DEBUG ((
+ DEBUG_INFO,
+ "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery
Policy\n",
+ __FUNCTION__,
+ DiscoveryPolicy
+ ));
+ return EFI_SUCCESS;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiBootManagerPolicyProtocolGuid,
+ NULL,
+ (VOID **)&BMPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a - Failed to locate
gEfiBootManagerPolicyProtocolGuid - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
+ if (EFI_ERROR (Status)){
+ DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n",
__FUNCTION__, Status));
+ return Status;
+ }
+
+ EfiBootManagerRefreshAllBootOption();
+
+ return EFI_SUCCESS;
+}
+
/**
Do the platform specific action after the console is ready
Possible things that can be done in PlatformBootManagerAfterConsole:
@@ -644,6 +730,11 @@ PlatformBootManagerAfterConsole (
DEBUG ((DEBUG_INFO, "Boot Policy is Fast Boot. Skip connecting all
devices\n"));
}

+ Status = BootDiscoveryPolicyHandler ();
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_INFO, "Error applying Boot Discovery Policy:%r\n",
Status));
+ }
+
Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,
(VOID**)&EsrtManagement);
if (!EFI_ERROR (Status)) {
EsrtManagement->SyncEsrtFmp ();
--
2.25.1
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot Discovery Policy.

Samer El-Haj-Mahmoud
 

Ard,

Now that the EDK2 changes are merged (aaecef38b9440a65809cbdaf9d97029f4eeb), I think these RPi specific changes are ready to be merged as well.

-----Original Message-----
From: Grzegorz Bernacki <gjb@...>
Sent: Monday, August 2, 2021 8:19 AM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; Sunny Wang
<Sunny.Wang@...>; mw@...; upstream@...;
pete@...; jian.j.wang@...; hao.a.wu@...;
dandan.bi@...; eric.dong@...; Grzegorz Bernacki
<gjb@...>; Sunny Wang <Sunny.Wang@...>
Subject: [edk2-platforms PATCH v5 1/2] Platform/RaspberryPi: Enable Boot
Discovery Policy.

This commit modify platform boot to check the value of
BootDiscoveryPolicy variable and use BootPolicyManager
Protocol to connect devices specified by the variable.

Signed-off-by: Grzegorz Bernacki <gjb@...>
Reviewed-by: Sunny Wang <sunny.wang@...>
---
Platform/RaspberryPi/RPi4/RPi4.dsc | 3 +
Platform/RaspberryPi/RPi4/RPi4.fdf | 1 +

Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootManag
erLib.inf | 5 ++
Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
| 91 ++++++++++++++++++++
4 files changed, 100 insertions(+)

diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc
b/Platform/RaspberryPi/RPi4/RPi4.dsc
index fd73c4d14b..8b9beac64a 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -555,6 +555,7 @@

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Columns"|gRasp
berryPiTokenSpaceGuid|0x0|80

gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|L"Rows"|gRaspb
erryPiTokenSpaceGuid|0x0|25

gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Rows"|gRaspberryPi
TokenSpaceGuid|0x0|25
+
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|L"BootDiscove
ryPolicy"|gBootDiscoveryPolicyMgrFormsetGuid|0

[PcdsDynamicDefault.common]
#
@@ -682,6 +683,7 @@
#
# Bds
#
+
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
@@ -690,6 +692,7 @@
Platform/RaspberryPi/Drivers/LogoDxe/LogoDxe.inf
MdeModulePkg/Application/UiApp/UiApp.inf {
<LibraryClasses>
+
NULL|MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
yUiLib.inf

NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf

NULL|Platform/RaspberryPi/Library/PlatformUiAppLib/PlatformUiAppLib.inf
diff --git a/Platform/RaspberryPi/RPi4/RPi4.fdf
b/Platform/RaspberryPi/RPi4/RPi4.fdf
index 1e13909a57..371197a93e 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.fdf
+++ b/Platform/RaspberryPi/RPi4/RPi4.fdf
@@ -253,6 +253,7 @@ READ_LOCK_STATUS = TRUE
#
# Bds
#
+ INF
MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.i
nf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
index fbf510ab96..4ef2f791ae 100644
---
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
+++
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBootMan
agerLib.inf
@@ -61,11 +61,13 @@
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType

[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gRaspberryPiTokenSpaceGuid.PcdSdIsArasan
gRaspberryPiTokenSpaceGuid.PcdBootPolicy

[Guids]
+ gBootDiscoveryPolicyMgrFormsetGuid
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gEfiFileSystemVolumeLabelInfoIdGuid
@@ -73,8 +75,11 @@
gEfiTtyTermGuid
gUefiShellFileGuid
gEfiEventExitBootServicesGuid
+ gEfiBootManagerPolicyNetworkGuid
+ gEfiBootManagerPolicyConnectAllGuid

[Protocols]
+ gEfiBootManagerPolicyProtocolGuid
gEfiDevicePathProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiLoadedImageProtocolGuid
diff --git
a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
index d081fdae63..d944d1a38d 100644
--- a/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/Platform/RaspberryPi/Library/PlatformBootManagerLib/PlatformBm.c
@@ -6,6 +6,7 @@
* Copyright (c) 2015-2016, Red Hat, Inc.
* Copyright (c) 2014-2021, ARM Ltd. All rights reserved.
* Copyright (c) 2004-2016, Intel Corporation. All rights reserved.
+ * Copyright (c) 2021, Semihalf All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@@ -19,10 +20,12 @@
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
+#include <Protocol/BootManagerPolicy.h>
#include <Protocol/DevicePath.h>
#include <Protocol/EsrtManagement.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/LoadedImage.h>
+#include <Guid/BootDiscoveryPolicy.h>
#include <Guid/EventGroup.h>
#include <Guid/TtyTerm.h>
#include <ConfigVars.h>
@@ -598,6 +601,89 @@ PlatformBootManagerBeforeConsole (
FilterAndProcess (&gEfiUsb2HcProtocolGuid, NULL, Connect);
}

+/**
+ Connect device specified by BootDiscoverPolicy variable and refresh
+ Boot order for newly discovered boot device.
+
+ @retval EFI_SUCCESS Devices connected succesfully or connection
+ not required.
+ @retval others Return values from GetVariable(), LocateProtocol()
+ and ConnectDeviceClass().
+--*/
+STATIC
+EFI_STATUS
+BootDiscoveryPolicyHandler (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 DiscoveryPolicy;
+ UINTN Size;
+ EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
+ EFI_GUID *Class;
+
+ Size = sizeof (DiscoveryPolicy);
+ Status = gRT->GetVariable (
+ BOOT_DISCOVERY_POLICY_VAR,
+ &gBootDiscoveryPolicyMgrFormsetGuid,
+ NULL,
+ &Size,
+ &DiscoveryPolicy
+ );
+ if (Status == EFI_NOT_FOUND) {
+ Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32
(PcdBootDiscoveryPolicy));
+ DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } else if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
+ return EFI_SUCCESS;
+ }
+
+ switch (DiscoveryPolicy) {
+ case BDP_CONNECT_NET:
+ Class = &gEfiBootManagerPolicyNetworkGuid;
+ break;
+ case BDP_CONNECT_ALL:
+ Class = &gEfiBootManagerPolicyConnectAllGuid;
+ break;
+ default:
+ DEBUG ((
+ DEBUG_INFO,
+ "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery
Policy\n",
+ __FUNCTION__,
+ DiscoveryPolicy
+ ));
+ return EFI_SUCCESS;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiBootManagerPolicyProtocolGuid,
+ NULL,
+ (VOID **)&BMPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a - Failed to locate
gEfiBootManagerPolicyProtocolGuid - %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
+ if (EFI_ERROR (Status)){
+ DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n",
__FUNCTION__, Status));
+ return Status;
+ }
+
+ EfiBootManagerRefreshAllBootOption();
+
+ return EFI_SUCCESS;
+}
+
/**
Do the platform specific action after the console is ready
Possible things that can be done in PlatformBootManagerAfterConsole:
@@ -644,6 +730,11 @@ PlatformBootManagerAfterConsole (
DEBUG ((DEBUG_INFO, "Boot Policy is Fast Boot. Skip connecting all
devices\n"));
}

+ Status = BootDiscoveryPolicyHandler ();
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_INFO, "Error applying Boot Discovery Policy:%r\n",
Status));
+ }
+
Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL,
(VOID**)&EsrtManagement);
if (!EFI_ERROR (Status)) {
EsrtManagement->SyncEsrtFmp ();
--
2.25.1
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [staging/edk2-redfish-client PATCH v2 2/2] edk2: Update Maintainers.txt

Leif Lindholm
 

On Tue, Jul 20, 2021 at 11:53:58 +0800, Abner Chang wrote:
Add maintainer and reviewer to RedfishClinetPkg.

Signed-off-by: Abner Chang <abner.chang@...>
Cc: Nickle Wang <nickle.wang@...>
Cc: Liming Gao <gaoliming@...>
Cc: Andrew Fish <afish@...>
Cc: Leif Lindholm <leif@...>
Cc: Michael D Kinney <michael.d.kinney@...>
---
Maintainers.txt | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index e9dda5c5ca..55068c9140 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -519,6 +519,11 @@ F: RedfishPkg/
M: Abner Chang <abner.chang@...>
R: Nickle Wang <nickle.wang@...>

+RedfishClientPkg: Redfish Client related modules
My interpretation of the normal use of this field is that we can add a
comment if the entry applies only to a subset of a package.
This adds an entry for a whole new package, and as such should only
state the name of the package.

With everything from the : until the end of line dropped:
Reviewed-by: Leif Lindholm <leif@...>

/
Leif

+F: RedfishClientPkg/
+M: Abner Chang <abner.chang@...>
+R: Nickle Wang <nickle.wang@...>
+
SecurityPkg
F: SecurityPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/SecurityPkg
--
2.17.1






Re: [Patch V2 3/3] Maintainers.txt: Add GitHub IDs

Leif Lindholm
 

On Thu, Jul 08, 2021 at 12:50:47 -0700, Michael D Kinney wrote:
Cc: Andrew Fish <afish@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Leif Lindholm <leif@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
Reviewed-by: Leif Lindholm <leif@...>

Apologies for tardiness.

---
Maintainers.txt | 282 ++++++++++++++++++++++++------------------------
1 file changed, 139 insertions(+), 143 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index f4e4c72d0628..575a80be5e89 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -68,10 +68,9 @@ F: */
Tianocore Stewards
------------------
F: *
-M: Andrew Fish <afish@...>
-M: Laszlo Ersek <lersek@...>
-M: Leif Lindholm <leif@...>
-M: Michael D Kinney <michael.d.kinney@...>
+M: Andrew Fish <afish@...> [ajfish]
+M: Leif Lindholm <leif@...> [leiflindholm]
+M: Michael D Kinney <michael.d.kinney@...> [mdkinney]

Responsible Disclosure, Reporting Security Issues
-------------------------------------------------
@@ -80,73 +79,72 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/Security
EDK II Releases:
----------------
W: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning
-M: Liming Gao <gaoliming@...>
+M: Liming Gao <gaoliming@...> [lgao4]

UEFI Shell Binaries (ShellBinPkg.zip) from EDK II Releases:
-----------------------------------------------------------
W: https://github.com/tianocore/edk2/releases/
-M: Ray Ni <ray.ni@...> (Ia32/X64)
-M: Zhichao Gao <zhichao.gao@...> (Ia32/X64)
-M: Leif Lindholm <leif@...> (ARM/AArch64)
-M: Ard Biesheuvel <ardb+tianocore@...> (ARM/AArch64)
+M: Ray Ni <ray.ni@...> [niruiyu] (Ia32/X64)
+M: Zhichao Gao <zhichao.gao@...> [ZhichaoGao] (Ia32/X64)
+M: Leif Lindholm <leif@...> [leiflindholm] (ARM/AArch64)
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel] (ARM/AArch64)

EDK II Architectures:
---------------------
ARM, AARCH64
F: */AArch64/
F: */Arm/
-M: Leif Lindholm <leif@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
+M: Leif Lindholm <leif@...> [leiflindholm]
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]

RISCV64
F: */RiscV64/
-M: Abner Chang <abner.chang@...>
+M: Abner Chang <abner.chang@...> [changab]
R: Daniel Schaefer <daniel.schaefer@...>

EDK II Continuous Integration:
------------------------------
.azurepipelines/
F: .azurepipelines/
-M: Sean Brogan <sean.brogan@...>
-M: Bret Barkelew <Bret.Barkelew@...>
-R: Michael D Kinney <michael.d.kinney@...>
-R: Liming Gao <gaoliming@...>
+M: Sean Brogan <sean.brogan@...> [spbrogan]
+M: Bret Barkelew <Bret.Barkelew@...> [corthon]
+R: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+R: Liming Gao <gaoliming@...> [lgao4]

.mergify/
F: .mergify/
-M: Michael D Kinney <michael.d.kinney@...>
-M: Liming Gao <gaoliming@...>
-R: Sean Brogan <sean.brogan@...>
-R: Bret Barkelew <Bret.Barkelew@...>
+M: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+M: Liming Gao <gaoliming@...> [lgao4]
+R: Sean Brogan <sean.brogan@...> [spbrogan]
+R: Bret Barkelew <Bret.Barkelew@...> [corthon]

.pytool/
F: .pytool/
-M: Sean Brogan <sean.brogan@...>
-M: Bret Barkelew <Bret.Barkelew@...>
-R: Michael D Kinney <michael.d.kinney@...>
-R: Liming Gao <gaoliming@...>
+M: Sean Brogan <sean.brogan@...> [spbrogan]
+M: Bret Barkelew <Bret.Barkelew@...> [corthon]
+R: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+R: Liming Gao <gaoliming@...> [lgao4]

EDK II Packages:
----------------
ArmPkg
F: ArmPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/ArmPkg
-M: Leif Lindholm <leif@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
+M: Leif Lindholm <leif@...> [leiflindholm]
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]

ArmPlatformPkg
F: ArmPlatformPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/ArmPlatformPkg
-M: Leif Lindholm <leif@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
+M: Leif Lindholm <leif@...> [leiflindholm]
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]

ArmVirtPkg
F: ArmVirtPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
-M: Laszlo Ersek <lersek@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
-R: Leif Lindholm <leif@...>
-R: Sami Mujawar <sami.mujawar@...>
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]
+R: Leif Lindholm <leif@...> [leiflindholm]
+R: Sami Mujawar <sami.mujawar@...> [samimujawar]

ArmVirtPkg: modules used on Xen
F: ArmVirtPkg/ArmVirtXen.*
@@ -161,78 +159,78 @@ R: Julien Grall <julien@...>
BaseTools
F: BaseTools/
W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
-M: Bob Feng <bob.c.feng@...>
-M: Liming Gao <gaoliming@...>
-R: Yuwei Chen <yuwei.chen@...>
+M: Bob Feng <bob.c.feng@...> [BobCF]
+M: Liming Gao <gaoliming@...> [lgao4]
+R: Yuwei Chen <yuwei.chen@...> [YuweiChen1110]

CryptoPkg
F: CryptoPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/CryptoPkg
-M: Jiewen Yao <jiewen.yao@...>
-M: Jian J Wang <jian.j.wang@...>
-R: Xiaoyu Lu <xiaoyux.lu@...>
-R: Guomin Jiang <guomin.jiang@...>
+M: Jiewen Yao <jiewen.yao@...> [jyao1]
+M: Jian J Wang <jian.j.wang@...> [jwang36]
+R: Xiaoyu Lu <xiaoyux.lu@...> [xiaoyuxlu]
+R: Guomin Jiang <guomin.jiang@...> [guominjia]

DynamicTablesPkg
F: DynamicTablesPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg
-M: Sami Mujawar <Sami.Mujawar@...>
-M: Alexei Fedorov <Alexei.Fedorov@...>
+M: Sami Mujawar <Sami.Mujawar@...> [samimujawar]
+M: Alexei Fedorov <Alexei.Fedorov@...> [AlexeiFedorov]

EmbeddedPkg
F: EmbeddedPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/EmbeddedPkg
-M: Leif Lindholm <leif@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
+M: Leif Lindholm <leif@...> [leiflindholm]
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]

EmulatorPkg
F: EmulatorPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
-M: Andrew Fish <afish@...>
-M: Ray Ni <ray.ni@...>
+M: Andrew Fish <afish@...> [ajfish]
+M: Ray Ni <ray.ni@...> [niruiyu]
S: Maintained

FatPkg
F: FatPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/Edk2-fat-driver
-M: Ray Ni <ray.ni@...>
+M: Ray Ni <ray.ni@...> [niruiyu]
T: svn - https://svn.code.sf.net/p/edk2-fatdriver2/code/trunk/EnhancedFat
T: git - https://github.com/tianocore/edk2-FatPkg.git

FmpDevicePkg
F: FmpDevicePkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/FmpDevicePkg
-M: Liming Gao <gaoliming@...>
-M: Michael D Kinney <michael.d.kinney@...>
-R: Guomin Jiang <guomin.jiang@...>
-R: Wei6 Xu <wei6.xu@...>
+M: Liming Gao <gaoliming@...> [lgao4]
+M: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+R: Guomin Jiang <guomin.jiang@...> [guominjia]
+R: Wei6 Xu <wei6.xu@...> [xuweiintel]

IntelFsp2Pkg
F: IntelFsp2Pkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/IntelFsp2Pkg
-M: Chasel Chiu <chasel.chiu@...>
-R: Nate DeSimone <nathaniel.l.desimone@...>
-R: Star Zeng <star.zeng@...>
+M: Chasel Chiu <chasel.chiu@...> [ChaselChiu]
+R: Nate DeSimone <nathaniel.l.desimone@...> [nate-desimone]
+R: Star Zeng <star.zeng@...> [lzeng14]

IntelFsp2WrapperPkg
F: IntelFsp2WrapperPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/IntelFsp2WrapperPkg
-M: Chasel Chiu <chasel.chiu@...>
-R: Nate DeSimone <nathaniel.l.desimone@...>
-R: Star Zeng <star.zeng@...>
+M: Chasel Chiu <chasel.chiu@...> [ChaselChiu]
+R: Nate DeSimone <nathaniel.l.desimone@...> [nate-desimone]
+R: Star Zeng <star.zeng@...> [lzeng14]

MdeModulePkg
F: MdeModulePkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
-M: Jian J Wang <jian.j.wang@...>
-M: Hao A Wu <hao.a.wu@...>
+M: Jian J Wang <jian.j.wang@...> [jwang36]
+M: Hao A Wu <hao.a.wu@...> [hwu25]

MdeModulePkg: ACPI modules
F: MdeModulePkg/Include/*Acpi*.h
F: MdeModulePkg/Universal/Acpi/
-R: Zhiguang Liu <zhiguang.liu@...>
-R: Dandan Bi <dandan.bi@...>
-R: Liming Gao <gaoliming@...>
+R: Zhiguang Liu <zhiguang.liu@...> [LiuZhiguang001]
+R: Dandan Bi <dandan.bi@...> [dandanbi]
+R: Liming Gao <gaoliming@...> [lgao4]

MdeModulePkg: ACPI modules related to S3
F: MdeModulePkg/*LockBox*/
@@ -240,8 +238,8 @@ F: MdeModulePkg/Include/*BootScript*.h
F: MdeModulePkg/Include/*LockBox*.h
F: MdeModulePkg/Include/*S3*.h
F: MdeModulePkg/Library/*S3*/
-R: Hao A Wu <hao.a.wu@...>
-R: Eric Dong <eric.dong@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Eric Dong <eric.dong@...> [ydong10]

MdeModulePkg: BDS modules
F: MdeModulePkg/*BootManager*/
@@ -251,8 +249,8 @@ F: MdeModulePkg/Universal/DevicePathDxe/
F: MdeModulePkg/Universal/DriverHealthManagerDxe/
F: MdeModulePkg/Universal/LoadFileOnFv2/
F: MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.*
-R: Zhichao Gao <zhichao.gao@...>
-R: Ray Ni <ray.ni@...>
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdeModulePkg: Console and Graphics modules
F: MdeModulePkg/*Logo*/
@@ -266,8 +264,8 @@ F: MdeModulePkg/Include/Library/FrameBufferBltLib.h
F: MdeModulePkg/Library/BaseBmpSupportLib/
F: MdeModulePkg/Library/FrameBufferBltLib/
F: MdeModulePkg/Universal/Console/
-R: Zhichao Gao <zhichao.gao@...>
-R: Ray Ni <ray.ni@...>
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdeModulePkg: Core services (PEI, DXE and Runtime) modules
F: MdeModulePkg/*Mem*/
@@ -293,8 +291,8 @@ F: MdeModulePkg/Library/DxeSecurityManagementLib/
F: MdeModulePkg/Universal/PCD/
F: MdeModulePkg/Universal/PlatformDriOverrideDxe/
F: MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
-R: Dandan Bi <dandan.bi@...>
-R: Liming Gao <gaoliming@...>
+R: Dandan Bi <dandan.bi@...> [dandanbi]
+R: Liming Gao <gaoliming@...> [lgao4]

MdeModulePkg: Device and Peripheral modules
F: MdeModulePkg/*PciHostBridge*/
@@ -313,14 +311,14 @@ F: MdeModulePkg/Include/Ppi/StorageSecurityCommand.h
F: MdeModulePkg/Include/Protocol/Ps2Policy.h
F: MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/
F: MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/
-R: Hao A Wu <hao.a.wu@...>
-R: Ray Ni <ray.ni@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdeModulePkg: Disk modules
F: MdeModulePkg/Universal/Disk/
-R: Hao A Wu <hao.a.wu@...>
-R: Ray Ni <ray.ni@...>
-R: Zhichao Gao <zhichao.gao@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Ray Ni <ray.ni@...> [niruiyu]
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]

MdeModulePkg: Firmware Update modules
F: MdeModulePkg/*Capsule*/
@@ -332,9 +330,9 @@ F: MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h
F: MdeModulePkg/Library/DisplayUpdateProgressLib*/
F: MdeModulePkg/Library/FmpAuthenticationLibNull/
F: MdeModulePkg/Universal/Esrt*/
-R: Hao A Wu <hao.a.wu@...>
-R: Liming Gao <gaoliming@...>
-R: Guomin Jiang <guomin.jiang@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Liming Gao <gaoliming@...> [lgao4]
+R: Guomin Jiang <guomin.jiang@...> [guominjia]

MdeModulePkg: HII and UI modules
F: MdeModulePkg/*FileExplorer*/
@@ -350,44 +348,44 @@ F: MdeModulePkg/Library/CustomizedDisplayLib/
F: MdeModulePkg/Universal/DisplayEngineDxe/
F: MdeModulePkg/Universal/DriverSampleDxe/
F: MdeModulePkg/Universal/SetupBrowserDxe/
-R: Dandan Bi <dandan.bi@...>
-R: Eric Dong <eric.dong@...>
+R: Dandan Bi <dandan.bi@...> [dandanbi]
+R: Eric Dong <eric.dong@...> [ydong10]

MdeModulePkg: Management Mode (MM, SMM) modules
F: MdeModulePkg/*Smi*/
F: MdeModulePkg/*Smm*/
F: MdeModulePkg/Include/*Smi*.h
F: MdeModulePkg/Include/*Smm*.h
-R: Eric Dong <eric.dong@...>
-R: Ray Ni <ray.ni@...>
+R: Eric Dong <eric.dong@...> [ydong10]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdeModulePkg: Pei Core
F: MdeModulePkg/Core/Pei/
-R: Dandan Bi <dandan.bi@...>
-R: Liming Gao <gaoliming@...>
+R: Dandan Bi <dandan.bi@...> [dandanbi]
+R: Liming Gao <gaoliming@...> [lgao4]
R: Debkumar De <debkumar.de@...>
R: Harry Han <harry.han@...>
-R: Catharine West <catharine.west@...>
+R: Catharine West <catharine.west@...> [catharine-intl]

MdeModulePkg: Reset modules
F: MdeModulePkg/*Reset*/
F: MdeModulePkg/Include/*Reset*.h
-R: Zhichao Gao <zhichao.gao@...>
-R: Ray Ni <ray.ni@...>
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdeModulePkg: Serial modules
F: MdeModulePkg/*Serial*/
F: MdeModulePkg/Include/*SerialPort*.h
-R: Hao A Wu <hao.a.wu@...>
-R: Ray Ni <ray.ni@...>
-R: Zhichao Gao <zhichao.gao@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Ray Ni <ray.ni@...> [niruiyu]
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]

MdeModulePkg: SMBIOS modules
F: MdeModulePkg/Universal/Smbios*/
-R: Zhiguang Liu <zhiguang.liu@...>
-R: Dandan Bi <dandan.bi@...>
-R: Star Zeng <star.zeng@...>
-R: Zhichao Gao <zhichao.gao@...>
+R: Zhiguang Liu <zhiguang.liu@...> [LiuZhiguang001]
+R: Dandan Bi <dandan.bi@...> [dandanbi]
+R: Star Zeng <star.zeng@...> [lzeng14]
+R: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]

MdeModulePkg: UEFI Variable modules
F: MdeModulePkg/*Var*/
@@ -396,34 +394,33 @@ F: MdeModulePkg/Include/*/*Var*.h
F: MdeModulePkg/Include/Guid/SystemNvDataGuid.h
F: MdeModulePkg/Include/Protocol/SwapAddressRange.h
F: MdeModulePkg/Universal/FaultTolerantWrite*/
-R: Hao A Wu <hao.a.wu@...>
-R: Liming Gao <gaoliming@...>
+R: Hao A Wu <hao.a.wu@...> [hwu25]
+R: Liming Gao <gaoliming@...> [lgao4]

MdeModulePkg: Universal Payload definitions
F: MdeModulePkg/Include/UniversalPayload/
-R: Zhiguang Liu <zhiguang.liu@...>
-R: Ray Ni <ray.ni@...>
+R: Zhiguang Liu <zhiguang.liu@...> [LiuZhiguang001]
+R: Ray Ni <ray.ni@...> [niruiyu]

MdePkg
F: MdePkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
-M: Michael D Kinney <michael.d.kinney@...>
-M: Liming Gao <gaoliming@...>
-R: Zhiguang Liu <zhiguang.liu@...>
+M: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+M: Liming Gao <gaoliming@...> [lgao4]
+R: Zhiguang Liu <zhiguang.liu@...> [LiuZhiguang001]

NetworkPkg
F: NetworkPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
-M: Maciej Rabeda <maciej.rabeda@...>
-R: Jiaxin Wu <jiaxin.wu@...>
-R: Siyuan Fu <siyuan.fu@...>
+M: Maciej Rabeda <maciej.rabeda@...> [mrabeda]
+R: Jiaxin Wu <jiaxin.wu@...> [jiaxinwu]
+R: Siyuan Fu <siyuan.fu@...> [sfu5]

OvmfPkg
F: OvmfPkg/
W: http://www.tianocore.org/ovmf/
-M: Laszlo Ersek <lersek@...>
-M: Ard Biesheuvel <ardb+tianocore@...>
-R: Jordan Justen <jordan.l.justen@...>
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]
+R: Jordan Justen <jordan.l.justen@...> [jljusten]
S: Maintained

OvmfPkg: bhyve-related modules
@@ -437,12 +434,12 @@ F: OvmfPkg/Library/PciHostBridgeLibScan/
F: OvmfPkg/Library/PlatformBootManagerLibBhyve/
F: OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
F: OvmfPkg/Library/ResetSystemLib/BaseResetSystemLibBhyve.inf
-R: Rebecca Cran <rebecca@...>
-R: Peter Grehan <grehan@...>
+R: Rebecca Cran <rebecca@...> [bcran]
+R: Peter Grehan <grehan@...> [grehan-freebsd]

OvmfPkg: CSM modules
F: OvmfPkg/Csm/
-R: David Woodhouse <dwmw2@...>
+R: David Woodhouse <dwmw2@...> [dwmw2]

OvmfPkg: Confidential Computing
F: OvmfPkg/AmdSev/
@@ -456,12 +453,12 @@ F: OvmfPkg/Library/VmgExitLib/
F: OvmfPkg/PlatformPei/AmdSev.c
F: OvmfPkg/ResetVector/
F: OvmfPkg/Sec/
-R: Brijesh Singh <brijesh.singh@...>
+R: Brijesh Singh <brijesh.singh@...> [codomania]
R: Erdem Aktas <erdemaktas@...>
-R: James Bottomley <jejb@...>
-R: Jiewen Yao <jiewen.yao@...>
-R: Min Xu <min.m.xu@...>
-R: Tom Lendacky <thomas.lendacky@...>
+R: James Bottomley <jejb@...> [jejb]
+R: Jiewen Yao <jiewen.yao@...> [jyao1]
+R: Min Xu <min.m.xu@...> [mxu9]
+R: Tom Lendacky <thomas.lendacky@...> [tlendacky]

OvmfPkg: LsiScsi driver
F: OvmfPkg/LsiScsiDxe/
@@ -509,86 +506,85 @@ F: OvmfPkg/XenPlatformPei/
F: OvmfPkg/XenPvBlkDxe/
F: OvmfPkg/XenResetVector/
F: OvmfPkg/XenTimerDxe/
-R: Anthony Perard <anthony.perard@...>
+R: Anthony Perard <anthony.perard@...> [sheep]
R: Julien Grall <julien@...>

PcAtChipsetPkg
F: PcAtChipsetPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/PcAtChipsetPkg
-M: Ray Ni <ray.ni@...>
+M: Ray Ni <ray.ni@...> [niruiyu]

RedfishPkg: Redfish related modules
F: RedfishPkg/
-M: Abner Chang <abner.chang@...>
-R: Nickle Wang <nickle.wang@...>
+M: Abner Chang <abner.chang@...> [changab]
+R: Nickle Wang <nickle.wang@...> [nicklela]

SecurityPkg
F: SecurityPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/SecurityPkg
-M: Jiewen Yao <jiewen.yao@...>
-M: Jian J Wang <jian.j.wang@...>
+M: Jiewen Yao <jiewen.yao@...> [jyao1]
+M: Jian J Wang <jian.j.wang@...> [jwang36]

SecurityPkg: Secure boot related modules
F: SecurityPkg/Library/DxeImageVerificationLib/
F: SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/
F: SecurityPkg/Library/AuthVariableLib/
-R: Min Xu <min.m.xu@...>
+R: Min Xu <min.m.xu@...> [mxu9]

SecurityPkg: Tcg related modules
F: SecurityPkg/Tcg/
-R: Qi Zhang <qi1.zhang@...>
-R: Rahul Kumar <rahul1.kumar@...>
+R: Qi Zhang <qi1.zhang@...> [qizhangz]
+R: Rahul Kumar <rahul1.kumar@...> [rahul1-kumar]

ShellPkg
F: ShellPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/ShellPkg
-M: Ray Ni <ray.ni@...>
-M: Zhichao Gao <zhichao.gao@...>
+M: Ray Ni <ray.ni@...> [niruiyu]
+M: Zhichao Gao <zhichao.gao@...> [ZhichaoGao]

SignedCapsulePkg
F: SignedCapsulePkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/SignedCapsulePkg
-M: Jian J Wang <jian.j.wang@...>
+M: Jian J Wang <jian.j.wang@...> [jwang36]

SourceLevelDebugPkg
F: SourceLevelDebugPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/SourceLevelDebugPkg
-M: Hao A Wu <hao.a.wu@...>
+M: Hao A Wu <hao.a.wu@...> [hwu25]

StandaloneMmPkg
F: StandaloneMmPkg/
-M: Ard Biesheuvel <ardb+tianocore@...>
-M: Sami Mujawar <sami.mujawar@...>
-M: Jiewen Yao <jiewen.yao@...>
-R: Supreeth Venkatesh <supreeth.venkatesh@...>
+M: Ard Biesheuvel <ardb+tianocore@...> [ardbiesheuvel]
+M: Sami Mujawar <sami.mujawar@...> [samimujawar]
+M: Jiewen Yao <jiewen.yao@...> [jyao1]
+R: Supreeth Venkatesh <supreeth.venkatesh@...> [supven01]

UefiCpuPkg
F: UefiCpuPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/UefiCpuPkg
-M: Eric Dong <eric.dong@...>
-M: Ray Ni <ray.ni@...>
-R: Laszlo Ersek <lersek@...>
-R: Rahul Kumar <rahul1.kumar@...>
+M: Eric Dong <eric.dong@...> [ydong10]
+M: Ray Ni <ray.ni@...> [niruiyu]
+R: Rahul Kumar <rahul1.kumar@...> [rahul1-kumar]

UefiCpuPkg: Sec related modules
F: UefiCpuPkg/SecCore/
F: UefiCpuPkg/ResetVector/
R: Debkumar De <debkumar.de@...>
R: Harry Han <harry.han@...>
-R: Catharine West <catharine.west@...>
+R: Catharine West <catharine.west@...> [catharine-intl]

UefiPayloadPkg
F: UefiPayloadPkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/UefiPayloadPkg
-M: Guo Dong <guo.dong@...>
-M: Ray Ni <ray.ni@...>
-R: Maurice Ma <maurice.ma@...>
-R: Benjamin You <benjamin.you@...>
+M: Guo Dong <guo.dong@...> [gdong1]
+M: Ray Ni <ray.ni@...> [niruiyu]
+R: Maurice Ma <maurice.ma@...> [mauricema]
+R: Benjamin You <benjamin.you@...> [BenjaminYou]
S: Maintained

UnitTestFrameworkPkg
F: UnitTestFrameworkPkg/
-M: Michael D Kinney <michael.d.kinney@...>
-R: Sean Brogan <sean.brogan@...>
-R: Bret Barkelew <Bret.Barkelew@...>
+M: Michael D Kinney <michael.d.kinney@...> [mdkinney]
+R: Sean Brogan <sean.brogan@...> [spbrogan]
+R: Bret Barkelew <Bret.Barkelew@...> [corthon]
S: Maintained
--
2.32.0.windows.1


Re: [edk2-platforms][PATCH v5 21/46] KabylakeOpenBoardPkg: Update SpiFvbService & SpiFlashCommonLib

Chiu, Chasel
 

Please see my comments below inline.

Thanks,
Chasel

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Tuesday, August 3, 2021 10:39 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L
<nathaniel.l.desimone@...>; Jeremy Soller <jeremy@...>
Subject: [edk2-platforms][PATCH v5 21/46] KabylakeOpenBoardPkg: Update
SpiFvbService & SpiFlashCommonLib

From: Michael Kubacki <michael.kubacki@...>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3307

Updates KabylakeOpenBoardPkg to use the SmmSpiFlashCommonLib instance in
IntelSiliconPkg and the SpiFvbServiceSmm driver in IntelSiliconPkg.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Jeremy Soller <jeremy@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>
Reviewed-by: Chasel Chiu <chasel.chiu@...>
---
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 7
+++++--
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf | 2 +-
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc | 7
+++++--
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf | 2 +-
4 files changed, 12 insertions(+), 6 deletions(-)

diff --git
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 302cb679b5eb..89be744a9038 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -228,7 +228,7 @@ [LibraryClasses.X64.DXE_SMM_DRIVER]
#######################################
# Silicon Initialization Package
#######################################
-
SpiFlashCommonLib|$(PLATFORM_SI_PACKAGE)/Pch/Library/SmmSpiFlashCom
monLib/SmmSpiFlashCommonLib.inf
+
+
SpiFlashCommonLib|IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiF
+ lashCommonLib.inf

#######################################
# Platform Package
@@ -377,6 +377,10 @@ [Components.X64]
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf
$(PLATFORM_SI_BIN_PACKAGE)/Microcode/MicrocodeUpdates.inf

+!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
+ IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+!endif
+

I encountered build failure because this file not found, did I miss any prerequisite patch?



#######################################
# Platform Package
#######################################
@@ -393,7 +397,6 @@ [Components.X64]

!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE

- $(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf

$(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf { diff --git
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index 39432d21b8b5..239b6b720a6a 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -401,7 +401,7 @@ [FV.FvOsBootUncompact] !if
gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE INF
$(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyDxe/SiliconPolicyDxe.inf
INF
$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
-INF $(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+INF IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf

INF $(PLATFORM_PACKAGE)/Acpi/AcpiTables/AcpiPlatform.inf
INF $(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf
diff --git
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 8523ab3f4fc1..f29393579c06 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -268,7 +268,7 @@ [LibraryClasses.X64.DXE_SMM_DRIVER]
#######################################
# Silicon Initialization Package
#######################################
-
SpiFlashCommonLib|$(PLATFORM_SI_PACKAGE)/Pch/Library/SmmSpiFlashCom
monLib/SmmSpiFlashCommonLib.inf
+
+
SpiFlashCommonLib|IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiF
+ lashCommonLib.inf

#######################################
# Platform Package
@@ -456,6 +456,10 @@ [Components.X64]
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf
$(PLATFORM_SI_BIN_PACKAGE)/Microcode/MicrocodeUpdates.inf

+!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
+ IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+!endif
+
#######################################
# Platform Package
#######################################
@@ -472,7 +476,6 @@ [Components.X64]

!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE

- $(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf

$(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf { diff --git
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index f003dda0ddfc..23f9be5cf2a2 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
@@ -408,7 +408,7 @@ [FV.FvOsBootUncompact] !if
gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE INF
$(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyDxe/SiliconPolicyDxe.inf
INF
$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
-INF $(PLATFORM_PACKAGE)/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+INF IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf

INF $(PLATFORM_PACKAGE)/Acpi/AcpiTables/AcpiPlatform.inf
INF $(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf
--
2.28.0.windows.1


Re: [edk2-platforms PATCH 3/6] Marvell: Armada7k8kPciHostBridgeLib: Remove ECAM base limitation

Marcin Wojtas
 

wt., 3 sie 2021 o 08:53 Ard Biesheuvel <ardb@...> napisał(a):

On Mon, 2 Aug 2021 at 19:00, Marcin Wojtas <mw@...> wrote:

Hi Ard,

pon., 2 sie 2021 o 10:43 Ard Biesheuvel <ardb@...> napisał(a):

On Mon, 2 Aug 2021 at 07:01, Marcin Wojtas <mw@...> wrote:

On CN913x-based platforms it is possible to have up to 9 PCIE
root complexes. In such case it may be necessary to configure
more configuration spaces with smaller bus count, so that
to fit the memory layout constraints. For that purpose remove
forcing ECAM base to be divisible by SIZE_256MB.
There is one subtlety here that we need to take into account: IIUC,
PCIe requires that the ECAM start address of bus N equals N MB modulo
256 MB. In other words, if your ECAM range lives at 1 GB + 128 MB, the
bus range has to start at bus 128.

I think OSes are usually quite lax about this, but it is something to
double check regardless, even for existing platforms
I tested a wide range of OSs (various Linux distributions, Win10 PE,
FreeBSD, OpenBSD and of course EDK2) and with 7 ECAMs, of which 6 are
squeezed within 256MB memory chunk together with their mmio32 and no
issue was observed. Moreover, if you recall, contrary to the EDK2,
where the full bus number is used, in ACPI we expose a single 1MB
space with the ECAM base address aligned to 0x8000.
Ah yes, I had forgotten about that hack :-)
A great one though.


Do you wish to change the assertion in EDK2 instead of removing?
No worries - if all those OSes are fine with this, I don't see a point
in being pedantic. I will note, however, that you can still comply
with this requirement by changing the bus ranges: each RC only uses a
single bus, but that bus number could be (ECAM base address / 1M) %
256
For OS's there is indeed only bus0 exposed, but I plan to make it
tunable, so that to use entire range (e.g. for FreeBSD). In EDK2 there
is full coverage. FYI, in the platform I plan to submit after this
patchset there 7 RC's: 1 with 255 and 6 with 15 busses (the last 1 MB
in each case is used for IO space).

Best regards,
Marcin



Signed-off-by: Marcin Wojtas <mw@...>
---
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
index 067e57a2dc..87e57aeae3 100644
--- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
+++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
@@ -219,7 +219,6 @@ Armada7k8kPciHostBridgeLibConstructor (
PcieController = &(BoardPcieDescription->PcieControllers[Index]);

ASSERT (PcieController->PcieBusMin == 0);
- ASSERT (PcieController->ConfigSpaceAddress % SIZE_256MB == 0);

if (PcieController->HaveResetGpio == TRUE) {
/* Reset PCIE slot */
--
2.29.0


Re: [PATCH v8 00/11] Secure Boot default keys

Ard Biesheuvel
 

On Mon, 2 Aug 2021 at 12:47, Grzegorz Bernacki <gjb@...> wrote:

This patchset adds support for initialization of default
Secure Boot variables based on keys content embedded in
flash binary. This feature is active only if Secure Boot
is enabled and DEFAULT_KEY is defined. The patchset
consist also application to enroll keys from default
variables and secure boot menu change to allow user
to reset key content to default values.
Discussion on design can be found at:
https://edk2.groups.io/g/rfc/topic/82139806#600

Built with:
GCC
- RISC-V (U500, U540) [requires fixes in dsc to build]
- Intel (Vlv2TbltDevicePkg (X64/IA32), Quark, MinPlatformPkg,
EmulatorPkg (X64), Bhyve, OvmfPkg (X64/IA32))
- ARM (Sgi75,SbsaQemu,DeveloperBox, RPi3/RPi4)

RISC-V, Quark, Vlv2TbltDevicePkg, Bhyve requires additional fixes to be built,
will be post on edk2 maillist later

VS2019
- Intel (OvmfPkgX64)

Test with:
GCC5/RPi4
VS2019/OvmfX64 (requires changes to enable feature)

Tests:
1. Try to enroll key in incorrect format.
2. Enroll with only PKDefault keys specified.
3. Enroll with all keys specified.
4. Enroll when keys are enrolled.
5. Reset keys values.
6. Running signed & unsigned app after enrollment.

Changes since v1:
- change names:
SecBootVariableLib => SecureBootVariableLib
SecBootDefaultKeysDxe => SecureBootDefaultKeysDxe
SecEnrollDefaultKeysApp => EnrollFromDefaultKeysApp
- change name of function CheckSetupMode to GetSetupMode
- remove ShellPkg dependecy from EnrollFromDefaultKeysApp
- rebase to master

Changes since v2:
- fix coding style for functions headers in SecureBootVariableLib.h
- add header to SecureBootDefaultKeys.fdf.inc
- remove empty line spaces in SecureBootDefaultKeysDxe files
- revert FAIL macro in EnrollFromDefaultKeysApp
- remove functions duplicates and add SecureBootVariableLib
to platforms which used it

Changes since v3:
- move SecureBootDefaultKeys.fdf.inc to ArmPlatformPkg
- leave duplicate of CreateTimeBasedPayload in PlatformVarCleanupLib
- fix typo in guid description

Changes since v4:
- reorder patches to make it bisectable
- split commits related to more than one platform
- move edk2-platform commits to separate patchset

Changes since v5:
- split SecureBootVariableLib into SecureBootVariableLib and
SecureBootVariableProvisionLib

Changes since v6:
- fix problems found by CI
- add correct modules to SecurityPkg.dsc
- update SecurityPkg.dec
- fix coding style issues

Changes since v7:
- fix coding style issues
v8 merged as #1850

Thanks all

NOTE: edk2-platform has not been changed and v6 platform patches
are still valid

Grzegorz Bernacki (11):
SecurityPkg: Create SecureBootVariableLib.
SecurityPkg: Create library for enrolling Secure Boot variables.
ArmVirtPkg: add SecureBootVariableLib class resolution
OvmfPkg: add SecureBootVariableLib class resolution
EmulatorPkg: add SecureBootVariableLib class resolution
SecurityPkg: Remove duplicated functions from SecureBootConfigDxe.
ArmPlatformPkg: Create include file for default key content.
SecurityPkg: Add SecureBootDefaultKeysDxe driver
SecurityPkg: Add EnrollFromDefaultKeys application.
SecurityPkg: Add new modules to Security package.
SecurityPkg: Add option to reset secure boot keys.

SecurityPkg/SecurityPkg.dec | 22 +
ArmVirtPkg/ArmVirt.dsc.inc | 2 +
EmulatorPkg/EmulatorPkg.dsc | 2 +
OvmfPkg/Bhyve/BhyveX64.dsc | 2 +
OvmfPkg/OvmfPkgIa32.dsc | 2 +
OvmfPkg/OvmfPkgIa32X64.dsc | 2 +
OvmfPkg/OvmfPkgX64.dsc | 2 +
SecurityPkg/SecurityPkg.dsc | 9 +-
SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.inf | 48 ++
SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf | 80 +++
SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf | 80 +++
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf | 3 +
SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf | 46 ++
SecurityPkg/Include/Library/SecureBootVariableLib.h | 153 ++++++
SecurityPkg/Include/Library/SecureBootVariableProvisionLib.h | 134 +++++
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigNvData.h | 2 +
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr | 6 +
SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.c | 115 +++++
SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c | 510 ++++++++++++++++++++
SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c | 482 ++++++++++++++++++
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c | 343 ++++++-------
SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c | 69 +++
ArmPlatformPkg/SecureBootDefaultKeys.fdf.inc | 70 +++
SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.uni | 17 +
SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.uni | 16 +
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigStrings.uni | 4 +
SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.uni | 16 +
27 files changed, 2048 insertions(+), 189 deletions(-)
create mode 100644 SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.inf
create mode 100644 SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
create mode 100644 SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
create mode 100644 SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf
create mode 100644 SecurityPkg/Include/Library/SecureBootVariableLib.h
create mode 100644 SecurityPkg/Include/Library/SecureBootVariableProvisionLib.h
create mode 100644 SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.c
create mode 100644 SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c
create mode 100644 SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c
create mode 100644 SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c
create mode 100644 ArmPlatformPkg/SecureBootDefaultKeys.fdf.inc
create mode 100644 SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.uni
create mode 100644 SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.uni
create mode 100644 SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.uni

--
2.25.1


Re: [edk2-platforms PATCH 0/6] Marvell multiple PCIE support

Ard Biesheuvel
 

On Mon, 2 Aug 2021 at 07:01, Marcin Wojtas <mw@...> wrote:

This patchset is a preparation for adding a new platform
(CN913x CEx7 Evaluation Board). It modifies a common
Marvell code in order to enable multiple PCIE controllers.
Moreover a default interrupt map is reworked, so that to
support all CP11x south bridge units.
Last but not least, a custom initialization sequence
can be executed thanks to a new board description library
extension.

More details can be found in the commit logs.
The patchest is publicly available in the github:
https://github.com/semihalf-wojtas-marcin/edk2-platforms/commits/pcie-r20210802

Best regards,
Marcin

Kamil Koczurek (1):
Marvell: Armada7k8k/OcteonTx: Add multiple PCIE ports support

Marcin Wojtas (5):
Marvell: Armada7k8k/OcteonTx: Allow memory mapping for more config
spaces
Marvell: Armada7k8k/OcteonTx: Allow tuning PCIE config space size
Marvell: Armada7k8kPciHostBridgeLib: Remove ECAM base limitation
Marvell: Armada7k8k/OcteonTX: Enable additional board configuration
Marvell: IcuLib: Rework default interrupt map
Pushed as d84c0545f4b4..73ccc21d918c

Thanks,


Platform/Marvell/Cn913xDb/Cn9130DbA.dsc.inc | 7 --
Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 7 --
Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 +
Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 1 +
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciSegmentLib/PciSegmentLib.inf | 11 +-
Silicon/Marvell/Armada7k8k/AcpiTables/IcuInterrupts.h | 48 ++++----
Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 10 ++
Silicon/Marvell/Library/IcuLib/IcuLib.h | 6 +-
Silicon/Marvell/OcteonTx/AcpiTables/T91/IcuInterrupts.h | 61 +++++++----
Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 11 ++
Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 11 ++
Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c | 11 ++
Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9132DbABoardDescLib.c | 11 ++
Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 11 ++
Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.c | 2 +
Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 18 ++-
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLib.c | 15 ++-
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c | 1 -
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciSegmentLib/PciSegmentLib.c | 69 +++++++++++-
Silicon/Marvell/Library/IcuLib/IcuLib.c | 115 ++++++--------------
20 files changed, 267 insertions(+), 160 deletions(-)

--
2.29.0


Re: [edk2-platforms PATCH 3/6] Marvell: Armada7k8kPciHostBridgeLib: Remove ECAM base limitation

Ard Biesheuvel
 

On Mon, 2 Aug 2021 at 19:00, Marcin Wojtas <mw@...> wrote:

Hi Ard,

pon., 2 sie 2021 o 10:43 Ard Biesheuvel <ardb@...> napisał(a):

On Mon, 2 Aug 2021 at 07:01, Marcin Wojtas <mw@...> wrote:

On CN913x-based platforms it is possible to have up to 9 PCIE
root complexes. In such case it may be necessary to configure
more configuration spaces with smaller bus count, so that
to fit the memory layout constraints. For that purpose remove
forcing ECAM base to be divisible by SIZE_256MB.
There is one subtlety here that we need to take into account: IIUC,
PCIe requires that the ECAM start address of bus N equals N MB modulo
256 MB. In other words, if your ECAM range lives at 1 GB + 128 MB, the
bus range has to start at bus 128.

I think OSes are usually quite lax about this, but it is something to
double check regardless, even for existing platforms
I tested a wide range of OSs (various Linux distributions, Win10 PE,
FreeBSD, OpenBSD and of course EDK2) and with 7 ECAMs, of which 6 are
squeezed within 256MB memory chunk together with their mmio32 and no
issue was observed. Moreover, if you recall, contrary to the EDK2,
where the full bus number is used, in ACPI we expose a single 1MB
space with the ECAM base address aligned to 0x8000.
Ah yes, I had forgotten about that hack :-)

Do you wish to change the assertion in EDK2 instead of removing?
No worries - if all those OSes are fine with this, I don't see a point
in being pedantic. I will note, however, that you can still comply
with this requirement by changing the bus ranges: each RC only uses a
single bus, but that bus number could be (ECAM base address / 1M) %
256



Signed-off-by: Marcin Wojtas <mw@...>
---
Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
index 067e57a2dc..87e57aeae3 100644
--- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
+++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciHostBridgeLib/PciHostBridgeLibConstructor.c
@@ -219,7 +219,6 @@ Armada7k8kPciHostBridgeLibConstructor (
PcieController = &(BoardPcieDescription->PcieControllers[Index]);

ASSERT (PcieController->PcieBusMin == 0);
- ASSERT (PcieController->ConfigSpaceAddress % SIZE_256MB == 0);

if (PcieController->HaveResetGpio == TRUE) {
/* Reset PCIE slot */
--
2.29.0


Re: [PATCH v5 1/1] MdeModulePkg: Add BootDiscoveryPolicyUiLib.

Grzegorz Bernacki
 

Hi Hao,
Thanks a lot.
regards,
greg

wt., 3 sie 2021 o 07:12 Wu, Hao A <hao.a.wu@...> napisał(a):


Thanks all,

Patch merged via:
PR - https://github.com/tianocore/edk2/pull/1858
Commit - https://github.com/tianocore/edk2/commit/2b47aaecef38b9440a65809cbdaf9d97029f4eeb

Best Regards,
Hao Wu

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sunny
Wang
Sent: Tuesday, August 3, 2021 11:03 AM
To: Gao, Zhichao <zhichao.gao@...>; Wu, Hao A
<hao.a.wu@...>; devel@edk2.groups.io; gjb@...
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; mw@...;
upstream@...; pete@...; Wang, Jian J
<jian.j.wang@...>; Bi, Dandan <dandan.bi@...>; Dong, Eric
<eric.dong@...>; Sunny Wang <Sunny.Wang@...>
Subject: Re: [edk2-devel] [PATCH v5 1/1] MdeModulePkg: Add
BootDiscoveryPolicyUiLib.

Ditto. v5 looks good to me as well, so keep my 'R-b' for v5.
Thanks for helping on this, Hao. :)

Best Regards,
Sunny Wang

-----Original Message-----
From: Gao, Zhichao <zhichao.gao@...>
Sent: Tuesday, August 3, 2021 10:25 AM
To: Wu, Hao A <hao.a.wu@...>; devel@edk2.groups.io;
gjb@...; Sunny Wang <Sunny.Wang@...>
Cc: leif@...; ardb+tianocore@...; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@...>; mw@...;
upstream@...; pete@...; Wang, Jian J
<jian.j.wang@...>; Bi, Dandan <dandan.bi@...>; Dong, Eric
<eric.dong@...>
Subject: RE: [edk2-devel] [PATCH v5 1/1] MdeModulePkg: Add
BootDiscoveryPolicyUiLib.

No. Please keep my 'R-b' for v5.

Thanks,
Zhichao

-----Original Message-----
From: Wu, Hao A <hao.a.wu@...>
Sent: Tuesday, August 3, 2021 8:01 AM
To: devel@edk2.groups.io; gjb@...; Gao, Zhichao
<zhichao.gao@...>; sunny.Wang@...
Cc: leif@...; ardb+tianocore@...; Samer.El-Haj-
Mahmoud@...; mw@...; upstream@...;
pete@...;
Wang, Jian J <jian.j.wang@...>; Bi, Dandan
<dandan.bi@...>; Dong, Eric <eric.dong@...>
Subject: RE: [edk2-devel] [PATCH v5 1/1] MdeModulePkg: Add
BootDiscoveryPolicyUiLib.

Thanks Greg, the new patch pass all the merging tests:
https://github.com/tianocore/edk2/pull/1858.

Hello Zhichao and Sunny Wang,
Do you have comments for this new version of the patch? If not, I will
keep your 'R-b' tags from V4. Thanks in advance.

Best Regards,
Hao Wu

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
Grzegorz Bernacki
Sent: Monday, August 2, 2021 8:19 PM
To: devel@edk2.groups.io
Cc: leif@...; ardb+tianocore@...; Samer.El-Haj-
Mahmoud@...; sunny.Wang@...; mw@...;
upstream@...; pete@...; Wang, Jian J
<jian.j.wang@...>; Wu, Hao A <hao.a.wu@...>; Bi, Dandan
<dandan.bi@...>; Dong, Eric <eric.dong@...>; Grzegorz
Bernacki <gjb@...>; Gao, Zhichao <zhichao.gao@...>
Subject: [edk2-devel] [PATCH v5 1/1] MdeModulePkg: Add
BootDiscoveryPolicyUiLib.

This library extends Boot Maintenance Menu and allows to select Boot
Discovery Policy. When choice is made BootDiscoveryPolicy variable is set.
Platform code can use this variable to decide which class of device
shall be connected.

Signed-off-by: Grzegorz Bernacki <gjb@...>
Reviewed-by: Zhichao Gao <zhichao.gao@...>
---
MdeModulePkg/MdeModulePkg.dec | 9 ++
MdeModulePkg/MdeModulePkg.dsc | 2 +

MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.inf
| 52 +++++++
MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h |
22
+++

MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.c
| 160 ++++++++++++++++++++

MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.uni
| 18 +++

MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
Stri
ngs.uni | 29 ++++

MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
Vfr.
Vfr | 44 ++++++
8 files changed, 336 insertions(+)
create mode 100644
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.inf create mode 100644
MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
create mode 100644
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.c
create mode 100644
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
.uni
create mode 100644
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
Stri
ngs.uni
create mode 100644
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLib
Vfr.
Vfr

diff --git a/MdeModulePkg/MdeModulePkg.dec
b/MdeModulePkg/MdeModulePkg.dec index ad84421cf3..133e04ee86
100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -425,6 +425,9 @@
## Include/UniversalPayload/SerialPortInfo.h
gUniversalPayloadSerialPortInfoGuid = { 0xaa7e190d, 0xbe21,
0x4409, { 0x8e, 0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } }

+ ## GUID used for Boot Discovery Policy FormSet guid and related
variables.
+ gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c,
+ 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }
+
[Ppis]
## Include/Ppi/AtaController.h
gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0,
0x7a,
0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} @@ -1600,6 +1603,12 @@
# @Prompt Console Output Row of Text Setup

gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|25|UINT32|0x40
000
00e

+ ## Specify the Boot Discovery Policy settings # To support
+ configuring from setup page, this PCD should be overridden in
+ DynamicHii type
in its platform .dsc:
+ #
+
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|L"BootDiscove
ryP
+ olicy"|gBootDiscoveryPolicyMgrFormsetGuid|0
+ # @Prompt Boot Discovery Policy
+
+
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy|2|UINT32|0x4
000
0
+ 00f
+
[PcdsFixedAtBuild.AARCH64, PcdsPatchableInModule.AARCH64]

gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20|UI
NT3
2|0x0001004c

diff --git a/MdeModulePkg/MdeModulePkg.dsc
b/MdeModulePkg/MdeModulePkg.dsc index 132fb36d95..b1d8346186
100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -220,6 +220,7 @@
MdeModulePkg/Logo/Logo.inf
MdeModulePkg/Logo/LogoDxe.inf
MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
+
+
MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
+ ib
+ .inf

MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance
Man
agerUiLib.inf
MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -341,6 +342,7 @@
MdeModulePkg/Application/UiApp/UiApp.inf{
<LibraryClasses>

NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+
+
NULL|MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPoli
+ NULL|cy
+ UiLib.inf
NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf

NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
nan
ceManagerUiLib.inf
}
diff --git
a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ib.i
nf
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ib.i
nf
new file mode 100644
index 0000000000..1fb4d43caa
--- /dev/null
+++
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
+++ yU
+++ iLib.inf
@@ -0,0 +1,52 @@
+## @file
+# Library for BDS phase to use Boot Discovery Policy # # Copyright
+(c) 2021, ARM Ltd. All rights reserved.<BR> # Copyright (c) 2021,
+Semihalf All rights reserved.<BR> # SPDX-License-Identifier:
+BSD-2-Clause-Patent # ##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BootDiscoveryPolicyUiLib
+ MODULE_UNI_FILE = BootDiscoveryPolicyUiLib.uni
+ FILE_GUID = BE73105A-B13D-4B57-A41A-463DBD15FE10
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION
+ CONSTRUCTOR = BootDiscoveryPolicyUiLibConstructor
+ DESTRUCTOR = BootDiscoveryPolicyUiLibDestructor
+#
+# The following information is for reference only and not required by
+the build
tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 AARCH64
+#
+
+[Sources]
+ BootDiscoveryPolicyUiLib.c
+ BootDiscoveryPolicyUiLibStrings.uni
+ BootDiscoveryPolicyUiLibVfr.Vfr
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ DevicePathLib
+ BaseLib
+ UefiRuntimeServicesTableLib
+ UefiBootServicesTableLib
+ DebugLib
+ HiiLib
+ UefiLib
+ BaseMemoryLib
+
+[Guids]
+ gBootDiscoveryPolicyMgrFormsetGuid
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy ##
PRODUCES
+
+[Depex]
+ gEfiHiiDatabaseProtocolGuid AND gPcdProtocolGuid
diff --git a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
new file mode 100644
index 0000000000..06e38921a0
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
@@ -0,0 +1,22 @@
+/** @file
+ Definition for structure & defines exported by Boot Discovery
+Policy UI
+
+ Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> Copyright
+ (c) 2021, Semihalf All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef BOOT_DISCOVERY_POLICY_UI_LIB_H_ #define
+BOOT_DISCOVERY_POLICY_UI_LIB_H_
+
+#define BDP_CONNECT_MINIMAL 0 /* Do not connect any additional
+devices
*/
+#define BDP_CONNECT_NET 1
+#define BDP_CONNECT_ALL 2
+
+#define BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID
{ 0x5b6f7107,
0xbb3c,
+0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }
+
+#define BOOT_DISCOVERY_POLICY_VAR L"BootDiscoveryPolicy"
+
+#endif
diff --git
a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLi
b.
c
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLi
b.
c
new file mode 100644
index 0000000000..615958799c
--- /dev/null
+++
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
+++ yU
+++ iLib.c
@@ -0,0 +1,160 @@
+/** @file
+ Boot Discovery Policy UI for Boot Maintenance menu.
+
+ Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> Copyright
+ (c) 2021, Semihalf All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Guid/BootDiscoveryPolicy.h> #include
+<Library/UefiDriverEntryPoint.h> #include
+<Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HiiLib.h>
+#include <Library/UefiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Include/Library/PcdLib.h>
+
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+
+extern UINT8 BootDiscoveryPolicyUiLibVfrBin[];
+
+EFI_HII_HANDLE mBPHiiHandle = NULL;
+EFI_HANDLE mBPDriverHandle = NULL;
+
+STATIC HII_VENDOR_DEVICE_PATH mVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8)(END_DEVICE_PATH_LENGTH),
+ (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+
+ Initialize Boot Maintenance Menu library.
+
+ @param ImageHandle The image handle.
+ @param SystemTable The system table.
+
+ @retval EFI_SUCCESS Install Boot manager menu success.
+ @retval Other Return error status.gBPDisplayLibGuid
+
+**/
+EFI_STATUS
+EFIAPI
+BootDiscoveryPolicyUiLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ UINT32 BootDiscoveryPolicy;
+
+ Size = sizeof (UINT32);
+ Status = gRT->GetVariable (
+ BOOT_DISCOVERY_POLICY_VAR,
+ &gBootDiscoveryPolicyMgrFormsetGuid,
+ NULL,
+ &Size,
+ &BootDiscoveryPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32
(PcdBootDiscoveryPolicy));
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mBPDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mVendorDevicePath,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish our HII data
+ //
+ mBPHiiHandle = HiiAddPackages (
+ &gBootDiscoveryPolicyMgrFormsetGuid,
+ mBPDriverHandle,
+ BootDiscoveryPolicyUiLibVfrBin,
+ BootDiscoveryPolicyUiLibStrings,
+ NULL
+ );
+ if (mBPHiiHandle == NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ mBPDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mVendorDevicePath,
+ NULL
+ );
+
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Destructor of Boot Maintenance menu library.
+
+ @param ImageHandle The firmware allocated handle for the EFI
image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor completed successfully.
+ @retval Other value The destructor did not complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BootDiscoveryPolicyUiLibDestructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+
+ if (mBPDriverHandle != NULL) {
+ gBS->UninstallProtocolInterface (
+ mBPDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mVendorDevicePath
+ );
+ mBPDriverHandle = NULL;
+ }
+
+ if (mBPHiiHandle != NULL) {
+ HiiRemovePackages (mBPHiiHandle);
+ mBPHiiHandle = NULL;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git
a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLi
b.
uni
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiLi
b.
uni
new file mode 100644
index 0000000000..eea3ca6c8d
--- /dev/null
+++
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
+++ yU
+++ iLib.uni
@@ -0,0 +1,18 @@
+// /** @file
+// Boot Discovery Policy UI module.
+//
+// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> // Copyright
+(c) 2021, Semihalf All rights reserved.<BR> // //
+SPDX-License-Identifier: BSD-2-Clause-Patent // // **/
+
+
+#string STR_MODULE_ABSTRACT
+#language en-US "Boot Discovery Policy UI module."
+
+#string STR_MODULE_DESCRIPTION
+#language en-US "Boot Discovery Policy UI module."
+
+
diff --git
a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ibS
trings.uni
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ibS
trings.uni
new file mode 100644
index 0000000000..736011c9bb
--- /dev/null
+++
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
+++ yU
+++ iLibStrings.uni
@@ -0,0 +1,29 @@
+// *++
+//
+// Copyright (c) 2021, ARM Ltd. All rights reserved.<BR> //
+Copyright
+(c) 2021, Semihalf All rights reserved.<BR> //
+SPDX-License-Identifier: BSD-2-Clause-Patent // // Module Name:
+//
+// BootDiscoveryPolicyUiLibStrings.uni
+//
+// Abstract:
+//
+// String definitions for Boot Discovery Policy UI.
+//
+// --*/
+
+/=#
+
+
+#langdef en-US "English"
+
+#string STR_FORM_BDP_MAIN_TITLE #language en-US "Boot
Discovery
Policy"
+
+#string STR_FORM_BDP_CONN_MIN #language en-US "Minimal"
+
+#string STR_FORM_BDP_CONN_NET #language en-US "Connect
Network
Devices"
+
+#string STR_FORM_BDP_CONN_ALL #language en-US "Connect All
Devices"
+
diff --git
a/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ibV
fr.Vfr
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolicyUiL
ibV
fr.Vfr
new file mode 100644
index 0000000000..0de87ec34f
--- /dev/null
+++
b/MdeModulePkg/Library/BootDiscoveryPolicyUiLib/BootDiscoveryPolic
+++ yU
+++ iLibVfr.Vfr
@@ -0,0 +1,44 @@
+///** @file
+//
+// Formset for Boot Discovery Policy UI // // Copyright (c) 2021,
+ARM Ltd. All rights reserved.<BR> // Copyright (c) 2021, Semihalf
+All rights reserved.<BR> // // SPDX-License-Identifier:
+BSD-2-Clause-Patent // //**/
+
+#include <Uefi/UefiMultiPhase.h>
+#include "Guid/BootDiscoveryPolicy.h"
+#include <Guid/HiiBootMaintenanceFormset.h>
+
+typedef struct {
+ UINT32 BootDiscoveryPolicy;
+} BOOT_DISCOVERY_POLICY_VARSTORE_DATA;
+
+formset
+ guid = BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE),
+ help = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE),
+ classguid = EFI_IFR_BOOT_MAINTENANCE_GUID,
+
+ efivarstore BOOT_DISCOVERY_POLICY_VARSTORE_DATA,
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ name = BootDiscoveryPolicy,
+ guid = BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID;
+
+ form formid = 0x0001,
+ title = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE);
+
+ oneof varid = BootDiscoveryPolicy.BootDiscoveryPolicy,
+ prompt = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE),
+ help = STRING_TOKEN(STR_FORM_BDP_MAIN_TITLE),
+ flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_FORM_BDP_CONN_MIN), value =
BDP_CONNECT_MINIMAL, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_FORM_BDP_CONN_NET), value =
BDP_CONNECT_NET, flags = 0;
+ option text = STRING_TOKEN(STR_FORM_BDP_CONN_ALL), value =
+ BDP_CONNECT_ALL, flags = 0; endoneof;
+
+ endform;
+endformset;
--
2.25.1




IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.



13901 - 13920 of 92426