Enable mahogany_fam10 and Kino family 10h to run the SB HT link at the expected HT3...
[coreboot.git] / src / northbridge / amd / amdht / ht_wrapper.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2008 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 #include <cpu/x86/msr.h>
21 #include <console/console.h>
22 #include <northbridge/amd/amdfam10/amdfam10.h>
23
24 /*----------------------------------------------------------------------------
25  *                      TYPEDEFS, DEFINITIONS AND MACROS
26  *
27  *----------------------------------------------------------------------------
28  */
29
30 /* Single CPU system? */
31 #if (CONFIG_MAX_PHYSICAL_CPUS == 1)
32         #define HT_BUILD_NC_ONLY 1
33 #endif
34
35 /* Debugging Options */
36 #define AMD_DEBUG 1
37 //#define AMD_DEBUG_ERROR_STOP 1
38
39 /*----------------------------------------------------------------------------
40  *                              MODULES USED
41  *
42  *----------------------------------------------------------------------------
43  */
44
45 #undef FILECODE
46 #define FILECODE 0xFF01
47 #include "comlib.h"
48 #include "h3gtopo.h"
49 #include "h3finit.h"
50
51 /* include the main HT source file */
52 #include "h3finit.c"
53
54
55 /*----------------------------------------------------------------------------
56  *                      LOCAL FUNCTIONS
57  *
58  *----------------------------------------------------------------------------
59  */
60
61 /* FIXME: Find a better place for these pre-ram functions. */
62 #define NODE_HT(x) NODE_PCI(x,0)
63 #define NODE_MP(x) NODE_PCI(x,1)
64 #define NODE_MC(x) NODE_PCI(x,3)
65 #define NODE_LC(x) NODE_PCI(x,4)
66
67 static  u32 get_nodes(void)
68 {
69         device_t dev;
70         u32 nodes;
71
72         dev = PCI_DEV(CONFIG_CBB, CONFIG_CDB, 0);
73         nodes = ((pci_read_config32(dev, 0x60)>>4) & 7) ;
74 #if CONFIG_MAX_PHYSICAL_CPUS > 8
75         nodes += (((pci_read_config32(dev, 0x160)>>4) & 7)<<3);
76 #endif
77         nodes++;
78
79         return nodes;
80 }
81
82
83 /**
84  * void AMD_CB_EventNotify (u8 evtClass, u16 event, const u8 *pEventData0)
85  */
86 static void AMD_CB_EventNotify (u8 evtClass, u16 event, const u8 *pEventData0)
87 {
88         u8 i;
89
90         printk(BIOS_DEBUG, "AMD_CB_EventNotify()\n");
91         printk(BIOS_DEBUG, " event class: %02x\n event: %04x\n data: ", evtClass, event);
92
93         for (i = 0; i < *pEventData0; i++) {
94                 printk(BIOS_DEBUG, " %02x ", *(pEventData0 + i));
95         }
96         printk(BIOS_DEBUG, "\n");
97
98 }
99
100 /**
101  * void getAmdTopolist(u8 ***p)
102  *
103  *  point to the stock topo list array
104  *
105  */
106 void getAmdTopolist(u8 ***p)
107 {
108         *p = (u8 **)amd_topo_list;
109 }
110
111
112 /**
113  * void amd_ht_init(struct sys_info *sysinfo)
114  *
115  *  AMD HT init coreboot wrapper
116  *
117  */
118 static void amd_ht_init(struct sys_info *sysinfo)
119 {
120
121         AMD_HTBLOCK ht_wrapper = {
122                 NULL,   // u8 **topolist;
123                 0,      // u8 AutoBusStart;
124                 32,     // u8 AutoBusMax;
125                 6,      // u8 AutoBusIncrement;
126                 NULL,   // BOOL (*AMD_CB_IgnoreLink)();
127                 NULL,   // BOOL (*AMD_CB_OverrideBusNumbers)();
128                 AMD_CB_ManualBUIDSwapList,      // BOOL (*AMD_CB_ManualBUIDSwapList)();
129                 NULL,   // void (*AMD_CB_DeviceCapOverride)();
130                 NULL,   // void (*AMD_CB_Cpu2CpuPCBLimits)();
131                 NULL,   // void (*AMD_CB_IOPCBLimits)();
132                 NULL,   // BOOL (*AMD_CB_SkipRegang)();
133                 NULL,   // BOOL (*AMD_CB_CustomizeTrafficDistribution)();
134                 NULL,   // BOOL (*AMD_CB_CustomizeBuffers)();
135                 NULL,   // void (*AMD_CB_OverrideDevicePort)();
136                 NULL,   // void (*AMD_CB_OverrideCpuPort)();
137                 AMD_CB_EventNotify      // void (*AMD_CB_EventNotify) ();
138         };
139
140         printk(BIOS_DEBUG, "Enter amd_ht_init()\n");
141         amdHtInitialize(&ht_wrapper);
142         printk(BIOS_DEBUG, "Exit amd_ht_init()\n");
143
144
145 }
146
147
148
149