From: Laurent Vivier <Laurent.Vivier@bull.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] QEMU/pc and scsi disks
Date: Thu, 01 Mar 2007 18:26:39 +0100 [thread overview]
Message-ID: <45E70CCF.40800@bull.net> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 388 bytes --]
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
--
------------- Laurent.Vivier@bull.net --------------
"Any sufficiently advanced technology is
indistinguishable from magic." - Arthur C. Clarke
[-- Attachment #1.2: pc-scsidisk.diff --]
[-- Type: text/plain, Size: 6131 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2007-03-01 17:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-01 17:26 Laurent Vivier [this message]
2007-03-01 17:36 ` [Qemu-devel] QEMU/pc and scsi disks Paul Brook
2007-03-02 8:36 ` Laurent Vivier
2007-03-02 11:02 ` Thiemo Seufer
2007-03-02 15:42 ` Paul Brook
2007-03-02 16:24 ` Anthony Liguori
2007-03-02 16:45 ` Joe Batt
2007-03-25 17:05 ` Anthony Liguori
2007-03-25 20:38 ` Thiemo Seufer
2007-03-03 19:01 ` Avi Kivity
2007-03-03 23:38 ` Anthony Liguori
2007-03-04 9:28 ` Avi Kivity
2007-03-04 11:43 ` Paul Brook
2007-03-04 11:48 ` Avi Kivity
2007-03-04 12:05 ` Paul Brook
2007-03-04 13:44 ` Chris Wilson
2007-03-04 17:50 ` Avi Kivity
2007-03-04 17:06 ` Anthony Liguori
2007-03-06 17:59 ` Joseph Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45E70CCF.40800@bull.net \
--to=laurent.vivier@bull.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.