pci32 code - early_*config*
Kumar Gala
galak at kernel.crashing.org
Sat Apr 18 03:38:56 EST 2009
On Apr 17, 2009, at 12:05 PM, Benjamin Herrenschmidt wrote:
> On Fri, 2009-04-17 at 09:08 -0500, Kumar Gala wrote:
>> The problem is that the "normal" PCI config access routines need a
>> pci_bus. However we don't have one yet and we need to do PCI config
>> cycles to the PHB before we call the remainder of the setup code to
>> get one.
>>
>> We could all call our own ops directly and provide a fake bus but
>> this
>> is pretty much what the early routines do for us in a common way.
>
> Ah right, slipped out of my mind. Oh well, easy to make the code
> common, move it to pci-common.c
Right, I can do that... In doing so I was wondering two things w/
regards to fake_pci_bus:
1. can we drop the hose == 0 check, it looks like there are 3 users of
the early pci ops code (fsl, 4xx, pmac). The FSL one I can say passes
a valid hose in and it looks like 4xx does as well. The pmac code is
always a bit more trick so I figured you might know
2. Do we believe those hose->ops is always valid -- again FSL & 4xx it
is, pmac??
static struct pci_bus *
fake_pci_bus(struct pci_controller *hose, int busnr)
{
static struct pci_bus bus;
if (hose == 0) {
hose = pci_bus_to_hose(busnr);
if (hose == 0)
printk(KERN_ERR "Can't find hose for PCI bus
%d!\n", busnr);
}
bus.number = busnr;
bus.sysdata = hose;
bus.ops = hose? hose->ops: &null_pci_ops;
return &bus;
}
More information about the Linuxppc-dev
mailing list