blob: e7d02fa9c579f73910569d314830aa1b62fa69b8 [file] [log] [blame]
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001/* $NoKeywords:$ */
2/**
3 * @file
4 *
5 * Agesa structures and definitions
6 *
7 * Contains AMD AGESA core interface
8 *
9 * @xrefitem bom "File Content Label" "Release Content"
10 * @e project: AGESA
11 * @e sub-project: Include
efdesign9884cbce22011-08-04 12:09:17 -060012 * @e \$Revision: 47417 $ @e \$Date: 2011-02-18 12:48:20 -0700 (Fri, 18 Feb 2011) $
Frank Vibrans2b4c8312011-02-14 18:30:54 +000013 */
14/*
15 *****************************************************************************
16 *
17 * Copyright (c) 2011, Advanced Micro Devices, Inc.
18 * All rights reserved.
Edward O'Callaghane963b382014-07-06 19:27:14 +100019 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000020 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions are met:
22 * * Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * * Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
Edward O'Callaghane963b382014-07-06 19:27:14 +100027 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
28 * its contributors may be used to endorse or promote products derived
Frank Vibrans2b4c8312011-02-14 18:30:54 +000029 * from this software without specific prior written permission.
Edward O'Callaghane963b382014-07-06 19:27:14 +100030 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000031 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
35 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Edward O'Callaghane963b382014-07-06 19:27:14 +100041 *
Frank Vibrans2b4c8312011-02-14 18:30:54 +000042 * ***************************************************************************
43 *
44 */
45
46
47#ifndef _AGESA_H_
48#define _AGESA_H_
49
Angel Ponsf689d2e2020-05-21 00:06:15 +020050/*
51 * This is the delivery package title.
52 * This string MUST be exactly 8 characters long.
53 */
54#define AGESA_PACKAGE_STRING {'c', 'b', '_', 'A', 'g', 'e', 's', 'a'}
55
Angel Ponsc072e792020-05-21 00:28:08 +020056/*
57 * This is the release version number of the AGESA component.
58 * This string MUST be exactly 12 characters long.
59 */
60#define AGESA_VERSION_STRING {'V', '1', '.', '1', '.', '0', '.', '3', ' ', ' ', ' ', ' '}
61
Frank Vibrans2b4c8312011-02-14 18:30:54 +000062#include "Porting.h"
63#include "AMD.h"
64
65//
66//
67// AGESA Types and Definitions
68//
69//
70
71// AGESA BASIC CALLOUTS
72#define AGESA_MEM_RELEASE 0x00028000
73
74// AGESA ADVANCED CALLOUTS, Processor
75#define AGESA_CHECK_UMA 0x00028100
76#define AGESA_DO_RESET 0x00028101
77#define AGESA_ALLOCATE_BUFFER 0x00028102
78#define AGESA_DEALLOCATE_BUFFER 0x00028103
79#define AGESA_LOCATE_BUFFER 0x00028104
80#define AGESA_RUNFUNC_ONAP 0x00028105
81
82// AGESA ADVANCED CALLOUTS, HyperTransport
83
84// AGESA ADVANCED CALLOUTS, Memory
85#define AGESA_READ_SPD 0x00028140
86#define AGESA_HOOKBEFORE_DRAM_INIT 0x00028141
87#define AGESA_HOOKBEFORE_DQS_TRAINING 0x00028142
88#define AGESA_READ_SPD_RECOVERY 0x00028143
89#define AGESA_HOOKBEFORE_EXIT_SELF_REF 0x00028144
90#define AGESA_HOOKBEFORE_DRAM_INIT_RECOVERY 0x00028145
91
92// AGESA IDS CALLOUTS
93#define AGESA_GET_IDS_INIT_DATA 0x00028200
94
95// AGESA GNB CALLOUTS
96#define AGESA_GNB_PCIE_SLOT_RESET 0x00028301
97
98//------------------------------------------------------------------------
99//
100// HyperTransport Interface
101
102
103
104//-----------------------------------------------------------------------------
105// HT DEFINITIONS AND MACROS
106//
107//-----------------------------------------------------------------------------
108
109
110// Width equates for call backs
111#define HT_WIDTH_8_BITS 8 ///< Specifies 8 bit, or up to 8 bit widths.
112#define HT_WIDTH_16_BITS 16 ///< Specifies 16 bit, or up to 16 bit widths.
113#define HT_WIDTH_4_BITS 4
114#define HT_WIDTH_2_BITS 2
115#define HT_WIDTH_NO_LIMIT HT_WIDTH_16_BITS
116
117// Frequency Limit equates for call backs which take a frequency supported mask.
118#define HT_FREQUENCY_LIMIT_200M 1 ///< Specifies a limit of no more than 200 MHz HT frequency.
119#define HT_FREQUENCY_LIMIT_400M 7 ///< Specifies a limit of no more than 400 MHz HT frequency.
120#define HT_FREQUENCY_LIMIT_600M 0x1F ///< Specifies a limit of no more than 600 MHz HT frequency.
121#define HT_FREQUENCY_LIMIT_800M 0x3F ///< Specifies a limit of no more than 800 MHz HT frequency.
122#define HT_FREQUENCY_LIMIT_1000M 0x7F ///< Specifies a limit of no more than 1000 MHz HT frequency.
123#define HT_FREQUENCY_LIMIT_HT1_ONLY 0x7F ///< Specifies a limit of no more than 1000 MHz HT frequency.
124#define HT_FREQUENCY_LIMIT_1200M 0xFF ///< Specifies a limit of no more than 1200 MHz HT frequency.
125#define HT_FREQUENCY_LIMIT_1400M 0x1FF ///< Specifies a limit of no more than 1400 MHz HT frequency.
126#define HT_FREQUENCY_LIMIT_1600M 0x3FF ///< Specifies a limit of no more than 1600 MHz HT frequency.
127#define HT_FREQUENCY_LIMIT_1800M 0x7FF ///< Specifies a limit of no more than 1800 MHz HT frequency.
128#define HT_FREQUENCY_LIMIT_2000M 0xFFF ///< Specifies a limit of no more than 2000 MHz HT frequency.
129#define HT_FREQUENCY_LIMIT_2200M 0x1FFF ///< Specifies a limit of no more than 2200 MHz HT frequency.
130#define HT_FREQUENCY_LIMIT_2400M 0x3FFF ///< Specifies a limit of no more than 2400 MHz HT frequency.
131#define HT_FREQUENCY_LIMIT_2600M 0x7FFF ///< Specifies a limit of no more than 2600 MHz HT frequency.
132#define HT_FREQUENCY_LIMIT_2800M 0x27FFF ///< Specifies a limit of no more than 2800 MHz HT frequency.
133#define HT_FREQUENCY_LIMIT_3000M 0x67FFF ///< Specifies a limit of no more than 3000 MHz HT frequency.
134#define HT_FREQUENCY_LIMIT_3200M 0xE7FFF ///< Specifies a limit of no more than 3200 MHz HT frequency.
135#define HT_FREQUENCY_LIMIT_3600M 0x1E7FFF
136#define HT_FREQUENCY_LIMIT_MAX HT_FREQUENCY_LIMIT_3600M
137#define HT_FREQUENCY_NO_LIMIT 0xFFFFFFFF ///< Specifies a no limit of HT frequency.
138
139// Unit ID Clumping special values
140#define HT_CLUMPING_DISABLE 0x00000000
141#define HT_CLUMPING_NO_LIMIT 0xFFFFFFFF
142
143#define HT_LIST_TERMINAL 0xFF ///< End of list.
144#define HT_LIST_MATCH_ANY 0xFE ///< Match Any value, used for Sockets, Links, IO Chain Depth.
145#define HT_LIST_MATCH_INTERNAL_LINK 0xFD ///< Match all of the internal links.
146
147// Event Notify definitions
148
149// Event definitions.
150
151// Coherent subfunction events
152#define HT_EVENT_COH_EVENTS 0x10001000
153#define HT_EVENT_COH_NO_TOPOLOGY 0x10011000 ///< See ::HT_EVENT_DATA_COH_NO_TOPOLOGY.
154#define HT_EVENT_COH_OBSOLETE000 0x10021000 // No longer used.
155#define HT_EVENT_COH_PROCESSOR_TYPE_MIX 0x10031000 ///< See ::HT_EVENT_DATA_COH_PROCESSOR_TYPE_MIX.
156#define HT_EVENT_COH_NODE_DISCOVERED 0x10041000 ///< See ::HT_EVENT_COH_NODE_DISCOVERED.
157#define HT_EVENT_COH_MPCAP_MISMATCH 0x10051000 ///< See ::HT_EVENT_COH_MPCAP_MISMATCH.
158
159// Non-coherent subfunction events
160#define HT_EVENT_NCOH_EVENTS 0x10002000
161#define HT_EVENT_NCOH_BUID_EXCEED 0x10012000 ///< See ::HT_EVENT_DATA_NCOH_BUID_EXCEED
162#define HT_EVENT_NCOH_OBSOLETE000 0x10022000 // No longer used.
163#define HT_EVENT_NCOH_BUS_MAX_EXCEED 0x10032000 ///< See ::HT_EVENT_DATA_NCOH_BUS_MAX_EXCEED.
164#define HT_EVENT_NCOH_CFG_MAP_EXCEED 0x10042000 ///< See ::HT_EVENT_DATA_NCOH_CFG_MAP_EXCEED.
165#define HT_EVENT_NCOH_DEVICE_FAILED 0x10052000 ///< See ::HT_EVENT_DATA_NCOH_DEVICE_FAILED
166#define HT_EVENT_NCOH_AUTO_DEPTH 0x10062000 ///< See ::HT_EVENT_NCOH_AUTO_DEPTH
167
168// Optimization subfunction events
169#define HT_EVENT_OPT_EVENTS 0x10003000
170#define HT_EVENT_OPT_REQUIRED_CAP_RETRY 0x10013000 ///< See ::HT_EVENT_DATA_OPT_REQUIRED_CAP.
171#define HT_EVENT_OPT_REQUIRED_CAP_GEN3 0x10023000 ///< See ::HT_EVENT_DATA_OPT_REQUIRED_CAP.
172#define HT_EVENT_OPT_UNUSED_LINKS 0x10033000 ///< See ::HT_EVENT_DATA_OPT_UNUSED_LINKS.
173#define HT_EVENT_OPT_LINK_PAIR_EXCEED 0x10043000 ///< See ::HT_EVENT_DATA_OPT_LINK_PAIR_EXCEED.
174
175// HW Fault events
176#define HT_EVENT_HW_EVENTS 0x10004000
177#define HT_EVENT_HW_SYNCFLOOD 0x10014000 ///< See ::HT_EVENT_DATA_HW_SYNCFLOOD.
178#define HT_EVENT_HW_HTCRC 0x10024000 ///< See ::HT_EVENT_DATA_HW_HT_CRC.
179
180// The Recovery HT component uses 0x10005000 for events.
181// For consistency, we avoid that range here.
182
183#define HT_MAX_NC_BUIDS 32
184//----------------------------------------------------------------------------
185// HT TYPEDEFS, STRUCTURES, ENUMS
186//
187//----------------------------------------------------------------------------
188
189/// Specify the state redundant links are to be left in after match.
190///
191/// After matching a link for IGNORE_LINK or SKIP_REGANG, the link may be left alone,
192/// or powered off.
193
194typedef enum {
195 MATCHED, ///< The link matches the requested customization.
196 ///< When used with IGNORE_LINK,
197 ///< this will generally require other software to initialize the link.
198 ///< When used with SKIP_REGANG,
199 ///< the two unganged links will be available for distribution.
200
201 POWERED_OFF, ///< Power the link off. Support may vary based on processor model.
202 ///< Power Off is only supported for coherent links.
203 ///< Link power off may occur at a warm reset rather than immediately.
204 ///< When used with SKIP_REGANG, the paired sublink is powered off, not the matching link.
205
206 UNMATCHED, ///< The link should be processed according to normal defaults.
207 ///< Effectively, the link does not match the requested customization.
208 ///< This can be used to exclude links from a following match any.
209
210 MaxFinalLinkState ///< Not a final link state, use for limit checking.
211} FINAL_LINK_STATE;
212
213/// Swap a device from its current id to a new one.
214
215typedef struct {
216 IN UINT8 FromId; ///< The device responding to FromId,
217 IN UINT8 ToId; ///< will be moved to ToId.
218} BUID_SWAP_ITEM;
219
220
221/// Each Non-coherent chain may have a list of device swaps. After performing the swaps,
222/// the final in order list of device ids is provided. (There can be more swaps than devices.)
223/// The unused entries in both are filled with 0xFF.
224
225typedef struct {
226 IN BUID_SWAP_ITEM Swaps[HT_MAX_NC_BUIDS]; ///< The BUID Swaps to perform
227 IN UINT8 FinalIds[HT_MAX_NC_BUIDS]; ///< The ordered final BUIDs, resulting from the swaps
228} BUID_SWAP_LIST;
229
230
231/// Control Manual Initialization of Non-Coherent Chains
232///
233/// This interface is checked every time a non-coherent chain is
234/// processed. BUID assignment may be controlled explicitly on a
235/// non-coherent chain. Provide a swap list. Swaps controls the
236/// BUID assignment and FinalIds provides the device to device
237/// Linking. Device orientation can be detected automatically, or
238/// explicitly. See interface documentation for more details.
239///
240/// If a manual swap list is not supplied,
241/// automatic non-coherent init assigns BUIDs starting at 1 and incrementing sequentially
242/// based on each device's unit count.
243
244typedef struct {
245 // Match fields
246 IN UINT8 Socket; ///< The Socket on which this chain is located
247 IN UINT8 Link; ///< The Link on the host for this chain
248 // Override fields
249 IN BUID_SWAP_LIST SwapList; ///< The swap list
250} MANUAL_BUID_SWAP_LIST;
251
252
253/// Override options for DEVICE_CAP_OVERRIDE.
254///
255/// Specify which override actions should be performed. For Checks, 1 means to check the item
256/// and 0 means to skip the check. For the override options, 1 means to apply the override and
257/// 0 means to ignore the override.
258
259typedef struct {
260 IN UINT32 IsCheckDevVenId:1; ///< Check Match on Device/Vendor id
261 IN UINT32 IsCheckRevision:1; ///< Check Match on device Revision
262 IN UINT32 IsOverrideWidthIn:1; ///< Override Width In
263 IN UINT32 IsOverrideWidthOut:1; ///< Override Width Out
264 IN UINT32 IsOverrideFreq:1; ///< Override Frequency
265 IN UINT32 IsOverrideClumping:1; ///< Override Clumping
266 IN UINT32 IsDoCallout:1; ///< Make the optional callout
267} DEVICE_CAP_OVERRIDE_OPTIONS;
268
269/// Override capabilities of a device.
270///
271/// This interface is checked once for every Link on every IO device.
272/// Provide the width and frequency capability if needed for this device.
273/// This is used along with device capabilities, the limit interfaces, and northbridge
274/// limits to compute the default settings. The components of the device's PCI config
275/// address are provided, so its settings can be consulted if need be.
276/// The optional callout is a catch all.
277
278typedef struct {
279 // Match fields
280 IN UINT8 HostSocket; ///< The Socket on which this chain is located.
281 IN UINT8 HostLink; ///< The Link on the host for this chain.
282 IN UINT8 Depth; ///< The Depth in the I/O chain from the Host.
283 IN UINT32 DevVenId; ///< The Device's PCI Vendor + Device ID (offset 0x00).
284 IN UINT8 Revision; ///< The Device's PCI Revision field (offset 0x08).
285 IN UINT8 Link; ///< The Device's Link number (0 or 1).
286 IN DEVICE_CAP_OVERRIDE_OPTIONS Options; ///< The options for this device override.
287 // Override fields
288 IN UINT8 LinkWidthIn; ///< modify to change the Link Width In.
289 IN UINT8 LinkWidthOut; ///< modify to change the Link Width Out.
290 IN UINT32 FreqCap; ///< modify to change the Link's frequency capability.
291 IN UINT32 Clumping; ///< modify to change Unit ID clumping support.
292 IN CALLOUT_ENTRY Callout; ///< optional call for really complex cases, or NULL.
293} DEVICE_CAP_OVERRIDE;
294
295/// Callout param struct for override capabilities of a device.
296///
297/// If the optional callout is implemented this param struct is passed to it.
298
299typedef struct {
300 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
301 // Match fields
302 IN UINT8 HostSocket; ///< The Socket on which this chain is located.
303 IN UINT8 HostLink; ///< The Link on the host for this chain.
304 IN UINT8 Depth; ///< The Depth in the I/O chain from the Host.
305 IN UINT32 DevVenId; ///< The Device's PCI Vendor + Device ID (offset 0x00).
306 IN UINT8 Revision; ///< The Device's PCI Revision field (offset 0x08).
307 IN UINT8 Link; ///< The Device's Link number (0 or 1).
308 IN PCI_ADDR PciAddress; ///< The Device's PCI Address.
309 // Override fields
310 OUT UINT8 *LinkWidthIn; ///< modify to change the Link Width In.
311 OUT UINT8 *LinkWidthOut; ///< modify to change the Link Width Out.
312 OUT UINT32 *FreqCap; ///< modify to change the Link's frequency capability.
313 OUT UINT32 *Clumping; ///< modify to change Unit ID clumping support.
314} DEVICE_CAP_CALLOUT_PARAMS;
315
316/// Limits for CPU to CPU Links.
317///
318/// For each coherent connection this interface is checked once.
319/// Provide the frequency and width if needed for this Link (usually based on board
320/// restriction). This is used with CPU device capabilities and northbridge limits
321/// to compute the default settings.
322
323typedef struct {
324 // Match fields
325 IN UINT8 SocketA; ///< One Socket on which this Link is located
326 IN UINT8 LinkA; ///< The Link on this Node
327 IN UINT8 SocketB; ///< The other Socket on which this Link is located
328 IN UINT8 LinkB; ///< The Link on that Node
329 // Limit fields
330 IN UINT8 ABLinkWidthLimit; ///< modify to change the Link Width A->B
331 IN UINT8 BALinkWidthLimit; ///< modify to change the Link Width B-<A
332 IN UINT32 PcbFreqCap; ///< modify to change the Link's frequency capability
333} CPU_TO_CPU_PCB_LIMITS;
334
335/// Get limits for non-coherent Links.
336///
337/// For each non-coherent connection this interface is checked once.
338/// Provide the frequency and width if needed for this Link (usually based on board
339/// restriction). This is used with device capabilities, device overrides, and northbridge limits
340/// to compute the default settings.
341///
342typedef struct {
343 // Match fields
344 IN UINT8 HostSocket; ///< The Socket on which this Link is located
345 IN UINT8 HostLink; ///< The Link about to be initialized
346 IN UINT8 Depth; ///< The Depth in the I/O chain from the Host
347 // Limit fields
348 IN UINT8 DownstreamLinkWidthLimit; ///< modify to change the Link Width going away from processor
349 IN UINT8 UpstreamLinkWidthLimit; ///< modify to change the Link Width moving toward processor
350 IN UINT32 PcbFreqCap; ///< modify to change the Link's frequency capability
351} IO_PCB_LIMITS;
352
353/// Manually control bus number assignment.
354///
355/// This interface is checked every time a non-coherent chain is processed.
356/// If a system can not use the auto Bus numbering feature for non-coherent chain bus
357/// assignments, this interface can provide explicit control. For each chain, provide
358/// the bus number range to use.
359
360typedef struct {
361 // Match fields
362 IN UINT8 Socket; ///< The Socket on which this chain is located
363 IN UINT8 Link; ///< The Link on the host for this chain
364 // Override fields
365 IN UINT8 SecBus; ///< Secondary Bus number for this non-coherent chain
366 IN UINT8 SubBus; ///< Subordinate Bus number
367} OVERRIDE_BUS_NUMBERS;
368
369
370/// Ignore a Link.
371///
372/// This interface is checked every time a coherent Link is found and then every
373/// time a non-coherent Link from a CPU is found.
374/// Any coherent or non-coherent Link from a CPU can be ignored and not used
375/// for discovery or initialization. Useful for connection based systems.
376/// (Note: not checked for IO device to IO Device Links.)
377/// (Note: not usable for internal links (MCM processors).)
378
379typedef struct {
380 // Match fields
381 IN UINT8 Socket; ///< The Socket on which this Link is located
382 IN UINT8 Link; ///< The Link about to be initialized
383 // Customization fields
Wim Vervoornb23f3922019-11-12 09:46:47 +0100384 IN FINAL_LINK_STATE LinkState; ///< The link may be left uninitialized, or powered off.
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000385} IGNORE_LINK;
386
387
388/// Skip reganging of subLinks.
389///
390/// This interface is checked whenever two subLinks are both connected to the same CPUs.
391/// Normally, unganged sublinks between the same two CPUs are reganged.
392/// Provide a matching structure to leave the Links unganged.
393
394typedef struct {
395 // Match fields
396 IN UINT8 SocketA; ///< One Socket on which this Link is located
397 IN UINT8 LinkA; ///< The Link on this Node
398 IN UINT8 SocketB; ///< The other Socket on which this Link is located
399 IN UINT8 LinkB; ///< The Link on that Node
400 // Customization fields
401 IN FINAL_LINK_STATE LinkState; ///< The paired sublink may be active, or powered off.
402} SKIP_REGANG;
403
404/// The System Socket layout, which sockets are physically connected.
405///
406/// The hardware method for Socket naming is preferred. Use this software method only
407/// if required.
408
409typedef struct {
410 IN UINT8 CurrentSocket; ///< The socket from which this connection originates.
411 IN UINT8 CurrentLink; ///< The Link from the source socket connects to another socket.
412 IN UINT8 TargetSocket; ///< The target socket which is connected on that link.
413} SYSTEM_PHYSICAL_SOCKET_MAP;
414
415//----------------------------------------------------------------------------
416///
417/// This is the input structure for AmdHtInitialize.
418///
419typedef struct {
420 // Basic level customization
421 IN UINT8 AutoBusStart; ///< For automatic bus number assignment, starting bus number - usually zero.
422 ///< @BldCfgItem{BLDCFG_STARTING_BUSNUM}
423 IN UINT8 AutoBusMax; ///< For automatic bus number assignment, do not assign above max.
424 ///< @BldCfgItem{BLDCFG_MAXIMUM_BUSNUM}
425 IN UINT8 AutoBusIncrement; ///< For automatic bus number assignment, each chain gets this many busses.
426 ///< @BldCfgItem{BLDCFG_ALLOCATED_BUSNUMS}
427
428 // Advanced Level Customization
429 IN MANUAL_BUID_SWAP_LIST *ManualBuidSwapList; ///< Provide Manual Swap List, if any.
430 ///< @BldCfgItem{BLDCFG_BUID_SWAP_LIST}
431 IN DEVICE_CAP_OVERRIDE *DeviceCapOverrideList; ///< Provide Device Overrides, if any.
432 ///< @BldCfgItem{BLDCFG_HTDEVICE_CAPABILITIES_OVERRIDE_LIST}
433 IN CPU_TO_CPU_PCB_LIMITS *CpuToCpuPcbLimitsList; ///< Provide CPU PCB Limits, if any.
434 ///< @BldCfgItem{BLDCFG_HTFABRIC_LIMITS_LIST}.
435 ///< @n @e Examples: See @ref FrequencyLimitExamples "Frequency Limit Examples".
436 IN IO_PCB_LIMITS *IoPcbLimitsList; ///< Provide IO PCB Limits, if any.
437 ///< @BldCfgItem{BLDCFG_HTCHAIN_LIMITS_LIST}.
438 ///< @n @e Examples: See @ref FrequencyLimitExamples "Frequency Limit Examples".
439 IN OVERRIDE_BUS_NUMBERS *OverrideBusNumbersList; ///< Provide manual Bus Number assignment, if any.
440 ///< Use either auto bus numbering or override bus
441 ///< numbers, not both.
442 ///< @BldCfgItem{BLDCFG_BUS_NUMBERS_LIST}
443
444 IN IGNORE_LINK *IgnoreLinkList; ///< Provide links to ignore, if any.
445 ///< @BldCfgItem{BLDCFG_IGNORE_LINK_LIST}
446 IN SKIP_REGANG *SkipRegangList; ///< Provide links to remain unganged, if any.
447 ///< @BldCfgItem{BLDCFG_LINK_SKIP_REGANG_LIST}
448 ///< @n @e Examples: See @ref PerfPerWattHt "Performance-per-watt Optimization".
449
450 // Expert Level Customization
451 IN UINT8 **Topolist; ///< Use this topology list in addition to the built in, if not NULL.
452 ///< @BldCfgItem{BLDCFG_ADDITIONAL_TOPOLOGIES_LIST}
453 IN SYSTEM_PHYSICAL_SOCKET_MAP *SystemPhysicalSocketMap;
454 ///< The hardware socket naming method is preferred,
455 ///< If it can't be used, this provides a software method.
456 ///< @BldCfgItem{BLDCFG_SYSTEM_PHYSICAL_SOCKET_MAP}
457} AMD_HT_INTERFACE;
458
459//-----------------------------------------------------------------------------
460//
461// HT Recovery Interface
462//
463
464
465/*-----------------------------------------------------------------------------
466 * HT Recovery DEFINITIONS AND MACROS
467 *
468 *-----------------------------------------------------------------------------
469 */
470
471// BBHT subfunction events
472#define HT_EVENT_BB_EVENTS 0x10005000
473#define HT_EVENT_BB_BUID_EXCEED 0x10015000
474#define HT_EVENT_BB_DEVICE_FAILED 0x10055000
475#define HT_EVENT_BB_AUTO_DEPTH 0x10065000
476
477/*----------------------------------------------------------------------------
478 * HT Recovery TYPEDEFS, STRUCTURES, ENUMS
479 *
480 *----------------------------------------------------------------------------
481 */
482
483
484/// The Interface structure to Recovery HT.
485
486typedef struct {
487 IN MANUAL_BUID_SWAP_LIST *ManualBuidSwapList; ///< Option to manually control SB link init
488 ///< @BldCfgItem{BLDCFG_BUID_SWAP_LIST}
489 OUT UINT32 Depth; ///< If auto init was used this is set to the depth of the chain,
490 ///< else, for manual init unmodified.
491} AMD_HT_RESET_INTERFACE;
492
493/*----------------------------------------------------------------------------
494 * CPU Feature related info
495 *----------------------------------------------------------------------------
496 */
497
498/// Build Configuration values for BLDCFG_PLATFORM_C1E_MODE
499typedef enum {
500 C1eModeDisabled = 0, ///< Disabled
501 C1eModeHardware = 1, ///< Hardware method
502 C1eModeMsgBased = 2, ///< Message-based method
503 C1eModeSoftwareDeprecated = 3, ///< Deprecated software SMI method.
504 ///< Refer to "Addendum\Examples\C1eSMMHandler.asm" for
505 ///< example host BIOS SMM Handler implementation
506 C1eModeHardwareSoftwareDeprecated = 4, ///< Hardware or deprecated software SMI method
507 MaxC1eMode = 5 ///< Not a valid value, used for verifying input
508} PLATFORM_C1E_MODES;
509
510/// Build Configuration values for BLDCFG_PLATFORM_CSTATE_MODE
511typedef enum {
512 CStateModeDisabled = 0, ///< Disabled
513 CStateModeC6 = 1, ///< C6 State
514 MaxCStateMode = 2 ///< Not a valid value, used for verifying input
515} PLATFORM_CSTATE_MODES;
516
517/// Build Configuration values for BLDCFG_PLATFORM_CPB_MODE
518typedef enum {
519 CpbModeAuto = 0, ///< Auto
520 CpbModeDisabled = 1, ///< Disabled
521 MaxCpbMode = 2 ///< Not a valid value, used for verifying input
522} PLATFORM_CPB_MODES;
523
524/*----------------------------------------------------------------------------
525 * GNB PCIe configuration info
526 *----------------------------------------------------------------------------
527 */
528
529// Event definitions
530
531
532#define GNB_EVENT_INVALID_CONFIGURATION 0x20010000 // User configuration invalid
533#define GNB_EVENT_INVALID_PCIE_TOPOLOGY_CONFIGURATION 0x20010001 // Requested lane allocation for PCIe port can not be supported
534#define GNB_EVENT_INVALID_PCIE_PORT_CONFIGURATION 0x20010002 // Requested incorrect PCIe port device address
535#define GNB_EVENT_INVALID_DDI_LINK_CONFIGURATION 0x20010003 // Incorrect parameter in DDI link configuration
536#define GNB_EVENT_INVALID_LINK_WIDTH_CONFIGURATION 0x20010004 // Invalid with for PCIe port or DDI link
537#define GNB_EVENT_INVALID_LANES_CONFIGURATION 0x20010005 // Lane double subscribe lanes
538#define GNB_EVENT_INVALID_DDI_TOPOLOGY_CONFIGURATION 0x20010006 // Requested lane allocation for DDI link(s) can not be supported
539#define GNB_EVENT_LINK_TRAINING_FAIL 0x20020000 // PCIe Link training fail
540#define GNB_EVENT_BROKEN_LANE_RECOVERY 0x20030000 // Broken lane workaround applied to recover link training
541#define GNB_EVENT_GEN2_SUPPORT_RECOVERY 0x20040000 // Scale back to GEN1 to recover link training
542
543
544#define DESCRIPTOR_TERMINATE_LIST 0x80000000ull
545
546/// PCIe port misc extended controls
547typedef struct {
548 IN UINT8 LinkComplianceMode :1; ///< Force port into compliance mode (device will not be trained, port output compliance pattern)
549 IN UINT8 LinkSafeMode :2; /**< Safe mode PCIe capability. (Parameter may limit PCIe speed requested through PCIe_PORT_DATA::LinkSpeedCapability)
550 * @li @b 0 - port can advertize muximum supported capability
551 * @li @b 1 - port limit advertized capability and speed to PCIe Gen1
552 */
553} PCIe_PORT_MISC_CONTROL;
554
555
556/// PCIe port configuration data
557typedef struct {
558 IN UINT8 PortPresent; ///< Enable PCIe port for initialization.
559 IN UINT8 ChannelType; /**< Channel type.
560 * @li @b 0 - "lowLoss",
561 * @li @b 1 - "highLoss",
562 * @li @b 2 - "mob0db",
563 * @li @b 3 - "mob3db",
564 * @li @b 4 - "extnd6db"
565 * @li @b 5 - "extnd8db"
566 */
567 IN UINT8 DeviceNumber; /**< PCI Device number for port.
568 * @li @b 0 - Native port device number
569 * @li @b N - Port device number (See available configurations @ref F12LaneConfigurations "Family 0x12", @ref F14LaneConfigurations "Family 0x14")
570 */
571 IN UINT8 FunctionNumber; ///< Reserved for future use
572 IN UINT8 LinkSpeedCapability; /**< PCIe link speed/
573 * @li @b 0 - Maximum supported by silicon
574 * @li @b 1 - Gen1
575 * @li @b 2 - Gen2
576 * @li @b 3 - Gen3
577 */
578 IN UINT8 LinkAspm; /**< ASPM control. (see AgesaPcieLinkAspm for additional option to control ASPM)
579 * @li @b 0 - Disabled
580 * @li @b 1 - L0s only
581 * @li @b 2 - L1 only
582 * @li @b 3 - L0s and L1
583 */
584 IN UINT8 LinkHotplug; /**< Hotplug control.
585 * @li @b 0 - Disabled
586 * @li @b 1 - Basic
587 * @li @b 2 - Server
588 * @li @b 3 - Enhanced
589 */
590 IN UINT8 ResetId; /**< Arbitrary number greater than 0 assigned by platform firmware for GPIO
591 * identification which control reset for given port.
592 * Each port with unique GPIO should have unique ResetId assigned.
593 * All ports use same GPIO to control reset should have same ResetId assigned.
594 * see AgesaPcieSlotResetContol.
595 */
596 IN PCIe_PORT_MISC_CONTROL MiscControls; ///< Misc extended controls
597} PCIe_PORT_DATA;
598
599/// DDI channel lane mapping
600typedef struct { ///< Structure that discribe lane mapping
601 IN UINT8 Lane0 :2; /**< Lane 0 mapping
602 * @li @b 0 - Map to lane 0
603 * @li @b 1 - Map to lane 1
604 * @li @b 2 - Map to lane 2
605 * @li @b 2 - Map to lane 3
606 */
607 IN UINT8 Lane1 :2; ///< Lane 1 mapping (see "Lane 0 mapping")
608 IN UINT8 Lane2 :2; ///< Lane 2 mapping (see "Lane 0 mapping")
609 IN UINT8 Lane3 :2; ///< Lane 3 mapping (see "Lane 0 mapping")
610} CHANNEL_MAPPING; ///< Lane mapping
611
612/// Common Channel Mapping
613typedef union {
614 IN UINT8 ChannelMappingValue; ///< Raw lane mapping
615 IN CHANNEL_MAPPING ChannelMapping; ///< Channel mapping
616} CONN_CHANNEL_MAPPING;
617
618/// DDI Configuration data
619typedef struct {
620 IN UINT8 ConnectorType; /**< Display Connector Type
621 * @li @b 0 - DP
622 * @li @b 1 - eDP
623 * @li @b 2 - Single Link DVI-D
624 * @li @b 3 - Dual Link DVI-D (see @ref F12DualLinkDviDescription "Family 0x12 Dual Link DVI connector description")
625 * @li @b 4 - HDMI
626 * @li @b 5 - Travis DP-to-VGA
627 * @li @b 6 - Travis DP-to-LVDS
628 * @li @b 7 - Hudson-2 NutMeg DP-to-VGA
629 * @li @b 8 - Single Link DVI-I
630 * @li @b 9 - Native CRT (Family 0x14)
631 * @li @b 10 - Native LVDS (Family 0x14)
632 * @li @b 11 - Auto detect LCD panel connector type. VBIOS is able to auto detect the LVDS connector type: native LVDS, eDP or Travis-LVDS
633 * The auto detection method only support panel with EDID.
634 */
635 IN UINT8 AuxIndex; /**< Indicates which AUX or DDC Line is used
636 * @li @b 0 - AUX1
637 * @li @b 1 - AUX2
638 * @li @b 2 - AUX3
639 * @li @b 3 - AUX4
640 * @li @b 4 - AUX5
641 * @li @b 5 - AUX6
642 */
643 IN UINT8 HdpIndex; /**< Indicates which HDP pin is used
644 * @li @b 0 - HDP1
645 * @li @b 1 - HDP2
646 * @li @b 2 - HDP3
647 * @li @b 3 - HDP4
648 * @li @b 4 - HDP5
649 * @li @b 5 - HDP6
650 */
651 IN CONN_CHANNEL_MAPPING Mapping[2]; /**< Set specific mapping of lanes to connector pins
652 * @li Mapping[0] define mapping for group of 4 lanes starting at PCIe_ENGINE_DATA.StartLane
653 * @li Mapping[1] define mapping for group of 4 lanes ending at PCIe_ENGINE_DATA.EndLane (only applicable for Dual DDI link)
654 * if Mapping[x] set to 0 than default mapping assumed
655 */
656} PCIe_DDI_DATA;
657
658/// Engine Configuration
659typedef struct {
660 IN UINT8 EngineType; /**< Engine type
661 * @li @b 0 - Ignore engine configuration
662 * @li @b 1 - PCIe port
663 * @li @b 2 - DDI
664 */
665 IN UINT16 StartLane; /**< Start Lane ID (in reversed configuration StartLane > EndLane)
666 * See lane description for @ref F12PcieLaneDescription "Family 0x12"
667 * @ref F14PcieLaneDescription "Family 0x14".
668 * See lane configurations for @ref F12LaneConfigurations "Family 0x12"
669 * @ref F14LaneConfigurations "Family 0x14".
670 */
671 IN UINT16 EndLane; /**< End lane ID (in reversed configuration StartLane > EndLane)
672 * See lane description for @ref F12PcieLaneDescription "Family 0x12",
673 * @ref F14PcieLaneDescription "Family 0x14".
674 * See lane configurations for @ref F12LaneConfigurations "Family 0x12"
675 * @ref F14LaneConfigurations "Family 0x14".
676 */
677
678} PCIe_ENGINE_DATA;
679
680/// PCIe port descriptor
681typedef struct {
682 IN UINT32 Flags; /**< Descriptor flags
683 * @li @b Bit31 - last descriptor in complex
684 */
685 IN PCIe_ENGINE_DATA EngineData; ///< Engine data
686 IN PCIe_PORT_DATA Port; ///< PCIe port specific configuration info
687} PCIe_PORT_DESCRIPTOR;
688
689/// DDI descriptor
690typedef struct {
691 IN UINT32 Flags; /**< Descriptor flags
692 * @li @b Bit31 - last descriptor in complex
693 */
694 IN PCIe_ENGINE_DATA EngineData; ///< Engine data
695 IN PCIe_DDI_DATA Ddi; ///< DDI port specific configuration info
696} PCIe_DDI_DESCRIPTOR;
697
698/// PCIe Complex descriptor
699typedef struct {
700 IN UINT32 Flags; /**< Descriptor flags
701 * @li @b Bit31 - last descriptor in topology
702 */
703 IN UINT32 SocketId; ///< Socket Id
Edward O'Callaghan3e570d42014-11-09 11:43:59 +1100704 IN CONST PCIe_PORT_DESCRIPTOR *PciePortList; ///< Pointer to array of PCIe port descriptors or NULL (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST).
705 IN CONST PCIe_DDI_DESCRIPTOR *DdiLinkList; ///< Pointer to array DDI link descriptors (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST).
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000706 IN VOID *Reserved; ///< Reserved for future use
707} PCIe_COMPLEX_DESCRIPTOR;
708
709/// Action to control PCIe slot reset
710typedef enum {
711 AssertSlotReset, ///< Assert slot reset
712 DeassertSlotReset ///< Deassert slot reset
713} PCIE_RESET_CONTROL;
714
715///Slot Reset Info
716typedef struct {
717 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
718 IN UINT8 ResetId; ///< Slot reset ID as specified in PCIe_PORT_DESCRIPTOR
719 IN UINT8 ResetControl; ///< Reset control as in PCIE_RESET_CONTROL
720} PCIe_SLOT_RESET_INFO;
721
722/// Engine descriptor type
723typedef enum {
724 PcieUnusedEngine = 0, ///< Unused descriptor
725 PciePortEngine = 1, ///< PCIe port
726 PcieDdiEngine = 2, ///< DDI
727 MaxPcieEngine ///< Max engine type for boundary check.
728} PCIE_ENGINE_TYPE;
729
730/// PCIe link capability/speed
731typedef enum {
732 PcieGenMaxSupported, ///< Maximum supported
733 PcieGen1 = 1, ///< Gen1
734 PcieGen2, ///< Gen2
735 MaxPcieGen ///< Max Gen for boundary check
736} PCIE_LINK_SPEED_CAP;
737
738/// PCIe PSPP Power policy
739typedef enum {
740 PsppDisabled, ///< PSPP disabled
741 PsppPerformance = 1, ///< Performance
742 PsppBalanceHigh, ///< Balance-High
743 PsppBalanceLow, ///< Balance-Low
744 PsppPowerSaving, ///< Power Saving
745 MaxPspp ///< Max Pspp for boundary check
746} PCIE_PSPP_POLICY;
747
748/// DDI display connector type
749typedef enum {
750 ConnectorTypeDP, ///< DP
751 ConnectorTypeEDP, ///< eDP
752 ConnectorTypeSingleLinkDVI, ///< Single Link DVI-D
753 ConnectorTypeDualLinkDVI, ///< Dual Link DVI-D
754 ConnectorTypeHDMI, ///< HDMI
755 ConnectorTypeTravisDpToVga, ///< Travis DP-to-VGA
756 ConnectorTypeTravisDpToLvds, ///< Travis DP-to-LVDS
757 ConnectorTypeNutmegDpToVga, ///< Hudson-2 NutMeg DP-to-VGA
758 ConnectorTypeSingleLinkDviI, ///< Single Link DVI-I
759 ConnectorTypeCrt, ///< CRT (VGA)
760 ConnectorTypeLvds, ///< LVDS
761 ConnectorTypeAutoDetect, ///< VBIOS auto detect connector type (native LVDS, eDP or Travis-LVDS)
762 MaxConnectorType ///< Not valid value, used to verify input
763} PCIE_CONNECTOR_TYPE;
764
765/// PCIe link channel type
766typedef enum {
767 ChannelTypeLowLoss, ///< Low Loss
768 ChannelTypeHighLoss, ///< High Loss
769 ChannelTypeMob0db, ///< Mobile 0dB
770 ChannelTypeMob3db, ///< Mobile 3dB
771 ChannelTypeExt6db, ///< Extended 6dB
772 ChannelTypeExt8db, ///< Extended 8dB
773 MaxChannelType ///< Not valid value, used to verify input
774} PCIE_CHANNEL_TYPE;
775
776/// PCIe link ASPM
777typedef enum {
778 AspmDisabled, ///< Disabled
779 AspmL0s, ///< PCIe L0s link state
780 AspmL1, ///< PCIe L1 link state
781 AspmL0sL1, ///< PCIe L0s & L1 link state
782 MaxAspm ///< Not valid value, used to verify input
783} PCIE_ASPM_TYPE;
784
785/// PCIe link hotplug support
786typedef enum {
787 HotplugDisabled, ///< Hotplug disable
788 HotplugBasic, ///< Basic Hotplug
789 HotplugServer, ///< Server Hotplug
790 HotplugEnhanced, ///< Enhanced
791 HotplugInboard, ///< Inboard
792 MaxHotplug ///< Not valid value, used to verify input
793} PCIE_HOTPLUG_TYPE;
794
795/// PCIe link initialization
796typedef enum {
797 PortDisabled, ///< Disable
798 PortEnabled ///< Enable
799} PCIE_PORT_ENABLE;
800
801/// DDI Aux channel
802typedef enum {
803 Aux1, ///< Aux1
804 Aux2, ///< Aux2
805 Aux3, ///< Aux3
806 Aux4, ///< Aux4
807 Aux5, ///< Aux5
808 Aux6, ///< Aux6
809 MaxAux ///< Not valid value, used to verify input
810} PCIE_AUX_TYPE;
811
812/// DDI Hdp Index
813typedef enum {
814 Hdp1, ///< Hdp1
815 Hdp2, ///< Hdp2
816 Hdp3, ///< Hdp3
817 Hdp4, ///< Hdp4
818 Hdp5, ///< Hdp5
819 Hdp6, ///< Hdp6
820 MaxHdp ///< Not valid value, used to verify input
821} PCIE_HDP_TYPE;
822
823// Macro for statically initialization of various structures
824#define PCIE_ENGINE_DATA_INITIALIZER(mType, mStartLane, mEndLane) {mType, mStartLane, mEndLane}
825#define PCIE_PORT_DATA_INITIALIZER(mPortPresent, mChannelType, mDevAddress, mHotplug, mMaxLinkSpeed, mMaxLinkCap, mAspm, mResetId) \
826{mPortPresent, mChannelType, mDevAddress, 0, mMaxLinkSpeed, mAspm, mHotplug, mResetId, {0, mMaxLinkCap} }
827#define PCIE_DDI_DATA_INITIALIZER(mConnectorType, mAuxIndex, mHpdIndex ) \
Martin Rothe533fda2013-02-23 16:29:25 -0700828{mConnectorType, mAuxIndex, mHpdIndex, {{0}, {0}}}
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000829#define PCIE_DDI_DATA_INITIALIZER_V1(mConnectorType, mAuxIndex, mHpdIndex, mMapping0, mMapping1) \
830{mConnectorType, mAuxIndex, mHpdIndex, {mMapping0, mMapping1}}
831
832
833/*----------------------------------------------------------------------------
834 * GNB configuration info
835 *----------------------------------------------------------------------------
836 */
efdesign9884cbce22011-08-04 12:09:17 -0600837
838/// LVDS Misc Control Field
839typedef struct {
840 IN UINT8 FpdiMode:1; ///< This item configures LVDS 888bit panel mode
841 ///< @li FALSE = LVDS 888 panel in LDI mode
842 ///< @li TRUE = LVDS 888 panel in FPDI mode
843 ///< @BldCfgItem{BLDCFG_LVDS_MISC_888_FPDI_MODE}
844 IN UINT8 DlChSwap:1; ///< This item configures LVDS panel lower and upper link mapping
845 ///< @li FALSE = Lower link and upper link not swap
846 ///< @li TRUE = Lower link and upper link are swapped
847 ///< @BldCfgItem{BLDCFG_LVDS_MISC_DL_CH_SWAP}
848 IN UINT8 VsyncActiveLow:1; ///< This item configures polarity of frame pulse encoded in lvds data stream
849 ///< @li FALSE = Active high Frame Pulse/Vsync
850 ///< @li TRUE = Active low Frame Pulse/Vsync
851 ///< @BldCfgItem{BLDCFG_LVDS_MISC_VSYNC_ACTIVE_LOW}
852 IN UINT8 HsyncActiveLow:1; ///< This item configures polarity of line pulse encoded in lvds data
853 ///< @li FALSE = Active high Line Pulse
854 ///< @li TRUE = Active low Line Pulse / Hsync
855 ///< @BldCfgItem{BLDCFG_LVDS_MISC_HSYNC_ACTIVE_LOW}
856 IN UINT8 BLONActiveLow:1; ///< This item configures polarity of signal sent to digital BLON output pin
857 ///< @li FALSE = Not inverted(active high)
858 ///< @li TRUE = Inverted (active low)
859 ///< @BldCfgItem{BLDCFG_LVDS_MISC_BLON_ACTIVE_LOW}
860 IN UINT8 Reserved:3; ///< Reserved
861} LVDS_MISC_CONTROL_FIELD;
862
863/// LVDS Misc Control
864typedef union _LVDS_MISC_CONTROL {
865 IN LVDS_MISC_CONTROL_FIELD Field; ///< LVDS_MISC_CONTROL_FIELD
866 IN UINT8 Value; ///< LVDS Misc Control Value
867} LVDS_MISC_CONTROL;
868
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000869/// Configuration settings for GNB.
870typedef struct {
871 IN UINT8 Gnb3dStereoPinIndex; ///< 3D Stereo Pin ID.
872 ///< @li 0 = Stereo 3D is disabled (default).
873 ///< @li 1 = Use processor pin HPD1.
874 ///< @li 2 = Use processor pin HPD2
875 ///< @li 3 = Use processor pin HPD3
876 ///< @li 4 = Use processor pin HPD4
877 ///< @li 5 = Use processor pin HPD5
878 ///< @li 6 = Use processor pin HPD6
879 ///< @BldCfgItem{BLDCFG_STEREO_3D_PINOUT}
880 IN UINT16 LvdsSpreadSpectrum; ///< Spread spectrum value in 0.01 %
881 ///< BldCfgItem{BLDCFG_GFX_LVDS_SPREAD_SPECTRUM}
882 IN UINT16 LvdsSpreadSpectrumRate; ///< Spread spectrum frequency used by SS hardware logic in unit of 10Hz, 0 - default frequency 40kHz
883 ///< BldCfgItem{BLDCFG_GFX_LVDS_SPREAD_SPECTRUM_RATE}
efdesign9884cbce22011-08-04 12:09:17 -0600884 IN LVDS_MISC_CONTROL LvdsMiscControl;///< This item configures LVDS swap/Hsync/Vsync/BLON
885 IN UINT16 PcieRefClkSpreadSpectrum; ///< Spread spectrum value in 0.01 %
886 ///< @BldCfgItem{BLDCFG_PCIE_REFCLK_SPREAD_SPECTRUM}
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000887} GNB_ENV_CONFIGURATION;
888
889/// GNB configuration info
890typedef struct {
Kyösti Mälkkie66e3902017-09-21 12:58:20 +0300891 IN const PCIe_COMPLEX_DESCRIPTOR *PcieComplexList; /**< Pointer to array of structures describe PCIe topology on each processor package or NULL.
Paul Menzel7454bdf2013-03-15 10:47:50 +0100892 * Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000893 * Example of topology definition for single socket system:
894 * @code
895 * PCIe_PORT_DESCRIPTOR PortList [] = {
896 * // Initialize Port descriptor (PCIe port, Lanes 8:15, PCI Device Number 2, ...)
897 * {
898 * 0, //Descriptor flags
899 * PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 8, 15),
900 * PCIE_PORT_DATA_INITIALIZER (PortEnabled, ChannelTypeExt6db, 2, HotplugDisabled, PcieGenMaxSupported, PcieGenMaxSupported, AspmDisabled, 0)
901 * },
902 * // Initialize Port descriptor (PCIe port, Lanes 16:19, PCI Device Number 3, ...)
903 * {
904 * 0, //Descriptor flags
905 * PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 16, 19),
906 * PCIE_PORT_DATA_INITIALIZER (PortEnabled, ChannelTypeExt6db, 3, HotplugDisabled, PcieGenMaxSupported, PcieGenMaxSupported, AspmDisabled, 0)
907 * },
908 * // Initialize Port descriptor (PCIe port, Lanes 4, PCI Device Number 4, ...)
909 * {
910 * DESCRIPTOR_TERMINATE_LIST, //Descriptor flags !!!IMPORTANT!!! Terminate last element of array
911 * PCIE_ENGINE_DATA_INITIALIZER (PciePortEngine, 4, 4),
912 * PCIE_PORT_DATA_INITIALIZER (PortEnabled, ChannelTypeExt6db, 4, HotplugDisabled, PcieGenMaxSupported, PcieGenMaxSupported, AspmDisabled, 0)
913 * }
914 * };
915 * PCIe_PORT_DESCRIPTOR DdiList [] = {
916 * // Initialize Ddi descriptor (DDI interface Lanes 24:27, Display Port Connector, ...)
917 * {
918 * 0, //Descriptor flags
919 * PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 24, 27),
Paul Menzel07e0f1b2013-04-13 15:58:03 +0200920 * PCIE_DDI_DATA_INITIALIZER (ConnectorTypeDP, Aux1, Hdp1)
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000921 * },
922 * // Initialize Ddi descriptor (DDI interface Lanes 28:31, HDMI, ...)
923 * {
924 * DESCRIPTOR_TERMINATE_LIST, //Descriptor flags !!!IMPORTANT!!! Terminate last element of array
925 * PCIE_ENGINE_DATA_INITIALIZER (PcieDdiEngine, 28, 31),
Paul Menzel07e0f1b2013-04-13 15:58:03 +0200926 * PCIE_DDI_DATA_INITIALIZER (ConnectorTypeHDMI, Aux2, Hdp2)
Frank Vibrans2b4c8312011-02-14 18:30:54 +0000927 * }
928 * };
929 * PCIe_COMPLEX_DESCRIPTOR PlatformTopology = {
930 * DESCRIPTOR_TERMINATE_LIST, //Descriptor flags !!!IMPORTANT!!! Terminate complexes list
931 * 0, //Socket ID
932 * &PortList[0],
933 * &DdiList[0],
934 * }
935 * @endcode
936 */
937 IN UINT8 PsppPolicy; /**< PSPP (PCIe Speed Power Policy)
938 * @li @b 0 - Disabled
939 * @li @b 1 - Performance
940 * @li @b 2 - Balance-High
941 * @li @b 3 - Balance-Low
942 * @li @b 4 - Power Saving
943 */
944
945} GNB_CONFIGURATION;
946//
947// MEMORY-SPECIFIC DATA STRUCTURES
948//
949//
950//
951//
952// AGESA MAXIMIUM VALUES
953//
954// These Max values are used to define array sizes and associated loop
955// counts in the code. They reflect the maximum values that AGESA
956// currently supports and does not necessarily reflect the hardware
957// capabilities of configuration.
958//
959
960#define MAX_SOCKETS_SUPPORTED 8 ///< Max number of sockets in system
961#define MAX_CHANNELS_PER_SOCKET 4 ///< Max Channels per sockets
962#define MAX_DIMMS_PER_CHANNEL 4 ///< Max DIMMs on a memory channel (independent of platform)
963#define NUMBER_OF_DELAY_TABLES 9 ///< Number of tables defined in CH_DEF_STRUCT.
964 ///< Eg: UINT16 *RcvEnDlys;
965 ///< UINT8 *WrDqsDlys;
966 ///< UINT8 *RdDqsDlys;
967 ///< UINT8 *WrDatDlys;
968 ///< UINT8 *RdDqsMinDlys;
969 ///< UINT8 *RdDqsMaxDlys;
970 ///< UINT8 *WrDatMinDlys;
971 ///< UINT8 *WrDatMaxDlys;
972#define NUMBER_OF_FAILURE_MASK_TABLES 1 ///< Number of failure mask tables
973
974#define MAX_PLATFORM_TYPES 16 ///< Platform types per system
975
976#define MCT_TRNG_KEEPOUT_START 0x00004000 ///< base [39:8]
977#define MCT_TRNG_KEEPOUT_END 0x00007FFF ///< base [39:8]
978
979#define UMA_ATTRIBUTE_INTERLEAVE 0x80000000 ///< Uma Region is interleaved
980#define UMA_ATTRIBUTE_ON_DCT0 0x40000000 ///< UMA resides on memory that belongs to DCT0
981#define UMA_ATTRIBUTE_ON_DCT1 0x20000000 ///< UMA resides on memory that belongs to DCT1
982
983typedef UINT8 PSO_TABLE; ///< Platform Configuration Table
984
985// AGESA DEFINITIONS
986//
987// Many of these are derived from the platform and hardware specific definitions
988
989/// EccSymbolSize override value
990#define ECCSYMBOLSIZE_USE_BKDG 0 ///< Use BKDG Recommended Value
991#define ECCSYMBOLSIZE_FORCE_X4 4 ///< Force to x4
992#define ECCSYMBOLSIZE_FORCE_X8 8 ///< Force to x8
993/// CPU Package Type
994#define PT_L1 0 ///< L1 Package type
995#define PT_M2 1 ///< AM Package type
996#define PT_S1 2 ///< S1 Package type
997
998/// Structures use to pass system Logical CPU-ID
999typedef struct {
1000 IN OUT UINT64 Family; ///< Indicates logical ID Family
1001 IN OUT UINT64 Revision; ///< Indicates logical ID Family
1002} CPU_LOGICAL_ID;
1003
1004/// Build Configuration values for BLDCFG_AMD_PLATFORM_TYPE
1005typedef enum {
1006 AMD_PLATFORM_SERVER = 0x8000, ///< Server
1007 AMD_PLATFORM_DESKTOP = 0x10000, ///< Desktop
1008 AMD_PLATFORM_MOBILE = 0x20000, ///< Mobile
1009} AMD_PLATFORM_TYPE;
1010
1011/// Dram technology type
1012typedef enum {
1013 DDR2_TECHNOLOGY, ///< DDR2 technology
1014 DDR3_TECHNOLOGY ///< DDR3 technology
1015} TECHNOLOGY_TYPE;
1016
1017/// Build Configuration values for BLDCFG_MEMORY_BUS_FREQUENCY_LIMIT & BLDCFG_MEMORY_CLOCK_SELECT
Angel Ponsec6e03e2020-05-21 16:30:00 +02001018typedef unsigned int MEMORY_BUS_SPEED;
1019
1020#define DDR400_FREQUENCY 200 ///< DDR 400
1021#define DDR533_FREQUENCY 266 ///< DDR 533
1022#define DDR667_FREQUENCY 333 ///< DDR 667
1023#define DDR800_FREQUENCY 400 ///< DDR 800
1024#define DDR1066_FREQUENCY 533 ///< DDR 1066
1025#define DDR1333_FREQUENCY 667 ///< DDR 1333
1026#define DDR1600_FREQUENCY 800 ///< DDR 1600
1027#define DDR1866_FREQUENCY 933 ///< DDR 1866
1028#define UNSUPPORTED_DDR_FREQUENCY 934 ///< Highest limit of DDR frequency
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001029
1030/// Build Configuration values for BLDCFG_MEMORY_QUADRANK_TYPE
Angel Ponsec6e03e2020-05-21 16:30:00 +02001031typedef unsigned int QUANDRANK_TYPE;
1032
1033#define QUADRANK_REGISTERED 0 ///< Quadrank registered DIMM
1034#define QUADRANK_UNBUFFERED 1 ///< Quadrank unbuffered DIMM
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001035
1036/// Build Configuration values for BLDCFG_TIMING_MODE_SELECT
Angel Ponsec6e03e2020-05-21 16:30:00 +02001037typedef unsigned int USER_MEMORY_TIMING_MODE;
1038
1039#define TIMING_MODE_AUTO 0 ///< Use best rate possible
1040#define TIMING_MODE_LIMITED 1 ///< Set user top limit
1041#define TIMING_MODE_SPECIFIC 2 ///< Set user specified speed
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001042
1043/// Build Configuration values for BLDCFG_POWER_DOWN_MODE
Angel Ponsec6e03e2020-05-21 16:30:00 +02001044typedef unsigned int POWER_DOWN_MODE;
1045
1046#define POWER_DOWN_BY_CHANNEL 0 ///< Channel power down mode
1047#define POWER_DOWN_BY_CHIP_SELECT 1 ///< Chip select power down mode
1048#define POWER_DOWN_MODE_AUTO 2 ///< AGESA to select power down mode
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001049
1050/// Low voltage support
1051typedef enum {
1052 VOLT1_5, ///< 1.5 Volt
1053 VOLT1_35, ///< 1.35 Volt
1054 VOLT1_25, ///< 1.25 Volt
1055 VOLT_UNSUPPORTED = 0xFF ///< No common voltage found
1056} DIMM_VOLTAGE;
1057
1058/// UMA Mode
1059typedef enum {
1060 UMA_NONE = 0, ///< UMA None
1061 UMA_SPECIFIED = 1, ///< UMA Specified
1062 UMA_AUTO = 2 ///< UMA Auto
1063} UMA_MODE;
1064
1065/// Build Configuration values for BLDCFG_UMA_ALIGNMENT
1066typedef enum {
1067 NO_UMA_ALIGNED = 0x00FFFFFF, ///< NO UMA aligned
1068 UMA_128MB_ALIGNED = 0x00FFF800, ///< UMA 128MB aligned
1069 UMA_256MB_ALIGNED = 0x00FFF000, ///< UMA 256MB aligned
1070 UMA_512MB_ALIGNED = 0x00FFE000, ///< UMA 512MB aligned
1071} UMA_ALIGNMENT;
1072
1073///
1074/// Global MCT Configuration Status Word (GStatus)
1075///
1076typedef enum {
1077 GsbMTRRshort, ///< Ran out of MTRRs while mapping memory
1078 GsbAllECCDimms, ///< All banks of all Nodes are ECC capable
1079 GsbDramECCDis, ///< Dram ECC requested but not enabled.
1080 GsbSoftHole, ///< A Node Base gap was created
1081 GsbHWHole, ///< A HW dram remap was created
1082 GsbNodeIntlv, ///< Node Memory interleaving was enabled
1083 GsbSpIntRemapHole, ///< Special condition for Node Interleave and HW remapping
1084 GsbEnDIMMSpareNW, ///< Indicates that DIMM Spare can be used without a warm reset
1085
1086 GsbEOL ///< End of list
1087} GLOBAL_STATUS_FIELD;
1088
1089///
1090/// Local Error Status (DIE_STRUCT.ErrStatus[31:0])
1091///
1092typedef enum {
1093 EsbNoDimms, ///< No DIMMs
1094 EsbSpdChkSum, ///< SPD Checksum fail
1095 EsbDimmMismatchM, ///< dimm module type(buffer) mismatch
1096 EsbDimmMismatchT, ///< dimm CL/T mismatch
1097 EsbDimmMismatchO, ///< dimm organization mismatch (128-bit)
1098 EsbNoTrcTrfc, ///< SPD missing Trc or Trfc info
1099 EsbNoCycTime, ///< SPD missing byte 23 or 25
1100 EsbBkIntDis, ///< Bank interleave requested but not enabled
1101 EsbDramECCDis, ///< Dram ECC requested but not enabled
1102 EsbSpareDis, ///< Online spare requested but not enabled
1103 EsbMinimumMode, ///< Running in Minimum Mode
1104 EsbNoRcvrEn, ///< No DQS Receiver Enable pass window found
1105 EsbSmallRcvr, ///< DQS Rcvr En pass window too small (far right of dynamic range)
1106 EsbNoDqsPos, ///< No DQS-DQ passing positions
1107 EsbSmallDqs, ///< DQS-DQ passing window too small
1108 EsbDCBKScrubDis, ///< DCache scrub requested but not enabled
1109
1110 EsbEMPNotSupported, ///< Processor is not capable for EMP.
1111 EsbEMPConflict, ///< EMP requested but cannot be enabled since
1112 ///< channel interleaving, bank interleaving, or bank swizzle is enabled.
1113 EsbEMPDis, ///< EMP requested but cannot be enabled since
1114 ///< memory size of each DCT is not a power of two.
1115
1116 EsbEOL ///< End of list
1117} ERROR_STATUS_FIELD;
1118
1119///
1120/// Local Configuration Status (DIE_STRUCT.Status[31:0])
1121///
1122typedef enum {
1123 SbRegistered, ///< All DIMMs are Registered
1124 SbEccDimms, ///< All banks ECC capable
1125 SbParDimms, ///< All banks Addr/CMD Parity capable
1126 SbDiagClks, ///< Jedec ALL slots clock enable diag mode
1127 Sb128bitmode, ///< DCT in 128-bit mode operation
1128 Sb64MuxedMode, ///< DCT in 64-bit mux'ed mode.
1129 Sb2TMode, ///< 2T CMD timing mode is enabled.
1130 SbSWNodeHole, ///< Remapping of Node Base on this Node to create a gap.
1131 SbHWHole, ///< Memory Hole created on this Node using HW remapping.
1132 SbOver400Mhz, ///< DCT freq greater than or equal to 400MHz flag
1133 SbDQSPosPass2, ///< Used for TrainDQSPos DIMM0/1, when freq greater than or equal to 400MHz
1134 SbDQSRcvLimit, ///< Used for DQSRcvEnTrain to know we have reached the upper bound.
1135 SbExtConfig, ///< Indicate the default setting for extended PCI configuration support
1136 SbLrdimms, ///< All DIMMs are LRDIMMs
1137
1138 SbEOL ///< End of list
1139} LOCAL_STATUS_FIELD;
1140
1141
1142///< CPU MSR Register definitions ------------------------------------------
1143#define SYS_CFG 0xC0010010
Kyösti Mälkki0127c6c2015-03-05 14:35:04 +02001144#define TOP_MEM 0xC001001Aul
1145#define TOP_MEM2 0xC001001Dul
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001146#define HWCR 0xC0010015
1147#define NB_CFG 0xC001001F
1148
1149#define FS_BASE 0xC0000100
1150#define IORR0_BASE 0xC0010016
1151#define IORR0_MASK 0xC0010017
1152#define BU_CFG 0xC0011023
1153#define BU_CFG2 0xC001102A
1154#define COFVID_STAT 0xC0010071
1155#define TSC 0x10
1156
1157//-----------------------------------------------------------------------------
1158///
1159/// SPD Data for each DIMM.
1160///
Mike Banon8b7bda42020-08-15 10:30:19 +03001161#define DDR3_SPD_SIZE 256
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001162typedef struct _SPD_DEF_STRUCT {
1163 IN BOOLEAN DimmPresent; ///< Indicates that the DIMM is present and Data is valid
Mike Banon8b7bda42020-08-15 10:30:19 +03001164 IN UINT8 Data[DDR3_SPD_SIZE]; ///< Buffer for 256 Bytes of SPD data from DIMM
Frank Vibrans2b4c8312011-02-14 18:30:54 +00001165} SPD_DEF_STRUCT;
1166
1167///
1168/// Channel Definition Structure.
1169/// This data structure defines entries that are specific to the channel initialization
1170///
1171typedef struct _CH_DEF_STRUCT {
1172 OUT UINT8 ChannelID; ///< Physical channel ID of a socket(0 = CH A, 1 = CH B, 2 = CH C, 3 = CH D)
1173 OUT TECHNOLOGY_TYPE TechType; ///< Technology type of this channel
1174 OUT UINT8 ChDimmPresent; ///< For each bit n 0..7, 1 = DIMM n is present.
1175 ///< DIMM# Select Signal
1176 ///< 0 MA0_CS_L[0, 1]
1177 ///< 1 MB0_CS_L[0, 1]
1178 ///< 2 MA1_CS_L[0, 1]
1179 ///< 3 MB1_CS_L[0, 1]
1180 ///< 4 MA2_CS_L[0, 1]
1181 ///< 5 MB2_CS_L[0, 1]
1182 ///< 6 MA3_CS_L[0, 1]
1183 ///< 7 MB3_CS_L[0, 1]
1184
1185 OUT struct _DCT_STRUCT *DCTPtr; ///< Pointer to the DCT data of this channel.
1186 OUT struct _DIE_STRUCT *MCTPtr; ///< Pointer to the node data of this channel.
1187 OUT SPD_DEF_STRUCT *SpdPtr; ///< Pointer to the SPD data for this channel. (Setup by NB Constructor)
1188 OUT SPD_DEF_STRUCT *DimmSpdPtr[MAX_DIMMS_PER_CHANNEL]; ///< Array of pointers to
1189 ///< SPD Data for each Dimm. (Setup by Tech Block Constructor)
1190 OUT UINT8 ChDimmValid; ///< For each bit n 0..3, 1 = DIMM n is valid and is/will be configured where 4..7 are reserved.
1191 ///<
1192 OUT UINT8 RegDimmPresent; ///< For each bit n 0..3, 1 = DIMM n is a registered DIMM where 4..7 are reserved.
1193 OUT UINT8 LrDimmPresent; ///< For each bit n 0..3, 1 = DIMM n is Load Reduced DIMM where 4..7 are reserved.
1194 OUT UINT8 SODimmPresent; ///< For each bit n 0..3, 1 = DIMM n is a SO-DIMM, where 4..7 are reserved.
1195 OUT UINT8 Loads; ///< Number of devices loading bus
1196 OUT UINT8 Dimms; ///< Number of DIMMs loading Channel
1197 OUT UINT8 Ranks; ///< Number of ranks loading Channel DATA
1198 OUT BOOLEAN SlowMode; ///< 1T or 2T CMD mode (slow access mode)
1199 ///< FALSE = 1T
1200 ///< TRUE = 2T
1201 ///< The following pointers will be pointed to dynamically allocated buffers.
1202 ///< Each buffer is two dimensional (RowCount x ColumnCount) and is lay-outed as in below.
1203 ///< Example: If DIMM and Byte based training, then
1204 ///< XX is a value in Hex
1205 ///< BYTE 0, BYTE 1, BYTE 2, BYTE 3, BYTE 4, BYTE 5, BYTE 6, BYTE 7, ECC BYTE
1206 ///< Row1 - Logical DIMM0 XX XX XX XX XX XX XX XX XX
1207 ///< Row2 - Logical DIMM1 XX XX XX XX XX XX XX XX XX
1208 OUT UINT16 *RcvEnDlys; ///< DQS Receiver Enable Delays
1209 OUT UINT8 *WrDqsDlys; ///< Write DQS delays (only valid for DDR3)
1210 OUT UINT8 *RdDqsDlys; ///< Read Dqs delays
1211 OUT UINT8 *WrDatDlys; ///< Write Data delays
1212 OUT UINT8 *RdDqsMinDlys; ///< Minimum Window for Read DQS
1213 OUT UINT8 *RdDqsMaxDlys; ///< Maximum Window for Read DQS
1214 OUT UINT8 *WrDatMinDlys; ///< Minimum Window for Write data
1215 OUT UINT8 *WrDatMaxDlys; ///< Maximum Window for Write data
1216 OUT UINT8 RowCount; ///< Number of rows of the allocated buffer.
1217 OUT UINT8 ColumnCount; ///< Number of columns of the allocated buffer.
1218 OUT UINT8 *FailingBitMask; ///< Table of masks to Track Failing bits
1219 OUT UINT32 DctOdcCtl; ///< Output Driver Strength (see BKDG FN2:Offset 9Ch, index 00h)
1220 OUT UINT32 DctAddrTmg; ///< Address Bus Timing (see BKDG FN2:Offset 9Ch, index 04h)
1221 OUT UINT32 PhyRODTCSLow; ///< Phy Read ODT Pattern Chip Select low (see BKDG FN2:Offset 9Ch, index 180h)
1222 OUT UINT32 PhyRODTCSHigh; ///< Phy Read ODT Pattern Chip Select high (see BKDG FN2:Offset 9Ch, index 181h)
1223 OUT UINT32 PhyWODTCSLow; ///< Phy Write ODT Pattern Chip Select low (see BKDG FN2:Offset 9Ch, index 182h)
1224 OUT UINT32 PhyWODTCSHigh; ///< Phy Write ODT Pattern Chip Select high (see BKDG FN2:Offset 9Ch, index 183)
1225 OUT UINT8 PhyWLODT[4]; ///< Write Levelization ODT Pattern for Dimm 0-3 (see BKDG FN2:Offset 9Ch, index 0x8[11:8])
1226 OUT UINT16 DctEccDqsLike; ///< DCT DQS ECC UINT8 like...
1227 OUT UINT8 DctEccDqsScale; ///< DCT DQS ECC UINT8 scale
1228 OUT UINT16 PtrPatternBufA; ///< Ptr on stack to aligned DQS testing pattern
1229 OUT UINT16 PtrPatternBufB; ///< Ptr on stack to aligned DQS testing pattern
1230 OUT UINT8 ByteLane; ///< Current UINT8 Lane (0..7)
1231 OUT UINT8 Direction; ///< Current DQS-DQ training write direction (0=read, 1=write)
1232 OUT UINT8 Pattern; ///< Current pattern
1233 OUT UINT8 DqsDelay; ///< Current DQS delay value
1234 OUT UINT16 HostBiosSrvc1; ///< UINT16 sized general purpose field for use by host BIOS. Scratch space.
1235 OUT UINT32 HostBiosSrvc2; ///< UINT32 sized general purpose field for use by host BIOS. Scratch space.
1236 OUT UINT16 DctMaxRdLat; ///< Max Read Latency (ns) for the DCT
1237 OUT UINT8 DIMMValidCh; ///< DIMM# in CH
1238 OUT UINT8 MaxCh; ///< Max number of CH in system
1239 OUT UINT8 Dct; ///< Dct pointer
1240 OUT UINT8 WrDatGrossH; ///< Write Data Gross delay high value
1241 OUT UINT8 DqsRcvEnGrossL; ///< DQS Receive Enable Gross Delay low
1242
1243 OUT UINT8 TrwtWB; ///< Non-SPD timing value for TrwtWB
1244 OUT UINT8 CurrRcvrDctADelay; ///< for keep current RcvrEnDly
1245 OUT UINT16 T1000; ///< get the T1000 figure (cycle time (ns) * 1K)
1246 OUT UINT8 DqsRcvEnPass; ///< for TrainRcvrEn UINT8 lane pass flag
1247 OUT UINT8 DqsRcvEnSaved; ///< for TrainRcvrEn UINT8 lane saved flag
1248 OUT UINT8 SeedPass1Remainder; ///< for Phy assisted DQS receiver enable training
1249
1250 OUT UINT8 ClToNbFlag; ///< is used to restore ClLinesToNbDis bit after memory
1251 OUT UINT32 NodeSysBase; ///< for channel interleave usage
1252 OUT UINT8 RefRawCard[MAX_DIMMS_PER_CHANNEL]; ///< Array of rawcards detected
1253 OUT UINT8 CtrlWrd02[MAX_DIMMS_PER_CHANNEL]; ///< Control Word 2 values per DIMM
1254 OUT UINT8 CtrlWrd03[MAX_DIMMS_PER_CHANNEL]; ///< Control Word 3 values per DIMM
1255 OUT UINT8 CtrlWrd04[MAX_DIMMS_PER_CHANNEL]; ///< Control Word 4 values per DIMM
1256 OUT UINT8 CtrlWrd05[MAX_DIMMS_PER_CHANNEL]; ///< Control Word 5 values per DIMM
1257 OUT UINT8 CtrlWrd08[MAX_DIMMS_PER_CHANNEL]; ///< Control Word 8 values per DIMM
1258
1259 OUT UINT16 CsPresentDCT; ///< For each bit n 0..7, 1 = Chip-select n is present
1260 OUT UINT8 DimmMirrorPresent; ///< For each bit n 0..3, 1 = DIMM n is OnDimmMirror capable where 4..7 are reserved.
1261 OUT UINT8 DimmSpdCse; ///< For each bit n 0..3, 1 = DIMM n SPD checksum error where 4..7 are reserved.
1262 OUT UINT8 DimmExclude; ///< For each bit n 0..3, 1 = DIMM n gets excluded where 4..7 are reserved.
1263 OUT UINT8 DimmYr06; ///< Bitmap indicating which Dimms have a manufacturer's year code <= 2006
1264 OUT UINT8 DimmWk2406; ///< Bitmap indicating which Dimms have a manufacturer's week code <= 24 of 2006 (June)
1265 OUT UINT8 DimmPlPresent; ///< Bitmap indicating that Planar (1) or Stacked (0) Dimms are present.
1266 OUT UINT8 DimmQrPresent; ///< QuadRank DIMM present?
1267 OUT UINT8 DimmDrPresent; ///< Bitmap indicating that Dual Rank Dimms are present
1268 OUT UINT8 DimmSRPresent; ///< Bitmap indicating that Single Rank Dimms are present
1269 OUT UINT8 Dimmx4Present; ///< For each bit n 0..3, 1 = DIMM n contains x4 data devices. where 4..7 are reserved.
1270 OUT UINT8 Dimmx8Present; ///< For each bit n 0..3, 1 = DIMM n contains x8 data devices. where 4..7 are reserved.
1271 OUT UINT8 Dimmx16Present; ///< For each bit n 0..3, 1 = DIMM n contains x16 data devices. where 4..7 are reserved.
1272 OUT UINT8 LrdimmPhysicalRanks[MAX_DIMMS_PER_CHANNEL];///< Number of Physical Ranks for LRDIMMs
1273 OUT UINT8 LrDimmLogicalRanks[MAX_DIMMS_PER_CHANNEL];///< Number of LRDIMM Logical ranks in this configuration
1274 OUT UINT8 LrDimmRankMult[MAX_DIMMS_PER_CHANNEL];///< Rank Multipication factor per dimm.
1275
1276 OUT UINT8 *MemClkDisMap; ///< This pointer will be set to point to an array that describes
1277 ///< the routing of M[B,A]_CLK pins to the DIMMs' ranks. AGESA will
1278 ///< base on this array to disable unused MemClk to save power.
1279 ///<
1280 ///< The array must have 8 entries. Each entry, which associates with
1281 ///< one MemClkDis bit, is a bitmap of 8 CS that that MemClk is routed to.
1282 ///< Example:
1283 ///< BKDG definition of Fn2x88[MemClkDis] bitmap for AM3 package
1284 ///< is like below:
1285 ///< Bit AM3/S1g3 pin name
1286 ///< 0 M[B,A]_CLK_H/L[0]
1287 ///< 1 M[B,A]_CLK_H/L[1]
1288 ///< 2 M[B,A]_CLK_H/L[2]
1289 ///< 3 M[B,A]_CLK_H/L[3]
1290 ///< 4 M[B,A]_CLK_H/L[4]
1291 ///< 5 M[B,A]_CLK_H/L[5]
1292 ///< 6 M[B,A]_CLK_H/L[6]
1293 ///< 7 M[B,A]_CLK_H/L[7]
1294 ///< And platform has the following routing:
1295 ///< CS0 M[B,A]_CLK_H/L[4]
1296 ///< CS1 M[B,A]_CLK_H/L[2]
1297 ///< CS2 M[B,A]_CLK_H/L[3]
1298 ///< CS3 M[B,A]_CLK_H/L[5]
1299 ///< Then MemClkDisMap should be pointed to the following array:
1300 ///< CLK_2 CLK_3 CLK_4 CLK_5
1301 ///< 0x00, 0x00, 0x02, 0x04, 0x01, 0x08, 0x00, 0x00
1302 ///< Each entry of the array is the bitmask of 8 chip selects.
1303
1304 OUT UINT8 *CKETriMap; ///< This pointer will be set to point to an array that describes
1305 ///< the routing of CKE pins to the DIMMs' ranks.
1306 ///< The array must have 2 entries. Each entry, which associates with
1307 ///< one CKE pin, is a bitmap of 8 CS that that CKE is routed to.
1308 ///< AGESA will base on this array to disable unused CKE pins to save power.
1309
1310 OUT UINT8 *ODTTriMap; ///< This pointer will be set to point to an array that describes
1311 ///< the routing of ODT pins to the DIMMs' ranks.
1312 ///< The array must have 4 entries. Each entry, which associates with
1313 ///< one ODT pin, is a bitmap of 8 CS that that ODT is routed to.
1314 ///< AGESA will base on this array to disable unused ODT pins to save power.
1315
1316 OUT UINT8 *ChipSelTriMap; ///< This pointer will be set to point to an array that describes
1317 ///< the routing of chip select pins to the DIMMs' ranks.
1318 ///< The array must have 8 entries. Each entry is a bitmap of 8 CS.
1319 ///< AGESA will base on this array to disable unused Chip select pins to save power.
1320
1321 OUT BOOLEAN ExtendTmp; ///< If extended temperature is supported on all dimms on a channel.
1322
1323 OUT UINT8 Reserved[100]; ///< Reserved
1324} CH_DEF_STRUCT;
1325
1326///
1327/// DCT Channel Timing Parameters.
1328/// This data structure sets timings that are specific to the channel.
1329///
1330typedef struct _CH_TIMING_STRUCT {
1331 OUT UINT16 DctDimmValid; ///< For each bit n 0..3, 1=DIMM n is valid and is/will be configured where 4..7 are reserved.
1332 OUT UINT16 DimmMirrorPresent; ///< For each bit n 0..3, 1=DIMM n is OnDimmMirror capable where 4..7 are reserved.
1333 OUT UINT16 DimmSpdCse; ///< For each bit n 0..3, 1=DIMM n SPD checksum error where 4..7 are reserved.
1334 OUT UINT16 DimmExclude; ///< For each bit n 0..3, 1 = DIMM n gets excluded where 4..7 are reserved.
1335 OUT UINT16 CsPresent; ///< For each bit n 0..7, 1=Chip-select n is present
1336 OUT UINT16 CsEnabled; ///< For each bit n 0..7, 1=Chip-select n is enabled
1337 OUT UINT16 CsTestFail; ///< For each bit n 0..7, 1=Chip-select n is present but disabled
1338 OUT UINT16 CsTrainFail; ///< Bitmap showing which chipselects failed training
1339 OUT UINT16 DIMM1KPage; ///< For each bit n 0..3, 1=DIMM n contains 1K page devices. where 4..7 are reserved
1340 OUT UINT16 DimmQrPresent; ///< QuadRank DIMM present?
1341 OUT UINT16 DimmDrPresent; ///< Bitmap indicating that Dual Rank Dimms are present , where 4..7 are reserved
1342 OUT UINT8 DimmSRPresent; ///< Bitmap indicating that Single Rank Dimms are present, where 4..7 are reserved
1343 OUT UINT16 Dimmx4Present; ///< For each bit n 0..3, 1=DIMM n contains x4 data devices. where 4..7 are reserved
1344 OUT UINT16 Dimmx8Present; ///< For each bit n 0..3, 1=DIMM n contains x8 data devices. where 4..7 are reserved
1345 OUT UINT16 Dimmx16Present; ///< For each bit n 0..3, 1=DIMM n contains x16 data devices. where 4..7 are reserved
1346
1347 OUT UINT16 DIMMTrcd; ///< Minimax Trcd*40 (ns) of DIMMs
1348 OUT UINT16 DIMMTrp; ///< Minimax Trp*40 (ns) of DIMMs
1349 OUT UINT16 DIMMTrtp; ///< Minimax Trtp*40 (ns) of DIMMs
1350 OUT UINT16 DIMMTras; ///< Minimax Tras*40 (ns) of DIMMs
1351 OUT UINT16 DIMMTrc; ///< Minimax Trc*40 (ns) of DIMMs
1352 OUT UINT16 DIMMTwr; ///< Minimax Twr*40 (ns) of DIMMs
1353 OUT UINT16 DIMMTrrd; ///< Minimax Trrd*40 (ns) of DIMMs
1354 OUT UINT16 DIMMTwtr; ///< Minimax Twtr*40 (ns) of DIMMs
1355 OUT UINT16 DIMMTfaw; ///< Minimax Tfaw*40 (ns) of DIMMs
1356 OUT UINT16 TargetSpeed; ///< Target DRAM bus speed in MHz
1357 OUT UINT16 Speed; ///< DRAM bus speed in MHz
1358 ///< 400 (MHz)
1359 ///< 533 (MHz)
1360 ///< 667 (MHz)
1361 ///< 800 (MHz)
1362 ///< and so on...
1363 OUT UINT8 CasL; ///< CAS latency DCT setting (busclocks)
1364 OUT UINT8 Trcd; ///< DCT Trcd (busclocks)
1365 OUT UINT8 Trp; ///< DCT Trp (busclocks)
1366 OUT UINT8 Trtp; ///< DCT Trtp (busclocks)
1367 OUT UINT8 Tras; ///< DCT Tras (busclocks)
1368 OUT UINT8 Trc; ///< DCT Trc (busclocks)
1369 OUT UINT8 Twr; ///< DCT Twr (busclocks)
1370 OUT UINT8 Trrd; ///< DCT Trrd (busclocks)
1371 OUT UINT8 Twtr; ///< DCT Twtr (busclocks)
1372 OUT UINT8 Tfaw; ///< DCT Tfaw (busclocks)
1373 OUT UINT8 Trfc0; ///< DCT Logical DIMM0 Trfc
1374 ///< 0 = 75ns (for 256Mb devs)
1375 ///< 1 = 105ns (for 512Mb devs)
1376 ///< 2 = 127.5ns (for 1Gb devs)
1377 ///< 3 = 195ns (for 2Gb devs)
1378 ///< 4 = 327.5ns (for 4Gb devs)
1379 OUT UINT8 Trfc1; ///< DCT Logical DIMM1 Trfc (see Trfc0 for format)
1380 OUT UINT8 Trfc2; ///< DCT Logical DIMM2 Trfc (see Trfc0 for format)
1381 OUT UINT8 Trfc3; ///< DCT Logical DIMM3 Trfc (see Trfc0 for format)
1382 OUT UINT32 DctMemSize; ///< Base[47:16], total DRAM size controlled by this DCT.
1383 ///<
1384 OUT BOOLEAN SlowMode; ///< 1T or 2T CMD mode (slow access mode)
1385 ///< FALSE = 1T
1386 ///< TRUE = 2T
1387 OUT UINT8 TrwtTO; ///< DCT TrwtTO (busclocks)
1388 OUT UINT8 Twrrd; ///< DCT Twrrd (busclocks)
1389 OUT UINT8 Twrwr; ///< DCT Twrwr (busclocks)
1390 OUT UINT8 Trdrd; ///< DCT Trdrd (busclocks)
1391 OUT UINT8 TrwtWB; ///< DCT TrwtWB (busclocks)
1392 OUT UINT8 TrdrdSD; ///< DCT TrdrdSD (busclocks)
1393 OUT UINT8 TwrwrSD; ///< DCT TwrwrSD (busclocks)
1394 OUT UINT8 TwrrdSD; ///< DCT TwrrdSD (busclocks)
1395 OUT UINT16 MaxRdLat; ///< Max Read Latency
1396 OUT UINT8 WrDatGrossH; ///< Temporary variables must be removed
1397 OUT UINT8 DqsRcvEnGrossL; ///< Temporary variables must be removed
1398} CH_TIMING_STRUCT;
1399
1400///
1401/// Data for each DCT.
1402/// This data structure defines data used to configure each DRAM controller.
1403///
1404typedef struct _DCT_STRUCT {
1405 OUT UINT8 Dct; ///< Current Dct
1406 OUT CH_TIMING_STRUCT Timings; ///< Channel Timing structure
1407 OUT CH_DEF_STRUCT *ChData; ///< Pointed to a dynamically allocated array of Channel structures
1408 OUT UINT8 ChannelCount; ///< Number of channel per this DCT
1409} DCT_STRUCT;
1410
1411
1412///
1413/// Data Structure defining each Die.
1414/// This data structure contains information that is used to configure each Die.
1415///
1416typedef struct _DIE_STRUCT {
1417
1418 /// Advanced:
1419
1420 OUT UINT8 NodeId; ///< Node ID of current controller
1421 OUT UINT8 SocketId; ///< Socket ID of this Die
1422 OUT UINT8 DieId; ///< ID of this die relative to the socket
1423 OUT PCI_ADDR PciAddr; ///< Pci bus and device number of this controller.
1424 OUT AGESA_STATUS ErrCode; ///< Current error condition of Node
1425 ///< 0x0 = AGESA_SUCCESS
1426 ///< 0x1 = AGESA_UNSUPPORTED
1427 ///< 0x2 = AGESA_BOUNDS_CHK
1428 ///< 0x3 = AGESA_ALERT
1429 ///< 0x4 = AGESA_WARNING
1430 ///< 0x5 = AGESA_ERROR
1431 ///< 0x6 = AGESA_CRITICAL
1432 ///< 0x7 = AGESA_FATAL
1433 ///<
1434 OUT BOOLEAN ErrStatus[EsbEOL]; ///< Error Status bit Field
1435 ///<
1436 OUT BOOLEAN Status[SbEOL]; ///< Status bit Field
1437 ///<
1438 OUT UINT32 NodeMemSize; ///< Base[47:16], total DRAM size controlled by both DCT0 and DCT1 of this Node.
1439 ///<
1440 OUT UINT32 NodeSysBase; ///< Base[47:16] (system address) DRAM base address of this Node.
1441 ///<
1442 OUT UINT32 NodeHoleBase; ///< If not zero, Base[47:16] (system address) of dram hole for HW remapping. Dram hole exists on this Node
1443 ///<
1444 OUT UINT32 NodeSysLimit; ///< Base[47:16] (system address) DRAM limit address of this Node.
1445 ///<
1446 OUT UINT32 DimmPresent; ///< For each bit n 0..7, 1 = DIMM n is present.
1447 ///< DIMM# Select Signal
1448 ///< 0 MA0_CS_L[0, 1]
1449 ///< 1 MB0_CS_L[0, 1]
1450 ///< 2 MA1_CS_L[0, 1]
1451 ///< 3 MB1_CS_L[0, 1]
1452 ///< 4 MA2_CS_L[0, 1]
1453 ///< 5 MB2_CS_L[0, 1]
1454 ///< 6 MA3_CS_L[0, 1]
1455 ///< 7 MB3_CS_L[0, 1]
1456 ///<
1457 OUT UINT32 DimmValid; ///< For each bit n 0..7, 1 = DIMM n is valid and is / will be configured
1458 OUT UINT32 RegDimmPresent; ///< For each bit n 0..7, 1 = DIMM n is registered DIMM
1459 OUT UINT32 LrDimmPresent; ///< For each bit n 0..7, 1 = DIMM n is Load Reduced DIMM
1460 OUT UINT32 DimmEccPresent; ///< For each bit n 0..7, 1 = DIMM n is ECC capable.
1461 OUT UINT32 DimmParPresent; ///< For each bit n 0..7, 1 = DIMM n is ADR/CMD Parity capable.
1462 ///<
1463 OUT UINT16 DimmTrainFail; ///< Bitmap showing which dimms failed training
1464 OUT UINT16 ChannelTrainFail; ///< Bitmap showing the channel information about failed Chip Selects
1465 ///< 0 in any bit field indicates Channel 0
1466 ///< 1 in any bit field indicates Channel 1
1467 OUT UINT8 Dct; ///< Need to be removed
1468 ///< DCT pointer
1469 OUT BOOLEAN GangedMode; ///< Ganged mode
1470 ///< 0 = disabled
1471 ///< 1 = enabled
1472 OUT CPU_LOGICAL_ID LogicalCpuid; ///< The logical CPUID of the node
1473 ///<
1474 OUT UINT16 HostBiosSrvc1; ///< UINT16 sized general purpose field for use by host BIOS. Scratch space.
1475 ///<
1476 OUT UINT32 HostBiosSrvc2; ///< UINT32 sized general purpose field for use by host BIOS. Scratch space.
1477 ///<
1478 OUT UINT8 MLoad; ///< Need to be removed
1479 ///< Number of devices loading MAA bus
1480 ///<
1481 OUT UINT8 MaxAsyncLat; ///< Legacy wrapper
1482 ///<
1483 OUT UINT8 ChbD3Rcvrdly; ///< Legacy wrapper
1484 ///<
1485 OUT UINT16 ChaMaxRdLat; ///< Max Read Latency (ns) for DCT 0
1486 ///<
1487 OUT UINT8 ChbD3BcRcvrdly; ///< CHB DIMM 3 Check UINT8 Receiver Enable Delay
1488
1489 OUT DCT_STRUCT *DctData; ///< Pointed to a dynamically allocated array of DCT_STRUCTs
1490 OUT UINT8 DctCount; ///< Number of DCTs per this Die
1491 OUT UINT8 Reserved[16]; ///< Reserved
1492} DIE_STRUCT;
1493
1494/**********************************************************************
1495 * S3 Support structure
1496 **********************************************************************/
1497/// AmdInitResume, AmdS3LateRestore, and AmdS3Save param structure
1498typedef struct {
1499 OUT UINT32 Signature; ///< "ASTR" for AMD Suspend-To-RAM
1500 OUT UINT16 Version; ///< S3 Params version number
1501 IN OUT UINT32 Flags; ///< Indicates operation
1502 IN OUT VOID *NvStorage; ///< Pointer to memory critical save state data
1503 IN OUT UINT32 NvStorageSize; ///< Size in bytes of the NvStorage region
1504 IN OUT VOID *VolatileStorage; ///< Pointer to remaining AMD save state data
1505 IN OUT UINT32 VolatileStorageSize; ///< Size in bytes of the VolatileStorage region
1506} AMD_S3_PARAMS;
1507
1508///===============================================================================
1509/// MEM_PARAMETER_STRUCT
1510/// This data structure is used to pass wrapper parameters to the memory configuration code
1511///
1512typedef struct _MEM_PARAMETER_STRUCT {
1513
1514 // Basic (Return parameters)
1515 // (This section contains the outbound parameters from the memory init code)
1516
1517 OUT BOOLEAN GStatus[GsbEOL]; ///< Global Status bitfield.
1518 ///<
1519 OUT UINT32 HoleBase; ///< If not zero Base[47:16] (system address) of sub 4GB dram hole for HW remapping.
1520 ///<
1521 OUT UINT32 Sub4GCacheTop; ///< If not zero, the 32-bit top of cacheable memory.
1522 ///<
1523 OUT UINT32 SysLimit; ///< Limit[47:16] (system address).
1524 ///<
1525
1526 OUT DIMM_VOLTAGE DDR3Voltage; ///< Find support voltage and send back to platform BIOS.
1527 ///< 0 = 1.5v
1528 ///< 1 = 1.35v
1529 ///< 2 = 1.2v
1530 ///< 0xFF = Mixed 1.5V and 1.2V in the system. 1.5V dimms get excluded
1531 ///< from the system.
1532 ///<
1533
1534 OUT struct _MEM_DATA_STRUCT *MemData; ///< Access to global memory init data.
1535
1536 // Advanced (Optional parameters)
1537 // Optional (all defaults values will be initialized by the
1538 // 'AmdMemInitDataStructDef' based on AMD defaults. It is up
1539 // to the IBV/OEM to change the defaults after initialization
1540 // but prior to the main entry to the memory code):
1541
1542 // Memory Map/Mgt.
1543
1544 IN UINT16 BottomIo; ///< Bottom of 32-bit IO space (8-bits).
1545 ///< NV_BOTTOM_IO[7:0]=Addr[31:24]
1546 ///<
1547 IN BOOLEAN MemHoleRemapping; ///< Memory Hole Remapping (1-bit).
1548 ///< FALSE = disable
1549 ///< TRUE = enable
1550
1551
1552 // Dram Timing
1553
1554 IN USER_MEMORY_TIMING_MODE UserTimingMode; ///< User Memclock Mode.
1555 ///< @BldCfgItem{BLDCFG_TIMING_MODE_SELECT}
1556
1557 IN MEMORY_BUS_SPEED MemClockValue; ///< Memory Clock Value.
1558 ///< @BldCfgItem{BLDCFG_MEMORY_CLOCK_SELECT}
1559
1560
1561 // Dram Configuration
1562
1563 IN BOOLEAN EnableBankIntlv; ///< Dram Bank (chip-select) Interleaving (1-bit).
1564 ///< - FALSE =disable (default)
1565 ///< - TRUE = enable
1566 ///<
1567 ///< @BldCfgItem{BLDCFG_MEMORY_ENABLE_BANK_INTERLEAVING}
1568
1569 IN BOOLEAN EnableNodeIntlv; ///< Node Memory Interleaving (1-bit).
1570 ///< - FALSE = disable (default)
1571 ///< - TRUE = enable
1572 ///<
1573 ///< @BldCfgItem{BLDCFG_MEMORY_ENABLE_NODE_INTERLEAVING}
1574
1575 IN BOOLEAN EnableChannelIntlv; ///< Channel Interleaving (1-bit).
1576 ///< - FALSE = disable (default)
1577 ///< - TRUE = enable
1578 ///<
1579 ///< @BldCfgItem{BLDCFG_MEMORY_CHANNEL_INTERLEAVING}
1580 // ECC
1581
1582 IN BOOLEAN EnableEccFeature; ///< enable ECC error to go into MCE.
1583 ///< - FALSE = disable (default)
1584 ///< - TRUE = enable
1585 ///<
1586 ///< @BldCfgItem{BLDCFG_ENABLE_ECC_FEATURE}
1587 // Dram Power
1588
1589 IN BOOLEAN EnablePowerDown; ///< CKE based power down mode (1-bit).
1590 ///< - FALSE =disable (default)
1591 ///< - TRUE =enable
1592 ///<
1593 ///< @BldCfgItem{BLDCFG_MEMORY_POWER_DOWN}
1594
1595 // Online Spare
1596
1597 IN BOOLEAN EnableOnLineSpareCtl; ///< Chip Select Spare Control bit 0.
1598 ///< - FALSE = disable Spare (default)
1599 ///< - TRUE = enable Spare
1600 ///<
1601 ///< @BldCfgItem{BLDCFG_ONLINE_SPARE}
1602
1603 IN UINT8 *TableBasedAlterations; ///< Desired modifications to register settings.
1604
1605 IN PSO_TABLE *PlatformMemoryConfiguration;
1606 ///< A table that contains platform specific settings.
1607 ///< For example, MemClk routing, the number of DIMM slots per channel, ....
1608 ///< AGESA initializes this pointer with DefaultPlatformMemoryConfiguration that
1609 ///< contains default conservative settings. Platform BIOS can either tweak
1610 ///< DefaultPlatformMemoryConfiguration or reassign this pointer to its own table.
1611 ///<
1612 IN BOOLEAN EnableParity; ///< Parity control.
1613 ///< - TRUE = enable
1614 ///< - FALSE = disable (default)
1615 ///<
1616 ///< @BldCfgItem{BLDCFG_MEMORY_PARITY_ENABLE}
1617
1618 IN BOOLEAN EnableBankSwizzle; ///< BankSwizzle control.
1619 ///< - FALSE = disable
1620 ///< - TRUE = enable (default)
1621 ///<
1622 ///< @BldCfgItem{BLDCFG_BANK_SWIZZLE}
1623
1624 ///<
1625
1626 IN BOOLEAN EnableMemClr; ///< Memory Clear functionality control.
1627 ///< - FALSE = disable
1628 ///< - TRUE = enable (default)
1629 ///<
1630
1631 // Uma Configuration
1632
1633 IN UMA_MODE UmaMode; ///< Uma Mode
1634 ///< 0 = None
1635 ///< 1 = Specified
1636 ///< 2 = Auto
1637 IN OUT UINT32 UmaSize; ///< The size of shared graphics dram (16-bits)
1638 ///< NV_UMA_Size[31:0]=Addr[47:16]
1639 ///<
1640 OUT UINT32 UmaBase; ///< The allocated Uma base address (32-bits)
1641 ///< NV_UMA_Base[31:0]=Addr[47:16]
1642 ///<
1643
1644 /// Memory Restore Feature
1645
1646 IN BOOLEAN MemRestoreCtl; ///< Memory context restore control
1647 ///< FALSE = perform memory init as normal (AMD default)
1648 ///< TRUE = restore memory context and skip training. This requires
1649 ///< MemContext is valid before AmdInitPost
1650 ///<
1651 IN BOOLEAN SaveMemContextCtl; ///< Control switch to save memory context at the end of MemAuto
1652 ///< TRUE = AGESA will setup MemContext block before exit AmdInitPost
1653 ///< FALSE = AGESA will not setup MemContext block. Platform is
1654 ///< expected to call S3Save later in POST if it wants to
1655 ///< use memory context restore feature.
1656 ///<
1657 IN OUT AMD_S3_PARAMS MemContext; ///< Memory context block describes the data that platform needs to
1658 ///< save and restore for memory context restore feature to work.
1659 ///< It uses the subset of S3Save block to save/restore. Hence platform
1660 ///< may save only S3 block and uses it for both S3 resume and
1661 ///< memory context restore.
1662 ///< - If MemRestoreCtl is TRUE, platform needs to pass in MemContext
1663 ///< before AmdInitPost.
1664 ///< - If SaveMemContextCtl is TRUE, platform needs to save MemContext
1665 ///< right after AmdInitPost.
1666 ///<
1667} MEM_PARAMETER_STRUCT;
1668
1669
1670///
1671/// Function definition.
1672/// This data structure passes function pointers to the memory configuration code.
1673/// The wrapper can use this structure with customized versions.
1674///
1675typedef struct _MEM_FUNCTION_STRUCT {
1676
1677 // PUBLIC required Internal functions
1678
1679 IN OUT BOOLEAN (*amdMemGetPsCfgU) ( VOID *pMemData); ///< Proc for Unbuffered DIMMs, platform specific
1680 IN OUT BOOLEAN (*amdMemGetPsCfgR) (VOID *pMemData); ///< Proc for Registered DIMMs, platform specific
1681
1682 // PUBLIC optional functions
1683
1684 IN OUT VOID (*amdMemEccInit) (VOID *pMemData); ///< NB proc for ECC feature
1685 IN OUT VOID (*amdMemChipSelectInterleaveInit) (VOID *pMemData); ///< NB proc for CS interleave feature
1686 IN OUT VOID (*amdMemDctInterleavingInit) (VOID *pMemData); ///< NB proc for Channel interleave feature
1687 IN OUT VOID (*amdMemMctInterleavingInit) (VOID *pMemData); ///< NB proc for Node interleave feature
1688 IN OUT VOID (*amdMemParallelTraining) (VOID *pMemData); ///< NB proc for parallel training feature
1689 IN OUT VOID (*amdMemEarlySampleSupport) (VOID *pMemData); ///< NB code for early sample support feature
1690 IN OUT VOID (*amdMemMultiPartInitSupport) (VOID *pMemData); ///< NB code for 'multi-part'
1691 IN OUT VOID (*amdMemOnlineSpareSupport) (VOID *pMemData); ///< NB code for On-Line Spare feature
1692 IN OUT VOID (*amdMemUDimmInit) (VOID *pMemData); ///< NB code for UDIMMs
1693 IN OUT VOID (*amdMemRDimmInit) (VOID *pMemData); ///< NB code for RDIMMs
1694 IN OUT VOID (*amdMemLrDimmInit) (VOID *pMemData); ///< NB code for LRDIMMs
1695
1696 IN OUT UINT32 Reserved[100]; ///< Reserved for later function definition
1697} MEM_FUNCTION_STRUCT;
1698
1699///
1700/// Socket Structure
1701///
1702///
1703typedef struct _MEM_SOCKET_STRUCT {
1704 OUT VOID *ChannelPtr[MAX_CHANNELS_PER_SOCKET]; ///< Pointers to each channels training data
1705
1706 OUT VOID *TimingsPtr[MAX_CHANNELS_PER_SOCKET]; ///< Pointers to each channels timing data
1707} MEM_SOCKET_STRUCT;
1708
1709///
1710/// Contains all data relevant to Memory Initialization.
1711///
1712typedef struct _MEM_DATA_STRUCT {
1713 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
1714
1715 IN MEM_PARAMETER_STRUCT *ParameterListPtr; ///< List of input Parameters
1716
1717 OUT MEM_FUNCTION_STRUCT FunctionList; ///< List of function Pointers
1718
1719 IN OUT AGESA_STATUS (*GetPlatformCfg[MAX_PLATFORM_TYPES]) (struct _MEM_DATA_STRUCT *MemData, UINT8 SocketID, CH_DEF_STRUCT *CurrentChannel); ///< look-up platform info
1720
1721 IN OUT BOOLEAN (*ErrorHandling)(struct _DIE_STRUCT *MCTPtr, UINT8 DCT, UINT16 ChipSelMask, AMD_CONFIG_PARAMS *StdHeader); ///< Error Handling
1722
1723
1724 OUT MEM_SOCKET_STRUCT SocketList[MAX_SOCKETS_SUPPORTED]; ///< Socket list for memory code.
1725 ///< SocketList is a shortcut for IBVs to retrieve training
1726 ///< and timing data for each channel indexed by socket/channel,
1727 ///< eliminating their need to parse die/dct/channel etc.
1728 ///< It contains pointers to the populated data structures for
1729 ///< each channel and skips the channel structures that are
1730 ///< unpopulated. In the case of channels sharing the same DCT,
1731 ///< the pTimings pointers will point to the same DCT Timing data.
1732
1733 OUT DIE_STRUCT *DiesPerSystem; ///< Pointed to an array of DIE_STRUCTs
1734 OUT UINT8 DieCount; ///< Number of MCTs in the system.
1735
1736 IN SPD_DEF_STRUCT *SpdDataStructure; ///< Pointer to SPD Data structure
1737
1738 IN OUT struct _PLATFORM_CONFIGURATION *PlatFormConfig; ///< Platform profile/build option config structure
1739
1740 IN OUT BOOLEAN IsFlowControlSupported; ///< Indicates if flow control is supported
1741
1742 OUT UINT32 TscRate; ///< The rate at which the TSC increments in megahertz.
1743
1744} MEM_DATA_STRUCT;
1745
1746///
1747/// Uma Structure
1748///
1749///
1750typedef struct _UMA_INFO {
1751 OUT UINT64 UmaBase; ///< UmaBase[63:0] = Addr[63:0]
1752 OUT UINT32 UmaSize; ///< UmaSize[31:0] = Addr[31:0]
1753 OUT UINT32 UmaAttributes; ///< Indicate the attribute of Uma
1754 OUT UINT8 UmaMode; ///< Indicate the mode of Uma
1755 OUT UINT16 MemClock; ///< Indicate memory running speed in MHz
1756 OUT UINT8 Reserved[3]; ///< Reserved for future usage
1757} UMA_INFO;
1758
1759// AGESA MEMORY ERRORS
1760
1761// AGESA_ALERT Memory Errors
1762#define MEM_ALERT_USER_TMG_MODE_OVERRULED 0x04010000 ///< TIMING_MODE_SPECIFIC is requested but
1763 ///< cannot be applied to current configurations.
1764#define MEM_ALERT_ORG_MISMATCH_DIMM 0x04010100 ///< DIMM organization miss-match
1765#define MEM_ALERT_BK_INT_DIS 0x04010200 ///< Bank interleaving disable for internal issue
1766
1767// AGESA_ERROR Memory Errors
1768#define MEM_ERROR_NO_DQS_POS_RD_WINDOW 0x04010300 ///< No DQS Position window for RD DQS
1769#define MEM_ERROR_SMALL_DQS_POS_RD_WINDOW 0x04020300 ///< Small DQS Position window for RD DQS
1770#define MEM_ERROR_NO_DQS_POS_WR_WINDOW 0x04030300 ///< No DQS Position window for WR DQS
1771#define MEM_ERROR_SMALL_DQS_POS_WR_WINDOW 0x04040300 ///< Small DQS Position window for WR DQS
1772#define MEM_ERROR_ECC_DIS 0x04010400 ///< ECC has been disabled as a result of an internal issue
1773#define MEM_ERROR_DIMM_SPARING_NOT_ENABLED 0x04010500 ///< DIMM sparing has not been enabled for an internal issues
1774#define MEM_ERROR_RCVR_EN_VALUE_TOO_LARGE 0x04050300 ///< Receive Enable value is too large
1775#define MEM_ERROR_RCVR_EN_NO_PASSING_WINDOW 0x04060300 ///< There is no DQS receiver enable window
1776#define MEM_ERROR_DRAM_ENABLED_TIME_OUT 0x04010600 ///< Time out when polling DramEnabled bit
1777#define MEM_ERROR_DCT_ACCESS_DONE_TIME_OUT 0x04010700 ///< Time out when polling DctAccessDone bit
1778#define MEM_ERROR_SEND_CTRL_WORD_TIME_OUT 0x04010800 ///< Time out when polling SendCtrlWord bit
1779#define MEM_ERROR_PREF_DRAM_TRAIN_MODE_TIME_OUT 0x04010900 ///< Time out when polling PrefDramTrainMode bit
1780#define MEM_ERROR_ENTER_SELF_REF_TIME_OUT 0x04010A00 ///< Time out when polling EnterSelfRef bit
1781#define MEM_ERROR_FREQ_CHG_IN_PROG_TIME_OUT 0x04010B00 ///< Time out when polling FreqChgInProg bit
1782#define MEM_ERROR_EXIT_SELF_REF_TIME_OUT 0x04020A00 ///< Time out when polling ExitSelfRef bit
1783#define MEM_ERROR_SEND_MRS_CMD_TIME_OUT 0x04010C00 ///< Time out when polling SendMrsCmd bit
1784#define MEM_ERROR_SEND_ZQ_CMD_TIME_OUT 0x04010D00 ///< Time out when polling SendZQCmd bit
1785#define MEM_ERROR_DCT_EXTRA_ACCESS_DONE_TIME_OUT 0x04010E00 ///< Time out when polling DctExtraAccessDone bit
1786#define MEM_ERROR_MEM_CLR_BUSY_TIME_OUT 0x04010F00 ///< Time out when polling MemClrBusy bit
1787#define MEM_ERROR_MEM_CLEARED_TIME_OUT 0x04020F00 ///< Time out when polling MemCleared bit
1788#define MEM_ERROR_FLUSH_WR_TIME_OUT 0x04011000 ///< Time out when polling FlushWr bit
1789#define MEM_ERROR_MAX_LAT_NO_WINDOW 0x04070300 ///< Fail to find pass during Max Rd Latency training
1790#define MEM_ERROR_PARALLEL_TRAINING_LAUNCH_FAIL 0x04080300 ///< Fail to launch training code on an AP
1791#define MEM_ERROR_PARALLEL_TRAINING_TIME_OUT 0x04090300 ///< Fail to finish parallel training
1792#define MEM_ERROR_NO_ADDRESS_MAPPING 0x04011100 ///< No address mapping found for a dimm
1793#define MEM_ERROR_RCVR_EN_NO_PASSING_WINDOW_EQUAL_LIMIT 0x040A0300 ///< There is no DQS receiver enable window and the value is equal to the largest value
1794#define MEM_ERROR_RCVR_EN_VALUE_TOO_LARGE_LIMIT_LESS_ONE 0x040B0300 ///< Receive Enable value is too large and is 1 less than limit
1795#define MEM_ERROR_CHECKSUM_NV_SPDCHK_RESTRT_ERROR 0x04011200 ///< SPD Checksum error for NV_SPDCHK_RESTRT
1796#define MEM_ERROR_NO_CHIPSELECT 0x04011300 ///< No chipselects found
1797#define MEM_ERROR_UNSUPPORTED_333MHZ_UDIMM 0x04011500 ///< Unbuffered dimm is not supported at 333MHz
1798#define MEM_ERROR_WL_PRE_OUT_OF_RANGE 0x040C0300 ///< Returned PRE value during write levelizzation was out of range
1799
1800// AGESA_WARNING Memory Errors
1801#define MEM_WARNING_UNSUPPORTED_QRDIMM 0x04011600 ///< QR DIMMs detected but not supported
1802#define MEM_WARNING_UNSUPPORTED_UDIMM 0x04021600 ///< U DIMMs detected but not supported
1803#define MEM_WARNING_UNSUPPORTED_SODIMM 0x04031600 ///< SO-DIMMs detected but not supported
1804#define MEM_WARNING_UNSUPPORTED_X4DIMM 0x04041600 ///< x4 DIMMs detected but not supported
1805#define MEM_WARNING_UNSUPPORTED_RDIMM 0x04051600 ///< R DIMMs detected but not supported
1806#define MEM_WARNING_UNSUPPORTED_LRDIMM 0x04061600 ///< LR DIMMs detected but not supported
1807#define MEM_WARNING_EMP_NOT_SUPPORTED 0x04011700 ///< Processor is not capable for EMP
1808#define MEM_WARNING_EMP_CONFLICT 0x04021700 ///< EMP cannot be enabled if channel interleaving,
1809#define MEM_WARNING_EMP_NOT_ENABLED 0x04031700 ///< Memory size is not power of two.
1810#define MEM_WARNING_PERFORMANCE_ENABLED_BATTERY_LIFE_PREFERRED 0x04011800 ///< Performance has been enabled, but battery life is preferred.
1811 ///< bank interleaving, or bank swizzle is enabled.
1812#define MEM_WARNING_NO_SPDTRC_FOUND 0x04011900 ///< No Trc timing value found in SPD of a dimm.
1813#define MEM_WARNING_NODE_INTERLEAVING_NOT_ENABLED 0x04012000 ///< Node Interleaveing Requested, but could not be enabled
1814#define MEM_WARNING_CHANNEL_INTERLEAVING_NOT_ENABLED 0x04012100 ///< Channel Interleaveing Requested, but could not be enabled
1815#define MEM_WARNING_BANK_INTERLEAVING_NOT_ENABLED 0x04012200 ///< Bank Interleaveing Requested, but could not be enabled
1816#define MEM_WARNING_VOLTAGE_1_35_NOT_SUPPORTED 0x04012300 ///< Voltage 1.35 determined, but could not be supported
1817
1818// AGESA_FATAL Memory Errors
1819#define MEM_ERROR_MINIMUM_MODE 0x04011A00 ///< Running in minimum mode
1820#define MEM_ERROR_MODULE_TYPE_MISMATCH_DIMM 0x04011B00 ///< DIMM modules are miss-matched
1821#define MEM_ERROR_NO_DIMM_FOUND_ON_SYSTEM 0x04011C00 ///< No DIMMs have been found
1822#define MEM_ERROR_MISMATCH_DIMM_CLOCKS 0x04011D00 ///< DIMM clocks miss-matched
1823#define MEM_ERROR_NO_CYC_TIME 0x04011E00 ///< No cycle time found
1824#define MEM_ERROR_HEAP_ALLOCATE_DYN_STORING_OF_TRAINED_TIMINGS 0x04011F00 ///< Heap allocation error with dynamic storing of trained timings
1825#define MEM_ERROR_HEAP_ALLOCATE_FOR_DCT_STRUCT_AND_CH_DEF_STRUCTs 0x04021F00 ///< Heap allocation error for DCT_STRUCT and CH_DEF_STRUCT
1826#define MEM_ERROR_HEAP_ALLOCATE_FOR_REMOTE_TRAINING_ENV 0x04031F00 ///< Heap allocation error with REMOTE_TRAINING_ENV
1827#define MEM_ERROR_HEAP_ALLOCATE_FOR_SPD 0x04041F00 ///< Heap allocation error for SPD data
1828#define MEM_ERROR_HEAP_ALLOCATE_FOR_RECEIVED_DATA 0x04051F00 ///< Heap allocation error for RECEIVED_DATA during parallel training
1829#define MEM_ERROR_HEAP_ALLOCATE_FOR_S3_SPECIAL_CASE_REGISTERS 0x04061F00 ///< Heap allocation error for S3 "SPECIAL_CASE_REGISTER"
1830#define MEM_ERROR_HEAP_ALLOCATE_FOR_TRAINING_DATA 0x04071F00 ///< Heap allocation error for Training Data
1831#define MEM_ERROR_HEAP_ALLOCATE_FOR_IDENTIFY_DIMM_MEM_NB_BLOCK 0x04081F00 ///< Heap allocation error for DIMM Identify "MEM_NB_BLOCK
1832#define MEM_ERROR_NO_CONSTRUCTOR_FOR_IDENTIFY_DIMM 0x04022300 ///< No Constructor for DIMM Identify
1833
1834// AGESA_CRITICAL Memory Errors
1835#define MEM_ERROR_HEAP_ALLOCATE_FOR_DMI_TABLE_DDR3 0x04091F00 ///< Heap allocation error for DMI table for DDR3
1836#define MEM_ERROR_HEAP_ALLOCATE_FOR_DMI_TABLE_DDR2 0x040A1F00 ///< Heap allocation error for DMI table for DDR2
1837#define MEM_ERROR_UNSUPPORTED_DIMM_CONFIG 0x04011400 ///< Dimm population is not supported
1838
1839
1840
1841/*----------------------------------------------------------------------------
1842 *
1843 * END OF MEMORY-SPECIFIC DATA STRUCTURES
1844 *
1845 *----------------------------------------------------------------------------
1846 */
1847
1848
1849
1850
1851/*----------------------------------------------------------------------------
1852 *
1853 * CPU RELATED DEFINITIONS
1854 *
1855 *----------------------------------------------------------------------------
1856 */
1857
1858// CPU Event definitions.
1859
1860// Defines used to filter CPU events based on functional blocks
1861#define CPU_EVENT_PM_EVENT_MASK 0xFF00FF00
1862#define CPU_EVENT_PM_EVENT_CLASS 0x08000400
1863
1864//================================================================
1865// CPU General events
1866// Heap allocation (AppFunction = 01h)
1867#define CPU_ERROR_HEAP_BUFFER_IS_NOT_PRESENT 0x08000100
1868#define CPU_ERROR_HEAP_IS_ALREADY_INITIALIZED 0x08010100
1869#define CPU_ERROR_HEAP_IS_FULL 0x08020100
1870#define CPU_ERROR_HEAP_BUFFER_HANDLE_IS_ALREADY_USED 0x08030100
1871#define CPU_ERROR_HEAP_BUFFER_HANDLE_IS_NOT_PRESENT 0x08040100
1872// BrandId (AppFunction = 02h)
1873#define CPU_ERROR_BRANDID_HEAP_NOT_AVAILABLE 0x08000200
1874// Micro code patch (AppFunction = 03h)
1875#define CPU_ERROR_MICRO_CODE_PATCH_IS_NOT_LOADED 0x08000300
1876// Power management (AppFunction = 04h)
1877#define CPU_EVENT_PM_PSTATE_OVERCURRENT 0x08000400
1878#define CPU_EVENT_PM_ALL_PSTATE_OVERCURRENT 0x08010400
1879#define CPU_ERROR_PSTATE_HEAP_NOT_AVAILABLE 0x08020400
1880#define CPU_ERROR_PM_NB_PSTATE_MISMATCH 0x08030400
1881// BIST (AppFunction = 05h)
1882#define CPU_EVENT_BIST_ERROR 0x08000500
1883
1884//=================================================================
1885// CPU Feature events
1886// Execution cache (AppFunction = 21h)
1887// AGESA_CACHE_SIZE_REDUCED 2101
1888// AGESA_CACHE_REGIONS_ACROSS_1MB 2102
1889// AGESA_CACHE_REGIONS_ACROSS_4GB 2103
1890// AGESA_REGION_NOT_ALIGNED_ON_BOUNDARY 2104
1891// AGESA_CACHE_START_ADDRESS_LESS_D0000 2105
1892// AGESA_THREE_CACHE_REGIONS_ABOVE_1MB 2106
1893// AGESA_DEALLOCATE_CACHE_REGIONS 2107
1894#define CPU_EVENT_EXECUTION_CACHE_ALLOCATION_ERROR 0x08002100
1895// Core Leveling (AppFunction = 22h)
1896#define CPU_WARNING_ADJUSTED_LEVELING_MODE 0x08002200
1897// HT Assist (AppFunction = 23h)
1898#define CPU_WARNING_NONOPTIMAL_HT_ASSIST_CFG 0x08002300
1899
1900// CPU Build Configuration structures and definitions
1901
1902/// Build Configuration structure for BLDCFG_AP_MTRR_SETTINGS
1903typedef struct {
1904 IN UINT32 MsrAddr; ///< Fixed-Sized MTRR address
1905 IN UINT64 MsrData; ///< MTRR Settings
1906} AP_MTRR_SETTINGS;
1907
1908#define AMD_AP_MTRR_FIX64k_00000 0x00000250
1909#define AMD_AP_MTRR_FIX16k_80000 0x00000258
1910#define AMD_AP_MTRR_FIX16k_A0000 0x00000259
1911#define AMD_AP_MTRR_FIX4k_C0000 0x00000268
1912#define AMD_AP_MTRR_FIX4k_C8000 0x00000269
1913#define AMD_AP_MTRR_FIX4k_D0000 0x0000026A
1914#define AMD_AP_MTRR_FIX4k_D8000 0x0000026B
1915#define AMD_AP_MTRR_FIX4k_E0000 0x0000026C
1916#define AMD_AP_MTRR_FIX4k_E8000 0x0000026D
1917#define AMD_AP_MTRR_FIX4k_F0000 0x0000026E
1918#define AMD_AP_MTRR_FIX4k_F8000 0x0000026F
1919#define CPU_LIST_TERMINAL 0xFFFFFFFF
1920
1921/************************************************************************
1922 *
1923 * AGESA interface Call-Out function parameter structures
1924 *
1925 ***********************************************************************/
1926
1927/// Parameters structure for interface call-out AgesaAllocateBuffer
1928typedef struct {
1929 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
1930 IN OUT UINT32 BufferLength; ///< Size of buffer to allocate
1931 IN UINT32 BufferHandle; ///< Identifier or name for the buffer
1932 OUT VOID *BufferPointer; ///< location of the created buffer
1933} AGESA_BUFFER_PARAMS;
1934
1935/// Parameters structure for interface call-out AgesaRunCodeOnAp
1936typedef struct {
1937 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
1938 IN UINT32 FunctionNumber; ///< Index of the procedure to execute
1939 IN VOID *RelatedDataBlock; ///< Location of data structure the procedure will use
1940 IN UINT32 RelatedBlockLength; ///< Size of the related data block
1941} AP_EXE_PARAMS;
1942
1943/// Parameters structure for the interface call-out AgesaReadSpd & AgesaReadSpdRecovery
1944typedef struct {
1945 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
1946 IN UINT8 SocketId; ///< Address of SPD - socket ID
1947 IN UINT8 MemChannelId; ///< Address of SPD - memory channel ID
1948 IN UINT8 DimmId; ///< Address of SPD - DIMM ID
1949 IN OUT UINT8 *Buffer; ///< Location where to place the SPD content
1950 IN OUT MEM_DATA_STRUCT *MemData; ///< Location of the MemData structure, for reference
1951} AGESA_READ_SPD_PARAMS;
1952
1953/// Buffer Handles
1954typedef enum {
1955 AMD_DMI_INFO_BUFFER_HANDLE = 0x000D000, ///< Assign 0x000D000 buffer handle to DMI function
1956 AMD_PSTATE_DATA_BUFFER_HANDLE, ///< Assign 0x000D001 buffer handle to Pstate data
1957 AMD_PSTATE_ACPI_BUFFER_HANDLE, ///< Assign 0x000D002 buffer handle to Pstate table
1958 AMD_BRAND_ID_BUFFER_HANDLE, ///< Assign 0x000D003 buffer handle to Brand ID
1959 AMD_ACPI_SLIT_BUFFER_HANDLE, ///< Assign 0x000D004 buffer handle to SLIT function
1960 AMD_SRAT_INFO_BUFFER_HANDLE, ///< Assign 0x000D005 buffer handle to SRAT function
1961 AMD_WHEA_BUFFER_HANDLE, ///< Assign 0x000D006 buffer handle to WHEA function
1962 AMD_S3_INFO_BUFFER_HANDLE, ///< Assign 0x000D007 buffer handle to S3 function
1963 AMD_S3_NB_INFO_BUFFER_HANDLE, ///< Assign 0x000D008 buffer handle to S3 NB device info
1964 AMD_ACPI_ALIB_BUFFER_HANDLE ///< Assign 0x000D009 buffer handle to ALIB SSDT table
1965} AMD_BUFFER_HANDLE;
1966/************************************************************************
1967 *
1968 * AGESA interface Call-Out function prototypes
1969 *
1970 ***********************************************************************/
1971
1972VOID
1973AgesaDoReset (
1974 IN UINTN ResetType,
1975 IN OUT AMD_CONFIG_PARAMS *StdHeader
1976 );
1977
1978AGESA_STATUS
1979AgesaAllocateBuffer (
1980 IN UINTN FcnData,
1981 IN OUT AGESA_BUFFER_PARAMS *AllocParams
1982 );
1983
1984AGESA_STATUS
1985AgesaDeallocateBuffer (
1986 IN UINTN FcnData,
1987 IN OUT AGESA_BUFFER_PARAMS *DeallocParams
1988 );
1989
1990AGESA_STATUS
1991AgesaLocateBuffer (
1992 IN UINTN FcnData,
1993 IN OUT AGESA_BUFFER_PARAMS *LocateParams
1994 );
1995
1996AGESA_STATUS
1997AgesaReadSpd (
1998 IN UINTN FcnData,
1999 IN OUT AGESA_READ_SPD_PARAMS *ReadSpd
2000 );
2001
2002AGESA_STATUS
2003AgesaReadSpdRecovery (
2004 IN UINTN FcnData,
2005 IN OUT AGESA_READ_SPD_PARAMS *ReadSpd
2006 );
2007
2008AGESA_STATUS
2009AgesaHookBeforeDramInitRecovery (
2010 IN UINTN FcnData,
2011 IN OUT MEM_DATA_STRUCT *MemData
2012 );
2013
2014AGESA_STATUS
2015AgesaRunFcnOnAp (
2016 IN UINTN ApicIdOfCore,
2017 IN AP_EXE_PARAMS *LaunchApParams
2018 );
2019
2020AGESA_STATUS
2021AgesaHookBeforeDramInit (
2022 IN UINTN FcnData,
2023 IN OUT MEM_DATA_STRUCT *MemData
2024 );
2025
2026AGESA_STATUS
2027AgesaHookBeforeDQSTraining (
2028 IN UINTN FcnData,
2029 IN OUT MEM_DATA_STRUCT *MemData
2030 );
2031
2032AGESA_STATUS
2033AgesaHookBeforeExitSelfRefresh (
2034 IN UINTN FcnData,
2035 IN OUT MEM_DATA_STRUCT *MemData
2036 );
2037
2038AGESA_STATUS
2039AgesaPcieSlotResetControl (
2040 IN UINTN FcnData,
2041 IN PCIe_SLOT_RESET_INFO *ResetInfo
2042 );
2043
2044/************************************************************************
2045 *
2046 * AGESA interface structure definition and function prototypes
2047 *
2048 ***********************************************************************/
2049
2050/**********************************************************************
2051 * Platform Configuration: The parameters in boot branch function
2052 **********************************************************************/
2053
2054/// The possible platform control flow settings.
2055typedef enum {
2056 Nfcm, ///< Normal Flow Control Mode.
2057 UmaDr, ///< UMA using Display Refresh flow control.
2058 UmaIfcm, ///< UMA using Isochronous Flow Control.
2059 Ifcm, ///< Isochronous Flow Control Mode (other than for UMA).
2060 Iommu, ///< An IOMMU is in use in the system.
2061 MaxControlFlow ///< Not a control flow mode, use for limit checking.
2062} PLATFORM_CONTROL_FLOW;
2063
2064/// Platform Deemphasis Levels.
2065///
2066/// The deemphasis level is set for the receiver, based on link characterization. The DCV level is
2067/// set based on the level of the far transmitter.
2068typedef enum {
2069 DeemphasisLevelNone, ///< No Deemphasis.
2070 DeemphasisLevelMinus3, ///< Minus 3 db deemphasis.
2071 DeemphasisLevelMinus6, ///< Minus 6 db deemphasis.
2072 DeemphasisLevelMinus8, ///< Minus 8 db deemphasis.
2073 DeemphasisLevelMinus11, ///< Minus 11 db deemphasis.
2074 DeemphasisLevelMinus11pre8, ///< Minus 11, Minus 8 precursor db deemphasis.
2075 DcvLevelNone = 16, ///< No DCV Deemphasis.
2076 DcvLevelMinus2, ///< Minus 2 db DCV deemphasis.
2077 DcvLevelMinus3, ///< Minus 3 db DCV deemphasis.
2078 DcvLevelMinus5, ///< Minus 5 db DCV deemphasis.
2079 DcvLevelMinus6, ///< Minus 6 db DCV deemphasis.
2080 DcvLevelMinus7, ///< Minus 7 db DCV deemphasis.
2081 DcvLevelMinus8, ///< Minus 8 db DCV deemphasis.
2082 DcvLevelMinus9, ///< Minus 9 db DCV deemphasis.
2083 DcvLevelMinus11, ///< Minus 11 db DCV deemphasis.
2084 MaxPlatformDeemphasisLevel ///< Not a deemphasis level, use for limit checking.
2085} PLATFORM_DEEMPHASIS_LEVEL;
2086
2087/// Provide Deemphasis Levels for HT Links.
2088///
2089/// For each CPU to CPU or CPU to IO device HT link, the list of Deemphasis Levels will
2090/// be checked for a match. The item matches for a Socket, Link if the link frequency is
2091/// is in the inclusive range HighFreq:LoFreq.
2092/// AGESA does not set deemphasis in IO devices, only in processors.
2093
2094typedef struct {
2095 // Match fields
2096 IN UINT8 Socket; ///< One Socket on which this Link is located
2097 IN UINT8 Link; ///< The Link on this Processor.
2098 IN UINT8 LoFreq; ///< If the link is set to this frequency or greater, apply these levels, and
2099 IN UINT8 HighFreq; ///< If the link is set to this frequency or less, apply these levels.
2100 // Value fields
2101 IN PLATFORM_DEEMPHASIS_LEVEL ReceiverDeemphasis; ///< The deemphasis level for this link
2102 IN PLATFORM_DEEMPHASIS_LEVEL DcvDeemphasis; ///< The DCV, or far transmitter deemphasis level.
2103} CPU_HT_DEEMPHASIS_LEVEL;
2104
2105/// The possible platform power policy settings.
2106typedef enum {
2107 Performance, ///< Optimize for performance.
2108 BatteryLife, ///< Optimize for battery life.
2109 MaxPowerPolicy ///< Not a power policy mode, use for limit checking.
2110} PLATFORM_POWER_POLICY;
2111
2112/// Platform performance settings for optimized settings.
2113/// Several configuration settings for the processor depend upon other parts and
2114/// general designer choices for the system. The determination of these data points
2115/// is not standard for all platforms, so the host environment needs to provide these
2116/// to specify how the system is to be configured.
2117typedef struct {
2118 IN PLATFORM_CONTROL_FLOW PlatformControlFlowMode; ///< The platform's control flow mode for optimum platform performance.
2119 ///< @BldCfgItem{BLDCFG_PLATFORM_CONTROL_FLOW_MODE}
2120 IN BOOLEAN UseHtAssist; ///< HyperTransport link traffic optimization.
2121 ///< @BldCfgItem{BLDCFG_USE_HT_ASSIST}
2122 IN BOOLEAN UseAtmMode; ///< HyperTransport link traffic optimization.
2123 ///< @BldCfgItem{BLDCFG_USE_ATM_MODE}
2124 IN BOOLEAN Use32ByteRefresh; ///< Display Refresh traffic generates 32 byte requests.
2125 ///< @BldCfgItem{BLDCFG_USE_32_BYTE_REFRESH}
2126 IN BOOLEAN UseVariableMctIsocPriority; ///< The Memory controller will be set to Variable Isoc Priority.
2127 ///< @BldCfgItem{BLDCFG_USE_VARIABLE_MCT_ISOC_PRIORITY}
2128 IN PLATFORM_POWER_POLICY PlatformPowerPolicy; ///< The platform's desired power policy
2129 ///< @BldCfgItem{BLDCFG_PLATFORM_POWER_POLICY_MODE}
2130} PERFORMANCE_PROFILE;
2131
2132/// Platform settings that describe the voltage regulator modules of the system.
2133/// Many power management settings are dependent upon the characteristics of the
2134/// on-board voltage regulator module (VRM). The host environment needs to provide
2135/// these to specify how the system is to be configured.
2136typedef struct {
2137 IN UINT32 CurrentLimit; ///< Vrm Current Limit.
2138 ///< @BldCfgItem{BLDCFG_VRM_CURRENT_LIMIT}
2139 ///< @BldCfgItem{BLDCFG_VRM_NB_CURRENT_LIMIT}
2140 IN UINT32 LowPowerThreshold; ///< Vrm Low Power Threshold.
2141 ///< @BldCfgItem{BLDCFG_VRM_LOW_POWER_THRESHOLD}
2142 ///< @BldCfgItem{BLDCFG_VRM_NB_LOW_POWER_THRESHOLD}
2143 IN UINT32 SlewRate; ///< Vrm Slew Rate.
2144 ///< @BldCfgItem{BLDCFG_VRM_SLEW_RATE}
2145 ///< @BldCfgItem{BLDCFG_VRM_NB_SLEW_RATE}
2146 IN UINT32 AdditionalDelay; ///< Vrm Additional Delay.
2147 ///< @BldCfgItem{BLDCFG_VRM_ADDITIONAL_DELAY}
2148 ///< @BldCfgItem{BLDCFG_VRM_NB_ADDITIONAL_DELAY}
2149 IN BOOLEAN HiSpeedEnable; ///< Select high speed VRM.
2150 ///< @BldCfgItem{BLDCFG_VRM_HIGH_SPEED_ENABLE}
2151 ///< @BldCfgItem{BLDCFG_VRM_NB_HIGH_SPEED_ENABLE}
2152 IN UINT32 InrushCurrentLimit; ///< Vrm Inrush Current Limit.
2153 ///< @BldCfgItem{BLDCFG_VRM_INRUSH_CURRENT_LIMIT}
2154 ///< @BldCfgItem{BLDCFG_VRM_NB_INRUSH_CURRENT_LIMIT}
2155} PLATFORM_VRM_CONFIGURATION;
2156
2157/// The VRM types to characterize.
2158typedef enum {
2159 CoreVrm, ///< VDD plane.
2160 NbVrm, ///< VDDNB plane.
2161 MaxVrmType ///< Not a valid VRM type, use for limit checking.
2162} PLATFORM_VRM_TYPE;
2163
2164
2165/// Build Option/Configuration Boolean Structure.
2166typedef struct {
2167 IN AMD_CODE_HEADER VersionString; ///< AMD embedded code version string
2168
2169 //Build Option Area
2170 IN BOOLEAN OptionUDimms; ///< @ref BLDOPT_REMOVE_UDIMMS_SUPPORT "BLDOPT_REMOVE_UDIMMS_SUPPORT"
2171 IN BOOLEAN OptionRDimms; ///< @ref BLDOPT_REMOVE_RDIMMS_SUPPORT "BLDOPT_REMOVE_RDIMMS_SUPPORT"
2172 IN BOOLEAN OptionLrDimms; ///< @ref BLDOPT_REMOVE_LRDIMMS_SUPPORT "BLDOPT_REMOVE_LRDIMMS_SUPPORT"
2173 IN BOOLEAN OptionEcc; ///< @ref BLDOPT_REMOVE_ECC_SUPPORT "BLDOPT_REMOVE_ECC_SUPPORT"
2174 IN BOOLEAN OptionBankInterleave; ///< @ref BLDOPT_REMOVE_BANK_INTERLEAVE "BLDOPT_REMOVE_BANK_INTERLEAVE"
2175 IN BOOLEAN OptionDctInterleave; ///< @ref BLDOPT_REMOVE_DCT_INTERLEAVE "BLDOPT_REMOVE_DCT_INTERLEAVE"
2176 IN BOOLEAN OptionNodeInterleave; ///< @ref BLDOPT_REMOVE_NODE_INTERLEAVE "BLDOPT_REMOVE_NODE_INTERLEAVE"
2177 IN BOOLEAN OptionParallelTraining; ///< @ref BLDOPT_REMOVE_PARALLEL_TRAINING "BLDOPT_REMOVE_PARALLEL_TRAINING"
2178 IN BOOLEAN OptionOnlineSpare; ///< @ref BLDOPT_REMOVE_ONLINE_SPARE_SUPPORT "BLDOPT_REMOVE_ONLINE_SPARE_SUPPORT"
2179 IN BOOLEAN OptionMemRestore; ///< @ref BLDOPT_REMOVE_MEM_RESTORE_SUPPORT "BLDOPT_REMOVE_MEM_RESTORE_SUPPORT"
2180 IN BOOLEAN OptionMultisocket; ///< @ref BLDOPT_REMOVE_MULTISOCKET_SUPPORT "BLDOPT_REMOVE_MULTISOCKET_SUPPORT"
2181 IN BOOLEAN OptionAcpiPstates; ///< @ref BLDOPT_REMOVE_ACPI_PSTATES "BLDOPT_REMOVE_ACPI_PSTATES"
2182 IN BOOLEAN OptionSrat; ///< @ref BLDOPT_REMOVE_SRAT "BLDOPT_REMOVE_SRAT"
2183 IN BOOLEAN OptionSlit; ///< @ref BLDOPT_REMOVE_SLIT "BLDOPT_REMOVE_SLIT"
2184 IN BOOLEAN OptionWhea; ///< @ref BLDOPT_REMOVE_WHEA "BLDOPT_REMOVE_WHEA"
2185 IN BOOLEAN OptionDmi; ///< @ref BLDOPT_REMOVE_DMI "BLDOPT_REMOVE_DMI"
2186 IN BOOLEAN OptionEarlySamples; ///< @ref BLDOPT_REMOVE_EARLY_SAMPLES "BLDOPT_REMOVE_EARLY_SAMPLES"
2187 IN BOOLEAN OptionAddrToCsTranslator; ///< ADDR_TO_CS_TRANSLATOR
2188
2189 //Build Configuration Area
2190 IN UINT64 CfgPciMmioAddress; ///< Pci Mmio Base Address to use for PCI Config accesses.
2191 ///< Build-time customizable only - @BldCfgItem{BLDCFG_PCI_MMIO_BASE}
2192 IN UINT32 CfgPciMmioSize; ///< Pci Mmio region Size.
2193 ///< Build-time customizable only - @BldCfgItem{BLDCFG_PCI_MMIO_SIZE}
2194 IN PLATFORM_VRM_CONFIGURATION CfgPlatVrmCfg[MaxVrmType]; ///< Several configuration settings for the voltage regulator modules.
2195 IN UINT32 CfgPlatNumIoApics; ///< The number of IO APICS for the platform.
2196 IN UINT32 CfgMemInitPstate; ///< Memory Init Pstate.
2197 IN PLATFORM_C1E_MODES CfgPlatformC1eMode; ///< Select the C1e Mode that will used.
2198 IN UINT32 CfgPlatformC1eOpData; ///< An IO port or additional C1e setup data, depends on C1e mode.
2199 IN UINT32 CfgPlatformC1eOpData1; ///< An IO port or additional C1e setup data, depends on C1e mode.
2200 IN UINT32 CfgPlatformC1eOpData2; ///< An IO port or additional C1e setup data, depends on C1e mode.
2201 IN PLATFORM_CSTATE_MODES CfgPlatformCStateMode; ///< Select the C-State Mode that will used.
2202 IN UINT32 CfgPlatformCStateOpData; ///< An IO port or additional C-State setup data, depends on C-State mode.
2203 IN UINT16 CfgPlatformCStateIoBaseAddress; ///< Specifies I/O ports that can be used to allow CPU to enter CStates
2204 IN PLATFORM_CPB_MODES CfgPlatformCpbMode; ///< Enable or disable core performance boost
2205 IN UINT32 CfgCoreLevelingMode; ///< Apply any downcoring or core count leveling as specified.
2206 IN PERFORMANCE_PROFILE CfgPerformanceProfile; ///< The platform's control flow mode and platform performance settings.
2207 IN CPU_HT_DEEMPHASIS_LEVEL *CfgPlatformDeemphasisList; ///< Deemphasis levels for the platform's HT links.
2208
2209 IN UINT32 CfgAmdPlatformType; ///< Designate the platform as a Server, Desktop, or Mobile.
2210 IN UINT32 CfgAmdPstateCapValue; ///< Amd pstate ceiling enabling deck
2211
2212 IN MEMORY_BUS_SPEED CfgMemoryBusFrequencyLimit; ///< Memory Bus Frequency Limit.
2213 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_BUS_FREQUENCY_LIMIT}
2214 IN BOOLEAN CfgMemoryModeUnganged; ///< Memory Mode Unganged.
2215 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_MODE_UNGANGED}
2216 IN BOOLEAN CfgMemoryQuadRankCapable; ///< Memory Quad Rank Capable.
2217 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_QUAD_RANK_CAPABLE}
2218 IN QUANDRANK_TYPE CfgMemoryQuadrankType; ///< Memory Quadrank Type.
2219 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_QUADRANK_TYPE}
2220 IN BOOLEAN CfgMemoryRDimmCapable; ///< Memory RDIMM Capable.
2221 IN BOOLEAN CfgMemoryLRDimmCapable; ///< Memory LRDIMM Capable.
2222 IN BOOLEAN CfgMemoryUDimmCapable; ///< Memory UDIMM Capable.
2223 IN BOOLEAN CfgMemorySODimmCapable; ///< Memory SODimm Capable.
2224 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_SODIMM_CAPABLE}
2225 IN BOOLEAN CfgMemoryEnableBankInterleaving; ///< Memory Enable Bank Interleaving.
2226 IN BOOLEAN CfgMemoryEnableNodeInterleaving; ///< Memory Enable Node Interleaving.
2227 IN BOOLEAN CfgMemoryChannelInterleaving; ///< Memory Channel Interleaving.
2228 IN BOOLEAN CfgMemoryPowerDown; ///< Memory Power Down.
2229 IN POWER_DOWN_MODE CfgPowerDownMode; ///< Power Down Mode.
2230 IN BOOLEAN CfgOnlineSpare; ///< Online Spare.
2231 IN BOOLEAN CfgMemoryParityEnable; ///< Memory Parity Enable.
2232 IN BOOLEAN CfgBankSwizzle; ///< Bank Swizzle.
2233 IN USER_MEMORY_TIMING_MODE CfgTimingModeSelect; ///< Timing Mode Select.
2234 IN MEMORY_BUS_SPEED CfgMemoryClockSelect; ///< Memory Clock Select.
2235 IN BOOLEAN CfgDqsTrainingControl; ///< Dqs Training Control.
2236 ///< Build-time customizable only - @BldCfgItem{BLDCFG_DQS_TRAINING_CONTROL}
2237 IN BOOLEAN CfgIgnoreSpdChecksum; ///< Ignore Spd Checksum.
2238 ///< Build-time customizable only - @BldCfgItem{BLDCFG_IGNORE_SPD_CHECKSUM}
2239 IN BOOLEAN CfgUseBurstMode; ///< Use Burst Mode.
2240 ///< Build-time customizable only - @BldCfgItem{BLDCFG_USE_BURST_MODE}
2241 IN BOOLEAN CfgMemoryAllClocksOn; ///< Memory All Clocks On.
2242 ///< Build-time customizable only - @BldCfgItem{BLDCFG_MEMORY_ALL_CLOCKS_ON}
2243 IN BOOLEAN CfgEnableEccFeature; ///< Enable ECC Feature.
2244 IN BOOLEAN CfgEccRedirection; ///< ECC Redirection.
2245 ///< Build-time customizable only - @BldCfgItem{BLDCFG_ECC_REDIRECTION}
2246 IN UINT16 CfgScrubDramRate; ///< Scrub Dram Rate.
2247 ///< Build-time customizable only - @BldCfgItem{BLDCFG_SCRUB_DRAM_RATE}
2248 IN UINT16 CfgScrubL2Rate; ///< Scrub L2Rate.
2249 ///< Build-time customizable only - @BldCfgItem{BLDCFG_SCRUB_L2_RATE}
2250 IN UINT16 CfgScrubL3Rate; ///< Scrub L3Rate.
2251 ///< Build-time customizable only - @BldCfgItem{BLDCFG_SCRUB_L3_RATE}
2252 IN UINT16 CfgScrubIcRate; ///< Scrub Ic Rate.
2253 ///< Build-time customizable only - @BldCfgItem{BLDCFG_SCRUB_IC_RATE}
2254 IN UINT16 CfgScrubDcRate; ///< Scrub Dc Rate.
2255 ///< Build-time customizable only - @BldCfgItem{BLDCFG_SCRUB_DC_RATE}
2256 IN BOOLEAN CfgEccSyncFlood; ///< ECC Sync Flood.
2257 ///< Build-time customizable only - @BldCfgItem{BLDCFG_ECC_SYNC_FLOOD}
2258 IN UINT16 CfgEccSymbolSize; ///< ECC Symbol Size.
2259 ///< Build-time customizable only - @BldCfgItem{BLDCFG_ECC_SYMBOL_SIZE}
2260 IN UINT64 CfgHeapDramAddress; ///< Heap contents will be temporarily stored in this address during the transition.
2261 ///< Build-time customizable only - @BldCfgItem{BLDCFG_HEAP_DRAM_ADDRESS}
2262 IN BOOLEAN CfgNodeMem1GBAlign; ///< Node Mem 1GB boundary Alignment
2263 IN BOOLEAN CfgS3LateRestore; ///< S3 Late Restore
2264 IN BOOLEAN CfgAcpiPstateIndependent; ///< PSD method dependent/Independent
2265 IN AP_MTRR_SETTINGS *CfgApMtrrSettingsList; ///< The AP's MTRR settings before final halt
2266 ///< Build-time customizable only - @BldCfgItem{BLDCFG_AP_MTRR_SETTINGS_LIST}
2267 IN UMA_MODE CfgUmaMode; ///< Uma Mode
2268 IN UINT32 CfgUmaSize; ///< Uma Size [31:0]=Addr[47:16]
2269 IN BOOLEAN CfgUmaAbove4G; ///< Uma Above 4G Support
2270 IN UMA_ALIGNMENT CfgUmaAlignment; ///< Uma alignment
2271 IN BOOLEAN CfgProcessorScopeInSb; ///< ACPI Processor Object in \\_SB scope
2272 IN CHAR8 CfgProcessorScopeName0; ///< OEM specific 1st character of processor scope name.
2273 IN CHAR8 CfgProcessorScopeName1; ///< OEM specific 2nd character of processor scope name.
2274 IN UINT8 CfgGnbHdAudio; ///< GNB HD Audio
2275 IN UINT8 CfgAbmSupport; ///< Abm Support
2276 IN UINT8 CfgDynamicRefreshRate; ///< DRR Dynamic Refresh Rate
2277 IN UINT16 CfgLcdBackLightControl; ///< LCD Backlight Control
2278 IN UINT8 CfgGnb3dStereoPinIndex; ///< 3D Stereo Pin ID.
2279 IN UINT32 CfgTempPcieMmioBaseAddress; ///< Temp pcie MMIO base Address
2280 ///< Build-time customizable only - @BldCfgItem{BLDCFG_TEMP_PCIE_MMIO_BASE_ADDRESS}
2281 IN UINT32 CfgGnbIGPUSSID; ///< Gnb internal GPU SSID
2282 ///< Build-time customizable only - @BldCfgItem{BLDCFG_IGPU_SUBSYSTEM_ID}
2283 IN UINT32 CfgGnbHDAudioSSID; ///< Gnb HD Audio SSID
2284 ///< Build-time customizable only - @BldCfgItem{BLDCFG_IGPU_HD_AUDIO_SUBSYSTEM_ID}
2285 IN UINT32 CfgGnbPcieSSID; ///< Gnb PCIe SSID
2286 ///< Build-time customizable only - @BldCfgItem{BLFCFG_APU_PCIE_PORTS_SUBSYSTEM_ID}
2287 IN UINT16 CfgLvdsSpreadSpectrum; ///< Lvds Spread Spectrum
2288 ///< Build-time customizable only - @BldCfgItem{BLDCFG_GFX_LVDS_SPREAD_SPECTRUM}
2289 IN UINT16 CfgLvdsSpreadSpectrumRate; ///< Lvds Spread Spectrum Rate
2290 ///< Build-time customizable only - @BldCfgItem{BLDCFG_GFX_LVDS_SPREAD_SPECTRUM_RATE}
efdesign9884cbce22011-08-04 12:09:17 -06002291 IN LVDS_MISC_CONTROL CfgLvdsMiscControl; ///< The LVDS Misc control
2292 IN UINT16 CfgPcieRefClkSpreadSpectrum; ///< PCIe Reference Clock Spread Spectrum
2293 ///< Build-time customizable only - @BldCfgItem{BLDCFG_PCIE_REFCLK_SPREAD_SPECTRUM}
Frank Vibrans2b4c8312011-02-14 18:30:54 +00002294 IN BOOLEAN Reserved; ///< reserved...
2295} BUILD_OPT_CFG;
2296
2297/// A structure containing platform specific operational characteristics. This
2298/// structure is initially populated by the initializer with a copy of the same
2299/// structure that was created at build time using the build configuration controls.
2300typedef struct _PLATFORM_CONFIGURATION {
2301 IN PERFORMANCE_PROFILE PlatformProfile; ///< Several configuration settings for the processor.
2302 IN CPU_HT_DEEMPHASIS_LEVEL *PlatformDeemphasisList; ///< Deemphasis levels for the platform's HT links.
2303 ///< @BldCfgItem{BLDCFG_PLATFORM_DEEMPHASIS_LIST}.
2304 ///< @n @e Examples: See @ref DeemphasisExamples "Deemphasis List Examples".
2305 IN UINT8 CoreLevelingMode; ///< Indicates how to balance the number of cores per processor.
2306 ///< @BldCfgItem{BLDCFG_CORE_LEVELING_MODE}
2307 IN PLATFORM_C1E_MODES C1eMode; ///< Specifies the method of C1e enablement - Disabled, HW, or message based.
2308 ///< @BldCfgItem{BLDCFG_PLATFORM_C1E_MODE}
2309 IN UINT32 C1ePlatformData; ///< If C1eMode is HW, specifies the P_LVL3 I/O port of the platform.
2310 ///< @BldCfgItem{BLDCFG_PLATFORM_C1E_OPDATA}
2311 IN UINT32 C1ePlatformData1; ///< If C1eMode is SW, specifies the address of chipset's SMI command port.
2312 ///< @BldCfgItem{BLDCFG_PLATFORM_C1E_OPDATA1}
2313 IN UINT32 C1ePlatformData2; ///< If C1eMode is SW, specifies the unique number used by the SMI handler to identify SMI source.
2314 ///< @BldCfgItem{BLDCFG_PLATFORM_C1E_OPDATA2}
2315 IN PLATFORM_CSTATE_MODES CStateMode; ///< Specifies the method of C-State enablement - Disabled, or C6.
2316 ///< @BldCfgItem{BLDCFG_PLATFORM_CSTATE_MODE}
2317 IN UINT32 CStatePlatformData; ///< This element specifies some pertinent data needed for the operation of the Cstate feature
2318 ///< If CStateMode is CStateModeC6, this item is reserved
2319 ///< @BldCfgItem{BLDCFG_PLATFORM_CSTATE_OPDATA}
2320 IN UINT16 CStateIoBaseAddress; ///< This item specifies a free block of 8 consecutive bytes of I/O ports that
2321 ///< can be used to allow the CPU to enter Cstates.
2322 ///< @BldCfgItem{BLDCFG_PLATFORM_CSTATE_IO_BASE_ADDRESS}
2323 IN PLATFORM_CPB_MODES CpbMode; ///< Specifies the method of core performance boost enablement - Disabled, or Auto.
2324 ///< @BldCfgItem{BLDCFG_PLATFORM_CPB_MODE}
2325 IN BOOLEAN UserOptionDmi; ///< When set to TRUE, the DMI data table is generated.
2326 IN BOOLEAN UserOptionPState; ///< When set to TRUE, the PState data tables are generated.
2327 IN BOOLEAN UserOptionSrat; ///< When set to TRUE, the SRAT data table is generated.
2328 IN BOOLEAN UserOptionSlit; ///< When set to TRUE, the SLIT data table is generated.
2329 IN BOOLEAN UserOptionWhea; ///< When set to TRUE, the WHEA data table is generated.
2330 IN UINT32 PowerCeiling; ///< P-State Ceiling Enabling Deck - Max power milli-watts.
2331 IN BOOLEAN ForcePstateIndependent; ///< P-State _PSD independence or dependence.
2332 ///< @BldCfgItem{BLDCFG_FORCE_INDEPENDENT_PSD_OBJECT}
2333 IN UINT32 NumberOfIoApics; ///< Number of I/O APICs in the system
2334 ///< @BldCfgItem{BLDCFG_PLATFORM_NUM_IO_APICS}
2335 IN PLATFORM_VRM_CONFIGURATION VrmProperties[MaxVrmType]; ///< Several configuration settings for the voltage regulator modules.
2336 IN BOOLEAN ProcessorScopeInSb; ///< ACPI Processor Object in \\_SB scope
2337 ///< @BldCfgItem{BLDCFG_PROCESSOR_SCOPE_IN_SB}
2338 IN CHAR8 ProcessorScopeName0; ///< OEM specific 1st character of processor scope name.
2339 ///< @BldCfgItem{BLDCFG_PROCESSOR_SCOPE_NAME0}
2340 IN CHAR8 ProcessorScopeName1; ///< OEM specific 2nd character of processor scope name.
2341 ///< @BldCfgItem{BLDCFG_PROCESSOR_SCOPE_NAME1}
2342 IN UINT8 GnbHdAudio; ///< Control GFX HD Audio controller(Used for HDMI and DP display output),
2343 ///< essentially it enables function 1 of graphics device.
2344 ///< @li 0 = HD Audio disable
2345 ///< @li 1 = HD Audio enable
2346 ///< @BldCfgItem{BLDCFG_CFG_GNB_HD_AUDIO}
2347 IN UINT8 AbmSupport; ///< Automatic adjust LVDS/eDP Back light level support.It is
2348 ///< characteristic specific to display panel which used by platform design.
2349 ///< @li 0 = ABM support disabled
2350 ///< @li 1 = ABM support enabled
2351 ///< @BldCfgItem{BLDCFG_CFG_ABM_SUPPORT}
2352 IN UINT8 DynamicRefreshRate; ///< Adjust refresh rate on LVDS/eDP.
2353 ///< @BldCfgItem{BLDCFG_CFG_DYNAMIC_REFRESH_RATE}
2354 IN UINT16 LcdBackLightControl; ///< The PWM frequency to LCD backlight control.
2355 ///< If equal to 0 backlight not controlled by iGPU
2356 ///< @BldCfgItem{BLDCFG_CFG_LCD_BACK_LIGHT_CONTROL}
2357} PLATFORM_CONFIGURATION;
2358
2359
2360/**********************************************************************
2361 * Structures for: AmdInitLate
2362 **********************************************************************/
2363#define PROC_VERSION_LENGTH 48
2364#define MAX_DIMMS_PER_SOCKET 16
2365
2366/* Interface Parameter Structures */
2367/// DMI Type4 - Processor ID
2368typedef struct {
2369 OUT UINT32 ProcIdLsd; ///< Lower half of 64b ID
2370 OUT UINT32 ProcIdMsd; ///< Upper half of 64b ID
2371} TYPE4_PROC_ID;
2372
2373/// DMI Type 4 - Processor information
2374typedef struct {
2375 OUT UINT8 T4ProcType; ///< CPU Type
2376 OUT UINT8 T4ProcFamily; ///< Family 1
2377 OUT TYPE4_PROC_ID T4ProcId; ///< Id
2378 OUT UINT8 T4Voltage; ///< Voltage
2379 OUT UINT16 T4ExternalClock; ///< External clock
2380 OUT UINT16 T4MaxSpeed; ///< Max speed
2381 OUT UINT16 T4CurrentSpeed; ///< Current speed
2382 OUT UINT8 T4Status; ///< Status
2383 OUT UINT8 T4ProcUpgrade; ///< Up grade
2384 OUT UINT8 T4CoreCount; ///< Core count
2385 OUT UINT8 T4CoreEnabled; ///< Core Enable
2386 OUT UINT8 T4ThreadCount; ///< Thread count
2387 OUT UINT16 T4ProcCharacteristics; ///< Characteristics
2388 OUT UINT16 T4ProcFamily2; ///< Family 2
2389 OUT CHAR8 T4ProcVersion[PROC_VERSION_LENGTH]; ///< Cpu version
2390} TYPE4_DMI_INFO;
2391
2392/// DMI Type 7 - Cache information
2393typedef struct _TYPE7_DMI_INFO {
2394 OUT UINT16 T7CacheCfg; ///< Cache cfg
2395 OUT UINT16 T7MaxCacheSize; ///< Max size
2396 OUT UINT16 T7InstallSize; ///< Install size
2397 OUT UINT16 T7SupportedSramType; ///< Supported Sram Type
2398 OUT UINT16 T7CurrentSramType; ///< Current type
2399 OUT UINT8 T7CacheSpeed; ///< Speed
2400 OUT UINT8 T7ErrorCorrectionType; ///< ECC type
2401 OUT UINT8 T7SystemCacheType; ///< Cache type
2402 OUT UINT8 T7Associativity; ///< Associativity
2403} TYPE7_DMI_INFO;
2404
2405/// DMI Type 16 offset 04h - Location
2406typedef enum {
2407 OtherLocation = 0x01, ///< Assign 01 to Other
2408 UnknownLocation, ///< Assign 02 to Unknown
2409 SystemboardOrMotherboard, ///< Assign 03 to systemboard or motherboard
2410 IsaAddonCard, ///< Assign 04 to ISA add-on card
2411 EisaAddonCard, ///< Assign 05 to EISA add-on card
2412 PciAddonCard, ///< Assign 06 to PCI add-on card
2413 McaAddonCard, ///< Assign 07 to MCA add-on card
2414 PcmciaAddonCard, ///< Assign 08 to PCMCIA add-on card
2415 ProprietaryAddonCard, ///< Assign 09 to proprietary add-on card
2416 NuBus, ///< Assign 0A to NuBus
2417 Pc98C20AddonCard, ///< Assign 0A0 to PC-98/C20 add-on card
2418 Pc98C24AddonCard, ///< Assign 0A1 to PC-98/C24 add-on card
2419 Pc98EAddoncard, ///< Assign 0A2 to PC-98/E add-on card
2420 Pc98LocalBusAddonCard ///< Assign 0A3 to PC-98/Local bus add-on card
2421} DMI_T16_LOCATION;
2422
2423/// DMI Type 16 offset 05h - Memory Error Correction
2424typedef enum {
2425 OtherUse = 0x01, ///< Assign 01 to Other
2426 UnknownUse, ///< Assign 02 to Unknown
2427 SystemMemory, ///< Assign 03 to system memory
2428 VideoMemory, ///< Assign 04 to video memory
2429 FlashMemory, ///< Assign 05 to flash memory
2430 NonvolatileRam, ///< Assign 06 to non-volatile RAM
2431 CacheMemory ///< Assign 07 to cache memory
2432} DMI_T16_USE;
2433
2434/// DMI Type 16 offset 07h - Maximum Capacity
2435typedef enum {
2436 Dmi16OtherErrCorrection = 0x01, ///< Assign 01 to Other
2437 Dmi16UnknownErrCorrection, ///< Assign 02 to Unknown
2438 Dmi16NoneErrCorrection, ///< Assign 03 to None
2439 Dmi16Parity, ///< Assign 04 to parity
2440 Dmi16SingleBitEcc, ///< Assign 05 to Single-bit ECC
2441 Dmi16MultiBitEcc, ///< Assign 06 to Multi-bit ECC
2442 Dmi16Crc ///< Assign 07 to CRC
2443} DMI_T16_ERROR_CORRECTION;
2444
2445/// DMI Type 16 - Physical Memory Array
2446typedef struct {
2447 OUT DMI_T16_LOCATION Location; ///< The physical location of the Memory Array,
2448 ///< whether on the system board or an add-in board.
2449 OUT DMI_T16_USE Use; ///< Identifies the function for which the array
2450 ///< is used.
2451 OUT DMI_T16_ERROR_CORRECTION MemoryErrorCorrection; ///< The primary hardware error correction or
2452 ///< detection method supported by this memory array.
2453 OUT UINT32 MaximumCapacity; ///< The maximum memory capacity, in kilobytes,
2454 ///< for the array.
2455 OUT UINT16 NumberOfMemoryDevices; ///< The number of slots or sockets available
2456 ///< for memory devices in this array.
2457} TYPE16_DMI_INFO;
2458
2459/// DMI Type 17 offset 0Eh - Form Factor
2460typedef enum {
2461 OtherFormFactor = 0x01, ///< Assign 01 to Other
2462 UnknowFormFactor, ///< Assign 02 to Unknown
2463 SimmFormFactor, ///< Assign 03 to SIMM
2464 SipFormFactor, ///< Assign 04 to SIP
2465 ChipFormFactor, ///< Assign 05 to Chip
2466 DipFormFactor, ///< Assign 06 to DIP
2467 ZipFormFactor, ///< Assign 07 to ZIP
2468 ProprietaryCardFormFactor, ///< Assign 08 to Proprietary Card
2469 DimmFormFactorFormFactor, ///< Assign 09 to DIMM
2470 TsopFormFactor, ///< Assign 10 to TSOP
2471 RowOfChipsFormFactor, ///< Assign 11 to Row of chips
2472 RimmFormFactor, ///< Assign 12 to RIMM
2473 SodimmFormFactor, ///< Assign 13 to SODIMM
2474 SrimmFormFactor, ///< Assign 14 to SRIMM
2475 FbDimmFormFactor ///< Assign 15 to FB-DIMM
2476} DMI_T17_FORM_FACTOR;
2477
2478/// DMI Type 17 offset 12h - Memory Type
2479typedef enum {
2480 OtherMemType = 0x01, ///< Assign 01 to Other
2481 UnknownMemType, ///< Assign 02 to Unknown
2482 DramMemType, ///< Assign 03 to DRAM
2483 EdramMemType, ///< Assign 04 to EDRAM
2484 VramMemType, ///< Assign 05 to VRAM
2485 SramMemType, ///< Assign 06 to SRAM
2486 RamMemType, ///< Assign 07 to RAM
2487 RomMemType, ///< Assign 08 to ROM
2488 FlashMemType, ///< Assign 09 to Flash
2489 EepromMemType, ///< Assign 10 to EEPROM
2490 FepromMemType, ///< Assign 11 to FEPROM
2491 EpromMemType, ///< Assign 12 to EPROM
2492 CdramMemType, ///< Assign 13 to CDRAM
2493 ThreeDramMemType, ///< Assign 14 to 3DRAM
2494 SdramMemType, ///< Assign 15 to SDRAM
2495 SgramMemType, ///< Assign 16 to SGRAM
2496 RdramMemType, ///< Assign 17 to RDRAM
2497 DdrMemType, ///< Assign 18 to DDR
2498 Ddr2MemType, ///< Assign 19 to DDR2
2499 Ddr2FbdimmMemType, ///< Assign 20 to DDR2 FB-DIMM
2500 Ddr3MemType = 0x18, ///< Assign 24 to DDR3
2501 Fbd2MemType ///< Assign 25 to FBD2
2502} DMI_T17_MEMORY_TYPE;
2503
2504/// DMI Type 17 offset 13h - Type Detail
2505typedef struct {
2506 OUT UINT16 Reserved1:1; ///< Reserved
2507 OUT UINT16 Other:1; ///< Other
2508 OUT UINT16 Unknown:1; ///< Unknown
2509 OUT UINT16 FastPaged:1; ///< Fast-Paged
2510 OUT UINT16 StaticColumn:1; ///< Static column
2511 OUT UINT16 PseudoStatic:1; ///< Pseudo-static
2512 OUT UINT16 Rambus:1; ///< RAMBUS
2513 OUT UINT16 Synchronous:1; ///< Synchronous
2514 OUT UINT16 Cmos:1; ///< CMOS
2515 OUT UINT16 Edo:1; ///< EDO
2516 OUT UINT16 WindowDram:1; ///< Window DRAM
2517 OUT UINT16 CacheDram:1; ///< Cache Dram
2518 OUT UINT16 NonVolatile:1; ///< Non-volatile
2519 OUT UINT16 Reserved2:3; ///< Reserved
2520} DMI_T17_TYPE_DETAIL;
2521
2522/// DMI Type 17 - Memory Device
2523typedef struct {
2524 OUT UINT16 TotalWidth; ///< Total Width, in bits, of this memory device, including any check or error-correction bits.
2525 OUT UINT16 DataWidth; ///< Data Width, in bits, of this memory device.
2526 OUT UINT16 MemorySize; ///< The size of the memory device.
2527 OUT DMI_T17_FORM_FACTOR FormFactor; ///< The implementation form factor for this memory device.
2528 OUT UINT8 DeviceSet; ///< Identifies when the Memory Device is one of a set of
2529 ///< Memory Devices that must be populated with all devices of
2530 ///< the same type and size, and the set to which this device belongs.
2531 OUT CHAR8 DeviceLocator[8]; ///< The string number of the string that identifies the physically labeled socket or board position where the memory device is located.
2532 OUT CHAR8 BankLocator[10]; ///< The string number of the string that identifies the physically labeled bank where the memory device is located.
2533 OUT DMI_T17_MEMORY_TYPE MemoryType; ///< The type of memory used in this device.
2534 OUT DMI_T17_TYPE_DETAIL TypeDetail; ///< Additional detail on the memory device type
2535 OUT UINT16 Speed; ///< Identifies the speed of the device, in megahertz (MHz).
2536 OUT UINT64 ManufacturerIdCode; ///< Manufacturer ID code.
2537 OUT CHAR8 SerialNumber[9]; ///< Serial Number.
2538 OUT CHAR8 PartNumber[19]; ///< Part Number.
2539 OUT UINT8 Attributes; ///< Bits 7-4: Reserved, Bits 3-0: rank.
2540 OUT UINT32 ExtSize; ///< Extended Size.
2541 OUT UINT16 ConfigSpeed; ///< Configured memory clock speed
2542} TYPE17_DMI_INFO;
2543
2544/// Memory DMI Type 17 and 20 - for memory use
2545typedef struct {
2546 OUT UINT16 TotalWidth; ///< Total Width, in bits, of this memory device, including any check or error-correction bits.
2547 OUT UINT16 DataWidth; ///< Data Width, in bits, of this memory device.
2548 OUT UINT16 MemorySize; ///< The size of the memory device.
2549 OUT DMI_T17_FORM_FACTOR FormFactor; ///< The implementation form factor for this memory device.
2550 OUT UINT8 DeviceLocator; ///< The string number of the string that identifies the physically labeled socket or board position where the memory device is located.
2551 OUT UINT8 BankLocator; ///< The string number of the string that identifies the physically labeled bank where the memory device is located.
2552 OUT UINT16 Speed; ///< Identifies the speed of the device, in megahertz (MHz).
2553 OUT UINT64 ManufacturerIdCode; ///< Manufacturer ID code.
2554 OUT UINT8 SerialNumber[4]; ///< Serial Number.
2555 OUT UINT8 PartNumber[18]; ///< Part Number.
2556 OUT UINT8 Attributes; ///< Bits 7-4: Reserved, Bits 3-0: rank.
2557 OUT UINT32 ExtSize; ///< Extended Size.
2558 OUT UINT8 Socket:3; ///< Socket ID
2559 OUT UINT8 Channel:2; ///< Channel ID
2560 OUT UINT8 Dimm:2; ///< DIMM ID
2561 OUT UINT8 DimmPresent:1; ///< Dimm Present
2562 OUT UINT32 StartingAddr; ///< The physical address, in kilobytes, of a range
2563 ///< of memory mapped to the referenced Memory Device.
2564 OUT UINT32 EndingAddr; ///< The handle, or instance number, associated with
2565 ///< the Memory Device structure to which this address
2566 ///< range is mapped.
2567 OUT UINT16 ConfigSpeed; ///< Configured memory clock speed
2568} MEM_DMI_INFO;
2569
2570/// DMI Type 19 - Memory Array Mapped Address
2571typedef struct {
2572 OUT UINT32 StartingAddr; ///< The physical address, in kilobytes,
2573 ///< of a range of memory mapped to the
2574 ///< specified physical memory array.
2575 OUT UINT32 EndingAddr; ///< The physical ending address of the
2576 ///< last kilobyte of a range of addresses
2577 ///< mapped to the specified physical memory array.
2578 OUT UINT16 MemoryArrayHandle; ///< The handle, or instance number, associated
2579 ///< with the physical memory array to which this
2580 ///< address range is mapped.
2581 OUT UINT8 PartitionWidth; ///< Identifies the number of memory devices that
2582 ///< form a single row of memory for the address
2583 ///< partition defined by this structure.
2584} TYPE19_DMI_INFO;
2585
2586///DMI Type 20 - Memory Device Mapped Address
2587typedef struct {
2588 OUT UINT32 StartingAddr; ///< The physical address, in kilobytes, of a range
2589 ///< of memory mapped to the referenced Memory Device.
2590 OUT UINT32 EndingAddr; ///< The handle, or instance number, associated with
2591 ///< the Memory Device structure to which this address
2592 ///< range is mapped.
2593 OUT UINT16 MemoryDeviceHandle; ///< The handle, or instance number, associated with
2594 ///< the Memory Device structure to which this address
2595 ///< range is mapped.
2596 OUT UINT16 MemoryArrayMappedAddressHandle; ///< The handle, or instance number, associated
2597 ///< with the Memory Array Mapped Address structure to
2598 ///< which this device address range is mapped.
2599 OUT UINT8 PartitionRowPosition; ///< Identifies the position of the referenced Memory
2600 ///< Device in a row of the address partition.
2601 OUT UINT8 InterleavePosition; ///< The position of the referenced Memory Device in
2602 ///< an interleave.
2603 OUT UINT8 InterleavedDataDepth; ///< The maximum number of consecutive rows from the
2604 ///< referenced Memory Device that are accessed in a
2605 ///< single interleaved transfer.
2606} TYPE20_DMI_INFO;
2607
2608/// Collection of pointers to the DMI records
2609typedef struct {
2610 OUT TYPE4_DMI_INFO T4[MAX_SOCKETS_SUPPORTED]; ///< Type 4 struc
2611 OUT TYPE7_DMI_INFO T7L1[MAX_SOCKETS_SUPPORTED]; ///< Type 7 struc 1
2612 OUT TYPE7_DMI_INFO T7L2[MAX_SOCKETS_SUPPORTED]; ///< Type 7 struc 2
2613 OUT TYPE7_DMI_INFO T7L3[MAX_SOCKETS_SUPPORTED]; ///< Type 7 struc 3
2614 OUT TYPE16_DMI_INFO T16; ///< Type 16 struc
2615 OUT TYPE17_DMI_INFO T17[MAX_SOCKETS_SUPPORTED][MAX_CHANNELS_PER_SOCKET][MAX_DIMMS_PER_CHANNEL]; ///< Type 17 struc
2616 OUT TYPE19_DMI_INFO T19; ///< Type 19 struc
2617 OUT TYPE20_DMI_INFO T20[MAX_SOCKETS_SUPPORTED][MAX_CHANNELS_PER_SOCKET][MAX_DIMMS_PER_CHANNEL]; ///< Type 20 struc
2618} DMI_INFO;
2619
2620/**********************************************************************
2621 * Interface call: AllocateExecutionCache
2622 **********************************************************************/
2623#define MAX_CACHE_REGIONS 3
2624
2625/// AllocateExecutionCache sub param structure for cached memory region
2626typedef struct {
2627 IN OUT UINT32 ExeCacheStartAddr; ///< Start address
2628 IN OUT UINT32 ExeCacheSize; ///< Size
2629} EXECUTION_CACHE_REGION;
2630
2631/**********************************************************************
2632 * Interface call: AmdGetAvailableExeCacheSize
2633 **********************************************************************/
2634/// Get available Cache remain
2635typedef struct {
2636 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2637 OUT UINT32 AvailableExeCacheSize; ///< Remain size
2638} AMD_GET_EXE_SIZE_PARAMS;
2639
2640AGESA_STATUS
2641AmdGetAvailableExeCacheSize (
2642 IN OUT AMD_GET_EXE_SIZE_PARAMS *AmdGetExeSizeParams
2643 );
2644
2645/// Selection type for core leveling
2646typedef enum {
2647 CORE_LEVEL_LOWEST, ///< Level to lowest common denominator
2648 CORE_LEVEL_TWO, ///< Level to 2 cores
2649 CORE_LEVEL_POWER_OF_TWO, ///< Level to 1,2,4 or 8
2650 CORE_LEVEL_NONE, ///< Do no leveling
2651 CORE_LEVEL_COMPUTE_UNIT, ///< Level cores to one core per compute unit
2652 CORE_LEVEL_ONE, ///< Level to 1 core
2653 CORE_LEVEL_THREE, ///< Level to 3 cores
2654 CORE_LEVEL_FOUR, ///< Level to 4 cores
2655 CORE_LEVEL_FIVE, ///< Level to 5 cores
2656 CORE_LEVEL_SIX, ///< Level to 6 cores
2657 CORE_LEVEL_SEVEN, ///< Level to 7 cores
2658 CORE_LEVEL_EIGHT, ///< Level to 8 cores
2659 CORE_LEVEL_NINE, ///< Level to 9 cores
2660 CORE_LEVEL_TEN, ///< Level to 10 cores
2661 CORE_LEVEL_ELEVEN, ///< Level to 11 cores
2662 CORE_LEVEL_TWELVE, ///< Level to 12 cores
2663 CORE_LEVEL_THIRTEEN, ///< Level to 13 cores
2664 CORE_LEVEL_FOURTEEN, ///< Level to 14 cores
2665 CORE_LEVEL_FIFTEEN, ///< Level to 15 cores
2666 CoreLevelModeMax ///< Used for bounds checking
2667} CORE_LEVELING_TYPE;
2668
2669
2670
2671
2672
2673/************************************************************************
2674 *
2675 * AGESA Basic Level interface structure definition and function prototypes
2676 *
2677 ***********************************************************************/
2678
2679/**********************************************************************
2680 * Interface call: AmdCreateStruct
2681 **********************************************************************/
2682AGESA_STATUS
2683AmdCreateStruct (
2684 IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
2685 );
2686
2687/**********************************************************************
2688 * Interface call: AmdReleaseStruct
2689 **********************************************************************/
2690AGESA_STATUS
2691AmdReleaseStruct (
2692 IN OUT AMD_INTERFACE_PARAMS *InterfaceParams
2693 );
2694
2695/**********************************************************************
2696 * Interface call: AmdInitReset
2697 **********************************************************************/
2698/// AmdInitReset param structure
2699typedef struct {
2700 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2701 IN EXECUTION_CACHE_REGION CacheRegion[3]; ///< The cached memory region
2702 IN AMD_HT_RESET_INTERFACE HtConfig; ///< The interface for Ht Recovery
2703} AMD_RESET_PARAMS;
2704
2705AGESA_STATUS
2706AmdInitReset (
2707 IN OUT AMD_RESET_PARAMS *ResetParams
2708 );
2709
2710
2711/**********************************************************************
2712 * Interface call: AmdInitEarly
2713 **********************************************************************/
2714/// InitEarly param structure
2715///
2716/// Provide defaults or customizations to each service performed in AmdInitEarly.
2717///
2718typedef struct {
2719 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2720 IN EXECUTION_CACHE_REGION CacheRegion[3]; ///< Execution Map Interface
2721 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2722 IN AMD_HT_INTERFACE HtConfig; ///< HyperTransport Interface
2723 IN GNB_CONFIGURATION GnbConfig; ///< GNB configuration
2724} AMD_EARLY_PARAMS;
2725
2726AGESA_STATUS
2727AmdInitEarly (
2728 IN OUT AMD_EARLY_PARAMS *EarlyParams
2729 );
2730
2731
2732/**********************************************************************
2733 * Interface call: AmdInitPost
2734 **********************************************************************/
2735/// AmdInitPost param structure
2736typedef struct {
2737 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2738 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2739 IN MEM_PARAMETER_STRUCT MemConfig; ///< Memory post param
2740} AMD_POST_PARAMS;
2741
2742AGESA_STATUS
2743AmdInitPost (
2744 IN OUT AMD_POST_PARAMS *PostParams ///< Amd Cpu init param
2745 );
2746
2747
2748/**********************************************************************
2749 * Interface call: AmdInitEnv
2750 **********************************************************************/
2751/// AmdInitEnv param structure
2752typedef struct {
2753 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2754 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2755 IN GNB_ENV_CONFIGURATION GnbEnvConfiguration; ///< platform operational characteristics.
2756} AMD_ENV_PARAMS;
2757
2758AGESA_STATUS
2759AmdInitEnv (
2760 IN OUT AMD_ENV_PARAMS *EnvParams
2761 );
2762
2763
2764/**********************************************************************
2765 * Interface call: AmdInitMid
2766 **********************************************************************/
2767/// AmdInitMid param structure
2768typedef struct {
2769 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2770 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2771} AMD_MID_PARAMS;
2772
2773AGESA_STATUS
2774AmdInitMid (
2775 IN OUT AMD_MID_PARAMS *MidParams
2776 );
2777
2778
2779/**********************************************************************
2780 * Interface call: AmdInitLate
2781 **********************************************************************/
2782/// AmdInitLate param structure
2783typedef struct {
2784 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2785 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2786 OUT DMI_INFO *DmiTable; ///< DMI Interface
2787 OUT VOID *AcpiPState; ///< Acpi Pstate SSDT Table
2788 OUT VOID *AcpiSrat; ///< SRAT Table
2789 OUT VOID *AcpiSlit; ///< SLIT Table
2790 OUT VOID *AcpiWheaMce; ///< WHEA MCE Table
2791 OUT VOID *AcpiWheaCmc; ///< WHEA CMC Table
2792 OUT VOID *AcpiAlib; ///< ACPI SSDT table with ALIB implementation
Kyösti Mälkki6cb4ee32017-07-25 12:07:59 +03002793 OUT VOID *AcpiIvrs; ///< IOMMU ACPI IVRS(I/O Virtualization Reporting Structure) table
2794 OUT VOID *AcpiCrat; ///< Component Resource Affinity Table table
2795 OUT VOID *AcpiCdit; ///< Component Locality Distance Information table
Frank Vibrans2b4c8312011-02-14 18:30:54 +00002796} AMD_LATE_PARAMS;
2797
2798AGESA_STATUS
2799AmdInitLate (
2800 IN OUT AMD_LATE_PARAMS *LateParams
2801 );
2802
2803/**********************************************************************
2804 * Interface call: AmdInitRecovery
2805 **********************************************************************/
2806/// CPU Recovery Parameters
2807typedef struct {
2808 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2809 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2810} AMD_CPU_RECOVERY_PARAMS;
2811
2812/// AmdInitRecovery param structure
2813typedef struct {
2814 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2815 IN MEM_PARAMETER_STRUCT MemConfig; ///< Memory post param
2816 IN EXECUTION_CACHE_REGION CacheRegion[3]; ///< The cached memory region. And the max cache region is 3
2817 IN AMD_CPU_RECOVERY_PARAMS CpuRecoveryParams; ///< Params for CPU related recovery init.
2818} AMD_RECOVERY_PARAMS;
2819
2820AGESA_STATUS
2821AmdInitRecovery (
2822 IN OUT AMD_RECOVERY_PARAMS *RecoveryParams
2823 );
2824
2825/**********************************************************************
2826 * Interface call: AmdInitResume
2827 **********************************************************************/
2828/// AmdInitResume param structure
2829typedef struct {
2830 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2831 IN PLATFORM_CONFIGURATION PlatformConfig; ///< Platform operational characteristics
2832 IN AMD_S3_PARAMS S3DataBlock; ///< Save state data
2833} AMD_RESUME_PARAMS;
2834
2835AGESA_STATUS
2836AmdInitResume (
2837 IN AMD_RESUME_PARAMS *ResumeParams
2838 );
2839
2840
2841/**********************************************************************
2842 * Interface call: AmdS3LateRestore
2843 **********************************************************************/
2844/// AmdS3LateRestore param structure
2845typedef struct {
2846 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2847 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2848 IN AMD_S3_PARAMS S3DataBlock; ///< Save state data
2849} AMD_S3LATE_PARAMS;
2850
2851AGESA_STATUS
2852AmdS3LateRestore (
2853 IN OUT AMD_S3LATE_PARAMS *S3LateParams
2854 );
2855
2856
2857/**********************************************************************
2858 * Interface call: AmdS3Save
2859 **********************************************************************/
2860/// AmdS3Save param structure
2861typedef struct {
2862 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2863 IN PLATFORM_CONFIGURATION PlatformConfig; ///< platform operational characteristics.
2864 OUT AMD_S3_PARAMS S3DataBlock; ///< Standard header
2865} AMD_S3SAVE_PARAMS;
2866
2867AGESA_STATUS
2868AmdS3Save (
2869 IN OUT AMD_S3SAVE_PARAMS *AmdS3SaveParams
2870 );
2871
2872
2873/**********************************************************************
2874 * Interface call: AmdLateRunApTask
2875 **********************************************************************/
2876/**
2877 * Entry point for AP tasking.
2878 */
2879AGESA_STATUS
2880AmdLateRunApTask (
2881 IN AP_EXE_PARAMS *AmdApExeParams
2882);
2883
2884//
2885// General Services API
2886//
2887
2888/**********************************************************************
2889 * Interface service call: AmdGetApicId
2890 **********************************************************************/
2891/// Request the APIC ID of a particular core.
2892
2893typedef struct {
2894 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2895 IN UINT8 Socket; ///< The Core's Socket.
2896 IN UINT8 Core; ///< The Core id.
2897 OUT BOOLEAN IsPresent; ///< The Core is present, and ApicAddress is valid.
2898 OUT UINT8 ApicAddress; ///< The Core's APIC ID.
2899} AMD_APIC_PARAMS;
2900
2901/**
2902 * Get a specified Core's APIC ID.
2903 */
2904AGESA_STATUS
2905AmdGetApicId (
2906 IN OUT AMD_APIC_PARAMS *AmdParamApic
2907);
2908
2909/**********************************************************************
2910 * Interface service call: AmdGetPciAddress
2911 **********************************************************************/
2912/// Request the PCI Address of a Processor Module (that is, its Northbridge)
2913
2914typedef struct {
2915 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2916 IN UINT8 Socket; ///< The Processor's socket
2917 IN UINT8 Module; ///< The Module in that Processor
2918 OUT BOOLEAN IsPresent; ///< The Core is present, and PciAddress is valid.
2919 OUT PCI_ADDR PciAddress; ///< The Processor's PCI Config Space address (Function 0, Register 0)
2920} AMD_GET_PCI_PARAMS;
2921
2922/**
2923 * Get Processor Module's PCI Config Space address.
2924 */
2925AGESA_STATUS
2926AmdGetPciAddress (
2927 IN OUT AMD_GET_PCI_PARAMS *AmdParamGetPci
2928);
2929
2930/**********************************************************************
2931 * Interface service call: AmdIdentifyCore
2932 **********************************************************************/
2933/// Request the identity (Socket, Module, Core) of the current Processor Core
2934
2935typedef struct {
2936 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2937 OUT UINT8 Socket; ///< The current Core's Socket
2938 OUT UINT8 Module; ///< The current Core's Processor Module
2939 OUT UINT8 Core; ///< The current Core's core id.
2940} AMD_IDENTIFY_PARAMS;
2941
2942/**
2943 * "Who am I" for the current running core.
2944 */
2945AGESA_STATUS
2946AmdIdentifyCore (
2947 IN OUT AMD_IDENTIFY_PARAMS *AmdParamIdentify
2948);
2949
2950/**********************************************************************
2951 * Interface service call: AmdReadEventLog
2952 **********************************************************************/
2953/// An Event Log Entry.
2954typedef struct {
2955 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2956 OUT UINT32 EventClass; ///< The severity of this event, matches AGESA_STATUS.
2957 OUT UINT32 EventInfo; ///< The unique event identifier, zero means "no event".
2958 OUT UINT32 DataParam1; ///< Data specific to the Event.
2959 OUT UINT32 DataParam2; ///< Data specific to the Event.
2960 OUT UINT32 DataParam3; ///< Data specific to the Event.
2961 OUT UINT32 DataParam4; ///< Data specific to the Event.
2962} EVENT_PARAMS;
2963
2964/**
2965 * Read an Event from the Event Log.
2966 */
2967AGESA_STATUS
2968AmdReadEventLog (
2969 IN EVENT_PARAMS *Event
2970);
2971
2972/**********************************************************************
2973 * Interface service call: AmdIdentifyDimm
2974 **********************************************************************/
2975/// Request the identity of dimm from system address
2976
2977typedef struct {
2978 IN OUT AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
2979 IN UINT64 MemoryAddress; ///< System Address that needs to be translated to dimm identification.
2980 OUT UINT8 SocketId; ///< The socket on which the targeted address locates.
2981 OUT UINT8 MemChannelId; ///< The channel on which the targeted address locates.
2982 OUT UINT8 DimmId; ///< The dimm on which the targeted address locates.
2983} AMD_IDENTIFY_DIMM;
2984
2985/**
2986 * Get the dimm identification for the address.
2987 */
2988AGESA_STATUS
2989AmdIdentifyDimm (
2990 IN OUT AMD_IDENTIFY_DIMM *AmdDimmIdentify
2991);
2992
2993/// Data structure for the Mapping Item between Unified ID for IDS Setup Option
2994/// and the option value.
2995///
2996typedef struct {
2997 IN UINT16 IdsNvId; ///< Unified ID for IDS Setup Option.
2998 OUT UINT16 IdsNvValue; ///< The value of IDS Setup Option.
2999} IDS_NV_ITEM;
3000
3001/// Data Structure for IDS CallOut Function
3002typedef struct {
3003 IN AMD_CONFIG_PARAMS StdHeader; ///< Standard configuration header
3004 IN IDS_NV_ITEM *IdsNvPtr; ///< Memory Pointer of IDS NV Table
3005 IN OUT UINTN Reserved; ///< reserved
3006} IDS_CALLOUT_STRUCT;
3007
3008AGESA_STATUS
3009AmdIdsRunApTaskLate (
3010 IN AP_EXE_PARAMS *AmdApExeParams
3011 );
3012
3013
3014#define AGESA_IDS_DFT_VAL 0xFFFF ///< Default value of every uninitlized NV item, the action for it will be ignored
3015#define AGESA_IDS_NV_END 0xFFFF ///< Flag specify end of option structure
3016/// WARNING: Don't change the comment below, it used as signature for script
3017/// AGESA IDS NV ID Definitions
3018typedef enum {
3019 AGESA_IDS_EXT_ID_START = 0x0000,///< 0x0000 specify the start of external NV id
3020
3021 AGESA_IDS_NV_UCODE, ///< 0x0001 Enable or disable microcode patching
3022
3023 AGESA_IDS_NV_TARGET_PSTATE, ///< 0x0002 Set the P-state required to be activated
3024 AGESA_IDS_NV_POSTPSTATE, ///< 0x0003 Set the P-state required to be activated through POST
3025
3026 AGESA_IDS_NV_BANK_INTERLEAVE, ///< 0x0004 Enable or disable Bank Interleave
3027 AGESA_IDS_NV_CHANNEL_INTERLEAVE, ///< 0x0005 Enable or disable Channel Interleave
3028 AGESA_IDS_NV_NODE_INTERLEAVE, ///< 0x0006 Enable or disable Node Interleave
3029 AGESA_IDS_NV_MEMHOLE, ///< 0x0007 Enables or disable memory hole
3030
3031 AGESA_IDS_NV_SCRUB_REDIRECTION, ///< 0x0008 Enable or disable a write to dram with corrected data
3032 AGESA_IDS_NV_DRAM_SCRUB, ///< 0x0009 Set the rate of background scrubbing for DRAM
3033 AGESA_IDS_NV_DCACHE_SCRUB, ///< 0x000A Set the rate of background scrubbing for the DCache.
3034 AGESA_IDS_NV_L2_SCRUB, ///< 0x000B Set the rate of background scrubbing for the L2 cache
3035 AGESA_IDS_NV_L3_SCRUB, ///< 0x000C Set the rate of background scrubbing for the L3 cache
3036 AGESA_IDS_NV_ICACHE_SCRUB, ///< 0x000D Set the rate of background scrubbing for the Icache
3037 AGESA_IDS_NV_SYNC_ON_ECC_ERROR, ///< 0x000E Enable or disable the sync flood on un-correctable ECC error
3038 AGESA_IDS_NV_ECC_SYMBOL_SIZE, ///< 0x000F Set ECC symbol size
3039
3040 AGESA_IDS_NV_ALL_MEMCLKS, ///< 0x0010 Enable or disable all memory clocks enable
3041 AGESA_IDS_NV_DCT_GANGING_MODE, ///< 0x0011 Set the Ganged mode
3042 AGESA_IDS_NV_DRAM_BURST_LENGTH32, ///< 0x0012 Set the DRAM Burst Length 32
3043 AGESA_IDS_NV_MEMORY_POWER_DOWN, ///< 0x0013 Enable or disable Memory power down mode
3044 AGESA_IDS_NV_MEMORY_POWER_DOWN_MODE, ///< 0x0014 Set the Memory power down mode
3045 AGESA_IDS_NV_DLL_SHUT_DOWN, ///< 0x0015 Enable or disable DLLShutdown
3046 AGESA_IDS_NV_ONLINE_SPARE, ///< 0x0016 Enable or disable the Dram controller to designate a DIMM bank as a spare for logical swap
3047
3048 AGESA_IDS_NV_HT_ASSIST, ///< 0x0017 Enable or Disable HT Assist
3049 AGESA_IDS_NV_ATMMODE, ///< 0x0018 Enable or Disable ATM mode
3050
3051 AGESA_IDS_NV_HDTOUT, ///< 0x0019 Enable or disable HDTOUT feature
3052
3053 AGESA_IDS_NV_HTLINKSOCKET, ///< 0x001A HT Link Socket
3054 AGESA_IDS_NV_HTLINKPORT, ///< 0x001B HT Link Port
3055 AGESA_IDS_NV_HTLINKFREQ, ///< 0x001C HT Link Frequency
3056 AGESA_IDS_NV_HTLINKWIDTHIN, ///< 0x001D HT Link In Width
3057 AGESA_IDS_NV_HTLINKWIDTHOUT, ///< 0x001E HT Link Out Width
3058
3059 AGESA_IDS_NV_GNBHDAUDIOEN, ///< 0x001F Enable or disable GNB HD Audio
3060
3061 AGESA_IDS_NV_CPB_EN, ///< 0x0020 Core Performance Boost
3062
3063 AGESA_IDS_NV_HTC_EN, ///< 0x0021 HTC Enable
3064 AGESA_IDS_NV_HTC_OVERRIDE, ///< 0x0022 HTC Override
3065 AGESA_IDS_NV_HTC_PSTATE_LIMIT, ///< 0x0023 HTC P-state limit select
3066 AGESA_IDS_NV_HTC_TEMP_HYS, ///< 0x0024 HTC Temperature Hysteresis
3067 AGESA_IDS_NV_HTC_ACT_TEMP, ///< 0x0025 HTC Activation Temp
3068
3069 AGESA_IDS_NV_POWER_POLICY, ///< 0x0026 Select Platform Power Policy
3070 AGESA_IDS_EXT_ID_END, ///< 0x0027 specify the end of external NV ID
3071} IDS_EX_NV_ID;
3072
3073
3074#define IDS_NUM_EXT_NV_ITEM (AGESA_IDS_EXT_ID_END - AGESA_IDS_EXT_ID_START + 1)
3075
3076#endif // _AGESA_H_