qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] ide: fix GPCMD_GET_CONFIGURATION for correct DVD-ROM emulation
@ 2007-11-30 17:18 Carlo Marcelo Arenas Belon
  2007-11-30 17:28 ` [Qemu-devel] [PATCH 1/2] ide: fix GPCMD_GET_CONFIGURATION for OpenSolaris guests Carlo Marcelo Arenas Belon
  2007-11-30 17:41 ` [Qemu-devel] [PATCH 2/2] ide: report model as DVD-ROM for INQUIRY and IDENTIFY DEVICE commands Carlo Marcelo Arenas Belon
  0 siblings, 2 replies; 3+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-11-30 17:18 UTC (permalink / raw)
  To: qemu-devel

The following patch series complements "Partial IDE DVD emulation" which was
added in revision 1.66 of ide.c and that was generating the following timeouts
for OpenSolaris guests when trying to access the ATAPI CD-ROM (during 
installation for example):

  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1);
          timeout: abort request, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: abort device, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: reset target, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: reset bus, target=0 lun=0

It has been tested to fix the problem and not to introduce any regression 
with several releases of Linux, BSD (FreeBSD, OpenBSD, NetBSD and
DragonflyBSD), Windows 2K and OpenSolaris (Nexenta, Indiana, SXDE) and Solaris
10 guests in x86 (32bit) and amd64 (64bit) hosts and to match exact responses
when compared to responses received by physical SATA and ATAPI DVD-ROM devices.

  Patch 1/2: fixes GET_CONFIGURATION to allow OpenSolaris CD-ROM access
  Patch 2/2: uses DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE

Carlo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 1/2] ide: fix GPCMD_GET_CONFIGURATION for OpenSolaris guests
  2007-11-30 17:18 [Qemu-devel] [PATCH 0/2] ide: fix GPCMD_GET_CONFIGURATION for correct DVD-ROM emulation Carlo Marcelo Arenas Belon
@ 2007-11-30 17:28 ` Carlo Marcelo Arenas Belon
  2007-11-30 17:41 ` [Qemu-devel] [PATCH 2/2] ide: report model as DVD-ROM for INQUIRY and IDENTIFY DEVICE commands Carlo Marcelo Arenas Belon
  1 sibling, 0 replies; 3+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-11-30 17:28 UTC (permalink / raw)
  To: qemu-devel

The following patch implements the following changes to the implementation of
"GET CONFIGURATION" as part of the initial MMC-6 support added to ide.c so it
would emulate a multi profile device with DVD-ROM capabilities :

* recognize and honor "Allocation Length" command parameter
* corrected flags for response to match bits for persistent and current as
requested by the standard
* only set "current profile" for the response if a profile is current (either
CD or DVD loaded)
* calculate "data length" including all headers
* refactor code and add comments to help document references to all partially
implemented standards (ATAPI-4, SPC-3 and MMC-6)

Carlo

---
Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72
diff -u -p -r1.72 ide.c
--- hw/ide.c	18 Nov 2007 01:44:37 -0000	1.72
+++ hw/ide.c	30 Nov 2007 16:29:49 -0000
@@ -1636,6 +1636,7 @@ static void ide_atapi_cmd(IDEState *s)
         break;
     case GPCMD_GET_CONFIGURATION:
         {
+            uint32_t len;
             int64_t total_sectors;
 
             /* only feature 0 is supported */
@@ -1644,17 +1645,27 @@ static void ide_atapi_cmd(IDEState *s)
                                     ASC_INV_FIELD_IN_CMD_PACKET);
                 break;
             }
-            memset(buf, 0, 32);
+            max_len = ube16_to_cpu(packet + 7);
             bdrv_get_geometry(s->bs, &total_sectors);
-            buf[3] = 16;
-            buf[7] = total_sectors <= 1433600 ? 0x08 : 0x10; /* current profile */
-            buf[10] = 0x10 | 0x1;
-            buf[11] = 0x08; /* size of profile list */
+            memset(buf, 0, 32);
+            if (total_sectors) {
+                if (total_sectors > 1433600) {
+                    buf[7] = 0x10; /* DVD-ROM */
+                } else {
+                    buf[7] = 0x08; /* CD-ROM */
+                }
+            } else {
+                buf[7] = 0x00; /* no current profile */
+            }
+            buf[10] = 0x02 | 0x01; /* persistent and current */
+            buf[11] = 0x08; /* size of profile list = 4 bytes per profile */
             buf[13] = 0x10; /* DVD-ROM profile */
-            buf[14] = buf[7] == 0x10; /* (in)active */
+            buf[14] = buf[13] == buf[7]; /* (in)active */
             buf[17] = 0x08; /* CD-ROM profile */
-            buf[18] = buf[7] == 0x08; /* (in)active */
-            ide_atapi_cmd_reply(s, 32, 32);
+            buf[18] = buf[17] == buf[7]; /* (in)active */
+            len = 8 + 4 + buf[11]; /* headers + size of profile list */
+            cpu_to_ube32(buf, len - 4); /* data length */
+            ide_atapi_cmd_reply(s, len, max_len);
             break;
         }
     default:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] ide: report model as DVD-ROM for INQUIRY and IDENTIFY DEVICE commands
  2007-11-30 17:18 [Qemu-devel] [PATCH 0/2] ide: fix GPCMD_GET_CONFIGURATION for correct DVD-ROM emulation Carlo Marcelo Arenas Belon
  2007-11-30 17:28 ` [Qemu-devel] [PATCH 1/2] ide: fix GPCMD_GET_CONFIGURATION for OpenSolaris guests Carlo Marcelo Arenas Belon
@ 2007-11-30 17:41 ` Carlo Marcelo Arenas Belon
  1 sibling, 0 replies; 3+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-11-30 17:41 UTC (permalink / raw)
  To: qemu-devel

This patch complements "Partial IDE DVD emulation" and the previous patch to
reflect that the device is now able to support DVDs by changing the reported
model to be "DVD-ROM" instead of "CD-ROM".

Carlo

---
Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72
diff -u -p -r1.72 ide.c
--- hw/ide.c	18 Nov 2007 01:44:37 -0000	1.72
+++ hw/ide.c	30 Nov 2007 16:57:52 -0000
@@ -1,5 +1,5 @@
 /*
- * QEMU IDE disk and CD-ROM Emulator
+ * QEMU IDE disk and CD/DVD-ROM Emulator
  *
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2006 Openedhand Ltd.
@@ -541,7 +541,7 @@ static void ide_atapi_identify(IDEState 
     put_le16(p + 21, 512); /* cache size in sectors */
     put_le16(p + 22, 4); /* ecc bytes */
     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
-    padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
+    padstr((uint8_t *)(p + 27), "QEMU DVD-ROM", 40); /* model */
     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
 #ifdef USE_DMA_CDROM
     put_le16(p + 49, 1 << 9 | 1 << 8); /* DMA and LBA supported */
@@ -1630,7 +1630,7 @@ static void ide_atapi_cmd(IDEState *s)
         buf[6] = 0; /* reserved */
         buf[7] = 0; /* reserved */
         padstr8(buf + 8, 8, "QEMU");
-        padstr8(buf + 16, 16, "QEMU CD-ROM");
+        padstr8(buf + 16, 16, "QEMU DVD-ROM");
         padstr8(buf + 32, 4, QEMU_VERSION);
         ide_atapi_cmd_reply(s, 36, max_len);
         break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-30 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30 17:18 [Qemu-devel] [PATCH 0/2] ide: fix GPCMD_GET_CONFIGURATION for correct DVD-ROM emulation Carlo Marcelo Arenas Belon
2007-11-30 17:28 ` [Qemu-devel] [PATCH 1/2] ide: fix GPCMD_GET_CONFIGURATION for OpenSolaris guests Carlo Marcelo Arenas Belon
2007-11-30 17:41 ` [Qemu-devel] [PATCH 2/2] ide: report model as DVD-ROM for INQUIRY and IDENTIFY DEVICE commands Carlo Marcelo Arenas Belon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).