Subject: Re: Enumerating PCI busses and pci_machdep code.
To: Peter Seebach <seebs@plethora.net>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-ports
Date: 03/03/2006 23:39:55
seebs@plethora.net (Peter Seebach) writes:

> Presumably, there's some way in which I should be able, in pci_intr_map, to
> figure out that the device I've been handed is on a bus which is entirely
> a subset of bus 0, device 17.  But I'm not sure how I should do this; should
> I be grovelling around in busses and parents, or should I be doing something
> entirely different?

In pci_intr_map() you should just be using the value from
pa->pa_intrline. The actual value for pa_intrline should be assigned
by pci_conf_interrupt(), which among its other arguments takes a
"swiz" argument. This argument gives the amount of "swizzling" from
the origin PCI device to the base of the bus; it's calculated in
src/sys/dev/pci/pci_configure.c based on rules from the PCI-PCI bridge
spec. It's essentially a mod-4 rotation of the interrupt lines from
the subsidiary bus to the primary bus.

        - Nathan