2 CPU Register Table Library definitions.
4 Copyright (c) 2017 - 2019, 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
*BeforeFeatureBitMask
;
47 UINT8
*AfterFeatureBitMask
;
48 UINT8
*CoreBeforeFeatureBitMask
;
49 UINT8
*CoreAfterFeatureBitMask
;
50 UINT8
*PackageBeforeFeatureBitMask
;
51 UINT8
*PackageAfterFeatureBitMask
;
58 // Flags used when program the register.
61 volatile UINTN ConsoleLogLock
; // Spinlock used to control console.
62 volatile UINTN MemoryMappedLock
; // Spinlock used to program mmio
63 volatile UINT32
*CoreSemaphoreCount
; // Semaphore containers used to program Core semaphore.
64 volatile UINT32
*PackageSemaphoreCount
; // Semaphore containers used to program Package semaphore.
65 } PROGRAM_CPU_REGISTER_FLAGS
;
68 EFI_MP_SERVICES_PROTOCOL
*Protocol
;
69 EFI_PEI_MP_SERVICES_PPI
*Ppi
;
75 LIST_ENTRY FeatureList
;
77 CPU_FEATURES_INIT_ORDER
*InitOrder
;
82 ACPI_CPU_DATA
*AcpiCpuData
;
84 CPU_REGISTER_TABLE
*RegisterTable
;
85 CPU_REGISTER_TABLE
*PreSmmRegisterTable
;
88 PROGRAM_CPU_REGISTER_FLAGS CpuFlags
;
90 MP_SERVICES MpService
;
93 #define CPU_FEATURE_ENTRY_FROM_LINK(a) \
98 CPU_FEATURE_ENTRY_SIGNATURE \
102 Worker function to get CPU_FEATURES_DATA pointer.
104 @return Pointer to CPU_FEATURES_DATA.
112 Worker function to return processor index.
114 @param CpuFeaturesData Cpu Feature Data structure.
116 @return The processor index.
120 IN CPU_FEATURES_DATA
*CpuFeaturesData
124 Gets detailed MP-related information on the requested processor at the
125 instant this call is made.
127 @param[in] ProcessorNumber The handle number of processor.
128 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
129 the requested processor is deposited.
131 @return Status of MpServices->GetProcessorInfo().
134 GetProcessorInformation (
135 IN UINTN ProcessorNumber
,
136 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
140 Worker function to execute a caller provided function on all enabled APs.
142 @param[in] Procedure A pointer to the function to be run on
143 enabled APs of the system.
144 @param[in] MpEvent A pointer to the event to be used later
145 to check whether procedure has done.
148 StartupAllAPsWorker (
149 IN EFI_AP_PROCEDURE Procedure
,
154 Worker function to retrieve the number of logical processor in the platform.
156 @param[out] NumberOfCpus Pointer to the total number of logical
157 processors in the system, including the BSP
159 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
160 processors that exist in system, including
164 GetNumberOfProcessor (
165 OUT UINTN
*NumberOfCpus
,
166 OUT UINTN
*NumberOfEnabledProcessors
170 Worker function to switch the requested AP to be the BSP from that point onward.
172 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
176 IN UINTN ProcessorNumber
180 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
182 @param[in] FeatureMask A pointer to the CPU feature bit mask.
183 @param[in] BitMaskSize CPU feature bits mask buffer size.
188 IN UINT8
*FeatureMask
,
189 IN UINT32 BitMaskSize
193 Dump CPU feature name or CPU feature bit mask.
195 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY
196 @param[in] BitMaskSize CPU feature bits mask buffer size.
201 IN CPU_FEATURES_ENTRY
*CpuFeature
,
202 IN UINT32 BitMaskSize
206 Return feature dependence result.
208 @param[in] CpuFeature Pointer to CPU feature.
209 @param[in] Before Check before dependence or after.
210 @param[in] NextCpuFeatureMask Pointer to next CPU feature Mask.
212 @retval return the dependence result.
214 CPU_FEATURE_DEPENDENCE_TYPE
216 IN CPU_FEATURES_ENTRY
*CpuFeature
,
218 IN UINT8
*NextCpuFeatureMask
222 Return feature dependence result.
224 @param[in] CpuFeature Pointer to CPU feature.
225 @param[in] Before Check before dependence or after.
226 @param[in] FeatureList Pointer to CPU feature list.
228 @retval return the dependence result.
230 CPU_FEATURE_DEPENDENCE_TYPE
231 DetectNoneNeighborhoodFeatureScope (
232 IN CPU_FEATURES_ENTRY
*CpuFeature
,
234 IN LIST_ENTRY
*FeatureList
238 Programs registers for the calling processor.
240 @param[in,out] Buffer The pointer to private data buffer.
245 SetProcessorRegister (
250 Return ACPI_CPU_DATA data.
252 @return Pointer to ACPI_CPU_DATA data.
260 Worker function to get MP service pointer.
262 @return MP_SERVICES variable.