mirror of https://github.com/acidanthera/audk.git
Add Dual-FSP support (MemoryInitUpd/SiliconInitUpd)
Add FspUpdSignatureCheck() API in FspSecPlatformLib, so that FspSecCore can check if UPD data is valid in FSP API. Add Set/GetFspMemoryInitUpdDataPointer() and Set/GetFspSiliconInitUpdDataPointer() API in FspCommonLib, so that core can set this UdpDataPointer and platform code may get UpdDataPointer easily. Add UpdateMemSiUpdInitOffsetValue function in GenCfgOpt.py tool, so that the MemoryInitUpdOffset and SiUpdInitOffset is recorded. Add missing EMBED comment in GenCfgOptUserManual.docx Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <Jiewen.Yao@intel.com> Reviewed-by: "Mudusuru, Giri P" <giri.p.mudusuru@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18123 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7669f73498
commit
b23441875c
|
@ -265,7 +265,7 @@ FspApiCallingCheck (
|
|||
//
|
||||
if ((UINT32)FspData != 0xFFFFFFFF) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
} else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0)) {
|
||||
} else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0) || (EFI_ERROR(FspUpdSignatureCheck(ApiIdx, ApiParam)))) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} else if (ApiIdx == 2) {
|
||||
|
@ -285,7 +285,7 @@ FspApiCallingCheck (
|
|||
//
|
||||
if ((UINT32)FspData != 0xFFFFFFFF) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
} else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0)) {
|
||||
} else if ((FspRtBuffer == NULL) || ((FspRtBuffer->BootLoaderTolumSize % EFI_PAGE_SIZE) != 0) || (EFI_ERROR(FspUpdSignatureCheck(ApiIdx, ApiParam)))) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} else if (ApiIdx == 4) {
|
||||
|
@ -308,6 +308,8 @@ FspApiCallingCheck (
|
|||
} else {
|
||||
if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
} else if (EFI_ERROR(FspUpdSignatureCheck(ApiIdx, ApiParam))) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
#define _SEC_FSPE_H_
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <FspApi.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/FspCommonLib.h>
|
||||
|
||||
#include <FspApi.h>
|
||||
#include <Library/FspSecPlatformLib.h>
|
||||
|
||||
#define FSP_MCUD_SIGNATURE SIGNATURE_32 ('M', 'C', 'U', 'D')
|
||||
#define FSP_PER0_SIGNATURE SIGNATURE_32 ('P', 'E', 'R', '0')
|
||||
|
|
|
@ -157,6 +157,50 @@ GetFspUpdDataPointer (
|
|||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This function sets the memory init UPD data pointer.
|
||||
|
||||
@param[in] MemoryInitUpdPtr memory init UPD data pointer.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SetFspMemoryInitUpdDataPointer (
|
||||
IN VOID *MemoryInitUpdPtr
|
||||
);
|
||||
|
||||
/**
|
||||
This function gets the memory init UPD data pointer.
|
||||
|
||||
@return memory init UPD data pointer.
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFspMemoryInitUpdDataPointer (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This function sets the silicon init UPD data pointer.
|
||||
|
||||
@param[in] SiliconInitUpdPtr silicon init UPD data pointer.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SetFspSiliconInitUpdDataPointer (
|
||||
IN VOID *SiliconInitUpdPtr
|
||||
);
|
||||
|
||||
/**
|
||||
This function gets the silicon init UPD data pointer.
|
||||
|
||||
@return silicon init UPD data pointer.
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFspSiliconInitUpdDataPointer (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Set FSP measurement point timestamp.
|
||||
|
||||
|
|
|
@ -71,4 +71,18 @@ SecCarInit (
|
|||
IN FSP_TEMP_RAM_INIT_PARAMS *TempRamInitParamPtr
|
||||
);
|
||||
|
||||
/**
|
||||
This function check the signture of UPD.
|
||||
|
||||
@param[in] ApiIdx Internal index of the FSP API.
|
||||
@param[in] ApiParam Parameter of the FSP API.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FspUpdSignatureCheck (
|
||||
IN UINT32 ApiIdx,
|
||||
IN VOID *ApiParam
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,8 @@ typedef struct {
|
|||
FSP_PLAT_DATA PlatformData;
|
||||
FSP_INFO_HEADER *FspInfoHeader;
|
||||
VOID *UpdDataRgnPtr;
|
||||
VOID *MemoryInitUpdPtr;
|
||||
VOID *SiliconInitUpdPtr;
|
||||
UINT8 ApiMode;
|
||||
UINT8 Reserved[3];
|
||||
UINT32 PerfIdx;
|
||||
|
|
|
@ -289,6 +289,91 @@ GetFspUpdDataPointer (
|
|||
return FspData->UpdDataRgnPtr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function sets the memory init UPD data pointer.
|
||||
|
||||
@param[in] MemoryInitUpdPtr memory init UPD data pointer.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SetFspMemoryInitUpdDataPointer (
|
||||
IN VOID *MemoryInitUpdPtr
|
||||
)
|
||||
{
|
||||
FSP_GLOBAL_DATA *FspData;
|
||||
|
||||
//
|
||||
// Get the Fsp Global Data Pointer
|
||||
//
|
||||
FspData = GetFspGlobalDataPointer ();
|
||||
|
||||
//
|
||||
// Set the memory init UPD pointer.
|
||||
//
|
||||
FspData->MemoryInitUpdPtr = MemoryInitUpdPtr;
|
||||
}
|
||||
|
||||
/**
|
||||
This function gets the memory init UPD data pointer.
|
||||
|
||||
@return memory init UPD data pointer.
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFspMemoryInitUpdDataPointer (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
FSP_GLOBAL_DATA *FspData;
|
||||
|
||||
FspData = GetFspGlobalDataPointer ();
|
||||
return FspData->MemoryInitUpdPtr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function sets the silicon init UPD data pointer.
|
||||
|
||||
@param[in] SiliconInitUpdPtr silicon init UPD data pointer.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
SetFspSiliconInitUpdDataPointer (
|
||||
IN VOID *SiliconInitUpdPtr
|
||||
)
|
||||
{
|
||||
FSP_GLOBAL_DATA *FspData;
|
||||
|
||||
//
|
||||
// Get the Fsp Global Data Pointer
|
||||
//
|
||||
FspData = GetFspGlobalDataPointer ();
|
||||
|
||||
//
|
||||
// Set the silicon init UPD data pointer.
|
||||
//
|
||||
FspData->SiliconInitUpdPtr = SiliconInitUpdPtr;
|
||||
}
|
||||
|
||||
/**
|
||||
This function gets the silicon init UPD data pointer.
|
||||
|
||||
@return silicon init UPD data pointer.
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetFspSiliconInitUpdDataPointer (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
FSP_GLOBAL_DATA *FspData;
|
||||
|
||||
FspData = GetFspGlobalDataPointer ();
|
||||
return FspData->SiliconInitUpdPtr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set FSP measurement point timestamp.
|
||||
|
||||
|
|
|
@ -86,7 +86,9 @@ FspMigrateTemporaryMemory (
|
|||
FSP_INIT_PARAMS *FspInitParams;
|
||||
UINT32 *NewStackTop;
|
||||
VOID *BootLoaderTempRamHob;
|
||||
VOID *UpdDataRgnPtr;
|
||||
UINT32 UpdDataRgnPtr;
|
||||
UINT32 MemoryInitUpdPtr;
|
||||
UINT32 SiliconInitUpdPtr;
|
||||
VOID *PlatformDataPtr;
|
||||
UINT8 ApiMode;
|
||||
|
||||
|
@ -105,7 +107,7 @@ FspMigrateTemporaryMemory (
|
|||
if (ApiMode == 0) {
|
||||
BootLoaderTempRamHob = BuildGuidHob (&gFspBootLoaderTemporaryMemoryGuid, BootLoaderTempRamSize);
|
||||
} else {
|
||||
BootLoaderTempRamHob = (VOID *)AllocatePool (BootLoaderTempRamSize);
|
||||
BootLoaderTempRamHob = (VOID *)AllocatePages (EFI_SIZE_TO_PAGES (BootLoaderTempRamSize));
|
||||
}
|
||||
ASSERT(BootLoaderTempRamHob != NULL);
|
||||
|
||||
|
@ -150,9 +152,20 @@ FspMigrateTemporaryMemory (
|
|||
//
|
||||
// Update UPD pointer in FSP Global Data
|
||||
//
|
||||
UpdDataRgnPtr = ((FSP_INIT_RT_COMMON_BUFFER *)FspInitParams->RtBufferPtr)->UpdDataRgnPtr;
|
||||
if (UpdDataRgnPtr != NULL) {
|
||||
SetFspUpdDataPointer (UpdDataRgnPtr);
|
||||
if (ApiMode == 0) {
|
||||
UpdDataRgnPtr = (UINT32)((UINT32 *)GetFspUpdDataPointer ());
|
||||
if (UpdDataRgnPtr >= BootLoaderTempRamStart && UpdDataRgnPtr < BootLoaderTempRamEnd) {
|
||||
MemoryInitUpdPtr = (UINT32)((UINT32 *)GetFspMemoryInitUpdDataPointer ());
|
||||
SiliconInitUpdPtr = (UINT32)((UINT32 *)GetFspSiliconInitUpdDataPointer ());
|
||||
SetFspUpdDataPointer ((VOID *)(UpdDataRgnPtr + OffsetGap));
|
||||
SetFspMemoryInitUpdDataPointer ((VOID *)(MemoryInitUpdPtr + OffsetGap));
|
||||
SetFspSiliconInitUpdDataPointer ((VOID *)(SiliconInitUpdPtr + OffsetGap));
|
||||
}
|
||||
} else {
|
||||
MemoryInitUpdPtr = (UINT32)((UINT32 *)GetFspMemoryInitUpdDataPointer ());
|
||||
if (MemoryInitUpdPtr >= BootLoaderTempRamStart && MemoryInitUpdPtr < BootLoaderTempRamEnd) {
|
||||
SetFspMemoryInitUpdDataPointer ((VOID *)(MemoryInitUpdPtr + OffsetGap));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -14,4 +14,21 @@
|
|||
|
||||
#include <PiPei.h>
|
||||
|
||||
/**
|
||||
This function check the signture of UPD.
|
||||
|
||||
@param[in] ApiIdx Internal index of the FSP API.
|
||||
@param[in] ApiParam Parameter of the FSP API.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FspUpdSignatureCheck (
|
||||
IN UINT32 ApiIdx,
|
||||
IN VOID *ApiParam
|
||||
)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -88,6 +88,48 @@ are permitted provided that the following conditions are met:
|
|||
**/
|
||||
"""
|
||||
|
||||
def UpdateMemSiUpdInitOffsetValue (DscFile):
|
||||
DscFd = open(DscFile, "r")
|
||||
DscLines = DscFd.readlines()
|
||||
DscFd.close()
|
||||
|
||||
DscContent = []
|
||||
MemUpdInitOffset = 0
|
||||
SiUpdInitOffset = 0
|
||||
MemUpdInitOffsetValue = 0
|
||||
SiUpdInitOffsetValue = 0
|
||||
|
||||
while len(DscLines):
|
||||
DscLine = DscLines.pop(0)
|
||||
DscContent.append(DscLine)
|
||||
DscLine = DscLine.strip()
|
||||
Match = re.match("^([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)
|
||||
if Match:
|
||||
MemUpdInitOffsetValue = int(Match.group(5), 0)
|
||||
Match = re.match("^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)
|
||||
if Match:
|
||||
SiUpdInitOffsetValue = int(Match.group(5), 0)
|
||||
Match = re.match("^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450554D454D24)",DscLine)
|
||||
if Match:
|
||||
MemUpdInitOffset = int(Match.group(3), 0)
|
||||
Match = re.match("^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450555F495324)",DscLine)
|
||||
if Match:
|
||||
SiUpdInitOffset = int(Match.group(3), 0)
|
||||
|
||||
if MemUpdInitOffsetValue != MemUpdInitOffset or SiUpdInitOffsetValue != SiUpdInitOffset:
|
||||
MemUpdInitOffsetStr = "0x%08X" % MemUpdInitOffset
|
||||
SiUpdInitOffsetStr = "0x%08X" % SiUpdInitOffset
|
||||
DscFd = open(DscFile,"w")
|
||||
for DscLine in DscContent:
|
||||
Match = re.match("^\s*([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)
|
||||
if Match:
|
||||
DscLine = re.sub(r'(?:[^\s]+\s*$)', MemUpdInitOffsetStr + '\n', DscLine)
|
||||
Match = re.match("^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)
|
||||
if Match:
|
||||
DscLine = re.sub(r'(?:[^\s]+\s*$)', SiUpdInitOffsetStr + '\n', line)
|
||||
DscFd.writelines(DscLine)
|
||||
DscFd.close()
|
||||
|
||||
class CLogicalExpression:
|
||||
def __init__(self):
|
||||
self.index = 0
|
||||
|
@ -889,6 +931,22 @@ EndList
|
|||
return 256
|
||||
|
||||
TxtBody = []
|
||||
for Item in self._CfgItemList:
|
||||
if str(Item['cname']) == 'Signature' and Item['length'] == 8:
|
||||
Value = int(Item['value'], 16)
|
||||
Chars = []
|
||||
while Value != 0x0:
|
||||
Chars.append(chr(Value & 0xFF))
|
||||
Value = Value >> 8
|
||||
SignatureStr = ''.join(Chars)
|
||||
if int(Item['offset']) == 0:
|
||||
TxtBody.append("#define FSP_UPD_SIGNATURE %s /* '%s' */\n" % (Item['value'], SignatureStr))
|
||||
elif 'MEM' in SignatureStr:
|
||||
TxtBody.append("#define FSP_MEMORY_INIT_UPD_SIGNATURE %s /* '%s' */\n" % (Item['value'], SignatureStr))
|
||||
else:
|
||||
TxtBody.append("#define FSP_SILICON_INIT_UPD_SIGNATURE %s /* '%s' */\n" % (Item['value'], SignatureStr))
|
||||
TxtBody.append("\n")
|
||||
|
||||
for Region in ['UPD', 'VPD']:
|
||||
|
||||
# Write PcdVpdRegionSign and PcdImageRevision
|
||||
|
@ -1176,6 +1234,8 @@ def Main():
|
|||
print "ERROR: Cannot open DSC file '%s' !" % DscFile
|
||||
return 2
|
||||
|
||||
UpdateMemSiUpdInitOffsetValue(DscFile)
|
||||
|
||||
OutFile = ''
|
||||
if argc > 4:
|
||||
if sys.argv[4][0] == '-':
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue