From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HMp3B-0006Zk-9b for qemu-devel@nongnu.org; Thu, 01 Mar 2007 12:26:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HMp39-0006XU-Ed for qemu-devel@nongnu.org; Thu, 01 Mar 2007 12:26:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HMp39-0006XI-Am for qemu-devel@nongnu.org; Thu, 01 Mar 2007 12:26:39 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HMp38-0001d5-8k for qemu-devel@nongnu.org; Thu, 01 Mar 2007 12:26:39 -0500 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id D83D319D9AB for ; Thu, 1 Mar 2007 18:26:47 +0100 (CET) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25232-03 for ; Thu, 1 Mar 2007 18:26:45 +0100 (CET) Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 4FBB819D941 for ; Thu, 1 Mar 2007 18:26:45 +0100 (CET) Message-ID: <45E70CCF.40800@bull.net> Date: Thu, 01 Mar 2007 18:26:39 +0100 From: Laurent Vivier MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8FCFCBF86FAEB74B366EF8AA" Subject: [Qemu-devel] QEMU/pc and scsi disks Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8FCFCBF86FAEB74B366EF8AA Content-Type: multipart/mixed; boundary="------------060101080005070104090102" This is a multi-part message in MIME format. --------------060101080005070104090102 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, b= ut 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 --=20 ------------- Laurent.Vivier@bull.net -------------- "Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke --------------060101080005070104090102 Content-Type: text/plain; name="pc-scsidisk.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="pc-scsidisk.diff" Index: qemu-0.9.0/hw/lsi53c895a.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =20 -/* 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 =20 Index: qemu-0.9.0/vl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =20 -extern BlockDriverState *bs_table[MAX_DISKS + 1]; +/* lsi53c895a.c */ +#define LSI_MAX_DEVS 7 + +extern BlockDriverState *bs_table[MAX_DISKS + LSI_MAX_DEVS + 1]; =20 void isa_ide_init(int iobase, int iobase2, int irq, BlockDriverState *hd0, BlockDriverState *hd1); Index: qemu-0.9.0/vl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 ima= ge 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 =3D &display_state; @@ -6562,6 +6578,8 @@ fd_filename[i] =3D NULL; for(i =3D 0; i < MAX_DISKS; i++) hd_filename[i] =3D NULL; + for(i =3D 0; i < LSI_MAX_DEVS; i++) + sd_filename[i] =3D NULL; ram_size =3D DEFAULT_RAM_SIZE * 1024 * 1024; vga_ram_size =3D VGA_RAM_SIZE; bios_size =3D BIOS_SIZE; @@ -6664,6 +6682,15 @@ cdrom_index =3D -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] =3D optarg; + break; case QEMU_OPTION_snapshot: snapshot =3D 1; break; @@ -7123,7 +7150,22 @@ } } } - + for( i =3D 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] =3D bdrv_new(buf); + } + ret =3D 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] =3D bdrv_new("fda"); bdrv_set_type_hint(fd_table[0], BDRV_TYPE_FLOPPY); Index: qemu-0.9.0/hw/pc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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; =20 scsi =3D lsi_scsi_init(pci_bus, -1); - bdrv =3D bdrv_new("scsidisk"); - bdrv_open(bdrv, "scsi_disk.img", 0); - lsi_scsi_attach(scsi, bdrv, -1); - bdrv =3D 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 =3D 0; i < LSI_MAX_DEVS; i++) { + if (bs_table[i + MAX_DISKS]) + lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1); + } } -#endif } =20 static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,= --------------060101080005070104090102-- --------------enig8FCFCBF86FAEB74B366EF8AA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.7 (GNU/Linux) iD8DBQFF5wzS9Kffa9pFVzwRAiS1AJ9aHKlpMLJFnW41gTpSeKHnlgF6ngCg1r7U LG0waTAszlCEVQE0P2ZARR0= =we2C -----END PGP SIGNATURE----- --------------enig8FCFCBF86FAEB74B366EF8AA--