Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2006 AMD |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 5 | * (Written by Yinghai Lu <yinghailu@amd.com> for AMD) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 6 | * Copyright (C) 2006 MSI |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 7 | * (Written by Bingxun Shi <bingxunshi@gmail.com> for MSI) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 8 | * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 | */ |
| 24 | |
| 25 | #define ASSEMBLY 1 |
| 26 | #define __ROMCC__ |
| 27 | |
| 28 | #define RAMINIT_SYSINFO 1 |
| 29 | |
| 30 | #define CACHE_AS_RAM_ADDRESS_DEBUG 0 |
| 31 | |
| 32 | unsigned int get_sbdn(unsigned bus); |
| 33 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 34 | /* Used by raminit. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 35 | #define QRANK_DIMM_SUPPORT 1 |
| 36 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 37 | /* Used by init_cpus and fidvid */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 38 | #define K8_SET_FIDVID 1 |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 39 | |
| 40 | /* If we want to wait for core1 done before DQS training, set it to 0. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 41 | #define K8_SET_FIDVID_CORE0_ONLY 1 |
| 42 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 43 | /* #define DEBUG_SMBUS 1 */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 44 | |
| 45 | #include <stdint.h> |
| 46 | #include <device/pci_def.h> |
| 47 | #include <arch/io.h> |
| 48 | #include <device/pnp_def.h> |
| 49 | #include <arch/romcc_io.h> |
| 50 | #include <cpu/x86/lapic.h> |
| 51 | #include "option_table.h" |
| 52 | #include "pc80/mc146818rtc_early.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 53 | #include "pc80/serial.c" |
| 54 | #include "arch/i386/lib/console.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 55 | #include <cpu/amd/model_fxx_rev.h> |
| 56 | #include "northbridge/amd/amdk8/raminit.h" |
| 57 | #include "cpu/amd/model_fxx/apic_timer.c" |
| 58 | #include "lib/delay.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 59 | #if CONFIG_USE_INIT == 0 |
| 60 | #include "lib/memcpy.c" |
| 61 | #endif |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 62 | #include "cpu/x86/lapic/boot_cpu.c" |
| 63 | #include "northbridge/amd/amdk8/reset_test.c" |
| 64 | #include "northbridge/amd/amdk8/debug.c" |
| 65 | #include "northbridge/amd/amdk8/early_ht.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 66 | #include "superio/winbond/w83627ehg/w83627ehg_early_serial.c" |
| 67 | #include "southbridge/via/vt8237r/vt8237r_early_smbus.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 68 | #include "cpu/amd/mtrr/amd_earlymtrr.c" |
| 69 | #include "cpu/x86/bist.h" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 70 | #include "northbridge/amd/amdk8/setup_resource_map.c" |
| 71 | |
| 72 | #define SERIAL_DEV PNP_DEV(0x2e, W83627EHG_SP1) |
| 73 | #define GPIO_DEV PNP_DEV(0x2e, W83627EHG_GPIO_SUSLED) |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 74 | #define ACPI_DEV PNP_DEV(0x2e, W83627EHG_ACPI) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 75 | #define RTC_DEV PNP_DEV(0x2e, W83627EHG_RTC) |
| 76 | |
| 77 | static void memreset_setup(void) |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | static void memreset(int controllers, const struct mem_controller *ctrl) |
| 82 | { |
| 83 | } |
| 84 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 85 | static inline int spd_read_byte(unsigned device, unsigned address) |
| 86 | { |
| 87 | return smbus_read_byte(device, address); |
| 88 | } |
| 89 | |
| 90 | #define K8_4RANK_DIMM_SUPPORT 1 |
| 91 | |
| 92 | #include "northbridge/amd/amdk8/amdk8.h" |
| 93 | #include "northbridge/amd/amdk8/raminit.c" |
| 94 | #include "northbridge/amd/amdk8/coherent_ht.c" |
| 95 | #include "northbridge/amd/amdk8/incoherent_ht.c" |
| 96 | #include "sdram/generic_sdram.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 97 | #include "cpu/amd/dualcore/dualcore.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 98 | #include "southbridge/via/k8t890/k8t890_early_car.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 99 | #include "cpu/amd/car/copy_and_run.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 100 | #include "cpu/amd/car/post_cache_as_ram.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 101 | #include "cpu/amd/model_fxx/init_cpus.c" |
| 102 | #include "cpu/amd/model_fxx/fidvid.c" |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 103 | #include "northbridge/amd/amdk8/resourcemap.c" |
| 104 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 105 | void activate_spd_rom(const struct mem_controller *ctrl) |
| 106 | { |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | void hard_reset(void) |
| 110 | { |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 111 | print_info("NO HARD RESET. FIX ME!\n"); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | void soft_reset(void) |
| 115 | { |
| 116 | uint8_t tmp; |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 117 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 118 | set_bios_reset(); |
| 119 | print_debug("soft reset \r\n"); |
| 120 | |
| 121 | /* PCI reset */ |
| 122 | tmp = pci_read_config8(PCI_DEV(0, 0x11, 0), 0x4f); |
| 123 | tmp |= 0x01; |
| 124 | pci_write_config8(PCI_DEV(0, 0x11, 0), 0x4f, tmp); |
| 125 | |
| 126 | while (1) { |
| 127 | /* daisy daisy ... */ |
| 128 | hlt(); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | unsigned int get_sbdn(unsigned bus) |
| 133 | { |
| 134 | device_t dev; |
| 135 | |
| 136 | dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, |
| 137 | PCI_DEVICE_ID_VIA_VT8237R_LPC), bus); |
| 138 | return (dev >> 15) & 0x1f; |
| 139 | } |
| 140 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 141 | void sio_init(void) |
| 142 | { |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 143 | u8 reg; |
| 144 | |
| 145 | pnp_enter_ext_func_mode(SERIAL_DEV); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 146 | /* We have 24MHz input. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 147 | reg = pnp_read_config(SERIAL_DEV, 0x24); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 148 | pnp_write_config(SERIAL_DEV, 0x24, (reg & ~0x40)); |
| 149 | /* We have GPIO for KB/MS pin. */ |
| 150 | reg = pnp_read_config(SERIAL_DEV, 0x2a); |
| 151 | pnp_write_config(SERIAL_DEV, 0x2a, (reg | 1)); |
| 152 | /* We have all RESTOUT and even some reserved bits, too. */ |
| 153 | reg = pnp_read_config(SERIAL_DEV, 0x2c); |
| 154 | pnp_write_config(SERIAL_DEV, 0x2c, (reg | 0xf0)); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 155 | pnp_exit_ext_func_mode(SERIAL_DEV); |
| 156 | |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 157 | pnp_enter_ext_func_mode(ACPI_DEV); |
| 158 | pnp_set_logical_device(ACPI_DEV); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 159 | /* |
| 160 | * Set the delay rising time from PWROK_LP to PWROK_ST to |
| 161 | * 300 - 600ms, and 0 to vice versa. |
| 162 | */ |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 163 | reg = pnp_read_config(ACPI_DEV, 0xe6); |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 164 | pnp_write_config(ACPI_DEV, 0xe6, (reg & 0xf0)); |
| 165 | /* 1 Use external suspend clock source 32.768KHz. Undocumented?? */ |
| 166 | reg = pnp_read_config(ACPI_DEV, 0xe4); |
| 167 | pnp_write_config(ACPI_DEV, 0xe4, (reg | 0x10)); |
| 168 | pnp_exit_ext_func_mode(ACPI_DEV); |
| 169 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 170 | pnp_enter_ext_func_mode(GPIO_DEV); |
| 171 | pnp_set_logical_device(GPIO_DEV); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 172 | /* Set memory voltage to 2.75V, vcore offset + 100mV, 1.5V chipset voltage. */ |
| 173 | pnp_write_config(GPIO_DEV, 0x30, 0x09); /* Enable GPIO 2 & GPIO 5. */ |
| 174 | pnp_write_config(GPIO_DEV, 0xe2, 0x00); /* No inversion */ |
| 175 | pnp_write_config(GPIO_DEV, 0xe5, 0x00); /* No inversion */ |
| 176 | pnp_write_config(GPIO_DEV, 0xe3, 0x03); /* 0000 0011, 0=output 1=input */ |
| 177 | pnp_write_config(GPIO_DEV, 0xe0, 0xde); /* 1101 1110, 0=output 1=input */ |
| 178 | pnp_write_config(GPIO_DEV, 0xe1, 0x01); /* Set output val. */ |
| 179 | pnp_write_config(GPIO_DEV, 0xe4, 0xb4); /* Set output val (1011 0100). */ |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 180 | pnp_exit_ext_func_mode(GPIO_DEV); |
| 181 | } |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 182 | |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 183 | #if USE_FALLBACK_IMAGE == 1 |
| 184 | |
| 185 | void failover_process(unsigned long bist, unsigned long cpu_init_detectedx) |
| 186 | { |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 187 | /* unsigned last_boot_normal_x = last_boot_normal(); */ |
| 188 | /* FIXME */ |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 189 | unsigned last_boot_normal_x = 1; |
| 190 | |
| 191 | sio_init(); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 192 | w83627ehg_enable_serial(SERIAL_DEV, TTYS0_BASE); |
| 193 | uart_init(); |
| 194 | console_init(); |
Rudolf Marek | 5671787 | 2008-03-15 00:26:50 +0000 | [diff] [blame^] | 195 | enable_rom_decode(); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 196 | |
| 197 | print_info("now booting... fallback\r\n"); |
| 198 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 199 | /* Is this a CPU only reset? Or is this a secondary CPU? */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 200 | if ((cpu_init_detectedx) || (!boot_cpu())) { |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 201 | if (last_boot_normal_x) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 202 | goto normal_image; |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 203 | else |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 204 | goto fallback_image; |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 205 | } |
| 206 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 207 | /* Nothing special needs to be done to find bus 0. */ |
| 208 | /* Allow the HT devices to be found. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 209 | enumerate_ht_chain(); |
| 210 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 211 | /* Is this a deliberate reset by the BIOS? */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 212 | if (bios_reset_detected() && last_boot_normal_x) { |
| 213 | goto normal_image; |
| 214 | } |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 215 | /* This is the primary CPU, how should I boot? */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 216 | else if (do_normal_boot()) { |
| 217 | goto normal_image; |
| 218 | } else { |
| 219 | goto fallback_image; |
| 220 | } |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 221 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 222 | normal_image: |
| 223 | /* print_info("JMP normal image\r\n"); */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 224 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 225 | __asm__ __volatile__("jmp __normal_image": |
| 226 | :"a" (bist), "b" (cpu_init_detectedx)); |
| 227 | |
| 228 | fallback_image: |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 229 | ; |
| 230 | } |
| 231 | #endif |
| 232 | |
| 233 | void real_main(unsigned long bist, unsigned long cpu_init_detectedx); |
| 234 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 235 | void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 236 | { |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 237 | #if USE_FALLBACK_IMAGE == 1 |
| 238 | failover_process(bist, cpu_init_detectedx); |
| 239 | #endif |
| 240 | real_main(bist, cpu_init_detectedx); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 243 | void real_main(unsigned long bist, unsigned long cpu_init_detectedx) |
| 244 | { |
| 245 | static const uint16_t spd_addr[] = { |
| 246 | (0xa << 3) | 0, (0xa << 3) | 2, 0, 0, |
| 247 | (0xa << 3) | 1, (0xa << 3) | 3, 0, 0, |
| 248 | #if CONFIG_MAX_PHYSICAL_CPUS > 1 |
| 249 | (0xa << 3) | 4, (0xa << 3) | 6, 0, 0, |
| 250 | (0xa << 3) | 5, (0xa << 3) | 7, 0, 0, |
| 251 | #endif |
| 252 | }; |
| 253 | unsigned bsp_apicid = 0; |
| 254 | int needs_reset = 0; |
| 255 | struct sys_info *sysinfo = |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 256 | (DCACHE_RAM_BASE + DCACHE_RAM_SIZE - DCACHE_RAM_GLOBAL_VAR_SIZE); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 257 | char *p; |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 258 | |
Rudolf Marek | 6211ae1 | 2008-01-12 22:29:17 +0000 | [diff] [blame] | 259 | sio_init(); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 260 | w83627ehg_enable_serial(SERIAL_DEV, TTYS0_BASE); |
| 261 | uart_init(); |
| 262 | console_init(); |
Rudolf Marek | 5671787 | 2008-03-15 00:26:50 +0000 | [diff] [blame^] | 263 | enable_rom_decode(); |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 264 | |
| 265 | print_info("now booting... real_main\r\n"); |
| 266 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 267 | if (bist == 0) |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 268 | bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 269 | |
| 270 | /* Halt if there was a built in self test failure. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 271 | report_bist_failure(bist); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 272 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 273 | setup_default_resource_map(); |
| 274 | setup_coherent_ht_domain(); |
| 275 | wait_all_core0_started(); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 276 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 277 | print_info("now booting... Core0 started\r\n"); |
| 278 | |
| 279 | #if CONFIG_LOGICAL_CPUS==1 |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 280 | /* It is said that we should start core1 after all core0 launched. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 281 | start_other_cores(); |
| 282 | wait_all_other_cores_started(bsp_apicid); |
| 283 | #endif |
| 284 | init_timer(); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 285 | ht_setup_chains_x(sysinfo); /* Init sblnk and sbbusn, nodes, sbdn. */ |
Rudolf Marek | cc3ccdb | 2007-11-13 15:40:21 +0000 | [diff] [blame] | 286 | |
| 287 | enable_fid_change(); |
| 288 | init_fidvid_bsp(bsp_apicid); |
| 289 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 290 | needs_reset = optimize_link_coherent_ht(); |
| 291 | needs_reset |= optimize_link_incoherent_ht(sysinfo); |
| 292 | |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 293 | /* FIXME: Assumes that 1000MHz LDT is selected. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 294 | needs_reset |= k8t890_early_setup_car(16, 0x6); |
| 295 | |
| 296 | if (needs_reset) { |
| 297 | print_debug("ht reset -\r\n"); |
| 298 | soft_reset(); |
| 299 | } |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 300 | |
| 301 | /* Stop the APs so we can start them later in init. */ |
| 302 | allow_all_aps_stop(bsp_apicid); |
| 303 | |
| 304 | /* It's the time to set ctrl now. */ |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 305 | fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr); |
Uwe Hermann | c4f5365 | 2008-03-08 19:14:42 +0000 | [diff] [blame] | 306 | |
Rudolf Marek | 1a00256 | 2007-11-02 23:17:57 +0000 | [diff] [blame] | 307 | enable_smbus(); |
| 308 | memreset_setup(); |
| 309 | sdram_initialize(sysinfo->nodes, sysinfo->ctrl, sysinfo); |
| 310 | post_cache_as_ram(); |
| 311 | } |