[PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition

Philippe Mathieu-Daudé posted 10 patches 5 years, 4 months ago
[PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
Posted by Philippe Mathieu-Daudé 5 years, 4 months ago
The network devices use IRQ #9 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/net/ne2000-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 9f78ff11246..11166592246 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -15,6 +15,7 @@ enum IsaIrqNumber {
     ISA_IRQ_FDC_DEFAULT =  6,
     ISA_IRQ_PAR_DEFAULT =  7,
     ISA_IRQ_RTC_DEFAULT =  8,
+    ISA_IRQ_NET_DEFAULT =  9,
     ISA_NUM_IRQS        = 16
 };
 
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index dd6f6e34d3c..e31e86c14af 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -80,7 +80,7 @@ static void isa_ne2000_realizefn(DeviceState *dev, Error **errp)
 
 static Property ne2000_isa_properties[] = {
     DEFINE_PROP_UINT32("iobase", ISANE2000State, iobase, 0x300),
-    DEFINE_PROP_UINT32("irq",   ISANE2000State, isairq, 9),
+    DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, ISA_IRQ_NET_DEFAULT),
     DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
     DEFINE_PROP_END_OF_LIST(),
 };
-- 
2.26.2

Re: [PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
Posted by Gerd Hoffmann 5 years, 4 months ago
On Sun, Oct 11, 2020 at 09:32:27PM +0200, Philippe Mathieu-Daudé wrote:
> The network devices use IRQ #9 by default. Add this
> default definition to the IsaIrqNumber enum.

IRQ #9 seems to be sort-of standard for acpi.  Not sure whenever that is
actually written down somewhere.  IIRC in pre-ACPI days it was free
like irq #5.

take care,
  Gerd


Re: [PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
Posted by Philippe Mathieu-Daudé 5 years, 3 months ago
On 10/13/20 9:23 AM, Gerd Hoffmann wrote:
> On Sun, Oct 11, 2020 at 09:32:27PM +0200, Philippe Mathieu-Daudé wrote:
>> The network devices use IRQ #9 by default. Add this
>> default definition to the IsaIrqNumber enum.
> 
> IRQ #9 seems to be sort-of standard for acpi.  Not sure whenever that is
> actually written down somewhere.  IIRC in pre-ACPI days it was free
> like irq #5.

OK, I'll drop this patch.

Thanks,

Phil.

Re: [PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
Posted by Stefan Berger 5 years, 3 months ago
On 10/13/20 3:23 AM, Gerd Hoffmann wrote:
> On Sun, Oct 11, 2020 at 09:32:27PM +0200, Philippe Mathieu-Daudé wrote:
>> The network devices use IRQ #9 by default. Add this
>> default definition to the IsaIrqNumber enum.
> IRQ #9 seems to be sort-of standard for acpi.  Not sure whenever that is
> actually written down somewhere.  IIRC in pre-ACPI days it was free
> like irq #5.

Best docu I could find was this one:

https://en.wikipedia.org/wiki/Interrupt_request_(PC_architecture)#Master_PIC


>
> take care,
>    Gerd
>