Home | History | Annotate | Line # | Download | only in tc
tcasic.c revision 1.14
      1 /*	$NetBSD: tcasic.c,v 1.14 1996/12/05 01:39:45 cgd Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 #include <sys/param.h>
     31 #include <sys/systm.h>
     32 #include <sys/device.h>
     33 
     34 #include <machine/autoconf.h>
     35 #include <machine/rpb.h>
     36 
     37 #include <dev/tc/tcvar.h>
     38 #include <alpha/tc/tc_conf.h>
     39 
     40 /* Definition of the driver for autoconfig. */
     41 #ifdef __BROKEN_INDIRECT_CONFIG
     42 int	tcasicmatch(struct device *, void *, void *);
     43 #else
     44 int	tcasicmatch(struct device *, struct cfdata *, void *);
     45 #endif
     46 void	tcasicattach(struct device *, struct device *, void *);
     47 
     48 struct cfattach tcasic_ca = {
     49 	sizeof (struct device), tcasicmatch, tcasicattach,
     50 };
     51 
     52 struct cfdriver tcasic_cd = {
     53 	NULL, "tcasic", DV_DULL,
     54 };
     55 
     56 int	tcasicprint __P((void *, const char *));
     57 
     58 extern int cputype;
     59 
     60 /* There can be only one. */
     61 int	tcasicfound;
     62 
     63 int
     64 tcasicmatch(parent, cfdata, aux)
     65 	struct device *parent;
     66 #ifdef __BROKEN_INDIRECT_CONFIG
     67 	void *cfdata;
     68 #else
     69 	struct cfdata *cfdata;
     70 #endif
     71 	void *aux;
     72 {
     73 	struct confargs *ca = aux;
     74 
     75         /* Make sure that we're looking for a TurboChannel ASIC. */
     76         if (strcmp(ca->ca_name, tcasic_cd.cd_name))
     77                 return (0);
     78 
     79         /* Make sure that the system supports a TurboChannel ASIC. */
     80 	if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
     81 		return (0);
     82 
     83 	if (tcasicfound)
     84 		return (0);
     85 
     86 	return (1);
     87 }
     88 
     89 void
     90 tcasicattach(parent, self, aux)
     91 	struct device *parent;
     92 	struct device *self;
     93 	void *aux;
     94 {
     95 	struct tcbus_attach_args tba;
     96 	void (*intr_setup) __P((void));
     97 	void (*iointr) __P((void *, unsigned long));
     98 
     99 	printf("\n");
    100 	tcasicfound = 1;
    101 
    102 	switch (cputype) {
    103 #ifdef DEC_3000_500
    104 	case ST_DEC_3000_500:
    105 
    106 		intr_setup = tc_3000_500_intr_setup;
    107 		iointr = tc_3000_500_iointr;
    108 
    109 		tba.tba_busname = "tc";
    110 		tba.tba_speed = TC_SPEED_25_MHZ;
    111 		tba.tba_nslots = tc_3000_500_nslots;
    112 		tba.tba_slots = tc_3000_500_slots;
    113 		if (hwrpb->rpb_variation & SV_GRAPHICS) {
    114 			tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins;
    115 			tba.tba_builtins = tc_3000_500_graphics_builtins;
    116 		} else {
    117 			tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins;
    118 			tba.tba_builtins = tc_3000_500_nographics_builtins;
    119 		}
    120 		tba.tba_intr_establish = tc_3000_500_intr_establish;
    121 		tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
    122 		break;
    123 #endif /* DEC_3000_500 */
    124 
    125 #ifdef DEC_3000_300
    126 	case ST_DEC_3000_300:
    127 
    128 		intr_setup = tc_3000_300_intr_setup;
    129 		iointr = tc_3000_300_iointr;
    130 
    131 		tba.tba_busname = "tc";
    132 		tba.tba_speed = TC_SPEED_12_5_MHZ;
    133 		tba.tba_nslots = tc_3000_300_nslots;
    134 		tba.tba_slots = tc_3000_300_slots;
    135 		tba.tba_nbuiltins = tc_3000_300_nbuiltins;
    136 		tba.tba_builtins = tc_3000_300_builtins;
    137 		tba.tba_intr_establish = tc_3000_300_intr_establish;
    138 		tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
    139 		break;
    140 #endif /* DEC_3000_300 */
    141 
    142 	default:
    143 		panic("tcasicattach: bad cputype");
    144 	}
    145 
    146 	tba.tba_memt = tc_bus_mem_init(NULL);
    147 
    148 	/* XXX XXX BEGIN XXX XXX */
    149 	{							/* XXX */
    150 		extern vm_offset_t alpha_XXX_dmamap_or;		/* XXX */
    151 		alpha_XXX_dmamap_or = 0;			/* XXX */
    152 	}							/* XXX */
    153 	/* XXX XXX END XXX XXX */
    154 
    155 	(*intr_setup)();
    156 	set_iointr(iointr);
    157 
    158 	config_found(self, &tba, tcasicprint);
    159 }
    160 
    161 int
    162 tcasicprint(aux, pnp)
    163 	void *aux;
    164 	const char *pnp;
    165 {
    166 
    167 	/* only TCs can attach to tcasics; easy. */
    168 	if (pnp)
    169 		printf("tc at %s", pnp);
    170 	return (UNCONF);
    171 }
    172