All PowerMacs supported by Linux/PPC include at least one PCI bus. There are a number of different host bridges that Apple used in their machines, some pure ASICS and others more or less starndard products.
Among the more exotic host bridges are bandit (7x00/8x00/9x00 series, PCI bus), chaos (7x00/8x00 video subsystem) and UNI-North (all recent UMA machines).
Not only do we have to deal with varying hardware, but also with more or less buggy firmware. In addition, the PowerPC lacks the ix86's concept of a separate IO address space, and therefore ISA or PCI IO space on PPC machines is simply a memory-mapped region.
Some PowerMacs have more than one PCI bus, but all but bus 0 would go unnoticed until now, as the existing PCI code only scans bus 0.
Having more than one PCI bus would cause problems as well on IO accesses on the PCI buses, because up to now, there is only one static mapping between the PCI bus' IO region, and the CPU's view of this address space. This translation is done in the IO space access macros, which makes all drivers believe they access an IO port at 0x200, but in reality they might access address 0xf2000200.
This is not a problem in itself, but it is sub-optimal from a performance view, since there's a supplemental add for every IO access. In addition, and the worst point in my opinion, is that this static mapping scheme breaks in the case of multiple PCI buses, where the static translation would only work for one bus. This problem happens on the 9x00 series (two separate PCI buses for 6 slots) and on the UMA machines (three buses on one bridge).
My patches below translate all IO regions to their respective kernel virtual
addresses, and updates the PCI device structs acordingly. This way, all device
drivers see the 'real' kernel virtual address of the IO ports, and since they
are remapped 'en block' via
ioremap(), they can be accessed
The patches below fix the following problems:
against kernel.org 2.2.12
against kernel.org 2.2.15. My previous 2.2.15 patch included some bugs related to the chaos bridge. Also, unassigned memory or IO BARs are now correctly ignored.
against kernel.org 2.2.17. I needed to add this patch for the IDE stuff in order to compile the 2.2.17 kernels.
against kernel.org 2.2.18.
against Paulus' 2.3.51
against Paulus' 2.3.52, without IO translation
against Paulus' 2.3.99-pre3, this includes Geert's dynamic PCI resource allocation patches.
against Paulus' 2.3.99-pre9, this includes Geert's dynamic PCI resource allocation patches. The crashing parts are disabled in this release ;-).
against Paulus' 2.4.0-test6, this includes Geert's dynamic PCI resource allocation patches. The crashing parts are disabled.
Updated: Here is my current patch set including PCI, planb and some controlfb patches.
All above patches are only tested on my PowerMac, and may not work (at best ;-) on other PPC platforms.