5 * Routines to deal with topology data.
7 * Access the topologies and information about a topology.
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: HyperTransport
12 * @e \$Revision: 56279 $ @e \$Date: 2011-07-11 13:11:28 -0600 (Mon, 11 Jul 2011) $
16 *****************************************************************************
18 * Copyright (C) 2012 Advanced Micro Devices, Inc.
19 * All rights reserved.
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.
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.
43 * ***************************************************************************
50 #include "OptionsHt.h"
55 #define FILECODE PROC_HT_HTGRAPH_HTGRAPH_FILECODE
57 extern OPTION_HT_CONFIGURATION OptionHtConfiguration;
59 /*----------------------------------------------------------------------------------------*/
61 * Returns the AGESA built in topology list
63 * @param[out] List a pointer to the built in topology list
70 // Cast below to hush CONST warning. The built in list must be CONST to be in ROM statically.
71 // The caller of this routine may get a topolist pointer from the interface, however, and
72 // that is not CONST, since it could be on the stack.
74 *List = (UINT8 **)OptionHtConfiguration.HtOptionBuiltinTopologies;
77 /*----------------------------------------------------------------------------------------*/
79 * Returns the number of Nodes in the compressed graph
81 * @param[in] Graph a compressed graph
83 * @return the number of Nodes in the graph
93 /*----------------------------------------------------------------------------------------*/
95 * Returns true if NodeA is directly connected to NodeB, false otherwise
97 * if NodeA == NodeB also returns false.
98 * Relies on rule that directly connected Nodes always route requests directly.
100 * @param[in] Graph the graph to examine
101 * @param[in] NodeA the Node number of the first Node
102 * @param[in] NodeB the Node number of the second Node
104 * @retval TRUE NodeA connects to NodeB
105 * @retval FALSE NodeA does not connect to NodeB
116 ASSERT ((NodeA < size) && (NodeB < size));
117 return (Graph[1 + (NodeA*size + NodeB)*2 + 1] & 0x0F) == NodeB;
120 /*----------------------------------------------------------------------------------------*/
122 * Returns the graph Node used by NodeA to route responses targeted at NodeB.
124 * This will be a Node directly connected to NodeA (possibly NodeB itself),
125 * or "Route to Self" if NodeA and NodeB are the same Node.
126 * Note that all Node numbers are abstract Node numbers of the topology graph,
127 * it is the responsibility of the caller to apply any permutation needed.
129 * @param[in] Graph the graph to examine
130 * @param[in] NodeA the Node number of the first Node
131 * @param[in] NodeB the Node number of the second Node
133 * @return The response route Node
144 ASSERT ((NodeA < size) && (NodeB < size));
145 return (Graph[1 + (NodeA*size + NodeB)*2 + 1] & 0xF0) >> 4;
148 /*----------------------------------------------------------------------------------------*/
150 * Returns the graph Node used by NodeA to route requests targeted at NodeB.
152 * This will be a Node directly connected to NodeA (possibly NodeB itself),
153 * or "Route to Self" if NodeA and NodeB are the same Node.
154 * Note that all Node numbers are abstract Node numbers of the topology graph,
155 * it is the responsibility of the caller to apply any permutation needed.
157 * @param[in] Graph the graph to examine
158 * @param[in] NodeA the Node number of the first Node
159 * @param[in] NodeB the Node number of the second Node
161 * @return The request route Node
172 ASSERT ((NodeA < size) && (NodeB < size));
173 return (Graph[1 + (NodeA*size + NodeB)*2 + 1] & 0x0F);
176 /*----------------------------------------------------------------------------------------*/
178 * Returns a bit vector of Nodes that NodeA should forward a broadcast from
181 * @param[in] Graph the graph to examine
182 * @param[in] NodeA the Node number of the first Node
183 * @param[in] NodeB the Node number of the second Node
185 * @return the broadcast routes for NodeA from NodeB
196 ASSERT ((NodeA < size) && (NodeB < size));
197 return Graph[1 + (NodeA*size + NodeB)*2];