2 * This file is part of the LinuxBIOS 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
21 static void print_raminit(const char *strval, u32 val)
23 printk_debug("%s%08x\n", strval, val);
27 #define RAMINIT_DEBUG 1
30 static void print_tx(const char *strval, u32 val)
32 #if RAMINIT_DEBUG == 1
33 print_raminit(strval, val);
38 static void print_t(const char *strval)
40 #if RAMINIT_DEBUG == 1
45 #include "../amdmct/wrappers/mcti.h"
46 #include "../amdmct/amddefs.h"
47 #include "../amdmct/mct/mct_d.h"
48 #include "../amdmct/mct/mct_d_gcc.h"
50 #include "../amdmct/wrappers/mcti_d.c"
51 #include "../amdmct/mct/mct_d.c"
54 #include "../amdmct/mct/mctmtr_d.c"
55 #include "../amdmct/mct/mctcsi_d.c"
56 #include "../amdmct/mct/mctecc_d.c"
57 #include "../amdmct/mct/mctpro_d.c"
58 #include "../amdmct/mct/mctdqs_d.c"
59 #include "../amdmct/mct/mctsrc.c"
60 #include "../amdmct/mct/mctsrc1p.c"
61 #include "../amdmct/mct/mcttmrl.c"
62 #include "../amdmct/mct/mcthdi.c"
63 #include "../amdmct/mct/mctndi_d.c"
64 #include "../amdmct/mct/mctchi_d.c"
66 #if SYSTEM_TYPE == SERVER
68 #include "../amdmct/mct/mctardk3.c"
69 #elif SYSTEM_TYPE == DESKTOP
71 #include "../amdmct/mct/mctardk4.c"
72 //#elif SYSTEM_TYPE == MOBILE
74 //#include "../amdmct/mct/mctardk5.c"
77 #include "../amdmct/mct/mct_fd.c"
79 int mctRead_SPD(u32 smaddr, u32 reg)
81 return spd_read_byte(smaddr, reg);
85 void mctSMBhub_Init(u32 node)
87 struct sys_info *sysinfo = (struct sys_info *)(DCACHE_RAM_BASE + DCACHE_RAM_SIZE - DCACHE_RAM_GLOBAL_VAR_SIZE);
88 struct mem_controller *ctrl = &( sysinfo->ctrl[node] );
89 activate_spd_rom(ctrl);
93 void mctGet_DIMMAddr(struct DCTStatStruc *pDCTstat, u32 node)
96 struct sys_info *sysinfo = (struct sys_info *)(DCACHE_RAM_BASE + DCACHE_RAM_SIZE - DCACHE_RAM_GLOBAL_VAR_SIZE);
97 struct mem_controller *ctrl = &( sysinfo->ctrl[node] );
99 for(j=0;j<DIMM_SOCKETS;j++) {
100 pDCTstat->DIMMAddr[j*2] = ctrl->spd_addr[j] & 0xff;
101 pDCTstat->DIMMAddr[j*2+1] = ctrl->spd_addr[DIMM_SOCKETS + j] & 0xff;
107 u32 mctGetLogicalCPUID(u32 Node)
111 u32 family, model, stepping;
113 dev = PA_NBMISC(Node);
114 val = Get_NB32(dev, 0xfc);
115 print_debug("Family_Model:"); print_debug_hex32(val); print_debug("\n");
117 family = ((val >> 8) & 0x0f) + ((val>>20) & 0xff);
118 model = ((val>>4) & 0x0f) | ((val>>(16-4)) & 0xf0);
119 stepping = val & 0xff;
120 print_debug("Family:"); print_debug_hex8(family); print_debug("\t");
121 print_debug("Model:"); print_debug_hex8(model); print_debug("\t");
122 print_debug("Stepping:"); print_debug_hex8(stepping); print_debug("\n");
124 valx = (family<<12) | (model<<4) | (stepping);
125 print_debug("converted:"); print_debug_hex32(valx); print_debug("\n");
145 void raminit_amdmct(struct sys_info *sysinfo)
147 struct MCTStatStruc *pMCTstat = &(sysinfo->MCTstat);
148 struct DCTStatStruc *pDCTstatA = sysinfo->DCTstatA;
150 print_debug("raminit_amdmct begin:\n");
152 mctAutoInitMCT_D(pMCTstat, pDCTstatA);
154 print_debug("raminit_amdmct end:\n");