blob: 4a335d853cdd47a052cd11e22b237faace651c24 [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
20/* Platform has no romstage entry point under mainboard directory,
21 * so this one is named with prefix mainboard.
22 */
23void 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 Pons95de2312020-02-17 13:08:53 +010032 ironlake_early_initialization(IRONLAKE_MOBILE);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020033
Arthur Heymansb9c9cd72019-10-10 15:06:33 +020034 early_pch_init();
35
Arthur Heymans2878c0b2019-10-14 18:42:00 +020036 s3resume = southbridge_detect_s3_resume();
37 if (s3resume) {
38 u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020039 if (!(reg8 & 0x20)) {
Arthur Heymans2878c0b2019-10-14 18:42:00 +020040 s3resume = 0;
Arthur Heymanscea4fd92019-10-03 08:54:35 +020041 printk(BIOS_DEBUG, "Bad resume from S3 detected.\n");
Arthur Heymanscea4fd92019-10-03 08:54:35 +020042 }
43 }
44
Arthur Heymanscea4fd92019-10-03 08:54:35 +020045 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}