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
20 static void print_tx(const char *strval, u32 val)
22 #if CONFIG_DEBUG_RAM_SETUP
23 printk(BIOS_DEBUG, "%s%08x\n", strval, val);
27 static void print_t(const char *strval)
29 #if CONFIG_DEBUG_RAM_SETUP
30 printk(BIOS_DEBUG, "%s", strval);
34 #include "../amdmct/wrappers/mcti.h"
35 #include "../amdmct/amddefs.h"
36 #include "../amdmct/mct/mct_d.h"
37 #include "../amdmct/mct/mct_d_gcc.h"
39 #include "../amdmct/wrappers/mcti_d.c"
40 #include "../amdmct/mct/mct_d.c"
43 #include "../amdmct/mct/mctmtr_d.c"
44 #include "../amdmct/mct/mctcsi_d.c"
45 #include "../amdmct/mct/mctecc_d.c"
46 #include "../amdmct/mct/mctpro_d.c"
47 #include "../amdmct/mct/mctdqs_d.c"
48 #include "../amdmct/mct/mctsrc.c"
49 #include "../amdmct/mct/mctsrc1p.c"
50 #include "../amdmct/mct/mcttmrl.c"
51 #include "../amdmct/mct/mcthdi.c"
52 #include "../amdmct/mct/mctndi_d.c"
53 #include "../amdmct/mct/mctchi_d.c"
55 #if CONFIG_CPU_SOCKET_TYPE == 0x10
57 #include "../amdmct/mct/mctardk3.c"
58 #elif CONFIG_CPU_SOCKET_TYPE == 0x11
60 #include "../amdmct/mct/mctardk4.c"
61 //#elif SYSTEM_TYPE == MOBILE
63 //#include "../amdmct/mct/mctardk5.c"
66 #include "../amdmct/mct/mct_fd.c"
68 int mctRead_SPD(u32 smaddr, u32 reg)
70 return spd_read_byte(smaddr, reg);
74 void mctSMBhub_Init(u32 node)
76 struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE);
77 struct mem_controller *ctrl = &( sysinfo->ctrl[node] );
78 activate_spd_rom(ctrl);
82 void mctGet_DIMMAddr(struct DCTStatStruc *pDCTstat, u32 node)
85 struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE);
86 struct mem_controller *ctrl = &( sysinfo->ctrl[node] );
88 for(j=0;j<DIMM_SOCKETS;j++) {
89 pDCTstat->DIMMAddr[j*2] = ctrl->spd_addr[j] & 0xff;
90 pDCTstat->DIMMAddr[j*2+1] = ctrl->spd_addr[DIMM_SOCKETS + j] & 0xff;
96 u32 mctGetLogicalCPUID(u32 Node)
98 /* FIXME: Move this to a more generic place. Maybe to the CPU code */
99 /* Converts the CPUID to a logical ID MASK that is used to check
100 CPU version support versions */
103 u32 family, model, stepping;
106 if (Node == 0xFF) { /* current node */
107 val = cpuid_eax(0x80000001);
109 dev = PA_NBMISC(Node);
110 val = Get_NB32(dev, 0xfc);
113 family = ((val >> 8) & 0x0f) + ((val >> 20) & 0xff);
114 model = ((val >> 4) & 0x0f) | ((val >> (16-4)) & 0xf0);
115 stepping = val & 0x0f;
117 valx = (family << 12) | (model << 4) | (stepping);
151 /* FIXME: mabe we should die() here. */
152 print_err("FIXME! CPU Version unknown or not supported! \n");
160 static void raminit_amdmct(struct sys_info *sysinfo)
162 struct MCTStatStruc *pMCTstat = &(sysinfo->MCTstat);
163 struct DCTStatStruc *pDCTstatA = sysinfo->DCTstatA;
165 print_debug("raminit_amdmct begin:\n");
167 mctAutoInitMCT_D(pMCTstat, pDCTstatA);
169 print_debug("raminit_amdmct end:\n");