On 29/06/18 21:10, BALATON Zoltan wrote:
How about changing ob_pci_init() to take a single bus_num int which is the starting bus number and then passing that down into ob_configure_pci_device()? That will allow you to set the correct bus_num for the 0xf2000000 PCI bus which should solve your problem, and also get OpenBIOS a small step closer to multiple PCI bus support.
I don't remember the details by now and don't want to debug this again but AFAIR the problem was not the bus-range but that only one PCI bus appears in the device tree while there are two buses emulated. I think MorphOS checks for up to 3 PCI buses and may not get all info from the device tree apart from addresses but may have some assumptions for other properties so it may not be possible to fix it with a device tree that does not look similar enough to a real Mac. Since only one PCI bus was present in the device tree, when trying to access config registers of bus 1 MorphOS talked to bus 0 instead which of course did not work as devices are on bus 1 and config reg accesses went to bus 0 and got ignored silently because there were no devices on that bus. The devices were still mmio mapped so some of them appeared to work when did not need initialisation but symptoms were failing to setting bus master bit for network card and not finding USB devices that are results of this mismatch between PCI buses. This is fixed by adding an empty/dummy pci bus 0 in the device tree which makes MorphOS notice there are two PCI busses and use the correct one for accessing PCI registers. So there needs to be two PCI buses in the device tree and since devices are on the second one the dummy one needs to be _before_ the second one (this is why I could not patch it from Forth or command line and need this patch).
If you can come up with any other patch to fix this (you can test with the MorphOS demo iso) then I'm fine with that but I could not find any other simple way to make this work without multiple PCI bus support in OpenBIOS but that's too much work I don't have time for. (Since the first PCI bus is empty it should not matter too much what info we have about that in device tree now as nothing should access it really.)
I'm not asking that you implement full multiple PCI bus support for OpenBIOS, just that you try setting bus-range manually to the correct value from a real device tree to see if it makes a difference.
Unfortunately my copy of MorphOS (3.7) in my OpenBIOS test repository never seems to get past the bootloader so I don't have a way to test it myself or know what to look for to know if this has succeeded or not.
ATB,
Mark.