From mboxrd@z Thu Jan 1 00:00:00 1970 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 Date: Tue, 15 Mar 2011 15:11:42 +0100 From: Christoph Hellwig Message-ID: <20110315141142.GC30710@lst.de> References: <20110315141049.GA30627@lst.de> <20110315141132.GB30710@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110315141132.GB30710@lst.de> Subject: [Qemu-devel] [PATCH 3/4] ide: wire up setfeatures cache control List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com, aliguori@us.ibm.com, prerna@linux.vnet.ibm.com 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 */