TianoCore EDK2 master
Loading...
Searching...
No Matches
RegisterCpuFeatures.h
Go to the documentation of this file.
1
9#ifndef _REGISTER_CPU_FEATURES_H_
10#define _REGISTER_CPU_FEATURES_H_
11#include <PiPei.h>
12#include <PiDxe.h>
13#include <Ppi/MpServices2.h>
14#include <Protocol/MpService.h>
15
16#include <Library/BaseLib.h>
17#include <Library/DebugLib.h>
18#include <Library/PcdLib.h>
23#include <Library/IoLib.h>
25
26#include <AcpiCpuData.h>
27
28#define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S')
29
30#define CPU_FEATURE_NAME_SIZE 128
31
32typedef struct {
34 UINT8 *FeaturesSupportedMask;
35 LIST_ENTRY OrderList;
37
38typedef struct {
39 UINT32 Signature;
40 LIST_ENTRY Link;
41 UINT8 *FeatureMask;
42 CHAR8 *FeatureName;
43 CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc;
44 CPU_FEATURE_SUPPORT SupportFunc;
45 CPU_FEATURE_INITIALIZE InitializeFunc;
46 UINT8 *ThreadBeforeFeatureBitMask;
47 UINT8 *ThreadAfterFeatureBitMask;
48 UINT8 *CoreBeforeFeatureBitMask;
49 UINT8 *CoreAfterFeatureBitMask;
50 UINT8 *PackageBeforeFeatureBitMask;
51 UINT8 *PackageAfterFeatureBitMask;
52 VOID *ConfigData;
53 BOOLEAN BeforeAll;
54 BOOLEAN AfterAll;
56
57//
58// Flags used when program the register.
59//
60typedef struct {
61 volatile UINTN MemoryMappedLock; // Spinlock used to program mmio
62 volatile UINT32 *CoreSemaphoreCount; // Semaphore containers used to program Core semaphore.
63 volatile UINT32 *PackageSemaphoreCount; // Semaphore containers used to program Package semaphore.
65
66typedef union {
70
71typedef struct {
72 UINTN FeaturesCount;
73 UINT32 BitMaskSize;
74 LIST_ENTRY FeatureList;
75
76 CPU_FEATURES_INIT_ORDER *InitOrder;
77 UINT8 *CapabilityPcd;
78 UINT8 *SettingPcd;
79
80 UINT32 NumberOfCpus;
81 ACPI_CPU_DATA *AcpiCpuData;
82
83 CPU_REGISTER_TABLE *RegisterTable;
84 CPU_REGISTER_TABLE *PreSmmRegisterTable;
85 UINTN BspNumber;
86
88
89 MP_SERVICES MpService;
91
92#define CPU_FEATURE_ENTRY_FROM_LINK(a) \
93 CR ( \
94 (a), \
95 CPU_FEATURES_ENTRY, \
96 Link, \
97 CPU_FEATURE_ENTRY_SIGNATURE \
98 )
99
107 VOID
108 );
109
117UINTN
119 IN CPU_FEATURES_DATA *CpuFeaturesData
120 );
121
134 IN UINTN ProcessorNumber,
135 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
136 );
137
146VOID
148 IN EFI_AP_PROCEDURE Procedure,
149 IN EFI_EVENT MpEvent
150 );
151
162VOID
164 OUT UINTN *NumberOfCpus,
165 OUT UINTN *NumberOfEnabledProcessors
166 );
167
173VOID
175 IN UINTN ProcessorNumber
176 );
177
185VOID
187 IN UINT8 *FeatureMask,
188 IN UINT32 BitMaskSize
189 );
190
198VOID
200 IN CPU_FEATURES_ENTRY *CpuFeature,
201 IN UINT32 BitMaskSize
202 );
203
213CPU_FEATURE_DEPENDENCE_TYPE
215 IN CPU_FEATURES_ENTRY *CpuFeature,
216 IN BOOLEAN Before,
217 IN UINT8 *NextCpuFeatureMask
218 );
219
229CPU_FEATURE_DEPENDENCE_TYPE
231 IN CPU_FEATURES_ENTRY *CpuFeature,
232 IN BOOLEAN Before,
233 IN LIST_ENTRY *FeatureList
234 );
235
242VOID
243EFIAPI
245 IN OUT VOID *Buffer
246 );
247
255 VOID
256 );
257
265 VOID
266 );
267
268#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
UINTN GetProcessorIndex(IN CPU_FEATURES_DATA *CpuFeaturesData)
VOID DumpCpuFeature(IN CPU_FEATURES_ENTRY *CpuFeature, IN UINT32 BitMaskSize)
VOID DumpCpuFeatureMask(IN UINT8 *FeatureMask, IN UINT32 BitMaskSize)
CPU_FEATURES_DATA * GetCpuFeaturesData(VOID)
CPU_FEATURE_DEPENDENCE_TYPE DetectNoneNeighborhoodFeatureScope(IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN LIST_ENTRY *FeatureList)
VOID SwitchNewBsp(IN UINTN ProcessorNumber)
VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors)
ACPI_CPU_DATA * GetAcpiCpuData(VOID)
VOID EFIAPI SetProcessorRegister(IN OUT VOID *Buffer)
CPU_FEATURE_DEPENDENCE_TYPE DetectFeatureScope(IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN UINT8 *NextCpuFeatureMask)
EFI_STATUS GetProcessorInformation(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
MP_SERVICES GetMpService(VOID)
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 * CPU_FEATURE_GET_CONFIG_DATA)(IN UINTN NumberOfProcessors)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37