Hi,

As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, but I
propose a little patch to make SCSI disks visible. Disks are not bootable, I
think we should write a BIOS for that ?

Regards,
Laurent
-- 
------------- [EMAIL PROTECTED]  --------------
       "Any sufficiently advanced technology is
  indistinguishable from magic." - Arthur C. Clarke
Index: qemu-0.9.0/hw/lsi53c895a.c
===================================================================
--- qemu-0.9.0.orig/hw/lsi53c895a.c     2007-03-01 17:53:43.000000000 +0100
+++ qemu-0.9.0/hw/lsi53c895a.c  2007-03-01 17:54:43.000000000 +0100
@@ -149,9 +149,6 @@
 #define PHASE_MI          7
 #define PHASE_MASK        7
 
-/* The HBA is ID 7, so for simplicitly limit to 7 devices.  */
-#define LSI_MAX_DEVS      7
-
 /* Maximum length of MSG IN data.  */
 #define LSI_MAX_MSGIN_LEN 8
 
Index: qemu-0.9.0/vl.h
===================================================================
--- qemu-0.9.0.orig/vl.h        2007-03-01 17:53:43.000000000 +0100
+++ qemu-0.9.0/vl.h     2007-03-01 17:54:43.000000000 +0100
@@ -917,7 +917,10 @@
 /* ide.c */
 #define MAX_DISKS 4
 
-extern BlockDriverState *bs_table[MAX_DISKS + 1];
+/* lsi53c895a.c */
+#define LSI_MAX_DEVS 7
+
+extern BlockDriverState *bs_table[MAX_DISKS + LSI_MAX_DEVS + 1];
 
 void isa_ide_init(int iobase, int iobase2, int irq,
                   BlockDriverState *hd0, BlockDriverState *hd1);
Index: qemu-0.9.0/vl.c
===================================================================
--- qemu-0.9.0.orig/vl.c        2007-03-01 17:53:43.000000000 +0100
+++ qemu-0.9.0/vl.c     2007-03-01 17:54:43.000000000 +0100
@@ -121,7 +121,7 @@
 IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS];
 /* Note: bs_table[MAX_DISKS] is a dummy block driver if none available
    to store the VM snapshots */
-BlockDriverState *bs_table[MAX_DISKS + 1], *fd_table[MAX_FD];
+BlockDriverState *bs_table[MAX_DISKS + LSI_MAX_DEVS + 1], *fd_table[MAX_FD];
 /* point to the block driver where the snapshots are managed */
 BlockDriverState *bs_snapshots;
 int vga_ram_size;
@@ -6020,6 +6020,7 @@
            "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n"
            "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n"
            "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n"
+           "-sda..-sdg file use 'file' as SCSI hard disk 0 to 7 image\n"
            "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 
master)\n"
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or 
network (n)\n"
            "-snapshot       write to temporary files instead of disk image 
files\n"
@@ -6154,6 +6155,13 @@
     QEMU_OPTION_hdc,
     QEMU_OPTION_hdd,
     QEMU_OPTION_cdrom,
+    QEMU_OPTION_sda,
+    QEMU_OPTION_sdb,
+    QEMU_OPTION_sdc,
+    QEMU_OPTION_sdd,
+    QEMU_OPTION_sde,
+    QEMU_OPTION_sdf,
+    QEMU_OPTION_sdg,
     QEMU_OPTION_boot,
     QEMU_OPTION_snapshot,
 #ifdef TARGET_I386
@@ -6226,6 +6234,13 @@
     { "hdc", HAS_ARG, QEMU_OPTION_hdc },
     { "hdd", HAS_ARG, QEMU_OPTION_hdd },
     { "cdrom", HAS_ARG, QEMU_OPTION_cdrom },
+    { "sda", HAS_ARG, QEMU_OPTION_sda },
+    { "sdb", HAS_ARG, QEMU_OPTION_sdb },
+    { "sdc", HAS_ARG, QEMU_OPTION_sdc },
+    { "sdd", HAS_ARG, QEMU_OPTION_sdd },
+    { "sde", HAS_ARG, QEMU_OPTION_sde },
+    { "sdf", HAS_ARG, QEMU_OPTION_sdf },
+    { "sdg", HAS_ARG, QEMU_OPTION_sdg },
     { "boot", HAS_ARG, QEMU_OPTION_boot },
     { "snapshot", 0, QEMU_OPTION_snapshot },
 #ifdef TARGET_I386
@@ -6504,6 +6519,7 @@
     int i, cdrom_index;
     int snapshot, linux_boot;
     const char *initrd_filename;
+    const char *sd_filename[LSI_MAX_DEVS];
     const char *hd_filename[MAX_DISKS], *fd_filename[MAX_FD];
     const char *kernel_filename, *kernel_cmdline;
     DisplayState *ds = &display_state;
@@ -6562,6 +6578,8 @@
         fd_filename[i] = NULL;
     for(i = 0; i < MAX_DISKS; i++)
         hd_filename[i] = NULL;
+    for(i = 0; i < LSI_MAX_DEVS; i++)
+        sd_filename[i] = NULL;
     ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
     vga_ram_size = VGA_RAM_SIZE;
     bios_size = BIOS_SIZE;
@@ -6664,6 +6682,15 @@
                         cdrom_index = -1;
                 }
                 break;
+           case QEMU_OPTION_sda:
+           case QEMU_OPTION_sdb:
+           case QEMU_OPTION_sdc:
+           case QEMU_OPTION_sdd:
+           case QEMU_OPTION_sde:
+           case QEMU_OPTION_sdf:
+           case QEMU_OPTION_sdg:
+                sd_filename[popt->index - QEMU_OPTION_sda] = optarg;
+                break;
             case QEMU_OPTION_snapshot:
                 snapshot = 1;
                 break;
@@ -7123,7 +7150,22 @@
             }
         }
     }
-
+    for( i = 0; i < LSI_MAX_DEVS; i++) {
+        int ret;
+       if (sd_filename[i]) {
+           if (!bs_table[i + MAX_DISKS]) {
+               char buf[64];
+               snprintf(buf, sizeof(buf), "sd%c", i + 'a');
+               bs_table[i + MAX_DISKS] = bdrv_new(buf);
+           }
+           ret = bdrv_open(bs_table[i + MAX_DISKS], sd_filename[i], 0);
+           if (ret < 0) {
+               fprintf(stderr, "qemu: could not open hard disk image '%s'\n",
+                       sd_filename[i]);
+               exit(1);
+           }
+       }
+    }
     /* we always create at least one floppy disk */
     fd_table[0] = bdrv_new("fda");
     bdrv_set_type_hint(fd_table[0], BDRV_TYPE_FLOPPY);
Index: qemu-0.9.0/hw/pc.c
===================================================================
--- qemu-0.9.0.orig/hw/pc.c     2007-03-01 17:55:05.000000000 +0100
+++ qemu-0.9.0/hw/pc.c  2007-03-01 17:55:13.000000000 +0100
@@ -711,23 +711,16 @@
     if (i440fx_state) {
         i440fx_init_memory_mappings(i440fx_state);
     }
-#if 0
-    /* ??? Need to figure out some way for the user to
-       specify SCSI devices.  */
+
     if (pci_enabled) {
         void *scsi;
-        BlockDriverState *bdrv;
 
         scsi = lsi_scsi_init(pci_bus, -1);
-        bdrv = bdrv_new("scsidisk");
-        bdrv_open(bdrv, "scsi_disk.img", 0);
-        lsi_scsi_attach(scsi, bdrv, -1);
-        bdrv = bdrv_new("scsicd");
-        bdrv_open(bdrv, "scsi_cd.iso", 0);
-        bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM);
-        lsi_scsi_attach(scsi, bdrv, -1);
+       for (i = 0; i < LSI_MAX_DEVS; i++) {
+           if (bs_table[i + MAX_DISKS])
+               lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1);
+       }
     }
-#endif
 }
 
 static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to