Home | History | Annotate | Line # | Download | only in pci
pci_550.c revision 1.35.2.2
      1  1.35.2.2      yamt /* $NetBSD: pci_550.c,v 1.35.2.2 2014/05/22 11:39:27 yamt Exp $ */
      2       1.1   thorpej 
      3       1.1   thorpej /*-
      4      1.14   thorpej  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
      5       1.1   thorpej  * All rights reserved.
      6       1.1   thorpej  *
      7       1.1   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8       1.3      ross  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9       1.4   thorpej  * NASA Ames Research Center, and by Andrew Gallatin.
     10       1.1   thorpej  *
     11       1.1   thorpej  * Redistribution and use in source and binary forms, with or without
     12       1.1   thorpej  * modification, are permitted provided that the following conditions
     13       1.1   thorpej  * are met:
     14       1.1   thorpej  * 1. Redistributions of source code must retain the above copyright
     15       1.1   thorpej  *    notice, this list of conditions and the following disclaimer.
     16       1.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17       1.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     18       1.1   thorpej  *    documentation and/or other materials provided with the distribution.
     19       1.1   thorpej  *
     20       1.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21       1.1   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22       1.1   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23       1.1   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24       1.1   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25       1.1   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26       1.1   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27       1.1   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28       1.1   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29       1.1   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30       1.1   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     31       1.1   thorpej  */
     32       1.1   thorpej 
     33       1.1   thorpej /*
     34       1.1   thorpej  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
     35       1.1   thorpej  * All rights reserved.
     36       1.1   thorpej  *
     37       1.1   thorpej  * Author: Chris G. Demetriou
     38  1.35.2.1      yamt  *
     39       1.1   thorpej  * Permission to use, copy, modify and distribute this software and
     40       1.1   thorpej  * its documentation is hereby granted, provided that both the copyright
     41       1.1   thorpej  * notice and this permission notice appear in all copies of the
     42       1.1   thorpej  * software, derivative works or modified versions, and any portions
     43       1.1   thorpej  * thereof, and that both notices appear in supporting documentation.
     44  1.35.2.1      yamt  *
     45  1.35.2.1      yamt  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     46  1.35.2.1      yamt  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     47       1.1   thorpej  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     48  1.35.2.1      yamt  *
     49       1.1   thorpej  * Carnegie Mellon requests users of this software to return to
     50       1.1   thorpej  *
     51       1.1   thorpej  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     52       1.1   thorpej  *  School of Computer Science
     53       1.1   thorpej  *  Carnegie Mellon University
     54       1.1   thorpej  *  Pittsburgh PA 15213-3890
     55       1.1   thorpej  *
     56       1.1   thorpej  * any improvements or extensions that they make and grant Carnegie the
     57       1.1   thorpej  * rights to redistribute these changes.
     58       1.1   thorpej  */
     59       1.1   thorpej 
     60       1.1   thorpej #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     61       1.1   thorpej 
     62  1.35.2.2      yamt __KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.35.2.2 2014/05/22 11:39:27 yamt Exp $");
     63       1.1   thorpej 
     64       1.1   thorpej #include <sys/types.h>
     65       1.1   thorpej #include <sys/param.h>
     66       1.1   thorpej #include <sys/time.h>
     67       1.1   thorpej #include <sys/systm.h>
     68       1.1   thorpej #include <sys/errno.h>
     69       1.1   thorpej #include <sys/malloc.h>
     70       1.1   thorpej #include <sys/device.h>
     71       1.1   thorpej #include <sys/syslog.h>
     72       1.1   thorpej 
     73       1.1   thorpej #include <machine/autoconf.h>
     74       1.5   thorpej #include <machine/rpb.h>
     75       1.1   thorpej 
     76       1.1   thorpej #include <dev/pci/pcireg.h>
     77       1.1   thorpej #include <dev/pci/pcivar.h>
     78       1.1   thorpej #include <dev/pci/pciidereg.h>
     79       1.1   thorpej #include <dev/pci/pciidevar.h>
     80       1.1   thorpej 
     81       1.1   thorpej #include <alpha/pci/ciareg.h>
     82       1.1   thorpej #include <alpha/pci/ciavar.h>
     83       1.1   thorpej 
     84       1.1   thorpej #include <alpha/pci/pci_550.h>
     85       1.1   thorpej 
     86       1.1   thorpej #include "sio.h"
     87       1.1   thorpej #if NSIO
     88       1.1   thorpej #include <alpha/pci/siovar.h>
     89       1.1   thorpej #endif
     90       1.1   thorpej 
     91      1.34    dyoung int	dec_550_intr_map(const struct pci_attach_args *,
     92      1.29       dsl 	    pci_intr_handle_t *);
     93  1.35.2.2      yamt const char *dec_550_intr_string(void *, pci_intr_handle_t, char *, size_t);
     94      1.29       dsl const struct evcnt *dec_550_intr_evcnt(void *, pci_intr_handle_t);
     95      1.29       dsl void	*dec_550_intr_establish(void *, pci_intr_handle_t,
     96      1.29       dsl 	    int, int (*func)(void *), void *);
     97      1.29       dsl void	dec_550_intr_disestablish(void *, void *);
     98       1.1   thorpej 
     99      1.35      matt void	*dec_550_pciide_compat_intr_establish(void *, device_t,
    100      1.34    dyoung 	    const struct pci_attach_args *, int, int (*)(void *), void *);
    101       1.1   thorpej 
    102       1.1   thorpej #define	DEC_550_PCI_IRQ_BEGIN	8
    103      1.14   thorpej #define	DEC_550_MAX_IRQ		(64 - DEC_550_PCI_IRQ_BEGIN)
    104      1.10   thorpej 
    105      1.10   thorpej /*
    106      1.10   thorpej  * The Miata has a Pyxis, which seems to have problems with stray
    107      1.10   thorpej  * interrupts.  Work around this by just ignoring strays.
    108      1.10   thorpej  */
    109      1.10   thorpej #define	PCI_STRAY_MAX		0
    110       1.1   thorpej 
    111      1.14   thorpej /*
    112      1.14   thorpej  * Some Miata models, notably models with a Cypress PCI-ISA bridge, have
    113      1.14   thorpej  * a PCI device (the OHCI USB controller) with interrupts tied to ISA IRQ
    114      1.21      ross  * lines.  This IRQ is encoded as: line = FLAG | isa_irq. Usually FLAG
    115      1.21      ross  * is 0xe0, however, it can be 0xf0.  We don't allow 0xf0 | irq15.
    116      1.14   thorpej  */
    117      1.21      ross #define	DEC_550_LINE_IS_ISA(line)	((line) >= 0xe0 && (line) <= 0xfe)
    118      1.14   thorpej #define	DEC_550_LINE_ISA_IRQ(line)	((line) & 0x0f)
    119      1.14   thorpej 
    120       1.1   thorpej struct alpha_shared_intr *dec_550_pci_intr;
    121       1.1   thorpej 
    122      1.29       dsl void	dec_550_iointr(void *arg, unsigned long vec);
    123      1.29       dsl void	dec_550_intr_enable(int irq);
    124      1.29       dsl void	dec_550_intr_disable(int irq);
    125       1.1   thorpej 
    126       1.1   thorpej void
    127      1.30       dsl pci_550_pickintr(struct cia_config *ccp)
    128       1.1   thorpej {
    129       1.1   thorpej 	bus_space_tag_t iot = &ccp->cc_iot;
    130       1.1   thorpej 	pci_chipset_tag_t pc = &ccp->cc_pc;
    131      1.16   thorpej 	char *cp;
    132       1.1   thorpej 	int i;
    133       1.1   thorpej 
    134  1.35.2.1      yamt 	pc->pc_intr_v = ccp;
    135  1.35.2.1      yamt 	pc->pc_intr_map = dec_550_intr_map;
    136  1.35.2.1      yamt 	pc->pc_intr_string = dec_550_intr_string;
    137      1.15       cgd 	pc->pc_intr_evcnt = dec_550_intr_evcnt;
    138  1.35.2.1      yamt 	pc->pc_intr_establish = dec_550_intr_establish;
    139  1.35.2.1      yamt 	pc->pc_intr_disestablish = dec_550_intr_disestablish;
    140       1.1   thorpej 
    141       1.1   thorpej 	pc->pc_pciide_compat_intr_establish =
    142       1.1   thorpej 	    dec_550_pciide_compat_intr_establish;
    143       1.1   thorpej 
    144       1.1   thorpej 	/*
    145       1.1   thorpej 	 * DEC 550's interrupts are enabled via the Pyxis interrupt
    146       1.7   thorpej 	 * mask register.  Nothing to map.
    147       1.1   thorpej 	 */
    148       1.1   thorpej 
    149      1.14   thorpej 	for (i = 0; i < DEC_550_MAX_IRQ; i++)
    150      1.14   thorpej 		dec_550_intr_disable(i);
    151       1.1   thorpej 
    152  1.35.2.2      yamt #define PCI_550_IRQ_STR	8
    153  1.35.2.2      yamt 	dec_550_pci_intr = alpha_shared_intr_alloc(DEC_550_MAX_IRQ,
    154  1.35.2.2      yamt 	    PCI_550_IRQ_STR);
    155      1.14   thorpej 	for (i = 0; i < DEC_550_MAX_IRQ; i++) {
    156       1.1   thorpej 		alpha_shared_intr_set_maxstrays(dec_550_pci_intr, i,
    157      1.14   thorpej 		    PCI_STRAY_MAX);
    158      1.14   thorpej 		alpha_shared_intr_set_private(dec_550_pci_intr, i, ccp);
    159      1.16   thorpej 
    160      1.16   thorpej 		cp = alpha_shared_intr_string(dec_550_pci_intr, i);
    161  1.35.2.2      yamt 		snprintf(cp, PCI_550_IRQ_STR, "irq %d", i);
    162      1.16   thorpej 		evcnt_attach_dynamic(alpha_shared_intr_evcnt(
    163      1.16   thorpej 		    dec_550_pci_intr, i), EVCNT_TYPE_INTR, NULL,
    164      1.16   thorpej 		    "dec_550", cp);
    165      1.14   thorpej 	}
    166       1.1   thorpej 
    167       1.1   thorpej #if NSIO
    168       1.1   thorpej 	sio_intr_setup(pc, iot);
    169       1.1   thorpej #endif
    170       1.1   thorpej }
    171       1.1   thorpej 
    172  1.35.2.1      yamt int
    173      1.34    dyoung dec_550_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
    174       1.1   thorpej {
    175      1.19  sommerfe 	pcitag_t bustag = pa->pa_intrtag;
    176      1.19  sommerfe 	int buspin = pa->pa_intrpin, line = pa->pa_intrline;
    177      1.19  sommerfe 	pci_chipset_tag_t pc = pa->pa_pc;
    178       1.1   thorpej 	int bus, device, function;
    179       1.1   thorpej 
    180       1.1   thorpej 	if (buspin == 0) {
    181       1.1   thorpej 		/* No IRQ used. */
    182       1.1   thorpej 		return 1;
    183       1.1   thorpej 	}
    184       1.1   thorpej 	if (buspin > 4) {
    185       1.1   thorpej 		printf("dec_550_intr_map: bad interrupt pin %d\n", buspin);
    186       1.1   thorpej 		return 1;
    187       1.1   thorpej 	}
    188       1.1   thorpej 
    189      1.23   thorpej 	pci_decompose_tag(pc, bustag, &bus, &device, &function);
    190       1.1   thorpej 
    191       1.1   thorpej 	/*
    192       1.5   thorpej 	 * There are two main variants of Miata: Miata 1 (Intel SIO)
    193       1.5   thorpej 	 * and Miata {1.5,2} (Cypress).
    194       1.5   thorpej 	 *
    195       1.5   thorpej 	 * The Miata 1 has a CMD PCI IDE wired to compatibility mode at
    196       1.5   thorpej 	 * device 4 of bus 0.  This variant apparently also has the
    197       1.5   thorpej 	 * Pyxis DMA bug.
    198       1.5   thorpej 	 *
    199       1.5   thorpej 	 * On the Miata 1.5 and Miata 2, the Cypress PCI-ISA bridge lives
    200       1.5   thorpej 	 * on device 7 of bus 0.  This device has PCI IDE wired to
    201       1.5   thorpej 	 * compatibility mode on functions 1 and 2.
    202       1.5   thorpej 	 *
    203       1.5   thorpej 	 * There will be no interrupt mapping for these devices, so just
    204       1.5   thorpej 	 * bail out now.
    205       1.1   thorpej 	 */
    206       1.5   thorpej 	if (bus == 0) {
    207       1.5   thorpej 		if ((hwrpb->rpb_variation & SV_ST_MASK) < SV_ST_MIATA_1_5) {
    208       1.5   thorpej 			/* Miata 1 */
    209       1.5   thorpej 			if (device == 7)
    210       1.5   thorpej 				panic("dec_550_intr_map: SIO device");
    211       1.5   thorpej 			else if (device == 4)
    212       1.5   thorpej 				return (1);
    213       1.5   thorpej 		} else {
    214       1.5   thorpej 			/* Miata 1.5 or Miata 2 */
    215       1.5   thorpej 			if (device == 7) {
    216       1.5   thorpej 				if (function == 0)
    217       1.5   thorpej 					panic("dec_550_intr_map: SIO device");
    218      1.14   thorpej 				if (function == 1 || function == 2)
    219      1.14   thorpej 					return (1);
    220       1.5   thorpej 			}
    221       1.5   thorpej 		}
    222       1.1   thorpej 	}
    223       1.1   thorpej 
    224       1.1   thorpej 	/*
    225       1.1   thorpej 	 * The console places the interrupt mapping in the "line" value.
    226       1.1   thorpej 	 * A value of (char)-1 indicates there is no mapping.
    227       1.1   thorpej 	 */
    228       1.1   thorpej 	if (line == 0xff) {
    229       1.1   thorpej 		printf("dec_550_intr_map: no mapping for %d/%d/%d\n",
    230       1.1   thorpej 		    bus, device, function);
    231       1.1   thorpej 		return (1);
    232       1.1   thorpej 	}
    233       1.1   thorpej 
    234      1.14   thorpej #if NSIO == 0
    235      1.14   thorpej 	if (DEC_550_LINE_IS_ISA(line)) {
    236      1.14   thorpej 		printf("dec_550_intr_map: ISA IRQ %d for %d/%d/%d\n",
    237      1.14   thorpej 		    DEC_550_LINE_ISA_IRQ(line), bus, device, function);
    238      1.14   thorpej 		return (1);
    239      1.14   thorpej 	}
    240      1.14   thorpej #endif
    241       1.1   thorpej 
    242      1.21      ross 	if (DEC_550_LINE_IS_ISA(line) == 0 && line >= DEC_550_MAX_IRQ) {
    243      1.21      ross 		printf("dec_550_intr_map: irq %d out of range %d/%d/%d\n",
    244      1.21      ross 		    line, bus, device, function);
    245      1.20      ross 		return (1);
    246      1.21      ross 	}
    247       1.1   thorpej 	*ihp = line;
    248       1.1   thorpej 	return (0);
    249       1.1   thorpej }
    250       1.1   thorpej 
    251       1.1   thorpej const char *
    252  1.35.2.2      yamt dec_550_intr_string(void *ccv, pci_intr_handle_t ih, char *buf, size_t len)
    253       1.1   thorpej {
    254       1.1   thorpej #if 0
    255       1.1   thorpej 	struct cia_config *ccp = ccv;
    256       1.1   thorpej #endif
    257       1.1   thorpej 
    258      1.14   thorpej #if NSIO
    259      1.14   thorpej 	if (DEC_550_LINE_IS_ISA(ih))
    260  1.35.2.2      yamt 		return sio_intr_string(NULL /*XXX*/,
    261  1.35.2.2      yamt 		    DEC_550_LINE_ISA_IRQ(ih), buf, len);
    262      1.14   thorpej #endif
    263      1.14   thorpej 
    264       1.1   thorpej 	if (ih >= DEC_550_MAX_IRQ)
    265  1.35.2.2      yamt 		panic("%s: bogus 550 IRQ 0x%lx", __func__, ih);
    266  1.35.2.2      yamt 	snprintf(buf, len, "dec 550 irq %ld", ih);
    267  1.35.2.2      yamt 	return buf;
    268      1.15       cgd }
    269      1.15       cgd 
    270      1.15       cgd const struct evcnt *
    271      1.30       dsl dec_550_intr_evcnt(void *ccv, pci_intr_handle_t ih)
    272      1.15       cgd {
    273      1.15       cgd #if 0
    274      1.15       cgd 	struct cia_config *ccp = ccv;
    275      1.15       cgd #endif
    276      1.15       cgd 
    277      1.15       cgd #if NSIO
    278      1.15       cgd 	if (DEC_550_LINE_IS_ISA(ih))
    279      1.15       cgd 		return (sio_intr_evcnt(NULL /*XXX*/,
    280      1.15       cgd 		    DEC_550_LINE_ISA_IRQ(ih)));
    281      1.15       cgd #endif
    282      1.15       cgd 
    283      1.16   thorpej 	if (ih >= DEC_550_MAX_IRQ)
    284  1.35.2.2      yamt 		panic("%s: bogus 550 IRQ 0x%lx", __func__, ih);
    285      1.16   thorpej 
    286      1.16   thorpej 	return (alpha_shared_intr_evcnt(dec_550_pci_intr, ih));
    287       1.1   thorpej }
    288       1.1   thorpej 
    289       1.1   thorpej void *
    290      1.32       dsl dec_550_intr_establish(void *ccv, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg)
    291       1.1   thorpej {
    292       1.1   thorpej #if 0
    293       1.1   thorpej 	struct cia_config *ccp = ccv;
    294       1.1   thorpej #endif
    295       1.1   thorpej 	void *cookie;
    296       1.1   thorpej 
    297      1.14   thorpej #if NSIO
    298      1.14   thorpej 	if (DEC_550_LINE_IS_ISA(ih))
    299      1.14   thorpej 		return (sio_intr_establish(NULL /*XXX*/,
    300      1.14   thorpej 		    DEC_550_LINE_ISA_IRQ(ih), IST_LEVEL, level, func, arg));
    301      1.14   thorpej #endif
    302      1.14   thorpej 
    303       1.1   thorpej 	if (ih >= DEC_550_MAX_IRQ)
    304      1.24    provos 		panic("dec_550_intr_establish: bogus dec 550 IRQ 0x%lx", ih);
    305       1.1   thorpej 
    306       1.1   thorpej 	cookie = alpha_shared_intr_establish(dec_550_pci_intr, ih, IST_LEVEL,
    307       1.1   thorpej 	    level, func, arg, "dec 550 irq");
    308       1.1   thorpej 
    309      1.22   thorpej 	if (cookie != NULL &&
    310      1.22   thorpej 	    alpha_shared_intr_firstactive(dec_550_pci_intr, ih)) {
    311      1.27        ad 		scb_set(0x900 + SCB_IDXTOVEC(ih), dec_550_iointr, NULL,
    312      1.27        ad 		    level);
    313       1.1   thorpej 		dec_550_intr_enable(ih);
    314      1.22   thorpej 	}
    315       1.1   thorpej 	return (cookie);
    316       1.1   thorpej }
    317       1.1   thorpej 
    318       1.1   thorpej void
    319      1.31       dsl dec_550_intr_disestablish(void *ccv, void *cookie)
    320       1.1   thorpej {
    321       1.1   thorpej 	struct cia_config *ccp = ccv;
    322      1.12   thorpej 	struct alpha_shared_intrhand *ih = cookie;
    323      1.12   thorpej 	unsigned int irq = ih->ih_num;
    324      1.12   thorpej 	int s;
    325      1.14   thorpej 
    326      1.14   thorpej #if NSIO
    327      1.14   thorpej 	/*
    328      1.14   thorpej 	 * We have to determine if this is an ISA IRQ or not!  We do this
    329      1.14   thorpej 	 * by checking to see if the intrhand points back to an intrhead
    330      1.14   thorpej 	 * that points to our cia_config.  If not, it's an ISA IRQ.  Pretty
    331      1.14   thorpej 	 * disgusting, eh?
    332      1.14   thorpej 	 */
    333      1.14   thorpej 	if (ih->ih_intrhead->intr_private != ccp) {
    334      1.14   thorpej 		sio_intr_disestablish(NULL /*XXX*/, cookie);
    335      1.14   thorpej 		return;
    336      1.14   thorpej 	}
    337      1.14   thorpej #endif
    338  1.35.2.1      yamt 
    339      1.12   thorpej 	s = splhigh();
    340      1.12   thorpej 
    341      1.12   thorpej 	alpha_shared_intr_disestablish(dec_550_pci_intr, cookie,
    342      1.12   thorpej 	    "dec 550 irq");
    343      1.12   thorpej 	if (alpha_shared_intr_isactive(dec_550_pci_intr, irq) == 0) {
    344      1.12   thorpej 		dec_550_intr_disable(irq);
    345      1.12   thorpej 		alpha_shared_intr_set_dfltsharetype(dec_550_pci_intr, irq,
    346      1.12   thorpej 		    IST_NONE);
    347      1.22   thorpej 		scb_free(0x900 + SCB_IDXTOVEC(irq));
    348      1.12   thorpej 	}
    349  1.35.2.1      yamt 
    350      1.12   thorpej 	splx(s);
    351       1.1   thorpej }
    352       1.1   thorpej 
    353       1.1   thorpej void *
    354      1.35      matt dec_550_pciide_compat_intr_establish(void *v, device_t dev,
    355      1.34    dyoung     const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
    356       1.1   thorpej {
    357       1.1   thorpej 	pci_chipset_tag_t pc = pa->pa_pc;
    358       1.1   thorpej 	void *cookie = NULL;
    359       1.1   thorpej 	int bus, irq;
    360  1.35.2.2      yamt 	char buf[64];
    361       1.1   thorpej 
    362      1.23   thorpej 	pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
    363       1.1   thorpej 
    364       1.1   thorpej 	/*
    365       1.1   thorpej 	 * If this isn't PCI bus #0, all bets are off.
    366       1.1   thorpej 	 */
    367       1.1   thorpej 	if (bus != 0)
    368       1.1   thorpej 		return (NULL);
    369       1.1   thorpej 
    370       1.1   thorpej 	irq = PCIIDE_COMPAT_IRQ(chan);
    371       1.1   thorpej #if NSIO
    372       1.1   thorpej 	cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
    373       1.1   thorpej 	    func, arg);
    374      1.17   thorpej 	if (cookie == NULL)
    375      1.17   thorpej 		return (NULL);
    376      1.35      matt 	aprint_normal_dev(dev, "%s channel interrupting at %s\n",
    377  1.35.2.2      yamt 	    PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq,
    378  1.35.2.2      yamt 	    buf, sizeof(buf)));
    379       1.1   thorpej #endif
    380       1.1   thorpej 	return (cookie);
    381       1.1   thorpej }
    382       1.1   thorpej 
    383       1.1   thorpej void
    384      1.30       dsl dec_550_iointr(void *arg, unsigned long vec)
    385       1.1   thorpej {
    386  1.35.2.1      yamt 	int irq;
    387       1.1   thorpej 
    388      1.22   thorpej 	irq = SCB_VECTOIDX(vec - 0x900);
    389       1.1   thorpej 
    390      1.22   thorpej 	if (irq >= DEC_550_MAX_IRQ)
    391      1.24    provos 		panic("550_iointr: vec 0x%lx out of range", vec);
    392       1.1   thorpej 
    393      1.22   thorpej 	if (!alpha_shared_intr_dispatch(dec_550_pci_intr, irq)) {
    394      1.22   thorpej 		alpha_shared_intr_stray(dec_550_pci_intr, irq,
    395      1.22   thorpej 		    "dec 550 irq");
    396      1.22   thorpej 		if (ALPHA_SHARED_INTR_DISABLE(dec_550_pci_intr, irq))
    397      1.22   thorpej 			dec_550_intr_disable(irq);
    398      1.25   thorpej 	} else
    399      1.25   thorpej 		alpha_shared_intr_reset_strays(dec_550_pci_intr, irq);
    400       1.1   thorpej }
    401       1.1   thorpej 
    402       1.1   thorpej void
    403      1.30       dsl dec_550_intr_enable(int irq)
    404       1.1   thorpej {
    405       1.1   thorpej 
    406      1.14   thorpej 	cia_pyxis_intr_enable(irq + DEC_550_PCI_IRQ_BEGIN, 1);
    407       1.1   thorpej }
    408       1.1   thorpej 
    409       1.1   thorpej void
    410      1.30       dsl dec_550_intr_disable(int irq)
    411       1.1   thorpej {
    412       1.1   thorpej 
    413      1.14   thorpej 	cia_pyxis_intr_enable(irq + DEC_550_PCI_IRQ_BEGIN, 0);
    414       1.1   thorpej }
    415