2002-10-02 08:06:36 +04:00
|
|
|
/* $NetBSD: tcbus.c,v 1.16 2002/10/02 04:15:11 thorpej Exp $ */
|
1999-11-15 12:50:17 +03:00
|
|
|
|
|
|
|
/*
|
2000-02-03 07:09:01 +03:00
|
|
|
* Copyright (c) 1999, 2000 Tohru Nishimura. All rights reserved.
|
1999-11-15 12:50:17 +03: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:
|
|
|
|
* This product includes software developed by Tohru Nishimura
|
|
|
|
* for the NetBSD Project.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* 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 */
|
2002-10-02 08:06:36 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.16 2002/10/02 04:15:11 thorpej Exp $");
|
2000-02-29 12:03:30 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Which system models were configured?
|
|
|
|
*/
|
|
|
|
#include "opt_dec_3max.h"
|
|
|
|
#include "opt_dec_3min.h"
|
|
|
|
#include "opt_dec_maxine.h"
|
|
|
|
#include "opt_dec_3maxplus.h"
|
1999-11-15 12:50:17 +03:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <machine/autoconf.h>
|
2000-01-14 16:45:21 +03:00
|
|
|
#include <machine/sysconf.h>
|
1999-11-15 12:50:17 +03:00
|
|
|
|
|
|
|
#define _PMAX_BUS_DMA_PRIVATE
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
#include <dev/tc/tcvar.h>
|
|
|
|
#include <pmax/pmax/pmaxtype.h>
|
|
|
|
|
2000-06-06 04:27:58 +04:00
|
|
|
static const struct evcnt *tc_ds_intr_evcnt __P((struct device *, void *));
|
2000-01-09 06:55:28 +03:00
|
|
|
static void tc_ds_intr_establish __P((struct device *, void *,
|
1999-11-15 12:50:17 +03:00
|
|
|
int, int (*)(void *), void *));
|
2000-01-09 06:55:28 +03:00
|
|
|
static void tc_ds_intr_disestablish __P((struct device *, void *));
|
|
|
|
static bus_dma_tag_t tc_ds_get_dma_tag __P((int));
|
1999-11-15 12:50:17 +03:00
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
extern struct tcbus_attach_args kn02_tc_desc[]; /* XXX */
|
|
|
|
extern struct tcbus_attach_args kmin_tc_desc[]; /* XXX */
|
|
|
|
extern struct tcbus_attach_args xine_tc_desc[]; /* XXX */
|
|
|
|
extern struct tcbus_attach_args kn03_tc_desc[]; /* XXX */
|
1999-11-15 12:50:17 +03:00
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
static int tcbus_match __P((struct device *, struct cfdata *, void *));
|
|
|
|
static void tcbus_attach __P((struct device *, struct device *, void *));
|
1999-11-15 12:50:17 +03:00
|
|
|
|
2002-10-02 08:06:36 +04:00
|
|
|
CFATTACH_DECL(tcbus, sizeof(struct tc_softc),
|
|
|
|
tcbus_match, tcbus_attach, NULL, NULL);
|
1999-11-15 12:50:17 +03:00
|
|
|
|
|
|
|
static int tcbus_found;
|
|
|
|
|
2000-02-29 12:03:30 +03:00
|
|
|
static int
|
1999-11-15 12:50:17 +03:00
|
|
|
tcbus_match(parent, cfdata, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *cfdata;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct mainbus_attach_args *ma = aux;
|
|
|
|
|
|
|
|
if (tcbus_found || strcmp(ma->ma_name, "tcbus"))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2000-02-29 12:03:30 +03:00
|
|
|
static void
|
1999-11-15 12:50:17 +03:00
|
|
|
tcbus_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct tcbus_attach_args *tba;
|
|
|
|
|
|
|
|
tcbus_found = 1;
|
|
|
|
|
|
|
|
switch (systype) {
|
|
|
|
#ifdef DEC_3MAX
|
|
|
|
case DS_3MAX:
|
|
|
|
tba = &kn02_tc_desc[0]; break;
|
|
|
|
#endif
|
|
|
|
#ifdef DEC_3MIN
|
|
|
|
case DS_3MIN:
|
|
|
|
tba = &kmin_tc_desc[0]; break;
|
|
|
|
#endif
|
|
|
|
#ifdef DEC_MAXINE
|
|
|
|
case DS_MAXINE:
|
|
|
|
tba = &xine_tc_desc[0]; break;
|
|
|
|
#endif
|
|
|
|
#ifdef DEC_3MAXPLUS
|
|
|
|
case DS_3MAXPLUS:
|
|
|
|
tba = &kn03_tc_desc[0]; break;
|
|
|
|
#endif
|
|
|
|
default:
|
1999-11-17 06:42:20 +03:00
|
|
|
panic("tcbus_attach: no TURBOchannel configured for systype = %d", systype);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
tba->tba_busname = "tc";
|
|
|
|
tba->tba_memt = 0;
|
2000-06-04 23:14:14 +04:00
|
|
|
tba->tba_intr_evcnt = tc_ds_intr_evcnt;
|
1999-11-15 12:50:17 +03:00
|
|
|
tba->tba_intr_establish = tc_ds_intr_establish;
|
|
|
|
tba->tba_intr_disestablish = tc_ds_intr_disestablish;
|
|
|
|
tba->tba_get_dma_tag = tc_ds_get_dma_tag;
|
|
|
|
|
|
|
|
tcattach(parent, self, tba);
|
|
|
|
}
|
|
|
|
|
2000-06-04 23:14:14 +04:00
|
|
|
/*
|
|
|
|
* Dispatch to model specific interrupt line evcnt fetch rontine
|
|
|
|
*/
|
2000-06-06 04:27:58 +04:00
|
|
|
static const struct evcnt *
|
2000-06-04 23:14:14 +04:00
|
|
|
tc_ds_intr_evcnt(dev, cookie)
|
|
|
|
struct device *dev;
|
|
|
|
void *cookie;
|
|
|
|
{
|
|
|
|
|
|
|
|
/* XXX for now, no evcnt parent reported */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-11-15 12:50:17 +03:00
|
|
|
/*
|
2000-02-29 12:03:30 +03:00
|
|
|
* Dispatch to model specific interrupt establishing routine
|
1999-11-15 12:50:17 +03:00
|
|
|
*/
|
2000-01-09 06:55:28 +03:00
|
|
|
static void
|
1999-11-15 12:50:17 +03:00
|
|
|
tc_ds_intr_establish(dev, cookie, level, handler, val)
|
|
|
|
struct device *dev;
|
|
|
|
void *cookie;
|
|
|
|
int level;
|
2001-02-17 21:02:40 +03:00
|
|
|
int (*handler) __P((void *));
|
1999-11-15 12:50:17 +03:00
|
|
|
void *val;
|
|
|
|
{
|
2000-02-29 12:03:30 +03:00
|
|
|
|
2001-02-17 21:02:40 +03:00
|
|
|
(*platform.intr_establish)(dev, cookie, level, handler, val);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
|
2000-01-09 06:55:28 +03:00
|
|
|
static void
|
1999-11-15 12:50:17 +03:00
|
|
|
tc_ds_intr_disestablish(dev, arg)
|
|
|
|
struct device *dev;
|
|
|
|
void *arg;
|
|
|
|
{
|
2000-02-29 12:03:30 +03:00
|
|
|
|
2001-02-17 21:02:40 +03:00
|
|
|
printf("cannot disestablish TC interrupts\n");
|
2000-02-29 12:03:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the DMA tag for use by the specified TURBOchannel slot.
|
|
|
|
*/
|
|
|
|
static bus_dma_tag_t
|
|
|
|
tc_ds_get_dma_tag(slot)
|
|
|
|
int slot;
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* All DECstations use the default DMA tag.
|
|
|
|
*/
|
|
|
|
return (&pmax_default_bus_dma_tag);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "rasterconsole.h"
|
|
|
|
|
|
|
|
#if NRASTERCONSOLE > 0
|
|
|
|
|
|
|
|
#include "mfb.h"
|
|
|
|
#include "cfb.h"
|
|
|
|
#include "sfb.h"
|
|
|
|
#include "px.h"
|
|
|
|
|
2000-02-03 07:09:01 +03:00
|
|
|
#include <machine/pmioctl.h> /* XXX */
|
2001-09-19 23:04:16 +04:00
|
|
|
#include <dev/sun/fbio.h> /* XXX */
|
2000-02-03 07:09:01 +03:00
|
|
|
#include <machine/fbvar.h> /* XXX */
|
|
|
|
#include <pmax/dev/fbreg.h> /* XXX */
|
1999-11-15 12:50:17 +03:00
|
|
|
#include <pmax/dev/cfbvar.h>
|
|
|
|
#include <pmax/dev/mfbvar.h>
|
|
|
|
#include <pmax/dev/sfbvar.h>
|
2000-02-03 07:09:01 +03:00
|
|
|
#include <pmax/dev/pxreg.h>
|
|
|
|
#include <pmax/dev/pxvar.h>
|
1999-11-15 12:50:17 +03:00
|
|
|
|
|
|
|
#include <machine/dec_prom.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
tcfb_cnattach(slotno)
|
|
|
|
int slotno;
|
|
|
|
{
|
2000-02-03 07:09:01 +03:00
|
|
|
paddr_t tcaddr;
|
1999-11-15 12:50:17 +03:00
|
|
|
char tcname[TC_ROM_LLEN];
|
|
|
|
|
|
|
|
tcaddr = (*callv->_slot_address)(slotno);
|
|
|
|
if (tc_badaddr(tcaddr) || tc_checkslot(tcaddr, tcname) == 0)
|
|
|
|
panic("TC console designated by PROM does not exist!?");
|
|
|
|
|
|
|
|
#if NSFB > 0
|
|
|
|
if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) {
|
2000-02-03 07:09:01 +03:00
|
|
|
return sfb_cnattach(tcaddr);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if NCFB > 0
|
|
|
|
if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) {
|
2000-02-03 07:09:01 +03:00
|
|
|
return cfb_cnattach(tcaddr);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if NMFB > 0
|
|
|
|
if (strncmp("PMAG-AA ", tcname, TC_ROM_LLEN) == 0) {
|
2000-02-03 07:09:01 +03:00
|
|
|
return mfb_cnattach(tcaddr);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if NPX > 0
|
|
|
|
if (strncmp("PMAG-CA ", tcname, TC_ROM_LLEN) == 0
|
1999-11-16 05:39:03 +03:00
|
|
|
|| strncmp("PMAG-DA ", tcname, TC_ROM_LLEN) == 0
|
1999-11-15 12:50:17 +03:00
|
|
|
|| strncmp("PMAG-FA ", tcname, TC_ROM_LLEN) == 0) {
|
2000-02-03 07:09:01 +03:00
|
|
|
int px_cnattach __P((paddr_t)); /* XXX much simpler XXX */
|
|
|
|
|
|
|
|
return px_cnattach(tcaddr);
|
1999-11-15 12:50:17 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|