blob: 126d942645df4294afc95825f1fd439fe2cf6d8e [file] [log] [blame]
Andreas Schultz4c94c052010-08-30 16:22:22 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Original take from digitallogic/adl855pc
5 *
6 * Copyright (C) 2010 Travelping GmbH <info@travelping.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Andreas Schultz4c94c052010-08-30 16:22:22 +000017 */
18
19#include <stdint.h>
20#include <device/pci_def.h>
21#include <arch/io.h>
22#include <device/pnp_def.h>
Andreas Schultz4c94c052010-08-30 16:22:22 +000023#include <stdlib.h>
Uwe Hermann6e9ab972010-11-22 12:59:36 +000024#include <lib.h>
Uwe Hermann6dc92f02010-11-21 11:36:03 +000025#include <spd.h>
Andreas Schultz4c94c052010-08-30 16:22:22 +000026#include <pc80/mc146818rtc.h>
27#include <console/console.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110028#include <southbridge/intel/i82801dx/i82801dx.h>
29#include <northbridge/intel/i855/raminit.h>
Andreas Schultz4c94c052010-08-30 16:22:22 +000030#include "northbridge/intel/i855/debug.c"
Edward O'Callaghan0dd06692014-04-29 13:59:54 +100031#include <superio/winbond/common/winbond.h>
Edward O'Callaghan4f5a5252014-04-03 14:40:24 +110032#include <superio/winbond/w83627thg/w83627thg.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110033#include <cpu/x86/bist.h>
Kyösti Mälkki07921540d2016-06-17 17:22:00 +030034#include <cpu/intel/romstage.h>
Andreas Schultz4c94c052010-08-30 16:22:22 +000035
Uwe Hermann2b6e93b2010-11-16 23:15:37 +000036#define SERIAL_DEV PNP_DEV(0x2e, W83627THG_SP1)
Andreas Schultz4c94c052010-08-30 16:22:22 +000037
38static inline int spd_read_byte(unsigned device, unsigned address)
39{
40 return smbus_read_byte(device, address);
41}
42
43#include "northbridge/intel/i855/raminit.c"
44#include "northbridge/intel/i855/reset_test.c"
Andreas Schultz4c94c052010-08-30 16:22:22 +000045
Kyösti Mälkki07921540d2016-06-17 17:22:00 +030046void mainboard_romstage_entry(unsigned long bist)
Andreas Schultz4c94c052010-08-30 16:22:22 +000047{
Andreas Schultz4c94c052010-08-30 16:22:22 +000048 if (bist == 0) {
49#if 0
50 enable_lapic();
51 init_timer();
52#endif
53 }
54
Edward O'Callaghan0dd06692014-04-29 13:59:54 +100055 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
56 console_init();
Andreas Schultz4c94c052010-08-30 16:22:22 +000057
58 /* Halt if there was a built in self test failure */
59 report_bist_failure(bist);
60
61#if 0
62 print_pci_devices();
63#endif
64
Uwe Hermann7b997052010-11-21 22:47:22 +000065 if (!bios_reset_detected()) {
Elyes HAOUASaabd7202016-09-28 21:10:08 +020066 enable_smbus();
Andreas Schultz4c94c052010-08-30 16:22:22 +000067#if 1
Uwe Hermann6e9ab972010-11-22 12:59:36 +000068 dump_spd_registers();
Andreas Schultz4c94c052010-08-30 16:22:22 +000069 dump_smbus_registers();
70#endif
Uwe Hermann6e9ab972010-11-22 12:59:36 +000071 sdram_set_registers();
72 sdram_set_spd_registers();
73 sdram_enable();
Andreas Schultz4c94c052010-08-30 16:22:22 +000074 }
Andreas Schultz4c94c052010-08-30 16:22:22 +000075}