TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuFeaturesInitialize.c File Reference

Go to the source code of this file.

Functions

VOID SetCapabilityPcd (IN UINT8 *SupportedFeatureMask, IN UINTN BitMaskSize)
 
VOID SetSettingPcd (IN UINT8 *SupportedFeatureMask, IN UINTN BitMaskSize)
 
VOID FillProcessorInfo (IN OUT REGISTER_CPU_FEATURE_INFORMATION *CpuInfo)
 
VOID CpuInitDataInitialize (VOID)
 
VOID SupportedMaskOr (IN UINT8 *SupportedFeatureMask, IN UINT8 *OrFeatureBitMask, IN UINT32 BitMaskSize)
 
VOID SupportedMaskAnd (IN UINT8 *SupportedFeatureMask, IN CONST UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
 
VOID SupportedMaskCleanBit (IN UINT8 *SupportedFeatureMask, IN UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
 
BOOLEAN IsBitMaskMatch (IN UINT8 *SupportedFeatureMask, IN UINT8 *ComparedFeatureBitMask, IN UINT32 BitMaskSize)
 
VOID EFIAPI CollectProcessorData (IN OUT VOID *Buffer)
 
VOID DumpRegisterTableOnProcessor (IN UINTN ProcessorNumber)
 
CPU_FEATURE_DEPENDENCE_TYPE BiggestDep (IN CPU_FEATURE_DEPENDENCE_TYPE BeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE AfterDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep)
 
VOID AnalysisProcessorFeatures (IN UINTN NumberOfCpus)
 
VOID LibReleaseSemaphore (IN OUT volatile UINT32 *Sem)
 
VOID LibWaitForSemaphore (IN OUT volatile UINT32 *Sem)
 
UINTN ReadWriteCr (IN UINT32 CrIndex, IN BOOLEAN Read, IN OUT UINTN *CrValue)
 
VOID ProgramProcessorRegister (IN CPU_REGISTER_TABLE *RegisterTable, IN EFI_CPU_PHYSICAL_LOCATION *ApLocation, IN CPU_STATUS_INFORMATION *CpuStatus, IN PROGRAM_CPU_REGISTER_FLAGS *CpuFlags)
 
VOID EFIAPI SetProcessorRegister (IN OUT VOID *Buffer)
 
VOID EFIAPI CpuFeaturesDetect (VOID)
 

Variables

CHAR16 * mDependTypeStr [] = { L"None", L"Thread", L"Core", L"Package", L"Invalid" }
 

Detailed Description

CPU Features Initialize functions.

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

Definition in file CpuFeaturesInitialize.c.

Function Documentation

◆ AnalysisProcessorFeatures()

VOID AnalysisProcessorFeatures ( IN UINTN  NumberOfCpus)

Analysis register CPU features on each processor and save CPU setting in CPU register table.

Parameters
[in]NumberOfCpusNumber of processor in system

Definition at line 714 of file CpuFeaturesInitialize.c.

◆ BiggestDep()

CPU_FEATURE_DEPENDENCE_TYPE BiggestDep ( IN CPU_FEATURE_DEPENDENCE_TYPE  BeforeDep,
IN CPU_FEATURE_DEPENDENCE_TYPE  AfterDep,
IN CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibBeforeDep,
IN CPU_FEATURE_DEPENDENCE_TYPE  NoneNeibAfterDep 
)

Get the biggest dependence type. PackageDepType > CoreDepType > ThreadDepType > NoneDepType.

Parameters
[in]BeforeDepBefore dependence type.
[in]AfterDepAfter dependence type.
[in]NoneNeibBeforeDepBefore dependence type for not neighborhood features.
[in]NoneNeibAfterDepAfter dependence type for not neighborhood features.
Return values
Returnthe biggest dependence type.

Definition at line 693 of file CpuFeaturesInitialize.c.

◆ CollectProcessorData()

VOID EFIAPI CollectProcessorData ( IN OUT VOID *  Buffer)

Collects processor data for calling processor.

Parameters
[in,out]BufferThe pointer to private data buffer.

Definition at line 544 of file CpuFeaturesInitialize.c.

◆ 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 1304 of file CpuFeaturesInitialize.c.

◆ CpuInitDataInitialize()

VOID CpuInitDataInitialize ( VOID  )

Prepares for private data used for CPU features.

Definition at line 91 of file CpuFeaturesInitialize.c.

◆ DumpRegisterTableOnProcessor()

VOID DumpRegisterTableOnProcessor ( IN UINTN  ProcessorNumber)

Dump the contents of a CPU register table.

Parameters
[in]ProcessorNumberThe index of the CPU to show the register table contents
Note
This service could be called by BSP only.

Definition at line 593 of file CpuFeaturesInitialize.c.

◆ FillProcessorInfo()

VOID FillProcessorInfo ( IN OUT REGISTER_CPU_FEATURE_INFORMATION CpuInfo)

Collects CPU type and feature information.

Parameters
[in,out]CpuInfoThe pointer to CPU feature information

Definition at line 56 of file CpuFeaturesInitialize.c.

◆ IsBitMaskMatch()

BOOLEAN IsBitMaskMatch ( IN UINT8 *  SupportedFeatureMask,
IN UINT8 *  ComparedFeatureBitMask,
IN UINT32  BitMaskSize 
)

Worker function to check if the compared CPU feature set in the CPU feature supported bits mask buffer.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]ComparedFeatureBitMaskThe feature bit mask to be compared
[in]BitMaskSizeCPU feature bits mask buffer size.
Return values
TRUEThe ComparedFeatureBitMask is set in CPU feature supported bits mask buffer.
FALSEThe ComparedFeatureBitMask is not set in CPU feature supported bits mask buffer.

Definition at line 516 of file CpuFeaturesInitialize.c.

◆ LibReleaseSemaphore()

VOID LibReleaseSemaphore ( IN OUT volatile UINT32 *  Sem)

Increment semaphore by 1.

Parameters
SemIN: 32-bit unsigned integer

Definition at line 907 of file CpuFeaturesInitialize.c.

◆ LibWaitForSemaphore()

VOID LibWaitForSemaphore ( IN OUT volatile UINT32 *  Sem)

Decrement the semaphore by 1 if it is not zero.

Performs an atomic decrement operation for semaphore. The compare exchange operation must be performed using MP safe mechanisms.

Parameters
SemIN: 32-bit unsigned integer

Definition at line 925 of file CpuFeaturesInitialize.c.

◆ ProgramProcessorRegister()

VOID ProgramProcessorRegister ( IN CPU_REGISTER_TABLE RegisterTable,
IN EFI_CPU_PHYSICAL_LOCATION ApLocation,
IN CPU_STATUS_INFORMATION CpuStatus,
IN PROGRAM_CPU_REGISTER_FLAGS CpuFlags 
)

Initialize the CPU registers from a register table.

Parameters
[in]RegisterTableThe register table for this AP.
[in]ApLocationAP location info for this ap.
[in]CpuStatusCPU status info for this CPU.
[in]CpuFlagsFlags data structure used when program the register.
Note
This service could be called by BSP/APs.

Definition at line 1008 of file CpuFeaturesInitialize.c.

◆ ReadWriteCr()

UINTN ReadWriteCr ( IN UINT32  CrIndex,
IN BOOLEAN  Read,
IN OUT UINTN CrValue 
)

Read / write CR value.

Parameters
[in]CrIndexThe CR index which need to read/write.
[in]ReadRead or write. TRUE is read.
[in,out]CrValueCR value.
Return values
EFI_SUCCESSmeans read/write success, else return EFI_UNSUPPORTED.

Definition at line 951 of file CpuFeaturesInitialize.c.

◆ SetCapabilityPcd()

VOID SetCapabilityPcd ( IN UINT8 *  SupportedFeatureMask,
IN UINTN  BitMaskSize 
)

Worker function to save PcdCpuFeaturesCapability.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]BitMaskSizeCPU feature bits mask buffer size.

Definition at line 21 of file CpuFeaturesInitialize.c.

◆ SetProcessorRegister()

VOID EFIAPI SetProcessorRegister ( IN OUT VOID *  Buffer)

Programs registers for the calling processor.

Parameters
[in,out]BufferThe pointer to private data buffer.

Definition at line 1256 of file CpuFeaturesInitialize.c.

◆ SetSettingPcd()

VOID SetSettingPcd ( IN UINT8 *  SupportedFeatureMask,
IN UINTN  BitMaskSize 
)

Worker function to save PcdCpuFeaturesSetting.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]BitMaskSizeCPU feature bits mask buffer size.

Definition at line 39 of file CpuFeaturesInitialize.c.

◆ SupportedMaskAnd()

VOID SupportedMaskAnd ( IN UINT8 *  SupportedFeatureMask,
IN CONST UINT8 *  AndFeatureBitMask,
IN UINT32  BitMaskSize 
)

Worker function to do AND operation on CPU feature supported bits mask buffer.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]AndFeatureBitMaskThe feature bit mask to do AND operation
[in]BitMaskSizeCPU feature bits mask buffer size.

Definition at line 460 of file CpuFeaturesInitialize.c.

◆ SupportedMaskCleanBit()

VOID SupportedMaskCleanBit ( IN UINT8 *  SupportedFeatureMask,
IN UINT8 *  AndFeatureBitMask,
IN UINT32  BitMaskSize 
)

Worker function to clean bit operation on CPU feature supported bits mask buffer.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]AndFeatureBitMaskThe feature bit mask to do XOR operation
[in]BitMaskSizeCPU feature bits mask buffer size.

Definition at line 485 of file CpuFeaturesInitialize.c.

◆ SupportedMaskOr()

VOID SupportedMaskOr ( IN UINT8 *  SupportedFeatureMask,
IN UINT8 *  OrFeatureBitMask,
IN UINT32  BitMaskSize 
)

Worker function to do OR operation on CPU feature supported bits mask buffer.

Parameters
[in]SupportedFeatureMaskThe pointer to CPU feature bits mask buffer
[in]OrFeatureBitMaskThe feature bit mask to do OR operation
[in]BitMaskSizeThe CPU feature bits mask buffer size.

Definition at line 434 of file CpuFeaturesInitialize.c.

Variable Documentation

◆ mDependTypeStr

CHAR16* mDependTypeStr[] = { L"None", L"Thread", L"Core", L"Package", L"Invalid" }

Definition at line 11 of file CpuFeaturesInitialize.c.