Home | History | Annotate | Line # | Download | only in jensenio
      1  1.18   thorpej /* $NetBSD: jensenio_intr.c,v 1.18 2021/07/15 01:43:54 thorpej Exp $ */
      2   1.1   thorpej 
      3   1.1   thorpej /*-
      4   1.1   thorpej  * Copyright (c) 1999, 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.1   thorpej  * by Jason R. Thorpe.
      9   1.1   thorpej  *
     10   1.1   thorpej  * Redistribution and use in source and binary forms, with or without
     11   1.1   thorpej  * modification, are permitted provided that the following conditions
     12   1.1   thorpej  * are met:
     13   1.1   thorpej  * 1. Redistributions of source code must retain the above copyright
     14   1.1   thorpej  *    notice, this list of conditions and the following disclaimer.
     15   1.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17   1.1   thorpej  *    documentation and/or other materials provided with the distribution.
     18   1.1   thorpej  *
     19   1.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1   thorpej  */
     31   1.1   thorpej 
     32   1.1   thorpej #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     33   1.1   thorpej 
     34  1.18   thorpej __KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.18 2021/07/15 01:43:54 thorpej Exp $");
     35   1.1   thorpej 
     36  1.10      matt #include <sys/types.h>
     37  1.10      matt #include <sys/param.h>
     38   1.1   thorpej #include <sys/time.h>
     39   1.1   thorpej #include <sys/systm.h>
     40   1.1   thorpej #include <sys/errno.h>
     41   1.1   thorpej #include <sys/device.h>
     42  1.13   thorpej #include <sys/cpu.h>
     43   1.1   thorpej #include <sys/syslog.h>
     44   1.1   thorpej 
     45   1.1   thorpej #include <machine/autoconf.h>
     46   1.1   thorpej 
     47  1.18   thorpej #include <dev/ic/i8259reg.h>
     48  1.18   thorpej 
     49   1.1   thorpej #include <dev/eisa/eisavar.h>
     50   1.1   thorpej 
     51   1.1   thorpej #include <dev/isa/isareg.h>
     52   1.1   thorpej #include <dev/isa/isavar.h>
     53   1.1   thorpej 
     54   1.1   thorpej #include <alpha/jensenio/jenseniovar.h>
     55   1.1   thorpej 
     56   1.1   thorpej static bus_space_tag_t pic_iot;
     57   1.1   thorpej static bus_space_handle_t pic_ioh[2];
     58   1.1   thorpej static bus_space_handle_t pic_elcr_ioh;
     59   1.1   thorpej 
     60  1.14   thorpej static int		jensenio_eisa_intr_map(void *, u_int,
     61  1.14   thorpej 			    eisa_intr_handle_t *);
     62  1.14   thorpej static const char *	jensenio_eisa_intr_string(void *, int, char *, size_t);
     63  1.14   thorpej static const struct evcnt *jensenio_eisa_intr_evcnt(void *, int);
     64  1.14   thorpej static void *		jensenio_eisa_intr_establish(void *, int, int, int,
     65  1.14   thorpej 			    int (*)(void *), void *);
     66  1.14   thorpej static void		jensenio_eisa_intr_disestablish(void *, void *);
     67  1.14   thorpej static int		jensenio_eisa_intr_alloc(void *, int, int, int *);
     68   1.1   thorpej 
     69   1.3   thorpej #define	JENSEN_MAX_IRQ		16
     70   1.1   thorpej 
     71  1.14   thorpej static struct alpha_shared_intr *jensenio_eisa_intr;
     72   1.1   thorpej 
     73  1.14   thorpej static void	jensenio_iointr(void *, u_long);
     74   1.1   thorpej 
     75  1.14   thorpej static void	jensenio_enable_intr(int, int);
     76  1.14   thorpej static void	jensenio_setlevel(int, int);
     77  1.14   thorpej static void	jensenio_pic_init(void);
     78   1.1   thorpej 
     79  1.14   thorpej static const int jensenio_intr_deftype[JENSEN_MAX_IRQ] = {
     80   1.1   thorpej 	IST_EDGE,		/*  0: interval timer 0 output */
     81   1.1   thorpej 	IST_EDGE,		/*  1: line printer */
     82   1.1   thorpej 	IST_UNUSABLE,		/*  2: (cascade) */
     83   1.1   thorpej 	IST_NONE,		/*  3: EISA pin B25 */
     84   1.1   thorpej 	IST_NONE,		/*  4: EISA pin B24 */
     85   1.1   thorpej 	IST_NONE,		/*  5: EISA pin B23 */
     86   1.1   thorpej 	IST_NONE,		/*  6: EISA pin B22 (floppy) */
     87   1.1   thorpej 	IST_NONE,		/*  7: EISA pin B21 */
     88   1.1   thorpej 	IST_EDGE,		/*  8: RTC */
     89   1.1   thorpej 	IST_NONE,		/*  9: EISA pin B04 */
     90   1.1   thorpej 	IST_NONE,		/* 10: EISA pin D03 */
     91   1.1   thorpej 	IST_NONE,		/* 11: EISA pin D04 */
     92   1.1   thorpej 	IST_NONE,		/* 12: EISA pin D05 */
     93   1.1   thorpej 	IST_UNUSABLE,		/* 13: not connected */
     94   1.1   thorpej 	IST_NONE,		/* 14: EISA pin D07 (SCSI) */
     95   1.1   thorpej 	IST_NONE,		/* 15: EISA pin D06 */
     96   1.1   thorpej };
     97   1.1   thorpej 
     98   1.5     perry static inline void
     99   1.2   thorpej jensenio_specific_eoi(int irq)
    100   1.2   thorpej {
    101   1.2   thorpej 
    102  1.18   thorpej 	if (irq > 7) {
    103  1.18   thorpej 		bus_space_write_1(pic_iot, pic_ioh[1], PIC_OCW2,
    104  1.18   thorpej 		    OCW2_EOI | OCW2_SL | (irq & 0x07));
    105  1.18   thorpej 	}
    106  1.18   thorpej 	bus_space_write_1(pic_iot, pic_ioh[0], PIC_OCW2,
    107  1.18   thorpej 	    OCW2_EOI | OCW2_SL | (irq > 7 ? 2 : irq));
    108   1.2   thorpej }
    109   1.2   thorpej 
    110   1.1   thorpej void
    111   1.1   thorpej jensenio_intr_init(struct jensenio_config *jcp)
    112   1.1   thorpej {
    113   1.1   thorpej 	eisa_chipset_tag_t ec = &jcp->jc_ec;
    114   1.1   thorpej 	isa_chipset_tag_t ic = &jcp->jc_ic;
    115  1.16   thorpej 	struct evcnt *ev;
    116  1.16   thorpej 	const char *cp;
    117   1.1   thorpej 	int i;
    118   1.1   thorpej 
    119   1.1   thorpej 	pic_iot = &jcp->jc_eisa_iot;
    120   1.1   thorpej 
    121   1.1   thorpej 	jensenio_pic_init();
    122   1.1   thorpej 
    123  1.16   thorpej 	jensenio_eisa_intr = alpha_shared_intr_alloc(JENSEN_MAX_IRQ);
    124   1.1   thorpej 	for (i = 0; i < JENSEN_MAX_IRQ; i++) {
    125   1.1   thorpej 		alpha_shared_intr_set_dfltsharetype(jensenio_eisa_intr,
    126   1.1   thorpej 		    i, jensenio_intr_deftype[i]);
    127   1.1   thorpej 
    128  1.16   thorpej 		ev = alpha_shared_intr_evcnt(jensenio_eisa_intr, i);
    129   1.1   thorpej 		cp = alpha_shared_intr_string(jensenio_eisa_intr, i);
    130  1.16   thorpej 
    131  1.16   thorpej 		evcnt_attach_dynamic(ev, EVCNT_TYPE_INTR, NULL, "eisa", cp);
    132   1.1   thorpej 	}
    133   1.1   thorpej 
    134   1.1   thorpej 	/*
    135   1.1   thorpej 	 * The cascasde interrupt must be edge triggered and always enabled.
    136   1.1   thorpej 	 */
    137   1.1   thorpej 	jensenio_setlevel(2, 0);
    138   1.1   thorpej 	jensenio_enable_intr(2, 1);
    139   1.1   thorpej 
    140   1.1   thorpej 	/*
    141   1.1   thorpej 	 * Initialize the EISA chipset.
    142   1.1   thorpej 	 */
    143   1.1   thorpej 	ec->ec_v = jcp;
    144   1.1   thorpej 	ec->ec_intr_map = jensenio_eisa_intr_map;
    145   1.1   thorpej 	ec->ec_intr_string = jensenio_eisa_intr_string;
    146   1.1   thorpej 	ec->ec_intr_evcnt = jensenio_eisa_intr_evcnt;
    147   1.1   thorpej 	ec->ec_intr_establish = jensenio_eisa_intr_establish;
    148   1.1   thorpej 	ec->ec_intr_disestablish = jensenio_eisa_intr_disestablish;
    149   1.1   thorpej 
    150   1.1   thorpej 	/*
    151   1.1   thorpej 	 * Initialize the ISA chipset.
    152   1.1   thorpej 	 */
    153   1.1   thorpej 	ic->ic_v = jcp;
    154   1.1   thorpej 	ic->ic_intr_establish = jensenio_eisa_intr_establish;
    155   1.1   thorpej 	ic->ic_intr_disestablish = jensenio_eisa_intr_disestablish;
    156   1.1   thorpej 	ic->ic_intr_alloc = jensenio_eisa_intr_alloc;
    157   1.1   thorpej 	ic->ic_intr_evcnt = jensenio_eisa_intr_evcnt;
    158   1.1   thorpej }
    159   1.1   thorpej 
    160  1.13   thorpej static void
    161  1.13   thorpej jensenio_intr_dispatch(void *arg, unsigned long vec)
    162  1.13   thorpej {
    163  1.13   thorpej 	struct jensenio_scb_intrhand *jih = arg;
    164  1.13   thorpej 
    165  1.13   thorpej 	jih->jih_evcnt.ev_count++;
    166  1.13   thorpej 	(void) jih->jih_func(jih->jih_arg);
    167  1.13   thorpej }
    168  1.13   thorpej 
    169  1.13   thorpej static void
    170  1.13   thorpej jensenio_intr_dispatch_wrapped(void *arg, unsigned long vec)
    171  1.13   thorpej {
    172  1.13   thorpej 	KERNEL_LOCK(1, NULL);
    173  1.13   thorpej 	jensenio_intr_dispatch(arg, vec);
    174  1.13   thorpej 	KERNEL_UNLOCK_ONE(NULL);
    175  1.13   thorpej }
    176  1.13   thorpej 
    177  1.13   thorpej void
    178  1.13   thorpej jensenio_intr_establish(struct jensenio_scb_intrhand *jih,
    179  1.13   thorpej     unsigned long vec, int flags, int (*func)(void *), void *arg)
    180  1.13   thorpej {
    181  1.13   thorpej 	void (*scb_func)(void *, unsigned long);
    182  1.13   thorpej 
    183  1.13   thorpej 	/*
    184  1.13   thorpej 	 * Jensen systems are all uniprocessors, but we still do all
    185  1.13   thorpej 	 * of the KERNEL_LOCK handling as a formality to keep assertions
    186  1.13   thorpej 	 * valid in MI code.
    187  1.13   thorpej 	 */
    188  1.13   thorpej 	KASSERT(CPU_IS_PRIMARY(curcpu()));
    189  1.13   thorpej 	KASSERT(ncpu == 1);
    190  1.13   thorpej 	if (flags & ALPHA_INTR_MPSAFE)
    191  1.13   thorpej 		scb_func = jensenio_intr_dispatch;
    192  1.13   thorpej 	else
    193  1.13   thorpej 		scb_func = jensenio_intr_dispatch_wrapped;
    194  1.13   thorpej 
    195  1.13   thorpej 	jih->jih_func = func;
    196  1.13   thorpej 	jih->jih_arg = arg;
    197  1.13   thorpej 	jih->jih_vec = vec;
    198  1.13   thorpej 
    199  1.13   thorpej 	snprintf(jih->jih_vecstr, sizeof(jih->jih_vecstr), "0x%lx",
    200  1.13   thorpej 	    jih->jih_vec);
    201  1.13   thorpej 	evcnt_attach_dynamic(&jih->jih_evcnt, EVCNT_TYPE_INTR,
    202  1.13   thorpej 	    NULL, "vector", jih->jih_vecstr);
    203  1.13   thorpej 
    204  1.13   thorpej 	mutex_enter(&cpu_lock);
    205  1.13   thorpej 
    206  1.13   thorpej 	scb_set(vec, scb_func, jih);
    207  1.13   thorpej 	curcpu()->ci_nintrhand++;
    208  1.13   thorpej 
    209  1.13   thorpej 	mutex_exit(&cpu_lock);
    210  1.13   thorpej }
    211  1.13   thorpej 
    212  1.14   thorpej static int
    213   1.1   thorpej jensenio_eisa_intr_map(void *v, u_int eirq, eisa_intr_handle_t *ihp)
    214   1.1   thorpej {
    215   1.1   thorpej 
    216   1.6   tsutsui 	if (eirq >= JENSEN_MAX_IRQ) {
    217   1.6   tsutsui 		printf("jensenio_eisa_intr_map: bogus IRQ %d", eirq);
    218   1.6   tsutsui 		*ihp = -1;
    219   1.6   tsutsui 		return (1);
    220   1.6   tsutsui 	}
    221   1.1   thorpej 
    222   1.1   thorpej 	if (jensenio_intr_deftype[eirq] == IST_UNUSABLE) {
    223   1.1   thorpej 		printf("jensenio_eisa_intr_map: unusable irq %d\n",
    224   1.1   thorpej 		    eirq);
    225   1.1   thorpej 		*ihp = -1;
    226   1.1   thorpej 		return (1);
    227   1.1   thorpej 	}
    228   1.1   thorpej 
    229   1.1   thorpej 	*ihp = eirq;
    230   1.1   thorpej 	return (0);
    231   1.1   thorpej }
    232   1.1   thorpej 
    233  1.14   thorpej static const char *
    234  1.11  christos jensenio_eisa_intr_string(void *v, int eirq, char *buf, size_t len)
    235   1.1   thorpej {
    236   1.2   thorpej 	if (eirq >= JENSEN_MAX_IRQ)
    237  1.11  christos 		panic("%s: bogus IRQ %d", __func__, eirq);
    238   1.1   thorpej 
    239  1.11  christos 	snprintf(buf, len, "eisa irq %d", eirq);
    240  1.11  christos 	return buf;
    241   1.1   thorpej }
    242   1.1   thorpej 
    243  1.14   thorpej static const struct evcnt *
    244   1.1   thorpej jensenio_eisa_intr_evcnt(void *v, int eirq)
    245   1.1   thorpej {
    246   1.1   thorpej 
    247   1.3   thorpej 	if (eirq >= JENSEN_MAX_IRQ)
    248  1.11  christos 		panic("%s: bogus IRQ %d", __func__, eirq);
    249   1.1   thorpej 
    250   1.1   thorpej 	return (alpha_shared_intr_evcnt(jensenio_eisa_intr, eirq));
    251   1.1   thorpej }
    252   1.1   thorpej 
    253  1.14   thorpej static void *
    254   1.1   thorpej jensenio_eisa_intr_establish(void *v, int irq, int type, int level,
    255   1.1   thorpej     int (*fn)(void *), void *arg)
    256   1.1   thorpej {
    257   1.1   thorpej 	void *cookie;
    258   1.1   thorpej 
    259   1.3   thorpej 	if (irq >= JENSEN_MAX_IRQ || type == IST_NONE)
    260   1.1   thorpej 		panic("jensenio_eisa_intr_establish: bogus irq or type");
    261   1.1   thorpej 
    262   1.1   thorpej 	if (jensenio_intr_deftype[irq] == IST_UNUSABLE) {
    263   1.1   thorpej 		printf("jensenio_eisa_intr_establish: IRQ %d not usable\n",
    264   1.1   thorpej 		    irq);
    265  1.13   thorpej 		return NULL;
    266   1.1   thorpej 	}
    267   1.1   thorpej 
    268  1.13   thorpej 	cookie = alpha_shared_intr_alloc_intrhand(jensenio_eisa_intr, irq,
    269  1.15   thorpej 	    type, level, 0, fn, arg, "eisa");
    270   1.1   thorpej 
    271  1.13   thorpej 	if (cookie == NULL)
    272  1.13   thorpej 		return NULL;
    273  1.13   thorpej 
    274  1.13   thorpej 	mutex_enter(&cpu_lock);
    275  1.13   thorpej 
    276  1.15   thorpej 	if (! alpha_shared_intr_link(jensenio_eisa_intr, cookie, "eisa")) {
    277  1.13   thorpej 		mutex_exit(&cpu_lock);
    278  1.13   thorpej 		alpha_shared_intr_free_intrhand(cookie);
    279  1.13   thorpej 		return NULL;
    280  1.13   thorpej 	}
    281  1.13   thorpej 
    282  1.13   thorpej 	if (alpha_shared_intr_firstactive(jensenio_eisa_intr, irq)) {
    283  1.12   thorpej 		scb_set(0x800 + SCB_IDXTOVEC(irq), jensenio_iointr, NULL);
    284   1.1   thorpej 		jensenio_setlevel(irq,
    285   1.1   thorpej 		    alpha_shared_intr_get_sharetype(jensenio_eisa_intr,
    286   1.1   thorpej 						    irq) == IST_LEVEL);
    287   1.1   thorpej 		jensenio_enable_intr(irq, 1);
    288   1.1   thorpej 	}
    289   1.1   thorpej 
    290  1.13   thorpej 	mutex_exit(&cpu_lock);
    291  1.13   thorpej 
    292  1.13   thorpej 	return cookie;
    293   1.1   thorpej }
    294   1.1   thorpej 
    295  1.14   thorpej static void
    296   1.1   thorpej jensenio_eisa_intr_disestablish(void *v, void *cookie)
    297   1.1   thorpej {
    298   1.1   thorpej 	struct alpha_shared_intrhand *ih = cookie;
    299  1.13   thorpej 	int irq = ih->ih_num;
    300   1.1   thorpej 
    301  1.13   thorpej 	mutex_enter(&cpu_lock);
    302   1.1   thorpej 
    303  1.13   thorpej 	if (alpha_shared_intr_firstactive(jensenio_eisa_intr, irq)) {
    304   1.1   thorpej 		jensenio_enable_intr(irq, 0);
    305   1.1   thorpej 		alpha_shared_intr_set_dfltsharetype(jensenio_eisa_intr,
    306   1.1   thorpej 		    irq, jensenio_intr_deftype[irq]);
    307   1.3   thorpej 		scb_free(0x800 + SCB_IDXTOVEC(irq));
    308   1.1   thorpej 	}
    309   1.1   thorpej 
    310  1.15   thorpej 	alpha_shared_intr_unlink(jensenio_eisa_intr, cookie, "eisa");
    311  1.13   thorpej 
    312  1.13   thorpej 	mutex_exit(&cpu_lock);
    313  1.13   thorpej 
    314  1.13   thorpej 	alpha_shared_intr_free_intrhand(cookie);
    315   1.1   thorpej }
    316   1.1   thorpej 
    317  1.14   thorpej static int
    318   1.1   thorpej jensenio_eisa_intr_alloc(void *v, int mask, int type, int *rqp)
    319   1.1   thorpej {
    320   1.1   thorpej 
    321   1.1   thorpej 	/* XXX Not supported right now. */
    322   1.1   thorpej 	return (1);
    323   1.1   thorpej }
    324   1.1   thorpej 
    325  1.14   thorpej static void
    326   1.1   thorpej jensenio_iointr(void *framep, u_long vec)
    327   1.1   thorpej {
    328   1.1   thorpej 	int irq;
    329   1.1   thorpej 
    330   1.3   thorpej 	irq = SCB_VECTOIDX(vec - 0x800);
    331   1.1   thorpej 
    332   1.2   thorpej 	if (!alpha_shared_intr_dispatch(jensenio_eisa_intr, irq))
    333  1.15   thorpej 		alpha_shared_intr_stray(jensenio_eisa_intr, irq, "eisa");
    334   1.2   thorpej 
    335   1.3   thorpej 	jensenio_specific_eoi(irq);
    336   1.1   thorpej }
    337   1.1   thorpej 
    338  1.14   thorpej static void
    339   1.1   thorpej jensenio_enable_intr(int irq, int onoff)
    340   1.1   thorpej {
    341   1.1   thorpej 	int pic;
    342  1.10      matt 	uint8_t bit, mask;
    343   1.1   thorpej 
    344   1.1   thorpej 	pic = irq >> 3;
    345   1.1   thorpej 	bit = 1 << (irq & 0x7);
    346   1.1   thorpej 
    347  1.18   thorpej 	mask = bus_space_read_1(pic_iot, pic_ioh[pic], PIC_OCW1);
    348   1.1   thorpej 	if (onoff)
    349   1.1   thorpej 		mask &= ~bit;
    350   1.1   thorpej 	else
    351   1.1   thorpej 		mask |= bit;
    352  1.18   thorpej 	bus_space_write_1(pic_iot, pic_ioh[pic], PIC_OCW1, mask);
    353   1.1   thorpej }
    354   1.1   thorpej 
    355   1.1   thorpej void
    356   1.1   thorpej jensenio_setlevel(int irq, int level)
    357   1.1   thorpej {
    358   1.1   thorpej 	int elcr;
    359  1.10      matt 	uint8_t bit, mask;
    360   1.1   thorpej 
    361   1.1   thorpej 	elcr = irq >> 3;
    362   1.1   thorpej 	bit = 1 << (irq & 0x7);
    363   1.1   thorpej 
    364   1.1   thorpej 	mask = bus_space_read_1(pic_iot, pic_elcr_ioh, elcr);
    365   1.1   thorpej 	if (level)
    366   1.1   thorpej 		mask |= bit;
    367   1.1   thorpej 	else
    368   1.1   thorpej 		mask &= ~bit;
    369   1.1   thorpej 	bus_space_write_1(pic_iot, pic_elcr_ioh, elcr, mask);
    370   1.1   thorpej }
    371   1.1   thorpej 
    372  1.14   thorpej static void
    373   1.1   thorpej jensenio_pic_init(void)
    374   1.1   thorpej {
    375   1.1   thorpej 	static const int picaddr[2] = { IO_ICU1, IO_ICU2 };
    376   1.1   thorpej 	int pic;
    377   1.1   thorpej 
    378   1.1   thorpej 	/*
    379   1.1   thorpej 	 * Map the PICs and mask off the interrupts on them.
    380   1.1   thorpej 	 */
    381   1.1   thorpej 	for (pic = 0; pic < 2; pic++) {
    382   1.1   thorpej 		if (bus_space_map(pic_iot, picaddr[pic], 2, 0, &pic_ioh[pic]))
    383   1.1   thorpej 			panic("jensenio_init_intr: unable to map PIC %d", pic);
    384  1.18   thorpej 		bus_space_write_1(pic_iot, pic_ioh[pic], PIC_OCW1, 0xff);
    385   1.1   thorpej 	}
    386   1.1   thorpej 
    387   1.1   thorpej 	/*
    388  1.18   thorpej 	 * Map the ELCR registers and initialize all interrupts to EDGE
    389  1.18   thorpej 	 * trigger.
    390   1.1   thorpej 	 */
    391   1.1   thorpej 	if (bus_space_map(pic_iot, 0x4d0, 2, 0, &pic_elcr_ioh))
    392   1.1   thorpej 		panic("jensenio_init_intr: unable to map ELCR registers");
    393  1.18   thorpej 	bus_space_write_1(pic_iot, pic_elcr_ioh, 0, 0);
    394  1.18   thorpej 	bus_space_write_1(pic_iot, pic_elcr_ioh, 1, 0);
    395   1.1   thorpej }
    396