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