mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-01 06:21:52 -06:00
qdev: Pass size to qbus_create_inplace()
To be passed to object_initialize().
Since commit 39355c3826
the argument is
void*, so drop some superfluous (BusState *) casts or direct parent
field usages.
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
e5f720391e
commit
fb17dfe057
19 changed files with 28 additions and 25 deletions
|
@ -44,7 +44,7 @@ void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size,
|
||||||
hda_codec_response_func response,
|
hda_codec_response_func response,
|
||||||
hda_codec_xfer_func xfer)
|
hda_codec_xfer_func xfer)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&bus->qbus, TYPE_HDA_BUS, dev, NULL);
|
qbus_create_inplace(bus, bus_size, TYPE_HDA_BUS, dev, NULL);
|
||||||
bus->response = response;
|
bus->response = response;
|
||||||
bus->xfer = xfer;
|
bus->xfer = xfer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ void ipack_bus_new_inplace(IPackBus *bus, size_t bus_size,
|
||||||
const char *name, uint8_t n_slots,
|
const char *name, uint8_t n_slots,
|
||||||
qemu_irq_handler handler)
|
qemu_irq_handler handler)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&bus->qbus, TYPE_IPACK_BUS, parent, name);
|
qbus_create_inplace(bus, bus_size, TYPE_IPACK_BUS, parent, name);
|
||||||
bus->n_slots = n_slots;
|
bus->n_slots = n_slots;
|
||||||
bus->set_irq = handler;
|
bus->set_irq = handler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -911,8 +911,8 @@ static int virtio_serial_device_init(VirtIODevice *vdev)
|
||||||
sizeof(struct virtio_console_config));
|
sizeof(struct virtio_console_config));
|
||||||
|
|
||||||
/* Spawn a new virtio-serial bus on which the ports will ride as devices */
|
/* Spawn a new virtio-serial bus on which the ports will ride as devices */
|
||||||
qbus_create_inplace(&vser->bus.qbus, TYPE_VIRTIO_SERIAL_BUS, qdev,
|
qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_BUS,
|
||||||
vdev->bus_name);
|
qdev, vdev->bus_name);
|
||||||
vser->bus.qbus.allow_hotplug = 1;
|
vser->bus.qbus.allow_hotplug = 1;
|
||||||
vser->bus.vser = vser;
|
vser->bus.vser = vser;
|
||||||
QTAILQ_INIT(&vser->ports);
|
QTAILQ_INIT(&vser->ports);
|
||||||
|
|
|
@ -470,7 +470,7 @@ static void bus_unparent(Object *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qbus_create_inplace(void *bus, const char *typename,
|
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
||||||
DeviceState *parent, const char *name)
|
DeviceState *parent, const char *name)
|
||||||
{
|
{
|
||||||
object_initialize(bus, typename);
|
object_initialize(bus, typename);
|
||||||
|
|
|
@ -276,8 +276,8 @@ static void main_system_bus_create(void)
|
||||||
/* assign main_system_bus before qbus_create_inplace()
|
/* assign main_system_bus before qbus_create_inplace()
|
||||||
* in order to make "if (bus != sysbus_get_default())" work */
|
* in order to make "if (bus != sysbus_get_default())" work */
|
||||||
main_system_bus = g_malloc0(system_bus_info.instance_size);
|
main_system_bus = g_malloc0(system_bus_info.instance_size);
|
||||||
qbus_create_inplace(main_system_bus, TYPE_SYSTEM_BUS, NULL,
|
qbus_create_inplace(main_system_bus, system_bus_info.instance_size,
|
||||||
"main-system-bus");
|
TYPE_SYSTEM_BUS, NULL, "main-system-bus");
|
||||||
OBJECT(main_system_bus)->free = g_free;
|
OBJECT(main_system_bus)->free = g_free;
|
||||||
object_property_add_child(container_get(qdev_get_machine(),
|
object_property_add_child(container_get(qdev_get_machine(),
|
||||||
"/unattached"),
|
"/unattached"),
|
||||||
|
|
|
@ -90,7 +90,8 @@ static void icc_bridge_init(Object *obj)
|
||||||
ICCBridgeState *s = ICC_BRIGDE(obj);
|
ICCBridgeState *s = ICC_BRIGDE(obj);
|
||||||
SysBusDevice *sb = SYS_BUS_DEVICE(obj);
|
SysBusDevice *sb = SYS_BUS_DEVICE(obj);
|
||||||
|
|
||||||
qbus_create_inplace(&s->icc_bus, TYPE_ICC_BUS, DEVICE(s), "icc");
|
qbus_create_inplace(&s->icc_bus, sizeof(s->icc_bus), TYPE_ICC_BUS,
|
||||||
|
DEVICE(s), "icc");
|
||||||
|
|
||||||
/* Do not change order of registering regions,
|
/* Do not change order of registering regions,
|
||||||
* APIC must be first registered region, board maps it by 0 index
|
* APIC must be first registered region, board maps it by 0 index
|
||||||
|
|
|
@ -50,7 +50,7 @@ static const TypeInfo ide_bus_info = {
|
||||||
void ide_bus_new(IDEBus *idebus, size_t idebus_size, DeviceState *dev,
|
void ide_bus_new(IDEBus *idebus, size_t idebus_size, DeviceState *dev,
|
||||||
int bus_id, int max_units)
|
int bus_id, int max_units)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&idebus->qbus, TYPE_IDE_BUS, dev, NULL);
|
qbus_create_inplace(idebus, idebus_size, TYPE_IDE_BUS, dev, NULL);
|
||||||
idebus->bus_id = bus_id;
|
idebus->bus_id = bus_id;
|
||||||
idebus->max_units = max_units;
|
idebus->max_units = max_units;
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,8 +711,8 @@ static void cuda_initfn(Object *obj)
|
||||||
s->timers[i].index = i;
|
s->timers[i].index = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)&s->adb_bus, TYPE_ADB_BUS, DEVICE(obj),
|
qbus_create_inplace(&s->adb_bus, sizeof(s->adb_bus), TYPE_ADB_BUS,
|
||||||
"adb.0");
|
DEVICE(obj), "adb.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cuda_class_init(ObjectClass *oc, void *data)
|
static void cuda_class_init(ObjectClass *oc, void *data)
|
||||||
|
|
|
@ -318,7 +318,7 @@ void pci_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *parent,
|
||||||
MemoryRegion *address_space_io,
|
MemoryRegion *address_space_io,
|
||||||
uint8_t devfn_min, const char *typename)
|
uint8_t devfn_min, const char *typename)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(bus, typename, parent, name);
|
qbus_create_inplace(bus, bus_size, typename, parent, name);
|
||||||
pci_bus_init(bus, parent, name, address_space_mem,
|
pci_bus_init(bus, parent, name, address_space_mem,
|
||||||
address_space_io, devfn_min);
|
address_space_io, devfn_min);
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,8 @@ int pci_bridge_initfn(PCIDevice *dev, const char *typename)
|
||||||
br->bus_name = dev->qdev.id;
|
br->bus_name = dev->qdev.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
qbus_create_inplace(&sec_bus->qbus, typename, &dev->qdev, br->bus_name);
|
qbus_create_inplace(sec_bus, sizeof(br->sec_bus), typename, DEVICE(dev),
|
||||||
|
br->bus_name);
|
||||||
sec_bus->parent_dev = dev;
|
sec_bus->parent_dev = dev;
|
||||||
sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn;
|
sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn;
|
||||||
sec_bus->address_space_mem = &br->address_space_mem;
|
sec_bus->address_space_mem = &br->address_space_mem;
|
||||||
|
|
|
@ -324,8 +324,8 @@ static int init_event_facility(S390SCLPDevice *sdev)
|
||||||
sdev->event_pending = event_pending;
|
sdev->event_pending = event_pending;
|
||||||
|
|
||||||
/* Spawn a new sclp-events facility */
|
/* Spawn a new sclp-events facility */
|
||||||
qbus_create_inplace(&event_facility->sbus.qbus,
|
qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),
|
||||||
TYPE_SCLP_EVENTS_BUS, (DeviceState *)sdev, NULL);
|
TYPE_SCLP_EVENTS_BUS, DEVICE(sdev), NULL);
|
||||||
event_facility->sbus.qbus.allow_hotplug = 0;
|
event_facility->sbus.qbus.allow_hotplug = 0;
|
||||||
event_facility->qdev = (DeviceState *) sdev;
|
event_facility->qdev = (DeviceState *) sdev;
|
||||||
|
|
||||||
|
|
|
@ -699,8 +699,8 @@ static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
|
||||||
BusState *qbus;
|
BusState *qbus;
|
||||||
char virtio_bus_name[] = "virtio-bus";
|
char virtio_bus_name[] = "virtio-bus";
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_S390_BUS, qdev,
|
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_S390_BUS,
|
||||||
virtio_bus_name);
|
qdev, virtio_bus_name);
|
||||||
qbus = BUS(bus);
|
qbus = BUS(bus);
|
||||||
qbus->allow_hotplug = 1;
|
qbus->allow_hotplug = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1297,8 +1297,8 @@ static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
|
||||||
BusState *qbus;
|
BusState *qbus;
|
||||||
char virtio_bus_name[] = "virtio-bus";
|
char virtio_bus_name[] = "virtio-bus";
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_CCW_BUS, qdev,
|
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_CCW_BUS,
|
||||||
virtio_bus_name);
|
qdev, virtio_bus_name);
|
||||||
qbus = BUS(bus);
|
qbus = BUS(bus);
|
||||||
qbus->allow_hotplug = 1;
|
qbus->allow_hotplug = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void scsi_device_unit_attention_reported(SCSIDevice *s)
|
||||||
void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
|
void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
|
||||||
const SCSIBusInfo *info, const char *bus_name)
|
const SCSIBusInfo *info, const char *bus_name)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&bus->qbus, TYPE_SCSI_BUS, host, bus_name);
|
qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name);
|
||||||
bus->busnr = next_scsi_bus++;
|
bus->busnr = next_scsi_bus++;
|
||||||
bus->info = info;
|
bus->info = info;
|
||||||
bus->qbus.allow_hotplug = 1;
|
bus->qbus.allow_hotplug = 1;
|
||||||
|
|
|
@ -70,7 +70,7 @@ const VMStateDescription vmstate_usb_device = {
|
||||||
void usb_bus_new(USBBus *bus, size_t bus_size,
|
void usb_bus_new(USBBus *bus, size_t bus_size,
|
||||||
USBBusOps *ops, DeviceState *host)
|
USBBusOps *ops, DeviceState *host)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&bus->qbus, TYPE_USB_BUS, host, NULL);
|
qbus_create_inplace(bus, bus_size, TYPE_USB_BUS, host, NULL);
|
||||||
bus->ops = ops;
|
bus->ops = ops;
|
||||||
bus->busnr = next_usb_bus++;
|
bus->busnr = next_usb_bus++;
|
||||||
bus->qbus.allow_hotplug = 1; /* Yes, we can */
|
bus->qbus.allow_hotplug = 1; /* Yes, we can */
|
||||||
|
|
|
@ -1309,7 +1309,8 @@ static int ccid_initfn(USBDevice *dev)
|
||||||
|
|
||||||
usb_desc_create_serial(dev);
|
usb_desc_create_serial(dev);
|
||||||
usb_desc_init(dev);
|
usb_desc_init(dev);
|
||||||
qbus_create_inplace(&s->bus.qbus, TYPE_CCID_BUS, &dev->qdev, NULL);
|
qbus_create_inplace(&s->bus, sizeof(s->bus), TYPE_CCID_BUS, DEVICE(dev),
|
||||||
|
NULL);
|
||||||
s->intr = usb_ep_get(dev, USB_TOKEN_IN, CCID_INT_IN_EP);
|
s->intr = usb_ep_get(dev, USB_TOKEN_IN, CCID_INT_IN_EP);
|
||||||
s->bus.qbus.allow_hotplug = 1;
|
s->bus.qbus.allow_hotplug = 1;
|
||||||
s->card = NULL;
|
s->card = NULL;
|
||||||
|
|
|
@ -392,7 +392,7 @@ static void virtio_mmio_bus_new(VirtioBusState *bus, size_t bus_size,
|
||||||
DeviceState *qdev = DEVICE(dev);
|
DeviceState *qdev = DEVICE(dev);
|
||||||
BusState *qbus;
|
BusState *qbus;
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_MMIO_BUS, qdev, NULL);
|
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_MMIO_BUS, qdev, NULL);
|
||||||
qbus = BUS(bus);
|
qbus = BUS(bus);
|
||||||
qbus->allow_hotplug = 0;
|
qbus->allow_hotplug = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1512,7 +1512,7 @@ static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size,
|
||||||
BusState *qbus;
|
BusState *qbus;
|
||||||
char virtio_bus_name[] = "virtio-bus";
|
char virtio_bus_name[] = "virtio-bus";
|
||||||
|
|
||||||
qbus_create_inplace((BusState *)bus, TYPE_VIRTIO_PCI_BUS, qdev,
|
qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_PCI_BUS, qdev,
|
||||||
virtio_bus_name);
|
virtio_bus_name);
|
||||||
qbus = BUS(bus);
|
qbus = BUS(bus);
|
||||||
qbus->allow_hotplug = 1;
|
qbus->allow_hotplug = 1;
|
||||||
|
|
|
@ -264,7 +264,7 @@ DeviceState *qdev_find_recursive(BusState *bus, const char *id);
|
||||||
typedef int (qbus_walkerfn)(BusState *bus, void *opaque);
|
typedef int (qbus_walkerfn)(BusState *bus, void *opaque);
|
||||||
typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
|
typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
|
||||||
|
|
||||||
void qbus_create_inplace(void *bus, const char *typename,
|
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
||||||
DeviceState *parent, const char *name);
|
DeviceState *parent, const char *name);
|
||||||
BusState *qbus_create(const char *typename, DeviceState *parent, const char *name);
|
BusState *qbus_create(const char *typename, DeviceState *parent, const char *name);
|
||||||
/* Returns > 0 if either devfn or busfn skip walk somewhere in cursion,
|
/* Returns > 0 if either devfn or busfn skip walk somewhere in cursion,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue