blob: 5c172ed2eb3780d0d6d49a0e6f8d8022a2df57c5 [file] [log] [blame]
Angel Ponsf94ac9a2020-04-05 15:46:48 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Duncan Lauriec88c54c2014-04-30 16:36:13 -07002
Angel Pons7a957542020-10-13 21:22:01 +02003#include <acpi/acpi.h>
Kyösti Mälkkia963acd2019-08-16 20:34:25 +03004#include <arch/romstage.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -07005#include <console/console.h>
Angel Pons9d733de2020-11-23 13:15:19 +01006#include <cpu/intel/haswell/haswell.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -07007#include <elog.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -07008#include <romstage_handoff.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -07009#include <soc/me.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070010#include <soc/pm.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070011#include <soc/romstage.h>
Angel Pons733f03d2021-01-28 16:59:04 +010012#include <southbridge/intel/lynxpoint/lp_gpio.h>
Angel Pons7a957542020-10-13 21:22:01 +020013#include <stdint.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070014
Angel Ponsac1c9bb2021-01-20 22:36:20 +010015__weak void mainboard_post_raminit(const int s3resume)
16{
17}
18
Arthur Heymans56f76872019-05-12 14:01:13 +020019/* Entry from cpu/intel/car/romstage.c. */
Kyösti Mälkki157b1892019-08-16 14:02:25 +030020void mainboard_romstage_entry(void)
Duncan Lauriec88c54c2014-04-30 16:36:13 -070021{
Duncan Lauriec88c54c2014-04-30 16:36:13 -070022 post_code(0x30);
23
Duncan Lauriec88c54c2014-04-30 16:36:13 -070024 /* System Agent Early Initialization */
25 systemagent_early_init();
26
27 /* PCH Early Initialization */
28 pch_early_init();
29
Duncan Laurie61680272014-05-05 12:42:35 -050030 /* Get power state */
Angel Pons24e4edb2021-01-20 22:53:42 +010031 struct chipset_power_state *const power_state = fill_power_state();
Duncan Laurie61680272014-05-05 12:42:35 -050032
Kyösti Mälkki74cb3e72021-02-17 17:33:17 +020033 int s3resume = power_state->prev_sleep_state == ACPI_S3;
34
35 elog_boot_notify(s3resume);
Kyösti Mälkki7f50afb2019-09-11 17:12:26 +030036
Duncan Lauriec88c54c2014-04-30 16:36:13 -070037 /* Print useful platform information */
38 report_platform_info();
39
40 /* Set CPU frequency to maximum */
41 set_max_freq();
42
Arthur Heymanscadc70f2019-05-12 13:44:22 +020043 /* Initialize GPIOs */
Angel Pons88f94a92021-03-19 15:13:46 +010044 setup_pch_lp_gpios(mainboard_lp_gpio_map);
Arthur Heymanscadc70f2019-05-12 13:44:22 +020045
Angel Pons61615e92021-06-23 13:02:22 +020046 /* Print ME state before MRC */
47 intel_me_status();
48
49 /* Save ME HSIO version */
50 intel_me_hsio_version(&power_state->hsio_version,
51 &power_state->hsio_checksum);
52
Angel Ponsdc600732021-06-23 13:11:30 +020053 perform_raminit(power_state);
Angel Ponsd0d528a2021-01-20 23:09:16 +010054
Kyösti Mälkki74cb3e72021-02-17 17:33:17 +020055 romstage_handoff_init(s3resume);
Arthur Heymans97e9e562019-05-12 13:47:35 +020056
Kyösti Mälkki74cb3e72021-02-17 17:33:17 +020057 mainboard_post_raminit(s3resume);
Duncan Lauriec88c54c2014-04-30 16:36:13 -070058}