1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
/** @file
Protocol used for specifying platform related CPU information and policy setting.
@copyright
Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.
This file contains an 'Intel Peripheral Driver' and is
licensed for Intel CPUs and chipsets under the terms of your
license agreement with Intel or your vendor. This file may
be modified by the user, subject to additional terms of the
license agreement
**/
#ifndef _CPU_PLATFORM_POLICY_H_
#define _CPU_PLATFORM_POLICY_H_
#include "CpuPmConfig.h"
#include EFI_PROTOCOL_DEFINITION (MpService)
#include EFI_GUID_DEFINITION (DataHubRecords)
#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
#else
#include EFI_PROTOCOL_DEFINITION (Hii)
#endif
EFI_FORWARD_DECLARATION (DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID);
#define DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID \
{ \
0x1279e288, 0x24cd, 0x47e9, 0x96, 0xba, 0xd7, 0xa3, 0x8c, 0x17, 0xbd, 0x64 \
}
///
/// Protocol revision number
/// Any backwards compatible changes to this protocol will result in an update in the revision number
/// Major changes will require publication of a new protocol
///
///
/// Revision 1: Initial version
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_1 1
///
/// Revision 2: Added CPU_CONFIG.DebugInterfaceEnable
/// Added CPU_CONFIG.DebugInterfaceLockEnable
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_2 2
///
/// Revision 3: Added CPU_CONFIG.ApIdleManner
/// Added CPU_CONFIG.ApHandoffManner
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_3 3
///
/// Revision 4: Added POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControl
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_4 4
///
/// Revision 5: Added POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3
/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3Time
/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3DutyCycle
/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3Lock
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_5 5
///
/// Revision 6: Added POWER_MGMT_CONFIG.CustomPowerUnit .Support for user to configuration custom Power Limts in milli watts
/// Default Power Unit for follwing Items changes to MilliWatts
/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS
/// PowerLimit1
/// PowerLimit2
/// PowerLimit3
/// POWER_MGMT_CONFIG.PPM_CUSTOM_CTDP
/// CustomPowerLimit1
/// CustomPowerLimit2
///
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_6 6
///
/// Revision 7: Added POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControlFloor. Changed definition of
/// POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControl from 1 (enable) to 1 (enable/manual)
/// POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControlFloor
///
#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_7 7
extern EFI_GUID gDxeCpuPlatformPolicyProtocolGuid;
//
// Forward reference for ANSI C compatibility
//
typedef struct _DXE_CPU_PLATFORM_POLICY_PROTOCOL DXE_CPU_PLATFORM_POLICY_PROTOCOL;
//
// Prototypes for the Platform CPU Protocol
//
///
/// This function is for platform code to provide Microcode location since different BIOS has different flash layout.
/// Platform code need to provide a function for CPU code to call to get the Microcode location in flash or memory.
///
typedef
EFI_STATUS
(EFIAPI *PLATFORM_CPU_RETRIEVE_MICROCODE)(
IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
OUT UINT8 **MicrocodeData
);
typedef struct {
UINT32 Package;
UINT32 Die;
UINT32 Core;
UINT32 Thread;
} CPU_PHYSICAL_LOCATION;
///
/// The platform category, Server, Desktop and Mobile are defined.
///
typedef enum {
CpuPlatformUnknown= 0,
CpuPlatformDesktop,
CpuPlatformMobile,
CpuPlatformServer,
CpuPlatformMax
} CPU_PLATFORM_CATEGORY;
///
/// The reason for changing the state of the processor Only applies to Disabling processors.
/// In future, we can add add/remove support
///
#define CPU_CAUSE_NOT_DISABLED 0x0000
#define CPU_CAUSE_INTERNAL_ERROR 0x0001
#define CPU_CAUSE_THERMAL_ERROR 0x0002
#define CPU_CAUSE_SELFTEST_FAILURE 0x0004
#define CPU_CAUSE_PREBOOT_TIMEOUT 0x0008
#define CPU_CAUSE_FAILED_TO_START 0x0010
#define CPU_CAUSE_CONFIG_ERROR 0x0020
#define CPU_CAUSE_USER_SELECTION 0x0080
#define CPU_CAUSE_BY_ASSOCIATION 0x0100
#define CPU_CAUSE_UNSPECIFIED 0x8000
typedef UINT32 CPU_STATE_CHANGE_CAUSE;
typedef struct {
EFI_MP_PROC_CONTEXT *Context;
EFI_EXP_BASE10_DATA CoreFreq;
EFI_EXP_BASE10_DATA BusFreq;
EFI_EXP_BASE2_DATA CacheSize[EFI_CACHE_LMAX];
EFI_PROCESSOR_ID_DATA CpuId;
EFI_PROCESSOR_MICROCODE_REVISION_DATA MuData;
EFI_PROCESSOR_STATUS_DATA Status;
} EFI_DETAILED_CPU_INFO;
///
/// Platform Specific Processor Information
///
typedef struct {
UINT64 ApicID; ///< APIC ID
STRING_REF ReferenceString; ///< Reference String
EFI_PROCESSOR_SOCKET_TYPE_DATA SocketType; ///< Socket Type
EFI_PROCESSOR_SOCKET_NAME_DATA SocketName; ///< Socket Name
EFI_PROCESSOR_MAX_CORE_FREQUENCY_DATA MaxCoreFrequency; ///< Maximum Core Frequency
EFI_PROCESSOR_MAX_FSB_FREQUENCY_DATA MaxFsbFrequency; ///< Maximum FSB Frequency
EFI_PROCESSOR_CORE_FREQUENCY_LIST_DATA PlatformCoreFrequencyList; ///< Platform Core Frequency List
EFI_PROCESSOR_FSB_FREQUENCY_LIST_DATA PlatformFsbFrequencyList; ///< Platform FSB Frequency List
STRING_REF AssetTag; ///< Asset Tag
EFI_HII_HANDLE StringHandle; ///< String Handle
STRING_REF SerialNumber; ///< Serial Number
STRING_REF PartNumber; ///< Part Number
} PLATFORM_CPU_INFORMATION;
///
/// This interface is for platform to provide processor support layout, such as how many packages we want
/// processor code to support. If return EFI_UNSUPPORTED, processor code will assume MAXIMUM_CPU_NUMBER and
/// allocate MAX memory for all APs.
///
typedef
EFI_STATUS
(EFIAPI *PLATFORM_CPU_GET_MAX_COUNT)(
IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
OUT UINT32 *MaxThreadsPerCore,
OUT UINT32 *MaxCoresPerDie,
OUT UINT32 *MaxDiesPerPackage,
OUT UINT32 *MaxPackages
);
///
/// Platform code can provide platform specific processor information, such as processor socket Name on board,
/// processor Socket Type, and so on for SMBIOS table creation.
///
typedef
EFI_STATUS
(EFIAPI *PLATFORM_CPU_GET_CPU_INFO)(
IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
IN CPU_PHYSICAL_LOCATION *Location,
IN OUT PLATFORM_CPU_INFORMATION *PlatformCpuInfo
);
//
// Generic definitions for device enabling/disabling used by CPU code
//
#define CPU_FEATURE_ENABLE 1
#define CPU_FEATURE_DISABLE 0
//
// Generic definitions for DTS
//
#define DTS_OUT_OF_SPEC_ONLY 2
#define DTS_OUT_OF_SPEC_OCCURRED 3
///
/// General CPU feature Configuration for all processor features enabling bit definitions are in this field.
/// Platform code can enable/disable features thru this field.
///
typedef struct {
//
// Byte 0, bit definition for functionality enable/disable
//
UINT8 HtState : 1; ///< Enable or Disable Hyper Threading State; 0: Disable; 1: Enable
UINT8 LimitCpuidMaximumValue : 1; ///< Enable or Disable Limit Cpuid Maximum Value; 0: Disable; 1: Enable
UINT8 DcaState : 1; ///< @deprecated Deprecated for Client (Server specific)
UINT8 ExecuteDisableBit : 1; ///< Enable or Disable Execute Disable Bit; 0: Disable; 1: Enable
UINT8 VmxEnable : 1; ///< Enable or Disable VMX; 0: Disable; 1: Enable
UINT8 SmxEnable : 1; ///< Enable or Disable SMX; 0: Disable; 1: Enable
UINT8 FastString : 1; ///< @deprecated
UINT8 MachineCheckEnable : 1; ///< Enable or Disable Machine Check; 0: Disable; 1: Enable
//
// Byte 1, bit definition for functionality enable/disable
//
UINT8 MonitorMwaitEnable : 1; ///< Enable or Disable Monitor Mwait mode; 0: Disable; 1: Enable
UINT8 XapicEnable : 1; ///< Enable or Disable Xapic mode; 0: Disable; 1: Enable
UINT8 MachineCheckStatusClean : 1; ///< @deprecated
UINT8 IsColdReset : 1; ///< Check if is Cold Reset; 0: Not Cold Reset; 1: Cold Reset
UINT8 MlcStreamerPrefetcher : 1; ///< Enable or Disable MlcStreamerPrefetcher; 0: Disable; 1: Enable
UINT8 MlcSpatialPrefetcher : 1; ///< Enable or Disable MlcSpatialPrefetcher; 0: Disable; 1: Enable
UINT8 EnableDts : 2; ///< Enable or Disable DTS feature; 0=Disable; 1=Enable; 2=OUT_OF_SPEC;
//
// Byte 2, byte definition for addiional functionalities expected later
//
UINT8 FviReport : 1; ///< Enable or Disable FVI report; 0: Disable; 1: Enable
UINT8 AesEnable : 1; ///< Enable or Disable AES feature; 0: Disable; 1: Enable
UINT8 DebugInterfaceEnable : 1; ///< Enable or Disable Debug Interface; This policy must be disabled for production BIOS. <b>0: Disable</b>; 1: Enable
UINT8 DebugInterfaceLockEnable : 1; ///< Enable or Disable Debug Interface Lock; This policy must be enabled on production platforms. 0: Disable; <b>1: Enable</b>
UINT8 ApIdleManner : 2; ///< Settings for AP Threads Idle; 1: HALT 2:MWAIT 3:RUN
UINT8 ApHandoffManner : 2; ///< Settings for AP Handoff to OS; 1: HALT 2:MWAIT32
//
// CPU feature configuration
//
UINT8 BspSelection; ///< Select BSP
UINT32 DcaPrefetchDelayValue; ///< @deprecated Deprecated for Client (Server specific)
UINT8 VirtualWireMode; ///< @deprecated
UINT8 SmmbaseSwSmiNumber; ///< SW SMI Number from Smbase.
//
// CPU Misc Config
//
UINT8 FviSmbiosType; ///< Create SMBIOS Table Type for FVI
//
// Functions provided by platform code
//
///
/// Platform code can provide microcode location thru this function.
///
PLATFORM_CPU_RETRIEVE_MICROCODE RetrieveMicrocode;
///
/// Platform to provide the processor detail about Max Thread per Core, Max Cores per Die, Max Dies per
/// Package and Max packages.
///
PLATFORM_CPU_GET_MAX_COUNT GetMaxCount;
///
/// Platform code to provide platform specific processor information
///
PLATFORM_CPU_GET_CPU_INFO GetCpuInfo;
} CPU_CONFIG;
///
/// TxT Platform Configuration
///
typedef struct {
UINT8 ResetAux : 1; ///< Reset Auxiliary content when it is set "TRUE"
UINT8 Reserved : 7; ///< Reserved for future use
UINT8 ByetReserved[1]; ///< Reserved for future use
} TXT_FUNCTION_CONFIG;
///
/// All processor security features enabling definitions are in this field.
/// Platform code can enable/disable features thru this field.
///
typedef struct {
TXT_FUNCTION_CONFIG *TxtFunctionConfig;
} SECURITY_CONFIG;
///
/// The CPU platform policy protocol allows the platform code to publish a set of configuration information that the
/// CPU drivers will use to configure the processor. Platform code needs to provide the information for processor
/// drivers to finish the initialization.
///
typedef struct _DXE_CPU_PLATFORM_POLICY_PROTOCOL {
///
/// This member specifies the revision of the CPU Policy protocol. This field is used to indicate backwards
/// compatible changes to the protocol. Platform code that produces this protocol must fill with the correct revision
/// value for the PCH reference code to correctly interpret the content of the protocol fields.
///
UINT8 Revision;
///
/// Processor standard features configuration.
///
CPU_CONFIG *CpuConfig;
///
/// Processor power management features configuration.
///
POWER_MGMT_CONFIG *PowerMgmtConfig;
///
/// Processor security features configuration.
///
SECURITY_CONFIG *SecurityConfig;
} DXE_CPU_PLATFORM_POLICY_PROTOCOL;
#endif
|