41 if ((msr.
lo & 0xff06) != 0xff06) {
42 printk(
BIOS_ERR,
"GETSEC not enabled in IA32_FEATURE_CONTROL MSR\n");
68 }
else if ((msr.
lo & 0xff06) != 0xff06) {
76 "IA32_FEATURE_CONTROL MSR locked with GETSEC and/or VMX disabled.\n"
77 "Will perform a full reset to unlock this MSR.\n");
105 for (i = 0; i < 0x1f; i++) {
107 asm volatile (
"getsec\n"
108 :
"=a" (eax),
"=b" (ebx),
"=c" (ecx)
110 switch (eax & 0x1f) {
116 if (version_numbers_supported)
117 *version_numbers_supported = ecx;
120 if (max_size_acm_area)
121 *max_size_acm_area = eax & ~0x1f;
124 if (memory_type_mask)
125 *memory_type_mask = eax;
128 if (senter_function_disable)
129 *senter_function_disable = eax & (0x3f00);
132 if (txt_feature_flags)
133 *txt_feature_flags = eax & (0x60);
152 asm volatile (
"getsec\n"
static unsigned int cpuid_ecx(unsigned int op)
#define printk(level,...)
static __always_inline void write_cr4(CRx_TYPE data)
static __always_inline CRx_TYPE read_cr4(void)
void enable_getsec_or_reset(void)
static bool getsec_enabled(void)
Check for SMX support and enable it if possible.
bool getsec_capabilities(uint32_t *eax)
Get capabilities as returned by getsec[CAPABILITIES].
bool getsec_parameter(uint32_t *version_mask, uint32_t *version_numbers_supported, uint32_t *max_size_acm_area, uint32_t *memory_type_mask, uint32_t *senter_function_disable, uint32_t *txt_feature_flags)
Get information as returned by getsec[PARAMETER].
static __always_inline msr_t rdmsr(unsigned int index)
#define IA32_FEATURE_CONTROL
#define FEATURE_CONTROL_LOCK_BIT
static __always_inline void wrmsr(unsigned int index, msr_t msr)
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define ENV_ROMSTAGE_OR_BEFORE
#define IA32_GETSEC_PARAMETERS
#define IA32_GETSEC_CAPABILITIES