pci_bus_for_each_resource, transparent bridges and rsrc_nonstatic.c

Jesse Barnes jbarnes at virtuousgeek.org
Mon Mar 29 12:41:37 EDT 2010


On Sun, 28 Mar 2010 13:45:59 +0200
Dominik Brodowski <linux at dominikbrodowski.net> wrote:

> 
> On Sat, Mar 27, 2010 at 08:03:40PM +0100, Peter Stuge wrote:
> > Dominik Brodowski wrote:
> > > can we safely trust BIOS authors to get it right?
> > 
> > As a long time member of the coreboot project I can assure you that
> > the answer to that is "No!!"
> 
> Thanks. Jesse, Bjorn: recalling my mesage of 22 March 2010, what's your
> opinion on the two options spelled out there:
> 
> | (1) The best way seems to be to skip all resources of type
> | PCI_SUBTRACTIVE_DECODE, but this flag is only stored in
> | struct pci_bus_resource, which is hard to access, and nonexistent for the
> | first four resources. Actually, the "flag" field is unused otherwise. Could
> | we set res->flags |= PCI_SUBTRACTIVE_DECODE instead? (it probably needs to
> | be != 0x1 then, but anyways). Then it's trivial in rsrc_nonstatic.c
> | 
> | (2) An alternative would be to
> |
> | diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
> | index ba3a53e..b0e60a1 100644
> | --- a/drivers/pcmcia/rsrc_nonstatic.c
> | +++ b/drivers/pcmcia/rsrc_nonstatic.c
> | @@ -933,7 +933,8 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
> |                 return -EINVAL;
> |  #endif
> | 
> | -       pci_bus_for_each_resource(s->cb_dev->bus, res, i) {
> | +       for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
> | +               res = s->cb_dev->bus->resource[i];
> |                 if (!res)
> |                         continue;

It would be nice to avoid pushing subtractive decode into the generic
resource code, since it's pretty PCI specific, but the second hunk
looks ok.  Alternatively we could add a field to the bus struct for you
to check.

-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the linux-pcmcia mailing list