These are needed by microvm too, so move them outside of PC-specific files.
With this patch, microvm.c need not include pc.h anymore.
Signed-off-by: Paolo Bonzini
---
hw/i386/acpi-build.c | 1 +
hw/i386/fw_cfg.c | 1 -
hw/i386/fw_cfg.h | 2 +
hw/i386/kvm/ioapic.c | 2 +-
hw/i386/microvm.c | 3 +-
hw/i386/pc.c | 101 +-
hw/i386/x86.c | 100 +
include/hw/i386/pc.h | 20 --
include/hw/i386/x86.h | 18 +
target/i386/kvm.c | 2 +-
target/i386/machine.c | 2 +-
11 files changed, 126 insertions(+), 126 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 12ff55f..7b8da62 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -53,6 +53,7 @@
/* Supported chipsets: */
#include "hw/southbridge/piix.h"
#include "hw/acpi/pcihp.h"
+#include "hw/i386/fw_cfg.h"
#include "hw/i386/ich9.h"
#include "hw/pci/pci_bus.h"
#include "hw/pci-host/q35.h"
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 326e33e..da60ada 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -16,7 +16,6 @@
#include "sysemu/numa.h"
#include "hw/acpi/acpi.h"
#include "hw/firmware/smbios.h"
-#include "hw/i386/pc.h"
#include "hw/i386/fw_cfg.h"
#include "hw/timer/hpet.h"
#include "hw/nvram/fw_cfg.h"
diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h
index e0856a3..9e74278 100644
--- a/hw/i386/fw_cfg.h
+++ b/hw/i386/fw_cfg.h
@@ -12,6 +12,8 @@
#include "hw/boards.h"
#include "hw/nvram/fw_cfg.h"
+#define FW_CFG_IO_BASE 0x510
+
#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
#define FW_CFG_IRQ0_OVERRIDE(FW_CFG_ARCH_LOCAL + 2)
diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c
index f94729c..8703f19 100644
--- a/hw/i386/kvm/ioapic.c
+++ b/hw/i386/kvm/ioapic.c
@@ -12,7 +12,7 @@
#include "qemu/osdep.h"
#include "monitor/monitor.h"
-#include "hw/i386/pc.h"
+#include "hw/i386/x86.h"
#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "hw/i386/ioapic_internal.h"
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 2068319..827ce29 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -32,7 +32,6 @@
#include "hw/kvm/clock.h"
#include "hw/i386/microvm.h"
#include "hw/i386/x86.h"
-#include "hw/i386/pc.h"
#include "target/i386/cpu.h"
#include "hw/intc/i8259.h"
#include "hw/timer/i8254.h"
@@ -133,7 +132,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
qemu_irq *i8259;
-i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
+i8259 = i8259_init(isa_bus, x86_allocate_cpu_irq());
for (i = 0; i < ISA_NUM_IRQS; i++) {
gsi_state->i8259_irq[i] = i8259[i];
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6a3212e..545b855 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -343,17 +343,6 @@ GlobalProperty pc_compat_1_4[] = {
};
const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4);
-void gsi_handler(void *opaque, int n, int level)
-{
-GSIState *s = opaque;
-
-DPRINTF("pc: %s GSI %d\n", level ? "raising" : "lowering", n);
-if (n < ISA_NUM_IRQS) {
-qemu_set_irq(s->i8259_irq[n], level);
-}
-qemu_set_irq(s->ioapic_irq[n], level);
-}
-
GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
{
GSIState *s;
@@ -393,55 +382,6 @@ static uint64_t ioportF0_read(void *opaque, hwaddr addr,
unsigned size)
return 0xULL;
}
-/* TSC handling */
-uint64_t cpu_get_tsc(CPUX86State *env)
-{
-return cpu_get_ticks();
-}
-
-/* IRQ handling */
-int cpu_get_pic_interrupt(CPUX86State *env)
-{
-X86CPU *cpu = env_archcpu(env);
-int intno;
-
-if (!kvm_irqchip_in_kernel()) {
-intno = apic_get_interrupt(cpu->apic_state);
-if (intno >= 0) {
-return intno;
-}
-/* read the irq from the PIC */
-if (!apic_accept_pic_intr(cpu->apic_state)) {
-return -1;
-}
-}
-
-intno = pic_read_irq(isa_pic);
-return intno;
-}
-
-static void pic_irq_request(void *opaque, int irq, int level)
-{
-CPUState *cs = first_cpu;
-X86CPU *cpu = X86_CPU(cs);
-
-DPRINTF("pic_irqs: %s irq %d\n", level? "raise" : "lower", irq);
-if (cpu->apic_state && !kvm_irqchip_in_kernel()) {
-CPU_FOREACH(cs) {
-cpu = X86_CPU(cs);
-if (apic_accept_pic_intr(cpu->apic_state)) {
-apic_deliver_pic_intr(cpu->apic_state, level);
-}
-}
-} else {
-if (level) {
-cpu_interrupt(cs, CPU_INTERRUPT_HARD);
-} else {
-cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
-}
-}
-}
-
/* PC cmos mappings */
#define REG_EQUIPMENT_BYTE 0x14
@@ -885,16 +825,6 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)