blob: 6274e099c86ecf8f2277bd251550ff23d37d6ea1 [file] [log] [blame]
Arthur Heymansdc584c32019-11-12 20:37:21 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <stdint.h>
18#include <cf9_reset.h>
19#include <cpu/x86/lapic.h>
20#include <console/console.h>
21#include <arch/romstage.h>
22#include <northbridge/intel/i945/i945.h>
23#include <northbridge/intel/i945/raminit.h>
24#include <southbridge/intel/i82801gx/i82801gx.h>
25#include <southbridge/intel/common/pmclib.h>
26
27__weak void mainboard_lpc_decode(void)
28{
29}
30
Arthur Heymansdc584c32019-11-12 20:37:21 +010031__weak void mainboard_pre_raminit_config(int s3_resume)
32{
33}
34
35__weak void mainboard_get_spd_map(u8 spd_map[4])
36{
37 spd_map[0] = 0x50;
38 spd_map[1] = 0x51;
39 spd_map[2] = 0x52;
40 spd_map[3] = 0x53;
41}
42
43void mainboard_romstage_entry(void)
44{
45 int s3resume = 0;
46 u8 spd_map[4] = {};
47
48 enable_lapic();
49
Arthur Heymansdc584c32019-11-12 20:37:21 +010050 mainboard_lpc_decode();
Arthur Heymansdc584c32019-11-12 20:37:21 +010051
52 if (MCHBAR16(SSKPD) == 0xCAFE) {
53 system_reset();
54 }
55
56 /* Perform some early chipset initialization required
57 * before RAM initialization can work
58 */
59 i82801gx_early_init();
60 i945_early_initialization();
61
62 s3resume = southbridge_detect_s3_resume();
63
Arthur Heymansdc584c32019-11-12 20:37:21 +010064 mainboard_pre_raminit_config(s3resume);
65
66 if (CONFIG(DEBUG_RAM_SETUP))
67 dump_spd_registers();
68
69 mainboard_get_spd_map(spd_map);
70
Paul Menzele0cd2eb2020-01-19 00:07:05 +010071 sdram_initialize(s3resume ? BOOT_PATH_RESUME : BOOT_PATH_NORMAL, spd_map);
Arthur Heymansdc584c32019-11-12 20:37:21 +010072
73 /* This should probably go away. Until now it is required
74 * and mainboard specific
75 */
76 mainboard_late_rcba_config();
77
78 /* Chipset Errata! */
79 fixup_i945_errata();
80
81 /* Initialize the internal PCIe links before we go into stage2 */
82 i945_late_initialization(s3resume);
83}