2000-01-10 06:24:31 +03:00
|
|
|
/* $NetBSD: ibus_3max.c,v 1.6 2000/01/10 03:24:35 simonb Exp $ */
|
1998-04-19 06:52:45 +04:00
|
|
|
|
|
|
|
/*
|
1999-11-15 12:50:17 +03:00
|
|
|
* Copyright (c) 1999 Tohru Nishimura. All rights reserved.
|
1998-04-19 06:52:45 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1999-11-15 12:50:17 +03:00
|
|
|
* This product includes software developed by Tohru Nishimura
|
|
|
|
* for the NetBSD Project.
|
1998-04-19 06:52:45 +04:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
1999-11-15 12:50:17 +03:00
|
|
|
* derived from this software without specific prior written permission
|
1998-04-19 06:52:45 +04:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
|
|
|
|
2000-01-10 06:24:31 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.6 2000/01/10 03:24:35 simonb Exp $");
|
1998-04-19 06:52:45 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
#include <dev/tc/tcvar.h>
|
1998-04-19 06:52:45 +04:00
|
|
|
#include <pmax/ibus/ibusvar.h>
|
1999-11-15 12:50:17 +03:00
|
|
|
#include <pmax/pmax/kn02.h>
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
#define KV(x) MIPS_PHYS_TO_KSEG1(x)
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-24 03:04:06 +03:00
|
|
|
struct ibus_attach_args kn02sys_devs[] = {
|
|
|
|
{ "mc146818", 0, KV(KN02_SYS_CLOCK), 0, },
|
1999-12-11 16:49:18 +03:00
|
|
|
{ "dc", 1, KV(KN02_SYS_DZ), 0, },
|
1998-04-19 06:52:45 +04:00
|
|
|
};
|
1999-11-24 03:04:06 +03:00
|
|
|
const int kn02sys_ndevs = sizeof(kn02sys_devs) / sizeof(kn02sys_devs[0]);
|
1998-04-19 06:52:45 +04:00
|
|
|
|
2000-01-08 04:02:35 +03:00
|
|
|
static int kn02sys_match __P((struct device *, struct cfdata *, void *));
|
|
|
|
static void kn02sys_attach __P((struct device *, struct device *, void *));
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
struct cfattach kn02sys_ca = {
|
|
|
|
sizeof(struct ibus_softc), kn02sys_match, kn02sys_attach,
|
1998-04-19 06:52:45 +04:00
|
|
|
};
|
1999-11-15 12:50:17 +03:00
|
|
|
extern struct cfdriver tc_cd;
|
1998-04-19 06:52:45 +04:00
|
|
|
|
|
|
|
int
|
1999-11-15 12:50:17 +03:00
|
|
|
kn02sys_match(parent, cfdata, aux)
|
1998-04-19 06:52:45 +04:00
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *cfdata;
|
|
|
|
void *aux;
|
|
|
|
|
|
|
|
{
|
1999-11-15 12:50:17 +03:00
|
|
|
struct tc_attach_args *ta = aux;
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
if (strncmp("KN02SYS ", ta->ta_modname, TC_ROM_LLEN) != 0)
|
1998-04-19 06:52:45 +04:00
|
|
|
return 0;
|
1999-11-15 12:50:17 +03:00
|
|
|
return 1;
|
1998-04-19 06:52:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-11-15 12:50:17 +03:00
|
|
|
kn02sys_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
1998-04-19 06:52:45 +04:00
|
|
|
void *aux;
|
|
|
|
{
|
1999-11-15 12:50:17 +03:00
|
|
|
struct ibus_dev_attach_args ida;
|
|
|
|
struct tc_softc *sc = tc_cd.cd_devs[0];
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
ida.ida_busname = "ibus";
|
|
|
|
ida.ida_devs = kn02sys_devs;
|
1999-11-24 03:04:06 +03:00
|
|
|
ida.ida_ndevs = kn02sys_ndevs;
|
1999-11-15 12:50:17 +03:00
|
|
|
ida.ida_establish = sc->sc_intr_establish;
|
|
|
|
ida.ida_disestablish = sc->sc_intr_disestablish;
|
1998-04-19 06:52:45 +04:00
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
ibusattach(parent, self, &ida);
|
1998-04-19 06:52:45 +04:00
|
|
|
}
|