From patchwork Tue Apr 12 09:27:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 90752 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (unknown [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 701F9B6F29 for ; Tue, 12 Apr 2011 19:29:40 +1000 (EST) Received: from localhost ([::1]:40744 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9Zuj-0003sK-9C for incoming@patchwork.ozlabs.org; Tue, 12 Apr 2011 05:29:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9ZtF-00024J-D0 for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:28:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9ZtE-0002Tx-I9 for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:28:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9ZtE-0002Ts-8l for qemu-devel@nongnu.org; Tue, 12 Apr 2011 05:28:04 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3C9S2ND017585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 05:28:02 -0400 Received: from localhost (dhcp193-58.pnq.redhat.com [10.65.193.58]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3C9S0pN029673; Tue, 12 Apr 2011 05:28:01 -0400 From: Amit Shah To: qemu list Date: Tue, 12 Apr 2011 14:57:41 +0530 Message-Id: <4b8ef9a0c0f065fde45fa040d1ced5cf27ef48cc.1302600061.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Juan Quintela , Stefan Hajnoczi , Markus Armbruster , Amit Shah , Paolo Bonzini Subject: [Qemu-devel] [PATCH v2 3/6] atapi: GESN: Spin off No Event Available handling into own function 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 Handle GET_EVENT_STATUS_NOTIFICATION's No Event Available status in its own function. Signed-off-by: Amit Shah --- hw/ide/core.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index d71bc41..c5913d8 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1084,14 +1084,24 @@ static int ide_dvd_read_structure(IDEState *s, int format, } } +static unsigned int event_status_nea(uint8_t *buf, unsigned int max_len) +{ + cpu_to_ube16(buf, 0x00); /* No event descriptor returned */ + buf[2] = 0x80; /* No Event Available (NEA) */ + buf[3] = 0x00; /* Empty supported event classes */ + + return 4; /* We wrote to 4 bytes */ +} + static void handle_get_event_status_notification(IDEState *s, uint8_t *buf, const uint8_t *packet) { - unsigned int max_len; + unsigned int max_len, used_len; max_len = ube16_to_cpu(packet + 7); + /* It is fine by the MMC spec to not support async mode operations */ if (!(packet[1] & 0x01)) { /* asynchronous mode */ /* Only polling is supported, asynchronous mode is not. */ ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, @@ -1099,12 +1109,11 @@ static void handle_get_event_status_notification(IDEState *s, return; } - /* polling */ + /* polling mode operation */ + /* We don't support any event class (yet). */ - cpu_to_ube16(buf, 0x00); /* No event descriptor returned */ - buf[2] = 0x80; /* No Event Available (NEA) */ - buf[3] = 0x00; /* Empty supported event classes */ - ide_atapi_cmd_reply(s, 4, max_len); + used_len = event_status_nea(buf, max_len); + ide_atapi_cmd_reply(s, used_len, max_len); } static void ide_atapi_cmd(IDEState *s)