Re: pci_domain_nr vs. /sys/devices

Ivan Kokshaysky
2003-06-17T09:29:09Z

On Tue, Jun 17, 2003 at 02:49:48PM +1000, Anton Blanchard wrote:
> And only creates /proc/bus/pci entries for the first domain.

Err, this definitely breaks X on alpha. On small and mid-range
machines we always have pci_domain_nr(bus) == bus->number.
Practically, it's only Marvel where we could overflow an 8-bit
bus number.

> Finally there was some shuffling required to make pci_bus_exists work
> (passing in a pci_bus *, ->sysdata and ->number must be initialised
> before calling it). There are some uses of pci_bus_exists in x86 that
> will need updating.
>
> Thoungts?

Looks good to me, except this (see above):

> + /* Backwards compatibility for domain 0 only */
> + if (pci_domain_nr(dev->bus) != 0)
> + return 0;

How about this instead?

/* Backwards compatibility for first N PCI domains. */
if (pci_domain_nr(dev->bus) > PCI_PROC_MAX_DOMAIN)
return 0;

PCI_PROC_MAX_DOMAIN could be defined in asm/pci.h (255 on alpha), default 0.

Ivan.