]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
UefiCpuPkg/CpuFeatures: Change files format to DOS
[mirror_edk2.git] / UefiCpuPkg / Library / RegisterCpuFeaturesLib / RegisterCpuFeatures.h
CommitLineData
80c4b236
JF
1/** @file\r
2 CPU Register Table Library definitions.\r
3\r
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _REGISTER_CPU_FEATURES_H_\r
16#define _REGISTER_CPU_FEATURES_H_\r
17\r
18#include <Library/BaseLib.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/PcdLib.h>\r
21#include <Library/RegisterCpuFeaturesLib.h>\r
22#include <Library/BaseMemoryLib.h>\r
23#include <Library/MemoryAllocationLib.h>\r
24#include <Library/SynchronizationLib.h>\r
25#include <Library/IoLib.h>\r
26\r
27#include <AcpiCpuData.h>\r
28\r
29#define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S')\r
30\r
31#define CPU_FEATURE_NAME_SIZE 128\r
32\r
33typedef struct {\r
34 REGISTER_CPU_FEATURE_INFORMATION CpuInfo;\r
35 UINT8 *FeaturesSupportedMask;\r
36 LIST_ENTRY OrderList;\r
37} CPU_FEATURES_INIT_ORDER;\r
38\r
39typedef struct {\r
40 UINT32 Signature;\r
41 LIST_ENTRY Link;\r
42 UINT8 *FeatureMask;\r
43 CHAR8 *FeatureName;\r
44 CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc;\r
45 CPU_FEATURE_SUPPORT SupportFunc;\r
46 CPU_FEATURE_INITIALIZE InitializeFunc;\r
47 UINT8 *BeforeFeatureBitMask;\r
48 UINT8 *AfterFeatureBitMask;\r
49 VOID *ConfigData;\r
50 BOOLEAN BeforeAll;\r
51 BOOLEAN AfterAll;\r
52} CPU_FEATURES_ENTRY;\r
53\r
54typedef struct {\r
55 UINTN FeaturesCount;\r
56 UINT32 BitMaskSize;\r
57 SPIN_LOCK MsrLock;\r
58 SPIN_LOCK MemoryMappedLock;\r
59 LIST_ENTRY FeatureList;\r
60\r
61 CPU_FEATURES_INIT_ORDER *InitOrder;\r
62 UINT8 *SupportPcds;\r
63 UINT8 *CapabilityPcds;\r
64 UINT8 *ConfigurationPcds;\r
65 UINT8 *SettingPcds;\r
66\r
67 CPU_REGISTER_TABLE *RegisterTable;\r
68 CPU_REGISTER_TABLE *PreSmmRegisterTable;\r
69 UINTN BspNumber;\r
70} CPU_FEATURES_DATA;\r
71\r
72#define CPU_FEATURE_ENTRY_FROM_LINK(a) \\r
73 CR ( \\r
74 (a), \\r
75 CPU_FEATURES_ENTRY, \\r
76 Link, \\r
77 CPU_FEATURE_ENTRY_SIGNATURE \\r
78 )\r
79\r
80/**\r
81 Worker function to get CPU_FEATURES_DATA pointer.\r
82\r
83 @return Pointer to CPU_FEATURES_DATA.\r
84**/\r
85CPU_FEATURES_DATA *\r
86GetCpuFeaturesData (\r
87 VOID\r
88 );\r
89\r
90/**\r
91 Enlarges CPU register table for each processor.\r
92\r
93 @param[in, out] RegisterTable Pointer processor's CPU register table\r
94**/\r
95VOID\r
96EnlargeRegisterTable (\r
97 IN OUT CPU_REGISTER_TABLE *RegisterTable\r
98 );\r
99\r
100/**\r
101 Allocates ACPI NVS memory to save ACPI_CPU_DATA.\r
102\r
103 @return Pointer to allocated ACPI_CPU_DATA.\r
104**/\r
105ACPI_CPU_DATA *\r
106AllocateAcpiCpuData (\r
107 VOID\r
108 );\r
109\r
110/**\r
111 Worker function to return processor index.\r
112\r
113 @return The processor index.\r
114**/\r
115UINTN\r
116GetProcessorIndex (\r
117 VOID\r
118 );\r
119\r
120/**\r
121 Gets detailed MP-related information on the requested processor at the\r
122 instant this call is made.\r
123\r
124 @param[in] ProcessorNumber The handle number of processor.\r
125 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
126 the requested processor is deposited.\r
127\r
128 @return Status of MpServices->GetProcessorInfo().\r
129**/\r
130EFI_STATUS\r
131GetProcessorInformation (\r
132 IN UINTN ProcessorNumber,\r
133 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
134 );\r
135\r
136/**\r
137 Worker function to execute a caller provided function on all enabled APs.\r
138\r
139 @param[in] Procedure A pointer to the function to be run on\r
140 enabled APs of the system.\r
141**/\r
142VOID\r
143StartupAPsWorker (\r
144 IN EFI_AP_PROCEDURE Procedure\r
145 );\r
146\r
147/**\r
148 Worker function to retrieve the number of logical processor in the platform.\r
149\r
150 @param[out] NumberOfCpus Pointer to the total number of logical\r
151 processors in the system, including the BSP\r
152 and disabled APs.\r
153 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
154 processors that exist in system, including\r
155 the BSP.\r
156**/\r
157VOID\r
158GetNumberOfProcessor (\r
159 OUT UINTN *NumberOfCpus,\r
160 OUT UINTN *NumberOfEnabledProcessors\r
161 );\r
162\r
163/**\r
164 Worker function to switch the requested AP to be the BSP from that point onward.\r
165\r
166 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.\r
167**/\r
168VOID\r
169SwitchNewBsp (\r
170 IN UINTN ProcessorNumber\r
171 );\r
172\r
173/**\r
174 Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.\r
175\r
176 @param[in] FeatureMask A pointer to the CPU feature bit mask.\r
177**/\r
178VOID\r
179DumpCpuFeatureMask (\r
180 IN UINT8 *FeatureMask\r
181 );\r
182\r
183/**\r
184 Dump CPU feature name or CPU feature bit mask.\r
185\r
186 @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY\r
187**/\r
188VOID\r
189DumpCpuFeature (\r
190 IN CPU_FEATURES_ENTRY *CpuFeature\r
191 );\r
192\r
193#endif\r