gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamSize ## CONSUMES\r
gIntelFsp2PkgTokenSpaceGuid.PcdFspTemporaryRamSize ## CONSUMES\r
gIntelFsp2PkgTokenSpaceGuid.PcdFspHeapSizePercentage ## CONSUMES\r
+ gIntelFsp2PkgTokenSpaceGuid.PcdFspMaxInterruptSupported ## CONSUMES\r
\r
[Ppis]\r
gEfiTemporaryRamSupportPpiGuid ## PRODUCES\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
/** @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
#include <Library/FspCommonLib.h>\r
#include <FspEas.h>\r
\r
-#define SEC_IDT_ENTRY_COUNT 34\r
-\r
typedef VOID (*PEI_CORE_ENTRY) ( \\r
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r
\r
typedef struct _SEC_IDT_TABLE {\r
EFI_PEI_SERVICES *PeiService;\r
- UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];\r
+ UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];\r
} SEC_IDT_TABLE;\r
\r
/**\r
# x % of FSP temporary memory will be used for heap\r
# (100 - x) % of FSP temporary memory will be used for stack\r
gIntelFsp2PkgTokenSpaceGuid.PcdFspHeapSizePercentage | 50| UINT8|0x10000004\r
+ #\r
+ # Maximal Interrupt supported in IDT table.\r
+ #\r
+ gIntelFsp2PkgTokenSpaceGuid.PcdFspMaxInterruptSupported | 34| UINT8|0x10000005\r
\r
[PcdsFixedAtBuild,PcdsDynamic,PcdsDynamicEx]\r
gIntelFsp2PkgTokenSpaceGuid.PcdFspReservedMemoryLength |0x00100000|UINT32|0x46530000\r