Home | History | Annotate | Line # | Download | only in dev
plumicu.c revision 1.3.10.2
      1  1.3.10.2  jdolecek /*	$NetBSD: plumicu.c,v 1.3.10.2 2002/02/11 20:08:05 jdolecek Exp $ */
      2       1.1       uch 
      3  1.3.10.1   thorpej /*-
      4  1.3.10.1   thorpej  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
      5       1.1       uch  * All rights reserved.
      6       1.1       uch  *
      7  1.3.10.1   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.3.10.1   thorpej  * by UCHIYAMA Yasushi.
      9  1.3.10.1   thorpej  *
     10       1.1       uch  * Redistribution and use in source and binary forms, with or without
     11       1.1       uch  * modification, are permitted provided that the following conditions
     12       1.1       uch  * are met:
     13       1.1       uch  * 1. Redistributions of source code must retain the above copyright
     14       1.1       uch  *    notice, this list of conditions and the following disclaimer.
     15  1.3.10.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.3.10.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.3.10.1   thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.3.10.1   thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.3.10.1   thorpej  *    must display the following acknowledgement:
     20  1.3.10.1   thorpej  *        This product includes software developed by the NetBSD
     21  1.3.10.1   thorpej  *        Foundation, Inc. and its contributors.
     22  1.3.10.1   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.3.10.1   thorpej  *    contributors may be used to endorse or promote products derived
     24  1.3.10.1   thorpej  *    from this software without specific prior written permission.
     25       1.1       uch  *
     26  1.3.10.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.3.10.1   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.3.10.1   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.3.10.1   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.3.10.1   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.3.10.1   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.3.10.1   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.3.10.1   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.3.10.1   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.3.10.1   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.3.10.1   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37       1.1       uch  */
     38       1.1       uch 
     39       1.1       uch #include <sys/param.h>
     40       1.1       uch #include <sys/systm.h>
     41       1.1       uch #include <sys/device.h>
     42       1.1       uch 
     43       1.1       uch #include <machine/bus.h>
     44       1.1       uch #include <machine/intr.h>
     45       1.1       uch 
     46       1.1       uch #include <hpcmips/tx/tx39var.h>
     47       1.1       uch #include <hpcmips/dev/plumvar.h>
     48       1.1       uch #include <hpcmips/dev/plumicuvar.h>
     49       1.1       uch #include <hpcmips/dev/plumicureg.h>
     50       1.1       uch 
     51       1.1       uch #ifdef PLUMICUDEBUG
     52       1.1       uch #define	DPRINTF(arg) printf arg
     53       1.1       uch #else
     54       1.1       uch #define	DPRINTF(arg)
     55       1.1       uch #endif
     56       1.1       uch 
     57  1.3.10.1   thorpej int plumicu_match(struct device *, struct cfdata *, void *);
     58  1.3.10.1   thorpej void plumicu_attach(struct device *, struct device *, void *);
     59  1.3.10.1   thorpej int plumicu_intr(void *);
     60       1.1       uch 
     61  1.3.10.1   thorpej static __inline__ void plum_di(plum_chipset_tag_t);
     62  1.3.10.1   thorpej static __inline__ void plum_ei(plum_chipset_tag_t);
     63       1.3       uch 
     64       1.3       uch const struct plum_intr_ctrl {
     65       1.1       uch 	plumreg_t	ic_ackpat1;
     66       1.2       uch 	plumreg_t	ic_ackpat2;	int	ic_ackreg2;
     67       1.2       uch 	plumreg_t	ic_ienpat;	int	ic_ienreg;
     68       1.2       uch 	plumreg_t	ic_senpat;	int	ic_senreg;
     69       1.2       uch } pi_ctrl[PLUM_INTR_MAX] = {
     70       1.1       uch 	[PLUM_INT_C1IO]	= {PLUM_INT_INTSTA_PCCINT,
     71       1.1       uch 			   PLUM_INT_PCCINTS_C1IO,	PLUM_INT_PCCINTS_REG,
     72  1.3.10.1   thorpej 			   PLUM_INT_PCCIEN_IENC1IO,	PLUM_INT_PCCIEN_REG,
     73       1.1       uch 			   PLUM_INT_PCCIEN_SENC1IO,	PLUM_INT_PCCIEN_REG
     74       1.1       uch 	},
     75       1.1       uch 	[PLUM_INT_C1RI] = {PLUM_INT_INTSTA_PCCINT,
     76       1.1       uch 			   PLUM_INT_PCCINTS_C1RI,	PLUM_INT_PCCINTS_REG,
     77       1.1       uch 			   PLUM_INT_PCCIEN_IENC1RI,	PLUM_INT_PCCIEN_REG,
     78       1.1       uch 			   PLUM_INT_PCCIEN_SENC1RI,	PLUM_INT_PCCIEN_REG
     79       1.1       uch 	},
     80       1.1       uch 	[PLUM_INT_C1SC] = {PLUM_INT_INTSTA_C1SCINT,	0, 0, 0, 0, 0, 0},
     81       1.1       uch 	[PLUM_INT_C2IO] = {PLUM_INT_INTSTA_PCCINT,
     82       1.1       uch 			   PLUM_INT_PCCINTS_C2IO,	PLUM_INT_PCCINTS_REG,
     83       1.1       uch 			   PLUM_INT_PCCIEN_IENC2IO,	PLUM_INT_PCCIEN_REG,
     84       1.1       uch 			   PLUM_INT_PCCIEN_SENC2IO,	PLUM_INT_PCCIEN_REG
     85       1.1       uch 	},
     86       1.1       uch 	[PLUM_INT_C2RI] = {PLUM_INT_INTSTA_PCCINT,
     87       1.1       uch 			   PLUM_INT_PCCINTS_C2RI,	PLUM_INT_PCCINTS_REG,
     88       1.1       uch 			   PLUM_INT_PCCIEN_IENC2RI,	PLUM_INT_PCCIEN_REG,
     89       1.1       uch 			   PLUM_INT_PCCIEN_SENC2RI,	PLUM_INT_PCCIEN_REG
     90       1.1       uch 	},
     91       1.1       uch 	[PLUM_INT_C2SC] = {PLUM_INT_INTSTA_C2SCINT,	0, 0, 0, 0, 0, 0},
     92       1.1       uch 	[PLUM_INT_DISP] = {PLUM_INT_INTSTA_DISPINT,	0, 0, 0, 0, 0, 0},
     93       1.1       uch 	[PLUM_INT_USB]  = {PLUM_INT_INTSTA_USBINT,
     94       1.1       uch 			   0, 0,
     95       1.1       uch 			   PLUM_INT_USBINTEN_IEN,	PLUM_INT_USBINTEN_REG,
     96       1.1       uch 			   0, 0
     97       1.1       uch 	},
     98       1.1       uch 	[PLUM_INT_USBWAKE] = {PLUM_INT_INTSTA_USBWAKE,
     99       1.1       uch 			   0, 0,
    100       1.1       uch 			   PLUM_INT_USBINTEN_WIEN,	PLUM_INT_USBINTEN_REG,
    101       1.1       uch 			   0, 0
    102       1.1       uch 	},
    103       1.1       uch 	[PLUM_INT_SM]	= {PLUM_INT_INTSTA_SMINT,
    104       1.1       uch 			   0, 0,
    105       1.1       uch 			   PLUM_INT_SMIEN,		PLUM_INT_SMIEN_REG,
    106       1.1       uch 			   0, 0
    107       1.1       uch 	},
    108       1.1       uch 	[PLUM_INT_EXT5IO0] = {PLUM_INT_INTSTA_EXTINT,
    109       1.1       uch 			   PLUM_INT_EXTINTS_IO5INT0,	PLUM_INT_EXTINTS_REG,
    110       1.1       uch 			   PLUM_INT_EXTIEN_IENIO5INT0,	PLUM_INT_EXTIEN_REG,
    111       1.1       uch 			   PLUM_INT_EXTIEN_SENIO5INT0,	PLUM_INT_EXTIEN_REG,
    112       1.1       uch 	},
    113       1.1       uch 	[PLUM_INT_EXT5IO1] = {PLUM_INT_INTSTA_EXTINT,
    114       1.1       uch 			   PLUM_INT_EXTINTS_IO5INT1,	PLUM_INT_EXTINTS_REG,
    115       1.1       uch 			   PLUM_INT_EXTIEN_IENIO5INT1,	PLUM_INT_EXTIEN_REG,
    116       1.1       uch 			   PLUM_INT_EXTIEN_SENIO5INT1,	PLUM_INT_EXTIEN_REG,
    117       1.1       uch 	},
    118       1.1       uch 	[PLUM_INT_EXT5IO2] = {PLUM_INT_INTSTA_EXTINT,
    119       1.1       uch 			   PLUM_INT_EXTINTS_IO5INT2,	PLUM_INT_EXTINTS_REG,
    120       1.1       uch 			   PLUM_INT_EXTIEN_IENIO5INT2,	PLUM_INT_EXTIEN_REG,
    121       1.1       uch 			   PLUM_INT_EXTIEN_SENIO5INT2,	PLUM_INT_EXTIEN_REG,
    122       1.1       uch 	},
    123       1.1       uch 	[PLUM_INT_EXT5IO3] = {PLUM_INT_INTSTA_EXTINT,
    124       1.1       uch 			   PLUM_INT_EXTINTS_IO5INT3,	PLUM_INT_EXTINTS_REG,
    125       1.1       uch 			   PLUM_INT_EXTIEN_IENIO5INT0,	PLUM_INT_EXTIEN_REG,
    126       1.1       uch 			   PLUM_INT_EXTIEN_SENIO5INT0,	PLUM_INT_EXTIEN_REG,
    127       1.1       uch 	},
    128       1.1       uch 	[PLUM_INT_EXT3IO0] = {PLUM_INT_INTSTA_EXTINT,
    129       1.1       uch 			   PLUM_INT_EXTINTS_IO3INT0,	PLUM_INT_EXTINTS_REG,
    130       1.1       uch 			   PLUM_INT_EXTIEN_IENIO3INT0,	PLUM_INT_EXTIEN_REG,
    131       1.1       uch 			   PLUM_INT_EXTIEN_SENIO3INT0,	PLUM_INT_EXTIEN_REG,
    132       1.1       uch 	},
    133       1.1       uch 	[PLUM_INT_EXT3IO1] = {PLUM_INT_INTSTA_EXTINT,
    134       1.1       uch 			   PLUM_INT_EXTINTS_IO3INT1,	PLUM_INT_EXTINTS_REG,
    135       1.1       uch 			   PLUM_INT_EXTIEN_IENIO3INT1,	PLUM_INT_EXTIEN_REG,
    136       1.1       uch 			   PLUM_INT_EXTIEN_SENIO3INT1,	PLUM_INT_EXTIEN_REG,
    137       1.1       uch 	}
    138       1.1       uch };
    139       1.1       uch 
    140       1.1       uch struct plum_intr_entry {
    141       1.3       uch 	int pi_enabled;
    142       1.1       uch 	int pi_line;
    143  1.3.10.1   thorpej 	int (*pi_fun)(void *);
    144       1.1       uch 	void *pi_arg;
    145       1.3       uch 	const struct plum_intr_ctrl *pi_ctrl;
    146       1.1       uch };
    147       1.1       uch 
    148       1.1       uch struct plumicu_softc {
    149       1.1       uch 	struct	device		sc_dev;
    150       1.1       uch 	plum_chipset_tag_t	sc_pc;
    151       1.1       uch 	bus_space_tag_t		sc_regt;
    152       1.1       uch 	bus_space_handle_t	sc_regh;
    153       1.1       uch 	void			*sc_ih;
    154       1.1       uch 	int			sc_enable_count;
    155       1.3       uch 	struct plum_intr_entry  sc_intr[PLUM_INTR_MAX];
    156       1.1       uch };
    157       1.1       uch 
    158       1.1       uch struct cfattach plumicu_ca = {
    159       1.1       uch 	sizeof(struct plumicu_softc), plumicu_match, plumicu_attach
    160       1.1       uch };
    161       1.1       uch 
    162       1.3       uch #ifdef PLUMICUDEBUG
    163  1.3.10.1   thorpej void plumicu_dump(struct plumicu_softc *);
    164       1.3       uch #endif
    165       1.1       uch 
    166       1.1       uch int
    167  1.3.10.1   thorpej plumicu_match(struct device *parent, struct cfdata *cf, void *aux)
    168       1.1       uch {
    169  1.3.10.1   thorpej 
    170       1.3       uch 	return (2); /* 1st attach group */
    171       1.1       uch }
    172       1.1       uch 
    173       1.1       uch void
    174  1.3.10.1   thorpej plumicu_attach(struct device *parent, struct device *self, void *aux)
    175       1.1       uch {
    176       1.1       uch 	struct plum_attach_args *pa = aux;
    177       1.1       uch 	struct plumicu_softc *sc = (void*)self;
    178       1.3       uch 	const struct plum_intr_ctrl *pic;
    179       1.1       uch 	bus_space_tag_t regt;
    180       1.1       uch 	bus_space_handle_t regh;
    181       1.1       uch 	plumreg_t reg;
    182       1.1       uch 	int i;
    183       1.1       uch 
    184       1.1       uch 	sc->sc_pc	= pa->pa_pc;
    185       1.1       uch 	sc->sc_regt	= pa->pa_regt;
    186       1.1       uch 
    187       1.1       uch 	/* map plum2 interrupt controller register space */
    188       1.1       uch 	if (bus_space_map(sc->sc_regt, PLUM_INT_REGBASE,
    189       1.1       uch 			  PLUM_INT_REGSIZE, 0, &sc->sc_regh)) {
    190       1.1       uch 		printf(":interrupt register map failed\n");
    191       1.1       uch 		return;
    192       1.1       uch 	}
    193       1.3       uch #ifdef PLUMICUDEBUG
    194       1.3       uch 	plumicu_dump(sc);
    195       1.3       uch #endif
    196       1.1       uch 	/* disable all interrupt */
    197       1.1       uch 	regt = sc->sc_regt;
    198       1.1       uch 	regh = sc->sc_regh;
    199       1.1       uch 	for (i = 0; i < PLUM_INTR_MAX; i++) {
    200       1.1       uch 		pic = &pi_ctrl[i];
    201       1.1       uch 		if (pic->ic_ienreg) {
    202       1.1       uch 			reg = plum_conf_read(regt, regh, pic->ic_ienreg);
    203       1.1       uch 			reg &= ~pic->ic_ienpat;
    204       1.1       uch 			plum_conf_write(regt, regh, pic->ic_ienreg, reg);
    205       1.1       uch 		}
    206       1.1       uch 		if (pic->ic_senreg) {
    207       1.1       uch 			reg = plum_conf_read(regt, regh, pic->ic_senreg);
    208       1.1       uch 			reg &= ~pic->ic_senpat;
    209       1.1       uch 			plum_conf_write(regt, regh, pic->ic_senreg, reg);
    210       1.1       uch 		}
    211       1.1       uch 	}
    212       1.1       uch 
    213       1.1       uch 	/* register handle to plum_chipset_tag */
    214       1.1       uch 	plum_conf_register_intr(sc->sc_pc, (void*)sc);
    215       1.1       uch 
    216       1.1       uch 	/* disable interrupt redirect to TX39 core */
    217       1.3       uch 	plum_di(sc->sc_pc);
    218       1.1       uch 
    219       1.1       uch 	if (!(sc->sc_ih = tx_intr_establish(sc->sc_pc->pc_tc, pa->pa_irq,
    220       1.3       uch 					    IST_EDGE, IPL_BIO,
    221       1.3       uch 					    plumicu_intr, sc))) {
    222       1.1       uch 		printf(": can't establish interrupt\n");
    223       1.1       uch 	}
    224       1.1       uch 	printf("\n");
    225       1.3       uch }
    226       1.3       uch 
    227       1.3       uch __inline__ void
    228  1.3.10.1   thorpej plum_di(plum_chipset_tag_t pc)
    229       1.3       uch {
    230       1.3       uch 	struct plumicu_softc *sc = pc->pc_intrt;
    231       1.3       uch 
    232       1.3       uch 	plum_conf_write(sc->sc_regt, sc->sc_regh, PLUM_INT_INTIEN_REG, 0);
    233       1.3       uch }
    234       1.3       uch 
    235       1.3       uch __inline__ void
    236  1.3.10.1   thorpej plum_ei(plum_chipset_tag_t pc)
    237       1.3       uch {
    238       1.3       uch 	struct plumicu_softc *sc = pc->pc_intrt;
    239       1.1       uch 
    240       1.3       uch 	plum_conf_write(sc->sc_regt, sc->sc_regh, PLUM_INT_INTIEN_REG,
    241       1.3       uch 			PLUM_INT_INTIEN);
    242       1.1       uch }
    243       1.1       uch 
    244       1.1       uch void*
    245  1.3.10.1   thorpej plum_intr_establish(plum_chipset_tag_t pc, int line, int mode, int level,
    246  1.3.10.1   thorpej     int (*ih_fun)(void *), void *ih_arg)
    247       1.1       uch {
    248       1.1       uch 	struct plumicu_softc *sc = pc->pc_intrt;
    249       1.1       uch 	bus_space_tag_t regt = sc->sc_regt;
    250       1.1       uch 	bus_space_handle_t regh = sc->sc_regh;
    251       1.1       uch 	plumreg_t reg;
    252       1.1       uch 	struct plum_intr_entry *pi;
    253       1.1       uch 
    254       1.1       uch 	if (!LEGAL_PRUM_INTR(line)) {
    255       1.1       uch 		panic("plum_intr_establish: bogus interrupt line");
    256       1.1       uch 	}
    257       1.1       uch 
    258       1.3       uch 	pi = &sc->sc_intr[line];
    259       1.1       uch 	pi->pi_line = line;
    260       1.1       uch 	pi->pi_fun  = ih_fun;
    261       1.1       uch 	pi->pi_arg  = ih_arg;
    262       1.1       uch 	pi->pi_ctrl = &pi_ctrl[line];
    263       1.1       uch 
    264       1.1       uch 	/* Enable interrupt */
    265       1.3       uch 
    266       1.2       uch 	/* status enable */
    267       1.2       uch 	if (pi->pi_ctrl->ic_senreg) {
    268       1.2       uch 		reg = plum_conf_read(regt, regh, pi->pi_ctrl->ic_senreg);
    269       1.2       uch 		reg |= pi->pi_ctrl->ic_senpat;
    270       1.2       uch 		plum_conf_write(regt, regh, pi->pi_ctrl->ic_senreg, reg);
    271       1.2       uch 	}
    272       1.2       uch 	/* interrupt enable */
    273       1.1       uch 	if (pi->pi_ctrl->ic_ienreg) {
    274       1.1       uch 		reg = plum_conf_read(regt, regh, pi->pi_ctrl->ic_ienreg);
    275       1.1       uch 		reg |= pi->pi_ctrl->ic_ienpat;
    276       1.1       uch 		plum_conf_write(regt, regh, pi->pi_ctrl->ic_ienreg, reg);
    277       1.1       uch 	}
    278       1.1       uch 
    279       1.1       uch 	/* Enable redirect to TX39 core */
    280       1.3       uch 	DPRINTF(("plum_intr_establish: %d (count=%d)\n", line,
    281       1.3       uch 		 sc->sc_enable_count));
    282       1.3       uch 
    283       1.3       uch 	if (sc->sc_enable_count++ == 0)
    284       1.3       uch 		plum_ei(pc);
    285       1.2       uch 
    286       1.3       uch 	pi->pi_enabled = 1;
    287       1.1       uch 
    288       1.3       uch 	return (ih_fun);
    289       1.1       uch }
    290       1.1       uch 
    291       1.1       uch void
    292  1.3.10.1   thorpej plum_intr_disestablish(plum_chipset_tag_t pc, void *arg)
    293       1.1       uch {
    294       1.1       uch 	struct plumicu_softc *sc = pc->pc_intrt;
    295       1.1       uch 	bus_space_tag_t regt = sc->sc_regt;
    296       1.1       uch 	bus_space_handle_t regh = sc->sc_regh;
    297       1.1       uch 	plumreg_t reg;
    298       1.1       uch 	struct plum_intr_entry *pi;
    299       1.1       uch 	int i;
    300       1.3       uch 
    301       1.3       uch 	sc = pc->pc_intrt;
    302       1.1       uch 
    303       1.1       uch 	for (i = 0; i < PLUM_INTR_MAX; i++) {
    304       1.3       uch 		pi = &sc->sc_intr[i];
    305       1.3       uch 		if (pi->pi_fun != arg)
    306       1.3       uch 			continue;
    307       1.3       uch 		DPRINTF(("plum_intr_disestablish: %d (count=%d)\n",
    308       1.3       uch 			 pi->pi_line, sc->sc_enable_count - 1));
    309       1.3       uch 		goto found;
    310       1.1       uch 	}
    311       1.1       uch 	panic("plum_intr_disestablish: can't find entry.");
    312       1.3       uch 	/* NOTREACHED */
    313       1.1       uch  found:
    314       1.3       uch 	pi->pi_enabled = 0;
    315       1.1       uch 	/* Disable interrupt */
    316       1.1       uch 	if (pi->pi_ctrl->ic_ienreg) {
    317       1.1       uch 		reg = plum_conf_read(regt, regh, pi->pi_ctrl->ic_ienreg);
    318       1.1       uch 		reg &= ~(pi->pi_ctrl->ic_ienpat);
    319       1.1       uch 		plum_conf_write(regt, regh, pi->pi_ctrl->ic_ienreg, reg);
    320       1.1       uch 	}
    321       1.1       uch 	if (pi->pi_ctrl->ic_senreg) {
    322       1.1       uch 		reg = plum_conf_read(regt, regh, pi->pi_ctrl->ic_senreg);
    323       1.1       uch 		reg &= ~(pi->pi_ctrl->ic_senpat);
    324       1.1       uch 		plum_conf_write(regt, regh, pi->pi_ctrl->ic_senreg, reg);
    325       1.1       uch 	}
    326       1.1       uch 
    327       1.3       uch 	/* Disable/Enable interrupt redirect to TX39 core */
    328       1.3       uch 	if (--sc->sc_enable_count == 0)
    329       1.3       uch 		plum_di(pc);
    330       1.1       uch }
    331       1.1       uch 
    332       1.1       uch int
    333  1.3.10.1   thorpej plumicu_intr(void *arg)
    334       1.1       uch {
    335       1.1       uch 	struct plumicu_softc *sc = arg;
    336       1.1       uch 	bus_space_tag_t regt = sc->sc_regt;
    337       1.1       uch 	bus_space_handle_t regh = sc->sc_regh;
    338       1.3       uch 	plumreg_t reg1, reg2, reg_ext, reg_pccard;
    339       1.1       uch 	int i;
    340       1.1       uch 
    341       1.3       uch 	plum_di(sc->sc_pc);
    342       1.3       uch 	/* read level 1 status */
    343       1.1       uch 	reg1 = plum_conf_read(regt, regh, PLUM_INT_INTSTA_REG);
    344       1.2       uch 
    345       1.3       uch 	/* read level 2 status and acknowledge */
    346       1.3       uch 	reg_ext = plum_conf_read(regt, regh, PLUM_INT_EXTINTS_REG);
    347       1.3       uch 	plum_conf_write(regt, regh, PLUM_INT_EXTINTS_REG, reg_ext);
    348       1.3       uch 
    349       1.3       uch 	reg_pccard = plum_conf_read(regt, regh, PLUM_INT_PCCINTS_REG);
    350       1.3       uch 	plum_conf_write(regt, regh, PLUM_INT_PCCINTS_REG, reg_pccard);
    351       1.3       uch 
    352       1.1       uch 	for (i = 0; i < PLUM_INTR_MAX; i++) {
    353       1.3       uch 		register struct plum_intr_entry *pi;
    354       1.3       uch 		register const struct plum_intr_ctrl *pic = &pi_ctrl[i];
    355       1.3       uch 
    356       1.3       uch 		if (!(pic->ic_ackpat1 & reg1))
    357       1.3       uch 			continue;
    358       1.3       uch 
    359       1.3       uch 		pi = &sc->sc_intr[i];
    360       1.3       uch 		if (!pi->pi_enabled)
    361       1.3       uch 			continue;
    362       1.3       uch 
    363       1.3       uch 		if (pic->ic_ackreg2 == 0) {
    364       1.3       uch 			(*pi->pi_fun)(pi->pi_arg);
    365       1.3       uch 			continue;
    366       1.1       uch 		}
    367       1.3       uch 
    368       1.3       uch 		reg2 = pic->ic_ackreg2 == PLUM_INT_PCCINTS_REG
    369       1.3       uch 			? reg_pccard : reg_ext;
    370       1.3       uch 
    371       1.3       uch 		if (pic->ic_ackpat2 & reg2)
    372       1.3       uch 			(*pi->pi_fun)(pi->pi_arg);
    373       1.1       uch 	}
    374       1.3       uch 	plum_ei(sc->sc_pc);
    375       1.1       uch 
    376       1.3       uch 	return (0);
    377       1.1       uch }
    378       1.1       uch 
    379       1.3       uch #ifdef PLUMICUDEBUG
    380       1.1       uch void
    381  1.3.10.1   thorpej plumicu_dump(struct plumicu_softc *sc)
    382       1.1       uch {
    383       1.1       uch 	bus_space_tag_t regt = sc->sc_regt;
    384       1.1       uch 	bus_space_handle_t regh = sc->sc_regh;
    385       1.1       uch 	plumreg_t reg;
    386       1.1       uch 
    387       1.1       uch 	printf("status:");
    388       1.1       uch 	reg = plum_conf_read(regt, regh, PLUM_INT_INTSTA_REG);
    389  1.3.10.2  jdolecek 	dbg_bit_print(reg);
    390       1.1       uch 	printf("ExtIO\n");
    391       1.1       uch 	printf("status:");
    392       1.1       uch 	reg = plum_conf_read(regt, regh, PLUM_INT_EXTINTS_REG);
    393  1.3.10.2  jdolecek 	dbg_bit_print(reg);
    394       1.1       uch 	printf("enable:");
    395       1.1       uch 	reg = plum_conf_read(regt, regh, PLUM_INT_EXTIEN_REG);
    396  1.3.10.2  jdolecek  	dbg_bit_print(reg);
    397       1.1       uch 
    398       1.1       uch }
    399       1.3       uch #endif /* PLUMICUDEBUG */
    400