2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
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.
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.
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
23 /*----------------------------------------------------------------------------
24 * Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
26 *----------------------------------------------------------------------------
29 /*-----------------------------------------------------------------------------
30 * DEFINITIONS AND MACROS
32 *-----------------------------------------------------------------------------
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);
39 #define makePCIDeviceFromNode(node) \
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);
46 #define makePCIBusFromNode(node) \
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);
53 #define makePCISegmentFromNode(node) \
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.
60 * It's not envisioned this would be replaced by an external function, but the prototype is
61 * u16 fixEarlySampleFreqCapability(u16 fc);
63 #ifndef HT_BUILD_EARLY_SAMPLE_CPU_SUPPORT
64 #define fixEarlySampleFreqCapability(fc) \
67 #define fixEarlySampleFreqCapability(fc) \
68 ((u16)fc & HT_FREQUENCY_LIMIT_HT1_ONLY)
71 /*----------------------------------------------------------------------------
72 * TYPEDEFS, STRUCTURES, ENUMS
74 *----------------------------------------------------------------------------
79 /* Public data, clients of northbridge can access */
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);
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);
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);
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);
118 /* Private Data for northbridge implementation use only */
119 u32 selfRouteRequestMask;
120 u32 selfRouteResponseMask;
125 /*----------------------------------------------------------------------------
126 * FUNCTIONS PROTOTYPE
128 *----------------------------------------------------------------------------
130 void newNorthBridge(u8 node, cNorthBridge *nb);
132 #endif /* H3NCMN_H */