/** @file\r
\r
- Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
};\r
\r
EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformationPpi[] = {\r
+ {\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI,\r
+ &gFspInApiModePpiGuid,\r
+ NULL\r
+ },\r
{\r
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
&gEfiTemporaryRamSupportPpiGuid,\r
\r
\r
@param[in] SizeOfRam Size of the temporary memory available for use.\r
- @param[in] TempRamBase Base address of tempory ram\r
+ @param[in] TempRamBase Base address of temporary ram\r
@param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r
@param[in] PeiCore PeiCore entry point.\r
@param[in] BootLoaderStack BootLoader stack.\r
UINT32 Index;\r
FSP_GLOBAL_DATA PeiFspData;\r
UINT64 ExceptionHandler;\r
+ UINTN IdtSize;\r
\r
//\r
// Process all libraries constructor function linked to SecCore.\r
// | |\r
// |-------------------|----> TempRamBase\r
IdtTableInStack.PeiService = NULL;\r
- ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);\r
- for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index ++) {\r
- CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));\r
+ AsmReadIdtr (&IdtDescriptor);\r
+ if ((IdtDescriptor.Base == 0) && (IdtDescriptor.Limit == 0xFFFF)) {\r
+ ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);\r
+ for (Index = 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); Index ++) {\r
+ CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));\r
+ }\r
+ IdtSize = sizeof (IdtTableInStack.IdtTable);\r
+ } else {\r
+ if (IdtDescriptor.Limit + 1 > sizeof (IdtTableInStack.IdtTable)) {\r
+ //\r
+ // ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here!\r
+ //\r
+ CpuDeadLoop();\r
+ } else {\r
+ IdtSize = IdtDescriptor.Limit + 1;\r
+ }\r
+ CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize);\r
}\r
-\r
IdtDescriptor.Base = (UINTN) &IdtTableInStack.IdtTable;\r
- IdtDescriptor.Limit = (UINT16)(sizeof (IdtTableInStack.IdtTable) - 1);\r
+ IdtDescriptor.Limit = (UINT16)(IdtSize - 1);\r
\r
AsmWriteIdtr (&IdtDescriptor);\r
\r
\r
//\r
// Call PeiCore Entry\r
- // \r
+ //\r
PeiCore (&SecCoreData, mPeiSecPlatformInformationPpi);\r
\r
//\r
\r
HeapSize = CopySize * PcdGet8 (PcdFspHeapSizePercentage) / 100 ;\r
StackSize = CopySize - HeapSize;\r
- \r
+\r
OldHeap = (VOID*)(UINTN)TemporaryMemoryBase;\r
NewHeap = (VOID*)((UINTN)PermanentMemoryBase + StackSize);\r
\r
\r
//\r
// SecSwitchStack function must be invoked after the memory migration\r
- // immediatly, also we need fixup the stack change caused by new call into\r
- // permenent memory.\r
+ // immediately, also we need fixup the stack change caused by new call into\r
+ // permanent memory.\r
//\r
SecSwitchStack (\r
(UINT32) (UINTN) OldStack,\r