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