Patrick Rudolph has uploaded this change for review.

View Change

qemu-q35: die if started on wrong machine

The QEMU machine "PC" doesn't support MCFG.
Die in bootblock 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 <siro@das-labor.org>
---
M src/mainboard/emulation/qemu-q35/bootblock.c
1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/31425/1
diff --git a/src/mainboard/emulation/qemu-q35/bootblock.c b/src/mainboard/emulation/qemu-q35/bootblock.c
index 18a083d..96d3457 100644
--- a/src/mainboard/emulation/qemu-q35/bootblock.c
+++ b/src/mainboard/emulation/qemu-q35/bootblock.c
@@ -14,6 +14,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <southbridge/intel/i82801ix/i82801ix.h>
+#include <console/console.h>

/* Just define these here, there is no gm35.h file to include. */
#define D0F0_PCIEXBAR_LO 0x60
@@ -39,6 +40,11 @@
pci_io_write_config32(PCI_DEV(0,0,0), D0F0_PCIEXBAR_HI, reg);
reg = CONFIG_MMCONF_BASE_ADDRESS | 1; /* 256MiB - 0-255 buses. */
pci_io_write_config32(PCI_DEV(0,0,0), D0F0_PCIEXBAR_LO, reg);
+
+ /* MCFG is now active. If it's not qemu was started for machine PC */
+ if (pci_read_config32(PCI_DEV(0,0,0), D0F0_PCIEXBAR_LO) !=
+ (CONFIG_MMCONF_BASE_ADDRESS | 1))
+ die("You must run qemu for machine Q35");
}

static void enable_spi_prefetch(void)

To view, visit change 31425. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9d1b24176de971c5f827091bc5bc1bac8426f3f6
Gerrit-Change-Number: 31425
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro@das-labor.org>
Gerrit-MessageType: newchange