Re: [PATCH 3/3] arch/tile: tilegx PCI root complex support

From: Arnd Bergmann
Date: Tue Apr 10 2012 - 06:43:21 EST


On Tuesday 10 April 2012, Bjorn Helgaas wrote:
> > + if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {
> > + /*
> > + * For bridges, we enable both memory and I/O decoding
> > + * in call cases.
> > + */
> > + cmd |= PCI_COMMAND_IO;
> > + cmd |= PCI_COMMAND_MEMORY;
> > + } else {
> > + /*
> > + * For endpoints, we enable memory and/or I/O decoding
> > + * only if they have a memory resource of that type.
> > + */
> > + for (i = 0; i < 6; i++) {
> > + r = &dev->resource[i];
> > + if (r->flags & IORESOURCE_UNSET) {
> > + pr_err("PCI: Device %s not available "
> > + "because of resource collisions\n",
> > + pci_name(dev));
> > + return -EINVAL;
> > + }
> > + if (r->flags & IORESOURCE_IO)
> > + cmd |= PCI_COMMAND_IO;
> > + if (r->flags & IORESOURCE_MEM)
> > + cmd |= PCI_COMMAND_MEMORY;
> > + }
>
> It would be nice if you could use pci_enable_resources() here, though
> you use IORESOURCE_UNSET here, while pci_enable_resources() does not.
> But you could at least use PCI_NUM_RESOURCES and "mask." There's
> nothing fundamentally architecture-dependent here, so I'd like to move
> toward a generic implementation.

Note that if tile does not support I/O space as indicated, it should
never enable PCI_COMMAND_IO.

Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/