Move devfn_min to a member of TyphoonClass and set the
Clipper-specific value, PCI_DEVFN(1, 0), in its subclass init.
Eliminate devfn_min as a parameter of typhoon_init() to enable
its forthcoming split into instance_init and realize hooks.
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
---
hw/alpha/alpha_sys.h | 3 ++-
hw/alpha/dp264.c | 3 ++-
hw/alpha/typhoon.c | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index fdfe96dcb4..cf16e235fb 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -15,11 +15,12 @@ typedef struct TyphoonClass {
PCIHostBridgeClass parent_class;
pci_map_irq_fn sys_map_irq;
+ uint8_t devfn_min;
} TyphoonClass;
OBJECT_DECLARE_TYPE(TyphoonState, TyphoonClass, TYPHOON_PCI_HOST_BRIDGE)
-PCIBus *typhoon_init(uint8_t devfn_min, TyphoonState *);
+PCIBus *typhoon_init(TyphoonState *);
#define TYPHOON_PROP_RAM "ram"
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 8c3c8fec67..de5829a004 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -111,7 +111,7 @@ static void clipper_init(MachineState *machine)
* Init the chipset. Because we're using CLIPPER IRQ mappings,
* the minimum PCI device IdSel is 1.
*/
- pci_bus = typhoon_init(PCI_DEVFN(1, 0), typhoon);
+ pci_bus = typhoon_init(typhoon);
/*
* Init the PCI -> ISA bridge.
@@ -259,6 +259,7 @@ static void typhoon_pcihost_clipper_class_init(ObjectClass *oc,
TyphoonClass *tc = TYPHOON_PCI_HOST_BRIDGE_CLASS(oc);
tc->sys_map_irq = clipper_pci_map_irq;
+ tc->devfn_min = PCI_DEVFN(1, 0);
}
static const TypeInfo clipper_types[] = {
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index b261dd7bc5..ad5010bea8 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -833,7 +833,7 @@ static void typhoon_alarm_timer(void *opaque)
cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER);
}
-PCIBus *typhoon_init(uint8_t devfn_min, TyphoonState *s)
+PCIBus *typhoon_init(TyphoonState *s)
{
TyphoonClass *tc = TYPHOON_PCI_HOST_BRIDGE_GET_CLASS(s);
MemoryRegion *addr_space = get_system_memory();
@@ -903,7 +903,7 @@ PCIBus *typhoon_init(uint8_t devfn_min, TyphoonState *s)
b = pci_register_root_bus(dev, "pci",
typhoon_set_irq, tc->sys_map_irq, s,
&s->pchip.reg_mem, &s->pchip.reg_io,
- devfn_min, 64, TYPE_PCI_BUS);
+ tc->devfn_min, 64, TYPE_PCI_BUS);
phb->bus = b;
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
--
2.53.0