Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Arastra, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
| 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. |
| 14 | * |
| 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 |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame^] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 20 | #include <stdint.h> |
| 21 | #include <stdlib.h> |
| 22 | #include <device/pci_def.h> |
| 23 | #include <device/pci_ids.h> |
| 24 | #include <arch/io.h> |
| 25 | #include <device/pnp_def.h> |
| 26 | #include <arch/romcc_io.h> |
| 27 | #include <cpu/x86/lapic.h> |
Edwin Beasant | eb50c7d | 2010-07-06 21:05:04 +0000 | [diff] [blame] | 28 | #include <pc80/mc146818rtc.h> |
Stefan Reinauer | ae5e11d | 2012-04-27 02:31:28 +0200 | [diff] [blame] | 29 | #include "drivers/pc80/udelay_io.c" |
Patrick Georgi | 12584e2 | 2010-05-08 09:14:51 +0000 | [diff] [blame] | 30 | #include <console/console.h> |
stepan | 836ae29 | 2010-12-08 05:42:47 +0000 | [diff] [blame] | 31 | #include "southbridge/intel/i3100/early_smbus.c" |
| 32 | #include "southbridge/intel/i3100/early_lpc.c" |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 33 | #include "northbridge/intel/i3100/raminit_ep80579.h" |
| 34 | #include "superio/intel/i3100/i3100.h" |
| 35 | #include "cpu/x86/lapic/boot_cpu.c" |
| 36 | #include "cpu/x86/mtrr/earlymtrr.c" |
stepan | 8301d83 | 2010-12-08 07:07:33 +0000 | [diff] [blame] | 37 | #include "superio/intel/i3100/early_serial.c" |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 38 | #include "cpu/x86/bist.h" |
Patrick Georgi | 9bd9a90 | 2010-11-20 10:31:00 +0000 | [diff] [blame] | 39 | #include <spd.h> |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 40 | |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 41 | #define DEVPRES_CONFIG (DEVPRES_D1F0 | DEVPRES_D2F0 | DEVPRES_D3F0 | DEVPRES_D4F0) |
| 42 | |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 43 | static inline int spd_read_byte(u16 device, u8 address) |
| 44 | { |
| 45 | return smbus_read_byte(device, address); |
| 46 | } |
| 47 | |
| 48 | #include "northbridge/intel/i3100/raminit_ep80579.c" |
Stefan Reinauer | c13093b | 2009-09-23 18:51:03 +0000 | [diff] [blame] | 49 | #include "lib/generic_sdram.c" |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 50 | #include "../../intel/jarrell/debug.c" |
Stefan Reinauer | 8677a23 | 2010-12-11 20:33:41 +0000 | [diff] [blame] | 51 | #include "arch/x86/lib/stages.c" |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 52 | |
Uwe Hermann | d1a1d57 | 2010-11-10 18:22:11 +0000 | [diff] [blame] | 53 | #define SERIAL_DEV PNP_DEV(0x4e, I3100_SP1) |
| 54 | |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 55 | static void main(unsigned long bist) |
| 56 | { |
| 57 | msr_t msr; |
| 58 | u16 perf; |
| 59 | static const struct mem_controller mch[] = { |
| 60 | { |
| 61 | .node_id = 0, |
| 62 | .f0 = PCI_DEV(0, 0x00, 0), |
Uwe Hermann | 6dc92f0 | 2010-11-21 11:36:03 +0000 | [diff] [blame] | 63 | .channel0 = { DIMM2, DIMM3 }, |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 64 | } |
| 65 | }; |
| 66 | |
| 67 | if (bist == 0) { |
| 68 | /* Skip this if there was a built in self test failure */ |
| 69 | early_mtrr_init(); |
Uwe Hermann | 7b99705 | 2010-11-21 22:47:22 +0000 | [diff] [blame] | 70 | if (memory_initialized()) |
Stefan Reinauer | d41a0bc | 2010-04-09 13:33:59 +0000 | [diff] [blame] | 71 | skip_romstage(); |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | /* Set up the console */ |
| 75 | i3100_enable_superio(); |
Uwe Hermann | d1a1d57 | 2010-11-10 18:22:11 +0000 | [diff] [blame] | 76 | i3100_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
| 77 | i3100_configure_uart_clk(SERIAL_DEV, I3100_UART_CLK_PREDIVIDE_26); |
| 78 | |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 79 | console_init(); |
| 80 | |
| 81 | /* Prevent the TCO timer from rebooting us */ |
| 82 | i3100_halt_tco_timer(); |
| 83 | |
| 84 | /* Halt if there was a built in self test failure */ |
| 85 | report_bist_failure(bist); |
| 86 | |
| 87 | #ifdef TRUXTON_DEBUG |
| 88 | print_pci_devices(); |
| 89 | #endif |
| 90 | enable_smbus(); |
| 91 | dump_spd_registers(); |
| 92 | |
| 93 | sdram_initialize(ARRAY_SIZE(mch), mch); |
| 94 | dump_pci_devices(); |
| 95 | dump_pci_device(PCI_DEV(0, 0x00, 0)); |
| 96 | #ifdef TRUXTON_DEBUG |
| 97 | dump_bar14(PCI_DEV(0, 0x00, 0)); |
| 98 | #endif |
Ed Swierk | b8e53eb | 2008-10-13 23:18:56 +0000 | [diff] [blame] | 99 | } |