From patchwork Mon Feb 7 12:40:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 82239 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 98C85B70DE for ; Tue, 8 Feb 2011 10:42:33 +1100 (EST) Received: from localhost ([127.0.0.1]:35106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmQbO-0003ji-RN for incoming@patchwork.ozlabs.org; Mon, 07 Feb 2011 07:53:59 -0500 Received: from [140.186.70.92] (port=58975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmQMu-00052Z-Jk for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:39:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmQMs-0008BQ-6j for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:38:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmQMr-0008Ay-TQ for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:38:58 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p17CcuAf008086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Feb 2011 07:38:56 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p17CcjHx025718; Mon, 7 Feb 2011 07:38:55 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 7 Feb 2011 13:40:24 +0100 Message-Id: <1297082430-628-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1297082430-628-1-git-send-email-kwolf@redhat.com> References: <1297082430-628-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 08/14] ahci: Implement HBA reset 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 From: Alexander Graf The ahci code was missing its soft reset functionality. This wasn't really an issue for Linux guests, but Windows gets confused when the controller doesn't reset when it tells it so. Using this patch I can now successfully boot Windows 7 from AHCI using AHCI enabled SeaBIOS. Signed-off-by: Alexander Graf Signed-off-by: Kevin Wolf --- hw/ide/ahci.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index e6ac77c..105dd53 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -335,7 +335,7 @@ static void ahci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val) case HOST_CTL: /* R/W */ if (val & HOST_CTL_RESET) { DPRINTF(-1, "HBA Reset\n"); - /* FIXME reset? */ + ahci_reset(container_of(s, AHCIPCIState, ahci)); } else { s->control_regs.ghc = (val & 0x3) | HOST_CTL_AHCI_EN; ahci_check_irq(s); @@ -1134,6 +1134,9 @@ void ahci_reset(void *opaque) struct AHCIPCIState *d = opaque; int i; + d->ahci.control_regs.irqstatus = 0; + d->ahci.control_regs.ghc = 0; + for (i = 0; i < SATA_PORTS; i++) { ahci_reset_port(&d->ahci, i); }