AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Include / Topology.h
1 /* $NoKeywords:$ */
2 /**
3  * @file
4  *
5  * Topology interface definitions.
6  *
7  * Contains AMD AGESA internal interface for topology related data which
8  * is consumed by code other than HyperTransport init (and produced by
9  * HyperTransport init.)
10  *
11  * @xrefitem bom "File Content Label" "Release Content"
12  * @e project:      AGESA
13  * @e sub-project:  Core
14  * @e \$Revision: 44324 $   @e \$Date: 2010-12-22 02:16:51 -0700 (Wed, 22 Dec 2010) $
15  */
16 /*****************************************************************************
17  *
18  * Copyright (C) 2012 Advanced Micro Devices, Inc.
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are met:
23  *     * Redistributions of source code must retain the above copyright
24  *       notice, this list of conditions and the following disclaimer.
25  *     * Redistributions in binary form must reproduce the above copyright
26  *       notice, this list of conditions and the following disclaimer in the
27  *       documentation and/or other materials provided with the distribution.
28  *     * Neither the name of Advanced Micro Devices, Inc. nor the names of
29  *       its contributors may be used to endorse or promote products derived
30  *       from this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35  * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
36  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  *
44  ***************************************************************************/
45
46 #ifndef _TOPOLOGY_H_
47 #define _TOPOLOGY_H_
48
49 // Defines for limiting data structure maximum allocation and limit checking.
50 #define MAX_NODES 8
51 #define MAX_SOCKETS MAX_NODES
52 #define MAX_DIES 2
53
54 // Defines useful with package link
55 #define HT_LIST_MATCH_INTERNAL_LINK_0 0xFA
56 #define HT_LIST_MATCH_INTERNAL_LINK_1 0xFB
57 #define HT_LIST_MATCH_INTERNAL_LINK_2 0xFC
58
59 /**
60  * Hop Count Table.
61  * This is a heap data structure.  The Hops array is filled as a size x size matrix.
62  * The unused space, if any, is all at the end.
63  */
64 typedef struct {
65   UINT8 Size;                         ///< The row and column size of actual hop count data */
66   UINT8 Hops[MAX_NODES * MAX_NODES];  ///< Room for a dynamic two dimensional array of [size][size] */
67 } HOP_COUNT_TABLE;
68
69 /**
70  * Socket and Module to Node Map Item.
71  * Provide the Node Id and core id range for each module in each processor.
72  */
73 typedef struct {
74   UINT8 Node;                 ///< The module's Node id.
75   UINT8 LowCore;              ///< The lowest processor core id for this module.
76   UINT8 HighCore;             ///< The highest processor core id for this module.
77   UINT8 EnabledComputeUnits;  ///< The value of Enabled for this processor module.
78   UINT8 DualCoreComputeUnits; ///< The value of DualCore for this processor module.
79 } SOCKET_DIE_TO_NODE_ITEM;
80
81 /**
82  * Socket and Module to Node Map.
83  * This type is a pointer to the actual map, it can be used for a struct item or
84  * for typecasting a heap buffer pointer.
85  */
86 typedef SOCKET_DIE_TO_NODE_ITEM (*SOCKET_DIE_TO_NODE_MAP)[MAX_SOCKETS][MAX_DIES];
87
88 /**
89  * Node id to Socket Die Map Item.
90  */
91 typedef struct {
92   UINT8 Socket;             ///< socket of the processor containing the Node.
93   UINT8 Die;                ///< the module in the processor which is Node.
94 } NODE_TO_SOCKET_DIE_ITEM;
95
96 /**
97  * Node id to Socket Die Map.
98  */
99 typedef NODE_TO_SOCKET_DIE_ITEM (*NODE_TO_SOCKET_DIE_MAP)[MAX_NODES];
100
101 /**
102  * Provide AP core with socket and node context at start up.
103  * This information is posted to the AP cores using a register as a mailbox.
104  */
105 typedef struct {
106   UINT32 Node:4;          ///< The node id of Core's node.
107   UINT32 Socket:4;        ///< The socket of this Core's node.
108   UINT32 Module:2;        ///< The internal module number for Core's node.
109   UINT32 ModuleType:2;    ///< Single Module = 0, Multi-module = 1.
110   UINT32 :20;             ///< Reserved
111 } AP_MAIL_INFO_FIELDS;
112
113 /**
114  * AP info fields can be written and read to a register.
115  */
116 typedef union {
117   UINT32              Info;        ///< Just a number for register access, or opaque passing.
118   AP_MAIL_INFO_FIELDS Fields;      ///< access to the info fields.
119 } AP_MAIL_INFO;
120
121 /**
122  * Provide AP core with system degree and system core number at start up.
123  * This information is posted to the AP cores using a register as a mailbox.
124  */
125 typedef struct {
126   UINT32 SystemDegree:3;  ///< The number of connected links
127   UINT32 :3;              ///< Reserved
128   UINT32 HeapIndex:6;     ///< The zero-based system core number
129   UINT32 :20;             ///< Reserved
130 } AP_MAIL_EXT_INFO_FIELDS;
131
132 /**
133  * AP info fields can be written and read to a register.
134  */
135 typedef union {
136   UINT32              Info;        ///< Just a number for register access, or opaque passing.
137   AP_MAIL_EXT_INFO_FIELDS Fields;  ///< access to the info fields.
138 } AP_MAIL_EXT_INFO;
139
140 /**
141  * AP Info mailbox set.
142  */
143 typedef struct {
144   AP_MAIL_INFO      ApMailInfo;    ///< The AP mail info
145   AP_MAIL_EXT_INFO  ApMailExtInfo; ///< The extended AP mail info
146 } AP_MAILBOXES;
147
148 /**
149  * Provide a northbridge to package mapping for link assignments.
150  *
151  */
152 typedef struct {
153   UINT8  Link;             ///< The Node's link
154   UINT8  Module;           ///< The internal module position of Node
155   UINT8  PackageLink;      ///< The corresponding package link
156 } PACKAGE_HTLINK_MAP_ITEM;
157
158 /**
159  * A Processor's complete set of link assignments
160  */
161 typedef PACKAGE_HTLINK_MAP_ITEM (*PACKAGE_HTLINK_MAP)[];
162
163 #endif  // _TOPOLOGY_H_