2 CPU Register Table Library definitions.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _REGISTER_CPU_FEATURES_H_
16 #define _REGISTER_CPU_FEATURES_H_
18 #include <Library/BaseLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/PcdLib.h>
21 #include <Library/RegisterCpuFeaturesLib.h>
22 #include <Library/BaseMemoryLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/SynchronizationLib.h>
25 #include <Library/IoLib.h>
26 #include <Library/LocalApicLib.h>
28 #include <AcpiCpuData.h>
30 #define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S')
32 #define CPU_FEATURE_NAME_SIZE 128
35 REGISTER_CPU_FEATURE_INFORMATION CpuInfo
;
36 UINT8
*FeaturesSupportedMask
;
38 } CPU_FEATURES_INIT_ORDER
;
45 CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc
;
46 CPU_FEATURE_SUPPORT SupportFunc
;
47 CPU_FEATURE_INITIALIZE InitializeFunc
;
48 UINT8
*BeforeFeatureBitMask
;
49 UINT8
*AfterFeatureBitMask
;
50 UINT8
*CoreBeforeFeatureBitMask
;
51 UINT8
*CoreAfterFeatureBitMask
;
52 UINT8
*PackageBeforeFeatureBitMask
;
53 UINT8
*PackageAfterFeatureBitMask
;
60 // Flags used when program the register.
63 volatile UINTN ConsoleLogLock
; // Spinlock used to control console.
64 volatile UINTN MemoryMappedLock
; // Spinlock used to program mmio
65 volatile UINT32
*SemaphoreCount
; // Semaphore used to program semaphore.
66 } PROGRAM_CPU_REGISTER_FLAGS
;
71 LIST_ENTRY FeatureList
;
73 CPU_FEATURES_INIT_ORDER
*InitOrder
;
76 UINT8
*ConfigurationPcd
;
80 ACPI_CPU_DATA
*AcpiCpuData
;
82 CPU_REGISTER_TABLE
*RegisterTable
;
83 CPU_REGISTER_TABLE
*PreSmmRegisterTable
;
86 PROGRAM_CPU_REGISTER_FLAGS CpuFlags
;
89 #define CPU_FEATURE_ENTRY_FROM_LINK(a) \
94 CPU_FEATURE_ENTRY_SIGNATURE \
98 Worker function to get CPU_FEATURES_DATA pointer.
100 @return Pointer to CPU_FEATURES_DATA.
108 Worker function to return processor index.
110 @return The processor index.
118 Gets detailed MP-related information on the requested processor at the
119 instant this call is made.
121 @param[in] ProcessorNumber The handle number of processor.
122 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
123 the requested processor is deposited.
125 @return Status of MpServices->GetProcessorInfo().
128 GetProcessorInformation (
129 IN UINTN ProcessorNumber
,
130 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
134 Worker function to execute a caller provided function on all enabled APs.
136 @param[in] Procedure A pointer to the function to be run on
137 enabled APs of the system.
138 @param[in] MpEvent A pointer to the event to be used later
139 to check whether procedure has done.
143 IN EFI_AP_PROCEDURE Procedure
,
148 Worker function to retrieve the number of logical processor in the platform.
150 @param[out] NumberOfCpus Pointer to the total number of logical
151 processors in the system, including the BSP
153 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
154 processors that exist in system, including
158 GetNumberOfProcessor (
159 OUT UINTN
*NumberOfCpus
,
160 OUT UINTN
*NumberOfEnabledProcessors
164 Worker function to switch the requested AP to be the BSP from that point onward.
166 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
170 IN UINTN ProcessorNumber
174 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
176 @param[in] FeatureMask A pointer to the CPU feature bit mask.
180 IN UINT8
*FeatureMask
184 Dump CPU feature name or CPU feature bit mask.
186 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY
190 IN CPU_FEATURES_ENTRY
*CpuFeature
194 Return feature dependence result.
196 @param[in] CpuFeature Pointer to CPU feature.
197 @param[in] Before Check before dependence or after.
198 @param[in] NextCpuFeatureMask Pointer to next CPU feature Mask.
200 @retval return the dependence result.
202 CPU_FEATURE_DEPENDENCE_TYPE
204 IN CPU_FEATURES_ENTRY
*CpuFeature
,
206 IN UINT8
*NextCpuFeatureMask
210 Return feature dependence result.
212 @param[in] CpuFeature Pointer to CPU feature.
213 @param[in] Before Check before dependence or after.
214 @param[in] FeatureList Pointer to CPU feature list.
216 @retval return the dependence result.
218 CPU_FEATURE_DEPENDENCE_TYPE
219 DetectNoneNeighborhoodFeatureScope (
220 IN CPU_FEATURES_ENTRY
*CpuFeature
,
222 IN LIST_ENTRY
*FeatureList
226 Programs registers for the calling processor.
228 @param[in,out] Buffer The pointer to private data buffer.
233 SetProcessorRegister (
238 Return ACPI_CPU_DATA data.
240 @return Pointer to ACPI_CPU_DATA data.