blob: 22eae4ef1ec3acdeff26e7a6cd0a3e4427325b41 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Arthur Heymansdc584c32019-11-12 20:37:21 +01002
3#include <stdint.h>
4#include <cf9_reset.h>
5#include <cpu/x86/lapic.h>
Arthur Heymansdc584c32019-11-12 20:37:21 +01006#include <arch/romstage.h>
7#include <northbridge/intel/i945/i945.h>
8#include <northbridge/intel/i945/raminit.h>
9#include <southbridge/intel/i82801gx/i82801gx.h>
10#include <southbridge/intel/common/pmclib.h>
11
12__weak void mainboard_lpc_decode(void)
13{
14}
15
Arthur Heymansdc584c32019-11-12 20:37:21 +010016__weak void mainboard_pre_raminit_config(int s3_resume)
17{
18}
19
20__weak void mainboard_get_spd_map(u8 spd_map[4])
21{
22 spd_map[0] = 0x50;
23 spd_map[1] = 0x51;
24 spd_map[2] = 0x52;
25 spd_map[3] = 0x53;
26}
27
28void mainboard_romstage_entry(void)
29{
30 int s3resume = 0;
31 u8 spd_map[4] = {};
32
33 enable_lapic();
34
Arthur Heymansdc584c32019-11-12 20:37:21 +010035 mainboard_lpc_decode();
Arthur Heymansdc584c32019-11-12 20:37:21 +010036
37 if (MCHBAR16(SSKPD) == 0xCAFE) {
38 system_reset();
39 }
40
41 /* Perform some early chipset initialization required
42 * before RAM initialization can work
43 */
44 i82801gx_early_init();
45 i945_early_initialization();
46
47 s3resume = southbridge_detect_s3_resume();
48
Arthur Heymansdc584c32019-11-12 20:37:21 +010049 mainboard_pre_raminit_config(s3resume);
50
Arthur Heymansdc584c32019-11-12 20:37:21 +010051 mainboard_get_spd_map(spd_map);
52
Angel Ponsa60b42a2021-03-28 14:06:55 +020053 if (CONFIG(DEBUG_RAM_SETUP))
54 dump_spd_registers(spd_map);
55
Paul Menzele0cd2eb2020-01-19 00:07:05 +010056 sdram_initialize(s3resume ? BOOT_PATH_RESUME : BOOT_PATH_NORMAL, spd_map);
Arthur Heymansdc584c32019-11-12 20:37:21 +010057
58 /* This should probably go away. Until now it is required
59 * and mainboard specific
60 */
61 mainboard_late_rcba_config();
62
63 /* Chipset Errata! */
Elyes HAOUAS8273e132020-03-10 22:17:12 +010064 if (CONFIG(NORTHBRIDGE_INTEL_SUBTYPE_I945GM))
65 fixup_i945gm_errata();
Arthur Heymansdc584c32019-11-12 20:37:21 +010066
67 /* Initialize the internal PCIe links before we go into stage2 */
68 i945_late_initialization(s3resume);
69}