Re: Enumerating PCI busses and pci_machdep code.

"Nathan J. Williams" <[email protected]> 03 Mar 2006 23:39:55 -0500
Newsgroups gmane.os.netbsd.devel.ports
Organization Wasabi Systems, Inc.
Message-ID <[email protected]>
[email protected] (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