blob: 28a0c7903ebea74dd1833ba7fcee68db1261677c [file] [log] [blame]
Angel Ponsf23ae0b2020-04-02 23:48:12 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin3d0071b2013-01-18 14:32:50 -06002
Angel Pons45f448f2020-07-03 14:46:47 +02003#include <arch/romstage.h>
Aaron Durbin3d0071b2013-01-18 14:32:50 -06004#include <console/console.h>
Angel Pons6c49f402020-08-28 02:02:00 +02005#include <device/mmio.h>
Angel Pons30931f52021-03-12 13:06:45 +01006#include <elog.h>
Aaron Durbina2671612013-02-06 21:41:01 -06007#include <cpu/x86/lapic.h>
Aaron Durbinbf396ff2013-02-11 21:50:35 -06008#include <romstage_handoff.h>
Angel Pons6c49f402020-08-28 02:02:00 +02009#include <security/intel/txt/txt.h>
10#include <security/intel/txt/txt_register.h>
Elyes HAOUAS65bb5432018-07-03 14:59:50 +020011#include <northbridge/intel/haswell/haswell.h>
12#include <northbridge/intel/haswell/raminit.h>
Angel Pons30931f52021-03-12 13:06:45 +010013#include <southbridge/intel/common/pmclib.h>
Elyes HAOUAS65bb5432018-07-03 14:59:50 +020014#include <southbridge/intel/lynxpoint/pch.h>
Angel Pons6eea1912020-07-03 14:14:30 +020015
Angel Pons73fa0352020-07-03 12:29:03 +020016void __weak mb_late_romstage_setup(void)
17{
18}
19
Angel Pons45f448f2020-07-03 14:46:47 +020020/* The romstage entry point for this platform is not mainboard-specific, hence the name */
21void mainboard_romstage_entry(void)
Aaron Durbina2671612013-02-06 21:41:01 -060022{
Kyösti Mälkki157b1892019-08-16 14:02:25 +030023 enable_lapic();
Aaron Durbina2671612013-02-06 21:41:01 -060024
Angel Pons30931f52021-03-12 13:06:45 +010025 early_pch_init();
26
Aaron Durbina2671612013-02-06 21:41:01 -060027 /* Perform some early chipset initialization required
28 * before RAM initialization can work
29 */
Angel Ponse8168292020-07-03 11:42:22 +020030 haswell_early_initialization();
Aaron Durbina2671612013-02-06 21:41:01 -060031 printk(BIOS_DEBUG, "Back from haswell_early_initialization()\n");
32
Angel Ponsd99b6932021-03-12 17:37:42 +010033 const int s3resume = southbridge_detect_s3_resume();
34
35 elog_boot_notify(s3resume);
36
Aaron Durbina2671612013-02-06 21:41:01 -060037 /* Prepare USB controller early in S3 resume */
Kyösti Mälkkib6fc13b2021-02-17 17:33:09 +020038 if (s3resume)
Aaron Durbina2671612013-02-06 21:41:01 -060039 enable_usb_bar();
40
41 post_code(0x3a);
Angel Pons284a5472020-07-03 11:46:50 +020042
Aaron Durbina2671612013-02-06 21:41:01 -060043 report_platform_info();
44
Angel Pons6c49f402020-08-28 02:02:00 +020045 if (CONFIG(INTEL_TXT))
46 intel_txt_romstage_init();
47
Angel Ponsd99b6932021-03-12 17:37:42 +010048 perform_raminit(s3resume);
Kyösti Mälkki3d45c402013-09-07 20:26:36 +030049
Angel Pons6c49f402020-08-28 02:02:00 +020050 if (CONFIG(INTEL_TXT)) {
51 printk(BIOS_DEBUG, "Check TXT_ERROR register after MRC\n");
52
53 intel_txt_log_acm_error(read32((void *)TXT_ERROR));
54
55 intel_txt_log_spad();
56
57 intel_txt_memory_has_secrets();
58
59 txt_dump_regions();
60 }
61
Tristan Corrick334be322018-12-17 22:10:21 +130062 haswell_unhide_peg();
63
Kyösti Mälkkib6fc13b2021-02-17 17:33:09 +020064 romstage_handoff_init(s3resume);
Aaron Durbinbf396ff2013-02-11 21:50:35 -060065
Angel Pons73fa0352020-07-03 12:29:03 +020066 mb_late_romstage_setup();
67
Aaron Durbina2671612013-02-06 21:41:01 -060068 post_code(0x3f);
Aaron Durbina2671612013-02-06 21:41:01 -060069}