Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 2 | |
Elyes HAOUAS | 92f46aa | 2020-09-15 08:42:17 +0200 | [diff] [blame] | 3 | #include <arch/io.h> |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | #include <console/console.h> |
| 6 | #include <cf9_reset.h> |
| 7 | #include <device/pci_ops.h> |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 8 | #include <timestamp.h> |
| 9 | #include <romstage_handoff.h> |
Angel Pons | 95de231 | 2020-02-17 13:08:53 +0100 | [diff] [blame] | 10 | #include "ironlake.h" |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 11 | #include <arch/romstage.h> |
| 12 | #include <device/pci_def.h> |
| 13 | #include <device/device.h> |
Angel Pons | 95de231 | 2020-02-17 13:08:53 +0100 | [diff] [blame] | 14 | #include <northbridge/intel/ironlake/chip.h> |
| 15 | #include <northbridge/intel/ironlake/raminit.h> |
Arthur Heymans | 2878c0b | 2019-10-14 18:42:00 +0200 | [diff] [blame] | 16 | #include <southbridge/intel/common/pmclib.h> |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 17 | #include <southbridge/intel/ibexpeak/pch.h> |
| 18 | #include <southbridge/intel/ibexpeak/me.h> |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 19 | |
Angel Pons | 43bcc7b | 2020-06-22 18:11:31 +0200 | [diff] [blame] | 20 | /* |
| 21 | * Platform has no romstage entry point under mainboard directory, |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 22 | * so this one is named with prefix mainboard. |
| 23 | */ |
| 24 | void mainboard_romstage_entry(void) |
| 25 | { |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 26 | int s3resume = 0; |
| 27 | u8 spd_addrmap[4] = {}; |
| 28 | |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 29 | /* TODO, make this configurable */ |
Angel Pons | 95de231 | 2020-02-17 13:08:53 +0100 | [diff] [blame] | 30 | ironlake_early_initialization(IRONLAKE_MOBILE); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 31 | |
Arthur Heymans | b9c9cd7 | 2019-10-10 15:06:33 +0200 | [diff] [blame] | 32 | early_pch_init(); |
| 33 | |
Arthur Heymans | 2878c0b | 2019-10-14 18:42:00 +0200 | [diff] [blame] | 34 | s3resume = southbridge_detect_s3_resume(); |
| 35 | if (s3resume) { |
| 36 | u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 37 | if (!(reg8 & 0x20)) { |
Arthur Heymans | 2878c0b | 2019-10-14 18:42:00 +0200 | [diff] [blame] | 38 | s3resume = 0; |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 39 | printk(BIOS_DEBUG, "Bad resume from S3 detected.\n"); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 43 | early_thermal_init(); |
| 44 | |
| 45 | timestamp_add_now(TS_BEFORE_INITRAM); |
| 46 | |
| 47 | chipset_init(s3resume); |
| 48 | |
| 49 | mainboard_pre_raminit(); |
| 50 | |
| 51 | mainboard_get_spd_map(spd_addrmap); |
| 52 | |
| 53 | raminit(s3resume, spd_addrmap); |
| 54 | |
| 55 | timestamp_add_now(TS_AFTER_INITRAM); |
| 56 | |
| 57 | intel_early_me_status(); |
| 58 | |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 59 | romstage_handoff_init(s3resume); |
| 60 | } |