qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: paul@codesourcery.com
Subject: [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function
Date: Wed, 21 May 2008 16:34:40 +0200	[thread overview]
Message-ID: <48343300.7050902@suse.de> (raw)

[-- 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);

             reply	other threads:[~2008-05-21 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 14:34 Alexander Graf [this message]
2008-05-24 10:31 ` [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function 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

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=48343300.7050902@suse.de \
    --to=agraf@suse.de \
    --cc=paul@codesourcery.com \
    --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 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).