From patchwork Mon Jul 2 09:41:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 168539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8E0282C008F for ; Mon, 2 Jul 2012 20:43:03 +1000 (EST) Received: from localhost ([::1]:43637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sld98-0004mN-9j for incoming@patchwork.ozlabs.org; Mon, 02 Jul 2012 05:42:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sld8c-0003lA-DS for qemu-devel@nongnu.org; Mon, 02 Jul 2012 05:41:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sld8U-0006Yl-T6 for qemu-devel@nongnu.org; Mon, 02 Jul 2012 05:41:45 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:53147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sld8U-0006YD-K2 for qemu-devel@nongnu.org; Mon, 02 Jul 2012 05:41:38 -0400 Received: by wgbds1 with SMTP id ds1so2606509wgb.4 for ; Mon, 02 Jul 2012 02:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=/wVHKEQ1XwEebOifHkMCAN1feRQfMx9AH6gSiVXEzl0=; b=CdoqJoG0OPBRUhGJEiWY8FGb/wXkTHIATwhueep3BCM1tjbWQsN2LFgmEii1pNlz2v 6Flq5zzmLaGwVqWZtEG0Il/AYZGgR0NdPFoBGEUSV7ywsRdr8ndDOIByWGo3jwzLq6U0 DhAOiNFQvSJngJ81hyx6i69/GHx+5rqHu7REOhmcrJnejUu11527kb3c9GO9rxY8uzGX LXkMrcBKsvgvOdQJZa2VAVYE6jiLCEQ0bIWQZyCH8CjtHYqMsjNT6rwEpU+/khwI5t62 RzVFTOYSH/W7NWRKUJncOJYBSTo+lYkz8axEmS/UUNhpBsUxD5L9GhpyKi6SL+NfokcS V9xA== Received: by 10.180.86.194 with SMTP id r2mr15315846wiz.15.1341222096484; Mon, 02 Jul 2012 02:41:36 -0700 (PDT) Received: from yakj.usersys.redhat.com (nat-pool-mxp-t.redhat.com. [209.132.186.18]) by mx.google.com with ESMTPS id bg10sm43224317wib.9.2012.07.02.02.41.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Jul 2012 02:41:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 2 Jul 2012 11:41:16 +0200 Message-Id: <1341222087-24920-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <1341222087-24920-1-git-send-email-pbonzini@redhat.com> References: <1341222087-24920-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.41 Cc: Kevin Wolf , Markus Armbruster Subject: [Qemu-devel] [PATCH 03/14] atapi: implement READ DISC INFORMATION X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This command is not necessary for CD-ROM and DVD-ROM, but some versions of udev trip on its absence. Cc: Kevin Wolf Cc: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/ide/atapi.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 5919cf5..f7f714c 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -956,6 +956,36 @@ static void cmd_read_cdvd_capacity(IDEState *s, uint8_t* buf) ide_atapi_cmd_reply(s, 8, 8); } +static void cmd_read_disc_information(IDEState *s, uint8_t* buf) +{ + uint8_t type = buf[1] & 7; + uint32_t max_len = ube16_to_cpu(buf + 7); + + /* Types 1/2 are only defined for Blu-Ray. */ + if (type != 0) { + ide_atapi_cmd_error(s, ILLEGAL_REQUEST, + ASC_INV_FIELD_IN_CMD_PACKET); + return; + } + + memset(buf, 0, 34); + buf[1] = 32; + buf[2] = 0xe; /* last session complete, disc finalized */ + buf[3] = 1; /* first track on disc */ + buf[4] = 1; /* # of sessions */ + buf[5] = 1; /* first track of last session */ + buf[6] = 1; /* last track of last session */ + buf[7] = 0x20; /* unrestricted use */ + buf[8] = 0x00; /* CD-ROM or DVD-ROM */ + /* 9-10-11: most significant byte corresponding bytes 4-5-6 */ + /* 12-23: not meaningful for CD-ROM or DVD-ROM */ + /* 24-31: disc bar code */ + /* 32: disc application code */ + /* 33: number of OPC tables */ + + ide_atapi_cmd_reply(s, 34, max_len); +} + static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf) { int max_len; @@ -1045,6 +1075,7 @@ static const struct { [ 0x43 ] = { cmd_read_toc_pma_atip, CHECK_READY }, [ 0x46 ] = { cmd_get_configuration, ALLOW_UA }, [ 0x4a ] = { cmd_get_event_status_notification, ALLOW_UA }, + [ 0x51 ] = { cmd_read_disc_information, CHECK_READY }, [ 0x5a ] = { cmd_mode_sense, /* (10) */ 0 }, [ 0xa8 ] = { cmd_read, /* (12) */ CHECK_READY }, [ 0xad ] = { cmd_read_dvd_structure, CHECK_READY },