[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 7/9] AHCI: Rework IRQ constants
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH v2 7/9] AHCI: Rework IRQ constants |
Date: |
Wed, 30 Aug 2017 19:28:02 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
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 <address@hidden>
>> ---
>> 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é <address@hidden>
>
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
- [Qemu-devel] [PATCH v2 4/9] ATAPI: Replace DEBUG_IDE_ATAPI with tracing events, (continued)
- [Qemu-devel] [PATCH v2 4/9] ATAPI: Replace DEBUG_IDE_ATAPI with tracing events, John Snow, 2017/08/29
- [Qemu-devel] [PATCH v2 8/9] AHCI: pretty-print FIS to buffer instead of stderr, John Snow, 2017/08/29
- [Qemu-devel] [PATCH v2 6/9] AHCI: Replace DPRINTF with trace-events, John Snow, 2017/08/29
- [Qemu-devel] [PATCH v2 9/9] AHCI: remove DPRINTF macro, John Snow, 2017/08/29
- [Qemu-devel] [PATCH v2 7/9] AHCI: Rework IRQ constants, John Snow, 2017/08/29
- Re: [Qemu-devel] [PATCH v2 0/9] IDE: replace printfs with tracing, no-reply, 2017/08/29
- Re: [Qemu-devel] [Qemu-block] [PATCH v2 0/9] IDE: replace printfs with tracing, Stefan Hajnoczi, 2017/08/30