2 CPU Register Table Library definitions.
4 Copyright (c) 2017 - 2019, 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_
19 #include <Ppi/MpServices.h>
20 #include <Protocol/MpService.h>
22 #include <Library/BaseLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/PcdLib.h>
25 #include <Library/RegisterCpuFeaturesLib.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/SynchronizationLib.h>
29 #include <Library/IoLib.h>
30 #include <Library/LocalApicLib.h>
32 #include <AcpiCpuData.h>
34 #define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S')
36 #define CPU_FEATURE_NAME_SIZE 128
39 REGISTER_CPU_FEATURE_INFORMATION CpuInfo
;
40 UINT8
*FeaturesSupportedMask
;
42 } CPU_FEATURES_INIT_ORDER
;
49 CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc
;
50 CPU_FEATURE_SUPPORT SupportFunc
;
51 CPU_FEATURE_INITIALIZE InitializeFunc
;
52 UINT8
*BeforeFeatureBitMask
;
53 UINT8
*AfterFeatureBitMask
;
54 UINT8
*CoreBeforeFeatureBitMask
;
55 UINT8
*CoreAfterFeatureBitMask
;
56 UINT8
*PackageBeforeFeatureBitMask
;
57 UINT8
*PackageAfterFeatureBitMask
;
64 // Flags used when program the register.
67 volatile UINTN ConsoleLogLock
; // Spinlock used to control console.
68 volatile UINTN MemoryMappedLock
; // Spinlock used to program mmio
69 volatile UINT32
*CoreSemaphoreCount
; // Semaphore containers used to program Core semaphore.
70 volatile UINT32
*PackageSemaphoreCount
; // Semaphore containers used to program Package semaphore.
71 } PROGRAM_CPU_REGISTER_FLAGS
;
74 EFI_MP_SERVICES_PROTOCOL
*Protocol
;
75 EFI_PEI_MP_SERVICES_PPI
*Ppi
;
81 LIST_ENTRY FeatureList
;
83 CPU_FEATURES_INIT_ORDER
*InitOrder
;
88 ACPI_CPU_DATA
*AcpiCpuData
;
90 CPU_REGISTER_TABLE
*RegisterTable
;
91 CPU_REGISTER_TABLE
*PreSmmRegisterTable
;
94 PROGRAM_CPU_REGISTER_FLAGS CpuFlags
;
96 MP_SERVICES MpService
;
99 #define CPU_FEATURE_ENTRY_FROM_LINK(a) \
102 CPU_FEATURES_ENTRY, \
104 CPU_FEATURE_ENTRY_SIGNATURE \
108 Worker function to get CPU_FEATURES_DATA pointer.
110 @return Pointer to CPU_FEATURES_DATA.
118 Worker function to return processor index.
120 @param CpuFeaturesData Cpu Feature Data structure.
122 @return The processor index.
126 IN CPU_FEATURES_DATA
*CpuFeaturesData
130 Gets detailed MP-related information on the requested processor at the
131 instant this call is made.
133 @param[in] ProcessorNumber The handle number of processor.
134 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
135 the requested processor is deposited.
137 @return Status of MpServices->GetProcessorInfo().
140 GetProcessorInformation (
141 IN UINTN ProcessorNumber
,
142 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
146 Worker function to execute a caller provided function on all enabled APs.
148 @param[in] Procedure A pointer to the function to be run on
149 enabled APs of the system.
150 @param[in] MpEvent A pointer to the event to be used later
151 to check whether procedure has done.
155 IN EFI_AP_PROCEDURE Procedure
,
160 Worker function to retrieve the number of logical processor in the platform.
162 @param[out] NumberOfCpus Pointer to the total number of logical
163 processors in the system, including the BSP
165 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
166 processors that exist in system, including
170 GetNumberOfProcessor (
171 OUT UINTN
*NumberOfCpus
,
172 OUT UINTN
*NumberOfEnabledProcessors
176 Worker function to switch the requested AP to be the BSP from that point onward.
178 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
182 IN UINTN ProcessorNumber
186 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.
188 @param[in] FeatureMask A pointer to the CPU feature bit mask.
192 IN UINT8
*FeatureMask
196 Dump CPU feature name or CPU feature bit mask.
198 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY
202 IN CPU_FEATURES_ENTRY
*CpuFeature
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.