On 08/29/2017 11:54 PM, Philippe Mathieu-Daudé wrote: > On 08/29/2017 05:49 PM, John Snow wrote: >> Create a new enum so that we can name the IRQ bits, which will make >> debugging >> them a little nicer if we can print them out. Not handled in this >> patch, but >> this will make it possible to get a nice debug printf detailing >> exactly which >> status bits are set, as it can be multiple at any given time. >> >> As a consequence of this patch, it is no longer possible to set >> multiple IRQ >> codes at once, but nothing was utilizing this ability anyway. >> >> Signed-off-by: John Snow <js...@redhat.com> >> --- >> hw/ide/ahci.c | 49 >> ++++++++++++++++++++++++++++++++++++++----------- >> hw/ide/ahci_internal.h | 44 >> +++++++++++++++++++++++++++++++++++--------- >> hw/ide/trace-events | 2 +- >> 3 files changed, 74 insertions(+), 21 deletions(-) >> >> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c >> index c60a000..a0a4dd6 100644 >> --- a/hw/ide/ahci.c >> +++ b/hw/ide/ahci.c >> @@ -56,6 +56,27 @@ static bool ahci_map_fis_address(AHCIDevice *ad); >> static void ahci_unmap_clb_address(AHCIDevice *ad); >> static void ahci_unmap_fis_address(AHCIDevice *ad); >> +static const char *AHCIPortIRQ_lookup[AHCI_PORT_IRQ__END] = { >> + [AHCI_PORT_IRQ_BIT_DHRS] = "DHRS", >> + [AHCI_PORT_IRQ_BIT_PSS] = "PSS", >> + [AHCI_PORT_IRQ_BIT_DSS] = "DSS", >> + [AHCI_PORT_IRQ_BIT_SDBS] = "SDBS", >> + [AHCI_PORT_IRQ_BIT_UFS] = "UFS", >> + [AHCI_PORT_IRQ_BIT_DPS] = "DPS", >> + [AHCI_PORT_IRQ_BIT_PCS] = "PCS", >> + [AHCI_PORT_IRQ_BIT_DMPS] = "DMPS", >> + [8 ... 21] = "RESERVED", >> + [AHCI_PORT_IRQ_BIT_PRCS] = "PRCS", >> + [AHCI_PORT_IRQ_BIT_IPMS] = "IPMS", >> + [AHCI_PORT_IRQ_BIT_OFS] = "OFS", >> + [25] = "RESERVED", >> + [AHCI_PORT_IRQ_BIT_INFS] = "INFS", >> + [AHCI_PORT_IRQ_BIT_IFS] = "IFS", >> + [AHCI_PORT_IRQ_BIT_HBDS] = "HBDS", >> + [AHCI_PORT_IRQ_BIT_HBFS] = "HBFS", >> + [AHCI_PORT_IRQ_BIT_TFES] = "TFES", >> + [AHCI_PORT_IRQ_BIT_CPDS] = "CPDS" >> +}; >> static uint32_t ahci_port_read(AHCIState *s, int port, int offset) >> { >> @@ -170,12 +191,18 @@ static void ahci_check_irq(AHCIState *s) >> } >> static void ahci_trigger_irq(AHCIState *s, AHCIDevice *d, >> - int irq_type) >> + enum AHCIPortIRQ irqbit) >> { >> - DPRINTF(d->port_no, "trigger irq %#x -> %x\n", >> - irq_type, d->port_regs.irq_mask & irq_type); >> + g_assert(irqbit >= 0 && irqbit < 32); > > I still think this assert is superfluous, anyway (and having hard time > reading C99 statement before declarations - I need to grow): > > Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> >
Left in because of my distrust of compilers as explained in my reply to #05. We'll get to the bottom of it ;) Thank you for the reviews. --js