Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Kyösti Mälkki <kyosti.malkki@gmail.com> |
| 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 as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 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 |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <device/pci_def.h> |
| 22 | #include <arch/io.h> |
| 23 | #include <device/pnp_def.h> |
| 24 | #include <arch/romcc_io.h> |
| 25 | #include <cpu/x86/lapic.h> |
| 26 | #include <arch/cpu.h> |
| 27 | #include <stdlib.h> |
| 28 | #include <pc80/mc146818rtc.h> |
| 29 | #include <console/console.h> |
Kyösti Mälkki | 3aff1a3 | 2012-04-11 12:19:03 +0300 | [diff] [blame] | 30 | #include <cpu/x86/bist.h> |
| 31 | #include <spd.h> |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 32 | |
| 33 | #include "southbridge/intel/i82801dx/i82801dx.h" |
| 34 | #include "southbridge/intel/i82801dx/early_smbus.c" |
| 35 | #include "southbridge/intel/i82801dx/reset.c" |
| 36 | #include "northbridge/intel/e7505/raminit.h" |
| 37 | #include "northbridge/intel/e7505/debug.c" |
| 38 | #include "superio/smsc/lpc47m10x/early_serial.c" |
| 39 | |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 40 | |
| 41 | #define SERIAL_DEV PNP_DEV(0x2e, LPC47M10X2_SP1) |
| 42 | |
| 43 | static inline int spd_read_byte(unsigned device, unsigned address) |
| 44 | { |
| 45 | return smbus_read_byte(device, address); |
| 46 | } |
| 47 | |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 48 | #include "northbridge/intel/e7505/raminit.c" |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 49 | |
Kyösti Mälkki | 3aff1a3 | 2012-04-11 12:19:03 +0300 | [diff] [blame] | 50 | void main(unsigned long bist) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 51 | { |
| 52 | static const struct mem_controller memctrl[] = { |
| 53 | { |
| 54 | .d0 = PCI_DEV(0, 0, 0), |
| 55 | .d0f1 = PCI_DEV(0, 0, 1), |
| 56 | .channel0 = { 0x50, 0x52, 0, 0 }, |
| 57 | .channel1 = { 0x51, 0x53, 0, 0 }, |
| 58 | }, |
| 59 | }; |
| 60 | |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 61 | // Get the serial port running and print a welcome banner |
| 62 | lpc47m10x_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE); |
| 63 | console_init(); |
| 64 | |
| 65 | // Halt if there was a built in self test failure |
| 66 | report_bist_failure(bist); |
| 67 | |
| 68 | // If this is a warm boot, some initialization can be skipped |
| 69 | if (!bios_reset_detected()) { |
| 70 | enable_smbus(); |
Kyösti Mälkki | 97c064f | 2012-04-18 20:33:35 +0300 | [diff] [blame^] | 71 | |
| 72 | /* The real MCH initialisation. */ |
| 73 | e7505_mch_init(memctrl); |
| 74 | |
| 75 | /* |
| 76 | * ECC scrub invalidates cache, so all stack in CAR |
| 77 | * is lost. Only return addresses from main() and |
| 78 | * scrub_ecc() are recovered to stack via xmm0-xmm3. |
| 79 | */ |
| 80 | #if CONFIG_HW_SCRUBBER |
| 81 | unsigned long ret_addr = (unsigned long)((unsigned long*)&bist - 1); |
| 82 | e7505_mch_scrub_ecc(ret_addr); |
| 83 | #endif |
| 84 | |
| 85 | /* Hook for post ECC scrub settings and debug. */ |
| 86 | e7505_mch_done(memctrl); |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 87 | } |
| 88 | |
Kyösti Mälkki | 97c064f | 2012-04-18 20:33:35 +0300 | [diff] [blame^] | 89 | printk(BIOS_DEBUG, "SDRAM is up.\n"); |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 90 | } |