Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <cf9_reset.h> |
| 6 | #include <cpu/x86/lapic.h> |
| 7 | #include <console/console.h> |
| 8 | #include <arch/romstage.h> |
| 9 | #include <northbridge/intel/i945/i945.h> |
| 10 | #include <northbridge/intel/i945/raminit.h> |
| 11 | #include <southbridge/intel/i82801gx/i82801gx.h> |
| 12 | #include <southbridge/intel/common/pmclib.h> |
| 13 | |
| 14 | __weak void mainboard_lpc_decode(void) |
| 15 | { |
| 16 | } |
| 17 | |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 18 | __weak void mainboard_pre_raminit_config(int s3_resume) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | __weak void mainboard_get_spd_map(u8 spd_map[4]) |
| 23 | { |
| 24 | spd_map[0] = 0x50; |
| 25 | spd_map[1] = 0x51; |
| 26 | spd_map[2] = 0x52; |
| 27 | spd_map[3] = 0x53; |
| 28 | } |
| 29 | |
| 30 | void mainboard_romstage_entry(void) |
| 31 | { |
| 32 | int s3resume = 0; |
| 33 | u8 spd_map[4] = {}; |
| 34 | |
| 35 | enable_lapic(); |
| 36 | |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 37 | mainboard_lpc_decode(); |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 38 | |
| 39 | if (MCHBAR16(SSKPD) == 0xCAFE) { |
| 40 | system_reset(); |
| 41 | } |
| 42 | |
| 43 | /* Perform some early chipset initialization required |
| 44 | * before RAM initialization can work |
| 45 | */ |
| 46 | i82801gx_early_init(); |
| 47 | i945_early_initialization(); |
| 48 | |
| 49 | s3resume = southbridge_detect_s3_resume(); |
| 50 | |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 51 | mainboard_pre_raminit_config(s3resume); |
| 52 | |
| 53 | if (CONFIG(DEBUG_RAM_SETUP)) |
| 54 | dump_spd_registers(); |
| 55 | |
| 56 | mainboard_get_spd_map(spd_map); |
| 57 | |
Paul Menzel | e0cd2eb | 2020-01-19 00:07:05 +0100 | [diff] [blame] | 58 | sdram_initialize(s3resume ? BOOT_PATH_RESUME : BOOT_PATH_NORMAL, spd_map); |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 59 | |
| 60 | /* This should probably go away. Until now it is required |
| 61 | * and mainboard specific |
| 62 | */ |
| 63 | mainboard_late_rcba_config(); |
| 64 | |
| 65 | /* Chipset Errata! */ |
Elyes HAOUAS | 8273e13 | 2020-03-10 22:17:12 +0100 | [diff] [blame] | 66 | if (CONFIG(NORTHBRIDGE_INTEL_SUBTYPE_I945GM)) |
| 67 | fixup_i945gm_errata(); |
Arthur Heymans | dc584c3 | 2019-11-12 20:37:21 +0100 | [diff] [blame] | 68 | |
| 69 | /* Initialize the internal PCIe links before we go into stage2 */ |
| 70 | i945_late_initialization(s3resume); |
| 71 | } |