Home | History | Annotate | Line # | Download | only in pci
pci_6600.c revision 1.8.2.3
      1  1.8.2.3  nathanw /* $NetBSD: pci_6600.c,v 1.8.2.3 2002/10/18 02:34:22 nathanw Exp $ */
      2  1.8.2.2  nathanw 
      3  1.8.2.2  nathanw /*-
      4  1.8.2.2  nathanw  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
      5  1.8.2.2  nathanw  *
      6  1.8.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
      7  1.8.2.2  nathanw  * modification, are permitted provided that the following conditions
      8  1.8.2.2  nathanw  * are met:
      9  1.8.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     10  1.8.2.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     11  1.8.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.8.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     13  1.8.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     14  1.8.2.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     15  1.8.2.2  nathanw  *    must display the following acknowledgement:
     16  1.8.2.2  nathanw  *	This product includes software developed by Ross Harvey.
     17  1.8.2.2  nathanw  * 4. The name of Ross Harvey may not be used to endorse or promote products
     18  1.8.2.2  nathanw  *    derived from this software without specific prior written permission.
     19  1.8.2.2  nathanw  *
     20  1.8.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY ROSS HARVEY ``AS IS'' AND ANY EXPRESS
     21  1.8.2.2  nathanw  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     22  1.8.2.2  nathanw  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP0SE
     23  1.8.2.2  nathanw  * ARE DISCLAIMED.  IN NO EVENT SHALL ROSS HARVEY BE LIABLE FOR ANY
     24  1.8.2.2  nathanw  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25  1.8.2.2  nathanw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26  1.8.2.2  nathanw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  1.8.2.2  nathanw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28  1.8.2.2  nathanw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29  1.8.2.2  nathanw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30  1.8.2.2  nathanw  * SUCH DAMAGE.
     31  1.8.2.2  nathanw  *
     32  1.8.2.2  nathanw  */
     33  1.8.2.2  nathanw 
     34  1.8.2.2  nathanw #include <sys/cdefs.h>
     35  1.8.2.2  nathanw 
     36  1.8.2.3  nathanw __KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.8.2.3 2002/10/18 02:34:22 nathanw Exp $");
     37  1.8.2.2  nathanw 
     38  1.8.2.2  nathanw #include <sys/param.h>
     39  1.8.2.2  nathanw #include <sys/systm.h>
     40  1.8.2.2  nathanw #include <sys/kernel.h>
     41  1.8.2.2  nathanw #include <sys/device.h>
     42  1.8.2.2  nathanw #include <sys/malloc.h>
     43  1.8.2.2  nathanw 
     44  1.8.2.2  nathanw #include <uvm/uvm_extern.h>
     45  1.8.2.2  nathanw 
     46  1.8.2.2  nathanw #include <machine/autoconf.h>
     47  1.8.2.2  nathanw #define _ALPHA_BUS_DMA_PRIVATE
     48  1.8.2.2  nathanw #include <machine/bus.h>
     49  1.8.2.2  nathanw #include <machine/rpb.h>
     50  1.8.2.2  nathanw #include <machine/alpha.h>
     51  1.8.2.2  nathanw 
     52  1.8.2.2  nathanw #include <dev/pci/pcireg.h>
     53  1.8.2.2  nathanw #include <dev/pci/pcivar.h>
     54  1.8.2.2  nathanw #include <dev/pci/pciidereg.h>
     55  1.8.2.2  nathanw #include <dev/pci/pciidevar.h>
     56  1.8.2.2  nathanw 
     57  1.8.2.2  nathanw #include <alpha/pci/tsreg.h>
     58  1.8.2.2  nathanw #include <alpha/pci/tsvar.h>
     59  1.8.2.2  nathanw #include <alpha/pci/pci_6600.h>
     60  1.8.2.2  nathanw 
     61  1.8.2.2  nathanw #define pci_6600() { Generate ctags(1) key. }
     62  1.8.2.2  nathanw 
     63  1.8.2.2  nathanw #include "sio.h"
     64  1.8.2.2  nathanw #if NSIO
     65  1.8.2.2  nathanw #include <alpha/pci/siovar.h>
     66  1.8.2.2  nathanw #endif
     67  1.8.2.2  nathanw 
     68  1.8.2.2  nathanw #define	PCI_NIRQ		64
     69  1.8.2.2  nathanw #define	PCI_STRAY_MAX		5
     70  1.8.2.2  nathanw 
     71  1.8.2.2  nathanw /*
     72  1.8.2.2  nathanw  * Some Tsunami models have a PCI device (the USB controller) with interrupts
     73  1.8.2.2  nathanw  * tied to ISA IRQ lines.  The IRQ is encoded as:
     74  1.8.2.2  nathanw  *
     75  1.8.2.2  nathanw  *	line = 0xe0 | isa_irq;
     76  1.8.2.2  nathanw  */
     77  1.8.2.2  nathanw #define	DEC_6600_LINE_IS_ISA(line)	((line) >= 0xe0 && (line) <= 0xef)
     78  1.8.2.2  nathanw #define	DEC_6600_LINE_ISA_IRQ(line)	((line) & 0x0f)
     79  1.8.2.2  nathanw 
     80  1.8.2.2  nathanw static char *irqtype = "6600 irq";
     81  1.8.2.2  nathanw static struct tsp_config *sioprimary;
     82  1.8.2.2  nathanw 
     83  1.8.2.2  nathanw void dec_6600_intr_disestablish __P((void *, void *));
     84  1.8.2.2  nathanw void *dec_6600_intr_establish __P((
     85  1.8.2.2  nathanw     void *, pci_intr_handle_t, int, int (*func)(void *), void *));
     86  1.8.2.2  nathanw const char *dec_6600_intr_string __P((void *, pci_intr_handle_t));
     87  1.8.2.2  nathanw const struct evcnt *dec_6600_intr_evcnt __P((void *, pci_intr_handle_t));
     88  1.8.2.2  nathanw int dec_6600_intr_map __P((struct pci_attach_args *, pci_intr_handle_t *));
     89  1.8.2.2  nathanw void *dec_6600_pciide_compat_intr_establish __P((void *, struct device *,
     90  1.8.2.2  nathanw     struct pci_attach_args *, int, int (*)(void *), void *));
     91  1.8.2.2  nathanw 
     92  1.8.2.2  nathanw struct alpha_shared_intr *dec_6600_pci_intr;
     93  1.8.2.2  nathanw 
     94  1.8.2.2  nathanw void dec_6600_iointr __P((void *arg, unsigned long vec));
     95  1.8.2.2  nathanw extern void dec_6600_intr_enable __P((int irq));
     96  1.8.2.2  nathanw extern void dec_6600_intr_disable __P((int irq));
     97  1.8.2.2  nathanw 
     98  1.8.2.2  nathanw void
     99  1.8.2.2  nathanw pci_6600_pickintr(pcp)
    100  1.8.2.2  nathanw 	struct tsp_config *pcp;
    101  1.8.2.2  nathanw {
    102  1.8.2.2  nathanw 	bus_space_tag_t iot = &pcp->pc_iot;
    103  1.8.2.2  nathanw 	pci_chipset_tag_t pc = &pcp->pc_pc;
    104  1.8.2.2  nathanw 	char *cp;
    105  1.8.2.2  nathanw 	int i;
    106  1.8.2.2  nathanw 
    107  1.8.2.2  nathanw         pc->pc_intr_v = pcp;
    108  1.8.2.2  nathanw         pc->pc_intr_map = dec_6600_intr_map;
    109  1.8.2.2  nathanw         pc->pc_intr_string = dec_6600_intr_string;
    110  1.8.2.2  nathanw 	pc->pc_intr_evcnt = dec_6600_intr_evcnt;
    111  1.8.2.2  nathanw         pc->pc_intr_establish = dec_6600_intr_establish;
    112  1.8.2.2  nathanw         pc->pc_intr_disestablish = dec_6600_intr_disestablish;
    113  1.8.2.2  nathanw 	pc->pc_pciide_compat_intr_establish = NULL;
    114  1.8.2.2  nathanw 
    115  1.8.2.2  nathanw 	/*
    116  1.8.2.2  nathanw 	 * System-wide and Pchip-0-only logic...
    117  1.8.2.2  nathanw 	 */
    118  1.8.2.2  nathanw 	if (dec_6600_pci_intr == NULL) {
    119  1.8.2.2  nathanw 		sioprimary = pcp;
    120  1.8.2.2  nathanw 		pc->pc_pciide_compat_intr_establish =
    121  1.8.2.2  nathanw 		    dec_6600_pciide_compat_intr_establish;
    122  1.8.2.2  nathanw 		dec_6600_pci_intr = alpha_shared_intr_alloc(PCI_NIRQ, 8);
    123  1.8.2.2  nathanw 		for (i = 0; i < PCI_NIRQ; i++) {
    124  1.8.2.2  nathanw 			alpha_shared_intr_set_maxstrays(dec_6600_pci_intr, i,
    125  1.8.2.2  nathanw 			    PCI_STRAY_MAX);
    126  1.8.2.2  nathanw 			alpha_shared_intr_set_private(dec_6600_pci_intr, i,
    127  1.8.2.2  nathanw 			    sioprimary);
    128  1.8.2.2  nathanw 
    129  1.8.2.2  nathanw 			cp = alpha_shared_intr_string(dec_6600_pci_intr, i);
    130  1.8.2.2  nathanw 			sprintf(cp, "irq %d", i);
    131  1.8.2.2  nathanw 			evcnt_attach_dynamic(alpha_shared_intr_evcnt(
    132  1.8.2.2  nathanw 			    dec_6600_pci_intr, 1), EVCNT_TYPE_INTR, NULL,
    133  1.8.2.2  nathanw 			    "dec_6600", cp);
    134  1.8.2.2  nathanw 		}
    135  1.8.2.2  nathanw #if NSIO
    136  1.8.2.2  nathanw 		sio_intr_setup(pc, iot);
    137  1.8.2.2  nathanw 		dec_6600_intr_enable(55);	/* irq line for sio */
    138  1.8.2.2  nathanw #endif
    139  1.8.2.2  nathanw 	}
    140  1.8.2.2  nathanw }
    141  1.8.2.2  nathanw 
    142  1.8.2.2  nathanw int
    143  1.8.2.2  nathanw dec_6600_intr_map(pa, ihp)
    144  1.8.2.2  nathanw 	struct pci_attach_args *pa;
    145  1.8.2.2  nathanw         pci_intr_handle_t *ihp;
    146  1.8.2.2  nathanw {
    147  1.8.2.2  nathanw 	pcitag_t bustag = pa->pa_intrtag;
    148  1.8.2.2  nathanw 	int buspin = pa->pa_intrpin, line = pa->pa_intrline;
    149  1.8.2.2  nathanw 	pci_chipset_tag_t pc = pa->pa_pc;
    150  1.8.2.2  nathanw 	int bus, device, function;
    151  1.8.2.2  nathanw 
    152  1.8.2.2  nathanw 	if (buspin == 0) {
    153  1.8.2.2  nathanw 		/* No IRQ used. */
    154  1.8.2.2  nathanw 		return 1;
    155  1.8.2.2  nathanw 	}
    156  1.8.2.2  nathanw 	if (buspin > 4) {
    157  1.8.2.2  nathanw 		printf("intr_map: bad interrupt pin %d\n", buspin);
    158  1.8.2.2  nathanw 		return 1;
    159  1.8.2.2  nathanw 	}
    160  1.8.2.2  nathanw 
    161  1.8.2.2  nathanw 	pci_decompose_tag(pc, bustag, &bus, &device, &function);
    162  1.8.2.2  nathanw 
    163  1.8.2.2  nathanw 	/*
    164  1.8.2.2  nathanw 	 * The console places the interrupt mapping in the "line" value.
    165  1.8.2.2  nathanw 	 * A value of (char)-1 indicates there is no mapping.
    166  1.8.2.2  nathanw 	 */
    167  1.8.2.2  nathanw 	if (line == 0xff) {
    168  1.8.2.2  nathanw 		printf("dec_6600_intr_map: no mapping for %d/%d/%d\n",
    169  1.8.2.2  nathanw 		    bus, device, function);
    170  1.8.2.2  nathanw 		return (1);
    171  1.8.2.2  nathanw 	}
    172  1.8.2.2  nathanw 
    173  1.8.2.2  nathanw #if NSIO == 0
    174  1.8.2.2  nathanw 	if (DEC_6600_LINE_IS_ISA(line)) {
    175  1.8.2.2  nathanw 		printf("dec_6600_intr_map: ISA IRQ %d for %d/%d/%d\n",
    176  1.8.2.2  nathanw 		    DEC_6600_LINE_ISA_IRQ(line), bus, device, function);
    177  1.8.2.2  nathanw 		return (1);
    178  1.8.2.2  nathanw 	}
    179  1.8.2.2  nathanw #endif
    180  1.8.2.2  nathanw 
    181  1.8.2.2  nathanw 	if (DEC_6600_LINE_IS_ISA(line) == 0 && line >= PCI_NIRQ)
    182  1.8.2.3  nathanw 		panic("dec_6600_intr_map: dec 6600 irq too large (%d)",
    183  1.8.2.2  nathanw 		    line);
    184  1.8.2.2  nathanw 
    185  1.8.2.2  nathanw 	*ihp = line;
    186  1.8.2.2  nathanw 	return (0);
    187  1.8.2.2  nathanw }
    188  1.8.2.2  nathanw 
    189  1.8.2.2  nathanw const char *
    190  1.8.2.2  nathanw dec_6600_intr_string(acv, ih)
    191  1.8.2.2  nathanw 	void *acv;
    192  1.8.2.2  nathanw 	pci_intr_handle_t ih;
    193  1.8.2.2  nathanw {
    194  1.8.2.2  nathanw 
    195  1.8.2.2  nathanw 	static const char irqfmt[] = "dec 6600 irq %ld";
    196  1.8.2.2  nathanw 	static char irqstr[sizeof irqfmt];
    197  1.8.2.2  nathanw 
    198  1.8.2.2  nathanw #if NSIO
    199  1.8.2.2  nathanw 	if (DEC_6600_LINE_IS_ISA(ih))
    200  1.8.2.2  nathanw 		return (sio_intr_string(NULL /*XXX*/,
    201  1.8.2.2  nathanw 		    DEC_6600_LINE_ISA_IRQ(ih)));
    202  1.8.2.2  nathanw #endif
    203  1.8.2.2  nathanw 
    204  1.8.2.2  nathanw 	snprintf(irqstr, sizeof irqstr, irqfmt, ih);
    205  1.8.2.2  nathanw 	return (irqstr);
    206  1.8.2.2  nathanw }
    207  1.8.2.2  nathanw 
    208  1.8.2.2  nathanw const struct evcnt *
    209  1.8.2.2  nathanw dec_6600_intr_evcnt(acv, ih)
    210  1.8.2.2  nathanw 	void *acv;
    211  1.8.2.2  nathanw 	pci_intr_handle_t ih;
    212  1.8.2.2  nathanw {
    213  1.8.2.2  nathanw 
    214  1.8.2.2  nathanw #if NSIO
    215  1.8.2.2  nathanw 	if (DEC_6600_LINE_IS_ISA(ih))
    216  1.8.2.2  nathanw 		return (sio_intr_evcnt(NULL /*XXX*/,
    217  1.8.2.2  nathanw 		    DEC_6600_LINE_ISA_IRQ(ih)));
    218  1.8.2.2  nathanw #endif
    219  1.8.2.2  nathanw 
    220  1.8.2.2  nathanw 	return (alpha_shared_intr_evcnt(dec_6600_pci_intr, ih));
    221  1.8.2.2  nathanw }
    222  1.8.2.2  nathanw 
    223  1.8.2.2  nathanw void *
    224  1.8.2.2  nathanw dec_6600_intr_establish(acv, ih, level, func, arg)
    225  1.8.2.2  nathanw         void *acv, *arg;
    226  1.8.2.2  nathanw         pci_intr_handle_t ih;
    227  1.8.2.2  nathanw         int level;
    228  1.8.2.2  nathanw         int (*func) __P((void *));
    229  1.8.2.2  nathanw {
    230  1.8.2.2  nathanw 	void *cookie;
    231  1.8.2.2  nathanw 
    232  1.8.2.2  nathanw #if NSIO
    233  1.8.2.2  nathanw 	if (DEC_6600_LINE_IS_ISA(ih))
    234  1.8.2.2  nathanw 		return (sio_intr_establish(NULL /*XXX*/,
    235  1.8.2.2  nathanw 		    DEC_6600_LINE_ISA_IRQ(ih), IST_LEVEL, level, func, arg));
    236  1.8.2.2  nathanw #endif
    237  1.8.2.2  nathanw 
    238  1.8.2.2  nathanw 	if (ih >= PCI_NIRQ)
    239  1.8.2.3  nathanw 		panic("dec_6600_intr_establish: bogus dec 6600 IRQ 0x%lx",
    240  1.8.2.2  nathanw 		    ih);
    241  1.8.2.2  nathanw 
    242  1.8.2.2  nathanw 	cookie = alpha_shared_intr_establish(dec_6600_pci_intr, ih, IST_LEVEL,
    243  1.8.2.2  nathanw 	    level, func, arg, irqtype);
    244  1.8.2.2  nathanw 
    245  1.8.2.2  nathanw 	if (cookie != NULL &&
    246  1.8.2.2  nathanw 	    alpha_shared_intr_firstactive(dec_6600_pci_intr, ih)) {
    247  1.8.2.2  nathanw 		scb_set(0x900 + SCB_IDXTOVEC(ih), dec_6600_iointr, NULL);
    248  1.8.2.2  nathanw 		dec_6600_intr_enable(ih);
    249  1.8.2.2  nathanw 	}
    250  1.8.2.2  nathanw 	return (cookie);
    251  1.8.2.2  nathanw }
    252  1.8.2.2  nathanw 
    253  1.8.2.2  nathanw void
    254  1.8.2.2  nathanw dec_6600_intr_disestablish(acv, cookie)
    255  1.8.2.2  nathanw         void *acv, *cookie;
    256  1.8.2.2  nathanw {
    257  1.8.2.2  nathanw 	struct alpha_shared_intrhand *ih = cookie;
    258  1.8.2.2  nathanw 	unsigned int irq = ih->ih_num;
    259  1.8.2.2  nathanw 	int s;
    260  1.8.2.2  nathanw 
    261  1.8.2.2  nathanw #if NSIO
    262  1.8.2.2  nathanw 	/*
    263  1.8.2.2  nathanw 	 * We have to determine if this is an ISA IRQ or not!  We do this
    264  1.8.2.2  nathanw 	 * by checking to see if the intrhand points back to an intrhead
    265  1.8.2.2  nathanw 	 * that points to the sioprimary TSP.  If not, it's an ISA IRQ.
    266  1.8.2.2  nathanw 	 * Pretty disgusting, eh?
    267  1.8.2.2  nathanw 	 */
    268  1.8.2.2  nathanw 	if (ih->ih_intrhead->intr_private != sioprimary) {
    269  1.8.2.2  nathanw 		sio_intr_disestablish(NULL /*XXX*/, cookie);
    270  1.8.2.2  nathanw 		return;
    271  1.8.2.2  nathanw 	}
    272  1.8.2.2  nathanw #endif
    273  1.8.2.2  nathanw 
    274  1.8.2.2  nathanw 	s = splhigh();
    275  1.8.2.2  nathanw 
    276  1.8.2.2  nathanw 	alpha_shared_intr_disestablish(dec_6600_pci_intr, cookie, irqtype);
    277  1.8.2.2  nathanw 	if (alpha_shared_intr_isactive(dec_6600_pci_intr, irq) == 0) {
    278  1.8.2.2  nathanw 		dec_6600_intr_disable(irq);
    279  1.8.2.2  nathanw 		alpha_shared_intr_set_dfltsharetype(dec_6600_pci_intr, irq,
    280  1.8.2.2  nathanw 		    IST_NONE);
    281  1.8.2.2  nathanw 		scb_free(0x900 + SCB_IDXTOVEC(irq));
    282  1.8.2.2  nathanw 	}
    283  1.8.2.2  nathanw 
    284  1.8.2.2  nathanw 	splx(s);
    285  1.8.2.2  nathanw }
    286  1.8.2.2  nathanw 
    287  1.8.2.2  nathanw void
    288  1.8.2.2  nathanw dec_6600_iointr(arg, vec)
    289  1.8.2.2  nathanw 	void *arg;
    290  1.8.2.2  nathanw 	unsigned long vec;
    291  1.8.2.2  nathanw {
    292  1.8.2.2  nathanw 	int irq;
    293  1.8.2.2  nathanw 
    294  1.8.2.2  nathanw 	irq = SCB_VECTOIDX(vec - 0x900);
    295  1.8.2.2  nathanw 
    296  1.8.2.2  nathanw 	if (irq >= PCI_NIRQ)
    297  1.8.2.2  nathanw 		panic("iointr: irq %d is too high", irq);
    298  1.8.2.2  nathanw 
    299  1.8.2.2  nathanw 	if (!alpha_shared_intr_dispatch(dec_6600_pci_intr, irq)) {
    300  1.8.2.2  nathanw 		alpha_shared_intr_stray(dec_6600_pci_intr, irq,
    301  1.8.2.2  nathanw 		    irqtype);
    302  1.8.2.2  nathanw 		if (ALPHA_SHARED_INTR_DISABLE(dec_6600_pci_intr, irq))
    303  1.8.2.2  nathanw 			dec_6600_intr_disable(irq);
    304  1.8.2.2  nathanw 	}
    305  1.8.2.2  nathanw }
    306  1.8.2.2  nathanw 
    307  1.8.2.2  nathanw void
    308  1.8.2.2  nathanw dec_6600_intr_enable(irq)
    309  1.8.2.2  nathanw 	int irq;
    310  1.8.2.2  nathanw {
    311  1.8.2.2  nathanw 	alpha_mb();
    312  1.8.2.2  nathanw 	STQP(TS_C_DIM0) |= 1UL << irq;
    313  1.8.2.2  nathanw 	alpha_mb();
    314  1.8.2.2  nathanw }
    315  1.8.2.2  nathanw 
    316  1.8.2.2  nathanw void
    317  1.8.2.2  nathanw dec_6600_intr_disable(irq)
    318  1.8.2.2  nathanw 	int irq;
    319  1.8.2.2  nathanw {
    320  1.8.2.2  nathanw 	alpha_mb();
    321  1.8.2.2  nathanw 	STQP(TS_C_DIM0) &= ~(1UL << irq);
    322  1.8.2.2  nathanw 	alpha_mb();
    323  1.8.2.2  nathanw }
    324  1.8.2.2  nathanw 
    325  1.8.2.2  nathanw void *
    326  1.8.2.2  nathanw dec_6600_pciide_compat_intr_establish(v, dev, pa, chan, func, arg)
    327  1.8.2.2  nathanw 	void *v;
    328  1.8.2.2  nathanw 	struct device *dev;
    329  1.8.2.2  nathanw 	struct pci_attach_args *pa;
    330  1.8.2.2  nathanw 	int chan;
    331  1.8.2.2  nathanw 	int (*func) __P((void *));
    332  1.8.2.2  nathanw 	void *arg;
    333  1.8.2.2  nathanw {
    334  1.8.2.2  nathanw 	pci_chipset_tag_t pc = pa->pa_pc;
    335  1.8.2.2  nathanw 	void *cookie = NULL;
    336  1.8.2.2  nathanw 	int bus, irq;
    337  1.8.2.2  nathanw 
    338  1.8.2.2  nathanw 	pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
    339  1.8.2.2  nathanw 
    340  1.8.2.2  nathanw 	/*
    341  1.8.2.2  nathanw 	 * If this isn't PCI bus #0 on the TSP that holds the PCI-ISA
    342  1.8.2.2  nathanw 	 * bridge, all bets are off.
    343  1.8.2.2  nathanw 	 */
    344  1.8.2.2  nathanw 	if (bus != 0 || pc->pc_intr_v != sioprimary)
    345  1.8.2.2  nathanw 		return (NULL);
    346  1.8.2.2  nathanw 
    347  1.8.2.2  nathanw 	irq = PCIIDE_COMPAT_IRQ(chan);
    348  1.8.2.2  nathanw #if NSIO
    349  1.8.2.2  nathanw 	cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
    350  1.8.2.2  nathanw 	    func, arg);
    351  1.8.2.2  nathanw 	if (cookie == NULL)
    352  1.8.2.2  nathanw 		return (NULL);
    353  1.8.2.2  nathanw 	printf("%s: %s channel interrupting at %s\n", dev->dv_xname,
    354  1.8.2.2  nathanw 	    PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq));
    355  1.8.2.2  nathanw #endif
    356  1.8.2.2  nathanw 	return (cookie);
    357  1.8.2.2  nathanw }
    358