qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Herbszt <herbszt@gmx.de>
To: qemu-devel@nongnu.org
Cc: qemu-ahci-devel@lists.sourceforge.net,
	Sebastian Herbszt <herbszt@gmx.de>
Subject: [Qemu-devel] [PATCH] ahci: handle writes to generic host control registers
Date: Sat, 22 May 2010 22:31:44 +0200	[thread overview]
Message-ID: <1274560304$3317@local> (raw)

Handle writes to Generic Host Control registers.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>

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)

                 reply	other threads:[~2010-05-22 20:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1274560304$3317@local' \
    --to=herbszt@gmx.de \
    --cc=qemu-ahci-devel@lists.sourceforge.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).