From: "Jim C. Brown" <jma5@umd.edu>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] enh req: Allow ATAPI CD-ROM to be attached other than sec/master
Date: Fri, 14 Apr 2006 14:41:12 -0400 [thread overview]
Message-ID: <20060414184112.GA16776@jbrown.mylinuxbox.org> (raw)
In-Reply-To: <34D2FED5-B14A-4375-8433-6B614C3B2073@smartgames.ca>
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
On Fri, Apr 14, 2006 at 01:38:18PM -0400, Toby Thain wrote:
> Per version 0.8.0, the ATAPI CD-ROM is always attached to IDE
> secondary/master (address 2). (See assignment to cdrom_index around
> vl.c line 4433.)
>
> Bochs allows the CD-ROM to be attached to any of four addresses, my
> suggestion is perhaps adding a QEMU runtime option for this.
>
> --Toby
Attached is a patch that does just that.
The default -cdrom still works, but you can also use -cdrom-a, -cdrom-b, -cdrom-c, and -cdrom-d to specify if the cdrom should be plugged in place over hda, hdb, hdc, or hdd respectively.
Also includes a few tests to make sure you don't clobber a hard disk with a cdrom, or use the same -hdX or -cdrom-X option multiple times.
--
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
[-- Attachment #2: vl.cdrom --]
[-- Type: text/plain, Size: 3082 bytes --]
--- vl.c.nocdrom Fri Apr 14 14:05:19 2006
+++ vl.c Fri Apr 14 14:34:10 2006
@@ -4730,6 +4730,10 @@
QEMU_OPTION_hdc,
QEMU_OPTION_hdd,
QEMU_OPTION_cdrom,
+ QEMU_OPTION_cdrom_a,
+ QEMU_OPTION_cdrom_b,
+ QEMU_OPTION_cdrom_c,
+ QEMU_OPTION_cdrom_d,
QEMU_OPTION_boot,
QEMU_OPTION_snapshot,
QEMU_OPTION_m,
@@ -4795,6 +4799,10 @@
{ "hdc", HAS_ARG, QEMU_OPTION_hdc },
{ "hdd", HAS_ARG, QEMU_OPTION_hdd },
{ "cdrom", HAS_ARG, QEMU_OPTION_cdrom },
+ { "cdrom-a", HAS_ARG, QEMU_OPTION_cdrom_a },
+ { "cdrom-b", HAS_ARG, QEMU_OPTION_cdrom_b },
+ { "cdrom-c", HAS_ARG, QEMU_OPTION_cdrom_c },
+ { "cdrom-d", HAS_ARG, QEMU_OPTION_cdrom_d },
{ "boot", HAS_ARG, QEMU_OPTION_boot },
{ "snapshot", 0, QEMU_OPTION_snapshot },
{ "m", HAS_ARG, QEMU_OPTION_m },
@@ -5091,11 +5099,7 @@
nographic = 0;
kernel_filename = NULL;
kernel_cmdline = "";
-#ifdef TARGET_PPC
- cdrom_index = 1;
-#else
- cdrom_index = 2;
-#endif
+ cdrom_index = -1; //disable by default
cyls = heads = secs = 0;
translation = BIOS_ATA_TRANSLATION_AUTO;
#ifdef _WIN32
@@ -5127,7 +5131,7 @@
break;
r = argv[optind];
if (r[0] != '-') {
- hd_filename[0] = argv[optind++];
+ //hd_filename[0] = argv[optind++];
} else {
const QEMUOption *popt;
@@ -5178,9 +5182,12 @@
{
int hd_index;
hd_index = popt->index - QEMU_OPTION_hda;
+ if (hd_filename[hd_index] != NULL) {
+printf("%d %s\n", hd_index, hd_filename[hd_index]);
+ fprintf(stderr, "qemu: can't share multiple disks\n");
+ exit(1);
+ }
hd_filename[hd_index] = optarg;
- if (hd_index == cdrom_index)
- cdrom_index = -1;
}
break;
case QEMU_OPTION_snapshot:
@@ -5235,9 +5242,30 @@
kernel_cmdline = optarg;
break;
case QEMU_OPTION_cdrom:
+ case QEMU_OPTION_cdrom_a:
+ case QEMU_OPTION_cdrom_b:
+ case QEMU_OPTION_cdrom_c:
+ case QEMU_OPTION_cdrom_d:
if (cdrom_index >= 0) {
- hd_filename[cdrom_index] = optarg;
+ fprintf(stderr, "qemu: too many cdroms\n");
+ exit(1);
+ }
+
+ if (popt->index == QEMU_OPTION_cdrom)
+/* use a sensible default */
+#ifdef TARGET_PPC
+ cdrom_index = 1;
+#else
+ cdrom_index = 2;
+#endif
+ else
+ cdrom_index = popt->index - QEMU_OPTION_cdrom_a;
+
+ if (hd_filename[cdrom_index] != NULL) {
+ fprintf(stderr, "qemu: can't share multiple disks\n");
+ exit(1);
}
+ hd_filename[cdrom_index] = optarg;
break;
case QEMU_OPTION_boot:
boot_device = optarg[0];
next prev parent reply other threads:[~2006-04-14 18:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-14 17:38 [Qemu-devel] enh req: Allow ATAPI CD-ROM to be attached other than sec/master Toby Thain
2006-04-14 18:41 ` Jim C. Brown [this message]
2006-04-14 19:23 ` Jim C. Brown
2006-04-15 16:44 ` Sylvain Petreolle
2006-04-15 18:13 ` Jim C. Brown
2006-09-25 20:26 ` RE : " Sylvain Petreolle
2006-04-17 16:26 ` Leonardo E. Reiter
2006-04-17 16:31 ` Leonardo E. Reiter
2006-04-15 20:18 ` Pascal Terjan
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=20060414184112.GA16776@jbrown.mylinuxbox.org \
--to=jma5@umd.edu \
--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.