Home | History | Annotate | Line # | Download | only in gemini
gemini_obio.c revision 1.10.68.2
      1  1.10.68.2  thorpej /*	$NetBSD: gemini_obio.c,v 1.10.68.2 2021/04/02 22:17:38 thorpej Exp $	*/
      2        1.1     matt 
      3        1.1     matt /* adapted from:
      4        1.6    cliff  *      NetBSD: omap2_obio.c,v 1.5 2008/10/21 18:50:25 matt Exp
      5        1.1     matt  */
      6        1.1     matt 
      7        1.1     matt /*
      8        1.6    cliff  * Autoconfiguration support for the Gemini "On Board" I/O.
      9        1.1     matt  *
     10        1.6    cliff  * Based on arm/omap/omap2_obio.c which in turn was derived
     11        1.1     matt  * Based on arm/omap/omap_emifs.c which in turn was derived
     12        1.1     matt  * Based on arm/xscale/pxa2x0.c which in turn was derived
     13        1.1     matt  * from arm/sa11x0/sa11x0.c
     14        1.1     matt  *
     15        1.1     matt  * Copyright (c) 2002, 2005  Genetec Corporation.  All rights reserved.
     16        1.1     matt  * Written by Hiroyuki Bessho for Genetec Corporation.
     17        1.1     matt  *
     18        1.1     matt  * Redistribution and use in source and binary forms, with or without
     19        1.1     matt  * modification, are permitted provided that the following conditions
     20        1.1     matt  * are met:
     21        1.1     matt  * 1. Redistributions of source code must retain the above copyright
     22        1.1     matt  *    notice, this list of conditions and the following disclaimer.
     23        1.1     matt  * 2. Redistributions in binary form must reproduce the above copyright
     24        1.1     matt  *    notice, this list of conditions and the following disclaimer in the
     25        1.1     matt  *    documentation and/or other materials provided with the distribution.
     26        1.1     matt  * 3. All advertising materials mentioning features or use of this software
     27        1.1     matt  *    must display the following acknowledgement:
     28        1.1     matt  *	This product includes software developed for the NetBSD Project by
     29        1.1     matt  *	Genetec Corporation.
     30        1.1     matt  * 4. The name of Genetec Corporation may not be used to endorse or
     31        1.1     matt  *    promote products derived from this software without specific prior
     32        1.1     matt  *    written permission.
     33        1.1     matt  *
     34        1.1     matt  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     35        1.1     matt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     36        1.1     matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     37        1.1     matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
     38        1.1     matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     39        1.1     matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     40        1.1     matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     41        1.1     matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     42        1.1     matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     43        1.1     matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     44        1.1     matt  * POSSIBILITY OF SUCH DAMAGE.
     45        1.1     matt  *
     46        1.1     matt  * Copyright (c) 1997,1998, 2001, The NetBSD Foundation, Inc.
     47        1.1     matt  * All rights reserved.
     48        1.1     matt  *
     49        1.1     matt  * This code is derived from software contributed to The NetBSD Foundation
     50        1.1     matt  * by IWAMOTO Toshihiro, Ichiro FUKUHARA and Paul Kranenburg.
     51        1.1     matt  *
     52        1.1     matt  * Redistribution and use in source and binary forms, with or without
     53        1.1     matt  * modification, are permitted provided that the following conditions
     54        1.1     matt  * are met:
     55        1.1     matt  * 1. Redistributions of source code must retain the above copyright
     56        1.1     matt  *    notice, this list of conditions and the following disclaimer.
     57        1.1     matt  * 2. Redistributions in binary form must reproduce the above copyright
     58        1.1     matt  *    notice, this list of conditions and the following disclaimer in the
     59        1.1     matt  *    documentation and/or other materials provided with the distribution.
     60        1.1     matt  *
     61        1.1     matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     62        1.1     matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     63        1.1     matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     64        1.1     matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     65        1.1     matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     66        1.1     matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     67        1.1     matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     68        1.1     matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     69        1.1     matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     70        1.1     matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     71        1.1     matt  * POSSIBILITY OF SUCH DAMAGE.
     72        1.1     matt  *
     73        1.1     matt  * Copyright (c) 1999
     74        1.1     matt  *         Shin Takemura and PocketBSD Project. All rights reserved.
     75        1.1     matt  *
     76        1.1     matt  * Redistribution and use in source and binary forms, with or without
     77        1.1     matt  * modification, are permitted provided that the following conditions
     78        1.1     matt  * are met:
     79        1.1     matt  * 1. Redistributions of source code must retain the above copyright
     80        1.1     matt  *    notice, this list of conditions and the following disclaimer.
     81        1.1     matt  * 2. Redistributions in binary form must reproduce the above copyright
     82        1.1     matt  *    notice, this list of conditions and the following disclaimer in the
     83        1.1     matt  *    documentation and/or other materials provided with the distribution.
     84        1.1     matt  * 3. All advertising materials mentioning features or use of this software
     85        1.1     matt  *    must display the following acknowledgement:
     86        1.1     matt  *	This product includes software developed by the PocketBSD project
     87        1.1     matt  *	and its contributors.
     88        1.1     matt  * 4. Neither the name of the project nor the names of its contributors
     89        1.1     matt  *    may be used to endorse or promote products derived from this software
     90        1.1     matt  *    without specific prior written permission.
     91        1.1     matt  *
     92        1.1     matt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     93        1.1     matt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     94        1.1     matt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     95        1.1     matt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     96        1.1     matt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     97        1.1     matt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     98        1.1     matt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     99        1.1     matt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    100        1.1     matt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    101        1.1     matt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    102        1.1     matt  * SUCH DAMAGE.
    103        1.1     matt  */
    104        1.1     matt 
    105        1.1     matt #include "opt_gemini.h"
    106        1.1     matt #include <sys/cdefs.h>
    107  1.10.68.2  thorpej __KERNEL_RCSID(0, "$NetBSD: gemini_obio.c,v 1.10.68.2 2021/04/02 22:17:38 thorpej Exp $");
    108        1.1     matt 
    109        1.1     matt #include "locators.h"
    110        1.1     matt #include "obio.h"
    111        1.1     matt #include "geminiicu.h"
    112        1.2    cliff #include "pci.h"
    113        1.1     matt 
    114        1.1     matt #include <sys/param.h>
    115        1.1     matt #include <sys/systm.h>
    116        1.1     matt #include <sys/device.h>
    117        1.1     matt #include <sys/kernel.h>
    118        1.1     matt #include <sys/reboot.h>
    119        1.1     matt 
    120        1.1     matt #include <machine/cpu.h>
    121       1.10   dyoung #include <sys/bus.h>
    122        1.1     matt 
    123        1.1     matt #include <arm/cpufunc.h>
    124        1.1     matt #include <arm/mainbus/mainbus.h>
    125        1.1     matt #include <arm/gemini/gemini_var.h>
    126        1.1     matt #include <arm/gemini/gemini_reg.h>
    127        1.1     matt 
    128        1.1     matt #include <arm/gemini/gemini_obiovar.h>
    129        1.1     matt 
    130        1.1     matt typedef struct {
    131        1.1     matt 	boolean_t	cs_valid;
    132        1.1     matt 	ulong		cs_addr;
    133        1.1     matt 	ulong		cs_size;
    134        1.1     matt } obio_csconfig_t;
    135        1.1     matt 
    136        1.1     matt /* prototypes */
    137        1.1     matt static int	obio_match(device_t, cfdata_t, void *);
    138        1.1     matt static void	obio_attach(device_t, device_t, void *);
    139        1.1     matt static int 	obio_search(device_t, cfdata_t, const int *, void *);
    140        1.1     matt static int	obio_find(device_t, cfdata_t, const int *, void *);
    141        1.1     matt static int	obio_print(void *, const char *);
    142        1.1     matt static void	obio_attach_critical(struct obio_softc *);
    143        1.1     matt 
    144        1.1     matt /* attach structures */
    145        1.7    cliff CFATTACH_DECL_NEW(obio, sizeof(struct obio_softc),
    146        1.1     matt 	obio_match, obio_attach, NULL, NULL);
    147        1.1     matt 
    148        1.1     matt 
    149        1.1     matt static int
    150        1.1     matt obio_match(device_t parent, cfdata_t match, void *aux)
    151        1.1     matt {
    152        1.1     matt 	return 1;
    153        1.1     matt }
    154        1.1     matt 
    155        1.1     matt static void
    156        1.1     matt obio_attach(device_t parent, device_t self, void *aux)
    157        1.1     matt {
    158        1.1     matt 	struct obio_softc *sc = device_private(self);
    159        1.1     matt 	struct mainbus_attach_args *mb = (struct mainbus_attach_args *)aux;
    160        1.2    cliff #if NPCI > 0
    161        1.1     matt 	struct pcibus_attach_args pba;
    162        1.2    cliff #endif
    163        1.1     matt 
    164        1.7    cliff 	sc->sc_dev = self;
    165        1.7    cliff 
    166        1.1     matt 	sc->sc_iot = &gemini_bs_tag;
    167        1.1     matt 
    168        1.1     matt 	aprint_normal(": On-Board IO\n");
    169        1.1     matt 
    170        1.6    cliff #if (GEMINI_BUSBASE != 0)
    171        1.5    cliff 	sc->sc_dmarange.dr_sysbase = 0;
    172        1.6    cliff 	sc->sc_dmarange.dr_busbase = (GEMINI_BUSBASE * 1024 * 1024);
    173        1.5    cliff 	sc->sc_dmarange.dr_len = MEMSIZE * 1024 * 1024;
    174        1.5    cliff 	gemini_bus_dma_tag._ranges = &sc->sc_dmarange;
    175        1.5    cliff 	gemini_bus_dma_tag._nranges = 1;
    176        1.5    cliff #endif
    177        1.5    cliff 
    178        1.1     matt 	sc->sc_ioh = 0;
    179        1.1     matt 	sc->sc_dmat = &gemini_bus_dma_tag;
    180        1.1     matt 	sc->sc_base = mb->mb_iobase;
    181        1.1     matt 	sc->sc_size = mb->mb_iosize;
    182        1.1     matt 
    183        1.1     matt 	/*
    184        1.1     matt 	 * Attach critical devices first.
    185        1.1     matt 	 */
    186        1.1     matt 	obio_attach_critical(sc);
    187        1.1     matt 
    188        1.2    cliff #if NPCI > 0
    189        1.1     matt 	/*
    190        1.1     matt 	 * map PCI controller registers
    191        1.1     matt 	 */
    192        1.1     matt 	if (bus_space_map(sc->sc_iot, GEMINI_PCICFG_BASE,
    193        1.1     matt 		GEMINI_PCI_CFG_DATA+4, 0, &sc->sc_pcicfg_ioh)) {
    194        1.1     matt 			aprint_error("cannot map PCI controller at %#x\n",
    195        1.1     matt 				GEMINI_PCICFG_BASE);
    196        1.1     matt 			return;
    197        1.1     matt 	}
    198        1.1     matt 	/*
    199        1.1     matt 	 * initialize the PCI chipset tag
    200        1.1     matt 	 */
    201        1.1     matt 	gemini_pci_init(&sc->sc_pci_chipset, sc);
    202        1.2    cliff #endif	/* NPCI */
    203        1.1     matt 
    204        1.1     matt 	/*
    205        1.1     matt 	 * attach the rest of our devices
    206        1.1     matt 	 */
    207  1.10.68.1  thorpej 	config_search(self, NULL,
    208  1.10.68.1  thorpej 	    CFARG_SUBMATCH, obio_search,
    209  1.10.68.1  thorpej 	    CFARG_IATTR, "obio",
    210  1.10.68.1  thorpej 	    CFARG_EOL);
    211        1.1     matt 
    212        1.2    cliff #if NPCI > 0
    213        1.1     matt 	/*
    214        1.1     matt 	 * attach the PCI bus
    215        1.1     matt 	 */
    216        1.1     matt 	pba.pba_memt = sc->sc_iot;
    217        1.8  mbalmer 	pba.pba_iot =  sc->sc_iot;
    218        1.1     matt 	pba.pba_dmat = sc->sc_dmat;
    219        1.1     matt 	pba.pba_dmat64 = NULL;
    220        1.1     matt 	pba.pba_pc = &sc->sc_pci_chipset;
    221        1.1     matt 	pba.pba_bus = 0;
    222        1.1     matt 	pba.pba_bridgetag = NULL;
    223        1.1     matt 	pba.pba_intrswiz = 0;
    224        1.1     matt 	pba.pba_intrtag = 0;
    225        1.9   dyoung 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
    226        1.1     matt 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
    227        1.1     matt 
    228  1.10.68.2  thorpej 	config_found(sc->sc_dev, &pba, pcibusprint,
    229  1.10.68.2  thorpej 	    CFARG_IATTR, "pcibus",
    230  1.10.68.2  thorpej 	    CFARG_EOL);
    231        1.2    cliff #endif	/* NPCI */
    232        1.1     matt 
    233        1.1     matt }
    234        1.1     matt 
    235        1.1     matt static int
    236        1.1     matt obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    237        1.1     matt {
    238        1.1     matt 	struct obio_softc * const sc = device_private(parent);
    239        1.1     matt 	struct obio_attach_args oa;
    240        1.1     matt 
    241        1.1     matt 	/* Set up the attach args. */
    242        1.1     matt 	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
    243        1.1     matt #if 0
    244        1.1     matt 		if (cf->cf_loc[OBIOCF_MULT] == 1)
    245        1.1     matt 			oa.obio_iot = &nobyteacc_bs_tag;
    246        1.1     matt 		else
    247        1.1     matt #endif
    248        1.1     matt 			panic("nobyteacc specified for device with "
    249        1.1     matt 				"non-byte multiplier\n");
    250        1.1     matt 	} else {
    251        1.1     matt 		switch (cf->cf_loc[OBIOCF_MULT]) {
    252        1.1     matt 		case 1:
    253        1.1     matt 			oa.obio_iot = &gemini_bs_tag;
    254        1.1     matt 			break;
    255        1.1     matt #if 0
    256        1.1     matt 		case 2:
    257        1.1     matt 			oa.obio_iot = &gemini_a2x_bs_tag;
    258        1.1     matt 			break;
    259        1.1     matt #endif
    260        1.1     matt 		case 4:
    261        1.1     matt 			oa.obio_iot = &gemini_a4x_bs_tag;
    262        1.1     matt 			break;
    263        1.1     matt 		default:
    264        1.1     matt 			panic("Unsupported obio bus multiplier.");
    265        1.1     matt 			break;
    266        1.1     matt 		}
    267        1.1     matt 	}
    268        1.1     matt 
    269        1.1     matt 	oa.obio_dmat = sc->sc_dmat;
    270        1.1     matt 	oa.obio_addr = cf->cf_loc[OBIOCF_ADDR];
    271        1.1     matt 	oa.obio_size = cf->cf_loc[OBIOCF_SIZE];
    272        1.1     matt 	oa.obio_intr = cf->cf_loc[OBIOCF_INTR];
    273        1.1     matt 	oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    274        1.1     matt 
    275        1.1     matt 	if (config_match(parent, cf, &oa)) {
    276        1.1     matt 		config_attach(parent, cf, &oa, obio_print);
    277        1.1     matt 		return 0;			/* love it */
    278        1.1     matt 	}
    279        1.1     matt 
    280        1.1     matt 	return UNCONF;	/* NG */
    281        1.1     matt }
    282        1.1     matt 
    283        1.1     matt static int
    284        1.1     matt obio_find(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    285        1.1     matt {
    286        1.1     matt 	struct obio_attach_args * const oa = aux;
    287        1.1     matt 
    288        1.1     matt 	if (oa->obio_addr != OBIOCF_ADDR_DEFAULT
    289        1.1     matt 	    && oa->obio_addr != cf->cf_loc[OBIOCF_ADDR])
    290        1.1     matt 		return 0;
    291        1.1     matt 	if (oa->obio_size != OBIOCF_SIZE_DEFAULT
    292        1.1     matt 	    && oa->obio_size != cf->cf_loc[OBIOCF_SIZE])
    293        1.1     matt 		return 0;
    294        1.1     matt 	if (oa->obio_intr != OBIOCF_INTR_DEFAULT
    295        1.1     matt 	    && oa->obio_intr != cf->cf_loc[OBIOCF_INTR])
    296        1.1     matt 		return 0;
    297        1.1     matt 	if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT
    298        1.1     matt 	    && oa->obio_intrbase != cf->cf_loc[OBIOCF_INTRBASE])
    299        1.1     matt 		return 0;
    300        1.1     matt 
    301        1.1     matt 	/* Set up the attach args. */
    302        1.1     matt 	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
    303        1.1     matt #if 0
    304        1.1     matt 		if (cf->cf_loc[OBIOCF_MULT] == 1)
    305        1.1     matt 			oa->obio_iot = &nobyteacc_bs_tag;
    306        1.1     matt 		else
    307        1.1     matt #endif
    308        1.1     matt 			panic("nobyteacc specified for device with "
    309        1.1     matt 				"non-byte multiplier\n");
    310        1.1     matt 	} else {
    311        1.1     matt 		switch (cf->cf_loc[OBIOCF_MULT]) {
    312        1.1     matt 		case 1:
    313        1.1     matt 			oa->obio_iot = &gemini_bs_tag;
    314        1.1     matt 			break;
    315        1.1     matt #if 0
    316        1.1     matt 		case 2:
    317        1.1     matt 			oa->obio_iot = &gemini_a2x_bs_tag;
    318        1.1     matt 			break;
    319        1.1     matt #endif
    320        1.1     matt 		case 4:
    321        1.1     matt 			oa->obio_iot = &gemini_a4x_bs_tag;
    322        1.1     matt 			break;
    323        1.1     matt 		default:
    324        1.1     matt 			panic("Unsupported obio bus multiplier.");
    325        1.1     matt 			break;
    326        1.1     matt 		}
    327        1.1     matt 	}
    328        1.1     matt 	oa->obio_addr = cf->cf_loc[OBIOCF_ADDR];
    329        1.1     matt 	oa->obio_size = cf->cf_loc[OBIOCF_SIZE];
    330        1.1     matt 	oa->obio_intr = cf->cf_loc[OBIOCF_INTR];
    331        1.1     matt 	oa->obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    332        1.1     matt 
    333        1.1     matt 	return config_match(parent, cf, oa);
    334        1.1     matt }
    335        1.1     matt 
    336        1.1     matt #if NGEMINIICU == 0
    337        1.1     matt #error no geminiicu present in config file
    338        1.1     matt #endif
    339        1.1     matt 
    340        1.1     matt static const struct {
    341        1.1     matt 	const char *name;
    342        1.1     matt 	bus_addr_t addr;
    343        1.1     matt 	bool required;
    344        1.1     matt } critical_devs[] = {
    345        1.4    cliff #if defined(GEMINI_MASTER) || defined(GEMINI_SINGLE)
    346        1.3    cliff 	{ .name = "geminiicu0",   .addr = 0x48000000, .required = true },
    347        1.3    cliff 	{ .name = "geminiwdt0",   .addr = 0x41000000, .required = true },
    348        1.3    cliff 	{ .name = "geminitmr0",   .addr = 0x43000000, .required = true },
    349        1.3    cliff 	{ .name = "geminitmr2",   .addr = 0x43000000, .required = true },
    350        1.3    cliff 	{ .name = "com0",         .addr = 0x42000000, .required = true },
    351        1.4    cliff #elif defined(GEMINI_SLAVE)
    352        1.3    cliff 	{ .name = "geminiicu1",   .addr = 0x49000000, .required = true },
    353        1.3    cliff 	{ .name = "geminitmr1",   .addr = 0x43000000, .required = true },
    354        1.3    cliff 	{ .name = "geminitmr2",   .addr = 0x43000000, .required = true },
    355        1.3    cliff 	{ .name = "geminilpchc0", .addr = 0x47000000, .required = true },
    356        1.2    cliff #endif
    357        1.1     matt };
    358        1.1     matt 
    359        1.1     matt static void
    360        1.1     matt obio_attach_critical(struct obio_softc *sc)
    361        1.1     matt {
    362        1.1     matt 	struct obio_attach_args oa;
    363        1.1     matt 	cfdata_t cf;
    364        1.1     matt 	size_t i;
    365        1.1     matt 
    366        1.1     matt 	for (i = 0; i < __arraycount(critical_devs); i++) {
    367        1.1     matt 		oa.obio_iot = sc->sc_iot;
    368        1.1     matt 		oa.obio_dmat = sc->sc_dmat;
    369        1.1     matt 
    370        1.1     matt 		oa.obio_addr = critical_devs[i].addr;
    371        1.1     matt 		oa.obio_size = OBIOCF_SIZE_DEFAULT;
    372        1.1     matt 		oa.obio_intr = OBIOCF_INTR_DEFAULT;
    373        1.1     matt 		oa.obio_intrbase = OBIOCF_INTRBASE_DEFAULT;
    374        1.1     matt 
    375        1.1     matt #if 0
    376        1.1     matt 		if (oa.obio_addr != OBIOCF_ADDR_DEFAULT
    377        1.1     matt 		    && (oa.obio_addr < sc->sc_base
    378        1.1     matt 		        || oa.obio_addr >= sc->sc_base + sc->sc_size))
    379        1.1     matt 			continue;
    380        1.1     matt #endif
    381        1.1     matt 
    382  1.10.68.1  thorpej 		cf = config_search(sc->sc_dev, &oa,
    383  1.10.68.1  thorpej 		    CFARG_SUBMATCH, obio_find,
    384  1.10.68.1  thorpej 		    CFARG_IATTR, "obio",
    385  1.10.68.1  thorpej 		    CFARG_EOL);
    386        1.1     matt 		if (cf == NULL && critical_devs[i].required)
    387        1.1     matt 			panic("obio_attach_critical: failed to find %s!",
    388        1.1     matt 			    critical_devs[i].name);
    389        1.1     matt 
    390        1.1     matt 		oa.obio_addr = cf->cf_loc[OBIOCF_ADDR];
    391        1.1     matt 		oa.obio_size = cf->cf_loc[OBIOCF_SIZE];
    392        1.1     matt 		oa.obio_intr = cf->cf_loc[OBIOCF_INTR];
    393        1.1     matt 		oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    394        1.7    cliff 		config_attach(sc->sc_dev, cf, &oa, obio_print);
    395        1.1     matt 	}
    396        1.1     matt }
    397        1.1     matt 
    398        1.1     matt static int
    399        1.1     matt obio_print(void *aux, const char *name)
    400        1.1     matt {
    401        1.1     matt 	struct obio_attach_args *oa = (struct obio_attach_args*)aux;
    402        1.1     matt 
    403        1.1     matt 	if (oa->obio_addr != OBIOCF_ADDR_DEFAULT) {
    404        1.1     matt 		aprint_normal(" addr 0x%08lx", oa->obio_addr);
    405        1.1     matt 		if (oa->obio_size != OBIOCF_SIZE_DEFAULT)
    406        1.1     matt 			aprint_normal("-0x%08lx",
    407        1.1     matt 				oa->obio_addr + oa->obio_size-1);
    408        1.1     matt 	}
    409        1.1     matt 	if (oa->obio_intr != OBIOCF_INTR_DEFAULT)
    410        1.1     matt 		aprint_normal(" intr %d", oa->obio_intr);
    411        1.1     matt 	if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT)
    412        1.1     matt 		aprint_normal(" intrbase %d", oa->obio_intrbase);
    413        1.1     matt 
    414        1.1     matt 	return UNCONF;
    415        1.1     matt }
    416