Skip to contentSkip to conversation

SCSI externals patch revisited

Qemu-devel Chuck Brazie 1 participant 1 message Dec 8, 2006

lore
Share & tools
lore
#0 lore raw

Here is a patch that merges the externals for IDE and SCSI with a --disk as Paul requested. Let me know if you want different keywords.

Chuck

qemu-new/hw/pc.c renamed from hg-qemu/hw/pc.c +11 -14
diff -Nuar -X diff_excludes /hg-qemu/hw/pc.c /qemu-new/hw/pc.c
@@ -710,23 +710,20 @@
     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);
+        if (scsi_hba_lsi > 0) {
+            if (!(scsi = lsi_scsi_init(pci_bus, -1))){
+                 exit(1);
+            }
+            for(i = 0; i < MAX_SCSI_DISKS; i++) {
+                if (scsi_disks_info[i].adapter == SCSI_LSI_53C895A &&
+                    scsi_disks_info[i].device_type != SCSI_NONE) {
+                    lsi_scsi_attach(scsi, bs_scsi_table[i], scsi_disks_info[i].id);
+                }
+            }
+        }
     }
-#endif
 }
 
 static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
qemu-new/vl.c renamed from hg-qemu/vl.c +309 -42

437 lines not on this page · raw message

qemu-new/vl.h renamed from hg-qemu/vl.h +21 -0
diff -Nuar -X diff_excludes /hg-qemu/vl.h /qemu-new/vl.h
@@ -1217,9 +1217,30 @@
 void scsi_cancel_io(SCSIDevice *s, uint32_t tag);
 uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag);
 
+enum scsi_host_adapters {           
+    SCSI_LSI_53C895A
+};
+enum scsi_devices {          
+    SCSI_CDROM,
+    SCSI_DISK,
+    SCSI_NONE
+};
+typedef enum scsi_host_adapters scsi_host_adapters;
+typedef enum scsi_devices scsi_devices;
+typedef struct SCSIDiskInfo{
+    scsi_host_adapters adapter; 
+    int id;
+    scsi_devices device_type;
+    } SCSIDiskInfo;
+
+#define MAX_SCSI_DISKS 7
+extern BlockDriverState *bs_scsi_table[MAX_SCSI_DISKS];
+extern SCSIDiskInfo scsi_disks_info[MAX_SCSI_DISKS];
+
 /* lsi53c895a.c */
 void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id);
 void *lsi_scsi_init(PCIBus *bus, int devfn);
+extern int scsi_hba_lsi; // Count of scsi disks/cdrom using this lsi adapter 
 
 /* integratorcp.c */
 extern QEMUMachine integratorcp926_machine;