Home | History | Annotate | Line # | Download | only in gemini
      1  1.12  thorpej /*	$NetBSD: gemini_obio.c,v 1.12 2021/08/07 16:18:44 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.12  thorpej __KERNEL_RCSID(0, "$NetBSD: gemini_obio.c,v 1.12 2021/08/07 16:18:44 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.11  thorpej 	config_search(self, NULL,
    208  1.12  thorpej 	    CFARGS(.search = obio_search,
    209  1.12  thorpej 		   .iattr = "obio"));
    210   1.1     matt 
    211   1.2    cliff #if NPCI > 0
    212   1.1     matt 	/*
    213   1.1     matt 	 * attach the PCI bus
    214   1.1     matt 	 */
    215   1.1     matt 	pba.pba_memt = sc->sc_iot;
    216   1.8  mbalmer 	pba.pba_iot =  sc->sc_iot;
    217   1.1     matt 	pba.pba_dmat = sc->sc_dmat;
    218   1.1     matt 	pba.pba_dmat64 = NULL;
    219   1.1     matt 	pba.pba_pc = &sc->sc_pci_chipset;
    220   1.1     matt 	pba.pba_bus = 0;
    221   1.1     matt 	pba.pba_bridgetag = NULL;
    222   1.1     matt 	pba.pba_intrswiz = 0;
    223   1.1     matt 	pba.pba_intrtag = 0;
    224   1.9   dyoung 	pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
    225   1.1     matt 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
    226   1.1     matt 
    227  1.11  thorpej 	config_found(sc->sc_dev, &pba, pcibusprint,
    228  1.12  thorpej 	    CFARGS(.iattr = "pcibus"));
    229   1.2    cliff #endif	/* NPCI */
    230   1.1     matt 
    231   1.1     matt }
    232   1.1     matt 
    233   1.1     matt static int
    234   1.1     matt obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    235   1.1     matt {
    236   1.1     matt 	struct obio_softc * const sc = device_private(parent);
    237   1.1     matt 	struct obio_attach_args oa;
    238   1.1     matt 
    239   1.1     matt 	/* Set up the attach args. */
    240   1.1     matt 	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
    241   1.1     matt #if 0
    242   1.1     matt 		if (cf->cf_loc[OBIOCF_MULT] == 1)
    243   1.1     matt 			oa.obio_iot = &nobyteacc_bs_tag;
    244   1.1     matt 		else
    245   1.1     matt #endif
    246   1.1     matt 			panic("nobyteacc specified for device with "
    247   1.1     matt 				"non-byte multiplier\n");
    248   1.1     matt 	} else {
    249   1.1     matt 		switch (cf->cf_loc[OBIOCF_MULT]) {
    250   1.1     matt 		case 1:
    251   1.1     matt 			oa.obio_iot = &gemini_bs_tag;
    252   1.1     matt 			break;
    253   1.1     matt #if 0
    254   1.1     matt 		case 2:
    255   1.1     matt 			oa.obio_iot = &gemini_a2x_bs_tag;
    256   1.1     matt 			break;
    257   1.1     matt #endif
    258   1.1     matt 		case 4:
    259   1.1     matt 			oa.obio_iot = &gemini_a4x_bs_tag;
    260   1.1     matt 			break;
    261   1.1     matt 		default:
    262   1.1     matt 			panic("Unsupported obio bus multiplier.");
    263   1.1     matt 			break;
    264   1.1     matt 		}
    265   1.1     matt 	}
    266   1.1     matt 
    267   1.1     matt 	oa.obio_dmat = sc->sc_dmat;
    268   1.1     matt 	oa.obio_addr = cf->cf_loc[OBIOCF_ADDR];
    269   1.1     matt 	oa.obio_size = cf->cf_loc[OBIOCF_SIZE];
    270   1.1     matt 	oa.obio_intr = cf->cf_loc[OBIOCF_INTR];
    271   1.1     matt 	oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    272   1.1     matt 
    273  1.11  thorpej 	if (config_probe(parent, cf, &oa)) {
    274  1.12  thorpej 		config_attach(parent, cf, &oa, obio_print, CFARGS_NONE);
    275   1.1     matt 		return 0;			/* love it */
    276   1.1     matt 	}
    277   1.1     matt 
    278   1.1     matt 	return UNCONF;	/* NG */
    279   1.1     matt }
    280   1.1     matt 
    281   1.1     matt static int
    282   1.1     matt obio_find(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
    283   1.1     matt {
    284   1.1     matt 	struct obio_attach_args * const oa = aux;
    285   1.1     matt 
    286   1.1     matt 	if (oa->obio_addr != OBIOCF_ADDR_DEFAULT
    287   1.1     matt 	    && oa->obio_addr != cf->cf_loc[OBIOCF_ADDR])
    288   1.1     matt 		return 0;
    289   1.1     matt 	if (oa->obio_size != OBIOCF_SIZE_DEFAULT
    290   1.1     matt 	    && oa->obio_size != cf->cf_loc[OBIOCF_SIZE])
    291   1.1     matt 		return 0;
    292   1.1     matt 	if (oa->obio_intr != OBIOCF_INTR_DEFAULT
    293   1.1     matt 	    && oa->obio_intr != cf->cf_loc[OBIOCF_INTR])
    294   1.1     matt 		return 0;
    295   1.1     matt 	if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT
    296   1.1     matt 	    && oa->obio_intrbase != cf->cf_loc[OBIOCF_INTRBASE])
    297   1.1     matt 		return 0;
    298   1.1     matt 
    299   1.1     matt 	/* Set up the attach args. */
    300   1.1     matt 	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
    301   1.1     matt #if 0
    302   1.1     matt 		if (cf->cf_loc[OBIOCF_MULT] == 1)
    303   1.1     matt 			oa->obio_iot = &nobyteacc_bs_tag;
    304   1.1     matt 		else
    305   1.1     matt #endif
    306   1.1     matt 			panic("nobyteacc specified for device with "
    307   1.1     matt 				"non-byte multiplier\n");
    308   1.1     matt 	} else {
    309   1.1     matt 		switch (cf->cf_loc[OBIOCF_MULT]) {
    310   1.1     matt 		case 1:
    311   1.1     matt 			oa->obio_iot = &gemini_bs_tag;
    312   1.1     matt 			break;
    313   1.1     matt #if 0
    314   1.1     matt 		case 2:
    315   1.1     matt 			oa->obio_iot = &gemini_a2x_bs_tag;
    316   1.1     matt 			break;
    317   1.1     matt #endif
    318   1.1     matt 		case 4:
    319   1.1     matt 			oa->obio_iot = &gemini_a4x_bs_tag;
    320   1.1     matt 			break;
    321   1.1     matt 		default:
    322   1.1     matt 			panic("Unsupported obio bus multiplier.");
    323   1.1     matt 			break;
    324   1.1     matt 		}
    325   1.1     matt 	}
    326   1.1     matt 	oa->obio_addr = cf->cf_loc[OBIOCF_ADDR];
    327   1.1     matt 	oa->obio_size = cf->cf_loc[OBIOCF_SIZE];
    328   1.1     matt 	oa->obio_intr = cf->cf_loc[OBIOCF_INTR];
    329   1.1     matt 	oa->obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    330   1.1     matt 
    331   1.1     matt 	return config_match(parent, cf, oa);
    332   1.1     matt }
    333   1.1     matt 
    334   1.1     matt #if NGEMINIICU == 0
    335   1.1     matt #error no geminiicu present in config file
    336   1.1     matt #endif
    337   1.1     matt 
    338   1.1     matt static const struct {
    339   1.1     matt 	const char *name;
    340   1.1     matt 	bus_addr_t addr;
    341   1.1     matt 	bool required;
    342   1.1     matt } critical_devs[] = {
    343   1.4    cliff #if defined(GEMINI_MASTER) || defined(GEMINI_SINGLE)
    344   1.3    cliff 	{ .name = "geminiicu0",   .addr = 0x48000000, .required = true },
    345   1.3    cliff 	{ .name = "geminiwdt0",   .addr = 0x41000000, .required = true },
    346   1.3    cliff 	{ .name = "geminitmr0",   .addr = 0x43000000, .required = true },
    347   1.3    cliff 	{ .name = "geminitmr2",   .addr = 0x43000000, .required = true },
    348   1.3    cliff 	{ .name = "com0",         .addr = 0x42000000, .required = true },
    349   1.4    cliff #elif defined(GEMINI_SLAVE)
    350   1.3    cliff 	{ .name = "geminiicu1",   .addr = 0x49000000, .required = true },
    351   1.3    cliff 	{ .name = "geminitmr1",   .addr = 0x43000000, .required = true },
    352   1.3    cliff 	{ .name = "geminitmr2",   .addr = 0x43000000, .required = true },
    353   1.3    cliff 	{ .name = "geminilpchc0", .addr = 0x47000000, .required = true },
    354   1.2    cliff #endif
    355   1.1     matt };
    356   1.1     matt 
    357   1.1     matt static void
    358   1.1     matt obio_attach_critical(struct obio_softc *sc)
    359   1.1     matt {
    360   1.1     matt 	struct obio_attach_args oa;
    361   1.1     matt 	cfdata_t cf;
    362   1.1     matt 	size_t i;
    363   1.1     matt 
    364   1.1     matt 	for (i = 0; i < __arraycount(critical_devs); i++) {
    365   1.1     matt 		oa.obio_iot = sc->sc_iot;
    366   1.1     matt 		oa.obio_dmat = sc->sc_dmat;
    367   1.1     matt 
    368   1.1     matt 		oa.obio_addr = critical_devs[i].addr;
    369   1.1     matt 		oa.obio_size = OBIOCF_SIZE_DEFAULT;
    370   1.1     matt 		oa.obio_intr = OBIOCF_INTR_DEFAULT;
    371   1.1     matt 		oa.obio_intrbase = OBIOCF_INTRBASE_DEFAULT;
    372   1.1     matt 
    373   1.1     matt #if 0
    374   1.1     matt 		if (oa.obio_addr != OBIOCF_ADDR_DEFAULT
    375   1.1     matt 		    && (oa.obio_addr < sc->sc_base
    376   1.1     matt 		        || oa.obio_addr >= sc->sc_base + sc->sc_size))
    377   1.1     matt 			continue;
    378   1.1     matt #endif
    379   1.1     matt 
    380  1.11  thorpej 		cf = config_search(sc->sc_dev, &oa,
    381  1.12  thorpej 		    CFARGS(.submatch = obio_find,
    382  1.12  thorpej 			   .iattr = "obio"));
    383   1.1     matt 		if (cf == NULL && critical_devs[i].required)
    384   1.1     matt 			panic("obio_attach_critical: failed to find %s!",
    385   1.1     matt 			    critical_devs[i].name);
    386   1.1     matt 
    387   1.1     matt 		oa.obio_addr = cf->cf_loc[OBIOCF_ADDR];
    388   1.1     matt 		oa.obio_size = cf->cf_loc[OBIOCF_SIZE];
    389   1.1     matt 		oa.obio_intr = cf->cf_loc[OBIOCF_INTR];
    390   1.1     matt 		oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
    391  1.12  thorpej 		config_attach(sc->sc_dev, cf, &oa, obio_print, CFARGS_NONE);
    392   1.1     matt 	}
    393   1.1     matt }
    394   1.1     matt 
    395   1.1     matt static int
    396   1.1     matt obio_print(void *aux, const char *name)
    397   1.1     matt {
    398   1.1     matt 	struct obio_attach_args *oa = (struct obio_attach_args*)aux;
    399   1.1     matt 
    400   1.1     matt 	if (oa->obio_addr != OBIOCF_ADDR_DEFAULT) {
    401   1.1     matt 		aprint_normal(" addr 0x%08lx", oa->obio_addr);
    402   1.1     matt 		if (oa->obio_size != OBIOCF_SIZE_DEFAULT)
    403   1.1     matt 			aprint_normal("-0x%08lx",
    404   1.1     matt 				oa->obio_addr + oa->obio_size-1);
    405   1.1     matt 	}
    406   1.1     matt 	if (oa->obio_intr != OBIOCF_INTR_DEFAULT)
    407   1.1     matt 		aprint_normal(" intr %d", oa->obio_intr);
    408   1.1     matt 	if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT)
    409   1.1     matt 		aprint_normal(" intrbase %d", oa->obio_intrbase);
    410   1.1     matt 
    411   1.1     matt 	return UNCONF;
    412   1.1     matt }
    413