[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 09/23] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS
From: |
Bernhard Beschow |
Subject: |
[PATCH v7 09/23] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS |
Date: |
Sun, 12 Feb 2023 13:37:51 +0100 |
PIIX_NUM_PIC_IRQS is assumed to be the same as ISA_NUM_IRQS, otherwise
inconsistencies can occur.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221022150508.26830-21-shentey@gmail.com>
---
include/hw/southbridge/piix.h | 5 ++---
hw/isa/piix3.c | 8 ++++----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index f84a5d15cf..096a85e384 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -31,7 +31,6 @@
*/
#define PIIX_RCR_IOPORT 0xcf9
-#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */
#define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */
struct PIIXState {
@@ -43,10 +42,10 @@ struct PIIXState {
* So one PIC level is tracked by PIIX_NUM_PIRQS bits.
*
* PIRQ is mapped to PIC pins, we track it by
- * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with
+ * PIIX_NUM_PIRQS * ISA_NUM_IRQS = 64 bits with
* pic_irq * PIIX_NUM_PIRQS + pirq
*/
-#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64
+#if ISA_NUM_IRQS * PIIX_NUM_PIRQS > 64
#error "unable to encode pic state in 64bit in pic_levels."
#endif
uint64_t pic_levels;
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index dfdae27daf..55835912b8 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -52,7 +52,7 @@ static void piix3_set_irq_level_internal(PIIX3State *piix3,
int pirq, int level)
uint64_t mask;
pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq];
- if (pic_irq >= PIIX_NUM_PIC_IRQS) {
+ if (pic_irq >= ISA_NUM_IRQS) {
return;
}
@@ -66,7 +66,7 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pirq,
int level)
int pic_irq;
pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq];
- if (pic_irq >= PIIX_NUM_PIC_IRQS) {
+ if (pic_irq >= ISA_NUM_IRQS) {
return;
}
@@ -87,7 +87,7 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque,
int pin)
int irq = piix3->dev.config[PIIX_PIRQCA + pin];
PCIINTxRoute route;
- if (irq < PIIX_NUM_PIC_IRQS) {
+ if (irq < ISA_NUM_IRQS) {
route.mode = PCI_INTX_ENABLED;
route.irq = irq;
} else {
@@ -119,7 +119,7 @@ static void piix3_write_config(PCIDevice *dev,
pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev));
piix3_update_irq_levels(piix3);
- for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) {
+ for (pic_irq = 0; pic_irq < ISA_NUM_IRQS; pic_irq++) {
piix3_set_irq_pic(piix3, pic_irq);
}
}
--
2.39.1
- [PATCH v7 05/23] hw/isa/piix3: Create power management controller in host device, (continued)
- [PATCH v7 05/23] hw/isa/piix3: Create power management controller in host device, Bernhard Beschow, 2023/02/12
- [PATCH v7 03/23] hw/i386/pc_piix: Allow for setting properties before realizing PIIX3 south bridge, Bernhard Beschow, 2023/02/12
- [PATCH v7 16/23] hw/isa/piix4: Create the "intr" property during init() already, Bernhard Beschow, 2023/02/12
- [PATCH v7 13/23] hw/isa/piix4: Make PIIX4's ACPI and USB functions optional, Bernhard Beschow, 2023/02/12
- [PATCH v7 12/23] hw/isa/piix3: Drop the "3" from PIIX base class, Bernhard Beschow, 2023/02/12
- [PATCH v7 19/23] hw/isa/piix: Harmonize names of reset control memory regions, Bernhard Beschow, 2023/02/12
- [PATCH v7 02/23] hw/i386/pc: No need for rtc_state to be an out-parameter, Bernhard Beschow, 2023/02/12
- [PATCH v7 07/23] hw/isa/piix3: Create IDE controller in host device, Bernhard Beschow, 2023/02/12
- [PATCH v7 15/23] hw/isa/piix4: Reuse struct PIIXState from PIIX3, Bernhard Beschow, 2023/02/12
- [PATCH v7 06/23] hw/isa/piix3: Move ISA bus IRQ assignments into host device, Bernhard Beschow, 2023/02/12
- [PATCH v7 09/23] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS,
Bernhard Beschow <=
- [PATCH v7 14/23] hw/isa/piix4: Remove unused inbound ISA interrupt lines, Bernhard Beschow, 2023/02/12
- [PATCH v7 10/23] hw/isa/piix3: Rename pci_piix3_props for sharing with PIIX4, Bernhard Beschow, 2023/02/12
- [PATCH v7 08/23] hw/isa/piix3: Wire up ACPI interrupt internally, Bernhard Beschow, 2023/02/12
- [PATCH v7 17/23] hw/isa/piix4: Rename reset control operations to match PIIX3, Bernhard Beschow, 2023/02/12
- [PATCH v7 20/23] hw/isa/piix: Reuse PIIX3 base class' realize method in PIIX4, Bernhard Beschow, 2023/02/12
- [PATCH v7 22/23] hw/isa/piix: Consolidate IRQ triggering, Bernhard Beschow, 2023/02/12
- [PATCH v7 21/23] hw/isa/piix: Rename functions to be shared for interrupt triggering, Bernhard Beschow, 2023/02/12
- [PATCH v7 18/23] hw/isa/piix3: Merge hw/isa/piix4.c, Bernhard Beschow, 2023/02/12
- [PATCH v7 23/23] hw/isa/piix: Share PIIX3's base class with PIIX4, Bernhard Beschow, 2023/02/12
- Re: [PATCH v7 00/23] Consolidate PIIX south bridges, Bernhard Beschow, 2023/02/23