From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlo Marcelo Arenas Belon Subject: [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access Date: Wed, 19 Dec 2007 11:55:27 -0600 Message-ID: <20071219175527.GD2981@tapir> References: <20071219174838.GC2981@tapir> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: Content-Disposition: inline In-Reply-To: <20071219174838.GC2981@tapir> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This patch complements "Partial IDE DVD emulation" (revision 1.66 for ide.c in qemu's cvs) that is generating the following timeouts for OpenSolaris guests when trying to access the ATAPI cdrom (ex: during installation): WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1); timeout: abort request, target=0 lun=0 WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1): timeout: abort device, target=0 lun=0 WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1): timeout: reset target, target=0 lun=0 WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1): timeout: reset bus, target=0 lun=0 The changes required to the "GET CONFIGURATION" implementation are : * recognize and honor "Allocation Length" input parameter * only set "current profile" for the response if a profile is current (either CD or DVD loaded) * calculate "data length" including all headers * refactor code and add comments to help document references to all implemented standards (ATAPI-4, SPC-3 and MMC-6) Signed-off-by: Carlo Marcelo Arenas Belon --- qemu/hw/ide.c | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c index 18431e7..3289964 100644 --- a/qemu/hw/ide.c +++ b/qemu/hw/ide.c @@ -1636,6 +1636,7 @@ static void ide_atapi_cmd(IDEState *s) break; case GPCMD_GET_CONFIGURATION: { + uint32_t len; int64_t total_sectors; /* only feature 0 is supported */ @@ -1644,17 +1645,27 @@ static void ide_atapi_cmd(IDEState *s) ASC_INV_FIELD_IN_CMD_PACKET); break; } - memset(buf, 0, 32); + max_len = ube16_to_cpu(packet + 7); bdrv_get_geometry(s->bs, &total_sectors); - buf[3] = 16; - buf[7] = total_sectors <= 1433600 ? 0x08 : 0x10; /* current profile */ - buf[10] = 0x10 | 0x1; - buf[11] = 0x08; /* size of profile list */ + memset(buf, 0, 32); + if (total_sectors) { + if (total_sectors > 1433600) { + buf[7] = 0x10; /* DVD-ROM */ + } else { + buf[7] = 0x08; /* CD-ROM */ + } + } else { + buf[7] = 0x00; /* no current profile */ + } + buf[10] = 0x02 | 0x01; /* persistent and current */ + buf[11] = 0x08; /* size of profile list = 4 bytes per profile */ buf[13] = 0x10; /* DVD-ROM profile */ - buf[14] = buf[7] == 0x10; /* (in)active */ + buf[14] = buf[13] == buf[7]; /* (in)active */ buf[17] = 0x08; /* CD-ROM profile */ - buf[18] = buf[7] == 0x08; /* (in)active */ - ide_atapi_cmd_reply(s, 32, 32); + buf[18] = buf[17] == buf[7]; /* (in)active */ + len = 8 + 4 + buf[11]; /* headers + size of profile list */ + cpu_to_ube32(buf, len - 4); /* data length */ + ide_atapi_cmd_reply(s, len, max_len); break; } default: -- 1.5.2.5 ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace