IntelFsp2Pkg/FspSecCore: Update FSP global data in FSP-S/I entry
Today when FspSiliconInit/FspSmmInit is called, the corresponding FSP-S/I UPD pointer is saved in FSP_GLOBAL_DATA by gen-specific code. Such code might be duplicated between different gens of FSP implementation. The change is to update FspSecCore module to set the UPD pointer in FSP_GLOBAL_DATA for all API calls: * FspMemoryInit * FspSiliconInit * FspSmmInit This can eliminate the gen-specific code. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Ted Kuo <ted.kuo@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
This commit is contained in:
parent
af2a04699d
commit
8d0a57d65a
|
@ -1,6 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2016 - 2025, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -10,6 +10,9 @@
|
||||||
/**
|
/**
|
||||||
This function check the FSP API calling condition.
|
This function check the FSP API calling condition.
|
||||||
|
|
||||||
|
It updates the FSP API index and UPD data pointer in FSP global data
|
||||||
|
when FspSiliconInit and FspSmmInit are called.
|
||||||
|
|
||||||
@param[in] ApiIdx Internal index of the FSP API.
|
@param[in] ApiIdx Internal index of the FSP API.
|
||||||
@param[in] ApiParam Parameter of the FSP API.
|
@param[in] ApiParam Parameter of the FSP API.
|
||||||
|
|
||||||
|
@ -23,6 +26,7 @@ FspApiCallingCheck (
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
FSP_GLOBAL_DATA *FspData;
|
FSP_GLOBAL_DATA *FspData;
|
||||||
|
FSP_INFO_HEADER *FspInfoHeader;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
FspData = GetFspGlobalDataPointer ();
|
FspData = GetFspGlobalDataPointer ();
|
||||||
|
@ -108,11 +112,22 @@ FspApiCallingCheck (
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if ((ApiIdx != FspMemoryInitApiIndex)) {
|
if ((ApiIdx != FspMemoryInitApiIndex)) {
|
||||||
//
|
//
|
||||||
// For FspMemoryInit, the global data is not valid yet
|
// Set "API Index" and "UPD Data Pointer" in FSP Global Data for FspSiliconInit and FspSmmInit
|
||||||
// The API index will be updated by SecCore after the global data
|
// For FspMemoryInit: The global data is not valid when code runs here.
|
||||||
// is initialized
|
// The 2 fields will be updated by SecCore after the global data is allocated in stack.
|
||||||
//
|
//
|
||||||
SetFspApiCallingIndex (ApiIdx);
|
SetFspApiCallingIndex (ApiIdx);
|
||||||
|
|
||||||
|
if (ApiParam == NULL) {
|
||||||
|
FspInfoHeader = (FSP_INFO_HEADER *)AsmGetFspInfoHeader ();
|
||||||
|
ApiParam = (VOID *)(UINTN)(FspInfoHeader->ImageBase + FspInfoHeader->CfgRegionOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ApiIdx == FspSiliconInitApiIndex) {
|
||||||
|
SetFspSiliconInitUpdDataPointer (ApiParam);
|
||||||
|
} else if (ApiIdx == FspSmmInitApiIndex) {
|
||||||
|
SetFspSmmInitUpdDataPointer (ApiParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue