From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jypj3-00015s-7E for qemu-devel@nongnu.org; Wed, 21 May 2008 10:55:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jypj2-00014Z-LI for qemu-devel@nongnu.org; Wed, 21 May 2008 10:55:32 -0400 Received: from [199.232.76.173] (port=37422 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jypj2-00014N-IW for qemu-devel@nongnu.org; Wed, 21 May 2008 10:55:32 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55834 helo=mx2.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jypj2-0002lT-GH for qemu-devel@nongnu.org; Wed, 21 May 2008 10:55:32 -0400 Message-ID: <48343300.7050902@suse.de> Date: Wed, 21 May 2008 16:34:40 +0200 From: Alexander Graf MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070802000401000203020901" Subject: [Qemu-devel] [PATCH] Fix ATAPI GET_CONFIGURATION function Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: paul@codesourcery.com This is a multi-part message in MIME format. --------------070802000401000203020901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 Signed-off-by: Kevin Wolf --------------070802000401000203020901 Content-Type: text/x-patch; name="atapi.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="atapi.patch" 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); --------------070802000401000203020901--