TianoCore EDK2 master
|
#include "RegisterCpuFeatures.h"
Go to the source code of this file.
Functions | |
VOID | DumpCpuFeatureMask (IN UINT8 *FeatureMask, IN UINT32 BitMaskSize) |
VOID | DumpCpuFeature (IN CPU_FEATURES_ENTRY *CpuFeature, IN UINT32 BitMaskSize) |
BOOLEAN | IsBitMaskMatchCheck (IN UINT8 *FeatureMask, IN UINT8 *DependentBitMask) |
BOOLEAN | FindSpecifyFeature (IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN BOOLEAN SearchFormer, IN UINT8 *FeatureMask) |
CPU_FEATURE_DEPENDENCE_TYPE | DetectFeatureScope (IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN UINT8 *NextCpuFeatureMask) |
CPU_FEATURE_DEPENDENCE_TYPE | DetectNoneNeighborhoodFeatureScope (IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN LIST_ENTRY *FeatureList) |
BOOLEAN | AdjustFeaturesDependence (IN OUT CPU_FEATURES_ENTRY *PreviousFeature, IN OUT CPU_FEATURES_ENTRY *CurrentFeature, IN CPU_FEATURES_ENTRY *FindFeature, IN BOOLEAN Before) |
VOID | AdjustEntry (IN LIST_ENTRY *FeatureList, IN OUT LIST_ENTRY *FindEntry, IN OUT LIST_ENTRY *CurrentEntry, IN BOOLEAN Before) |
BOOLEAN | InsertToBeforeEntry (IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask) |
BOOLEAN | InsertToAfterEntry (IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask) |
VOID | CheckCpuFeaturesDependency (IN LIST_ENTRY *FeatureList) |
RETURN_STATUS | RegisterCpuFeatureWorker (IN CPU_FEATURES_DATA *CpuFeaturesData, IN CPU_FEATURES_ENTRY *CpuFeature) |
VOID | SetCpuFeaturesBitMask (IN UINT8 **FeaturesBitMask, IN UINT32 Feature, IN UINTN BitMaskSize) |
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,...) |
ACPI_CPU_DATA * | GetAcpiCpuData (VOID) |
STATIC VOID | EnlargeRegisterTable (IN OUT CPU_REGISTER_TABLE *RegisterTable) |
VOID | CpuRegisterTableWriteWorker (IN BOOLEAN PreSmmFlag, IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT8 ValidBitStart, IN UINT8 ValidBitLength, IN UINT64 Value, IN BOOLEAN TestThenWrite) |
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) |
BOOLEAN | IsCpuFeatureSetInCpuPcd (IN UINT8 *CpuBitMask, IN UINTN CpuBitMaskSize, IN UINT32 Feature) |
BOOLEAN EFIAPI | IsCpuFeatureSupported (IN UINT32 Feature) |
BOOLEAN EFIAPI | IsCpuFeatureInSetting (IN UINT32 Feature) |
VOID EFIAPI | SwitchBspAfterFeaturesInitialize (IN UINTN ProcessorNumber) |
CPU Register Table Library functions.
Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file RegisterCpuFeaturesLib.c.
VOID AdjustEntry | ( | IN LIST_ENTRY * | FeatureList, |
IN OUT LIST_ENTRY * | FindEntry, | ||
IN OUT LIST_ENTRY * | CurrentEntry, | ||
IN BOOLEAN | Before | ||
) |
Base on dependence relationship to asjust feature order.
[in] | FeatureList | Pointer to CPU feature list |
[in,out] | FindEntry | The entry this feature depend on. |
[in,out] | CurrentEntry | The entry for this feature. |
[in] | Before | Before or after dependence relationship. |
Definition at line 351 of file RegisterCpuFeaturesLib.c.
BOOLEAN AdjustFeaturesDependence | ( | IN OUT CPU_FEATURES_ENTRY * | PreviousFeature, |
IN OUT CPU_FEATURES_ENTRY * | CurrentFeature, | ||
IN CPU_FEATURES_ENTRY * | FindFeature, | ||
IN BOOLEAN | Before | ||
) |
Base on dependence relationship to asjust feature dependence.
ONLY when the feature before(or after) the find feature also has dependence with the find feature. In this case, driver need to base on dependce relationship to decide how to insert current feature and adjust the feature dependence.
[in,out] | PreviousFeature | CPU feature current before the find one. |
[in,out] | CurrentFeature | Cpu feature need to adjust. |
[in] | FindFeature | Cpu feature which current feature depends. |
[in] | Before | Before or after dependence relationship. |
TRUE | means the current feature dependence has been adjusted. |
FALSE | means the previous feature dependence has been adjusted. or previous feature has no dependence with the find one. |
Definition at line 309 of file RegisterCpuFeaturesLib.c.
VOID CheckCpuFeaturesDependency | ( | IN LIST_ENTRY * | FeatureList | ) |
Checks and adjusts CPU features order per dependency relationship.
[in] | FeatureList | Pointer to CPU feature list |
Definition at line 508 of file RegisterCpuFeaturesLib.c.
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.
[in] | ProcessorNumber | The index of the CPU to add a register table entry |
[in] | RegisterType | Type of the register to program |
[in] | Index | Index of the register to program |
[in] | ValueMask | Mask of bits in register to write |
[in] | Value | Value to write |
Definition at line 1210 of file RegisterCpuFeaturesLib.c.
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.
[in] | ProcessorNumber | The index of the CPU to add a register table entry |
[in] | RegisterType | Type of the register to program |
[in] | Index | Index of the register to program |
[in] | ValueMask | Mask of bits in register to write |
[in] | Value | Value to write |
Definition at line 1176 of file RegisterCpuFeaturesLib.c.
VOID CpuRegisterTableWriteWorker | ( | IN BOOLEAN | PreSmmFlag, |
IN UINTN | ProcessorNumber, | ||
IN REGISTER_TYPE | RegisterType, | ||
IN UINT64 | Index, | ||
IN UINT8 | ValidBitStart, | ||
IN UINT8 | ValidBitLength, | ||
IN UINT64 | Value, | ||
IN BOOLEAN | TestThenWrite | ||
) |
Add 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.
[in] | PreSmmFlag | If TRUE, entry will be added into PreSmm register table If FALSE, entry will be added into register table |
[in] | ProcessorNumber | The index of the CPU to add a register table entry |
[in] | RegisterType | Type of the register to program |
[in] | Index | Index of the register to program |
[in] | ValidBitStart | Start of the bit section |
[in] | ValidBitLength | Length of the bit section |
[in] | Value | Value to write |
[in] | TestThenWrite | Whether need to test current Value before writing. |
Definition at line 1106 of file RegisterCpuFeaturesLib.c.
CPU_FEATURE_DEPENDENCE_TYPE DetectFeatureScope | ( | IN CPU_FEATURES_ENTRY * | CpuFeature, |
IN BOOLEAN | Before, | ||
IN UINT8 * | NextCpuFeatureMask | ||
) |
Return feature dependence result.
[in] | CpuFeature | Pointer to CPU feature. |
[in] | Before | Check before dependence or after. |
[in] | NextCpuFeatureMask | Pointer to next CPU feature Mask. |
return | the dependence result. |
Definition at line 168 of file RegisterCpuFeaturesLib.c.
CPU_FEATURE_DEPENDENCE_TYPE DetectNoneNeighborhoodFeatureScope | ( | IN CPU_FEATURES_ENTRY * | CpuFeature, |
IN BOOLEAN | Before, | ||
IN LIST_ENTRY * | FeatureList | ||
) |
Return feature dependence result.
[in] | CpuFeature | Pointer to CPU feature. |
[in] | Before | Check before dependence or after. |
[in] | FeatureList | Pointer to CPU feature list. |
return | the dependence result. |
Definition at line 240 of file RegisterCpuFeaturesLib.c.
VOID DumpCpuFeature | ( | IN CPU_FEATURES_ENTRY * | CpuFeature, |
IN UINT32 | BitMaskSize | ||
) |
Dump CPU feature name or CPU feature bit mask.
[in] | CpuFeature | Pointer to CPU_FEATURES_ENTRY |
[in] | BitMaskSize | CPU feature bits mask buffer size. |
Definition at line 43 of file RegisterCpuFeaturesLib.c.
Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
[in] | FeatureMask | A pointer to the CPU feature bit mask. |
[in] | BitMaskSize | CPU feature bits mask buffer size. |
Definition at line 19 of file RegisterCpuFeaturesLib.c.
STATIC VOID EnlargeRegisterTable | ( | IN OUT CPU_REGISTER_TABLE * | RegisterTable | ) |
Enlarges CPU register table for each processor.
[in,out] | RegisterTable | Pointer processor's CPU register table |
Definition at line 1056 of file RegisterCpuFeaturesLib.c.
BOOLEAN FindSpecifyFeature | ( | IN LIST_ENTRY * | FeatureList, |
IN LIST_ENTRY * | CurrentEntry, | ||
IN BOOLEAN | SearchFormer, | ||
IN UINT8 * | FeatureMask | ||
) |
Try to find the specify cpu featuren in former/after feature list.
[in] | FeatureList | Pointer to dependent CPU feature list |
[in] | CurrentEntry | Pointer to current CPU feature entry. |
[in] | SearchFormer | Find in former feature or after features. |
[in] | FeatureMask | Pointer to CPU feature bit mask |
TRUE | The feature bit mask is in dependent CPU feature bit mask buffer. |
FALSE | The feature bit mask is not in dependent CPU feature bit mask buffer. |
Definition at line 101 of file RegisterCpuFeaturesLib.c.
ACPI_CPU_DATA * GetAcpiCpuData | ( | VOID | ) |
Return ACPI_CPU_DATA data.
Definition at line 973 of file RegisterCpuFeaturesLib.c.
BOOLEAN InsertToAfterEntry | ( | IN LIST_ENTRY * | FeatureList, |
IN LIST_ENTRY * | CurrentEntry, | ||
IN UINT8 * | FeatureMask | ||
) |
Checks and adjusts current CPU features per dependency relationship.
[in] | FeatureList | Pointer to CPU feature list |
[in] | CurrentEntry | Pointer to current checked CPU feature |
[in] | FeatureMask | The feature bit mask. |
return | Swapped info. |
Definition at line 472 of file RegisterCpuFeaturesLib.c.
BOOLEAN InsertToBeforeEntry | ( | IN LIST_ENTRY * | FeatureList, |
IN LIST_ENTRY * | CurrentEntry, | ||
IN UINT8 * | FeatureMask | ||
) |
Checks and adjusts current CPU features per dependency relationship.
[in] | FeatureList | Pointer to CPU feature list |
[in] | CurrentEntry | Pointer to current checked CPU feature |
[in] | FeatureMask | The feature bit mask. |
return | Swapped info. |
Definition at line 432 of file RegisterCpuFeaturesLib.c.
Determines if the feature bit mask is in dependent CPU feature bit mask buffer.
[in] | FeatureMask | Pointer to CPU feature bit mask |
[in] | DependentBitMask | Pointer to dependent CPU feature bit mask buffer |
TRUE | The feature bit mask is in dependent CPU feature bit mask buffer. |
FALSE | The feature bit mask is not in dependent CPU feature bit mask buffer. |
Definition at line 66 of file RegisterCpuFeaturesLib.c.
BOOLEAN EFIAPI IsCpuFeatureInSetting | ( | IN UINT32 | Feature | ) |
Determines if a CPU feature is set in PcdCpuFeaturesSetting bit mask.
[in] | Feature | The bit number of the CPU feature to check in the PCD PcdCpuFeaturesSetting |
TRUE | The CPU feature is set in PcdCpuFeaturesSetting. |
FALSE | The CPU feature is not set in PcdCpuFeaturesSetting. |
Definition at line 1327 of file RegisterCpuFeaturesLib.c.
BOOLEAN IsCpuFeatureSetInCpuPcd | ( | IN UINT8 * | CpuBitMask, |
IN UINTN | CpuBitMaskSize, | ||
IN UINT32 | Feature | ||
) |
Worker function to determine if a CPU feature is set in input CPU feature bit mask buffer.
[in] | CpuBitMask | CPU feature bit mask buffer |
[in] | CpuBitMaskSize | The size of CPU feature bit mask buffer |
[in] | Feature | The bit number of the CPU feature |
TRUE | The CPU feature is set in CpuBitMask. |
FALSE | The CPU feature is not set in CpuBitMask. |
Definition at line 1274 of file RegisterCpuFeaturesLib.c.
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.
[in] | Feature | The bit number of the CPU feature to check in the PCD PcdCpuFeaturesSupport |
TRUE | The CPU feature is set in PcdCpuFeaturesSupport. |
FALSE | The CPU feature is not set in PcdCpuFeaturesSupport. |
Definition at line 1303 of file RegisterCpuFeaturesLib.c.
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.
[in] | ProcessorNumber | The index of the CPU to add a register table entry. |
[in] | RegisterType | Type of the register to program |
[in] | Index | Index of the register to program |
[in] | ValueMask | Mask of bits in register to write |
[in] | Value | Value to write |
Definition at line 1244 of file RegisterCpuFeaturesLib.c.
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.
[in] | FeatureName | A Null-terminated Ascii string indicates CPU feature name. |
[in] | GetConfigDataFunc | CPU 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] | SupportFunc | CPU 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] | InitializeFunc | CPU 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_SUCCESS | The CPU feature was successfully registered. |
RETURN_OUT_OF_RESOURCES | There are not enough resources to register the CPU feature. |
RETURN_UNSUPPORTED | Registration of the CPU feature is not supported due to a circular dependency between BEFORE and AFTER features. |
RETURN_NOT_READY | CPU feature PCD PcdCpuFeaturesUserConfiguration not updated by Platform driver yet. |
Definition at line 840 of file RegisterCpuFeaturesLib.c.
RETURN_STATUS RegisterCpuFeatureWorker | ( | IN CPU_FEATURES_DATA * | CpuFeaturesData, |
IN CPU_FEATURES_ENTRY * | CpuFeature | ||
) |
Worker function to register CPU Feature.
[in] | CpuFeaturesData | Pointer to CPU feature data structure. |
[in] | CpuFeature | Pointer to CPU feature entry |
RETURN_SUCCESS | The CPU feature was successfully registered. |
RETURN_OUT_OF_RESOURCES | There are not enough resources to register the CPU feature. |
RETURN_UNSUPPORTED | Registration of the CPU feature is not supported due to a circular dependency between BEFORE and AFTER features. |
Definition at line 641 of file RegisterCpuFeaturesLib.c.
Sets CPU feature bit mask in CPU feature bit mask buffer.
[in] | FeaturesBitMask | Pointer to CPU feature bit mask buffer |
[in] | Feature | The bit number of the CPU feature |
[in] | BitMaskSize | CPU feature bit mask buffer size |
Definition at line 772 of file RegisterCpuFeaturesLib.c.
Switches to assigned BSP after CPU features initialization.
[in] | ProcessorNumber | The index of the CPU executing this function. |
Definition at line 1347 of file RegisterCpuFeaturesLib.c.