[PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition

Philippe Mathieu-Daudé posted 10 patches 5 years, 4 months ago
[PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
Posted by Philippe Mathieu-Daudé 5 years, 4 months ago
The IDE controller uses IRQ #14 by default. Add this
default definition to the IsaIrqNumber enum.

Avoid magic values in the code, replace them by the
newly introduced definition.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/isa/isa.h | 1 +
 hw/ide/isa.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 43cdc3c47b6..05622ee11e2 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -17,6 +17,7 @@ enum IsaIrqNumber {
     ISA_IRQ_RTC_DEFAULT =  8,
     ISA_IRQ_NET_DEFAULT =  9,
     ISA_IRQ_MOU_DEFAULT = 12,
+    ISA_IRQ_IDE_DEFAULT = 14,
     ISA_NUM_IRQS        = 16
 };
 
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 6bc19de2265..2412d568937 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -108,7 +108,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
 static Property isa_ide_properties[] = {
     DEFINE_PROP_UINT32("iobase",  ISAIDEState, iobase,  0x1f0),
     DEFINE_PROP_UINT32("iobase2", ISAIDEState, iobase2, 0x3f6),
-    DEFINE_PROP_UINT32("irq",    ISAIDEState, isairq,  14),
+    DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, ISA_IRQ_IDE_DEFAULT),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.26.2

Re: [PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
Posted by John Snow 5 years, 4 months ago
On 10/11/20 3:32 PM, Philippe Mathieu-Daudé wrote:
> The IDE controller uses IRQ #14 by default. Add this
> default definition to the IsaIrqNumber enum.
> 
> Avoid magic values in the code, replace them by the
> newly introduced definition.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   include/hw/isa/isa.h | 1 +
>   hw/ide/isa.c         | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
> index 43cdc3c47b6..05622ee11e2 100644
> --- a/include/hw/isa/isa.h
> +++ b/include/hw/isa/isa.h
> @@ -17,6 +17,7 @@ enum IsaIrqNumber {
>       ISA_IRQ_RTC_DEFAULT =  8,
>       ISA_IRQ_NET_DEFAULT =  9,
>       ISA_IRQ_MOU_DEFAULT = 12,
> +    ISA_IRQ_IDE_DEFAULT = 14,
>       ISA_NUM_IRQS        = 16
>   };
>   
> diff --git a/hw/ide/isa.c b/hw/ide/isa.c
> index 6bc19de2265..2412d568937 100644
> --- a/hw/ide/isa.c
> +++ b/hw/ide/isa.c
> @@ -108,7 +108,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
>   static Property isa_ide_properties[] = {
>       DEFINE_PROP_UINT32("iobase",  ISAIDEState, iobase,  0x1f0),
>       DEFINE_PROP_UINT32("iobase2", ISAIDEState, iobase2, 0x3f6),
> -    DEFINE_PROP_UINT32("irq",    ISAIDEState, isairq,  14),
> +    DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, ISA_IRQ_IDE_DEFAULT),
>       DEFINE_PROP_END_OF_LIST(),
>   };
>   
> 

Acked-by: John Snow <jsnow@redhat.com>


Re: [PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
Posted by Gerd Hoffmann 5 years, 3 months ago
On Sun, Oct 11, 2020 at 09:32:29PM +0200, Philippe Mathieu-Daudé wrote:
> The IDE controller uses IRQ #14 by default. Add this
> default definition to the IsaIrqNumber enum.

primary, while secondary uses IRQ 15.

take care,
  Gerd