Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/acpi.c | 2 +- src/boot.c | 2 +- src/mptable.c | 3 +-- src/paravirt.c | 48 +++++------------------------------------------- src/paravirt.h | 4 ---- src/smp.c | 3 +-- 6 files changed, 9 insertions(+), 53 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c index 5396ae2..aebf26e 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -372,7 +372,7 @@ build_madt(void) io_apic->interrupt = cpu_to_le32(0);
struct madt_intsrcovr *intsrcovr = (void*)&io_apic[1]; - if (qemu_cfg_irq0_override()) { + if (romfile_loadint("etc/irq0-override", 0)) { memset(intsrcovr, 0, sizeof(*intsrcovr)); intsrcovr->type = APIC_XRUPT_OVERRIDE; intsrcovr->length = sizeof(*intsrcovr); diff --git a/src/boot.c b/src/boot.c index f70e402..ec411b7 100644 --- a/src/boot.c +++ b/src/boot.c @@ -404,7 +404,7 @@ interactive_bootmenu(void) { // XXX - show available drives?
- if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu()) + if (! CONFIG_BOOTMENU || !romfile_loadint("etc/show-boot-menu", 1)) return;
while (get_keystroke(0) >= 0) diff --git a/src/mptable.c b/src/mptable.c index 2d4e441..fc16096 100644 --- a/src/mptable.c +++ b/src/mptable.c @@ -8,7 +8,6 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "mptable.h" // MPTABLE_SIGNATURE -#include "paravirt.h" // qemu_cfg_irq0_override #include "pci.h" #include "pci_regs.h"
@@ -143,7 +142,7 @@ mptable_setup(void) intsrc->srcbusirq = i; intsrc->dstapic = ioapic_id; intsrc->dstirq = i; - if (qemu_cfg_irq0_override()) { + if (romfile_loadint("etc/irq0-override", 0)) { /* Destination 2 is covered by irq0->inti2 override (i == 0). Source IRQ 2 is unused */ if (i == 0) diff --git a/src/paravirt.c b/src/paravirt.c index e782227..79b1c56 100644 --- a/src/paravirt.c +++ b/src/paravirt.c @@ -172,37 +172,6 @@ void qemu_cfg_preinit(void) dprintf(4, "qemu_cfg_present=%d\n", qemu_cfg_present); }
-void qemu_cfg_get_uuid(u8 *uuid) -{ - if (!qemu_cfg_present) - return; - - qemu_cfg_read_entry(uuid, QEMU_CFG_UUID, 16); -} - -int qemu_cfg_show_boot_menu(void) -{ - u16 v; - if (!qemu_cfg_present) - return 1; - - qemu_cfg_read_entry(&v, QEMU_CFG_BOOT_MENU, sizeof(v)); - - return v; -} - -int qemu_cfg_irq0_override(void) -{ - u8 v; - - if (!qemu_cfg_present) - return 0; - - qemu_cfg_read_entry(&v, QEMU_CFG_IRQ0_OVERRIDE, sizeof(v)); - - return v; -} - u32 qemu_cfg_e820_entries(void) { u32 cnt; @@ -237,18 +206,6 @@ void qemu_cfg_get_numa_data(u64 *data, int n) qemu_cfg_read((u8*)(data + i), sizeof(u64)); }
-u16 qemu_cfg_get_max_cpus(void) -{ - u16 cnt; - - if (!qemu_cfg_present) - return 0; - - qemu_cfg_read_entry(&cnt, QEMU_CFG_MAX_CPUS, sizeof(cnt)); - - return cnt; -} - static int qemu_cfg_read_file(struct romfile_s *file, void *dst, u32 maxlen) { @@ -292,6 +249,11 @@ struct qemu_smbios_header { static void qemu_cfg_legacy(void) { + // Misc config items. + qemu_romfile_add("etc/show-boot-menu", QEMU_CFG_BOOT_MENU, 0, 2); + qemu_romfile_add("etc/irq0-override", QEMU_CFG_IRQ0_OVERRIDE, 0, 1); + qemu_romfile_add("etc/max-cpus", QEMU_CFG_MAX_CPUS, 0, 2); + // ACPI tables char name[128]; u16 cnt; diff --git a/src/paravirt.h b/src/paravirt.h index 6b99ca9..e92e236 100644 --- a/src/paravirt.h +++ b/src/paravirt.h @@ -26,12 +26,8 @@ static inline int runningOnKVM(void) { void qemu_ramsize_preinit(void); void qemu_biostable_setup(void); void qemu_cfg_preinit(void); -int qemu_cfg_show_boot_menu(void); -void qemu_cfg_get_uuid(u8 *uuid); -int qemu_cfg_irq0_override(void); int qemu_cfg_get_numa_nodes(void); void qemu_cfg_get_numa_data(u64 *data, int n); -u16 qemu_cfg_get_max_cpus(void); u32 qemu_cfg_e820_entries(void); void* qemu_cfg_e820_load_next(void *addr); void qemu_romfile_init(void); diff --git a/src/smp.c b/src/smp.c index 394dc4b..1590d65 100644 --- a/src/smp.c +++ b/src/smp.c @@ -8,7 +8,6 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "cmos.h" // CMOS_BIOS_SMP_COUNT -#include "paravirt.h"
#define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300) #define APIC_SVR ((u8*)BUILD_APIC_ADDR + 0x0F0) @@ -139,7 +138,7 @@ smp_setup(void) // Restore memory. *(u64*)BUILD_AP_BOOT_ADDR = old;
- MaxCountCPUs = qemu_cfg_get_max_cpus(); + MaxCountCPUs = romfile_loadint("etc/max-cpus", 0); if (!MaxCountCPUs || MaxCountCPUs < CountCPUs) MaxCountCPUs = CountCPUs;