qdev: Remove obsolete functions.
In order to simplify refactoring / future patches
Change-Id: Ic5dc8f58e8bdd429c1dc023e0c992f4cea5a50ed
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 227b7e0..e9c5a61 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -386,54 +386,6 @@
memcpy(macaddr, dev->nd->macaddr, 6);
}
-static int next_block_unit[IF_COUNT];
-
-/* Get a block device. This should only be used for single-drive devices
- (e.g. SD/Floppy/MTD). Multi-disk devices (scsi/ide) should use the
- appropriate bus. */
-BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type)
-{
- int unit = next_block_unit[type]++;
- DriveInfo* info;
-
- info = drive_get(type, 0, unit);
- if (info == NULL) {
- return NULL;
- }
- return info->bdrv;
-}
-
-BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
-{
- BusState *bus;
-
- QLIST_FOREACH(bus, &dev->child_bus, sibling) {
- if (strcmp(name, bus->name) == 0) {
- return bus;
- }
- }
- return NULL;
-}
-
-static int next_scsi_bus;
-
-/* Create a scsi bus, and attach devices to it. */
-/* TODO: Actually create a scsi bus for hotplug to use. */
-void scsi_bus_new(DeviceState *host, SCSIAttachFn attach)
-{
- int bus = next_scsi_bus++;
- int unit;
- DriveInfo* info;
-
- for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
- info = drive_get(IF_SCSI, bus, unit);
- if (info == NULL) {
- continue;
- }
- attach(host, info->bdrv, unit);
- }
-}
-
BusState *qbus_create(BusType type, size_t size,
DeviceState *parent, const char *name)
{
@@ -450,78 +402,6 @@
return bus;
}
-static const char *bus_type_names[] = {
- [ BUS_TYPE_SYSTEM ] = "System",
- [ BUS_TYPE_PCI ] = "PCI",
- [ BUS_TYPE_SCSI ] = "SCSI",
- [ BUS_TYPE_I2C ] = "I2C",
- [ BUS_TYPE_SSI ] = "SSI",
-};
-
-#define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", ## __VA_ARGS__)
-static void qbus_print(Monitor *mon, BusState *bus, int indent);
-
-static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
-{
- DeviceProperty *prop;
- BusState *child;
- qdev_printf("dev: %s\n", dev->type->info->name);
- indent += 2;
- if (dev->num_gpio_in) {
- qdev_printf("gpio-in %d\n", dev->num_gpio_in);
- }
- if (dev->num_gpio_out) {
- qdev_printf("gpio-out %d\n", dev->num_gpio_out);
- }
- for (prop = dev->props; prop; prop = prop->next) {
- switch (prop->type) {
- case PROP_TYPE_INT:
- qdev_printf("prop-int %s 0x%" PRIx64 "\n", prop->name,
- prop->value.i);
- break;
- case PROP_TYPE_PTR:
- qdev_printf("prop-ptr %s\n", prop->name);
- break;
- case PROP_TYPE_DEV:
- qdev_printf("prop-dev %s %s\n", prop->name,
- ((DeviceState *)prop->value.ptr)->type->info->name);
- break;
- default:
- qdev_printf("prop-unknown%d %s\n", prop->type, prop->name);
- break;
- }
- }
- switch (dev->parent_bus->type) {
- case BUS_TYPE_SYSTEM:
- sysbus_dev_print(mon, dev, indent);
- break;
- default:
- break;
- }
- QLIST_FOREACH(child, &dev->child_bus, sibling) {
- qbus_print(mon, child, indent);
- }
-}
-
-static void qbus_print(Monitor *mon, BusState *bus, int indent)
-{
- struct DeviceState *dev;
-
- qdev_printf("bus: %s\n", bus->name);
- indent += 2;
- qdev_printf("type %s\n", bus_type_names[bus->type]);
- QLIST_FOREACH(dev, &bus->children, sibling) {
- qdev_print(mon, dev, indent);
- }
-}
-#undef qdev_printf
-
-void do_info_qtree(Monitor *mon)
-{
- if (main_system_bus)
- qbus_print(mon, main_system_bus, 0);
-}
-
char *qdev_get_dev_path(DeviceState *dev)
{
// TODO(digit): Implement this properly.
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 77f4774..7903938 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -65,17 +65,6 @@
dev->irqp[n] = p;
}
-/* Pass IRQs from a target device. */
-void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target)
-{
- int i;
- assert(dev->num_irq == 0);
- dev->num_irq = target->num_irq;
- for (i = 0; i < dev->num_irq; i++) {
- dev->irqp[i] = target->irqp[i];
- }
-}
-
void sysbus_init_mmio(SysBusDevice *dev, hwaddr size, int iofunc)
{
int n;
@@ -87,18 +76,6 @@
dev->mmio[n].iofunc = iofunc;
}
-void sysbus_init_mmio_cb(SysBusDevice *dev, hwaddr size,
- mmio_mapfunc cb)
-{
- int n;
-
- assert(dev->num_mmio < QDEV_MAX_MMIO);
- n = dev->num_mmio++;
- dev->mmio[n].addr = -1;
- dev->mmio[n].size = size;
- dev->mmio[n].cb = cb;
-}
-
static void sysbus_device_init(DeviceState *dev, DeviceInfo *base)
{
SysBusDeviceInfo *info = container_of(base, SysBusDeviceInfo, qdev);
@@ -125,42 +102,3 @@
info->init = init;
sysbus_register_withprop(info);
}
-
-DeviceState *sysbus_create_varargs(const char *name,
- hwaddr addr, ...)
-{
- DeviceState *dev;
- SysBusDevice *s;
- va_list va;
- qemu_irq irq;
- int n;
-
- dev = qdev_create(NULL, name);
- s = sysbus_from_qdev(dev);
- qdev_init(dev);
- if (addr != (hwaddr)-1) {
- sysbus_mmio_map(s, 0, addr);
- }
- va_start(va, addr);
- n = 0;
- while (1) {
- irq = va_arg(va, qemu_irq);
- if (!irq) {
- break;
- }
- sysbus_connect_irq(s, n, irq);
- n++;
- }
- return dev;
-}
-
-void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
-{
- SysBusDevice *s = sysbus_from_qdev(dev);
- int i;
-
- for (i = 0; i < s->num_mmio; i++) {
- monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
- indent, "", s->mmio[i].addr, s->mmio[i].size);
- }
-}
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index eef15f7..8e280de 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -36,7 +36,6 @@
int devfn_min;
pci_set_irq_fn set_irq;
pci_map_irq_fn map_irq;
- uint32_t config_reg; /* XXX: suppress */
/* low level pic */
qemu_irq_handler low_set_irq;
qemu_irq *irq_opaque;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index e68656d..5bf5c43 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -54,8 +54,6 @@
qemu_irq qdev_get_gpio_in(DeviceState *dev, int n);
void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin);
-BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
-
/*** Device API. ***/
typedef enum {
@@ -92,8 +90,6 @@
void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);
-void scsi_bus_new(DeviceState *host, SCSIAttachFn attach);
-
CharDriverState *qdev_init_chardev(DeviceState *dev);
BusState *qdev_get_parent_bus(DeviceState *dev);
@@ -121,9 +117,6 @@
/*** monitor commands ***/
-void do_info_qtree(Monitor *mon);
-void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent);
-
char *qdev_get_dev_path(DeviceState *dev);
#endif // QDEV_CORE_H
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 0327a33..4de8112 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -41,23 +41,10 @@
void sysbus_register_withprop(SysBusDeviceInfo *info);
void *sysbus_new(void);
void sysbus_init_mmio(SysBusDevice *dev, hwaddr size, int iofunc);
-void sysbus_init_mmio_cb(SysBusDevice *dev, hwaddr size,
- mmio_mapfunc cb);
void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
-void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
-/* Legacy helper function for creating devices. */
-DeviceState *sysbus_create_varargs(const char *name,
- hwaddr addr, ...);
-static inline DeviceState *sysbus_create_simple(const char *name,
- hwaddr addr,
- qemu_irq irq)
-{
- return sysbus_create_varargs(name, addr, irq, NULL);
-}
-
#endif /* !HW_SYSBUS_H */