All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function
@ 2008-05-21 14:34 Alexander Graf
  2008-05-24 10:31 ` Alexander Graf
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2008-05-21 14:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: paul

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

The current implementation of GET_CONFIGURATION in the ATAPI stack of 
qemu replies a different length depending on the buffer, the data should 
be written into.

On the other hand the SCSI spec defines that length information has to 
be consistent and independent of return buffer lengths.

This patch makes the ATAPI emulation behave according to the spec and 
fixes the Darwin DVD driver.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@suse.de>




[-- Attachment #2: atapi.patch --]
[-- Type: text/x-patch, Size: 1229 bytes --]

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index a2a8299..6e585e1 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -1717,6 +1717,7 @@ static void ide_atapi_cmd(IDEState *s)
     case GPCMD_GET_CONFIGURATION:
         {
             uint32_t len;
+            uint8_t index = 0;
 
             /* only feature 0 is supported */
             if (packet[2] != 0 || packet[3] != 0) {
@@ -1753,14 +1754,11 @@ static void ide_atapi_cmd(IDEState *s)
             }
 
             len = 8; /* header completed */
-            if (max_len > len) {
-                uint8_t index = 0;
 
-                buf[10] = 0x02 | 0x01; /* persistent and current */
-                len += 4; /* header */
-                len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM);
-                len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM);
-            }
+            buf[10] = 0x02 | 0x01; /* persistent and current */
+            len += 4; /* header */
+            len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM);
+            len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM);
             cpu_to_ube32(buf, len - 4); /* data length */
 
             ide_atapi_cmd_reply(s, len, max_len);

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

end of thread, other threads:[~2008-05-30  1:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 14:34 [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function Alexander Graf
2008-05-24 10:31 ` Alexander Graf
2008-05-24 19:54   ` Alexander Graf
2008-05-25  7:53   ` Carlo Marcelo Arenas Belon
2008-05-25  9:27     ` Alexander Graf
2008-05-25 10:38       ` Carlo Marcelo Arenas Belon
2008-05-26  8:59         ` Alexander Graf
2008-05-26 17:46         ` Alexander Graf
2008-05-27 18:10           ` Carlo Marcelo Arenas Belon
2008-05-30  1:32             ` Alexander Graf

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.