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 | |
| 3 | #include <stdint.h> |
| 4 | #include <console/console.h> |
| 5 | #include <cf9_reset.h> |
| 6 | #include <device/pci_ops.h> |
| 7 | #include <cpu/x86/lapic.h> |
| 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 | |
| 20 | /* Platform has no romstage entry point under mainboard directory, |
| 21 | * so this one is named with prefix mainboard. |
| 22 | */ |
| 23 | void mainboard_romstage_entry(void) |
| 24 | { |
| 25 | u32 reg32; |
| 26 | int s3resume = 0; |
| 27 | u8 spd_addrmap[4] = {}; |
| 28 | |
| 29 | enable_lapic(); |
| 30 | |
| 31 | /* TODO, make this configurable */ |
Angel Pons | 95de231 | 2020-02-17 13:08:53 +0100 | [diff] [blame] | 32 | ironlake_early_initialization(IRONLAKE_MOBILE); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 33 | |
Arthur Heymans | b9c9cd7 | 2019-10-10 15:06:33 +0200 | [diff] [blame] | 34 | early_pch_init(); |
| 35 | |
Arthur Heymans | 2878c0b | 2019-10-14 18:42:00 +0200 | [diff] [blame] | 36 | s3resume = southbridge_detect_s3_resume(); |
| 37 | if (s3resume) { |
| 38 | u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 39 | if (!(reg8 & 0x20)) { |
Arthur Heymans | 2878c0b | 2019-10-14 18:42:00 +0200 | [diff] [blame] | 40 | s3resume = 0; |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 41 | printk(BIOS_DEBUG, "Bad resume from S3 detected.\n"); |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | |
Arthur Heymans | cea4fd9 | 2019-10-03 08:54:35 +0200 | [diff] [blame] | 45 | early_thermal_init(); |
| 46 | |
| 47 | timestamp_add_now(TS_BEFORE_INITRAM); |
| 48 | |
| 49 | chipset_init(s3resume); |
| 50 | |
| 51 | mainboard_pre_raminit(); |
| 52 | |
| 53 | mainboard_get_spd_map(spd_addrmap); |
| 54 | |
| 55 | raminit(s3resume, spd_addrmap); |
| 56 | |
| 57 | timestamp_add_now(TS_AFTER_INITRAM); |
| 58 | |
| 59 | intel_early_me_status(); |
| 60 | |
| 61 | if (s3resume) { |
| 62 | /* Clear SLP_TYPE. This will break stage2 but |
| 63 | * we care for that when we get there. |
| 64 | */ |
| 65 | reg32 = inl(DEFAULT_PMBASE + 0x04); |
| 66 | outl(reg32 & ~(7 << 10), DEFAULT_PMBASE + 0x04); |
| 67 | } |
| 68 | |
| 69 | romstage_handoff_init(s3resume); |
| 70 | } |