diff options
-rw-r--r-- | hw/acpi/piix4.c | 2 | ||||
-rw-r--r-- | hw/core/loader.c | 2 | ||||
-rw-r--r-- | hw/i386/multiboot.c | 2 | ||||
-rw-r--r-- | hw/i386/multiboot.h | 4 | ||||
-rw-r--r-- | hw/i386/pc.c | 24 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 2 | ||||
-rw-r--r-- | hw/intc/apic.c | 42 | ||||
-rw-r--r-- | hw/misc/pvpanic.c | 4 | ||||
-rw-r--r-- | hw/nvram/fw_cfg.c | 18 | ||||
-rw-r--r-- | hw/nvram/mac_nvram.c | 2 | ||||
-rw-r--r-- | hw/pci-bridge/Makefile.objs | 2 | ||||
-rw-r--r-- | hw/pci-bridge/dec.c (renamed from hw/pci-host/dec.c) | 0 | ||||
-rw-r--r-- | hw/pci-bridge/dec.h (renamed from hw/pci-host/dec.h) | 0 | ||||
-rw-r--r-- | hw/pci-host/Makefile.objs | 1 | ||||
-rw-r--r-- | hw/pci-host/q35.c | 1 | ||||
-rw-r--r-- | hw/sparc/sun4m.c | 4 | ||||
-rw-r--r-- | hw/sparc64/sun4u.c | 4 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 18 | ||||
-rw-r--r-- | include/hw/loader.h | 3 | ||||
-rw-r--r-- | include/hw/nvram/fw_cfg.h | 4 | ||||
-rw-r--r-- | include/hw/nvram/openbios_firmware_abi.h (renamed from include/hw/sparc/firmware_abi.h) | 0 | ||||
-rw-r--r-- | include/qemu/typedefs.h | 1 |
22 files changed, 78 insertions, 62 deletions
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index c4af1cc..e6525ac 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -447,7 +447,7 @@ static int piix4_pm_initfn(PCIDevice *dev) i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, - int kvm_enabled, void *fw_cfg) + int kvm_enabled, FWCfgState *fw_cfg) { PCIDevice *dev; PIIX4PMState *s; diff --git a/hw/core/loader.c b/hw/core/loader.c index 7507914..a711145 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -733,7 +733,7 @@ int rom_load_all(void) return 0; } -void rom_set_fw(void *f) +void rom_set_fw(FWCfgState *f) { fw_cfg = f; } diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index d696507..09211e0 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s, s->mb_mods_count++; } -int load_multiboot(void *fw_cfg, +int load_multiboot(FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename, diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h index 98fb1b7..60de309 100644 --- a/hw/i386/multiboot.h +++ b/hw/i386/multiboot.h @@ -1,7 +1,9 @@ #ifndef QEMU_MULTIBOOT_H #define QEMU_MULTIBOOT_H -int load_multiboot(void *fw_cfg, +#include "hw/nvram/fw_cfg.h" + +int load_multiboot(FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 197d218..4844a6b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -595,9 +595,9 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus) return x86_cpu_apic_id_from_index(max_cpus - 1) + 1; } -static void *bochs_bios_init(void) +static FWCfgState *bochs_bios_init(void) { - void *fw_cfg; + FWCfgState *fw_cfg; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; @@ -674,7 +674,7 @@ static long get_file_size(FILE *f) return size; } -static void load_linux(void *fw_cfg, +static void load_linux(FWCfgState *fw_cfg, const char *kernel_filename, const char *initrd_filename, const char *kernel_cmdline, @@ -1012,19 +1012,19 @@ void pc_acpi_init(const char *default_dsdt) } } -void *pc_memory_init(MemoryRegion *system_memory, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, - ram_addr_t below_4g_mem_size, - ram_addr_t above_4g_mem_size, - MemoryRegion *rom_memory, - MemoryRegion **ram_memory) +FWCfgState *pc_memory_init(MemoryRegion *system_memory, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + ram_addr_t below_4g_mem_size, + ram_addr_t above_4g_mem_size, + MemoryRegion *rom_memory, + MemoryRegion **ram_memory) { int linux_boot, i; MemoryRegion *ram, *option_rom_mr; MemoryRegion *ram_below_4g, *ram_above_4g; - void *fw_cfg; + FWCfgState *fw_cfg; linux_boot = (kernel_filename != NULL); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 530b6ab..d547548 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -89,7 +89,7 @@ static void pc_init1(MemoryRegion *system_memory, MemoryRegion *pci_memory; MemoryRegion *rom_memory; DeviceState *icc_bridge; - void *fw_cfg = NULL; + FWCfgState *fw_cfg = NULL; icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 756dff0..46cb097 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -40,18 +40,18 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask, uint8_t dest, uint8_t dest_mode); /* Find first bit starting from msb */ -static int fls_bit(uint32_t value) +static int apic_fls_bit(uint32_t value) { return 31 - clz32(value); } /* Find first bit starting from lsb */ -static int ffs_bit(uint32_t value) +static int apic_ffs_bit(uint32_t value) { return ctz32(value); } -static inline void set_bit(uint32_t *tab, int index) +static inline void apic_set_bit(uint32_t *tab, int index) { int i, mask; i = index >> 5; @@ -59,7 +59,7 @@ static inline void set_bit(uint32_t *tab, int index) tab[i] |= mask; } -static inline void reset_bit(uint32_t *tab, int index) +static inline void apic_reset_bit(uint32_t *tab, int index) { int i, mask; i = index >> 5; @@ -67,7 +67,7 @@ static inline void reset_bit(uint32_t *tab, int index) tab[i] &= ~mask; } -static inline int get_bit(uint32_t *tab, int index) +static inline int apic_get_bit(uint32_t *tab, int index) { int i, mask; i = index >> 5; @@ -81,7 +81,7 @@ static int get_highest_priority_int(uint32_t *tab) int i; for (i = 7; i >= 0; i--) { if (tab[i] != 0) { - return i * 32 + fls_bit(tab[i]); + return i * 32 + apic_fls_bit(tab[i]); } } return -1; @@ -184,7 +184,7 @@ void apic_deliver_pic_intr(DeviceState *d, int level) case APIC_DM_FIXED: if (!(lvt & APIC_LVT_LEVEL_TRIGGER)) break; - reset_bit(s->irr, lvt & 0xff); + apic_reset_bit(s->irr, lvt & 0xff); /* fall through */ case APIC_DM_EXTINT: cpu_reset_interrupt(CPU(s->cpu), CPU_INTERRUPT_HARD); @@ -230,7 +230,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask, d = -1; for(i = 0; i < MAX_APIC_WORDS; i++) { if (deliver_bitmask[i]) { - d = i * 32 + ffs_bit(deliver_bitmask[i]); + d = i * 32 + apic_ffs_bit(deliver_bitmask[i]); break; } } @@ -386,13 +386,13 @@ void apic_poll_irq(DeviceState *d) static void apic_set_irq(APICCommonState *s, int vector_num, int trigger_mode) { - apic_report_irq_delivered(!get_bit(s->irr, vector_num)); + apic_report_irq_delivered(!apic_get_bit(s->irr, vector_num)); - set_bit(s->irr, vector_num); + apic_set_bit(s->irr, vector_num); if (trigger_mode) - set_bit(s->tmr, vector_num); + apic_set_bit(s->tmr, vector_num); else - reset_bit(s->tmr, vector_num); + apic_reset_bit(s->tmr, vector_num); if (s->vapic_paddr) { apic_sync_vapic(s, SYNC_ISR_IRR_TO_VAPIC); /* @@ -412,8 +412,8 @@ static void apic_eoi(APICCommonState *s) isrv = get_highest_priority_int(s->isr); if (isrv < 0) return; - reset_bit(s->isr, isrv); - if (!(s->spurious_vec & APIC_SV_DIRECTED_IO) && get_bit(s->tmr, isrv)) { + apic_reset_bit(s->isr, isrv); + if (!(s->spurious_vec & APIC_SV_DIRECTED_IO) && apic_get_bit(s->tmr, isrv)) { ioapic_eoi_broadcast(isrv); } apic_sync_vapic(s, SYNC_FROM_VAPIC | SYNC_TO_VAPIC); @@ -452,7 +452,7 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask, int idx = apic_find_dest(dest); memset(deliver_bitmask, 0x00, MAX_APIC_WORDS * sizeof(uint32_t)); if (idx >= 0) - set_bit(deliver_bitmask, idx); + apic_set_bit(deliver_bitmask, idx); } } else { /* XXX: cluster mode */ @@ -462,11 +462,11 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask, if (apic_iter) { if (apic_iter->dest_mode == 0xf) { if (dest & apic_iter->log_dest) - set_bit(deliver_bitmask, i); + apic_set_bit(deliver_bitmask, i); } else if (apic_iter->dest_mode == 0x0) { if ((dest & 0xf0) == (apic_iter->log_dest & 0xf0) && (dest & apic_iter->log_dest & 0x0f)) { - set_bit(deliver_bitmask, i); + apic_set_bit(deliver_bitmask, i); } } } else { @@ -509,14 +509,14 @@ static void apic_deliver(DeviceState *d, uint8_t dest, uint8_t dest_mode, break; case 1: memset(deliver_bitmask, 0x00, sizeof(deliver_bitmask)); - set_bit(deliver_bitmask, s->idx); + apic_set_bit(deliver_bitmask, s->idx); break; case 2: memset(deliver_bitmask, 0xff, sizeof(deliver_bitmask)); break; case 3: memset(deliver_bitmask, 0xff, sizeof(deliver_bitmask)); - reset_bit(deliver_bitmask, s->idx); + apic_reset_bit(deliver_bitmask, s->idx); break; } @@ -573,8 +573,8 @@ int apic_get_interrupt(DeviceState *d) apic_sync_vapic(s, SYNC_TO_VAPIC); return s->spurious_vec & 0xff; } - reset_bit(s->irr, intno); - set_bit(s->isr, intno); + apic_reset_bit(s->irr, intno); + apic_set_bit(s->isr, intno); apic_sync_vapic(s, SYNC_TO_VAPIC); /* re-inject if there is still a pending PIC interrupt */ diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 31e1b1d..910e44f 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -90,13 +90,13 @@ static int pvpanic_isa_initfn(ISADevice *dev) { PVPanicState *s = ISA_PVPANIC_DEVICE(dev); static bool port_configured; - void *fw_cfg; + FWCfgState *fw_cfg; memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1); isa_register_ioport(dev, &s->io, s->ioport); if (!port_configured) { - fw_cfg = object_resolve_path("/machine/fw_cfg", NULL); + fw_cfg = fw_cfg_find(); if (fw_cfg) { fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", g_memdup(&s->ioport, sizeof(s->ioport)), diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 479113b..3c255ce 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -32,6 +32,9 @@ #define FW_CFG_SIZE 2 #define FW_CFG_DATA_SIZE 1 +#define TYPE_FW_CFG "fw_cfg" +#define FW_CFG_NAME "fw_cfg" +#define FW_CFG_PATH "/machine/" FW_CFG_NAME typedef struct FWCfgEntry { uint32_t len; @@ -493,10 +496,9 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, s = DO_UPCAST(FWCfgState, busdev.qdev, dev); - if (!object_resolve_path("/machine/fw_cfg", NULL)) { - object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s), - NULL); - } + assert(!object_resolve_path(FW_CFG_PATH, NULL)); + + object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL); qdev_init_nofail(dev); @@ -553,6 +555,12 @@ static Property fw_cfg_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +FWCfgState *fw_cfg_find(void) +{ + return OBJECT_CHECK(FWCfgState, object_resolve_path(FW_CFG_PATH, NULL), + TYPE_FW_CFG); +} + static void fw_cfg_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -566,7 +574,7 @@ static void fw_cfg_class_init(ObjectClass *klass, void *data) } static const TypeInfo fw_cfg_info = { - .name = "fw_cfg", + .name = TYPE_FW_CFG, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(FWCfgState), .class_init = fw_cfg_class_init, diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index 5223330..d76a06c 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -23,7 +23,7 @@ * THE SOFTWARE. */ #include "hw/hw.h" -#include "hw/sparc/firmware_abi.h" +#include "hw/nvram/openbios_firmware_abi.h" #include "sysemu/sysemu.h" #include "hw/ppc/mac.h" diff --git a/hw/pci-bridge/Makefile.objs b/hw/pci-bridge/Makefile.objs index 5dd92d2..968b369 100644 --- a/hw/pci-bridge/Makefile.objs +++ b/hw/pci-bridge/Makefile.objs @@ -1,3 +1,5 @@ common-obj-y += pci_bridge_dev.o common-obj-y += ioh3420.o xio3130_upstream.o xio3130_downstream.o common-obj-y += i82801b11.o +# NewWorld PowerMac +common-obj-$(CONFIG_DEC_PCI) += dec.o diff --git a/hw/pci-host/dec.c b/hw/pci-bridge/dec.c index cff458b..cff458b 100644 --- a/hw/pci-host/dec.c +++ b/hw/pci-bridge/dec.c diff --git a/hw/pci-host/dec.h b/hw/pci-bridge/dec.h index 17dc0c2..17dc0c2 100644 --- a/hw/pci-host/dec.h +++ b/hw/pci-bridge/dec.h diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index 909e702..bb65f9c 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -5,7 +5,6 @@ common-obj-$(CONFIG_PREP_PCI) += prep.o common-obj-$(CONFIG_GRACKLE_PCI) += grackle.o # NewWorld PowerMac common-obj-$(CONFIG_UNIN_PCI) += uninorth.o -common-obj-$(CONFIG_DEC_PCI) += dec.o # PowerPC E500 boards common-obj-$(CONFIG_PPCE500_PCI) += ppce500.o diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 8467f86..24df6b5 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -76,6 +76,7 @@ static void q35_host_class_init(ObjectClass *klass, void *data) k->init = q35_host_init; dc->props = mch_props; + dc->fw_name = "pci"; } static void q35_host_initfn(Object *obj) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 8840881..0e86ca7 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -30,7 +30,7 @@ #include "sysemu/sysemu.h" #include "net/net.h" #include "hw/boards.h" -#include "hw/sparc/firmware_abi.h" +#include "hw/nvram/openbios_firmware_abi.h" #include "hw/scsi/esp.h" #include "hw/i386/pc.h" #include "hw/isa/isa.h" @@ -831,7 +831,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size, qemu_irq *cpu_halt; unsigned long kernel_size; DriveInfo *fd[MAX_FD]; - void *fw_cfg; + FWCfgState *fw_cfg; unsigned int num_vsimms; /* init CPUs */ diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 5c2bbd4..2c2a111 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -32,7 +32,7 @@ #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "hw/sparc/firmware_abi.h" +#include "hw/nvram/openbios_firmware_abi.h" #include "hw/nvram/fw_cfg.h" #include "hw/sysbus.h" #include "hw/ide.h" @@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qemu_irq *ivec_irqs, *pbm_irqs; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; - void *fw_cfg; + FWCfgState *fw_cfg; /* init CPUs */ cpu = cpu_devinit(cpu_model, hwdef); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 663426c..b4c8a74 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -80,14 +80,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level); void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge); void pc_hot_add_cpu(const int64_t id, Error **errp); void pc_acpi_init(const char *default_dsdt); -void *pc_memory_init(MemoryRegion *system_memory, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, - ram_addr_t below_4g_mem_size, - ram_addr_t above_4g_mem_size, - MemoryRegion *rom_memory, - MemoryRegion **ram_memory); +FWCfgState *pc_memory_init(MemoryRegion *system_memory, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + ram_addr_t below_4g_mem_size, + ram_addr_t above_4g_mem_size, + MemoryRegion *rom_memory, + MemoryRegion **ram_memory); qemu_irq *pc_allocate_cpu_irq(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, @@ -111,7 +111,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, - int kvm_enabled, void *fw_cfg); + int kvm_enabled, FWCfgState *fw_cfg); void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr); /* hpet.c */ diff --git a/include/hw/loader.h b/include/hw/loader.h index 0958f06..15d4cc9 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -1,6 +1,7 @@ #ifndef LOADER_H #define LOADER_H #include "qapi/qmp/qdict.h" +#include "hw/nvram/fw_cfg.h" /* loader.c */ int get_image_size(const char *filename); @@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len, int rom_add_elf_program(const char *name, void *data, size_t datasize, size_t romsize, hwaddr addr); int rom_load_all(void); -void rom_set_fw(void *f); +void rom_set_fw(FWCfgState *f); int rom_copy(uint8_t *dest, hwaddr addr, size_t size); void *rom_ptr(hwaddr addr); void do_info_roms(Monitor *mon, const QDict *qdict); diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 3e4a334..f60dd67 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -6,6 +6,7 @@ #include <stddef.h> #include "exec/hwaddr.h" +#include "qemu/typedefs.h" #endif #define FW_CFG_SIGNATURE 0x00 @@ -60,7 +61,6 @@ typedef struct FWCfgFiles { typedef void (*FWCfgCallback)(void *opaque, uint8_t *data); -typedef struct FWCfgState FWCfgState; void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len); void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value); void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value); @@ -73,6 +73,8 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data, FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, hwaddr crl_addr, hwaddr data_addr); +FWCfgState *fw_cfg_find(void); + #endif /* NO_QEMU_PROTOS */ #endif diff --git a/include/hw/sparc/firmware_abi.h b/include/hw/nvram/openbios_firmware_abi.h index 5e6e5d4..5e6e5d4 100644 --- a/include/hw/sparc/firmware_abi.h +++ b/include/hw/nvram/openbios_firmware_abi.h diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 93aae81..afe4ec7 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -61,5 +61,6 @@ typedef struct EventNotifier EventNotifier; typedef struct VirtIODevice VirtIODevice; typedef struct QEMUSGList QEMUSGList; typedef struct SHPCDevice SHPCDevice; +typedef struct FWCfgState FWCfgState; #endif /* QEMU_TYPEDEFS_H */ |