aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
commit6f68ecb2c11d90212d6f7d06c857843d30abcfdc (patch)
treee6926e91f567d60f0498556fe76de233ea5bb536 /hw/qdev.c
parent6b1b92d35b247188139c3dd022fd9521882ef8a9 (diff)
downloadqemu-6f68ecb2c11d90212d6f7d06c857843d30abcfdc.zip
qemu-6f68ecb2c11d90212d6f7d06c857843d30abcfdc.tar.gz
qemu-6f68ecb2c11d90212d6f7d06c857843d30abcfdc.tar.bz2
qdev scsi bus infrastructure
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index db6f696..a97f425 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -265,3 +265,22 @@ void qdev_attach_child_bus(DeviceState *dev, const char *name, void *bus)
p->next = dev->child_bus;
dev->child_bus = p;
}
+
+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;
+ int index;
+
+ for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
+ index = drive_get_index(IF_SCSI, bus, unit);
+ if (index == -1) {
+ continue;
+ }
+ attach(host, drives_table[index].bdrv, unit);
+ }
+}