From 8ffb1bcf56a4b62d80c8dbefa715cd16394255e0 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 15 Jul 2009 13:59:25 +0200 Subject: qdev: bus walker + qdev_device_add() This patch implements a parser and qdev tree walker for bus paths and adds qdev_device_add on top of this. A bus path can be: (1) full path, i.e. /i440FX-pcihost/pci.0/lsi/scsi.0 (2) bus name, i.e. "scsi.0". Best used together with id= to make sure this is unique. (3) relative path starting with a bus name, i.e. "pci.0/lsi/scsi.0" For the (common) case of a single child bus being attached to a device it is enougth to specify the device only, i.e. "pci.0/lsi" will be accepted too. qdev_device_add() adds devices and accepts bus= parameters to find the bus the device should be attached to. Without bus= being specified it takes the first bus it finds where the device can be attached to (i.e. first pci bus for pci devices, ...). Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/qdev.h | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/qdev.h') diff --git a/hw/qdev.h b/hw/qdev.h index d9c78eba60..af2ee0f8b9 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -82,6 +82,7 @@ struct CompatProperty { /*** Board API. This should go away once we have a machine config file. ***/ DeviceState *qdev_create(BusState *bus, const char *name); +DeviceState *qdev_device_add(const char *cmdline); void qdev_init(DeviceState *dev); void qdev_free(DeviceState *dev); -- cgit v1.2.3-55-g7522