qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function
Date: Sat, 24 May 2008 12:31:01 +0200

Is there anything particularly wrong with this patch? Does it break any guest OSs I am not aware of?
If not, please include it as it's a pretty obvious bug.

Alex

On May 21, 2008, at 4:34 PM, Alexander Graf wrote:

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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>



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 via email to

[Prev in Thread] Current Thread [Next in Thread]