2001-08-23 05:16:52 +04:00
|
|
|
/* $NetBSD: tcasic.c,v 1.36 2001/08/23 01:16:52 nisimura Exp $ */
|
1995-12-20 03:43:20 +03:00
|
|
|
|
|
|
|
/*
|
1996-04-12 10:07:05 +04:00
|
|
|
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
1995-12-20 03:43:20 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
1997-09-02 17:29:17 +04:00
|
|
|
#include "opt_dec_3000_300.h"
|
|
|
|
#include "opt_dec_3000_500.h"
|
|
|
|
|
1997-04-08 03:39:37 +04:00
|
|
|
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
|
|
|
|
2001-08-23 05:16:52 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.36 2001/08/23 01:16:52 nisimura Exp $");
|
1997-04-07 02:31:45 +04:00
|
|
|
|
1995-12-20 03:43:20 +03:00
|
|
|
#include <sys/param.h>
|
1996-07-09 04:53:48 +04:00
|
|
|
#include <sys/systm.h>
|
1995-12-20 03:43:20 +03:00
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <machine/autoconf.h>
|
|
|
|
#include <machine/rpb.h>
|
1998-11-19 05:53:47 +03:00
|
|
|
#include <machine/alpha.h>
|
1995-12-20 03:43:20 +03:00
|
|
|
|
|
|
|
#include <dev/tc/tcvar.h>
|
|
|
|
#include <alpha/tc/tc_conf.h>
|
|
|
|
|
|
|
|
/* Definition of the driver for autoconfig. */
|
1996-12-05 04:39:27 +03:00
|
|
|
int tcasicmatch(struct device *, struct cfdata *, void *);
|
1995-12-20 03:43:20 +03:00
|
|
|
void tcasicattach(struct device *, struct device *, void *);
|
1996-03-17 04:03:02 +03:00
|
|
|
|
|
|
|
struct cfattach tcasic_ca = {
|
1996-04-12 05:31:43 +04:00
|
|
|
sizeof (struct device), tcasicmatch, tcasicattach,
|
1996-03-17 04:03:02 +03:00
|
|
|
};
|
|
|
|
|
1998-01-12 13:21:02 +03:00
|
|
|
extern struct cfdriver tcasic_cd;
|
1995-12-20 03:43:20 +03:00
|
|
|
|
1996-08-28 01:53:46 +04:00
|
|
|
int tcasicprint __P((void *, const char *));
|
1995-12-20 03:43:20 +03:00
|
|
|
|
|
|
|
/* There can be only one. */
|
|
|
|
int tcasicfound;
|
|
|
|
|
|
|
|
int
|
|
|
|
tcasicmatch(parent, cfdata, aux)
|
|
|
|
struct device *parent;
|
1996-12-05 04:39:27 +03:00
|
|
|
struct cfdata *cfdata;
|
1995-12-20 03:43:20 +03:00
|
|
|
void *aux;
|
|
|
|
{
|
1998-05-14 04:01:30 +04:00
|
|
|
struct mainbus_attach_args *ma = aux;
|
1995-12-20 03:43:20 +03:00
|
|
|
|
|
|
|
/* Make sure that we're looking for a TurboChannel ASIC. */
|
1998-05-14 04:01:30 +04:00
|
|
|
if (strcmp(ma->ma_name, tcasic_cd.cd_name))
|
1995-12-20 03:43:20 +03:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* Make sure that the system supports a TurboChannel ASIC. */
|
|
|
|
if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (tcasicfound)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tcasicattach(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1996-04-12 05:31:43 +04:00
|
|
|
struct tcbus_attach_args tba;
|
1995-12-20 03:43:20 +03:00
|
|
|
void (*intr_setup) __P((void));
|
1996-07-14 08:06:27 +04:00
|
|
|
void (*iointr) __P((void *, unsigned long));
|
1995-12-20 03:43:20 +03:00
|
|
|
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("\n");
|
1995-12-20 03:43:20 +03:00
|
|
|
tcasicfound = 1;
|
|
|
|
|
|
|
|
switch (cputype) {
|
|
|
|
#ifdef DEC_3000_500
|
|
|
|
case ST_DEC_3000_500:
|
|
|
|
|
|
|
|
intr_setup = tc_3000_500_intr_setup;
|
|
|
|
iointr = tc_3000_500_iointr;
|
|
|
|
|
1996-04-12 05:31:43 +04:00
|
|
|
tba.tba_speed = TC_SPEED_25_MHZ;
|
|
|
|
tba.tba_nslots = tc_3000_500_nslots;
|
|
|
|
tba.tba_slots = tc_3000_500_slots;
|
1996-11-16 02:59:00 +03:00
|
|
|
if (hwrpb->rpb_variation & SV_GRAPHICS) {
|
|
|
|
tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins;
|
|
|
|
tba.tba_builtins = tc_3000_500_graphics_builtins;
|
|
|
|
} else {
|
|
|
|
tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins;
|
|
|
|
tba.tba_builtins = tc_3000_500_nographics_builtins;
|
|
|
|
}
|
2000-06-04 23:14:14 +04:00
|
|
|
tba.tba_intr_evcnt = tc_3000_500_intr_evcnt;
|
1996-04-12 05:31:43 +04:00
|
|
|
tba.tba_intr_establish = tc_3000_500_intr_establish;
|
|
|
|
tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
|
1998-01-19 05:54:24 +03:00
|
|
|
tba.tba_get_dma_tag = tc_dma_get_tag_3000_500;
|
1997-06-07 03:54:24 +04:00
|
|
|
|
|
|
|
/* Do 3000/500-specific DMA setup now. */
|
|
|
|
tc_dma_init_3000_500(tc_3000_500_nslots);
|
1995-12-20 03:43:20 +03:00
|
|
|
break;
|
|
|
|
#endif /* DEC_3000_500 */
|
|
|
|
|
|
|
|
#ifdef DEC_3000_300
|
|
|
|
case ST_DEC_3000_300:
|
|
|
|
|
|
|
|
intr_setup = tc_3000_300_intr_setup;
|
|
|
|
iointr = tc_3000_300_iointr;
|
|
|
|
|
1996-04-12 05:31:43 +04:00
|
|
|
tba.tba_speed = TC_SPEED_12_5_MHZ;
|
|
|
|
tba.tba_nslots = tc_3000_300_nslots;
|
|
|
|
tba.tba_slots = tc_3000_300_slots;
|
|
|
|
tba.tba_nbuiltins = tc_3000_300_nbuiltins;
|
|
|
|
tba.tba_builtins = tc_3000_300_builtins;
|
2000-06-04 23:14:14 +04:00
|
|
|
tba.tba_intr_evcnt = tc_3000_300_intr_evcnt;
|
1996-04-12 05:31:43 +04:00
|
|
|
tba.tba_intr_establish = tc_3000_300_intr_establish;
|
|
|
|
tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
|
1998-01-19 05:54:24 +03:00
|
|
|
tba.tba_get_dma_tag = tc_dma_get_tag_3000_300;
|
1995-12-20 03:43:20 +03:00
|
|
|
break;
|
|
|
|
#endif /* DEC_3000_300 */
|
|
|
|
|
|
|
|
default:
|
|
|
|
panic("tcasicattach: bad cputype");
|
|
|
|
}
|
|
|
|
|
1998-01-19 05:54:24 +03:00
|
|
|
tba.tba_busname = "tc";
|
1996-10-23 01:34:19 +04:00
|
|
|
tba.tba_memt = tc_bus_mem_init(NULL);
|
1997-06-07 03:54:24 +04:00
|
|
|
|
|
|
|
tc_dma_init();
|
1996-10-23 08:12:13 +04:00
|
|
|
|
1995-12-20 03:43:20 +03:00
|
|
|
(*intr_setup)();
|
2001-07-27 04:25:18 +04:00
|
|
|
|
|
|
|
/* They all come in at 0x800. */
|
|
|
|
scb_set(0x800, iointr, NULL);
|
1995-12-20 03:43:20 +03:00
|
|
|
|
1996-04-12 05:31:43 +04:00
|
|
|
config_found(self, &tba, tcasicprint);
|
1995-12-20 03:43:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
tcasicprint(aux, pnp)
|
|
|
|
void *aux;
|
1996-08-28 01:53:46 +04:00
|
|
|
const char *pnp;
|
1995-12-20 03:43:20 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
/* only TCs can attach to tcasics; easy. */
|
|
|
|
if (pnp)
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("tc at %s", pnp);
|
1995-12-20 03:43:20 +03:00
|
|
|
return (UNCONF);
|
|
|
|
}
|
1998-10-22 05:03:07 +04:00
|
|
|
|
|
|
|
#include "wsdisplay.h"
|
|
|
|
|
|
|
|
#if NWSDISPLAY > 0
|
|
|
|
|
|
|
|
#include "sfb.h"
|
2001-02-22 10:46:01 +03:00
|
|
|
#include "sfbp.h"
|
2001-08-23 05:16:52 +04:00
|
|
|
#include "cfb.h"
|
|
|
|
#include "mfb.h"
|
|
|
|
#include "tfb.h"
|
2000-12-22 16:33:57 +03:00
|
|
|
#include "px.h"
|
|
|
|
#include "pxg.h"
|
1998-10-22 05:03:07 +04:00
|
|
|
|
2000-12-22 16:33:57 +03:00
|
|
|
extern void sfb_cnattach __P((tc_addr_t));
|
2001-02-22 10:46:01 +03:00
|
|
|
extern void sfbp_cnattach __P((tc_addr_t));
|
2001-08-23 05:16:52 +04:00
|
|
|
extern void cfb_cnattach __P((tc_addr_t));
|
|
|
|
extern void mfb_cnattach __P((tc_addr_t));
|
|
|
|
extern void tfb_cnattach __P((tc_addr_t));
|
2000-12-22 16:33:57 +03:00
|
|
|
extern void px_cnattach __P((tc_addr_t));
|
|
|
|
extern void pxg_cnattach __P((tc_addr_t));
|
1998-10-22 05:03:07 +04:00
|
|
|
extern int tc_checkslot __P((tc_addr_t, char *));
|
|
|
|
|
2000-12-22 16:33:57 +03:00
|
|
|
struct cnboards {
|
|
|
|
const char *cb_tcname;
|
2000-12-23 16:11:57 +03:00
|
|
|
void (*cb_cnattach)(tc_addr_t);
|
2001-03-04 16:36:19 +03:00
|
|
|
} static const cnboards[] = {
|
2000-12-22 16:33:57 +03:00
|
|
|
#if NSFB > 0
|
|
|
|
{ "PMAGB-BA", sfb_cnattach },
|
|
|
|
#endif
|
2001-08-23 05:16:52 +04:00
|
|
|
#if NSFBP > 0
|
|
|
|
{ "PMAGD ", sfbp_cnattach },
|
|
|
|
#endif
|
2000-12-22 16:33:57 +03:00
|
|
|
#if NCFB > 0
|
|
|
|
{ "PMAG-BA ", cfb_cnattach },
|
|
|
|
#endif
|
2001-08-23 05:16:52 +04:00
|
|
|
#if NMFB > 0
|
|
|
|
{ "PMAG-AA ", mfb_cnattach },
|
|
|
|
#endif
|
|
|
|
#if NTFB > 0
|
|
|
|
{ "PMAG-JA ", tfb_cnattach },
|
2001-02-22 10:46:01 +03:00
|
|
|
#endif
|
2000-12-22 16:33:57 +03:00
|
|
|
#if NPX > 0
|
|
|
|
{ "PMAG-CA ", px_cnattach },
|
|
|
|
#endif
|
|
|
|
#if NPXG > 0
|
|
|
|
{ "PMAG-DA ", pxg_cnattach },
|
|
|
|
{ "PMAG-FA ", pxg_cnattach },
|
|
|
|
{ "PMAG-FB ", pxg_cnattach },
|
|
|
|
{ "PMAGB-FA", pxg_cnattach },
|
|
|
|
{ "PMAGB-FB", pxg_cnattach },
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
1998-10-22 05:03:07 +04:00
|
|
|
/*
|
|
|
|
* tc_fb_cnattach --
|
|
|
|
* Attempt to attach the appropriate display driver to the
|
|
|
|
* output console.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
tc_fb_cnattach(tcaddr)
|
|
|
|
tc_addr_t tcaddr;
|
|
|
|
{
|
|
|
|
char tcname[TC_ROM_LLEN];
|
2000-12-22 16:33:57 +03:00
|
|
|
int i;
|
1998-10-22 05:03:07 +04:00
|
|
|
|
2000-12-22 16:33:57 +03:00
|
|
|
if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0))
|
|
|
|
return (EINVAL);
|
1998-10-22 05:03:07 +04:00
|
|
|
|
2000-12-22 16:33:57 +03:00
|
|
|
for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
|
|
|
|
if (strncmp(tcname, cnboards[i].cb_tcname, TC_ROM_LLEN) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == sizeof(cnboards) / sizeof(cnboards[0]))
|
|
|
|
return (ENXIO);
|
|
|
|
|
|
|
|
(cnboards[i].cb_cnattach)(tcaddr);
|
|
|
|
return (0);
|
1998-10-22 05:03:07 +04:00
|
|
|
}
|
|
|
|
#endif /* if NWSDISPLAY > 0 */
|