On 20/05/2021 08:41, Mark Cave-Ayland wrote:
3) Add a new pci_isa_bridge_get_isabus(PCIDevice *d) function that the devices such
as via-ide can use to obtain a reference to the ISABus from their own PCIDevice. It
should hopefully be quite simple like this:
ISABus *pci_isa_bridge_get_isabus(PCIDevice *d)
{
PCIISABridge *s = PCI_ISA_BRIDGE(d);
return s->isa_bus;
}
Oops - have just realised that PCIDevice in this case is the PCI/ISA device and not
the bridge itself. This means there is a bit more work to do, perhaps something like:
ISABus *pci_device_get_isabus(PCIDevice *d)
{
PCIBus *bus = pci_get_bus(d);
PCIDeviceClass *k;
int devfn;
for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
PCIDevice *pd = bus->devices[devfn];
PCIDeviceClass *k = PCI_DEVICE_GET_CLASS(d);
PCIISABridge *s;
if (object_dynamic_cast(OBJECT(pd), TYPE_PCI_ISA_BRIDGE)) {
s = PCI_ISA_BRIDGE(pd);
return s->isa_bus;
}
}
return NULL;
}
Given that a PCI-ISA bridge effectively manages the bottom part of the single IO
address space then I believe there can only be one PCI-ISA bridge per PCI host
bridge, and therefore bus.
ATB,
Mark.