tcasic.c revision 1.16 1 /* $NetBSD: tcasic.c,v 1.16 1997/04/06 22:32:06 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 <machine/options.h> /* Pull in config options headers */
31
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/device.h>
35
36 #include <machine/autoconf.h>
37 #include <machine/rpb.h>
38
39 #include <dev/tc/tcvar.h>
40 #include <alpha/tc/tc_conf.h>
41
42 /* Definition of the driver for autoconfig. */
43 int tcasicmatch(struct device *, struct cfdata *, void *);
44 void tcasicattach(struct device *, struct device *, void *);
45
46 struct cfattach tcasic_ca = {
47 sizeof (struct device), tcasicmatch, tcasicattach,
48 };
49
50 struct cfdriver tcasic_cd = {
51 NULL, "tcasic", DV_DULL,
52 };
53
54 int tcasicprint __P((void *, const char *));
55
56 extern int cputype;
57
58 /* There can be only one. */
59 int tcasicfound;
60
61 int
62 tcasicmatch(parent, cfdata, aux)
63 struct device *parent;
64 struct cfdata *cfdata;
65 void *aux;
66 {
67 struct confargs *ca = aux;
68
69 /* Make sure that we're looking for a TurboChannel ASIC. */
70 if (strcmp(ca->ca_name, tcasic_cd.cd_name))
71 return (0);
72
73 /* Make sure that the system supports a TurboChannel ASIC. */
74 if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
75 return (0);
76
77 if (tcasicfound)
78 return (0);
79
80 return (1);
81 }
82
83 void
84 tcasicattach(parent, self, aux)
85 struct device *parent;
86 struct device *self;
87 void *aux;
88 {
89 struct tcbus_attach_args tba;
90 void (*intr_setup) __P((void));
91 void (*iointr) __P((void *, unsigned long));
92
93 printf("\n");
94 tcasicfound = 1;
95
96 switch (cputype) {
97 #ifdef DEC_3000_500
98 case ST_DEC_3000_500:
99
100 intr_setup = tc_3000_500_intr_setup;
101 iointr = tc_3000_500_iointr;
102
103 tba.tba_busname = "tc";
104 tba.tba_speed = TC_SPEED_25_MHZ;
105 tba.tba_nslots = tc_3000_500_nslots;
106 tba.tba_slots = tc_3000_500_slots;
107 if (hwrpb->rpb_variation & SV_GRAPHICS) {
108 tba.tba_nbuiltins = tc_3000_500_graphics_nbuiltins;
109 tba.tba_builtins = tc_3000_500_graphics_builtins;
110 } else {
111 tba.tba_nbuiltins = tc_3000_500_nographics_nbuiltins;
112 tba.tba_builtins = tc_3000_500_nographics_builtins;
113 }
114 tba.tba_intr_establish = tc_3000_500_intr_establish;
115 tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
116 break;
117 #endif /* DEC_3000_500 */
118
119 #ifdef DEC_3000_300
120 case ST_DEC_3000_300:
121
122 intr_setup = tc_3000_300_intr_setup;
123 iointr = tc_3000_300_iointr;
124
125 tba.tba_busname = "tc";
126 tba.tba_speed = TC_SPEED_12_5_MHZ;
127 tba.tba_nslots = tc_3000_300_nslots;
128 tba.tba_slots = tc_3000_300_slots;
129 tba.tba_nbuiltins = tc_3000_300_nbuiltins;
130 tba.tba_builtins = tc_3000_300_builtins;
131 tba.tba_intr_establish = tc_3000_300_intr_establish;
132 tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
133 break;
134 #endif /* DEC_3000_300 */
135
136 default:
137 panic("tcasicattach: bad cputype");
138 }
139
140 tba.tba_memt = tc_bus_mem_init(NULL);
141
142 /* XXX XXX BEGIN XXX XXX */
143 { /* XXX */
144 extern vm_offset_t alpha_XXX_dmamap_or; /* XXX */
145 alpha_XXX_dmamap_or = 0; /* XXX */
146 } /* XXX */
147 /* XXX XXX END XXX XXX */
148
149 (*intr_setup)();
150 set_iointr(iointr);
151
152 config_found(self, &tba, tcasicprint);
153 }
154
155 int
156 tcasicprint(aux, pnp)
157 void *aux;
158 const char *pnp;
159 {
160
161 /* only TCs can attach to tcasics; easy. */
162 if (pnp)
163 printf("tc at %s", pnp);
164 return (UNCONF);
165 }
166