9#ifndef __REGISTER_CPU_FEATURES_LIB_H__
10#define __REGISTER_CPU_FEATURES_LIB_H__
23#define CPU_FEATURE_AESNI 0
24#define CPU_FEATURE_TURBO_MODE 1
25#define CPU_FEATURE_MWAIT 2
26#define CPU_FEATURE_ACPI 3
27#define CPU_FEATURE_EIST 4
28#define CPU_FEATURE_RESERVED_5 5
29#define CPU_FEATURE_FASTSTRINGS 6
30#define CPU_FEATURE_VMX 7
31#define CPU_FEATURE_SMX 8
32#define CPU_FEATURE_LMCE 9
33#define CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER 10
34#define CPU_FEATURE_LIMIT_CPUID_MAX_VAL 11
35#define CPU_FEATURE_MCE 12
36#define CPU_FEATURE_MCA 13
37#define CPU_FEATURE_MCG_CTL 14
38#define CPU_FEATURE_PENDING_BREAK 15
39#define CPU_FEATURE_C1E 16
40#define CPU_FEATURE_C1_AUTO_DEMOTION 17
41#define CPU_FEATURE_C3_AUTO_DEMOTION 18
42#define CPU_FEATURE_C1_UNDEMOTION 19
43#define CPU_FEATURE_C3_UNDEMOTION 20
44#define CPU_FEATURE_C_STATE 21
45#define CPU_FEATURE_TM 22
46#define CPU_FEATURE_TM2 23
47#define CPU_FEATURE_X2APIC 24
48#define CPU_FEATURE_RESERVED_25 25
49#define CPU_FEATURE_RESERVED_26 26
50#define CPU_FEATURE_RESERVED_27 27
51#define CPU_FEATURE_RESERVED_28 28
52#define CPU_FEATURE_RESERVED_29 29
53#define CPU_FEATURE_RESERVED_30 30
54#define CPU_FEATURE_RESERVED_31 31
56#define CPU_FEATURE_L2_PREFETCHER (32+0)
57#define CPU_FEATURE_L1_DATA_PREFETCHER (32+1)
58#define CPU_FEATURE_HARDWARE_PREFETCHER (32+2)
59#define CPU_FEATURE_ADJACENT_CACHE_LINE_PREFETCH (32+3)
60#define CPU_FEATURE_DCU_PREFETCHER (32+4)
61#define CPU_FEATURE_IP_PREFETCHER (32+5)
62#define CPU_FEATURE_MLC_STREAMER_PREFETCHER (32+6)
63#define CPU_FEATURE_MLC_SPATIAL_PREFETCHER (32+7)
64#define CPU_FEATURE_THREE_STRIKE_COUNTER (32+8)
65#define CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE (32+9)
66#define CPU_FEATURE_ENERGY_PERFORMANCE_BIAS (32+10)
67#define CPU_FEATURE_PPIN (32+11)
68#define CPU_FEATURE_PROC_TRACE (32+12)
70#define CPU_FEATURE_BEFORE_ALL BIT23
71#define CPU_FEATURE_AFTER_ALL BIT24
72#define CPU_FEATURE_THREAD_BEFORE BIT25
73#define CPU_FEATURE_THREAD_AFTER BIT26
74#define CPU_FEATURE_CORE_BEFORE BIT27
75#define CPU_FEATURE_CORE_AFTER BIT28
76#define CPU_FEATURE_PACKAGE_BEFORE BIT29
77#define CPU_FEATURE_PACKAGE_AFTER BIT30
78#define CPU_FEATURE_END MAX_UINT32
109 UINT32 Reserved : 26;
306 IN CHAR8 *FeatureName OPTIONAL,
372 IN REGISTER_TYPE RegisterType,
398 IN REGISTER_TYPE RegisterType,
422 IN REGISTER_TYPE RegisterType,
441#define CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value) \
443 CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
461#define CPU_REGISTER_TABLE_TEST_THEN_WRITE32(ProcessorNumber, RegisterType, Index, Value) \
463 CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
479#define CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value) \
481 CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
499#define CPU_REGISTER_TABLE_TEST_THEN_WRITE64(ProcessorNumber, RegisterType, Index, Value) \
501 CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
519#define CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value) \
522 ValueMask = MAX_UINT64; \
523 ((Type *)(&ValueMask))->Field = 0; \
524 CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
544#define CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value) \
547 ValueMask = MAX_UINT64; \
548 ((Type *)(&ValueMask))->Field = 0; \
549 CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
565#define PRE_SMM_CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value) \
567 PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
583#define PRE_SMM_CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value) \
585 PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
603#define PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value) \
606 ValueMask = MAX_UINT64; \
607 ((Type *)(&ValueMask))->Field = 0; \
608 PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
VOID EFIAPI SwitchBspAfterFeaturesInitialize(IN UINTN ProcessorNumber)
RETURN_STATUS(EFIAPI * CPU_FEATURE_INITIALIZE)(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
BOOLEAN(EFIAPI * CPU_FEATURE_SUPPORT)(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
VOID EFIAPI CpuRegisterTableWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
VOID EFIAPI CpuFeaturesDetect(VOID)
BOOLEAN EFIAPI IsCpuFeatureInSetting(IN UINT32 Feature)
BOOLEAN EFIAPI IsCpuFeatureSupported(IN UINT32 Feature)
VOID EFIAPI PreSmmCpuRegisterTableWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
VOID *(EFIAPI * CPU_FEATURE_GET_CONFIG_DATA)(IN UINTN NumberOfProcessors)
VOID EFIAPI CpuRegisterTableTestThenWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
VOID EFIAPI CpuFeaturesInitialize(VOID)
RETURN_STATUS EFIAPI RegisterCpuFeature(IN CHAR8 *FeatureName OPTIONAL, IN CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc OPTIONAL, IN CPU_FEATURE_SUPPORT SupportFunc OPTIONAL, IN CPU_FEATURE_INITIALIZE InitializeFunc OPTIONAL,...)
EFI_PROCESSOR_INFORMATION ProcessorInfo
REGISTER_CPU_FEATURE_FIRST_PROCESSOR First
CPUID_VERSION_INFO_ECX CpuIdVersionInfoEcx
CPUID_VERSION_INFO_EDX CpuIdVersionInfoEdx