From patchwork Fri Sep 5 16:13:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 386450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9BD871400D5 for ; Sat, 6 Sep 2014 02:30:16 +1000 (EST) Received: from localhost ([::1]:59003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPwOs-0004yi-NR for incoming@patchwork.ozlabs.org; Fri, 05 Sep 2014 12:30:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPwA6-0004uG-M5 for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:15:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPwA0-0006Pw-IE for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:14:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPwA0-0006Po-9U for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:14:52 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s85GEo8G014486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Sep 2014 12:14:50 -0400 Received: from localhost (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s85GEnw3028050; Fri, 5 Sep 2014 12:14:50 -0400 From: Stefan Hajnoczi To: Date: Fri, 5 Sep 2014 17:13:50 +0100 Message-Id: <1409933634-11331-23-git-send-email-stefanha@redhat.com> In-Reply-To: <1409933634-11331-1-git-send-email-stefanha@redhat.com> References: <1409933634-11331-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , John Snow , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 22/26] ide: Add wwn support to IDE-ATAPI drive 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 From: John Snow Although it is possible to specify the wwn property for cdrom devices on the command line, the underlying driver fails to relay this information to the guest operating system via IDENTIFY. This is a simple patch to correct that. See ATA8-ACS, Table 22 parts 5, 6, and 9. Signed-off-by: John Snow Reviewed-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- hw/ide/core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index b48127f..de0e5e9 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -230,9 +230,23 @@ static void ide_atapi_identify(IDEState *s) } put_le16(p + 80, 0x1e); /* support up to ATA/ATAPI-4 */ + if (s->wwn) { + put_le16(p + 84, (1 << 8)); /* supports WWN for words 108-111 */ + put_le16(p + 87, (1 << 8)); /* WWN enabled */ + } + #ifdef USE_DMA_CDROM put_le16(p + 88, 0x3f | (1 << 13)); /* udma5 set and supported */ #endif + + if (s->wwn) { + /* LE 16-bit words 111-108 contain 64-bit World Wide Name */ + put_le16(p + 108, s->wwn >> 48); + put_le16(p + 109, s->wwn >> 32); + put_le16(p + 110, s->wwn >> 16); + put_le16(p + 111, s->wwn); + } + memcpy(s->identify_data, p, sizeof(s->identify_data)); s->identify_set = 1; }