TianoCore EDK2 master
Loading...
Searching...
No Matches
RegisterCpuFeaturesLib.h File Reference

Go to the source code of this file.

Data Structures

struct  REGISTER_CPU_FEATURE_FIRST_PROCESSOR
 
struct  REGISTER_CPU_FEATURE_INFORMATION
 

Macros

#define CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value)
 
#define CPU_REGISTER_TABLE_TEST_THEN_WRITE32(ProcessorNumber, RegisterType, Index, Value)
 
#define CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value)
 
#define CPU_REGISTER_TABLE_TEST_THEN_WRITE64(ProcessorNumber, RegisterType, Index, Value)
 
#define CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value)
 
#define CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value)
 
#define PRE_SMM_CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value)
 
#define PRE_SMM_CPU_REGISTER_TABLE_WRITE64(ProcessorNumber, RegisterType, Index, Value)
 
#define PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD(ProcessorNumber, RegisterType, Index, Type, Field, Value)
 
#define CPU_FEATURE_AESNI   0
 
#define CPU_FEATURE_TURBO_MODE   1
 
#define CPU_FEATURE_MWAIT   2
 
#define CPU_FEATURE_ACPI   3
 
#define CPU_FEATURE_EIST   4
 
#define CPU_FEATURE_RESERVED_5   5
 
#define CPU_FEATURE_FASTSTRINGS   6
 
#define CPU_FEATURE_VMX   7
 
#define CPU_FEATURE_SMX   8
 
#define CPU_FEATURE_LMCE   9
 
#define CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER   10
 
#define CPU_FEATURE_LIMIT_CPUID_MAX_VAL   11
 
#define CPU_FEATURE_MCE   12
 
#define CPU_FEATURE_MCA   13
 
#define CPU_FEATURE_MCG_CTL   14
 
#define CPU_FEATURE_PENDING_BREAK   15
 
#define CPU_FEATURE_C1E   16
 
#define CPU_FEATURE_C1_AUTO_DEMOTION   17
 
#define CPU_FEATURE_C3_AUTO_DEMOTION   18
 
#define CPU_FEATURE_C1_UNDEMOTION   19
 
#define CPU_FEATURE_C3_UNDEMOTION   20
 
#define CPU_FEATURE_C_STATE   21
 
#define CPU_FEATURE_TM   22
 
#define CPU_FEATURE_TM2   23
 
#define CPU_FEATURE_X2APIC   24
 
#define CPU_FEATURE_RESERVED_25   25
 
#define CPU_FEATURE_RESERVED_26   26
 
#define CPU_FEATURE_RESERVED_27   27
 
#define CPU_FEATURE_RESERVED_28   28
 
#define CPU_FEATURE_RESERVED_29   29
 
#define CPU_FEATURE_RESERVED_30   30
 
#define CPU_FEATURE_RESERVED_31   31
 
#define CPU_FEATURE_L2_PREFETCHER   (32+0)
 
#define CPU_FEATURE_L1_DATA_PREFETCHER   (32+1)
 
#define CPU_FEATURE_HARDWARE_PREFETCHER   (32+2)
 
#define CPU_FEATURE_ADJACENT_CACHE_LINE_PREFETCH   (32+3)
 
#define CPU_FEATURE_DCU_PREFETCHER   (32+4)
 
#define CPU_FEATURE_IP_PREFETCHER   (32+5)
 
#define CPU_FEATURE_MLC_STREAMER_PREFETCHER   (32+6)
 
#define CPU_FEATURE_MLC_SPATIAL_PREFETCHER   (32+7)
 
#define CPU_FEATURE_THREE_STRIKE_COUNTER   (32+8)
 
#define CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE   (32+9)
 
#define CPU_FEATURE_ENERGY_PERFORMANCE_BIAS   (32+10)
 
#define CPU_FEATURE_PPIN   (32+11)
 
#define CPU_FEATURE_PROC_TRACE   (32+12)
 
#define CPU_FEATURE_BEFORE_ALL   BIT23
 
#define CPU_FEATURE_AFTER_ALL   BIT24
 
#define CPU_FEATURE_THREAD_BEFORE   BIT25
 
#define CPU_FEATURE_THREAD_AFTER   BIT26
 
#define CPU_FEATURE_CORE_BEFORE   BIT27
 
#define CPU_FEATURE_CORE_AFTER   BIT28
 
#define CPU_FEATURE_PACKAGE_BEFORE   BIT29
 
#define CPU_FEATURE_PACKAGE_AFTER   BIT30
 
#define CPU_FEATURE_END   MAX_UINT32
 

Typedefs

typedef VOID *(EFIAPI * CPU_FEATURE_GET_CONFIG_DATA) (IN UINTN NumberOfProcessors)
 
typedef BOOLEAN(EFIAPI * CPU_FEATURE_SUPPORT) (IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
 
typedef RETURN_STATUS(EFIAPI * CPU_FEATURE_INITIALIZE) (IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
 

Functions

BOOLEAN EFIAPI IsCpuFeatureSupported (IN UINT32 Feature)
 
BOOLEAN EFIAPI IsCpuFeatureInSetting (IN UINT32 Feature)
 
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,...)
 
VOID EFIAPI CpuFeaturesDetect (VOID)
 
VOID EFIAPI CpuFeaturesInitialize (VOID)
 
VOID EFIAPI SwitchBspAfterFeaturesInitialize (IN UINTN ProcessorNumber)
 
VOID EFIAPI CpuRegisterTableWrite (IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
 
VOID EFIAPI CpuRegisterTableTestThenWrite (IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
 
VOID EFIAPI PreSmmCpuRegisterTableWrite (IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
 

Detailed Description

Register CPU Features Library to register and manage CPU features.

Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file RegisterCpuFeaturesLib.h.

Macro Definition Documentation

◆ CPU_FEATURE_ACPI

#define CPU_FEATURE_ACPI   3

Definition at line 26 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_ADJACENT_CACHE_LINE_PREFETCH

#define CPU_FEATURE_ADJACENT_CACHE_LINE_PREFETCH   (32+3)

Definition at line 59 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_AESNI

#define CPU_FEATURE_AESNI   0

Defines used to identify a CPU feature. The lower 16-bits are used to identify a unique CPU feature and the value represents a bit number in a bit mask. The upper 16-bits are bit mask values that are used as modifiers of a CPU feature. When used in a list, the define value CPU_FEATURE_END is used to terminate a list of CPU feature values.

Definition at line 23 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_AFTER_ALL

#define CPU_FEATURE_AFTER_ALL   BIT24

Definition at line 71 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE

#define CPU_FEATURE_APIC_TPR_UPDATE_MESSAGE   (32+9)

Definition at line 65 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_BEFORE_ALL

#define CPU_FEATURE_BEFORE_ALL   BIT23

Definition at line 70 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C1_AUTO_DEMOTION

#define CPU_FEATURE_C1_AUTO_DEMOTION   17

Definition at line 40 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C1_UNDEMOTION

#define CPU_FEATURE_C1_UNDEMOTION   19

Definition at line 42 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C1E

#define CPU_FEATURE_C1E   16

Definition at line 39 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C3_AUTO_DEMOTION

#define CPU_FEATURE_C3_AUTO_DEMOTION   18

Definition at line 41 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C3_UNDEMOTION

#define CPU_FEATURE_C3_UNDEMOTION   20

Definition at line 43 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_C_STATE

#define CPU_FEATURE_C_STATE   21

Definition at line 44 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_CORE_AFTER

#define CPU_FEATURE_CORE_AFTER   BIT28

Definition at line 75 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_CORE_BEFORE

#define CPU_FEATURE_CORE_BEFORE   BIT27

Definition at line 74 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_DCU_PREFETCHER

#define CPU_FEATURE_DCU_PREFETCHER   (32+4)

Definition at line 60 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_EIST

#define CPU_FEATURE_EIST   4

Definition at line 27 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_END

#define CPU_FEATURE_END   MAX_UINT32

Definition at line 78 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_ENERGY_PERFORMANCE_BIAS

#define CPU_FEATURE_ENERGY_PERFORMANCE_BIAS   (32+10)

Definition at line 66 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_FASTSTRINGS

#define CPU_FEATURE_FASTSTRINGS   6

Definition at line 29 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_HARDWARE_PREFETCHER

#define CPU_FEATURE_HARDWARE_PREFETCHER   (32+2)

Definition at line 58 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_IP_PREFETCHER

#define CPU_FEATURE_IP_PREFETCHER   (32+5)

Definition at line 61 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_L1_DATA_PREFETCHER

#define CPU_FEATURE_L1_DATA_PREFETCHER   (32+1)

Definition at line 57 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_L2_PREFETCHER

#define CPU_FEATURE_L2_PREFETCHER   (32+0)

Definition at line 56 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_LIMIT_CPUID_MAX_VAL

#define CPU_FEATURE_LIMIT_CPUID_MAX_VAL   11

Definition at line 34 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_LMCE

#define CPU_FEATURE_LMCE   9

Definition at line 32 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER

#define CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER   10

Definition at line 33 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MCA

#define CPU_FEATURE_MCA   13

Definition at line 36 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MCE

#define CPU_FEATURE_MCE   12

Definition at line 35 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MCG_CTL

#define CPU_FEATURE_MCG_CTL   14

Definition at line 37 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MLC_SPATIAL_PREFETCHER

#define CPU_FEATURE_MLC_SPATIAL_PREFETCHER   (32+7)

Definition at line 63 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MLC_STREAMER_PREFETCHER

#define CPU_FEATURE_MLC_STREAMER_PREFETCHER   (32+6)

Definition at line 62 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_MWAIT

#define CPU_FEATURE_MWAIT   2

Definition at line 25 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_PACKAGE_AFTER

#define CPU_FEATURE_PACKAGE_AFTER   BIT30

Definition at line 77 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_PACKAGE_BEFORE

#define CPU_FEATURE_PACKAGE_BEFORE   BIT29

Definition at line 76 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_PENDING_BREAK

#define CPU_FEATURE_PENDING_BREAK   15

Definition at line 38 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_PPIN

#define CPU_FEATURE_PPIN   (32+11)

Definition at line 67 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_PROC_TRACE

#define CPU_FEATURE_PROC_TRACE   (32+12)

Definition at line 68 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_25

#define CPU_FEATURE_RESERVED_25   25

Definition at line 48 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_26

#define CPU_FEATURE_RESERVED_26   26

Definition at line 49 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_27

#define CPU_FEATURE_RESERVED_27   27

Definition at line 50 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_28

#define CPU_FEATURE_RESERVED_28   28

Definition at line 51 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_29

#define CPU_FEATURE_RESERVED_29   29

Definition at line 52 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_30

#define CPU_FEATURE_RESERVED_30   30

Definition at line 53 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_31

#define CPU_FEATURE_RESERVED_31   31

Definition at line 54 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_RESERVED_5

#define CPU_FEATURE_RESERVED_5   5

Definition at line 28 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_SMX

#define CPU_FEATURE_SMX   8

Definition at line 31 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_THREAD_AFTER

#define CPU_FEATURE_THREAD_AFTER   BIT26

Definition at line 73 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_THREAD_BEFORE

#define CPU_FEATURE_THREAD_BEFORE   BIT25

Definition at line 72 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_THREE_STRIKE_COUNTER

#define CPU_FEATURE_THREE_STRIKE_COUNTER   (32+8)

Definition at line 64 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_TM

#define CPU_FEATURE_TM   22

Definition at line 45 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_TM2

#define CPU_FEATURE_TM2   23

Definition at line 46 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_TURBO_MODE

#define CPU_FEATURE_TURBO_MODE   1

Definition at line 24 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_VMX

#define CPU_FEATURE_VMX   7

Definition at line 30 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_X2APIC

#define CPU_FEATURE_X2APIC   24

Definition at line 47 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_TEST_THEN_WRITE32

#define CPU_REGISTER_TABLE_TEST_THEN_WRITE32 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
} while(FALSE);
#define FALSE
Definition: Base.h:307

Adds a 32-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Driver will test the current value before setting new value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 461 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_TEST_THEN_WRITE64

#define CPU_REGISTER_TABLE_TEST_THEN_WRITE64 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
} while(FALSE);

Adds a 64-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Driver will test the current value before setting new value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 499 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD

#define CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD (   ProcessorNumber,
  RegisterType,
  Index,
  Type,
  Field,
  Value 
)
Value:
do { \
UINT64 ValueMask; \
ValueMask = MAX_UINT64; \
((Type *)(&ValueMask))->Field = 0; \
CpuRegisterTableTestThenWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
} while(FALSE);

Adds a bit field write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, bit field section, and value.

Driver will test the current value before setting new value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program.
[in]IndexIndex of the register to program.
[in]TypeThe data type name of a register structure.
[in]FieldThe bit fiel name in register structure to write.
[in]ValueValue to write to the bit field.
Note
This service could be called by BSP only.

Definition at line 544 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_WRITE32

#define CPU_REGISTER_TABLE_WRITE32 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
} while(FALSE);

Adds a 32-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 441 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_WRITE64

#define CPU_REGISTER_TABLE_WRITE64 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
} while(FALSE);

Adds a 64-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 479 of file RegisterCpuFeaturesLib.h.

◆ CPU_REGISTER_TABLE_WRITE_FIELD

#define CPU_REGISTER_TABLE_WRITE_FIELD (   ProcessorNumber,
  RegisterType,
  Index,
  Type,
  Field,
  Value 
)
Value:
do { \
UINT64 ValueMask; \
ValueMask = MAX_UINT64; \
((Type *)(&ValueMask))->Field = 0; \
CpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
} while(FALSE);

Adds a bit field write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, bit field section, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program.
[in]IndexIndex of the register to program.
[in]TypeThe data type name of a register structure.
[in]FieldThe bit fiel name in register structure to write.
[in]ValueValue to write to the bit field.
Note
This service could be called by BSP only.

Definition at line 519 of file RegisterCpuFeaturesLib.h.

◆ PRE_SMM_CPU_REGISTER_TABLE_WRITE32

#define PRE_SMM_CPU_REGISTER_TABLE_WRITE32 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT32, Value); \
} while(FALSE);

Adds a 32-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 565 of file RegisterCpuFeaturesLib.h.

◆ PRE_SMM_CPU_REGISTER_TABLE_WRITE64

#define PRE_SMM_CPU_REGISTER_TABLE_WRITE64 (   ProcessorNumber,
  RegisterType,
  Index,
  Value 
)
Value:
do { \
PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, MAX_UINT64, Value); \
} while(FALSE);

Adds a 64-bit register write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 583 of file RegisterCpuFeaturesLib.h.

◆ PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD

#define PRE_SMM_CPU_REGISTER_TABLE_WRITE_FIELD (   ProcessorNumber,
  RegisterType,
  Index,
  Type,
  Field,
  Value 
)
Value:
do { \
UINT64 ValueMask; \
ValueMask = MAX_UINT64; \
((Type *)(&ValueMask))->Field = 0; \
PreSmmCpuRegisterTableWrite (ProcessorNumber, RegisterType, Index, ~ValueMask, Value); \
} while(FALSE);

Adds a bit field write entry in specified register table.

This macro adds an entry in specified register table, with given register type, register index, bit field section, and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program.
[in]IndexIndex of the register to program.
[in]TypeThe data type name of a register structure.
[in]FieldThe bit fiel name in register structure to write.
[in]ValueValue to write to the bit field.
Note
This service could be called by BSP only.

Definition at line 603 of file RegisterCpuFeaturesLib.h.

Typedef Documentation

◆ CPU_FEATURE_GET_CONFIG_DATA

typedef VOID *(EFIAPI * CPU_FEATURE_GET_CONFIG_DATA) (IN UINTN NumberOfProcessors)

Prepares for the data used by CPU feature detection and initialization.

Parameters
[in]NumberOfProcessorsThe number of CPUs in the platform.
Returns
Pointer to a buffer of CPU related configuration data.
Note
This service could be called by BSP only.

Definition at line 200 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_INITIALIZE

typedef RETURN_STATUS(EFIAPI * CPU_FEATURE_INITIALIZE) (IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)

Initializes CPU feature to specific state.

This service does not initialize hardware and only produces entries in the Register Table for specified processor. Hardware initialization on BSP/APs will be done in CpuFeaturesInitialize().

Parameters
[in]ProcessorNumberThe index of the CPU executing this function.
[in]CpuInfoA pointer to the REGISTER_CPU_FEATURE_INFORMATION structure for the CPU executing this function.
[in]ConfigDataA pointer to the configuration buffer returned by CPU_FEATURE_GET_CONFIG_DATA. NULL if CPU_FEATURE_GET_CONFIG_DATA was not provided in RegisterCpuFeature().
[in]StateIf TRUE, then the CPU feature must be enabled. If FALSE, then the CPU feature must be disabled.
Return values
RETURN_SUCCESSCPU feature is initialized.
Note
This service could be called by BSP only.

Definition at line 251 of file RegisterCpuFeaturesLib.h.

◆ CPU_FEATURE_SUPPORT

typedef BOOLEAN(EFIAPI * CPU_FEATURE_SUPPORT) (IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)

Detects if CPU feature supported on current processor.

Parameters
[in]ProcessorNumberThe index of the CPU executing this function.
[in]CpuInfoA pointer to the REGISTER_CPU_FEATURE_INFORMATION structure for the CPU executing this function.
[in]ConfigDataA pointer to the configuration buffer returned by CPU_FEATURE_GET_CONFIG_DATA. NULL if CPU_FEATURE_GET_CONFIG_DATA was not provided in RegisterCpuFeature().
Return values
TRUECPU feature is supported.
FALSECPU feature is not supported.
Note
This service could be called by BSP/APs.

Definition at line 222 of file RegisterCpuFeaturesLib.h.

Function Documentation

◆ CpuFeaturesDetect()

VOID EFIAPI CpuFeaturesDetect ( VOID  )

Performs CPU features detection.

This service will invoke MP service to check CPU features' capabilities on BSP/APs.

Note
This service could be called by BSP only.

Definition at line 1201 of file CpuFeaturesInitialize.c.

◆ CpuFeaturesInitialize()

VOID EFIAPI CpuFeaturesInitialize ( VOID  )

Performs CPU features Initialization.

This service will invoke MP service to perform CPU features initialization on BSP/APs per user configuration.

Note
This service could be called by BSP only.

Definition at line 218 of file DxeRegisterCpuFeaturesLib.c.

◆ CpuRegisterTableTestThenWrite()

VOID EFIAPI CpuRegisterTableTestThenWrite ( IN UINTN  ProcessorNumber,
IN REGISTER_TYPE  RegisterType,
IN UINT64  Index,
IN UINT64  ValueMask,
IN UINT64  Value 
)

Adds an entry in specified register table.

This function adds an entry in specified register table, with given register type, register index, bit section and value.

Driver will test the current value before setting new value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueMaskMask of bits in register to write
[in]ValueValue to write
Note
This service could be called by BSP only.

Adds an entry in specified register table.

This function adds an entry in specified register table, with given register type, register index, bit section and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueMaskMask of bits in register to write
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 1194 of file RegisterCpuFeaturesLib.c.

◆ CpuRegisterTableWrite()

VOID EFIAPI CpuRegisterTableWrite ( IN UINTN  ProcessorNumber,
IN REGISTER_TYPE  RegisterType,
IN UINT64  Index,
IN UINT64  ValueMask,
IN UINT64  Value 
)

Adds an entry in specified register table.

This function adds an entry in specified register table, with given register type, register index, bit section and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueMaskMask of bits in register to write
[in]ValueValue to write
Note
This service could be called by BSP only.

Adds an entry in specified register table.

This function adds an entry in specified register table, with given register type, register index, bit section and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueMaskMask of bits in register to write
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 1160 of file RegisterCpuFeaturesLib.c.

◆ IsCpuFeatureInSetting()

BOOLEAN EFIAPI IsCpuFeatureInSetting ( IN UINT32  Feature)

Determines if a CPU feature is set in PcdCpuFeaturesSetting bit mask.

Parameters
[in]FeatureThe bit number of the CPU feature to check in the PCD PcdCpuFeaturesSetting.
Return values
TRUEThe CPU feature is set in PcdCpuFeaturesSetting.
FALSEThe CPU feature is not set in PcdCpuFeaturesSetting.
Note
This service could be called by BSP only.

Determines if a CPU feature is set in PcdCpuFeaturesSetting bit mask.

Parameters
[in]FeatureThe bit number of the CPU feature to check in the PCD PcdCpuFeaturesSetting
Return values
TRUEThe CPU feature is set in PcdCpuFeaturesSetting.
FALSEThe CPU feature is not set in PcdCpuFeaturesSetting.
Note
This service could be called by BSP only.

Definition at line 1311 of file RegisterCpuFeaturesLib.c.

◆ IsCpuFeatureSupported()

BOOLEAN EFIAPI IsCpuFeatureSupported ( IN UINT32  Feature)

Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask. If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data associated with that feature should be optimized away if compiler optimizations are enabled.

Parameters
[in]FeatureThe bit number of the CPU feature to check in the PCD PcdCpuFeaturesSupport.
Return values
TRUEThe CPU feature is set in PcdCpuFeaturesSupport.
FALSEThe CPU feature is not set in PcdCpuFeaturesSupport.
Note
This service could be called by BSP only.

Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask. If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data associated with that feature should be optimized away if compiler optimizations are enabled.

Parameters
[in]FeatureThe bit number of the CPU feature to check in the PCD PcdCpuFeaturesSupport
Return values
TRUEThe CPU feature is set in PcdCpuFeaturesSupport.
FALSEThe CPU feature is not set in PcdCpuFeaturesSupport.
Note
This service could be called by BSP only.

Definition at line 1287 of file RegisterCpuFeaturesLib.c.

◆ PreSmmCpuRegisterTableWrite()

VOID EFIAPI PreSmmCpuRegisterTableWrite ( IN UINTN  ProcessorNumber,
IN REGISTER_TYPE  RegisterType,
IN UINT64  Index,
IN UINT64  ValueMask,
IN UINT64  Value 
)

Adds an entry in specified Pre-SMM register table.

This function adds an entry in specified register table, with given register type, register index, bit section and value.

Parameters
[in]ProcessorNumberThe index of the CPU to add a register table entry.
[in]RegisterTypeType of the register to program
[in]IndexIndex of the register to program
[in]ValueMaskMask of bits in register to write
[in]ValueValue to write
Note
This service could be called by BSP only.

Definition at line 1228 of file RegisterCpuFeaturesLib.c.

◆ RegisterCpuFeature()

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,
  ... 
)

Registers a CPU Feature.

Parameters
[in]FeatureNameA Null-terminated Ascii string indicates CPU feature name.
[in]GetConfigDataFuncCPU feature get configuration data function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU configuration data for the registered feature is NULL.
[in]SupportFuncCPU feature support function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU feature is assumed to be supported by all CPUs.
[in]InitializeFuncCPU feature initialize function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU feature initialization is skipped.
[in]...Variable argument list of UINT32 CPU feature value. Values with no modifiers are the features provided by the registered functions. Values with CPU_FEATURE_BEFORE modifier are features that must be initialized after the features provided by the registered functions are used. Values with CPU_FEATURE_AFTER modifier are features that must be initialized before the features provided by the registered functions are used. The last argument in this variable argument list must always be CPU_FEATURE_END.
Return values
RETURN_SUCCESSThe CPU feature was successfully registered.
RETURN_OUT_OF_RESOURCESThere are not enough resources to register the CPU feature.
RETURN_UNSUPPORTEDRegistration of the CPU feature is not supported due to a circular dependency between BEFORE and AFTER features.
Note
This service could be called by BSP only.

Registers a CPU Feature.

Parameters
[in]FeatureNameA Null-terminated Ascii string indicates CPU feature name.
[in]GetConfigDataFuncCPU feature get configuration data function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU configuration data for the registered feature is NULL.
[in]SupportFuncCPU feature support function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU feature is assumed to be supported by all CPUs.
[in]InitializeFuncCPU feature initialize function. This is an optional parameter that may be NULL. If NULL, then the most recently registered function for the CPU feature is used. If no functions are registered for a CPU feature, then the CPU feature initialization is skipped.
[in]...Variable argument list of UINT32 CPU feature value. Values with no modifiers are the features provided by the registered functions. Values with CPU_FEATURE_BEFORE modifier are features that must be initialized after the features provided by the registered functions are used. Values with CPU_FEATURE_AFTER modifier are features that must be initialized before the features provided by the registered functions are used. The last argument in this variable argument list must always be CPU_FEATURE_END.
Return values
RETURN_SUCCESSThe CPU feature was successfully registered.
RETURN_OUT_OF_RESOURCESThere are not enough resources to register the CPU feature.
RETURN_UNSUPPORTEDRegistration of the CPU feature is not supported due to a circular dependency between BEFORE and AFTER features.
RETURN_NOT_READYCPU feature PCD PcdCpuFeaturesUserConfiguration not updated by Platform driver yet.
Note
This service could be called by BSP only.

Definition at line 840 of file RegisterCpuFeaturesLib.c.

◆ SwitchBspAfterFeaturesInitialize()

VOID EFIAPI SwitchBspAfterFeaturesInitialize ( IN UINTN  ProcessorNumber)

Switches to assigned BSP after CPU features initialization.

Parameters
[in]ProcessorNumberThe index of the CPU executing this function.
Note
This service could be called by BSP only.

Definition at line 1331 of file RegisterCpuFeaturesLib.c.