Please bear with me - another rename checkin. This qualifies as trivial, no
[coreboot.git] / src / northbridge / amd / amdht / h3ncmn.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #ifndef H3NCMN_H
21 #define H3NCMN_H
22
23 /*----------------------------------------------------------------------------
24  *   Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
25  *
26  *----------------------------------------------------------------------------
27  */
28
29 /*-----------------------------------------------------------------------------
30  *                      DEFINITIONS AND MACROS
31  *
32  *-----------------------------------------------------------------------------
33  */
34
35 /* Use a macro to convert a node number to a PCI device.  If some future port of
36  * this code needs to, this can easily be replaced by a function call:
37  * u8 makePCIDeviceFromNode(u8 node);
38  */
39 #define makePCIDeviceFromNode(node) \
40         ((u8)(24 + node))
41
42 /* Use a macro to convert a node number to a PCI bus.   If some future port of
43  * this code needs to, this can easily be replaced by a function call:
44  * u8 makePCIBusFromNode(u8 node);
45  */
46 #define makePCIBusFromNode(node) \
47         ((u8)(0))
48
49 /* Use a macro to convert a node number to a PCI Segment.  If some future port of
50  * this code needs to, this can easily be replaced by a function call:
51  * u8 makePCISegmentFromNode(u8 node);
52  */
53 #define makePCISegmentFromNode(node) \
54         ((u8)(0))
55
56 /* Macros to fix support issues that come up with early sample processors, which
57  * sometimes do things like report capabilities that are actually unsupported.
58  * Use the build flag, HT_BUILD_EARLY_SAMPLE_CPU_SUPPORT, to enable this support.
59  *
60  * It's not envisioned this would be replaced by an external function, but the prototype is
61  * u16 fixEarlySampleFreqCapability(u16 fc);
62  */
63 #ifndef HT_BUILD_EARLY_SAMPLE_CPU_SUPPORT
64 #define fixEarlySampleFreqCapability(fc) \
65         ((u16)fc)
66 #else
67 #define fixEarlySampleFreqCapability(fc) \
68         ((u16)fc & HT_FREQUENCY_LIMIT_HT1_ONLY)
69 #endif
70
71 /*----------------------------------------------------------------------------
72  *                          TYPEDEFS, STRUCTURES, ENUMS
73  *
74  *----------------------------------------------------------------------------
75  */
76
77 struct cNorthBridge
78 {
79         /* Public data, clients of northbridge can access */
80         u8 maxLinks;
81         u8 maxNodes;
82         u8 maxPlatformLinks;
83
84         /* Public Interfaces for northbridge clients, coherent init*/
85         void (*writeRoutingTable)(u8 node, u8 target, u8 link, cNorthBridge *nb);
86         void (*writeNodeID)(u8 node, u8 nodeID, cNorthBridge *nb);
87         u8 (*readDefLnk)(u8 node, cNorthBridge *nb);
88         void (*enableRoutingTables)(u8 node, cNorthBridge *nb);
89         BOOL (*verifyLinkIsCoherent)(u8 node, u8 link, cNorthBridge *nb);
90         BOOL (*readTrueLinkFailStatus)(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb);
91         u8 (*readToken)(u8 node, cNorthBridge *nb);
92         void (*writeToken)(u8 node, u8 value, cNorthBridge *nb);
93         u8 (*getNumCoresOnNode)(u8 node, cNorthBridge *nb);
94         void (*setTotalNodesAndCores)(u8 node, u8 totalNodes, u8 totalCores, cNorthBridge *nb);
95         void (*limitNodes)(u8 node, cNorthBridge *nb);
96         void (*writeFullRoutingTable)(u8 node, u8 target, u8 reqLink, u8 rspLink, u32 bClinks, cNorthBridge *nb);
97         BOOL (*isCompatible)(u8 node, cNorthBridge *nb);
98         BOOL (*isCapable)(u8 node, sMainData *pDat, cNorthBridge *nb);
99         void (*stopLink)(u8 node, u8 link, cNorthBridge *nb);
100         BOOL (*handleSpecialLinkCase)(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb);
101
102         /* Public Interfaces for northbridge clients, noncoherent init */
103         u8 (*readSbLink)(cNorthBridge *nb);
104         BOOL (*verifyLinkIsNonCoherent)(u8 node, u8 link, cNorthBridge *nb);
105         void (*setCFGAddrMap)(u8 cfgMapIndex, u8 secBus, u8 subBus, u8 targetNode, u8 targetLink, sMainData *pDat, cNorthBridge *nb);
106
107         /* Public Interfaces for northbridge clients, Optimization */
108         u8 (*convertBitsToWidth)(u8 value, cNorthBridge *nb);
109         u8 (*convertWidthToBits)(u8 value, cNorthBridge *nb);
110         u16 (*northBridgeFreqMask)(u8 node, cNorthBridge *nb);
111         void (*gatherLinkData)(sMainData *pDat, cNorthBridge *nb);
112         void (*setLinkData)(sMainData *pDat, cNorthBridge *nb);
113
114         /* Public Interfaces for northbridge clients, System and performance Tuning. */
115         void (*writeTrafficDistribution)(u32 links01, u32 links10, cNorthBridge *nb);
116         void (*bufferOptimizations)(u8 node, sMainData *pDat, cNorthBridge *nb);
117
118         /* Private Data for northbridge implementation use only */
119         u32 selfRouteRequestMask;
120         u32 selfRouteResponseMask;
121         u8 broadcastSelfBit;
122         u32 compatibleKey;
123 } ;
124
125 /*----------------------------------------------------------------------------
126  *                      FUNCTIONS PROTOTYPE
127  *
128  *----------------------------------------------------------------------------
129  */
130 void newNorthBridge(u8 node, cNorthBridge *nb);
131
132 #endif   /* H3NCMN_H */