From fbdeb4af75d022c237ff48cb3021451d7e8c5328 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 14 Feb 2019 19:47:03 +0100 Subject: qemu-q35: die if started on wrong machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QEMU machine "PC" doesn't support MCFG. Die after console init if the user selected the wrong qemu machine and print a message to use the correct machine type. Without this patch ramstage dies with non-helpful message: "get_pbus: dev is NULL!" Change-Id: I9d1b24176de971c5f827091bc5bc1bac8426f3f6 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/31425 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Kyösti Mälkki Reviewed-by: Paul Menzel --- src/mainboard/emulation/qemu-q35/romstage.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/mainboard/emulation/qemu-q35/romstage.c') diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c index e409ad1e5fae..dbaead982af0 100644 --- a/src/mainboard/emulation/qemu-q35/romstage.c +++ b/src/mainboard/emulation/qemu-q35/romstage.c @@ -22,6 +22,18 @@ #include #include #include +#include + +#define D0F0_PCIEXBAR_LO 0x60 + +static void mainboard_machine_check(void) +{ + /* Check that MCFG is active. If it's not qemu was started for machine PC */ + if (!CONFIG(BOOTBLOCK_CONSOLE) && + (pci_read_config32(PCI_DEV(0, 0, 0), D0F0_PCIEXBAR_LO) != + (CONFIG_MMCONF_BASE_ADDRESS | 1))) + die("You must run qemu for machine Q35 (-M q35)"); +} asmlinkage void car_stage_entry(void) { @@ -29,6 +41,8 @@ asmlinkage void car_stage_entry(void) i82801ix_early_init(); console_init(); + mainboard_machine_check(); + cbmem_recovery(0); timestamp_add_now(TS_START_ROMSTAGE); -- cgit v1.2.3