mirror of
https://git.proxmox.com/git/qemu
synced 2025-07-09 10:27:56 +00:00
allow qdev busses allocations be inplace
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
828566bc33
commit
cd739fb6e9
15
hw/qdev.c
15
hw/qdev.c
@ -502,13 +502,12 @@ static BusState *qbus_find(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name)
|
void qbus_create_inplace(BusState *bus, BusInfo *info,
|
||||||
|
DeviceState *parent, const char *name)
|
||||||
{
|
{
|
||||||
BusState *bus;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
int i,len;
|
int i,len;
|
||||||
|
|
||||||
bus = qemu_mallocz(info->size);
|
|
||||||
bus->info = info;
|
bus->info = info;
|
||||||
bus->parent = parent;
|
bus->parent = parent;
|
||||||
|
|
||||||
@ -537,6 +536,16 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name)
|
|||||||
QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
|
QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
|
||||||
parent->num_child_bus++;
|
parent->num_child_bus++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name)
|
||||||
|
{
|
||||||
|
BusState *bus;
|
||||||
|
|
||||||
|
bus = qemu_mallocz(info->size);
|
||||||
|
bus->qdev_allocated = 1;
|
||||||
|
qbus_create_inplace(bus, info, parent, name);
|
||||||
return bus;
|
return bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ struct BusState {
|
|||||||
DeviceState *parent;
|
DeviceState *parent;
|
||||||
BusInfo *info;
|
BusInfo *info;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
int qdev_allocated;
|
||||||
QLIST_HEAD(, DeviceState) children;
|
QLIST_HEAD(, DeviceState) children;
|
||||||
QLIST_ENTRY(BusState) sibling;
|
QLIST_ENTRY(BusState) sibling;
|
||||||
};
|
};
|
||||||
@ -145,6 +146,8 @@ BusState *qdev_get_parent_bus(DeviceState *dev);
|
|||||||
|
|
||||||
/*** BUS API. ***/
|
/*** BUS API. ***/
|
||||||
|
|
||||||
|
void qbus_create_inplace(BusState *bus, BusInfo *info,
|
||||||
|
DeviceState *parent, const char *name);
|
||||||
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name);
|
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name);
|
||||||
|
|
||||||
#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
|
#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
|
||||||
|
Loading…
Reference in New Issue
Block a user