aboutsummaryrefslogtreecommitdiff
path: root/hw/grackle_pci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-14 10:36:05 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:43:28 -0500
commit81a322d4a1b68d47908a6630bf22897a289722aa (patch)
treecdca9840d0620d9e0b46d7b81c58abe04a372b78 /hw/grackle_pci.c
parent24e6f3551f3c8ea7cc7524a3e64e84beca59618f (diff)
downloadqemu-81a322d4a1b68d47908a6630bf22897a289722aa.zip
qemu-81a322d4a1b68d47908a6630bf22897a289722aa.tar.gz
qemu-81a322d4a1b68d47908a6630bf22897a289722aa.tar.bz2
qdev: add return value to init() callbacks.
Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/grackle_pci.c')
-rw-r--r--hw/grackle_pci.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 5b6778e..38e2fe4 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -152,7 +152,7 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
return d->host_state.bus;
}
-static void pci_grackle_init_device(SysBusDevice *dev)
+static int pci_grackle_init_device(SysBusDevice *dev)
{
GrackleState *s;
int pci_mem_config, pci_mem_data;
@@ -171,9 +171,10 @@ static void pci_grackle_init_device(SysBusDevice *dev)
&s->host_state);
qemu_register_reset(pci_grackle_reset, &s->host_state);
pci_grackle_reset(&s->host_state);
+ return 0;
}
-static void pci_dec_21154_init_device(SysBusDevice *dev)
+static int pci_dec_21154_init_device(SysBusDevice *dev)
{
GrackleState *s;
int pci_mem_config, pci_mem_data;
@@ -187,9 +188,10 @@ static void pci_dec_21154_init_device(SysBusDevice *dev)
&s->host_state);
sysbus_init_mmio(dev, 0x1000, pci_mem_config);
sysbus_init_mmio(dev, 0x1000, pci_mem_data);
+ return 0;
}
-static void grackle_pci_host_init(PCIDevice *d)
+static int grackle_pci_host_init(PCIDevice *d)
{
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MOTOROLA);
pci_config_set_device_id(d->config, PCI_DEVICE_ID_MOTOROLA_MPC106);
@@ -197,9 +199,10 @@ static void grackle_pci_host_init(PCIDevice *d)
d->config[0x09] = 0x01;
pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
+ return 0;
}
-static void dec_21154_pci_host_init(PCIDevice *d)
+static int dec_21154_pci_host_init(PCIDevice *d)
{
/* PCI2PCI bridge same values as PearPC - check this */
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_DEC);
@@ -223,6 +226,7 @@ static void dec_21154_pci_host_init(PCIDevice *d)
d->config[0x25] = 0x84;
d->config[0x26] = 0x00; // prefetchable_memory_limit
d->config[0x27] = 0x85;
+ return 0;
}
static PCIDeviceInfo grackle_pci_host_info = {