qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 09/13] ahci: add -drive support


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 09/13] ahci: add -drive support
Date: Fri, 26 Nov 2010 20:17:29 +0100

We need to be able to spawn new AHCI drives, so let's add AHCI support
to the -drive option.

Signed-off-by: Alexander Graf <address@hidden>
---
 blockdev.c    |    6 +++++-
 blockdev.h    |    1 +
 qemu-common.h |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 6cb179a..5ce90cc 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -209,6 +209,9 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, 
int *fatal_error)
        } else if (!strcmp(buf, "xen")) {
            type = IF_XEN;
             max_devs = 0;
+        } else if (!strcmp(buf, "sata")) {
+            type = IF_SATA;
+            max_devs = MAX_SATA_DEVS;
        } else if (!strcmp(buf, "none")) {
            type = IF_NONE;
             max_devs = 0;
@@ -402,7 +405,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, 
int *fatal_error)
     } else {
         /* no id supplied -> create one */
         dinfo->id = qemu_mallocz(32);
-        if (type == IF_IDE || type == IF_SCSI)
+        if (type == IF_IDE || type == IF_SCSI || type == IF_SATA)
             mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd";
         if (max_devs)
             snprintf(dinfo->id, 32, "%s%i%s%i",
@@ -427,6 +430,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, 
int *fatal_error)
     case IF_IDE:
     case IF_SCSI:
     case IF_XEN:
+    case IF_SATA:
     case IF_NONE:
         switch(media) {
        case MEDIA_DISK:
diff --git a/blockdev.h b/blockdev.h
index 653affc..f50a15e 100644
--- a/blockdev.h
+++ b/blockdev.h
@@ -33,6 +33,7 @@ struct DriveInfo {
 
 #define MAX_IDE_DEVS   2
 #define MAX_SCSI_DEVS  7
+#define MAX_SATA_DEVS   4
 
 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
 int drive_get_max_bus(BlockInterfaceType type);
diff --git a/qemu-common.h b/qemu-common.h
index b3957f1..ae1cfca 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -257,7 +257,7 @@ typedef uint64_t pcibus_t;
 typedef enum {
     IF_NONE,
     IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN,
-    IF_COUNT
+    IF_SATA, IF_COUNT
 } BlockInterfaceType;
 
 void cpu_exec_init_all(unsigned long tb_size);
-- 
1.6.0.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]