summaryrefslogtreecommitdiff
path: root/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.h
blob: 5b6793f2a13769fd9570d1dc5124fbd2e94d9f04 (plain)
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/** @file
  Interface definition details between System Agent and platform drivers during DXE phase.

@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 uniquely
  identified as "Intel Reference Module" 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 _SA_PLATFORM_POLICY_H_
#define _SA_PLATFORM_POLICY_H_

#include "SaAccess.h"

///
/// SA Policy provided by platform for DXE phase {912A2913-42A8-45b0-822F-A94D1EAE9965}
///
#define DXE_PLATFORM_SA_POLICY_GUID \
  { \
    0x912a2913, 0x42a8, 0x45b0, 0x82, 0x2f, 0xa9, 0x4d, 0x1e, 0xae, 0x99, 0x65 \
  }

///
/// Extern the GUID for protocol users.
///
extern EFI_GUID gDxePlatformSaPolicyGuid;

///
/// 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
///
/// Don't change the original DXE_MCH_PLATFORM_POLICY_PROTOCOL_REVISION macro, external
/// modules maybe have consumed this macro in their source code.  Directly
/// update the DXE_MCH_PLATFORM_POLICY_PROTOCOL_REVISION version number may cause those
/// external modules to auto mark themselves wrong version info.
/// Always create new version macro for new PlatformMchPolicy protocol interface.
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION
///   First version
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION    1
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2
///   Moved PcieDevsOverride to SampleCode as part of SA_PCIE_CONFIGURATION structure
///   Added SA_PCIE_CONFIGURATION.PcieLtrDevsOverride
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2  2
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_3
///   Added DXE_PLATFORM_SA_POLICY_PROTOCOL.VbiosConfig
///         SA_IGD_CONFIGURATION.VbtAddress
///         SA_IGD_CONFIGURATION.Size
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_3  3
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_4
///   Added SA_IGD_CONFIGURATION.CdClk
///         SA_IGD_CONFIGURATION.CdClkVar
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_4  4
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_5
///   Added SA_IGD_CONFIGURATION.PlatformConfig
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_5  5
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_6
///   Added SA_IGD_CONFIGURATION.IuerStatusVal
///   Added SA_MISC_CONFIGURATION.SaHdaVerbTableNum
///         SA_MISC_CONFIGURATION.*SaHdaVerbTable
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_6  6
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7
///   Added SA_IGD_CONFIGURATION.GopVersion
///   Added SA_PCIE_CONFIGURATION.PegPwrOpt[SA_PEG_MAX_FUN]
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7  7
///
/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8
///   Added SA_PCIE_CONFIGURATION.C7Allowed
///
#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8  8

#define SA_VTD_ENGINE_NUMBER                        2
#define SA_PCIE_DEV_END_OF_TABLE                    0xFFFF
///
/// The data elements should be initialized by a Platform Module.  The data structure is for
/// VT-d driver initialization
///
typedef struct {
  BOOLEAN               VtdEnable;                         ///< This field is used to describe whether or not the VT-d function should be enabled
  EFI_PHYSICAL_ADDRESS  *RmrrUsbBaseAddress;               ///< The field is used to describe the platform USB Reserved memory for Intel VT-d support. Platform code should provide this information for Intel VT-d DXE driver use
  UINT32                BaseAddress[SA_VTD_ENGINE_NUMBER]; ///< This field is used to describe the base addresses for VT-d function
} SA_VTD_CONFIGURATION;

///
/// The Memory Configuration includes DIMM SPD address Map and DIMM Slot Mechanical present bit map.
///
/// The data elements should be initialized by a Platform Module.  Refer to
/// $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c for the usage.
///
typedef struct {
/**
  Dimm SPD address
  Only Server support 2 channels * 3 slots per channel = 6 sockets totally
  The Desktop and mobile only support 2 channels * 2 slots per channel = 4 sockets totally
  So there is mapping rule here for Desktop and mobile that there are no more 4 DIMMS totally in a system:
    Channel A/ Slot 0 --> Dimm 0 --> SpdAddressTable[0]
    Channel A/ Slot 1 --> Dimm 1 --> SpdAddressTable[1]
    Channel B/ Slot 0 --> Dimm 2 --> SpdAddressTable[2]
    Channel B/ Slot 1 --> Dimm 3 --> SpdAddressTable[3]
  Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c for use
  If change the mapping rule, please update the Revision number.
**/
  UINT8 *SpdAddressTable;
/**
  Channel A DIMM Slot Mechanical present bit map, bit 0 -> DIMM 0, bit 1 -> DIMM1, ...
  if the bit is 1, the related DIMM slot is present.
  E.g. if channel A has 2 DIMMs,  ChannelASlotMap = 0x03;
  E.g. if channel A has only 1 DIMMs,  ChannelASlotMap = 0x01;
  Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c
**/
  UINT8 ChannelASlotMap;
/**
  Channel B DIMM Slot Mechanical present bit map, bit 0 -> DIMM 0, bit 1 -> DIMM1, ...
  if the bit is 1, the related DIMM slot is present.
  E.g. if channel B has 2 DIMMs,  ChannelBSlotMap = 0x03;
  E.g. if channel B has only 1 DIMMs,  ChannelBSlotMap = 0x01;
  Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c
**/
  UINT8 ChannelBSlotMap;
  UINT8 RmtBdatEnable;    ///< This flag is used by the MRC for DDR3 channel training (default is false). Please refer to the MRC documentation for more details
  UINT8 MrcTimeMeasure;   ///< Time measure
  UINT8 MrcFastBoot;      ///< Fast boot
} SA_MEMORY_CONFIGURATION;

///
/// The value before AutoConfig match the setting of PCI Express Base Specification 1.1, please be careful for adding new feature
///
typedef enum {
  PcieAspmDisabled,
  PcieAspmL0s,
  PcieAspmL1,
  PcieAspmL0sL1,
  PcieAspmAutoConfig,
  PcieAspmMax
} SA_PCIE_ASPM_CONFIG;

///
/// Device List Structure
///
typedef struct {
  UINT16  VendorId; ///< PCI Configuration space offset 0
  UINT16  DeviceId; ///< PCI Configuration space offset 2
  UINT8   RevId;    ///< PCI Configuration space offset 8; 0xFF means all steppings
  UINT8   RootApmcMask;
  UINT8   EndpointApmcMask;
} PCIE_ASPM_DEV_INFO;

typedef struct {
  UINT16  VendorId; ///< PCI Config space offset 0
  UINT16  DeviceId; ///< PCI Config space offset 2
  UINT8   RevId;    ///< PCI Config space offset 8; 0xFF means all steppings
/**
  SnoopLatency bit definition
  Note: All Reserved bits must be set to 0

  BIT[15]     - When set to 1b, indicates that the values in bits 9:0 are valid
                When clear values in bits 9:0 will be ignored
  BIT[14]     - Should be set to 0b
  BIT[13]     - Reserved
  BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
                000b - 1 ns
                001b - 32 ns
                010b - 1024 ns
                011b - 32,768 ns
                100b - 1,048,576 ns
                101b - 33,554,432 ns
                110b - Reserved
                111b - Reserved
  BITS[9:0]   - Snoop Latency Value. The value in these bits will be multiplied with
                the scale in bits 12:10
**/
  UINT16  SnoopLatency;
/**
  NonSnoopLatency bit definition
  Note: All Reserved bits must be set to 0

  BIT[15]     - When set to 1b, indicates that the values in bits 9:0 are valid
                When clear values in bits 9:0 will be ignored
  BIT[14]     - Should be set to 0b
  BIT[13]     - Reserved
  BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
                000b - 1 ns
                001b - 32 ns
                010b - 1024 ns
                011b - 32,768 ns
                100b - 1,048,576 ns
                101b - 33,554,432 ns
                110b - Reserved
                111b - Reserved
  BITS[9:0]   - Non Snoop Latency Value. The value in these bits will be multiplied with
                the scale in bits 12:10
**/
  UINT16  NonSnoopLatency;
} PCIE_LTR_DEV_INFO;

///
/// PCIE Power Optimizer config
///
typedef struct {
  UINT8   LtrEnable;
  UINT16  LtrMaxSnoopLatency;
  UINT16  LtrMaxNoSnoopLatency;
  UINT8   ObffEnable;
} SA_PCIE_PWR_OPT;


///
/// The PCI Express Configuration info includes PCI Resources Range Base and Limits and the control
/// for PEG ASPM.
///
/// The data elements should be initialized by a Platform Module.  For the data structure for PCI IO
/// and PCI Memory address range info refer to $(PROJECT_SA_ROOT)\PciHostBridge\Dxe\PciHostBridge.c
/// for the usage.
///
typedef struct {
  SA_PCIE_ASPM_CONFIG DmiAspm;                       ///< This field is used to describe the ASPM control for DMI
  SA_PCIE_ASPM_CONFIG PegAspm[SA_PEG_MAX_FUN];       ///< This field is used to describe the ASPM control for PEG Ports
  UINT8               PegAspmL0s[SA_PEG_MAX_FUN];    ///< This field is used to describe the PEG L0s advanced control
  UINT8               PegDeEmphasis[SA_PEG_MAX_FUN]; ///< This field is used to describe the DeEmphasis control for PEG (-6 dB and -3.5 dB are the options)
  BOOLEAN             DmiExtSync;                    ///< This field is used to describe the DMI Extended Sync enable/disable control
  UINT8               DmiDeEmphasis;                 ///< This field is used to describe the DeEmphasis control for DMI (-6 dB and -3.5 dB are the options)
  BOOLEAN             DmiIot;                        ///< This field is used to describe the IOT control for DMI, default is 0
  UINT8               C7Allowed;                     ///< Enable/Disable C7 allowed for PEG Ports [Run-time control]. 0=Disable (default) and 1=Enable
  ///
  /// This field is used as a pointer to the ASPM device override table, default points to an
  /// existing table, mPcieAspmDevsOverride, in the sample code. Refer to
  /// $(PROJECT_SA_ROOT)\Protocol\SaPlatformPolicy\SaPlatformPolicy.h and
  /// $(PROJECT_SA_ROOT)\SampleCode\SaPolicyInit\Dxe\SaDxePolicyInit.c for the usage.
  ///
  /// Note:  This exclusion list helps avoid potential system hangs.
  ///
  PCIE_ASPM_DEV_INFO  *PcieAspmDevsOverride;
  ///
  /// This field is used as a pointer to the LTR device override table, default points to an existing
  /// table, mPcieLtrDevsOverride, in the sample code. Refer to
  /// $(PROJECT_SA_ROOT)\Protocol\SaPlatformPolicy\SaPlatformPolicy.h and
  /// $(PROJECT_SA_ROOT)\SampleCode\SaPolicyInit\Dxe\SaDxePolicyInit.c for the usage.
  ///
  PCIE_LTR_DEV_INFO   *PcieLtrDevsOverride;
  SA_PCIE_PWR_OPT     PegPwrOpt[SA_PEG_MAX_FUN];     ///< This field is used to describe the PCIe LTR/OBFF relevant settings
} SA_PCIE_CONFIGURATION;

///
/// Audio Codec Verb Table
///
typedef struct {
  UINT32  VendorDeviceId;
  UINT16  SubSystemId;
  UINT8   RevisionId; ///< 0xFF applies to all steppings
  UINT8   FrontPanelSupport;
  UINT16  NumberOfRearJacks;
  UINT16  NumberOfFrontJacks;
} SA_HDA_VERB_TABLE_HEADER;

typedef struct {
  SA_HDA_VERB_TABLE_HEADER  VerbTableHeader;
  UINT32                    *VerbTableData;
} SA_HDA_VERB_TABLE;

///
/// This data structure includes IGD related configuration Variables. The data elements should
/// be initialized by a Platform Module.
///
typedef struct {
  UINT8                 RenderStandby;     ///< This field is used to enable or disable RC6 (Render Standby)
  UINT8                 DeepRenderStandby; ///< @deprecated
  EFI_PHYSICAL_ADDRESS  VbtAddress;        ///< This field points to the GOP VBT data buffer
  UINT32                Size;              ///< This field gives the size of the GOP VBT Data buffer
  UINT8                 CdClk;             ///< This field is used to control the Cd Clock Frequency by the user. 0: 337.5Mhz, 1: 450Mhz, 2: 540Mhz
  UINT8                 CdClkVar;          ///< This field gives the Cd Clock Frequencies supported by the system.
  UINT8                 PlatformConfig;    ///< This field gives the Platform Configuration Information (0 = Platform is S0ix Capable for ULT SKUs only, 1 = Platform is not S0ix Capable, 2 = Force Platform is S0ix Capable for All SKUs)
  UINT32                IuerStatusVal;     ///< This field holds the current status of all the supported Ultrabook events (Intel(R) Ultrabook Event Status bits)
  CHAR16                GopVersion[0x10];  ///< This field holds the GOP Driver Version. It is an Output Protocol and updated by the RC

} SA_IGD_CONFIGURATION;

///
/// Subsystem Vendor ID / Subsystem ID
///
typedef struct {
  UINT16  SubSystemVendorId;
  UINT16  SubSystemId;
} SA_DEFAULT_SVID_SID;

///
/// This data structure includes miscellaneous configuration variables such SA thermal device
/// control. The data elements should be initialized by a Platform Module.
///
typedef struct {
  BOOLEAN             ChapDeviceEnable; ///< This field is used to control enable or disable System Agent device (0,7,0)
  BOOLEAN             Device4Enable;    ///< This field is used to control enable or disable System Agent device (0,4,0)
  SA_DEFAULT_SVID_SID *DefaultSvidSid;  ///< This field contains the Subsystem VendorID and Subsystem ID values to program to SA devices
  BOOLEAN             CridEnable;       ///< This field is used to control enable or disable HSW CRID control (to support Intel(R) SIPP)
  BOOLEAN             AudioEnable;      ///< This field is used to control enable or disable System Agent device (0,3,0)
  BOOLEAN             FviReport;        ///< This field is used to control enable or disable of Firmware Version Info (FVI) reporting. 0: Disable; 1: Enable
  UINT8               FviSmbiosType;    ///< This field is used to control the FVI type reported
  UINT8               SaHdaVerbTableNum;///< This field gives the number of HD Audio verb tables that are loaded
  SA_HDA_VERB_TABLE   *SaHdaVerbTable;  ///< This field points to the current HD Audio verb table
} SA_MISC_CONFIGURATION;

///
/// This data structure includes Switchable Graphics VBIOS configuration. The data elements
/// should be initialized by a Platform Module.
///
typedef struct {
  UINT8 LoadVbios    : 1; ///< This field is used to describe if the dGPU VBIOS needs to be loaded
  UINT8 ExecuteVbios : 1; ///< This field is used to describe if the dGPU VBIOD need to be executed
  UINT8 VbiosSource  : 1; ///< This field is used to identify the source location of dGPU VBIOS
  UINT8 Reserved     : 5;
} SA_SG_VBIOS_CONFIGURATION;

///
/// SA DXE Platform Policy
///
/// The DXE_PLATFORM_SA_POLICY_PROTOCOL producer drvier is recommended to
/// set all the DXE_PLATFORM_SA_POLICY_PROTOCOL size buffer zero before init any member parameter,
/// this clear step can make sure no random value for those unknow new version parameters.
///
/// Make sure to update the Revision if any change to the protocol, including the existing
/// internal structure definations
///
typedef struct _DXE_PLATFORM_SA_POLICY_PROTOCOL {
  /// This field specifies the revision of the protocol.  The protocol is expected to change in
  /// a backwards compatible manner as the chipset configuration options are added or removed.
  /// Major changes will result in new protocol definitions/GUID.  The protocol producer must update
  /// this field at build time.
  ///
  /// Please ensure to use DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION macro to define the protocol
  /// revision as input for this version.
  ///
  UINT8                      Revision;
  SA_VTD_CONFIGURATION       *Vtd;          ///< This field is used to describe the configuration of VT-d function used by System Agent Reference code
  SA_PCIE_CONFIGURATION      *PcieConfig;   ///< This field is used to describe the PCIE configuration used by System Agent Reference code
  SA_MEMORY_CONFIGURATION    *MemoryConfig; ///< This field is used to describe the Memory configuration used by System Agent Reference code
  SA_IGD_CONFIGURATION       *IgdConfig;    ///< This field is used to describe the IGD configuration used by System Agent Reference code
  SA_MISC_CONFIGURATION      *MiscConfig;   ///< This field is used to describe some miscellaneous configuration used by System Agent Reference code, such as device enable/disable, CRID support, etc
  SA_SG_VBIOS_CONFIGURATION  *VbiosConfig;  ///< This field is used to describe Switchable Graphics configuration used by System Agent Reference Code
} DXE_PLATFORM_SA_POLICY_PROTOCOL;

#endif