#define CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE (32+9)\r
#define CPU_FEATURE_ENERGY_PERFORMANCE_BIAS (32+10)\r
#define CPU_FEATURE_PPIN (32+11)\r
+//\r
+// Currently, CPU_FEATURE_PROC_TRACE is the MAX feature we support.\r
+// If you define a feature bigger than it, please also replace it\r
+// in RegisterCpuFeatureLibIsFeatureValid function.\r
+//\r
#define CPU_FEATURE_PROC_TRACE (32+12)\r
\r
#define CPU_FEATURE_BEFORE_ALL BIT27\r
}\r
}\r
\r
+/**\r
+ Determines if the CPU feature is valid.\r
+\r
+ @param[in] Feature Pointer to CPU feature\r
+\r
+ @retval TRUE The CPU feature is valid.\r
+ @retval FALSE The CPU feature is invalid.\r
+**/\r
+BOOLEAN\r
+RegisterCpuFeatureLibIsFeatureValid (\r
+ IN UINT32 Feature\r
+ )\r
+{\r
+ UINT32 Data;\r
+\r
+ Data = Feature;\r
+ Data &= ~(CPU_FEATURE_BEFORE | CPU_FEATURE_AFTER | CPU_FEATURE_BEFORE_ALL | CPU_FEATURE_AFTER_ALL);\r
+ //\r
+ // Currently, CPU_FEATURE_PROC_TRACE is the MAX feature we support.\r
+ // If you define a feature bigger than it, please replace it at below.\r
+ //\r
+ if (Data > CPU_FEATURE_PROC_TRACE) {\r
+ DEBUG ((DEBUG_ERROR, "Invalid CPU feature: 0x%x ", Feature));\r
+ return FALSE;\r
+ }\r
+ return TRUE;\r
+}\r
+\r
/**\r
Determines if the feature bit mask is in dependent CPU feature bit mask buffer.\r
\r
\r
VA_START (Marker, InitializeFunc);\r
Feature = VA_ARG (Marker, UINT32);\r
+ ASSERT (RegisterCpuFeatureLibIsFeatureValid(Feature));\r
while (Feature != CPU_FEATURE_END) {\r
ASSERT ((Feature & (CPU_FEATURE_BEFORE | CPU_FEATURE_AFTER))\r
!= (CPU_FEATURE_BEFORE | CPU_FEATURE_AFTER));\r