diff options
-rw-r--r-- | cpu-defs.h | 2 | ||||
-rw-r--r-- | hw/cirrus_vga.c | 2 | ||||
-rw-r--r-- | hw/e1000.c | 2 | ||||
-rw-r--r-- | hw/fdc.c | 39 | ||||
-rw-r--r-- | hw/pci-hotplug.c | 6 | ||||
-rw-r--r-- | hw/pci.c | 35 | ||||
-rw-r--r-- | hw/pci.h | 6 | ||||
-rw-r--r-- | hw/rtl8139.c | 2 | ||||
-rw-r--r-- | hw/virtio-pci.c | 2 | ||||
-rw-r--r-- | hw/vmware_vga.c | 2 | ||||
-rw-r--r-- | monitor.c | 2 | ||||
-rw-r--r-- | target-i386/machine.c | 1 |
12 files changed, 55 insertions, 46 deletions
diff --git a/cpu-defs.h b/cpu-defs.h index 0e4ed1616..cf502e992 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -188,7 +188,7 @@ struct KVMCPUState { \ /* Core interrupt code */ \ jmp_buf jmp_env; \ - int32_t exception_index; \ + int exception_index; \ \ CPUState *next_cpu; /* next CPU sharing TB cache */ \ int cpu_index; /* CPU index (informative) */ \ diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 3c7193b1d..224921a8a 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3229,7 +3229,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) } /* ROM BIOS */ - rom_add_vga(VGABIOS_CIRRUS_FILENAME); + pci_add_option_rom((PCIDevice *)d, VGABIOS_CIRRUS_FILENAME); return 0; } diff --git a/hw/e1000.c b/hw/e1000.c index 8566fe327..f7956010f 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1125,7 +1125,7 @@ static int pci_e1000_init(PCIDevice *pci_dev) if (!pci_dev->qdev.hotplugged) { static int loaded = 0; if (!loaded) { - rom_add_option("pxe-e1000.bin"); + pci_add_option_rom(&d->dev, "pxe-e1000.bin"); loaded = 1; } } @@ -661,7 +661,7 @@ static int fdc_post_load(void *opaque, int version_id) } static const VMStateDescription vmstate_fdc = { - .name = "fdctrl", + .name = "fdc", .version_id = 2, .minimum_version_id = 2, .minimum_version_id_old = 2, @@ -699,31 +699,6 @@ static const VMStateDescription vmstate_fdc = { } }; -static const VMStateDescription vmstate_fdc_isa = { - .name = "fdc", - .version_id = 2, - .minimum_version_id = 2, - .minimum_version_id_old = 2, - .fields = (VMStateField []) { - /* Controller State */ - VMSTATE_STRUCT(state, fdctrl_isabus_t, 0, vmstate_fdc, fdctrl_t), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_fdc_sysbus = { - .name = "fdc", - .version_id = 2, - .minimum_version_id = 2, - .minimum_version_id_old = 2, - .fields = (VMStateField []) { - /* Controller State */ - VMSTATE_STRUCT(state, fdctrl_sysbus_t, 0, vmstate_fdc, fdctrl_t), - VMSTATE_END_OF_LIST() - } -}; - - static void fdctrl_external_reset_sysbus(DeviceState *d) { fdctrl_sysbus_t *sys = container_of(d, fdctrl_sysbus_t, busdev.qdev); @@ -1926,7 +1901,7 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base, return fdctrl; } -static int fdctrl_init_common(fdctrl_t *fdctrl) +static int fdctrl_init_common(fdctrl_t *fdctrl, target_phys_addr_t io_base) { int i, j; static int command_tables_inited = 0; @@ -1957,6 +1932,7 @@ static int fdctrl_init_common(fdctrl_t *fdctrl) DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl); fdctrl_connect_drives(fdctrl); + vmstate_register(io_base, &vmstate_fdc, fdctrl); return 0; } @@ -1980,7 +1956,7 @@ static int isabus_fdc_init1(ISADevice *dev) isa_init_irq(&isa->busdev, &fdctrl->irq, isairq); fdctrl->dma_chann = dma_chann; - ret = fdctrl_init_common(fdctrl); + ret = fdctrl_init_common(fdctrl, iobase); return ret; } @@ -1998,7 +1974,7 @@ static int sysbus_fdc_init1(SysBusDevice *dev) qdev_init_gpio_in(&dev->qdev, fdctrl_handle_tc, 1); fdctrl->dma_chann = -1; - ret = fdctrl_init_common(fdctrl); + ret = fdctrl_init_common(fdctrl, io); return ret; } @@ -2015,7 +1991,7 @@ static int sun4m_fdc_init1(SysBusDevice *dev) qdev_init_gpio_in(&dev->qdev, fdctrl_handle_tc, 1); fdctrl->sun4m = 1; - return fdctrl_init_common(fdctrl); + return fdctrl_init_common(fdctrl, io); } static ISADeviceInfo isa_fdc_info = { @@ -2023,7 +1999,6 @@ static ISADeviceInfo isa_fdc_info = { .qdev.name = "isa-fdc", .qdev.size = sizeof(fdctrl_isabus_t), .qdev.no_user = 1, - .qdev.vmsd = &vmstate_fdc_isa, .qdev.reset = fdctrl_external_reset_isa, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("driveA", fdctrl_isabus_t, state.drives[0].dinfo), @@ -2036,7 +2011,6 @@ static SysBusDeviceInfo sysbus_fdc_info = { .init = sysbus_fdc_init1, .qdev.name = "sysbus-fdc", .qdev.size = sizeof(fdctrl_sysbus_t), - .qdev.vmsd = &vmstate_fdc_sysbus, .qdev.reset = fdctrl_external_reset_sysbus, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("driveA", fdctrl_sysbus_t, state.drives[0].dinfo), @@ -2049,7 +2023,6 @@ static SysBusDeviceInfo sun4m_fdc_info = { .init = sun4m_fdc_init1, .qdev.name = "SUNW,fdtwo", .qdev.size = sizeof(fdctrl_sysbus_t), - .qdev.vmsd = &vmstate_fdc_sysbus, .qdev.reset = fdctrl_external_reset_sysbus, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("drive", fdctrl_sysbus_t, state.drives[0].dinfo), diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index ed55d5f69..41ce0041b 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -200,14 +200,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, switch (type) { case IF_SCSI: - if (!dinfo) { - monitor_printf(mon, "scsi requires a backing file/device.\n"); - return NULL; - } dev = pci_create(bus, devfn, "lsi53c895a"); if (qdev_init(&dev->qdev) < 0) dev = NULL; - if (dev) { + if (dev && dinfo) { if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) { qdev_unplug(&dev->qdev); dev = NULL; @@ -26,6 +26,7 @@ #include "monitor.h" #include "net.h" #include "sysemu.h" +#include "loader.h" #include "qemu-kvm.h" #include "hw/pc.h" #include "device-assignment.h" @@ -1586,6 +1587,40 @@ static uint8_t pci_find_capability_list(PCIDevice *pdev, uint8_t cap_id, return next; } +static void pci_map_option_rom(PCIDevice *pdev, int region_num, pcibus_t addr, pcibus_t size, int type) +{ + cpu_register_physical_memory(addr, size, pdev->rom_offset); +} + +/* Add an option rom for the device */ +int pci_add_option_rom(PCIDevice *pdev, const char *name) +{ + int size; + char *path; + void *ptr; + + path = qemu_find_file(QEMU_FILE_TYPE_BIOS, name); + if (path == NULL) { + path = qemu_strdup(name); + } + + size = get_image_size(path); + if (size & (size - 1)) { + size = 1 << qemu_fls(size); + } + + pdev->rom_offset = qemu_ram_alloc(size); + + ptr = qemu_get_ram_ptr(pdev->rom_offset); + load_image(path, ptr); + qemu_free(path); + + pci_register_bar(pdev, PCI_ROM_SLOT, size, + 0, pci_map_option_rom); + + return 0; +} + /* Reserve space and add capability to the linked list in pci config space */ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size) { @@ -267,6 +267,10 @@ struct PCIDevice { uint32_t msix_bar_size; /* Version id needed for VMState */ int32_t version_id; + + /* Location of option rom */ + ram_addr_t rom_offset; + /* How much space does an MSIX table need. */ /* The spec requires giving the table structure * a 4K aligned region all by itself. Align it to @@ -294,6 +298,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, pcibus_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_option_rom(PCIDevice *pdev, const char *name); + int pci_enable_capability_support(PCIDevice *pci_dev, uint32_t config_start, PCICapConfigReadFunc *config_read, diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 9fd05a8a1..2cee97bb7 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3357,7 +3357,7 @@ static int pci_rtl8139_init(PCIDevice *dev) if (!dev->qdev.hotplugged) { static int loaded = 0; if (!loaded) { - rom_add_option("pxe-rtl8139.bin"); + pci_add_option_rom(&s->dev, "pxe-rtl8139.bin"); loaded = 1; } } diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 450013091..85f14a2c2 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -522,7 +522,7 @@ static int virtio_net_init_pci(PCIDevice *pci_dev) if (!pci_dev->qdev.hotplugged) { static int loaded = 0; if (!loaded) { - rom_add_option("pxe-virtio.bin"); + pci_add_option_rom(pci_dev, "pxe-virtio.bin"); loaded = 1; } } diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index e3d570613..7ab1c7910 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -467,7 +467,7 @@ struct vmsvga_cursor_definition_s { int hot_x; int hot_y; uint32_t mask[1024]; - uint32_t image[1024]; + uint32_t image[4096]; }; #define SVGA_BITMAP_SIZE(w, h) ((((w) + 31) >> 5) * (h)) @@ -3897,7 +3897,7 @@ static int monitor_can_read(void *opaque) { Monitor *mon = opaque; - return (mon->suspend_cnt == 0) ? 128 : 0; + return (mon->suspend_cnt == 0) ? 1 : 0; } typedef struct CmdArgs { diff --git a/target-i386/machine.c b/target-i386/machine.c index b9d51f414..47ca6e856 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -466,7 +466,6 @@ static const VMStateDescription vmstate_cpu = { VMSTATE_UINT8_V(nmi_pending, CPUState, 11), VMSTATE_UINT8_V(has_error_code, CPUState, 11), VMSTATE_UINT32_V(sipi_vector, CPUState, 11), - VMSTATE_INT32_V(exception_index, CPUState, 11), /* MCE */ VMSTATE_UINT64_V(mcg_cap, CPUState, 10), VMSTATE_UINT64_V(mcg_status, CPUState, 10), |