From patchwork Tue Mar 15 14:11:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 86988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 25464B6F93 for ; Wed, 16 Mar 2011 01:17:49 +1100 (EST) Received: from localhost ([127.0.0.1]:34946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzV4E-0007aM-40 for incoming@patchwork.ozlabs.org; Tue, 15 Mar 2011 10:17:46 -0400 Received: from [140.186.70.92] (port=60653 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzUyO-0004d9-5V for qemu-devel@nongnu.org; Tue, 15 Mar 2011 10:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzUyN-0002gA-7f for qemu-devel@nongnu.org; Tue, 15 Mar 2011 10:11:44 -0400 Received: from verein.lst.de ([213.95.11.211]:38243 helo=newverein.lst.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzUyN-0002g2-1V for qemu-devel@nongnu.org; Tue, 15 Mar 2011 10:11:43 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id E521A13FBC; Tue, 15 Mar 2011 15:11:42 +0100 (CET) Date: Tue, 15 Mar 2011 15:11:42 +0100 From: Christoph Hellwig To: qemu-devel@nongnu.org Message-ID: <20110315141142.GC30710@lst.de> References: <20110315141049.GA30627@lst.de> <20110315141132.GB30710@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110315141132.GB30710@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 213.95.11.211 Cc: kwolf@redhat.com, stefanha@gmail.com, aliguori@us.ibm.com, prerna@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 3/4] ide: wire up setfeatures cache control X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Wire up the ATA SETFEATURES subcalls that control the volatile write cache to the new bdrv_change_cache helper. Signed-off-by: Christoph Hellwig Index: qemu/hw/ide/core.c =================================================================== --- qemu.orig/hw/ide/core.c 2011-03-15 11:47:18.569636140 +0100 +++ qemu/hw/ide/core.c 2011-03-15 13:07:21.464634347 +0100 @@ -1700,6 +1700,19 @@ void ide_ioport_write(void *opaque, uint } } +static void ide_setcache(IDEState *s, bool enable) +{ + if (bdrv_change_cache(s->bs, enable)) { + ide_abort_command(s); + ide_set_irq(s->bus); + return; + } + + s->identify_set = 0; + + s->status = READY_STAT | SEEK_STAT; + ide_set_irq(s->bus); +} void ide_exec_cmd(IDEBus *bus, uint32_t val) { @@ -1855,7 +1868,11 @@ void ide_exec_cmd(IDEBus *bus, uint32_t case 0xcc: /* reverting to power-on defaults enable */ case 0x66: /* reverting to power-on defaults disable */ case 0x02: /* write cache enable */ + ide_setcache(s, true); + break; case 0x82: /* write cache disable */ + ide_setcache(s, false); + break; case 0xaa: /* read look-ahead enable */ case 0x55: /* read look-ahead disable */ case 0x05: /* set advanced power management mode */