/** @file\r
The Quark CPU specific programming for PiSmmCpuDxeSmm module.\r
\r
-Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2016, 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 <PiSmm.h>\r
#include <Library/SmmCpuFeaturesLib.h>\r
#include <Register/SmramSaveStateMap.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
#include <Library/QNCAccessLib.h>\r
\r
#define EFI_MSR_SMRR_PHYS_MASK_VALID BIT11\r
CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);\r
CpuState->x86.SMBASE = CpuHotPlugData->SmBase[CpuIndex];\r
\r
+ //\r
+ // SMRR size cannot be less than 4-KBytes\r
+ // SMRR size must be of length 2^n\r
+ // SMRR base alignment cannot be less than SMRR length\r
+ //\r
+ if ((CpuHotPlugData->SmrrSize < SIZE_4KB) ||\r
+ (CpuHotPlugData->SmrrSize != GetPowerOfTwo32 (CpuHotPlugData->SmrrSize)) ||\r
+ ((CpuHotPlugData->SmrrBase & ~(CpuHotPlugData->SmrrSize - 1)) != CpuHotPlugData->SmrrBase)) {\r
+ DEBUG ((EFI_D_ERROR, "SMM Base/Size does not meet alignment/size requirement!\n"));\r
+ CpuDeadLoop ();\r
+ }\r
+\r
//\r
// Use QNC to initialize SMRR on Quark\r
//\r