Home | History | Annotate | Line # | Download | only in isa
isa.c revision 1.107.6.3
      1  1.107.6.3   nathanw /*	$NetBSD: isa.c,v 1.107.6.3 2002/01/11 23:39:08 nathanw Exp $	*/
      2       1.58       cgd 
      3        1.1       cgd /*-
      4  1.107.6.3   nathanw  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
      5      1.105   mycroft  * All rights reserved.
      6      1.105   mycroft  *
      7      1.105   mycroft  * This code is derived from software contributed to The NetBSD Foundation
      8  1.107.6.3   nathanw  * by Charles M. Hannum; by Jason R. Thorpe of Wasabi Systems, Inc.
      9        1.1       cgd  *
     10        1.1       cgd  * Redistribution and use in source and binary forms, with or without
     11        1.1       cgd  * modification, are permitted provided that the following conditions
     12        1.1       cgd  * are met:
     13        1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     14        1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     15        1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     16        1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     17        1.1       cgd  *    documentation and/or other materials provided with the distribution.
     18        1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     19        1.1       cgd  *    must display the following acknowledgement:
     20      1.105   mycroft  *        This product includes software developed by the NetBSD
     21      1.105   mycroft  *        Foundation, Inc. and its contributors.
     22      1.105   mycroft  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.105   mycroft  *    contributors may be used to endorse or promote products derived
     24      1.105   mycroft  *    from this software without specific prior written permission.
     25        1.1       cgd  *
     26      1.105   mycroft  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.105   mycroft  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.105   mycroft  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.105   mycroft  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.105   mycroft  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.105   mycroft  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.105   mycroft  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.105   mycroft  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.105   mycroft  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.105   mycroft  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.105   mycroft  * POSSIBILITY OF SUCH DAMAGE.
     37        1.1       cgd  */
     38  1.107.6.2   nathanw 
     39  1.107.6.2   nathanw #include <sys/cdefs.h>
     40  1.107.6.3   nathanw __KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.107.6.3 2002/01/11 23:39:08 nathanw Exp $");
     41        1.1       cgd 
     42       1.31   mycroft #include <sys/param.h>
     43       1.31   mycroft #include <sys/systm.h>
     44       1.40   mycroft #include <sys/kernel.h>
     45       1.31   mycroft #include <sys/malloc.h>
     46       1.46   mycroft #include <sys/device.h>
     47       1.85   thorpej 
     48       1.85   thorpej #include <machine/intr.h>
     49       1.31   mycroft 
     50       1.72       cgd #include <dev/isa/isareg.h>
     51       1.72       cgd #include <dev/isa/isavar.h>
     52       1.95   thorpej #include <dev/isa/isadmareg.h>
     53       1.77       cgd 
     54      1.102       leo #include "isadma.h"
     55      1.102       leo 
     56      1.103  christos #include "isapnp.h"
     57  1.107.6.1   nathanw #if NISAPNP > 0
     58      1.103  christos #include <dev/isapnp/isapnpreg.h>
     59      1.103  christos #include <dev/isapnp/isapnpvar.h>
     60      1.103  christos #endif
     61      1.103  christos 
     62  1.107.6.3   nathanw int	isamatch(struct device *, struct cfdata *, void *);
     63  1.107.6.3   nathanw void	isaattach(struct device *, struct device *, void *);
     64  1.107.6.3   nathanw int	isaprint(void *, const char *);
     65       1.77       cgd 
     66       1.79   thorpej struct cfattach isa_ca = {
     67       1.79   thorpej 	sizeof(struct isa_softc), isamatch, isaattach
     68       1.79   thorpej };
     69       1.79   thorpej 
     70  1.107.6.3   nathanw void	isa_attach_knowndevs(struct isa_softc *);
     71  1.107.6.3   nathanw void	isa_free_knowndevs(struct isa_softc *);
     72  1.107.6.3   nathanw 
     73  1.107.6.3   nathanw int	isasubmatch(struct device *, struct cfdata *, void *);
     74  1.107.6.3   nathanw int	isasearch(struct device *, struct cfdata *, void *);
     75       1.91       cgd 
     76       1.77       cgd int
     77  1.107.6.3   nathanw isamatch(struct device *parent, struct cfdata *cf, void *aux)
     78       1.77       cgd {
     79       1.77       cgd 	struct isabus_attach_args *iba = aux;
     80       1.77       cgd 
     81       1.77       cgd 	if (strcmp(iba->iba_busname, cf->cf_driver->cd_name))
     82       1.77       cgd 		return (0);
     83       1.77       cgd 
     84       1.77       cgd 	/* XXX check other indicators */
     85       1.77       cgd 
     86       1.77       cgd         return (1);
     87       1.77       cgd }
     88       1.77       cgd 
     89       1.77       cgd void
     90  1.107.6.3   nathanw isaattach(struct device *parent, struct device *self, void *aux)
     91       1.77       cgd {
     92       1.77       cgd 	struct isa_softc *sc = (struct isa_softc *)self;
     93       1.77       cgd 	struct isabus_attach_args *iba = aux;
     94       1.98   thorpej 
     95  1.107.6.3   nathanw 	TAILQ_INIT(&sc->sc_knowndevs);
     96  1.107.6.3   nathanw 	sc->sc_dynamicdevs = 0;
     97  1.107.6.3   nathanw 
     98       1.80       cgd 	isa_attach_hook(parent, self, iba);
     99       1.88  christos 	printf("\n");
    100       1.77       cgd 
    101  1.107.6.3   nathanw 	/* XXX Add code to fetch known-devices. */
    102  1.107.6.3   nathanw 
    103       1.89   thorpej 	sc->sc_iot = iba->iba_iot;
    104       1.89   thorpej 	sc->sc_memt = iba->iba_memt;
    105       1.95   thorpej 	sc->sc_dmat = iba->iba_dmat;
    106       1.80       cgd 	sc->sc_ic = iba->iba_ic;
    107      1.103  christos 
    108      1.103  christos #if NISAPNP > 0
    109      1.103  christos 	/*
    110      1.103  christos 	 * Reset isapnp cards that the bios configured for us
    111      1.103  christos 	 */
    112      1.103  christos 	isapnp_isa_attach_hook(sc);
    113      1.103  christos #endif
    114       1.78       cgd 
    115      1.102       leo #if NISADMA > 0
    116       1.82   thorpej 	/*
    117      1.101   thorpej 	 * Initialize our DMA state.
    118       1.95   thorpej 	 */
    119      1.101   thorpej 	isa_dmainit(sc->sc_ic, sc->sc_iot, sc->sc_dmat, self);
    120      1.102       leo #endif
    121      1.100  drochner 
    122  1.107.6.3   nathanw 	/* Attach all direct-config children. */
    123  1.107.6.3   nathanw 	isa_attach_knowndevs(sc);
    124  1.107.6.3   nathanw 
    125  1.107.6.3   nathanw 	/*
    126  1.107.6.3   nathanw 	 * If we don't support dynamic hello/goodbye of devices,
    127  1.107.6.3   nathanw 	 * then free the knowndevs info now.
    128  1.107.6.3   nathanw 	 */
    129  1.107.6.3   nathanw 	if (sc->sc_dynamicdevs == 0)
    130  1.107.6.3   nathanw 		isa_free_knowndevs(sc);
    131  1.107.6.3   nathanw 
    132  1.107.6.3   nathanw 	/* Attach all indrect-config children. */
    133       1.91       cgd 	config_search(isasearch, self, NULL);
    134       1.77       cgd }
    135        1.1       cgd 
    136  1.107.6.3   nathanw void
    137  1.107.6.3   nathanw isa_attach_knowndevs(struct isa_softc *sc)
    138  1.107.6.3   nathanw {
    139  1.107.6.3   nathanw 	struct isa_attach_args ia;
    140  1.107.6.3   nathanw 	struct isa_knowndev *ik;
    141  1.107.6.3   nathanw 
    142  1.107.6.3   nathanw 	if (TAILQ_EMPTY(&sc->sc_knowndevs))
    143  1.107.6.3   nathanw 		return;
    144  1.107.6.3   nathanw 
    145  1.107.6.3   nathanw 	TAILQ_FOREACH(ik, &sc->sc_knowndevs, ik_list) {
    146  1.107.6.3   nathanw 		if (ik->ik_claimed != NULL)
    147  1.107.6.3   nathanw 			continue;
    148  1.107.6.3   nathanw 
    149  1.107.6.3   nathanw 		ia.ia_iot = sc->sc_iot;
    150  1.107.6.3   nathanw 		ia.ia_memt = sc->sc_memt;
    151  1.107.6.3   nathanw 		ia.ia_dmat = sc->sc_dmat;
    152  1.107.6.3   nathanw 		ia.ia_ic = sc->sc_ic;
    153  1.107.6.3   nathanw 
    154  1.107.6.3   nathanw 		ia.ia_pnpname = ik->ik_pnpname;
    155  1.107.6.3   nathanw 		ia.ia_pnpcompatnames = ik->ik_pnpcompatnames;
    156  1.107.6.3   nathanw 
    157  1.107.6.3   nathanw 		ia.ia_io = ik->ik_io;
    158  1.107.6.3   nathanw 		ia.ia_nio = ik->ik_nio;
    159  1.107.6.3   nathanw 
    160  1.107.6.3   nathanw 		ia.ia_iomem = ik->ik_iomem;
    161  1.107.6.3   nathanw 		ia.ia_niomem = ik->ik_niomem;
    162  1.107.6.3   nathanw 
    163  1.107.6.3   nathanw 		ia.ia_irq = ik->ik_irq;
    164  1.107.6.3   nathanw 		ia.ia_nirq = ik->ik_nirq;
    165  1.107.6.3   nathanw 
    166  1.107.6.3   nathanw 		ia.ia_drq = ik->ik_drq;
    167  1.107.6.3   nathanw 		ia.ia_ndrq = ik->ik_ndrq;
    168  1.107.6.3   nathanw 
    169  1.107.6.3   nathanw 		ia.ia_aux = NULL;
    170  1.107.6.3   nathanw 
    171  1.107.6.3   nathanw 		ik->ik_claimed = config_found_sm(&sc->sc_dev, &ia,
    172  1.107.6.3   nathanw 		    isaprint, isasubmatch);
    173  1.107.6.3   nathanw 	}
    174  1.107.6.3   nathanw }
    175  1.107.6.3   nathanw 
    176  1.107.6.3   nathanw void
    177  1.107.6.3   nathanw isa_free_knowndevs(struct isa_softc *sc)
    178  1.107.6.3   nathanw {
    179  1.107.6.3   nathanw 	struct isa_knowndev *ik;
    180  1.107.6.3   nathanw 	struct isa_pnpname *ipn;
    181  1.107.6.3   nathanw 
    182  1.107.6.3   nathanw #define	FREEIT(x)	if (x != NULL) free(x, M_DEVBUF)
    183  1.107.6.3   nathanw 
    184  1.107.6.3   nathanw 	while ((ik = TAILQ_FIRST(&sc->sc_knowndevs)) != NULL) {
    185  1.107.6.3   nathanw 		TAILQ_REMOVE(&sc->sc_knowndevs, ik, ik_list);
    186  1.107.6.3   nathanw 		FREEIT(ik->ik_pnpname);
    187  1.107.6.3   nathanw 		while ((ipn = ik->ik_pnpcompatnames) != NULL) {
    188  1.107.6.3   nathanw 			ik->ik_pnpcompatnames = ipn->ipn_next;
    189  1.107.6.3   nathanw 			free(ipn->ipn_name, M_DEVBUF);
    190  1.107.6.3   nathanw 			free(ipn, M_DEVBUF);
    191  1.107.6.3   nathanw 		}
    192  1.107.6.3   nathanw 		FREEIT(ik->ik_io);
    193  1.107.6.3   nathanw 		FREEIT(ik->ik_iomem);
    194  1.107.6.3   nathanw 		FREEIT(ik->ik_irq);
    195  1.107.6.3   nathanw 		FREEIT(ik->ik_drq);
    196  1.107.6.3   nathanw 		free(ik, M_DEVBUF);
    197  1.107.6.3   nathanw 	}
    198  1.107.6.3   nathanw 
    199  1.107.6.3   nathanw #undef FREEIT
    200  1.107.6.3   nathanw }
    201  1.107.6.3   nathanw 
    202  1.107.6.3   nathanw int
    203  1.107.6.3   nathanw isasubmatch(struct device *parent, struct cfdata *cf, void *aux)
    204  1.107.6.3   nathanw {
    205  1.107.6.3   nathanw 	struct isa_attach_args *ia = aux;
    206  1.107.6.3   nathanw 	int i;
    207  1.107.6.3   nathanw 
    208  1.107.6.3   nathanw 	if (ia->ia_nio == 0) {
    209  1.107.6.3   nathanw 		if (cf->cf_iobase != ISACF_PORT_DEFAULT)
    210  1.107.6.3   nathanw 			return (0);
    211  1.107.6.3   nathanw 	} else {
    212  1.107.6.3   nathanw 		if (cf->cf_iobase != ISACF_PORT_DEFAULT &&
    213  1.107.6.3   nathanw 		    cf->cf_iobase != ia->ia_io[0].ir_addr)
    214  1.107.6.3   nathanw 			return (0);
    215  1.107.6.3   nathanw 	}
    216  1.107.6.3   nathanw 
    217  1.107.6.3   nathanw 	if (ia->ia_niomem == 0) {
    218  1.107.6.3   nathanw 		if (cf->cf_maddr != ISACF_IOMEM_DEFAULT)
    219  1.107.6.3   nathanw 			return (0);
    220  1.107.6.3   nathanw 	} else {
    221  1.107.6.3   nathanw 		if (cf->cf_maddr != ISACF_IOMEM_DEFAULT &&
    222  1.107.6.3   nathanw 		    cf->cf_maddr != ia->ia_iomem[0].ir_addr)
    223  1.107.6.3   nathanw 			return (0);
    224  1.107.6.3   nathanw 	}
    225  1.107.6.3   nathanw 
    226  1.107.6.3   nathanw 	if (ia->ia_nirq == 0) {
    227  1.107.6.3   nathanw 		if (cf->cf_irq != ISACF_IRQ_DEFAULT)
    228  1.107.6.3   nathanw 			return (0);
    229  1.107.6.3   nathanw 	} else {
    230  1.107.6.3   nathanw 		if (cf->cf_irq != ISACF_IRQ_DEFAULT &&
    231  1.107.6.3   nathanw 		    cf->cf_irq != ia->ia_irq[0].ir_irq)
    232  1.107.6.3   nathanw 			return (0);
    233  1.107.6.3   nathanw 	}
    234  1.107.6.3   nathanw 
    235  1.107.6.3   nathanw 	if (ia->ia_ndrq == 0) {
    236  1.107.6.3   nathanw 		if (cf->cf_drq != ISACF_DRQ_DEFAULT)
    237  1.107.6.3   nathanw 			return (0);
    238  1.107.6.3   nathanw 		if (cf->cf_drq2 != ISACF_DRQ_DEFAULT)
    239  1.107.6.3   nathanw 			return (0);
    240  1.107.6.3   nathanw 	} else {
    241  1.107.6.3   nathanw 		for (i = 0; i < 2; i++) {
    242  1.107.6.3   nathanw 			if (i == ia->ia_ndrq)
    243  1.107.6.3   nathanw 				break;
    244  1.107.6.3   nathanw 			if (cf->cf_loc[ISACF_DRQ + i] != ISACF_DRQ_DEFAULT &&
    245  1.107.6.3   nathanw 			    cf->cf_loc[ISACF_DRQ + i] != ia->ia_drq[i].ir_drq)
    246  1.107.6.3   nathanw 				return (0);
    247  1.107.6.3   nathanw 		}
    248  1.107.6.3   nathanw 		for (; i < 2; i++) {
    249  1.107.6.3   nathanw 			if (cf->cf_loc[ISACF_DRQ + i] != ISACF_DRQ_DEFAULT)
    250  1.107.6.3   nathanw 				return (0);
    251  1.107.6.3   nathanw 		}
    252  1.107.6.3   nathanw 	}
    253  1.107.6.3   nathanw 
    254  1.107.6.3   nathanw 	return ((*cf->cf_attach->ca_match)(parent, cf, aux));
    255  1.107.6.3   nathanw }
    256  1.107.6.3   nathanw 
    257       1.46   mycroft int
    258  1.107.6.3   nathanw isaprint(void *aux, const char *isa)
    259       1.46   mycroft {
    260       1.46   mycroft 	struct isa_attach_args *ia = aux;
    261  1.107.6.3   nathanw 	const char *sep;
    262  1.107.6.3   nathanw 	int i;
    263  1.107.6.3   nathanw 
    264  1.107.6.3   nathanw 	/*
    265  1.107.6.3   nathanw 	 * This block of code only fires if we have a direct-config'd
    266  1.107.6.3   nathanw 	 * device for which there is no driver match.
    267  1.107.6.3   nathanw 	 */
    268  1.107.6.3   nathanw 	if (isa != NULL) {
    269  1.107.6.3   nathanw 		struct isa_pnpname *ipn;
    270  1.107.6.3   nathanw 
    271  1.107.6.3   nathanw 		if (ia->ia_pnpname != NULL)
    272  1.107.6.3   nathanw 			printf("%s", ia->ia_pnpname);
    273  1.107.6.3   nathanw 		if ((ipn = ia->ia_pnpcompatnames) != NULL) {
    274  1.107.6.3   nathanw 			printf(" (");	/* ) */
    275  1.107.6.3   nathanw 			for (sep = ""; ipn != NULL;
    276  1.107.6.3   nathanw 			     ipn = ipn->ipn_next, sep = " ") {
    277  1.107.6.3   nathanw 				printf("%s%s", sep, ipn->ipn_name);
    278  1.107.6.3   nathanw 			}
    279  1.107.6.3   nathanw 	/* ( */		printf(")");
    280  1.107.6.3   nathanw 		}
    281  1.107.6.3   nathanw 		printf(" at %s", isa);
    282  1.107.6.3   nathanw 	}
    283  1.107.6.3   nathanw 
    284  1.107.6.3   nathanw 	if (ia->ia_nio) {
    285  1.107.6.3   nathanw 		sep = "";
    286  1.107.6.3   nathanw 		printf(" port ");
    287  1.107.6.3   nathanw 		for (i = 0; i < ia->ia_nio; i++) {
    288  1.107.6.3   nathanw 			if (ia->ia_io[i].ir_size == 0)
    289  1.107.6.3   nathanw 				continue;
    290  1.107.6.3   nathanw 			printf("%s0x%x", sep, ia->ia_io[i].ir_addr);
    291  1.107.6.3   nathanw 			if (ia->ia_io[i].ir_size > 1)
    292  1.107.6.3   nathanw 				printf("-0x%x", ia->ia_io[i].ir_addr +
    293  1.107.6.3   nathanw 				    ia->ia_io[i].ir_size - 1);
    294  1.107.6.3   nathanw 			sep = ",";
    295  1.107.6.3   nathanw 		}
    296  1.107.6.3   nathanw 	}
    297  1.107.6.3   nathanw 
    298  1.107.6.3   nathanw 	if (ia->ia_niomem) {
    299  1.107.6.3   nathanw 		sep = "";
    300  1.107.6.3   nathanw 		printf(" iomem ");
    301  1.107.6.3   nathanw 		for (i = 0; i < ia->ia_niomem; i++) {
    302  1.107.6.3   nathanw 			if (ia->ia_iomem[i].ir_size == 0)
    303  1.107.6.3   nathanw 				continue;
    304  1.107.6.3   nathanw 			printf("%s0x%x", sep, ia->ia_iomem[i].ir_addr);
    305  1.107.6.3   nathanw 			if (ia->ia_iomem[i].ir_size > 1)
    306  1.107.6.3   nathanw 				printf("-0x%x", ia->ia_iomem[i].ir_addr +
    307  1.107.6.3   nathanw 				    ia->ia_iomem[i].ir_size - 1);
    308  1.107.6.3   nathanw 			sep = ",";
    309  1.107.6.3   nathanw 		}
    310  1.107.6.3   nathanw 	}
    311  1.107.6.3   nathanw 
    312  1.107.6.3   nathanw 	if (ia->ia_nirq) {
    313  1.107.6.3   nathanw 		sep = "";
    314  1.107.6.3   nathanw 		printf(" irq ");
    315  1.107.6.3   nathanw 		for (i = 0; i < ia->ia_nirq; i++) {
    316  1.107.6.3   nathanw 			if (ia->ia_irq[i].ir_irq == ISACF_IRQ_DEFAULT)
    317  1.107.6.3   nathanw 				continue;
    318  1.107.6.3   nathanw 			printf("%s%d", sep, ia->ia_irq[i].ir_irq);
    319  1.107.6.3   nathanw 			sep = ",";
    320  1.107.6.3   nathanw 		}
    321  1.107.6.3   nathanw 	}
    322  1.107.6.3   nathanw 
    323  1.107.6.3   nathanw 	if (ia->ia_ndrq) {
    324  1.107.6.3   nathanw 		sep = "";
    325  1.107.6.3   nathanw 		printf(" drq ");
    326  1.107.6.3   nathanw 		for (i = 0; i < ia->ia_ndrq; i++) {
    327  1.107.6.3   nathanw 			if (ia->ia_drq[i].ir_drq == ISACF_DRQ_DEFAULT)
    328  1.107.6.3   nathanw 				continue;
    329  1.107.6.3   nathanw 			printf("%s%d", sep, ia->ia_drq[i].ir_drq);
    330  1.107.6.3   nathanw 			sep = ",";
    331  1.107.6.3   nathanw 		}
    332  1.107.6.3   nathanw 	}
    333       1.46   mycroft 
    334       1.71   mycroft 	return (UNCONF);
    335       1.46   mycroft }
    336       1.46   mycroft 
    337       1.94       cgd int
    338  1.107.6.3   nathanw isasearch(struct device *parent, struct cfdata *cf, void *aux)
    339       1.94       cgd {
    340  1.107.6.3   nathanw 	struct isa_io res_io[1];
    341  1.107.6.3   nathanw 	struct isa_iomem res_mem[1];
    342  1.107.6.3   nathanw 	struct isa_irq res_irq[1];
    343  1.107.6.3   nathanw 	struct isa_drq res_drq[2];
    344       1.94       cgd 	struct isa_softc *sc = (struct isa_softc *)parent;
    345       1.94       cgd 	struct isa_attach_args ia;
    346       1.94       cgd 	int tryagain;
    347       1.94       cgd 
    348       1.94       cgd 	do {
    349  1.107.6.3   nathanw 		ia.ia_pnpname = NULL;
    350  1.107.6.3   nathanw 		ia.ia_pnpcompatnames = NULL;
    351  1.107.6.3   nathanw 
    352  1.107.6.3   nathanw 		res_io[0].ir_addr = cf->cf_loc[ISACF_PORT];
    353  1.107.6.3   nathanw 		res_io[0].ir_size = 0;
    354  1.107.6.3   nathanw 
    355  1.107.6.3   nathanw 		res_mem[0].ir_addr = cf->cf_loc[ISACF_IOMEM];
    356  1.107.6.3   nathanw 		res_mem[0].ir_size = cf->cf_loc[ISACF_IOSIZ];
    357  1.107.6.3   nathanw 
    358  1.107.6.3   nathanw 		res_irq[0].ir_irq =
    359  1.107.6.3   nathanw 		    cf->cf_loc[ISACF_IRQ] == 2 ? 9 : cf->cf_loc[ISACF_IRQ];
    360  1.107.6.3   nathanw 
    361  1.107.6.3   nathanw 		res_drq[0].ir_drq = cf->cf_loc[ISACF_DRQ];
    362  1.107.6.3   nathanw 		res_drq[1].ir_drq = cf->cf_loc[ISACF_DRQ2];
    363  1.107.6.3   nathanw 
    364       1.94       cgd 		ia.ia_iot = sc->sc_iot;
    365       1.94       cgd 		ia.ia_memt = sc->sc_memt;
    366       1.95   thorpej 		ia.ia_dmat = sc->sc_dmat;
    367       1.94       cgd 		ia.ia_ic = sc->sc_ic;
    368  1.107.6.3   nathanw 
    369  1.107.6.3   nathanw 		ia.ia_io = res_io;
    370  1.107.6.3   nathanw 		ia.ia_nio = 1;
    371  1.107.6.3   nathanw 
    372  1.107.6.3   nathanw 		ia.ia_iomem = res_mem;
    373  1.107.6.3   nathanw 		ia.ia_niomem = 1;
    374  1.107.6.3   nathanw 
    375  1.107.6.3   nathanw 		ia.ia_irq = res_irq;
    376  1.107.6.3   nathanw 		ia.ia_nirq = 1;
    377  1.107.6.3   nathanw 
    378  1.107.6.3   nathanw 		ia.ia_drq = res_drq;
    379  1.107.6.3   nathanw 		ia.ia_ndrq = 2;
    380       1.94       cgd 
    381       1.94       cgd 		tryagain = 0;
    382       1.94       cgd 		if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0) {
    383       1.94       cgd 			config_attach(parent, cf, &ia, isaprint);
    384       1.94       cgd 			tryagain = (cf->cf_fstate == FSTATE_STAR);
    385       1.94       cgd 		}
    386       1.94       cgd 	} while (tryagain);
    387       1.94       cgd 
    388       1.91       cgd 	return (0);
    389       1.72       cgd }
    390       1.72       cgd 
    391       1.72       cgd char *
    392  1.107.6.3   nathanw isa_intr_typename(int type)
    393       1.72       cgd {
    394       1.72       cgd 
    395       1.72       cgd 	switch (type) {
    396       1.75   mycroft         case IST_NONE :
    397       1.72       cgd 		return ("none");
    398       1.75   mycroft         case IST_PULSE:
    399       1.72       cgd 		return ("pulsed");
    400       1.75   mycroft         case IST_EDGE:
    401       1.72       cgd 		return ("edge-triggered");
    402       1.75   mycroft         case IST_LEVEL:
    403       1.72       cgd 		return ("level-triggered");
    404       1.72       cgd 	default:
    405       1.72       cgd 		panic("isa_intr_typename: invalid type %d", type);
    406       1.72       cgd 	}
    407        1.1       cgd }
    408