]>
Commit | Line | Data |
---|---|---|
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 | |
33 | typedef 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 | |
39 | typedef 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 | |
54 | typedef 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 *SupportPcd;\r | |
63 | UINT8 *CapabilityPcd;\r | |
64 | UINT8 *ConfigurationPcd;\r | |
65 | UINT8 *SettingPcd;\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 | |
85 | CPU_FEATURES_DATA *\r | |
86 | GetCpuFeaturesData (\r | |
87 | VOID\r | |
88 | );\r | |
89 | \r | |
90 | /**\r | |
91 | Worker function to return processor index.\r | |
92 | \r | |
93 | @return The processor index.\r | |
94 | **/\r | |
95 | UINTN\r | |
96 | GetProcessorIndex (\r | |
97 | VOID\r | |
98 | );\r | |
99 | \r | |
100 | /**\r | |
101 | Gets detailed MP-related information on the requested processor at the\r | |
102 | instant this call is made.\r | |
103 | \r | |
104 | @param[in] ProcessorNumber The handle number of processor.\r | |
105 | @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r | |
106 | the requested processor is deposited.\r | |
107 | \r | |
108 | @return Status of MpServices->GetProcessorInfo().\r | |
109 | **/\r | |
110 | EFI_STATUS\r | |
111 | GetProcessorInformation (\r | |
112 | IN UINTN ProcessorNumber,\r | |
113 | OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r | |
114 | );\r | |
115 | \r | |
116 | /**\r | |
117 | Worker function to execute a caller provided function on all enabled APs.\r | |
118 | \r | |
119 | @param[in] Procedure A pointer to the function to be run on\r | |
120 | enabled APs of the system.\r | |
121 | **/\r | |
122 | VOID\r | |
123 | StartupAPsWorker (\r | |
124 | IN EFI_AP_PROCEDURE Procedure\r | |
125 | );\r | |
126 | \r | |
127 | /**\r | |
128 | Worker function to retrieve the number of logical processor in the platform.\r | |
129 | \r | |
130 | @param[out] NumberOfCpus Pointer to the total number of logical\r | |
131 | processors in the system, including the BSP\r | |
132 | and disabled APs.\r | |
133 | @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r | |
134 | processors that exist in system, including\r | |
135 | the BSP.\r | |
136 | **/\r | |
137 | VOID\r | |
138 | GetNumberOfProcessor (\r | |
139 | OUT UINTN *NumberOfCpus,\r | |
140 | OUT UINTN *NumberOfEnabledProcessors\r | |
141 | );\r | |
142 | \r | |
143 | /**\r | |
144 | Worker function to switch the requested AP to be the BSP from that point onward.\r | |
145 | \r | |
146 | @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.\r | |
147 | **/\r | |
148 | VOID\r | |
149 | SwitchNewBsp (\r | |
150 | IN UINTN ProcessorNumber\r | |
151 | );\r | |
152 | \r | |
153 | /**\r | |
154 | Function that uses DEBUG() macros to display the contents of a a CPU feature bit mask.\r | |
155 | \r | |
156 | @param[in] FeatureMask A pointer to the CPU feature bit mask.\r | |
157 | **/\r | |
158 | VOID\r | |
159 | DumpCpuFeatureMask (\r | |
160 | IN UINT8 *FeatureMask\r | |
161 | );\r | |
162 | \r | |
163 | /**\r | |
164 | Dump CPU feature name or CPU feature bit mask.\r | |
165 | \r | |
166 | @param[in] CpuFeature Pointer to CPU_FEATURES_ENTRY\r | |
167 | **/\r | |
168 | VOID\r | |
169 | DumpCpuFeature (\r | |
170 | IN CPU_FEATURES_ENTRY *CpuFeature\r | |
171 | );\r | |
172 | \r | |
173 | #endif\r |