[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 37/42] hw/isa/piix: Rename functions to be shared for interrupt t
From: |
Bernhard Beschow |
Subject: |
[PATCH 37/42] hw/isa/piix: Rename functions to be shared for interrupt triggering |
Date: |
Thu, 1 Sep 2022 18:26:08 +0200 |
PIIX4 will get the same optimizations which are already implemented for
PIIX3.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/isa/piix.c | 56 +++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/hw/isa/piix.c b/hw/isa/piix.c
index af6d920eff..1d516de5cc 100644
--- a/hw/isa/piix.c
+++ b/hw/isa/piix.c
@@ -40,47 +40,47 @@
#define XEN_PIIX_NUM_PIRQS 128ULL
-static void piix3_set_irq_pic(PIIXState *piix3, int pic_irq)
+static void piix_set_irq_pic(PIIXState *piix, int pic_irq)
{
- qemu_set_irq(piix3->pic.in_irqs[pic_irq],
- !!(piix3->pic_levels &
+ qemu_set_irq(piix->pic.in_irqs[pic_irq],
+ !!(piix->pic_levels &
(((1ULL << PIIX_NUM_PIRQS) - 1) <<
(pic_irq * PIIX_NUM_PIRQS))));
}
-static void piix3_set_irq_level_internal(PIIXState *piix3, int pirq, int level)
+static void piix_set_irq_level_internal(PIIXState *piix, int pirq, int level)
{
int pic_irq;
uint64_t mask;
- pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq];
+ pic_irq = piix->dev.config[PIIX_PIRQCA + pirq];
if (pic_irq >= ISA_NUM_IRQS) {
return;
}
mask = 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq);
- piix3->pic_levels &= ~mask;
- piix3->pic_levels |= mask * !!level;
+ piix->pic_levels &= ~mask;
+ piix->pic_levels |= mask * !!level;
}
-static void piix3_set_irq_level(PIIXState *piix3, int pirq, int level)
+static void piix_set_irq_level(PIIXState *piix, int pirq, int level)
{
int pic_irq;
- pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq];
+ pic_irq = piix->dev.config[PIIX_PIRQCA + pirq];
if (pic_irq >= ISA_NUM_IRQS) {
return;
}
- piix3_set_irq_level_internal(piix3, pirq, level);
+ piix_set_irq_level_internal(piix, pirq, level);
- piix3_set_irq_pic(piix3, pic_irq);
+ piix_set_irq_pic(piix, pic_irq);
}
-static void piix3_set_irq(void *opaque, int pirq, int level)
+static void piix_set_irq(void *opaque, int pirq, int level)
{
- PIIXState *piix3 = opaque;
- piix3_set_irq_level(piix3, pirq, level);
+ PIIXState *piix = opaque;
+ piix_set_irq_level(piix, pirq, level);
}
static void piix4_set_irq(void *opaque, int irq_num, int level)
@@ -157,29 +157,29 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void
*opaque, int pin)
}
/* irq routing is changed. so rebuild bitmap */
-static void piix3_update_irq_levels(PIIXState *piix3)
+static void piix_update_irq_levels(PIIXState *piix)
{
- PCIBus *bus = pci_get_bus(&piix3->dev);
+ PCIBus *bus = pci_get_bus(&piix->dev);
int pirq;
- piix3->pic_levels = 0;
+ piix->pic_levels = 0;
for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) {
- piix3_set_irq_level(piix3, pirq, pci_bus_get_irq_level(bus, pirq));
+ piix_set_irq_level(piix, pirq, pci_bus_get_irq_level(bus, pirq));
}
}
-static void piix3_write_config(PCIDevice *dev,
- uint32_t address, uint32_t val, int len)
+static void piix_write_config(PCIDevice *dev, uint32_t address, uint32_t val,
+ int len)
{
pci_default_write_config(dev, address, val, len);
if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) {
- PIIXState *piix3 = PIIX_PCI_DEVICE(dev);
+ PIIXState *piix = PIIX_PCI_DEVICE(dev);
int pic_irq;
- pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev));
- piix3_update_irq_levels(piix3);
+ pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix->dev));
+ piix_update_irq_levels(piix);
for (pic_irq = 0; pic_irq < ISA_NUM_IRQS; pic_irq++) {
- piix3_set_irq_pic(piix3, pic_irq);
+ piix_set_irq_pic(piix, pic_irq);
}
}
}
@@ -201,7 +201,7 @@ static void piix3_write_config_xen(PCIDevice *dev,
}
}
- piix3_write_config(dev, address, val, len);
+ piix_write_config(dev, address, val, len);
}
static void piix_reset(DeviceState *dev)
@@ -261,7 +261,7 @@ static int piix3_post_load(void *opaque, int version_id)
*/
piix3->pic_levels = 0;
for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) {
- piix3_set_irq_level_internal(piix3, pirq,
+ piix_set_irq_level_internal(piix3, pirq,
pci_bus_get_irq_level(pci_get_bus(&piix3->dev), pirq));
}
return 0;
@@ -511,7 +511,7 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
return;
}
- pci_bus_irqs(pci_bus, piix3_set_irq, piix3_pci_slot_get_pirq,
+ pci_bus_irqs(pci_bus, piix_set_irq, piix3_pci_slot_get_pirq,
piix3, PIIX_NUM_PIRQS);
pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq);
}
@@ -520,7 +520,7 @@ static void piix3_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->config_write = piix3_write_config;
+ k->config_write = piix_write_config;
k->realize = piix3_realize;
}
--
2.37.3
- [PATCH 27/42] hw/isa/piix4: Allow board to provide PCI interrupt routes, (continued)
- [PATCH 27/42] hw/isa/piix4: Allow board to provide PCI interrupt routes, Bernhard Beschow, 2022/09/01
- [PATCH 26/42] hw/isa/piix4: Make PIIX4's ACPI and USB functions optional, Bernhard Beschow, 2022/09/01
- [PATCH 25/42] hw/isa/piix4: Move pci_ide_create_devs() call to board code, Bernhard Beschow, 2022/09/01
- [PATCH 35/42] hw/isa/piix: Harmonize names of reset control memory regions, Bernhard Beschow, 2022/09/01
- [PATCH 33/42] hw/isa/piix4: Prefix pci_slot_get_pirq() with "piix4_", Bernhard Beschow, 2022/09/01
- [PATCH 40/42] hw/isa/piix: Share PIIX3 base class with PIIX4, Bernhard Beschow, 2022/09/01
- [PATCH 37/42] hw/isa/piix: Rename functions to be shared for interrupt triggering,
Bernhard Beschow <=
- [PATCH 38/42] hw/isa/piix: Consolidate IRQ triggering, Bernhard Beschow, 2022/09/01
- [PATCH 29/42] hw/isa/piix4: Use ISA PIC device, Bernhard Beschow, 2022/09/01
- [PATCH 36/42] hw/isa/piix: Reuse PIIX3 base class' realize method in PIIX4, Bernhard Beschow, 2022/09/01
- [PATCH 39/42] hw/isa/piix: Unexport PIIXState, Bernhard Beschow, 2022/09/01
- [PATCH 34/42] hw/isa/piix3: Merge hw/isa/piix4.c, Bernhard Beschow, 2022/09/01
- [PATCH 42/42] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller, Bernhard Beschow, 2022/09/01