aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-06-30 14:12:08 +0200
committerPaul Brook <paul@codesourcery.com>2009-07-09 13:07:03 +0100
commit10c4c98ab7dc18169b37b76f6ea5e60ebe65222b (patch)
tree94b41a4a26b82720cc8695b66cedbcf135d68669 /hw/qdev.h
parent0aab0d3a4a62505ab7e79ee0a67fe3f04f6dae23 (diff)
qdev: replace bus_type enum with bus_info struct.
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index ad104992a6..36def1e6bf 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -10,6 +10,8 @@ typedef struct DeviceProperty DeviceProperty;
typedef struct BusState BusState;
+typedef struct BusInfo BusInfo;
+
/* This structure should not be accessed directly. We declare it here
so that it can be embedded in individual device state structures. */
struct DeviceState {
@@ -25,18 +27,17 @@ struct DeviceState {
LIST_ENTRY(DeviceState) sibling;
};
-typedef enum {
- BUS_TYPE_SYSTEM,
- BUS_TYPE_PCI,
- BUS_TYPE_SCSI,
- BUS_TYPE_I2C,
- BUS_TYPE_SSI
-} BusType;
+typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
+struct BusInfo {
+ const char *name;
+ size_t size;
+ bus_dev_printfn print_dev;
+};
struct BusState {
DeviceState *parent;
+ BusInfo *info;
const char *name;
- BusType type;
LIST_HEAD(, DeviceState) children;
LIST_ENTRY(BusState) sibling;
};
@@ -84,7 +85,7 @@ struct DeviceInfo {
/* Private to qdev / bus. */
qdev_initfn init;
- BusType bus_type;
+ BusInfo *bus_info;
};
void qdev_register(DeviceInfo *info);
@@ -116,14 +117,12 @@ void *qdev_get_prop_ptr(DeviceState *dev, const char *name);
/*** BUS API. ***/
-BusState *qbus_create(BusType type, size_t size,
- 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)
/*** monitor commands ***/
void do_info_qtree(Monitor *mon);
-void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent);
#endif