2 CPU Register Table Library definitions.
4 Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _REGISTER_CPU_FEATURES_H_
10 #define _REGISTER_CPU_FEATURES_H_
13 #include <Ppi/MpServices.h>
14 #include <Protocol/MpService.h>
16 #include <Library/BaseLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
19 #include <Library/RegisterCpuFeaturesLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/MemoryAllocationLib.h>
22 #include <Library/SynchronizationLib.h>
23 #include <Library/IoLib.h>
24 #include <Library/LocalApicLib.h>
26 #include <AcpiCpuData.h>
28 #define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S')
30 #define CPU_FEATURE_NAME_SIZE 128
33 REGISTER_CPU_FEATURE_INFORMATION CpuInfo
;
34 UINT8
*FeaturesSupportedMask
;
36 } CPU_FEATURES_INIT_ORDER
;
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
;
58 // Flags used when program the register.
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.
64 } PROGRAM_CPU_REGISTER_FLAGS
;
67 EFI_MP_SERVICES_PROTOCOL
*Protocol
;
68 EFI_PEI_MP_SERVICES_PPI
*Ppi
;
74 LIST_ENTRY FeatureList
;
76 CPU_FEATURES_INIT_ORDER
*InitOrder
;
81 ACPI_CPU_DATA
*AcpiCpuData
;
83 CPU_REGISTER_TABLE
*RegisterTable
;
84 CPU_REGISTER_TABLE
*PreSmmRegisterTable
;
87 PROGRAM_CPU_REGISTER_FLAGS CpuFlags
;
89 MP_SERVICES MpService
;
92 #define CPU_FEATURE_ENTRY_FROM_LINK(a) \
97 CPU_FEATURE_ENTRY_SIGNATURE \
101 Worker function to get CPU_FEATURES_DATA pointer.
103 @return Pointer to CPU_FEATURES_DATA.
111 Worker function to return processor index.
113 @param CpuFeaturesData Cpu Feature Data structure.
115 @return The processor index.
119 IN CPU_FEATURES_DATA
*CpuFeaturesData
123 Gets detailed MP-related information on the requested processor at the
124 instant this call is made.
126 @param[in] ProcessorNumber The handle number of processor.
127 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
128 the requested processor is deposited.
130 @return Status of MpServices->GetProcessorInfo().
133 GetProcessorInformation (
134 IN UINTN ProcessorNumber
,
135 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
139 Worker function to execute a caller provided function on all enabled APs.
141 @param[in] Procedure A pointer to the function to be run on
142 enabled APs of the system.
143 @param[in] MpEvent A pointer to the event to be used later
144 to check whether procedure has done.
147 StartupAllAPsWorker (
148 IN EFI_AP_PROCEDURE Procedure
,
153 Worker function to retrieve the number of logical processor in the platform.
155 @param[out] NumberOfCpus Pointer to the total number of logical
156 processors in the system, including the BSP
158 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
159 processors that exist in system, including
163 GetNumberOfProcessor (
164 OUT UINTN
*NumberOfCpus
,
165 OUT UINTN
*NumberOfEnabledProcessors
169 Worker function to switch the requested AP to be the BSP from that point onward.
171 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
175 IN UINTN ProcessorNumber
179 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
181 @param[in] FeatureMask A pointer to the CPU feature bit mask.
182 @param[in] BitMaskSize CPU feature bits mask buffer size.
187 IN UINT8
*FeatureMask
,
188 IN UINT32 BitMaskSize
192 Dump CPU feature name or CPU feature bit mask.
194 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY
195 @param[in] BitMaskSize CPU feature bits mask buffer size.
200 IN CPU_FEATURES_ENTRY
*CpuFeature
,
201 IN UINT32 BitMaskSize
205 Return feature dependence result.
207 @param[in] CpuFeature Pointer to CPU feature.
208 @param[in] Before Check before dependence or after.
209 @param[in] NextCpuFeatureMask Pointer to next CPU feature Mask.
211 @retval return the dependence result.
213 CPU_FEATURE_DEPENDENCE_TYPE
215 IN CPU_FEATURES_ENTRY
*CpuFeature
,
217 IN UINT8
*NextCpuFeatureMask
221 Return feature dependence result.
223 @param[in] CpuFeature Pointer to CPU feature.
224 @param[in] Before Check before dependence or after.
225 @param[in] FeatureList Pointer to CPU feature list.
227 @retval return the dependence result.
229 CPU_FEATURE_DEPENDENCE_TYPE
230 DetectNoneNeighborhoodFeatureScope (
231 IN CPU_FEATURES_ENTRY
*CpuFeature
,
233 IN LIST_ENTRY
*FeatureList
237 Programs registers for the calling processor.
239 @param[in,out] Buffer The pointer to private data buffer.
244 SetProcessorRegister (
249 Return ACPI_CPU_DATA data.
251 @return Pointer to ACPI_CPU_DATA data.
259 Worker function to get MP service pointer.
261 @return MP_SERVICES variable.