aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Lopez <slp@redhat.com>2019-07-24 12:51:26 +0200
committerPaolo Bonzini <bonzini@gnu.org>2019-07-24 16:55:26 +0200
commit947bade3443facfb07f20ca10b4436bc9eb4ef27 (patch)
tree1479749ffff629b1ac1b8dd0b49e73cda835ed6d
parentf8d4dd25732f518001bfbec1fae01902edabcb4b (diff)
downloadqboot-947bade3443facfb07f20ca10b4436bc9eb4ef27.zip
qboot-947bade3443facfb07f20ca10b4436bc9eb4ef27.tar.gz
qboot-947bade3443facfb07f20ca10b4436bc9eb4ef27.tar.bz2
support machines without PCI
Instead of panicing when a PCI bus isn't found, continue booting without PCI nor ACPI initialization. Signed-off-by: Sergio Lopez <slp@redhat.com>
-rw-r--r--hwsetup.c9
-rw-r--r--include/bios.h2
-rw-r--r--main.c7
3 files changed, 12 insertions, 6 deletions
diff --git a/hwsetup.c b/hwsetup.c
index 6eae3fa..250213e 100644
--- a/hwsetup.c
+++ b/hwsetup.c
@@ -94,7 +94,7 @@ void setup_pam(int bdf, int pambase)
pci_config_writeb(bdf, pambase, 0x30);
}
-void setup_hw(void)
+bool setup_hw(void)
{
const int bdf = 0;
const uint8_t *bios_start = (void *)((uintptr_t)&stext + 0xfff00000);
@@ -112,8 +112,9 @@ void setup_hw(void)
setup_ich9();
setup_ich9_pm();
pambase = Q35_HOST_BRIDGE_PAM0;
- } else
- panic();
+ } else {
+ return false;
+ }
// Make ram from 0xc0000-0xf0000 read-write
rom_check_value = rom_check;
@@ -126,6 +127,8 @@ void setup_hw(void)
memcpy(&sinit, init_start, &einit - &sinit);
setup_pic();
+
+ return true;
}
#define Q35_HOST_BRIDGE_PCIEXBAREN 1
diff --git a/include/bios.h b/include/bios.h
index 3e4cdee..1469cb6 100644
--- a/include/bios.h
+++ b/include/bios.h
@@ -64,7 +64,7 @@ extern void bios32_entry(void);
extern uint32_t pic_base(void);
extern void setup_pci(void);
-extern void setup_hw(void);
+extern bool setup_hw(void);
extern bool setup_mmconfig(void);
extern void extract_acpi(void);
extern void boot_from_fwcfg(void);
diff --git a/main.c b/main.c
index f66693b..b20a7de 100644
--- a/main.c
+++ b/main.c
@@ -79,10 +79,11 @@ static void extract_e820(void)
int __attribute__ ((section (".text.startup"))) main(void)
{
+ bool have_pci;
#ifdef BENCHMARK_HACK
outb(FW_EXIT_PORT, FW_START);
#endif
- setup_hw();
+ have_pci = setup_hw();
// Only the 16-bit trampoline for vmlinuz and the 16-bit interrupt
// handlers need to run from the F-segment, but keep things simple
@@ -90,7 +91,9 @@ int __attribute__ ((section (".text.startup"))) main(void)
asm("ljmp $0x8, $1f; 1:");
have_mmconfig = setup_mmconfig();
- setup_pci();
+ if (have_pci) {
+ setup_pci();
+ }
setup_idt();
fw_cfg_setup();
extract_acpi();