4 #define QRANK_DIMM_SUPPORT 1
6 #if CONFIG_LOGICAL_CPUS==1
7 #define SET_NB_CFG_54 1
12 #include <device/pci_def.h>
14 #include <device/pnp_def.h>
15 #include <arch/romcc_io.h>
16 #include <cpu/x86/lapic.h>
17 #include "option_table.h"
18 #include "pc80/mc146818rtc_early.c"
19 #include "pc80/serial.c"
20 #include "arch/i386/lib/console.c"
21 #include "lib/ramtest.c"
24 static void post_code(uint8_t value) {
27 for(i=0;i<0x80000;i++) {
34 #include <cpu/amd/model_fxx_rev.h>
35 #include "northbridge/amd/amdk8/incoherent_ht.c"
36 #include "southbridge/broadcom/bcm5785/bcm5785_early_smbus.c"
37 #include "northbridge/amd/amdk8/raminit.h"
38 #include "cpu/amd/model_fxx/apic_timer.c"
39 #include "lib/delay.c"
41 #include "cpu/x86/lapic/boot_cpu.c"
42 #include "northbridge/amd/amdk8/reset_test.c"
43 #include "northbridge/amd/amdk8/debug.c"
44 #include "superio/nsc/pc87417/pc87417_early_serial.c"
46 #include "cpu/amd/mtrr/amd_earlymtrr.c"
47 #include "cpu/x86/bist.h"
49 #include "northbridge/amd/amdk8/setup_resource_map.c"
51 #define SERIAL_DEV PNP_DEV(0x2e, PC87417_SP1)
52 #define RTC_DEV PNP_DEV(0x2e, PC87417_RTC)
54 #include "southbridge/broadcom/bcm5785/bcm5785_early_setup.c"
56 static void memreset_setup(void)
60 static void memreset(int controllers, const struct mem_controller *ctrl)
64 static inline void activate_spd_rom(const struct mem_controller *ctrl)
66 #define SMBUS_HUB 0x71
68 unsigned device=(ctrl->channel0[0])>>8;
69 smbus_send_byte(SMBUS_HUB, device);
72 static inline void change_i2c_mux(unsigned device)
74 #define SMBUS_HUB 0x71
76 print_debug("change_i2c_mux i="); print_debug_hex8(device); print_debug("\r\n");
77 ret = smbus_send_byte(SMBUS_HUB, device);
78 print_debug("change_i2c_mux ret="); print_debug_hex32(ret); print_debug("\r\n");
82 static inline int spd_read_byte(unsigned device, unsigned address)
84 return smbus_read_byte(device, address);
87 #include "northbridge/amd/amdk8/raminit.c"
88 #include "northbridge/amd/amdk8/coherent_ht.c"
89 #include "lib/generic_sdram.c"
91 /* tyan does not want the default */
92 #include "resourcemap.c"
94 #include "cpu/amd/dualcore/dualcore.c"
104 #include "cpu/amd/car/copy_and_run.c"
105 #include "cpu/amd/car/post_cache_as_ram.c"
107 #include "cpu/amd/model_fxx/init_cpus.c"
110 #if CONFIG_USE_FALLBACK_IMAGE == 1
112 #include "northbridge/amd/amdk8/early_ht.c"
114 void failover_process(unsigned long bist, unsigned long cpu_init_detectedx)
118 /* Is this a cpu only reset? Is this a secondary cpu? */
119 if ((cpu_init_detectedx) || (!boot_cpu())) {
120 if (last_boot_normal()) { // RTC already inited
126 /* Nothing special needs to be done to find bus 0 */
127 /* Allow the HT devices to be found */
129 enumerate_ht_chain();
131 bcm5785_enable_rom();
133 bcm5785_enable_lpc();
136 pc87417_enable_dev(RTC_DEV);
138 /* Is this a deliberate reset by the bios */
140 if (bios_reset_detected() && last_boot_normal()) {
143 /* This is the primary cpu how should I boot? */
144 else if (do_normal_boot()) {
152 __asm__ volatile ("jmp __normal_image"
154 : "a" (bist), "b" (cpu_init_detectedx) /* inputs */
161 #endif /* CONFIG_USE_FALLBACK_IMAGE == 1 */
163 void real_main(unsigned long bist, unsigned long cpu_init_detectedx);
165 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
168 #if CONFIG_USE_FALLBACK_IMAGE == 1
169 failover_process(bist, cpu_init_detectedx);
171 real_main(bist, cpu_init_detectedx);
175 void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
177 static const uint16_t spd_addr[] = {
178 RC0|DIMM0, RC0|DIMM2, 0, 0,
179 RC0|DIMM1, RC0|DIMM3, 0, 0,
180 #if CONFIG_MAX_PHYSICAL_CPUS > 1
181 RC1|DIMM0, RC1|DIMM2, 0, 0,
182 RC1|DIMM1, RC1|DIMM3, 0, 0,
187 unsigned bsp_apicid = 0;
189 struct mem_controller ctrl[8];
193 bsp_apicid = init_cpus(cpu_init_detectedx);
197 pc87417_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
205 /* Halt if there was a built in self test failure */
206 report_bist_failure(bist);
208 print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\r\n");
210 setup_blast_resource_map();
213 dump_pci_device(PCI_DEV(0, 0x18, 0));
214 dump_pci_device(PCI_DEV(0, 0x19, 0));
217 needs_reset = setup_coherent_ht_domain();
219 #if CONFIG_LOGICAL_CPUS==1
220 // It is said that we should start core1 after all core0 launched
221 wait_all_core0_started();
224 wait_all_aps_started(bsp_apicid);
226 needs_reset |= ht_setup_chains_x();
228 bcm5785_early_setup();
231 print_info("ht reset -\r\n");
235 allow_all_aps_stop(bsp_apicid);
238 //It's the time to set ctrl now;
239 fill_mem_ctrl(nodes, ctrl, spd_addr);
247 dump_smbus_registers();
255 sdram_initialize(nodes, ctrl);