]>
Commit | Line | Data |
---|---|---|
eff78ac3 JF |
1 | /** @file |
2 | CPU Register Table Library definitions. | |
3 | ||
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 | |
9 | ||
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. | |
12 | ||
13 | **/ | |
14 | ||
15 | #ifndef _REGISTER_CPU_FEATURES_H_ | |
16 | #define _REGISTER_CPU_FEATURES_H_ | |
17 | ||
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 | ||
27 | #include <AcpiCpuData.h> | |
28 | ||
29 | #define CPU_FEATURE_ENTRY_SIGNATURE SIGNATURE_32 ('C', 'F', 'E', 'S') | |
30 | ||
31 | #define CPU_FEATURE_NAME_SIZE 128 | |
32 | ||
33 | typedef struct { | |
34 | REGISTER_CPU_FEATURE_INFORMATION CpuInfo; | |
35 | UINT8 *FeaturesSupportedMask; | |
36 | LIST_ENTRY OrderList; | |
37 | } CPU_FEATURES_INIT_ORDER; | |
38 | ||
39 | typedef struct { | |
40 | UINT32 Signature; | |
41 | LIST_ENTRY Link; | |
42 | UINT8 *FeatureMask; | |
43 | CHAR8 *FeatureName; | |
44 | CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc; | |
45 | CPU_FEATURE_SUPPORT SupportFunc; | |
46 | CPU_FEATURE_INITIALIZE InitializeFunc; | |
47 | UINT8 *BeforeFeatureBitMask; | |
48 | UINT8 *AfterFeatureBitMask; | |
49 | VOID *ConfigData; | |
50 | BOOLEAN BeforeAll; | |
51 | BOOLEAN AfterAll; | |
52 | } CPU_FEATURES_ENTRY; | |
53 | ||
54 | typedef struct { | |
55 | UINTN FeaturesCount; | |
56 | UINT32 BitMaskSize; | |
57 | SPIN_LOCK MsrLock; | |
58 | SPIN_LOCK MemoryMappedLock; | |
59 | LIST_ENTRY FeatureList; | |
60 | ||
61 | CPU_FEATURES_INIT_ORDER *InitOrder; | |
62 | UINT8 *SupportPcds; | |
63 | UINT8 *CapabilityPcds; | |
64 | UINT8 *ConfigurationPcds; | |
65 | UINT8 *SettingPcds; | |
66 | ||
67 | CPU_REGISTER_TABLE *RegisterTable; | |
68 | CPU_REGISTER_TABLE *PreSmmRegisterTable; | |
69 | UINTN BspNumber; | |
70 | } CPU_FEATURES_DATA; | |
71 | ||
72 | #define CPU_FEATURE_ENTRY_FROM_LINK(a) \ | |
73 | CR ( \ | |
74 | (a), \ | |
75 | CPU_FEATURES_ENTRY, \ | |
76 | Link, \ | |
77 | CPU_FEATURE_ENTRY_SIGNATURE \ | |
78 | ) | |
79 | ||
80 | /** | |
81 | Worker function to get CPU_FEATURES_DATA pointer. | |
82 | ||
83 | @return Pointer to CPU_FEATURES_DATA. | |
84 | **/ | |
85 | CPU_FEATURES_DATA * | |
86 | GetCpuFeaturesData ( | |
87 | VOID | |
88 | ); | |
89 | ||
90 | /** | |
91 | Enlarges CPU register table for each processor. | |
92 | ||
93 | @param[in, out] RegisterTable Pointer processor's CPU register table | |
94 | **/ | |
95 | VOID | |
96 | EnlargeRegisterTable ( | |
97 | IN OUT CPU_REGISTER_TABLE *RegisterTable | |
98 | ); | |
99 | ||
100 | /** | |
101 | Allocates ACPI NVS memory to save ACPI_CPU_DATA. | |
102 | ||
103 | @return Pointer to allocated ACPI_CPU_DATA. | |
104 | **/ | |
105 | ACPI_CPU_DATA * | |
106 | AllocateAcpiCpuData ( | |
107 | VOID | |
108 | ); | |
109 | ||
110 | /** | |
111 | Worker function to return processor index. | |
112 | ||
113 | @return The processor index. | |
114 | **/ | |
115 | UINTN | |
116 | GetProcessorIndex ( | |
117 | VOID | |
118 | ); | |
119 | ||
120 | /** | |
121 | Gets detailed MP-related information on the requested processor at the | |
122 | instant this call is made. | |
123 | ||
124 | @param[in] ProcessorNumber The handle number of processor. | |
125 | @param[out] ProcessorInfoBuffer A pointer to the buffer where information for | |
126 | the requested processor is deposited. | |
127 | ||
128 | @return Status of MpServices->GetProcessorInfo(). | |
129 | **/ | |
130 | EFI_STATUS | |
131 | GetProcessorInformation ( | |
132 | IN UINTN ProcessorNumber, | |
133 | OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer | |
134 | ); | |
135 | ||
136 | /** | |
137 | Worker function to execute a caller provided function on all enabled APs. | |
138 | ||
139 | @param[in] Procedure A pointer to the function to be run on | |
140 | enabled APs of the system. | |
141 | **/ | |
142 | VOID | |
143 | StartupAPsWorker ( | |
144 | IN EFI_AP_PROCEDURE Procedure | |
145 | ); | |
146 | ||
147 | /** | |
148 | Worker function to retrieve the number of logical processor in the platform. | |
149 | ||
8d5df9d7 | 150 | @param[out] NumberOfCpus Pointer to the total number of logical |
eff78ac3 JF |
151 | processors in the system, including the BSP |
152 | and disabled APs. | |
153 | @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical | |
154 | processors that exist in system, including | |
155 | the BSP. | |
156 | **/ | |
157 | VOID | |
158 | GetNumberOfProcessor ( | |
159 | OUT UINTN *NumberOfCpus, | |
160 | OUT UINTN *NumberOfEnabledProcessors | |
161 | ); | |
162 | ||
163 | /** | |
164 | Worker function to switch the requested AP to be the BSP from that point onward. | |
165 | ||
166 | @param[in] ProcessorNumber The handle number of AP that is to become the new BSP. | |
167 | **/ | |
168 | VOID | |
169 | SwitchNewBsp ( | |
170 | IN UINTN ProcessorNumber | |
171 | ); | |
172 | ||
173 | /** | |
174 | Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask. | |
175 | ||
176 | @param[in] FeatureMask A pointer to the CPU feature bit mask. | |
177 | **/ | |
178 | VOID | |
179 | DumpCpuFeatureMask ( | |
180 | IN UINT8 *FeatureMask | |
181 | ); | |
182 | ||
183 | /** | |
184 | Dump CPU feature name or CPU feature bit mask. | |
185 | ||
186 | @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY | |
187 | **/ | |
188 | VOID | |
189 | DumpCpuFeature ( | |
190 | IN CPU_FEATURES_ENTRY *CpuFeature | |
191 | ); | |
192 | ||
193 | #endif |