blob: e5ecafe2a2beefe5cf2091c3826a5608f81e7b7c [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
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 Pons95de2312020-02-17 13:08:53 +010010#include "ironlake.h"
Arthur Heymanscea4fd92019-10-03 08:54:35 +020011#include <arch/romstage.h>
12#include <device/pci_def.h>
13#include <device/device.h>
Angel Pons95de2312020-02-17 13:08:53 +010014#include <northbridge/intel/ironlake/chip.h>
15#include <northbridge/intel/ironlake/raminit.h>
Arthur Heymans2878c0b2019-10-14 18:42:00 +020016#include <southbridge/intel/common/pmclib.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020017#include <southbridge/intel/ibexpeak/pch.h>
18#include <southbridge/intel/ibexpeak/me.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020019
Angel Pons43bcc7b2020-06-22 18:11:31 +020020/*
21 * Platform has no romstage entry point under mainboard directory,
Arthur Heymanscea4fd92019-10-03 08:54:35 +020022 * so this one is named with prefix mainboard.
23 */
24void mainboard_romstage_entry(void)
25{
26 u32 reg32;
27 int s3resume = 0;
28 u8 spd_addrmap[4] = {};
29
30 enable_lapic();
31
32 /* TODO, make this configurable */
Angel Pons95de2312020-02-17 13:08:53 +010033 ironlake_early_initialization(IRONLAKE_MOBILE);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020034
Arthur Heymansb9c9cd72019-10-10 15:06:33 +020035 early_pch_init();
36
Arthur Heymans2878c0b2019-10-14 18:42:00 +020037 s3resume = southbridge_detect_s3_resume();
38 if (s3resume) {
39 u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020040 if (!(reg8 & 0x20)) {
Arthur Heymans2878c0b2019-10-14 18:42:00 +020041 s3resume = 0;
Arthur Heymanscea4fd92019-10-03 08:54:35 +020042 printk(BIOS_DEBUG, "Bad resume from S3 detected.\n");
Arthur Heymanscea4fd92019-10-03 08:54:35 +020043 }
44 }
45
Arthur Heymanscea4fd92019-10-03 08:54:35 +020046 early_thermal_init();
47
48 timestamp_add_now(TS_BEFORE_INITRAM);
49
50 chipset_init(s3resume);
51
52 mainboard_pre_raminit();
53
54 mainboard_get_spd_map(spd_addrmap);
55
56 raminit(s3resume, spd_addrmap);
57
58 timestamp_add_now(TS_AFTER_INITRAM);
59
60 intel_early_me_status();
61
62 if (s3resume) {
Angel Pons43bcc7b2020-06-22 18:11:31 +020063 /*
64 * Clear SLP_TYPE. This will break stage2 but
Arthur Heymanscea4fd92019-10-03 08:54:35 +020065 * we care for that when we get there.
66 */
67 reg32 = inl(DEFAULT_PMBASE + 0x04);
68 outl(reg32 & ~(7 << 10), DEFAULT_PMBASE + 0x04);
69 }
70
71 romstage_handoff_init(s3resume);
72}