#include "disk.h" // MAXDESCSIZE
#include "config.h" // CONFIG_*
#include "acpi.h" // find_pmtimer
+#include "pci.h" // pci_probe_devices
+
/****************************************************************
* Memory map
void
coreboot_preinit(void)
{
+ if (!CONFIG_COREBOOT)
+ return;
+
dprintf(3, "Attempting to find coreboot table\n");
// Find coreboot table.
}
void
-coreboot_biostable_setup(void)
+coreboot_platform_setup(void)
{
+ if (!CONFIG_COREBOOT)
+ return;
+ pci_probe_devices();
+
struct cb_memory *cbm = CBMemTable;
- if (! CONFIG_COREBOOT || !cbm)
+ if (!cbm)
return;
dprintf(3, "Relocating coreboot bios tables\n");
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
-#include "paravirt.h" // runningOnXen
#include "pci.h" // pcimem_start
#define MSR_MTRRcap 0x000000fe
void mtrr_setup(void)
{
- if (!CONFIG_MTRR_INIT || runningOnXen())
+ if (!CONFIG_MTRR_INIT)
return;
u32 eax, ebx, ecx, edx, cpuid_features;
#include "acpi.h" // acpi_setup
#include "mptable.h" // mptable_setup
#include "pci.h" // create_pirtable
+#include "xen.h" // xen_biostable_setup
/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
* should be used to determine that a VM is running under KVM.
}
void
-qemu_ramsize_preinit(void)
+qemu_preinit(void)
{
if (!CONFIG_QEMU)
return;
+ if (runningOnXen()) {
+ xen_ramsize_preinit();
+ return;
+ }
+
PlatformRunningOn = PF_QEMU;
kvm_preinit();
}
void
-qemu_biostable_setup(void)
+qemu_platform_setup(void)
{
+ if (!CONFIG_QEMU)
+ return;
+
+ if (runningOnXen()) {
+ pci_probe_devices();
+ xen_hypercall_setup();
+ xen_biostable_setup();
+ return;
+ }
+
+ // Initialize pci
+ pci_setup();
+ smm_setup();
+
+ // Initialize mtrr and smp
+ mtrr_setup();
+ smp_setup();
+
+ // Create bios tables
pirtable_setup();
mptable_setup();
smbios_setup();
return CONFIG_QEMU && GET_GLOBAL(PlatformRunningOn) & PF_KVM;
}
-void qemu_ramsize_preinit(void);
-void qemu_biostable_setup(void);
+void qemu_preinit(void);
+void qemu_platform_setup(void);
void qemu_cfg_init(void);
#endif
#include "pci_regs.h" // PCI_COMMAND
#include "ioport.h" // PORT_ATA1_CMD_BASE
#include "config.h" // CONFIG_*
-#include "paravirt.h" // runningOnXen
#include "memmap.h" // add_e820
#include "dev-q35.h"
void
pci_setup(void)
{
- if (!CONFIG_QEMU || runningOnXen()) {
- // PCI setup already done by coreboot or Xen - just do probe.
- pci_probe_devices();
+ if (!CONFIG_QEMU)
return;
- }
dprintf(3, "pci setup\n");
mathcp_setup();
timer_setup();
- // Initialize pci
- pci_setup();
- smm_setup();
-
- // Initialize mtrr and smp
- mtrr_setup();
- smp_setup();
-
- // Setup Xen hypercalls
- xen_hypercall_setup();
-
- // Setup external BIOS interface tables
- if (CONFIG_COREBOOT)
- coreboot_biostable_setup();
- else if (runningOnXen())
- xen_biostable_setup();
- else
- qemu_biostable_setup();
+ // Platform specific setup
+ qemu_platform_setup();
+ coreboot_platform_setup();
}
void
dopost(void)
{
// Detect ram and setup internal malloc.
- if (CONFIG_COREBOOT)
- coreboot_preinit();
- else if (runningOnXen())
- xen_ramsize_preinit();
- else
- qemu_ramsize_preinit();
+ qemu_preinit();
+ coreboot_preinit();
malloc_preinit();
// Relocate initialization code and call maininit().
#include "config.h" // CONFIG_*
#include "ioport.h" // outb
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
-#include "paravirt.h" // runningOnXen
#include "dev-q35.h"
ASM32FLAT(
void
smm_setup(void)
{
- if (!CONFIG_USE_SMM || runningOnXen())
+ if (!CONFIG_USE_SMM)
return;
dprintf(3, "init smm\n");
extern const char *CBvendor, *CBpart;
struct cbfs_file;
void cbfs_run_payload(struct cbfs_file *file);
-void coreboot_biostable_setup(void);
+void coreboot_platform_setup(void);
void cbfs_payload_setup(void);
void coreboot_preinit(void);
void coreboot_cbfs_init(void);