diff options
author | John Snow <jsnow@redhat.com> | 2018-06-08 13:17:38 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2018-06-08 13:17:38 -0400 |
commit | d566811a10a8310da120cc962e487d491d1e91d3 (patch) | |
tree | 3b02820d4d5fc1557e5ab477d3f7b69487079c81 /hw/ide | |
parent | 467378baed0c1b3bfaa11eb97d1c231d1b0ed916 (diff) | |
download | qemu-d566811a10a8310da120cc962e487d491d1e91d3.zip qemu-d566811a10a8310da120cc962e487d491d1e91d3.tar.gz qemu-d566811a10a8310da120cc962e487d491d1e91d3.tar.bz2 |
ahci: adjust ahci_mem_write to work on registers
Actually, this function looks pretty broken, but for now, let's finish
up what this series of commits came here to do.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180531222835.16558-15-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/ahci.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 51c3e96..e4e8735 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -468,11 +468,14 @@ static void ahci_mem_write(void *opaque, hwaddr addr, } if (addr < AHCI_GENERIC_HOST_CONTROL_REGS_MAX_ADDR) { - switch (addr) { - case HOST_CAP: /* R/WO, RO */ + enum AHCIHostReg regnum = addr / 4; + assert(regnum < AHCI_HOST_REG__COUNT); + + switch (regnum) { + case AHCI_HOST_REG_CAP: /* R/WO, RO */ /* FIXME handle R/WO */ break; - case HOST_CTL: /* R/W */ + case AHCI_HOST_REG_CTL: /* R/W */ if (val & HOST_CTL_RESET) { ahci_reset(s); } else { @@ -480,14 +483,14 @@ static void ahci_mem_write(void *opaque, hwaddr addr, ahci_check_irq(s); } break; - case HOST_IRQ_STAT: /* R/WC, RO */ + case AHCI_HOST_REG_IRQ_STAT: /* R/WC, RO */ s->control_regs.irqstatus &= ~val; ahci_check_irq(s); break; - case HOST_PORTS_IMPL: /* R/WO, RO */ + case AHCI_HOST_REG_PORTS_IMPL: /* R/WO, RO */ /* FIXME handle R/WO */ break; - case HOST_VERSION: /* RO */ + case AHCI_HOST_REG_VERSION: /* RO */ /* FIXME report write? */ break; default: |