blob: 1e6bf67e3ebe7483c5acf2b8334164d0c72e0271 [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>
Arthur Heymanscea4fd92019-10-03 08:54:35 +02006#include <device/pci_ops.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +02007#include <timestamp.h>
8#include <romstage_handoff.h>
Angel Pons95de2312020-02-17 13:08:53 +01009#include "ironlake.h"
Arthur Heymanscea4fd92019-10-03 08:54:35 +020010#include <arch/romstage.h>
11#include <device/pci_def.h>
12#include <device/device.h>
Angel Pons95de2312020-02-17 13:08:53 +010013#include <northbridge/intel/ironlake/chip.h>
14#include <northbridge/intel/ironlake/raminit.h>
Arthur Heymans2878c0b2019-10-14 18:42:00 +020015#include <southbridge/intel/common/pmclib.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020016#include <southbridge/intel/ibexpeak/pch.h>
17#include <southbridge/intel/ibexpeak/me.h>
Arthur Heymanscea4fd92019-10-03 08:54:35 +020018
Angel Pons43bcc7b2020-06-22 18:11:31 +020019/*
20 * Platform has no romstage entry point under mainboard directory,
Arthur Heymanscea4fd92019-10-03 08:54:35 +020021 * so this one is named with prefix mainboard.
22 */
23void mainboard_romstage_entry(void)
24{
Arthur Heymanscea4fd92019-10-03 08:54:35 +020025 int s3resume = 0;
26 u8 spd_addrmap[4] = {};
27
Arthur Heymanscea4fd92019-10-03 08:54:35 +020028 /* TODO, make this configurable */
Angel Pons95de2312020-02-17 13:08:53 +010029 ironlake_early_initialization(IRONLAKE_MOBILE);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020030
Arthur Heymansb9c9cd72019-10-10 15:06:33 +020031 early_pch_init();
32
Arthur Heymans2878c0b2019-10-14 18:42:00 +020033 s3resume = southbridge_detect_s3_resume();
34 if (s3resume) {
35 u8 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa2);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020036 if (!(reg8 & 0x20)) {
Arthur Heymans2878c0b2019-10-14 18:42:00 +020037 s3resume = 0;
Arthur Heymanscea4fd92019-10-03 08:54:35 +020038 printk(BIOS_DEBUG, "Bad resume from S3 detected.\n");
Arthur Heymanscea4fd92019-10-03 08:54:35 +020039 }
40 }
41
Arthur Heymanscea4fd92019-10-03 08:54:35 +020042 early_thermal_init();
43
Jakub Czapigaad6157e2022-02-15 11:50:31 +010044 timestamp_add_now(TS_INITRAM_START);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020045
46 chipset_init(s3resume);
47
48 mainboard_pre_raminit();
49
50 mainboard_get_spd_map(spd_addrmap);
51
52 raminit(s3resume, spd_addrmap);
53
Jakub Czapigaad6157e2022-02-15 11:50:31 +010054 timestamp_add_now(TS_INITRAM_END);
Arthur Heymanscea4fd92019-10-03 08:54:35 +020055
56 intel_early_me_status();
57
Arthur Heymanscea4fd92019-10-03 08:54:35 +020058 romstage_handoff_init(s3resume);
59}