PLEASE REVIEW: Adding a pci_if method to facilitate specialized PCI bus drivers

John Baldwin jhb at FreeBSD.org
Fri Jun 27 10:36:52 PDT 2003


On 13-Jun-2003 Thomas Moestl wrote:
> Hi,
> 
> I've attached a patch that adds a new pci_if method,
> assign_interrupt, and makes the PCI code implement and use
> it. This is private to the PCI bus and is only used internally (to
> find an interrupt of a child device); it is a method so that derived
> PCI bus drivers can override it.
> 
> This is very useful for the sparc64 OFW PCI bus driver which I will
> commit soon, hopefully. On sparc64, there are some on-board devices
> which have special interrupt lines. To route their interrupts, we need
> not only know the device to route for, but also an interrupt index
> which is stored in the firmware for this device, and which is used to
> route on bridges instead of the intpin (in other cases, there's even
> the complete interrupt number stored there; for devices in PCI slots,
> we (usually) can use the intpin).
> 
> This requires us to get this firmware property in the OFW PCI bus
> driver before routing the interrupt; that can't be done in the pcib
> route_interrupt method, since we don't know whether we are routing for
> another bridge (where we use whichever index we get passed) or for a
> child device (in which case we would need to look at the firmware
> property).

Actually, can't you tell this by doing:

        if (device_get_parent(device_get_parent(dev)) == pcib)
                /* Routing direct child. */
        else
                /* Routing descedent of a child bridge. */

-- 

John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


More information about the freebsd-hackers mailing list