Added FspNonVolatileStorageHob2 support in FspSupportLib (#1850)

Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2

Signed-off-by: Kobe <kok.tong.ong@intel.com>
This commit is contained in:
koktong-ong 2023-03-24 20:33:10 +08:00 committed by GitHub
parent 5e48d930f9
commit c7fbc86eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016-2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -27,6 +27,22 @@ GetFspNvsDataBuffer (
CONST VOID *HobListPtr,
UINT32 *Length
);
/**
This function retrieves FSP Non-volatile Storage HOB 2 buffer and size.
@param HobListPtr A HOB list pointer.
@param Length A pointer to the NVS data buffer length. If the FSP NVS
HOB is located, the length will be updated.
@retval NULL Failed to find the NVS HOB.
@retval others FSP NVS data buffer pointer.
**/
VOID *
EFIAPI
GetFspNvsData2Buffer (
CONST VOID *HobListPtr,
UINT32 *Length
);
/**
This function retrieves a special reserved memory region.

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017-2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -11,6 +11,7 @@
#include <Library/BaseMemoryLib.h>
#include <Library/FspSupportLib.h>
#include <Library/BootloaderCoreLib.h>
#include <Guid/FspNonVolatileStorageHob2.h>
#include <Guid/GuidHobFspEas.h>
/**
@ -30,7 +31,45 @@ GetFspNvsDataBuffer (
UINT32 *Length
)
{
return GetGuidHobData (HobListPtr, Length, &gFspNonVolatileStorageHobGuid);
VOID *HobData;
HobData = GetGuidHobData (HobListPtr, Length, &gFspNonVolatileStorageHobGuid);
if (HobData == NULL){
return GetFspNvsData2Buffer(HobListPtr, Length);
}
return HobData;
}
/**
This function retrieves FSP Non-volatile Storage HOB 2 buffer and size.
@param HobListPtr A HOB list pointer.
@param Length A pointer to the NVS data buffer length. If the FSP NVS
HOB is located, the length will be updated.
@retval NULL Failed to find the NVS HOB.
@retval others FSP NVS data buffer pointer.
**/
VOID *
EFIAPI
GetFspNvsData2Buffer (
CONST VOID *HobListPtr,
UINT32 *Length
)
{
UINT8 *GuidHob;
if (HobListPtr == NULL) {
return NULL;
}
GuidHob = GetNextGuidHob (&gFspNonVolatileStorageHob2Guid, HobListPtr);
if (GuidHob != NULL) {
if (Length != NULL) {
*Length = (UINT32) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsDataLength;
}
return (VOID *) (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsDataPtr;
}
return NULL;
}
/**

View File

@ -1,6 +1,6 @@
## @file
#
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2017-2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@ -36,5 +36,6 @@
[Guids]
gFspNonVolatileStorageHobGuid
gFspNonVolatileStorageHob2Guid
[Pcd]

View File

@ -0,0 +1,24 @@
/** @file
Intel FSP Non-Volatile Storage (NVS) HOB version 2 definition from
Intel Firmware Support Package External Architecture Specification v2.3.
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __FSP_NON_VOLATILE_STORAGE_HOB2_H__
#define __FSP_NON_VOLATILE_STORAGE_HOB2_H__
///
/// The Non-Volatile Storage (NVS) HOB version 2 provides > 64KB buffer support.
///
typedef struct {
EFI_HOB_GUID_TYPE GuidHob;
EFI_PHYSICAL_ADDRESS NvsDataPtr;
UINT64 NvsDataLength;
} FSP_NON_VOLATILE_STORAGE_HOB2;
extern EFI_GUID gFspNonVolatileStorageHob2Guid;
#endif