diff options
-rw-r--r-- | IntelFspPkg/FspSecCore/SecFsp.c | 6 | ||||
-rw-r--r-- | IntelFspPkg/FspSecCore/SecFsp.h | 4 | ||||
-rw-r--r-- | IntelFspPkg/Include/Library/FspCommonLib.h | 44 | ||||
-rw-r--r-- | IntelFspPkg/Include/Library/FspSecPlatformLib.h | 14 | ||||
-rw-r--r-- | IntelFspPkg/Include/Private/FspGlobalData.h | 2 | ||||
-rw-r--r-- | IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c | 85 | ||||
-rw-r--r-- | IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c | 23 | ||||
-rw-r--r-- | IntelFspPkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c | 17 | ||||
-rw-r--r-- | IntelFspPkg/Tools/GenCfgOpt.py | 60 | ||||
-rw-r--r-- | IntelFspPkg/Tools/UserManuals/GenCfgOptUserManual.docx | bin | 22177 -> 24424 bytes |
10 files changed, 246 insertions, 9 deletions
diff --git a/IntelFspPkg/FspSecCore/SecFsp.c b/IntelFspPkg/FspSecCore/SecFsp.c index a9aba71..07aed1c 100644 --- a/IntelFspPkg/FspSecCore/SecFsp.c +++ b/IntelFspPkg/FspSecCore/SecFsp.c @@ -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 {
diff --git a/IntelFspPkg/FspSecCore/SecFsp.h b/IntelFspPkg/FspSecCore/SecFsp.h index 3e4e2a4..4dceebc 100644 --- a/IntelFspPkg/FspSecCore/SecFsp.h +++ b/IntelFspPkg/FspSecCore/SecFsp.h @@ -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')
diff --git a/IntelFspPkg/Include/Library/FspCommonLib.h b/IntelFspPkg/Include/Library/FspCommonLib.h index eddebba..fa2f81c 100644 --- a/IntelFspPkg/Include/Library/FspCommonLib.h +++ b/IntelFspPkg/Include/Library/FspCommonLib.h @@ -158,6 +158,50 @@ GetFspUpdDataPointer ( );
/**
+ 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.
@param[in] Id Measurement point ID.
diff --git a/IntelFspPkg/Include/Library/FspSecPlatformLib.h b/IntelFspPkg/Include/Library/FspSecPlatformLib.h index c6ed430..d5c7e77 100644 --- a/IntelFspPkg/Include/Library/FspSecPlatformLib.h +++ b/IntelFspPkg/Include/Library/FspSecPlatformLib.h @@ -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
diff --git a/IntelFspPkg/Include/Private/FspGlobalData.h b/IntelFspPkg/Include/Private/FspGlobalData.h index f50255f..be33e89 100644 --- a/IntelFspPkg/Include/Private/FspGlobalData.h +++ b/IntelFspPkg/Include/Private/FspGlobalData.h @@ -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;
diff --git a/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c b/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c index 7de84a0..a31d16b 100644 --- a/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c +++ b/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c @@ -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.
diff --git a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c index 97cae9a..ed5db93 100644 --- a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c +++ b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c @@ -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));
+ }
}
//
diff --git a/IntelFspPkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c b/IntelFspPkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c index 4de2a1d..d72d05f 100644 --- a/IntelFspPkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c +++ b/IntelFspPkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c @@ -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;
+}
+
diff --git a/IntelFspPkg/Tools/GenCfgOpt.py b/IntelFspPkg/Tools/GenCfgOpt.py index 77eaf64..a38da70 100644 --- a/IntelFspPkg/Tools/GenCfgOpt.py +++ b/IntelFspPkg/Tools/GenCfgOpt.py @@ -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] == '-':
diff --git a/IntelFspPkg/Tools/UserManuals/GenCfgOptUserManual.docx b/IntelFspPkg/Tools/UserManuals/GenCfgOptUserManual.docx Binary files differindex e4da8e0..1cbc459 100644 --- a/IntelFspPkg/Tools/UserManuals/GenCfgOptUserManual.docx +++ b/IntelFspPkg/Tools/UserManuals/GenCfgOptUserManual.docx |