Home | History | Annotate | Line # | Download | only in tc
ioasic_subr.c revision 1.4.2.6
      1  1.4.2.6     skrll /*	$NetBSD: ioasic_subr.c,v 1.4.2.6 2005/11/10 14:08:05 skrll Exp $	*/
      2      1.2    simonb 
      3      1.1  jonathan /*
      4      1.1  jonathan  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5      1.1  jonathan  * All rights reserved.
      6      1.1  jonathan  *
      7      1.1  jonathan  * Author: Keith Bostic, Chris G. Demetriou
      8  1.4.2.5     skrll  *
      9      1.1  jonathan  * Permission to use, copy, modify and distribute this software and
     10      1.1  jonathan  * its documentation is hereby granted, provided that both the copyright
     11      1.1  jonathan  * notice and this permission notice appear in all copies of the
     12      1.1  jonathan  * software, derivative works or modified versions, and any portions
     13      1.1  jonathan  * thereof, and that both notices appear in supporting documentation.
     14  1.4.2.5     skrll  *
     15  1.4.2.5     skrll  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.4.2.5     skrll  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17      1.1  jonathan  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.4.2.5     skrll  *
     19      1.1  jonathan  * Carnegie Mellon requests users of this software to return to
     20      1.1  jonathan  *
     21      1.1  jonathan  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22      1.1  jonathan  *  School of Computer Science
     23      1.1  jonathan  *  Carnegie Mellon University
     24      1.1  jonathan  *  Pittsburgh PA 15213-3890
     25      1.1  jonathan  *
     26      1.1  jonathan  * any improvements or extensions that they make and grant Carnegie the
     27      1.1  jonathan  * rights to redistribute these changes.
     28      1.1  jonathan  */
     29      1.1  jonathan 
     30      1.1  jonathan 
     31      1.3     lukem #include <sys/cdefs.h>
     32  1.4.2.6     skrll __KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.4.2.6 2005/11/10 14:08:05 skrll Exp $");
     33      1.1  jonathan 
     34      1.1  jonathan #include <sys/param.h>
     35      1.1  jonathan #include <sys/systm.h>
     36      1.1  jonathan #include <sys/device.h>
     37      1.1  jonathan #include <dev/tc/tcvar.h>
     38      1.1  jonathan #include <dev/tc/ioasicvar.h>
     39      1.1  jonathan 
     40  1.4.2.2     skrll #include "locators.h"
     41  1.4.2.2     skrll 
     42      1.1  jonathan int     ioasicprint(void *, const char *);
     43      1.1  jonathan 
     44      1.1  jonathan int
     45      1.1  jonathan ioasicprint(aux, pnp)
     46      1.1  jonathan 	void *aux;
     47      1.1  jonathan 	const char *pnp;
     48      1.1  jonathan {
     49      1.1  jonathan 	struct ioasicdev_attach_args *d = aux;
     50      1.1  jonathan 
     51      1.1  jonathan 	if (pnp)
     52      1.4   thorpej 		aprint_normal("%s at %s", d->iada_modname, pnp);
     53  1.4.2.1     skrll 	aprint_normal(" offset 0x%x", d->iada_offset);
     54      1.1  jonathan 	return (UNCONF);
     55      1.1  jonathan }
     56      1.1  jonathan 
     57      1.1  jonathan void
     58      1.1  jonathan ioasic_attach_devs(sc, ioasic_devs, ioasic_ndevs)
     59      1.1  jonathan 	struct ioasic_softc *sc;
     60      1.1  jonathan 	struct ioasic_dev *ioasic_devs;
     61      1.1  jonathan 	int ioasic_ndevs;
     62      1.1  jonathan {
     63      1.1  jonathan 	struct ioasicdev_attach_args idev;
     64      1.1  jonathan 	int i;
     65  1.4.2.6     skrll 	int locs[IOASICCF_NLOCS];
     66      1.1  jonathan 
     67      1.1  jonathan         /*
     68      1.1  jonathan 	 * Try to configure each device.
     69      1.1  jonathan 	 */
     70      1.1  jonathan         for (i = 0; i < ioasic_ndevs; i++) {
     71  1.4.2.1     skrll 		strlcpy(idev.iada_modname, ioasic_devs[i].iad_modname,
     72  1.4.2.1     skrll 		    sizeof(idev.iada_modname));
     73      1.1  jonathan 		idev.iada_offset = ioasic_devs[i].iad_offset;
     74      1.1  jonathan 		idev.iada_addr = sc->sc_base + ioasic_devs[i].iad_offset;
     75      1.1  jonathan 		idev.iada_cookie = ioasic_devs[i].iad_cookie;
     76      1.1  jonathan 
     77      1.1  jonathan                 /* Tell the autoconfig machinery we've found the hardware. */
     78  1.4.2.6     skrll 		locs[IOASICCF_OFFSET] = ioasic_devs[i].iad_offset;
     79  1.4.2.6     skrll 		config_found_sm_loc(&sc->sc_dv, "ioasic", locs, &idev,
     80  1.4.2.6     skrll 				    ioasicprint, config_stdsubmatch);
     81      1.1  jonathan         }
     82      1.1  jonathan }
     83