1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
|
/* $NoKeywords:$ */
/**
* @file
*
* Internal access to HT Interface.
*
* This file provides definitions used by HT internal modules. The
* external HT interface (in agesa.h) is accessed using these methods.
* This keeps the HT Feature implementations abstracted from the HT
* interface.
*
* This file includes the interface access constructor and interface
* support which is not removed with various build options.
*
* @xrefitem bom "File Content Label" "Release Content"
* @e project: AGESA
* @e sub-project: HyperTransport
* @e \$Revision: 44324 $ @e \$Date: 2010-12-22 02:16:51 -0700 (Wed, 22 Dec 2010) $
*
*/
/*
*****************************************************************************
*
* Copyright (C) 2012 Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Advanced Micro Devices, Inc. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***************************************************************************
*
*/
#ifndef _HT_INTERFACE_H_
#define _HT_INTERFACE_H_
/**
* @page htimplintf HT Internal Interface Implementation Guide
*
* HT Internal Interface provides access to the HT Component external interface (see AGESA.h),
* in a manner that isolates calling code from knowledge about the external interface or which
* interfaces are supported in the current build.
*
* @par Adding a Method to HT Internal Interface
*
* To add a new method to the HT Internal Interface, follow these steps.
* <ul>
* <li> Create a typedef for the Method with the correct parameters and return type.
*
* <ul>
* <li> Name the method typedef (F_METHOD_NAME)(), where METHOD_NAME is the same name as the method table item,
* but with "_"'s and UPPERCASE, rather than mixed case.
* @n <tt> typedef VOID (F_METHOD_NAME)(); </tt> @n
*
* <li> Make a reference type for references to a method implementation:
* @n <tt> /// Reference to a Method </tt>
* @n <tt> typedef F_METHOD_NAME *PF_METHOD_NAME </tt> @n
* </ul>
*
* <li> Provide a standard doxygen function preamble for the Method typedef. Begin the
* detailed description by providing a reference to the method instances page by including
* the lines below:
* @code
* *
* * @HtInterfaceInstances
* *
* @endcode
* @note It is important to provide documentation for the method type, because the method may not
* have an implementation in any families supported by the current package. @n
*
* <li> Add to the HT_INTERFACE struct an item for the Method:
* @n <tt> PF_METHOD_NAME MethodName; ///< Method: description. </tt> @n
* </ul>
*
* @par Implementing an HT Internal Interface Instance of the method.
*
* To implement an instance of a method for a specific interface follow these steps.
*
* - In appropriate files, implement the method with the return type and parameters
* matching the method typedef.
*
* - Name the function MethodName().
*
* - Create a doxygen function preamble for the method instance. Begin the detailed description with
* an Implements command to reference the method type and add this instance to the Method Instances page.
* @code
* *
* * @HtInterfaceMethod{::F_METHOD_NAME}.
* *
* @endcode
*
* - To access other Ht internal interface routines or data as part of the method implementation, the function
* must use HtInterface->OtherMethod(). Do not directly access other HT internal interface
* routines, because in the table there may be overrides or this routine may be shared by multiple families.
*
* - Add the instance to the HT_INTERFACE instances.
*
* - If a configuration does not need an instance of the method use one of the CommonReturns from
* CommonReturns.h with the same return type.
*
* @par Invoking HT Internal Interface Methods.
*
* The first step is carried out only once by the top level HT entry point.
* @n @code
* HT_INTERFACE HtInterface;
* // Get the current HT internal interface (to HtBlock data)
* NewHtInterface (&HtInterface);
* State->HtInterface = &HtInterface;
* @endcode
*
* The following example shows how to invoke a HT Internal Interface method.
* @n @code
* State->HtInterface->MethodName ();
* @endcode
*
*/
/*----------------------------------------------------------------------------
* Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
*
*----------------------------------------------------------------------------
*/
/*-----------------------------------------------------------------------------
* DEFINITIONS AND MACROS
*
*-----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* TYPEDEFS, STRUCTURES, ENUMS
*
*----------------------------------------------------------------------------
*/
/**
* Get limits for CPU to CPU Links.
*
* @HtInterfaceInstances.
*
* @param[in] NodeA One Node on which this Link is located
* @param[in] LinkA The Link on this Node
* @param[in] NodeB The other Node on which this Link is located
* @param[in] LinkB The Link on that Node
* @param[in,out] ABLinkWidthLimit modify to change the Link Width In
* @param[in,out] BALinkWidthLimit modify to change the Link Width Out
* @param[in,out] PcbFreqCap modify to change the Link's frequency capability
* @param[in] State the input data
*
*/
typedef VOID F_GET_CPU_2_CPU_PCB_LIMITS (
IN UINT8 NodeA,
IN UINT8 LinkA,
IN UINT8 NodeB,
IN UINT8 LinkB,
IN OUT UINT8 *ABLinkWidthLimit,
IN OUT UINT8 *BALinkWidthLimit,
IN OUT UINT32 *PcbFreqCap,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_CPU_2_CPU_PCB_LIMITS *PF_GET_CPU_2_CPU_PCB_LIMITS;
/**
* Skip reganging of subLinks.
*
* @HtInterfaceInstances.
*
* @param[in] NodeA One Node on which this Link is located
* @param[in] LinkA The Link on this Node
* @param[in] NodeB The other Node on which this Link is located
* @param[in] LinkB The Link on that Node
* @param[in] State the input data
*
* @retval MATCHED leave Link unganged
* @retval POWERED_OFF leave link unganged and power off the paired sublink
* @retval UNMATCHED regang Link automatically
*/
typedef FINAL_LINK_STATE F_GET_SKIP_REGANG (
IN UINT8 NodeA,
IN UINT8 LinkA,
IN UINT8 NodeB,
IN UINT8 LinkB,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_SKIP_REGANG *PF_GET_SKIP_REGANG;
/**
* Manually control bus number assignment.
*
* @HtInterfaceInstances.
*
* @param[in] Node The Node on which this chain is located
* @param[in] Link The Link on the host for this chain
* @param[out] SecBus Secondary Bus number for this non-coherent chain
* @param[out] SubBus Subordinate Bus number
* @param[in] State the input data
*
* @retval TRUE this routine is supplying the bus numbers
* @retval FALSE use auto Bus numbering
*/
typedef BOOLEAN F_GET_OVERRIDE_BUS_NUMBERS (
IN UINT8 Node,
IN UINT8 Link,
OUT UINT8 *SecBus,
OUT UINT8 *SubBus,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_OVERRIDE_BUS_NUMBERS *PF_GET_OVERRIDE_BUS_NUMBERS;
/**
* Get Manual BUID assignment list.
*
* @HtInterfaceInstances.
*
* @param[in] Node The Node on which this chain is located
* @param[in] Link The Link on the host for this chain
* @param[out] List a pointer to a list, if returns TRUE
* @param[in] State the input data
*
* @retval TRUE use manual List
* @retval FALSE initialize the Link automatically. List not valid.
*/
typedef BOOLEAN F_GET_MANUAL_BUID_SWAP_LIST (
IN UINT8 Node,
IN UINT8 Link,
OUT BUID_SWAP_LIST **List,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_MANUAL_BUID_SWAP_LIST *PF_GET_MANUAL_BUID_SWAP_LIST;
/**
* Override capabilities of a device.
*
* @HtInterfaceInstances.
*
* @param[in] HostNode The Node on which this chain is located
* @param[in] HostLink The Link on the host for this chain
* @param[in] Depth The Depth in the I/O chain from the Host
* @param[in] PciAddress The Device's PCI config address (for callout)
* @param[in] DevVenId The Device's PCI Vendor + Device ID (offset 0x00)
* @param[in] Revision The Device's PCI Revision
* @param[in] Link The Device's Link number (0 or 1)
* @param[in,out] LinkWidthIn modify to change the Link Width In
* @param[in,out] LinkWidthOut modify to change the Link Width Out
* @param[in,out] FreqCap modify to change the Link's frequency capability
* @param[in,out] Clumping modify to change unit id clumping capability
* @param[in] State the input data
*
*/
typedef VOID F_GET_DEVICE_CAP_OVERRIDE (
IN UINT8 HostNode,
IN UINT8 HostLink,
IN UINT8 Depth,
IN PCI_ADDR PciAddress,
IN UINT32 DevVenId,
IN UINT8 Revision,
IN UINT8 Link,
IN OUT UINT8 *LinkWidthIn,
IN OUT UINT8 *LinkWidthOut,
IN OUT UINT32 *FreqCap,
IN OUT UINT32 *Clumping,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_DEVICE_CAP_OVERRIDE *PF_GET_DEVICE_CAP_OVERRIDE;
/**
* Get limits for non-coherent Links.
*
* @HtInterfaceInstances.
*
* @param[in] HostNode The Node on which this Link is located
* @param[in] HostLink The Link about to be initialized
* @param[in] Depth The Depth in the I/O chain from the Host
* @param[in,out] DownstreamLinkWidthLimit modify to change the Link Width In
* @param[in,out] UpstreamLinkWidthLimit modify to change the Link Width Out
* @param[in,out] PcbFreqCap modify to change the Link's frequency capability
* @param[in] State the input data
*/
typedef VOID F_GET_IO_PCB_LIMITS (
IN UINT8 HostNode,
IN UINT8 HostLink,
IN UINT8 Depth,
IN OUT UINT8 *DownstreamLinkWidthLimit,
IN OUT UINT8 *UpstreamLinkWidthLimit,
IN OUT UINT32 *PcbFreqCap,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_IO_PCB_LIMITS *PF_GET_IO_PCB_LIMITS;
/**
* Get the Socket number for a given Node number.
*
* @HtInterfaceInstances.
*
* @param[in] Node Node discovered event data.
* @param[in] State reference to Node to socket map
*
* @return the socket id
*
*/
typedef UINT8 F_GET_SOCKET_FROM_MAP (
IN UINT8 Node,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_SOCKET_FROM_MAP *PF_GET_SOCKET_FROM_MAP;
/**
* Ignore a Link.
*
* @HtInterfaceInstances.
*
* @param[in] Node The Node on which this Link is located
* @param[in] Link The Link about to be initialized
* @param[in] NbList The northbridge default ignore link list
* @param[in] State the input data
*
* @retval MATCHED ignore this Link and skip it
* @retval POWERED_OFF ignore this link and power it off.
* @retval UNMATCHED initialize the Link normally
*/
typedef FINAL_LINK_STATE F_GET_IGNORE_LINK (
IN UINT8 Node,
IN UINT8 Link,
IN IGNORE_LINK *NbIgnoreLinkList,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_GET_IGNORE_LINK *PF_GET_IGNORE_LINK;
/**
* Post Node id and other context info to AP cores via mailbox.
*
* @HtInterfaceInstances.
*
* @param[in] State Our state
*/
typedef VOID F_POST_MAP_TO_AP (
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_POST_MAP_TO_AP *PF_POST_MAP_TO_AP;
/**
* Clean up the map structures after severe event has caused a fall back to 1 node.
*
* @HtInterfaceInstances.
*
* @param[in] State Our state
*/
typedef VOID F_CLEAN_MAPS_AFTER_ERROR (
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_CLEAN_MAPS_AFTER_ERROR *PF_CLEAN_MAPS_AFTER_ERROR;
/**
* Get a new Socket Die to Node Map.
*
* @HtInterfaceInstances.
*
* @param[in,out] State global state
*/
typedef VOID F_NEW_NODE_AND_SOCKET_TABLES (
IN OUT STATE_DATA *State
);
/// Reference to a method.
typedef F_NEW_NODE_AND_SOCKET_TABLES *PF_NEW_NODE_AND_SOCKET_TABLES;
/**
* Fill in the socket's Node id when a processor is discovered in that socket.
*
* @HtInterfaceInstances.
*
* @param[in] Node Node from which a new node was discovered
* @param[in] CurrentNodeModule The current node's module id in it's processor.
* @param[in] PackageLink The package level link from Node to NewNode.
* @param[in] NewNode The new node's id
* @param[in] HardwareSocket If we use the hardware method (preferred), this is the socket of new node.
* @param[in] Module The new node's module id in it's processor.
* @param[in] State our State
*/
typedef VOID F_SET_NODE_TO_SOCKET_MAP (
IN UINT8 Node,
IN UINT8 CurrentNodeModule,
IN UINT8 PackageLink,
IN UINT8 NewNode,
IN UINT8 HardwareSocket,
IN UINT8 Module,
IN STATE_DATA *State
);
/// Reference to a method.
typedef F_SET_NODE_TO_SOCKET_MAP *PF_SET_NODE_TO_SOCKET_MAP;
/**
* Get a new, empty Hop Count Table, to make one for the installed topology.
*
* @HtInterfaceInstances.
*
* @param[in,out] State Keep our buffer handle.
*
*/
typedef VOID F_NEW_HOP_COUNT_TABLE (
IN OUT STATE_DATA *State
);
/// Reference to a method.
typedef F_NEW_HOP_COUNT_TABLE *PF_NEW_HOP_COUNT_TABLE;
/**
* Get the minimum Northbridge frequency for the system.
*
* @HtInterfaceInstances.
*
* Invoke the CPU component power mgt interface.
*
* @param[in] PlatformConfig Platform profile/build option config structure.
* @param[in] StdHeader Config for library and services.
*
* @return Frequency in MHz.
*
*/
typedef UINT32 F_GET_MIN_NB_CORE_FREQ (
IN PLATFORM_CONFIGURATION *PlatformConfig,
IN AMD_CONFIG_PARAMS *StdHeader
);
/// Reference to a Method.
typedef F_GET_MIN_NB_CORE_FREQ *PF_GET_MIN_NB_CORE_FREQ;
/**
* The HT Interface, feature code uses these methods to get interface parameters.
*/
struct _HT_INTERFACE { // See Forward Declaration in HtFeates.h
PF_GET_CPU_2_CPU_PCB_LIMITS GetCpu2CpuPcbLimits; /**< Method: Get link limits for coherent links. */
PF_GET_SKIP_REGANG GetSkipRegang; /**< Method: Skip reganging for coherent links. */
PF_NEW_HOP_COUNT_TABLE NewHopCountTable; /**< Method: Get a new hop count table. */
PF_GET_OVERRIDE_BUS_NUMBERS GetOverrideBusNumbers; /**< Method: Control Bus number assignment. */
PF_GET_MANUAL_BUID_SWAP_LIST GetManualBuidSwapList; /**< Method: Assign device IDs. */
PF_GET_DEVICE_CAP_OVERRIDE GetDeviceCapOverride; /**< Method: Override Device capabilities. */
PF_GET_IO_PCB_LIMITS GetIoPcbLimits; /**< Method: Get link limits for noncoherent links. */
PF_GET_SOCKET_FROM_MAP GetSocketFromMap; /**< Method: Get the Socket for a node id. */
PF_GET_IGNORE_LINK GetIgnoreLink; /**< Method: Ignore a link. */
PF_POST_MAP_TO_AP PostMapToAp; /**< Method: Post Socket and other info to AP cores. */
PF_NEW_NODE_AND_SOCKET_TABLES NewNodeAndSocketTables; /**< Method: Get new socket and node maps. */
PF_CLEAN_MAPS_AFTER_ERROR CleanMapsAfterError; /**< Method: Clean up maps for forced 1P on error fall back. */
PF_SET_NODE_TO_SOCKET_MAP SetNodeToSocketMap; /**< Method: Associate a node id with a socket. */
PF_GET_MIN_NB_CORE_FREQ GetMinNbCoreFreq; /**< Method: Get the minimum northbridge frequency */
} ;
/*----------------------------------------------------------------------------
* Prototypes to Interface from Feature Code
*
*----------------------------------------------------------------------------
*/
/**
* A constructor for the internal Ht Interface.
*
*/
VOID
NewHtInterface (
OUT HT_INTERFACE *HtInterface,
IN AMD_CONFIG_PARAMS *StdHeader
);
#endif /* _HT_INTERFACE_H_ */
|