3 #define K8_ALLOCATE_IO_RANGE 1
4 //#define K8_SCAN_PCI_BUS 1
7 #define QRANK_DIMM_SUPPORT 1
9 #if CONFIG_LOGICAL_CPUS==1
10 #define SET_NB_CFG_54 1
15 #include <device/pci_def.h>
17 #include <device/pnp_def.h>
18 #include <arch/romcc_io.h>
19 #include <cpu/x86/lapic.h>
20 #include "option_table.h"
21 #include "pc80/mc146818rtc_early.c"
23 #define post_code(x) outb(x, 0x80)
24 #include "pc80/serial.c"
25 #include "arch/i386/lib/console.c"
26 #include "ram/ramtest.c"
29 #include <cpu/amd/model_fxx_rev.h>
31 #include "northbridge/amd/amdk8/incoherent_ht.c"
32 #include "southbridge/nvidia/ck804/ck804_early_smbus.c"
33 #include "northbridge/amd/amdk8/raminit.h"
34 #include "cpu/amd/model_fxx/apic_timer.c"
35 #include "lib/delay.c"
37 #include "cpu/x86/lapic/boot_cpu.c"
38 #include "northbridge/amd/amdk8/reset_test.c"
39 #include "superio/smsc/lpc47b397/lpc47b397_early_serial.c"
40 #include "superio/smsc/lpc47b397/lpc47b397_early_gpio.c"
41 #define SUPERIO_GPIO_DEV PNP_DEV(0x2e, LPC47B397_RT)
43 #define SUPERIO_GPIO_IO_BASE 0x400
45 #include "cpu/x86/bist.h"
47 #include "northbridge/amd/amdk8/debug.c"
49 #include "cpu/amd/mtrr/amd_earlymtrr.c"
51 #include "northbridge/amd/amdk8/setup_resource_map.c"
53 #define SERIAL_DEV PNP_DEV(0x2e, LPC47B397_SP1)
55 static void memreset_setup(void)
59 static void memreset(int controllers, const struct mem_controller *ctrl)
63 static void sio_gpio_setup(void){
67 /*Enable onboard scsi*/
68 lpc47b397_gpio_offset_out(SUPERIO_GPIO_IO_BASE, 0x2c, (1<<7)|(0<<2)|(0<<1)|(0<<0)); // GP21, offset 0x2c, DISABLE_SCSI_L
69 value = lpc47b397_gpio_offset_in(SUPERIO_GPIO_IO_BASE, 0x4c);
70 lpc47b397_gpio_offset_out(SUPERIO_GPIO_IO_BASE, 0x4c, (value|(1<<1)));
74 static inline void activate_spd_rom(const struct mem_controller *ctrl)
79 static inline int spd_read_byte(unsigned device, unsigned address)
81 return smbus_read_byte(device, address);
84 #include "northbridge/amd/amdk8/raminit.c"
85 #include "northbridge/amd/amdk8/coherent_ht.c"
86 #include "sdram/generic_sdram.c"
88 /* tyan does not want the default */
89 #include "resourcemap.c"
91 #include "cpu/amd/dualcore/dualcore.c"
94 #define CK804B_BUSN 0x80
95 #define CK804_USE_NIC 1
96 #define CK804_USE_ACI 1
98 #include "southbridge/nvidia/ck804/ck804_early_setup_ss.h"
100 //set GPIO to input mode
101 #define CK804_MB_SETUP \
102 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+ 5, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* M9,GPIO6, PCIXB2_PRSNT1_L*/ \
103 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+15, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* M8,GPIO16, PCIXB2_PRSNT2_L*/ \
104 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+44, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* P5,GPIO45, PCIXA_PRSNT1_L*/ \
105 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+ 7, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* M5,GPIO8, PCIXA_PRSNT2_L*/ \
106 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+16, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* K4,GPIO17, PCIXB_PRSNT1_L*/ \
107 RES_PORT_IO_8, SYSCTRL_IO_BASE + 0xc0+45, ~(0xff),((0<<4)|(0<<2)|(0<<0)),/* P7,GPIO46, PCIXB_PRSNT2_L*/
109 #include "southbridge/nvidia/ck804/ck804_early_setup_car.c"
111 #include "cpu/amd/car/copy_and_run.c"
113 #include "cpu/amd/car/post_cache_as_ram.c"
115 #include "cpu/amd/model_fxx/init_cpus.c"
117 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
119 static const uint16_t spd_addr [] = {
120 (0xa<<3)|0, (0xa<<3)|2, 0, 0,
121 (0xa<<3)|1, (0xa<<3)|3, 0, 0,
122 #if CONFIG_MAX_PHYSICAL_CPUS > 1
123 (0xa<<3)|4, (0xa<<3)|6, 0, 0,
124 (0xa<<3)|5, (0xa<<3)|7, 0, 0,
129 unsigned bsp_apicid = 0;
131 struct mem_controller ctrl[8];
135 bsp_apicid = init_cpus(cpu_init_detectedx);
140 lpc47b397_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
144 /* Halt if there was a built in self test failure */
145 report_bist_failure(bist);
149 setup_mb_resource_map();
151 dump_pci_device(PCI_DEV(0, 0x18, 0));
152 dump_pci_device(PCI_DEV(0, 0x19, 0));
155 needs_reset = setup_coherent_ht_domain();
157 wait_all_core0_started();
158 #if CONFIG_LOGICAL_CPUS==1
159 // It is said that we should start core1 after all core0 launched
161 wait_all_other_cores_started(bsp_apicid);
164 needs_reset |= ht_setup_chains_x();
166 needs_reset |= ck804_early_setup_x();
169 print_info("ht reset -\r\n");
173 allow_all_aps_stop(bsp_apicid);
176 //It's the time to set ctrl now;
177 fill_mem_ctrl(nodes, ctrl, spd_addr);
181 dump_spd_registers(&cpu[0]);
184 dump_smbus_registers();
188 sdram_initialize(nodes, ctrl);