hw/isa: Introduce definitions for default IRQ values
cover hw/isa: Introduce definitions for default IRQ values
Replace various magic values by definitions to make the code easier to read.
This probably makes sense to merge this series via the 'PC chipset' tree, rather than qemu-trivial@.
Regards,
Phil.
Philippe Mathieu-Daudé (10):
hw/isa: Introduce IsaIrqNumber enum
hw/isa: Add the ISA_IRQ_KBD_DEFAULT definition
hw/isa: Add the ISA_IRQ_SER_DEFAULT definition
hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
hw/isa: Add the ISA_IRQ_FDC_DEFAULT definition
hw/isa: Add the ISA_IRQ_PAR_DEFAULT definition
hw/isa: Add the ISA_IRQ_RTC_DEFAULT definition
hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
hw/isa: Add the ISA_IRQ_MOU_DEFAULT definition
hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
include/hw/isa/isa.h | 13 ++++++++++++- include/hw/rtc/mc146818rtc.h | 1 - hw/block/fdc.c | 4 ++-- hw/char/parallel.c | 2 +- hw/i386/acpi-build.c | 2 +- hw/ide/isa.c | 2 +- hw/input/pckbd.c | 2 +- hw/ipmi/isa_ipmi_bt.c | 2 +- hw/ipmi/isa_ipmi_kcs.c | 2 +- hw/isa/piix4.c | 2 +- hw/net/ne2000-isa.c | 2 +- hw/rtc/m48t59-isa.c | 2 +- hw/rtc/mc146818rtc.c | 4 ++-- hw/sparc64/sun4u.c | 10 +++++----- hw/timer/hpet.c | 8 ++++---- hw/tpm/tpm_tis_isa.c | 2 +- tests/qtest/rtc-test.c | 8 ++++---- 17 files changed, 39 insertions(+), 29 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/10 hw/isa: Introduce IsaIrqNumber enum
We are going to list all default ISA IRQs. As all the definitions are related, introduce the IsaIrqNumber type to enumerate them.
--- include/hw/isa/isa.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/hw/isa/isa.h +3 -1
@@ -8,7 +8,9 @@#include "hw/qdev-core.h" #include "qom/object.h" -#define ISA_NUM_IRQS 16 +enum IsaIrqNumber { +ISA_NUM_IRQS =16 +};#define TYPE_ISA_DEVICE "isa-device"OBJECT_DECLARE_TYPE (ISADevice, ISADeviceClass,ISA_DEVICE )
Signature · 1 line
2.26.2
PATCH 2/10 hw/isa: Add the ISA_IRQ_KBD_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe PS2 keyboard uses IRQ #1 by default. Add this
default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + hw/sparc64/sun4u.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/isa/isa.h +1 -0
@@ -9,6 +9,7 @@#include "qom/object.h" enum IsaIrqNumber { +ISA_IRQ_KBD_DEFAULT =1 ,ISA_NUM_IRQS =16 };
hw/sparc64/sun4u.c +1 -1
@@ -615,7 +615,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_LPT_IRQ));qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,6 ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_FDD_IRQ )); -qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,1 , +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 ));qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,12 ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_MSE_IRQ ));
Signature · 1 line
2.26.2
PATCH 3/10 hw/isa: Add the ISA_IRQ_SER_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe first serial port uses IRQ #4 by default. Add this default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + hw/sparc64/sun4u.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/isa/isa.h +1 -0
@@ -10,6 +10,7 @@enum IsaIrqNumber {ISA_IRQ_KBD_DEFAULT =1 , +ISA_IRQ_SER_DEFAULT =4 ,ISA_NUM_IRQS =16 };
hw/sparc64/sun4u.c +1 -1
@@ -619,7 +619,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qdev_get_gpio_in_named(DEVICE(sabre), "pbm-irq", OBIO_KBD_IRQ));qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,12 ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_MSE_IRQ )); -qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,4 , +qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,ISA_IRQ_SER_DEFAULT ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_SER_IRQ ));switch (vga_interface_type) {
Signature · 1 line
2.26.2
Re: [PATCH 03/10] hw/isa: Add the ISA_IRQ_SER_DEFAULT definition
Quoted 1 line · Philippe Mathieu-Daudé
The first serial port uses IRQ #4 by default. Add this
^^^^^
Quoted 1 line
+
ISA_IRQ_SER_DEFAULT= 4,
... so name this SER1 maybe? And add SER2 = 3?
take care,
Gerd
PATCH 4/10 hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe TPM TIS device uses IRQ #5 by default. Add this default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + hw/i386/acpi-build.c | 2 +- hw/ipmi/isa_ipmi_bt.c | 2 +- hw/ipmi/isa_ipmi_kcs.c | 2 +- hw/tpm/tpm_tis_isa.c | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-)
include/hw/isa/isa.h +1 -0
@@ -11,6 +11,7 @@enum IsaIrqNumber {ISA_IRQ_KBD_DEFAULT =1 ,ISA_IRQ_SER_DEFAULT =4 , +ISA_IRQ_TPM_DEFAULT =5 ,ISA_NUM_IRQS =16 };
hw/i386/acpi-build.c +1 -1
@@ -1886,7 +1886,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,Rewrite to take IRQ from TPM device model and fix default IRQ value there to use some unused IRQ */ -/* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ +/* aml_append(crs, aml_irq_no_flags(ISA_IRQ_TPM_DEFAULT)); */ aml_append (dev,aml_name_decl ("_CRS" , crs));tpm_build_ppi_acpi (tpm, dev);
hw/ipmi/isa_ipmi_bt.c +1 -1
@@ -137,7 +137,7 @@ static void *isa_ipmi_bt_get_backend_data(IPMIInterface *ii)static Property ipmi_isa_properties[] = {DEFINE_PROP_UINT32 ("ioport" , ISAIPMIBTDevice, bt.io_base,0xe4 ), -DEFINE_PROP_INT32 ("irq" , ISAIPMIBTDevice, isairq,5 ), +DEFINE_PROP_INT32 ("irq" , ISAIPMIBTDevice, isairq,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_END_OF_LIST (), };
hw/ipmi/isa_ipmi_kcs.c +1 -1
@@ -144,7 +144,7 @@ static void *isa_ipmi_kcs_get_backend_data(IPMIInterface *ii)static Property ipmi_isa_properties[] = {DEFINE_PROP_UINT32 ("ioport" , ISAIPMIKCSDevice, kcs.io_base,0xca2 ), -DEFINE_PROP_INT32 ("irq" , ISAIPMIKCSDevice, isairq,5 ), +DEFINE_PROP_INT32 ("irq" , ISAIPMIKCSDevice, isairq,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_END_OF_LIST (), };
hw/tpm/tpm_tis_isa.c +1 -1
@@ -91,7 +91,7 @@ static void tpm_tis_isa_reset(DeviceState *dev) }static Property tpm_tis_isa_properties[] = { -DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,TPM_TIS_IRQ ), +DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_TPMBE ("tpmdev" , TPMStateISA, state.be_driver),DEFINE_PROP_BOOL ("ppi" , TPMStateISA, state.ppi_enabled, true),DEFINE_PROP_END_OF_LIST (),
Signature · 1 line
2.26.2
Re: [PATCH 04/10] hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
Quoted 58 lines · Philippe Mathieu-Daudé
The TPM TIS device uses IRQ #5 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é <[email protected]>--- include/hw/isa/isa.h | 1 + hw/i386/acpi-build.c | 2 +- hw/ipmi/isa_ipmi_bt.c | 2 +- hw/ipmi/isa_ipmi_kcs.c | 2 +- hw/tpm/tpm_tis_isa.c | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-)include/hw/isa/isa.h +1
-0@@ -11,6 +11,7 @@enum IsaIrqNumber {ISA_IRQ_KBD_DEFAULT =1 ,ISA_IRQ_SER_DEFAULT =4 , +ISA_IRQ_TPM_DEFAULT =5 ,ISA_NUM_IRQS =16 };hw/i386/acpi-build.c +1
-1@@ -1886,7 +1886,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,Rewrite to take IRQ from TPM device model and fix default IRQ value there to use some unused IRQ */ -/* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ +/* aml_append(crs, aml_irq_no_flags(ISA_IRQ_TPM_DEFAULT)); */ aml_append (dev,aml_name_decl ("_CRS" , crs));tpm_build_ppi_acpi (tpm, dev);hw/ipmi/isa_ipmi_bt.c +1
-1@@ -137,7 +137,7 @@ static void *isa_ipmi_bt_get_backend_data(IPMIInterface *ii)static Property ipmi_isa_properties[] = {DEFINE_PROP_UINT32 ("ioport" , ISAIPMIBTDevice, bt.io_base,0xe4 ), -DEFINE_PROP_INT32 ("irq" , ISAIPMIBTDevice, isairq,5 ), +DEFINE_PROP_INT32 ("irq" , ISAIPMIBTDevice, isairq,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_END_OF_LIST (), };hw/ipmi/isa_ipmi_kcs.c +0
-0
hw/ipmi/isa_ipmi_kcs.c static void *isa_ipmi_kcs_get_backend_data(IPMIInterface *ii) · line 149
Quoted 7 lines
hw/ipmi/isa_ipmi_kcs.c +1
-1@@ -144,7 +144,7 @@ static void *isa_ipmi_kcs_get_backend_data(IPMIInterface *ii)static Property ipmi_isa_properties[] = {DEFINE_PROP_UINT32 ("ioport" , ISAIPMIKCSDevice, kcs.io_base,0xca2 ), -DEFINE_PROP_INT32 ("irq" , ISAIPMIKCSDevice, isairq,5 ), +DEFINE_PROP_INT32 ("irq" , ISAIPMIKCSDevice, isairq,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_END_OF_LIST (), };
I don't know what these devices do but this looks like an unwanted clash.
Quoted 13 lines
hw/tpm/tpm_tis_isa.c +1
-1@@ -91,7 +91,7 @@ static void tpm_tis_isa_reset(DeviceState *dev) }static Property tpm_tis_isa_properties[] = { -DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,TPM_TIS_IRQ ), +DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,ISA_IRQ_TPM_DEFAULT ),DEFINE_PROP_TPMBE ("tpmdev" , TPMStateISA, state.be_driver),DEFINE_PROP_BOOL ("ppi" , TPMStateISA, state.ppi_enabled, true),DEFINE_PROP_END_OF_LIST (),
Re: [PATCH 04/10] hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
Quoted 64 lines · Stefan Berger
Quoted 63 lines · Philippe Mathieu-Daudé
The TPM TIS device uses IRQ #5 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é <[email protected]>---
include/hw/isa/isa.h | 1 +
hw/i386/acpi-build.c | 2 +-
hw/ipmi/isa_ipmi_bt.c | 2 +-
hw/ipmi/isa_ipmi_kcs.c| 2 +-
hw/tpm/tpm_tis_isa.c | 2 +-5 files changed, 5 insertions(+), 4 deletions(-)include/hw/isa/isa.h +1
-0@@ -11,6 +11,7 @@ enum IsaIrqNumber { ISA_IRQ_KBD_DEFAULT = 1, ISA_IRQ_SER_DEFAULT = 4, + ISA_IRQ_TPM_DEFAULT = 5,ISA_NUM_IRQS = 16
};hw/i386/acpi-build.c +0
-0@@ -1886,7 +1886,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,Rewrite to take IRQ from TPM device model and fix default IRQ value there to use some unused IRQ */
- /*aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ + /*aml_append(crs, aml_irq_no_flags(ISA_IRQ_TPM_DEFAULT)); */
aml_append(dev, aml_name_decl("_CRS", crs));
tpm_build_ppi_acpi(tpm, dev);hw/ipmi/isa_ipmi_bt.c +1
-1@@ -137,7 +137,7 @@ static void *isa_ipmi_bt_get_backend_data(IPMIInterface *ii) static Property ipmi_isa_properties[] = { DEFINE_PROP_UINT32("ioport", ISAIPMIBTDevice, bt.io_base, 0xe4), - DEFINE_PROP_INT32("irq", ISAIPMIBTDevice, isairq, 5), + DEFINE_PROP_INT32("irq", ISAIPMIBTDevice, isairq,ISA_IRQ_TPM_DEFAULT ), DEFINE_PROP_END_OF_LIST(),};
hw/ipmi/isa_ipmi_kcs.c +0
-0@@ -144,7 +144,7 @@ static void *isa_ipmi_kcs_get_backend_data (IPMIInterface *ii)
Quoted 10 lines
Quoted 7 lines
hw/ipmi/isa_ipmi_kcs.c +1
-1static Property ipmi_isa_properties[] = { DEFINE_PROP_UINT32("ioport", ISAIPMIKCSDevice, kcs.io_base, 0xca2), - DEFINE_PROP_INT32("irq", ISAIPMIKCSDevice, isairq, 5), + DEFINE_PROP_INT32("irq", ISAIPMIKCSDevice, isairq,ISA_IRQ_TPM_DEFAULT ), DEFINE_PROP_END_OF_LIST(),};
I don't know what these devices do but this looks like an unwanted clash.
Yes, sorry :( Maybe better to drop this patch.
Quoted 18 lines
Quoted 15 lines
hw/tpm/tpm_tis_isa.c +1
-1@@ -91,7 +91,7 @@ static void tpm_tis_isa_reset(DeviceState *dev) } static Property tpm_tis_isa_properties[] = { - DEFINE_PROP_UINT32("irq", TPMStateISA, state.irq_num, TPM_TIS_IRQ), + DEFINE_PROP_UINT32("irq", TPMStateISA, state.irq_num,ISA_IRQ_TPM_DEFAULT ), DEFINE_PROP_TPMBE("tpmdev", TPMStateISA, state.be_driver), DEFINE_PROP_BOOL("ppi", TPMStateISA, state.ppi_enabled, true),
DEFINE_PROP_END_OF_LIST(),
Re: [PATCH 04/10] hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
The TPM TIS device uses IRQ #5 by default. Add this default definition to the IsaIrqNumber enum.
IRQ 5 has no fixed assignment. All kinds of add-on isa cards (sound, net) used to use irq #5 by default because that one wasn't assigned otherwise. Seems these days tpm and ipmi use it ...
take care,
Gerd
Re: [PATCH 04/10] hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
Quoted 7 lines · Gerd Hoffmann
Quoted 2 lines · Philippe Mathieu-Daudé
The TPM TIS device uses IRQ #5 by default. Add this default definition to the IsaIrqNumber enum.
IRQ 5 has no fixed assignment. All kinds of add-on isa cards (sound, net) used to use irq #5 by default because that one wasn't assigned otherwise. Seems these days tpm and ipmi use it ...
Yes, I'll drop this patch.
Thanks,
Phil.
Re: [PATCH 04/10] hw/isa: Add the ISA_IRQ_TPM_DEFAULT definition
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Gerd Hoffmann
Quoted 2 lines · Philippe Mathieu-Daudé
The TPM TIS device uses IRQ #5 by default. Add this default definition to the IsaIrqNumber enum.
IRQ 5 has no fixed assignment. All kinds of add-on isa cards (sound, net) used to use irq #5 by default because that one wasn't assigned otherwise. Seems these days tpm and ipmi use it ...
Yes, I'll drop this patch.
I think this patch is good but maybe the name should be a different one. Rather than having these numbers in the code you could maybe call it something like this here, which makes grepping through the code a bit easier:
ISA_IRQ_IRQ5 = 5,
Regards,
Stefan
Quoted 4 lines
Thanks,
Phil.
PATCH 5/10 hw/isa: Add the ISA_IRQ_FDC_DEFAULT definition
In reply to Philippe Mathieu-Daudé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.
--- include/hw/isa/isa.h | 1 + hw/block/fdc.c | 4 ++-- hw/sparc64/sun4u.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
include/hw/isa/isa.h +1 -0
@@ -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 };
hw/block/fdc.c +2 -2
@@ -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),
hw/sparc64/sun4u.c +1 -1
@@ -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 ));
Signature · 1 line
2.26.2
Re: [PATCH 05/10] hw/isa: Add the ISA_IRQ_FDC_DEFAULT definition
Quoted 7 lines · Philippe Mathieu-Daudé
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é <[email protected]>
PATCH 6/10 hw/isa: Add the ISA_IRQ_PAR_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe parallel port uses IRQ #7 by default. Add this default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + hw/char/parallel.c | 2 +- hw/sparc64/sun4u.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
include/hw/isa/isa.h +1 -0
@@ -13,6 +13,7 @@ enum IsaIrqNumber {ISA_IRQ_SER_DEFAULT =4 ,ISA_IRQ_TPM_DEFAULT =5 ,ISA_IRQ_FDC_DEFAULT =6 , +ISA_IRQ_PAR_DEFAULT =7 , ISA_NUM_IRQS = 16 };
hw/char/parallel.c +1 -1
@@ -636,7 +636,7 @@ bool parallel_mm_init(MemoryRegion *address_space,static Property parallel_isa_properties[] = {DEFINE_PROP_UINT32 ("index" , ISAParallelState, index,-1 ),DEFINE_PROP_UINT32 ("iobase" , ISAParallelState, iobase,-1 ), -DEFINE_PROP_UINT32 ("irq" , ISAParallelState, isairq,7 ), +DEFINE_PROP_UINT32 ("irq" , ISAParallelState, isairq,ISA_IRQ_PAR_DEFAULT ),DEFINE_PROP_CHR ("chardev" , ISAParallelState, state.chr),DEFINE_PROP_END_OF_LIST (), };
hw/sparc64/sun4u.c +1 -1
@@ -611,7 +611,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,pci_realize_and_unref (ebus, pci_busA, &error_fatal);/* Wire up "well-known" ISA IRQs to PBM legacy obio IRQs */ -qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,7 , +qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,ISA_IRQ_PAR_DEFAULT ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_LPT_IRQ ));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 ));
Signature · 1 line
2.26.2
PATCH 7/10 hw/isa: Add the ISA_IRQ_RTC_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe RTC time keep clock ses IRQ #8 by default. Add this default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + include/hw/rtc/mc146818rtc.h | 1 - hw/isa/piix4.c | 2 +- hw/rtc/m48t59-isa.c | 2 +- hw/rtc/mc146818rtc.c | 4 ++-- hw/timer/hpet.c | 8 ++++---- tests/qtest/rtc-test.c | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-)
include/hw/isa/isa.h +1 -0
@@ -14,6 +14,7 @@ enum IsaIrqNumber {ISA_IRQ_TPM_DEFAULT =5 ,ISA_IRQ_FDC_DEFAULT =6 ,ISA_IRQ_PAR_DEFAULT =7 , +ISA_IRQ_RTC_DEFAULT =8 , ISA_NUM_IRQS = 16 };
include/hw/rtc/mc146818rtc.h +0 -1
@@ -47,7 +47,6 @@ struct RTCState {QLIST_ENTRY (RTCState) link; }; -#define RTC_ISA_IRQ 8#define RTC_ISA_BASE 0x70 ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
hw/isa/piix4.c +1 -1
@@ -185,7 +185,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp)if (!qdev_realize (DEVICE (&s->rtc),BUS (isa_bus), errp)) {return ; } -isa_init_irq (ISA_DEVICE (&s->rtc), &s->rtc.irq,RTC_ISA_IRQ ); +isa_init_irq (ISA_DEVICE (&s->rtc), &s->rtc.irq,ISA_IRQ_RTC_DEFAULT ); piix4_dev = dev; }
hw/rtc/m48t59-isa.c +1 -1
@@ -124,7 +124,7 @@ static void m48t59_isa_realize(DeviceState *dev, Error **errp) s->model = u->info.model; s->size = u->info.size; -isa_init_irq (isadev, &s->IRQ,8 ); +isa_init_irq (isadev, &s->IRQ,ISA_IRQ_RTC_DEFAULT );m48t59_realize_common (s, errp);memory_region_init_io (&d->io,OBJECT (dev), &m48t59_io_ops, s,"m48t59" ,4 );if (d->io_base !=0 ) {
hw/rtc/mc146818rtc.c +2 -2
@@ -981,7 +981,7 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)if (intercept_irq) {qdev_connect_gpio_out (dev,0 , intercept_irq); }else { -isa_connect_gpio_out (isadev,0 ,RTC_ISA_IRQ ); +isa_connect_gpio_out (isadev,0 ,ISA_IRQ_RTC_DEFAULT ); } object_property_add_alias(qdev_get_machine(), "rtc-time", OBJECT(isadev),
@@ -1020,7 +1020,7 @@ static void rtc_build_aml(ISADevice *isadev, Aml *scope) crs =aml_resource_template ();aml_append (crs,aml_io (AML_DECODE16 ,RTC_ISA_BASE ,RTC_ISA_BASE ,0x01 ,0x08 )); -aml_append (crs,aml_irq_no_flags (RTC_ISA_IRQ )); +aml_append (crs,aml_irq_no_flags (ISA_IRQ_RTC_DEFAULT )); dev =aml_device ("RTC" );aml_append (dev,aml_name_decl ("_HID" ,aml_eisaid ("PNP0B00" )));
hw/timer/hpet.c +4 -4
@@ -196,7 +196,7 @@ static void update_irq(struct HPETTimer *timer, int set)* timer0 be routed to IRQ0 in NON-APIC or IRQ2 in the I/O APIC, * timer1 be routed to IRQ8 in NON-APIC or IRQ8 in the I/O APIC. */ - route = (timer->tn ==0 ) ?0 :RTC_ISA_IRQ ; + route = (timer->tn ==0 ) ?0 :ISA_IRQ_RTC_DEFAULT ; }else { route =timer_int_route (timer); }
@@ -615,11 +615,11 @@ static void hpet_ram_write(void *opaque, hwaddr addr,if (activating_bit (old_val, new_val,HPET_CFG_LEGACY )) {qemu_set_irq (s->pit_enabled,0 );qemu_irq_lower (s->irqs[0 ]); -qemu_irq_lower (s->irqs[RTC_ISA_IRQ ]); +qemu_irq_lower (s->irqs[ISA_IRQ_RTC_DEFAULT ]); }else if (deactivating_bit (old_val, new_val,HPET_CFG_LEGACY )) {qemu_irq_lower (s->irqs[0 ]);qemu_set_irq (s->pit_enabled,1 ); -qemu_set_irq (s->irqs[RTC_ISA_IRQ ], s->rtc_irq_level); +qemu_set_irq (s->irqs[ISA_IRQ_RTC_DEFAULT ], s->rtc_irq_level); }break ;case HPET_CFG +4 :
@@ -711,7 +711,7 @@ static void hpet_handle_legacy_irq(void *opaque, int n, int level) }else { s->rtc_irq_level = level;if (!hpet_in_legacy_mode (s)) { -qemu_set_irq (s->irqs[RTC_ISA_IRQ ], level); +qemu_set_irq (s->irqs[ISA_IRQ_RTC_DEFAULT ], level); } } }
tests/qtest/rtc-test.c +4 -4
@@ -278,7 +278,7 @@ static void alarm_time(void)/* set DEC mode */ cmos_write (RTC_REG_B ,REG_B_24H |REG_B_DM ); -g_assert (!get_irq (RTC_ISA_IRQ )); +g_assert (!get_irq (ISA_IRQ_RTC_DEFAULT ));cmos_read (RTC_REG_C ); now.tm_sec = (now.tm_sec +2 ) %60 ;
@@ -288,14 +288,14 @@ static void alarm_time(void)cmos_write (RTC_REG_B ,cmos_read (RTC_REG_B ) |REG_B_AIE );for (i =0 ; i <2 + wiggle; i++) { -if (get_irq (RTC_ISA_IRQ )) { +if (get_irq (ISA_IRQ_RTC_DEFAULT )) {break ; }clock_step (1000000000 ); } -g_assert (get_irq (RTC_ISA_IRQ )); +g_assert (get_irq (ISA_IRQ_RTC_DEFAULT ));g_assert ((cmos_read (RTC_REG_C ) ®_C_AF ) !=0 );g_assert (cmos_read (RTC_REG_C ) ==0 ); }
@@ -645,7 +645,7 @@ static void uip_stuck(void)static uint64_t wait_periodic_interrupt (uint64_t real_time) { -while (!get_irq (RTC_ISA_IRQ )) { +while (!get_irq (ISA_IRQ_RTC_DEFAULT )) { real_time =clock_step_next (); }
Signature · 1 line
2.26.2
PATCH 8/10 hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
In reply to Philippe Mathieu-Daudé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.
--- include/hw/isa/isa.h | 1 + hw/net/ne2000-isa.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/isa/isa.h +1 -0
@@ -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 };
hw/net/ne2000-isa.c +1 -1
@@ -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 (), };
Signature · 1 line
2.26.2
Re: [PATCH 08/10] hw/isa: Add the ISA_IRQ_NET_DEFAULT definition
Quoted 2 lines · Philippe Mathieu-Daudé
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
Quoted 7 lines · Gerd Hoffmann
Quoted 2 lines · Philippe Mathieu-Daudé
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
In reply to Gerd HoffmannQuoted 6 lines · Gerd Hoffmann
Quoted 2 lines · Philippe Mathieu-Daudé
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
Quoted 4 lines
take care,
Gerd
PATCH 9/10 hw/isa: Add the ISA_IRQ_MOU_DEFAULT definition
In reply to Philippe Mathieu-DaudéThe PS2 mouse uses IRQ #12 by default. Add this
default definition to the IsaIrqNumber enum.
Avoid magic values in the code, replace them by the newly introduced definition.
--- include/hw/isa/isa.h | 1 + hw/input/pckbd.c | 2 +- hw/sparc64/sun4u.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
include/hw/isa/isa.h +1 -0
@@ -16,6 +16,7 @@ enum IsaIrqNumber {ISA_IRQ_PAR_DEFAULT =7 ,ISA_IRQ_RTC_DEFAULT =8 ,ISA_IRQ_NET_DEFAULT =9 , +ISA_IRQ_MOU_DEFAULT =12 , ISA_NUM_IRQS = 16 };
hw/input/pckbd.c +1 -1
@@ -577,7 +577,7 @@ static void i8042_build_aml(ISADevice *isadev, Aml *scope)aml_append (kbd,aml_name_decl ("_CRS" , crs)); crs =aml_resource_template (); -aml_append (crs,aml_irq_no_flags (12 )); +aml_append (crs,aml_irq_no_flags (ISA_IRQ_MOU_DEFAULT )); mou =aml_device ("MOU" );aml_append (mou,aml_name_decl ("_HID" ,aml_eisaid ("PNP0F13" )));
hw/sparc64/sun4u.c +1 -1
@@ -617,7 +617,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, 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 )); -qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,12 , +qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,ISA_IRQ_MOU_DEFAULT ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_MSE_IRQ ));qdev_connect_gpio_out_named (DEVICE (ebus),"isa-irq" ,ISA_IRQ_SER_DEFAULT ,qdev_get_gpio_in_named (DEVICE (sabre),"pbm-irq" ,OBIO_SER_IRQ ));
Signature · 1 line
2.26.2
PATCH 10/10 hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
In reply to Philippe Mathieu-Daudé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.
--- include/hw/isa/isa.h | 1 + hw/ide/isa.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/isa/isa.h +1 -0
@@ -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 };
hw/ide/isa.c +1 -1
@@ -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 (), };
Signature · 1 line
2.26.2
Re: [PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
Quoted 30 lines · Philippe Mathieu-Daudé
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é <[email protected]>--- include/hw/isa/isa.h | 1 + hw/ide/isa.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)include/hw/isa/isa.h +1
-0@@ -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 };hw/ide/isa.c +0
-0
hw/ide/isa.c ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, · line 114
Quoted 8 lines
hw/ide/isa.c +1
-1@@ -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 (), };
Re: [PATCH 10/10] hw/isa: Add the ISA_IRQ_IDE_DEFAULT definition
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
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