From patchwork Sat May 22 20:31:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Herbszt X-Patchwork-Id: 53286 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 E291BB7D45 for ; Sun, 23 May 2010 06:34:15 +1000 (EST) Received: from localhost ([127.0.0.1]:46647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFvOe-0001SU-8l for incoming@patchwork.ozlabs.org; Sat, 22 May 2010 16:34:12 -0400 Received: from [140.186.70.92] (port=56470 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFvMw-0000fU-GE for qemu-devel@nongnu.org; Sat, 22 May 2010 16:32:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFvMu-0000m4-Ai for qemu-devel@nongnu.org; Sat, 22 May 2010 16:32:26 -0400 Received: from mail.gmx.net ([213.165.64.20]:51080) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OFvMt-0000lZ-TF for qemu-devel@nongnu.org; Sat, 22 May 2010 16:32:24 -0400 Received: (qmail invoked by alias); 22 May 2010 20:32:21 -0000 Received: from g225084245.adsl.alicedsl.de (HELO opensuse112) [92.225.84.245] by mail.gmx.net (mp038) with SMTP; 22 May 2010 22:32:21 +0200 X-Authenticated: #310364 X-Provags-ID: V01U2FsdGVkX1+MRNJL+FqMGINfjR2m0/Gf+Yd87goEZcSDbt91P+ SC4LCEbyc4aVn1 X-Mailer: gregkh_patchbomb modified Date: Sat, 22 May 2010 22:31:44 +0200 Message-Id: <1274560304$3317@local> Mime-Version: 1.0 To: qemu-devel@nongnu.org From: Sebastian Herbszt X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-ahci-devel@lists.sourceforge.net, Sebastian Herbszt Subject: [Qemu-devel] [PATCH] ahci: handle writes to generic host control registers 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 Handle writes to Generic Host Control registers. Signed-off-by: Sebastian Herbszt diff --git a/hw/ahci.c b/hw/ahci.c index f8e198c..178f9ea 100644 --- a/hw/ahci.c +++ b/hw/ahci.c @@ -425,7 +425,6 @@ static uint32_t ahci_mem_readl(void *ptr, target_phys_addr_t addr) static void ahci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val) { AHCIState *s = ptr; - uint32_t *p; addr=addr&0xfff; /* Only aligned reads are allowed on OHCI */ @@ -435,17 +434,30 @@ static void ahci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val) return; } - if(addr<0x20) - { - switch(addr) - { - case HOST_IRQ_STAT: + if (addr < 0x20) { /* Generic Host Control */ + switch(addr) { + case HOST_CAP: /* R/WO, RO */ + /* FIXME handle R/WO */ + break; + case HOST_CTL: /* R/W */ + if (val & HOST_RESET) { + DPRINTF("HBA Reset\n"); + /* FIXME reset? */ + } else + s->control_regs.ghc = val; + break; + case HOST_IRQ_STAT: /* R/WC, RO */ s->control_regs.irqstatus &= ~val; ahci_check_irq(s); break; + case HOST_PORTS_IMPL: /* R/WO, RO */ + /* FIXME handle R/WO */ + break; + case HOST_VERSION: /* RO */ + /* FIXME report write? */ + break; default: - /* genernal host control */ - p=(uint32_t *)&s->control_regs; + DPRINTF("write to unknown register 0x%x\n", (unsigned)addr); } } else if(addr>=0x100 && addr<0x300)