diff mbox series

[05/10] hw/isa: Add the ISA_IRQ_FDC_DEFAULT definition

Message ID 20201011193229.3210774-6-f4bug@amsat.org
State New
Headers show
Series hw/isa: Introduce definitions for default IRQ values | expand

Commit Message

Philippe Mathieu-Daudé Oct. 11, 2020, 7:32 p.m. UTC
The floppy disk controller uses IRQ #6 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/block/fdc.c       | 4 ++--
 hw/sparc64/sun4u.c   | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

John Snow Oct. 12, 2020, 2:17 p.m. UTC | #1
On 10/11/20 3:32 PM, Philippe Mathieu-Daudé wrote:
> The floppy disk controller uses IRQ #6 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>

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

Patch

diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index e4f2aed004f..214a6730598 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -12,6 +12,7 @@  enum IsaIrqNumber {
     ISA_IRQ_KBD_DEFAULT =  1,
     ISA_IRQ_SER_DEFAULT =  4,
     ISA_IRQ_TPM_DEFAULT =  5,
+    ISA_IRQ_FDC_DEFAULT =  6,
     ISA_NUM_IRQS        = 16
 };
 
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 4c2c35e223a..531fc4c0b72 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2855,7 +2855,7 @@  static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope)
     crs = aml_resource_template();
     aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
     aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
-    aml_append(crs, aml_irq_no_flags(6));
+    aml_append(crs, aml_irq_no_flags(ISA_IRQ_FDC_DEFAULT));
     aml_append(crs,
         aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
 
@@ -2889,7 +2889,7 @@  static const VMStateDescription vmstate_isa_fdc ={
 
 static Property isa_fdc_properties[] = {
     DEFINE_PROP_UINT32("iobase", FDCtrlISABus, iobase, 0x3f0),
-    DEFINE_PROP_UINT32("irq", FDCtrlISABus, irq, 6),
+    DEFINE_PROP_UINT32("irq", FDCtrlISABus, irq, ISA_IRQ_FDC_DEFAULT),
     DEFINE_PROP_UINT32("dma", FDCtrlISABus, dma, 2),
     DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.qdev_for_drives[0].blk),
     DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.qdev_for_drives[1].blk),
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 6e42467d5cc..458dc215e6f 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -613,7 +613,7 @@  static void sun4uv_init(MemoryRegion *address_space_mem,
     /* Wire up "well-known" ISA IRQs to PBM legacy obio IRQs */
     qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", 7,
         qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_LPT_IRQ));
-    qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", 6,
+    qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", ISA_IRQ_FDC_DEFAULT,
         qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_FDD_IRQ));
     qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", ISA_IRQ_KBD_DEFAULT,
         qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_KBD_IRQ));