Home | History | Annotate | Line # | Download | only in ibus
ibus.c revision 1.2
      1 /* $NetBSD: ibus.c,v 1.2 1999/11/15 09:50:29 nisimura Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Jonathan Stone for
     17  *      the NetBSD Project.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
     34 
     35 __KERNEL_RCSID(0, "$NetBSD: ibus.c,v 1.2 1999/11/15 09:50:29 nisimura Exp $");
     36 
     37 #include <sys/param.h>
     38 #include <sys/systm.h>
     39 #include <sys/device.h>
     40 
     41 #include <pmax/ibus/ibusvar.h>
     42 
     43 extern struct cfdriver ibus_cd;
     44 
     45 void
     46 ibusattach(parent, self, aux)
     47         struct device *parent, *self;
     48         void *aux;
     49 {
     50         struct ibus_softc *sc = (struct ibus_softc *)self;
     51 	struct ibus_dev_attach_args *ida = aux;
     52         int i;
     53 
     54         printf("\n");
     55 
     56         sc->sc_intr_establish = ida->ida_establish;
     57         sc->sc_intr_disestablish = ida->ida_disestablish;
     58 
     59 	for (i = 0; i < ida->ida_ndevs; i++) {
     60 		config_found(self, &ida->ida_devs[i], ibusprint);
     61 	}
     62 }
     63 
     64 int
     65 ibusprint(aux, pnp)
     66 	void *aux;
     67 	const char *pnp;
     68 {
     69 	if (pnp)
     70 		return (QUIET);
     71 	return (UNCONF);
     72 }
     73 
     74 void
     75 ibus_intr_establish(dev, cookie, level, handler, arg)
     76 	struct device *dev;
     77 	void *cookie;
     78 	int level;
     79 	int (*handler) __P((void *));
     80 	void *arg;
     81 {
     82 	struct ibus_softc *sc = ibus_cd.cd_devs[0];
     83 
     84 	(*sc->sc_intr_establish)(dev, cookie, level, handler, arg);
     85 }
     86 
     87 
     88 void
     89 ibus_intr_disestablish(dev, arg)
     90 	struct device *dev;
     91 	void *arg;
     92 {
     93 	struct ibus_softc *sc = ibus_cd.cd_devs[0];
     94 
     95 	(*sc->sc_intr_disestablish)(dev, arg);
     96 }
     97