blob: 6b9f3d0e8360dab5670b4b14411e403f8ebf974a [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Arthur Heymanscea4fd92019-10-03 08:54:35 +02002
Elyes HAOUAS92f46aa2020-09-15 08:42:17 +02003#include <arch/io.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +02004#include <stdint.h>
5#include <console/console.h>
6#include <cf9_reset.h>
7#include <device/pci_ops.h>
8#include <cpu/x86/lapic.h>
9#include <timestamp.h>
10#include <romstage_handoff.h>
Angel Pons95de2312020-02-17 13:08:53 +010011#include "ironlake.h"
Arthur Heymanscea4fd92019-10-03 08:54:35 +020012#include <arch/romstage.h>
13#include <device/pci_def.h>
14#include <device/device.h>
Angel Pons95de2312020-02-17 13:08:53 +010015#include <northbridge/intel/ironlake/chip.h>
16#include <northbridge/intel/ironlake/raminit.h>
Arthur Heymans2878c0b2019-10-14 18:42:00 +020017#include <southbridge/intel/common/pmclib.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020018#include <southbridge/intel/ibexpeak/pch.h>
19#include <southbridge/intel/ibexpeak/me.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020020
Angel Pons43bcc7b2020-06-22 18:11:31 +020021/*
22 * Platform has no romstage entry point under mainboard directory,
Arthur Heymanscea4fd92019-10-03 08:54:35 +020023 * so this one is named with prefix mainboard.
24 */
25void mainboard_romstage_entry(void)
26{
27 u32 reg32;
28 int s3resume = 0;
29 u8 spd_addrmap[4] = {};
30
31 enable_lapic();
32
33 /* TODO, make this configurable */
Angel Pons95de2312020-02-17 13:08:53 +010034 ironlake_early_initialization(IRONLAKE_MOBILE);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020035
Arthur Heymansb9c9cd72019-10-10 15:06:33 +020036 early_pch_init();
37
Arthur Heymans2878c0b2019-10-14 18:42:00 +020038 s3resume = southbridge_detect_s3_resume();
39 if (s3resume) {
40 u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020041 if (!(reg8 & 0x20)) {
Arthur Heymans2878c0b2019-10-14 18:42:00 +020042 s3resume = 0;
Arthur Heymanscea4fd92019-10-03 08:54:35 +020043 printk(BIOS_DEBUG, "Bad resume from S3 detected.\n");
Arthur Heymanscea4fd92019-10-03 08:54:35 +020044 }
45 }
46
Arthur Heymanscea4fd92019-10-03 08:54:35 +020047 early_thermal_init();
48
49 timestamp_add_now(TS_BEFORE_INITRAM);
50
51 chipset_init(s3resume);
52
53 mainboard_pre_raminit();
54
55 mainboard_get_spd_map(spd_addrmap);
56
57 raminit(s3resume, spd_addrmap);
58
59 timestamp_add_now(TS_AFTER_INITRAM);
60
61 intel_early_me_status();
62
63 if (s3resume) {
Angel Pons43bcc7b2020-06-22 18:11:31 +020064 /*
65 * Clear SLP_TYPE. This will break stage2 but
Arthur Heymanscea4fd92019-10-03 08:54:35 +020066 * we care for that when we get there.
67 */
68 reg32 = inl(DEFAULT_PMBASE + 0x04);
69 outl(reg32 & ~(7 << 10), DEFAULT_PMBASE + 0x04);
70 }
71
72 romstage_handoff_init(s3resume);
73}