1998-03-06 03:21:40 +03:00
|
|
|
/* $NetBSD: dc_ioasic.c,v 1.7 1998/03/06 00:21:40 thorpej Exp $ */
|
1996-09-26 00:48:51 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 1996 The Board of Trustees of The Leland Stanford
|
|
|
|
* Junior University. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this
|
|
|
|
* software and its documentation for any purpose and without
|
|
|
|
* fee is hereby granted, provided that the above copyright
|
|
|
|
* notice appear in all copies. Stanford University
|
|
|
|
* makes no representations about the suitability of this
|
|
|
|
* software for any purpose. It is provided "as is" without
|
|
|
|
* express or implied warranty.
|
|
|
|
*
|
|
|
|
* this driver contributed by Jonathan Stone
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/tty.h>
|
1998-03-06 03:21:40 +03:00
|
|
|
|
1996-09-26 00:48:51 +04:00
|
|
|
#include <machine/autoconf.h>
|
1998-03-06 03:21:40 +03:00
|
|
|
#include <machine/dc7085cons.h>
|
|
|
|
|
1996-09-26 00:48:51 +04:00
|
|
|
#include <dev/tc/tcvar.h>
|
|
|
|
#include <dev/tc/ioasicvar.h>
|
1998-03-06 03:21:40 +03:00
|
|
|
|
1996-09-26 00:48:51 +04:00
|
|
|
#include <pmax/dev/dcvar.h>
|
|
|
|
#include <pmax/dev/dc_ioasic_cons.h>
|
|
|
|
#include <pmax/pmax/kn02.h>
|
1998-03-06 03:21:40 +03:00
|
|
|
|
|
|
|
int dc_ioasic_match __P((struct device *, struct cfdata *, void *));
|
|
|
|
void dc_ioasic_attach __P((struct device *, struct device *, void *));
|
1996-09-26 00:48:51 +04:00
|
|
|
|
|
|
|
struct cfattach dc_ioasic_ca = {
|
|
|
|
sizeof(struct dc_softc), dc_ioasic_match, dc_ioasic_attach
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize a line for (polled) console I/O
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
dc_ioasic_consinit(dev)
|
|
|
|
dev_t dev;
|
|
|
|
{
|
|
|
|
|
1996-10-14 21:15:42 +04:00
|
|
|
#if defined(DEBUG) && 0
|
1996-10-13 07:39:27 +04:00
|
|
|
printf("dc_ioasic(%d,%d): serial console at 0x%x\n",
|
1996-09-26 00:48:51 +04:00
|
|
|
minor(dev) >> 2, minor(dev) & 03,
|
1997-06-22 11:42:25 +04:00
|
|
|
MIPS_PHYS_TO_KSEG1(KN02_SYS_DZ));
|
1996-09-26 00:48:51 +04:00
|
|
|
DELAY(100000);
|
|
|
|
#endif
|
1997-06-22 11:42:25 +04:00
|
|
|
dc_consinit(dev, (void *)MIPS_PHYS_TO_KSEG1(KN02_SYS_DZ));
|
1996-09-26 00:48:51 +04:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Match driver on 5000/200
|
1998-03-06 03:21:40 +03:00
|
|
|
* (XXX not a real ioasic, but we configure it as one)
|
1996-09-26 00:48:51 +04:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
dc_ioasic_match(parent, match, aux)
|
|
|
|
struct device *parent;
|
1997-07-21 09:39:02 +04:00
|
|
|
struct cfdata *match;
|
1996-09-26 00:48:51 +04:00
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct ioasicdev_attach_args *d = aux;
|
|
|
|
|
|
|
|
if (strcmp(d->iada_modname, "dc") != 0 &&
|
|
|
|
strcmp(d->iada_modname, "dc7085") != 0)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (badaddr((caddr_t)(d->iada_addr), 2))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
dc_ioasic_attach(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct dc_softc *sc = (void*) self;
|
|
|
|
struct ioasicdev_attach_args *d = aux;
|
|
|
|
caddr_t dcaddr;
|
|
|
|
|
1998-03-06 03:21:40 +03:00
|
|
|
printf("\n");
|
|
|
|
|
1996-09-26 00:48:51 +04:00
|
|
|
dcaddr = (caddr_t)d->iada_addr;
|
1997-06-22 11:42:25 +04:00
|
|
|
(void) dcattach(sc, (void*)MIPS_PHYS_TO_KSEG1(dcaddr),
|
1996-09-26 00:48:51 +04:00
|
|
|
/* dtr/dsr mask */ (1<< DCPRINTER_PORT) + (1 << DCCOMM_PORT),
|
|
|
|
#ifdef HW_FLOW_CONTROL
|
|
|
|
/* rts/cts mask */ (1<< DCPRINTER_PORT) + (1 << DCCOMM_PORT),
|
|
|
|
#else
|
|
|
|
0,
|
|
|
|
#endif
|
|
|
|
1, 3);
|
|
|
|
|
1998-03-06 03:21:40 +03:00
|
|
|
ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_TTY,
|
|
|
|
dcintr, self);
|
1996-09-26 00:48:51 +04:00
|
|
|
}
|