#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vme_two_68k.c,v 1.10 2012/10/27 17:18:04 chs Exp $");
#include "vmetwo.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <dev/vme/vmereg.h>
#include <dev/vme/vmevar.h>
#include <mvme68k/mvme68k/isr.h>
#include <mvme68k/dev/mainbus.h>
#include <dev/mvme/mvmebus.h>
#include <dev/mvme/vme_tworeg.h>
#include <dev/mvme/vme_twovar.h>
#include "ioconf.h"
static void vmetwoisrlink(void *, int (*)(void *), void *,
int, int, struct evcnt *);
static void vmetwoisrunlink(void *, int);
static struct evcnt *vmetwoisrevcnt(void *, int);
#if NVMETWO > 0
int vmetwo_match(device_t, cfdata_t, void *);
void vmetwo_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(vmetwo, sizeof(struct vmetwo_softc),
vmetwo_match, vmetwo_attach, NULL, NULL);
int
vmetwo_match(device_t parent, cfdata_t cf, void *aux)
{
struct mainbus_attach_args *ma;
static int matched = 0;
ma = aux;
if (strcmp(ma->ma_name, vmetwo_cd.cd_name))
return 0;
if (matched++)
return 0;
return vmetwo_probe(ma->ma_bust, ma->ma_offset) ? 1 : 0;
}
void
vmetwo_attach(device_t parent, device_t self, void *aux)
{
struct mainbus_attach_args *ma;
struct vmetwo_softc *sc;
sc = device_private(self);
sc->sc_mvmebus.sc_dev = self;
ma = aux;
bus_space_map(ma->ma_bust, ma->ma_offset + VME2REG_LCSR_OFFSET,
VME2LCSR_SIZE, 0, &sc->sc_lcrh);
#ifdef notyet
bus_space_map(ma->ma_bust, ma->ma_offset + VME2REG_GCSR_OFFSET,
VME2GCSR_SIZE, 0, &sc->sc_gcrh);
#endif
sc->sc_mvmebus.sc_bust = ma->ma_bust;
sc->sc_mvmebus.sc_dmat = ma->ma_dmat;
vmetwo_init(sc);
}
#endif
void
vmetwo_md_intr_init(struct vmetwo_softc *sc)
{
sc->sc_isrlink = vmetwoisrlink;
sc->sc_isrunlink = vmetwoisrunlink;
sc->sc_isrevcnt = vmetwoisrevcnt;
}
static void
vmetwoisrlink(void *cookie, int (*fn)(void *), void *arg, int ipl, int vec,
struct evcnt *evcnt)
{
isrlink_vectored(fn, arg, ipl, vec, evcnt);
}
static void
vmetwoisrunlink(void *cookie, int vec)
{
isrunlink_vectored(vec);
}
static struct evcnt *
vmetwoisrevcnt(void *cookie, int ipl)
{
return isrlink_evcnt(ipl);
}