tcasic.c revision 1.1 1 /* $NetBSD: tcasic.c,v 1.1 1995/12/20 00:43:34 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1994, 1995 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/device.h>
32
33 #include <machine/autoconf.h>
34 #include <machine/rpb.h>
35
36 #include <dev/tc/tcvar.h>
37 #include <alpha/tc/tc_conf.h>
38
39 /* Definition of the driver for autoconfig. */
40 int tcasicmatch(struct device *, void *, void *);
41 void tcasicattach(struct device *, struct device *, void *);
42 struct cfdriver tcasiccd =
43 { NULL, "tcasic", tcasicmatch, tcasicattach, DV_DULL,
44 sizeof (struct device) };
45
46 int tcasicprint __P((void *, char *));
47
48 extern int cputype;
49
50 /* There can be only one. */
51 int tcasicfound;
52
53 int
54 tcasicmatch(parent, cfdata, aux)
55 struct device *parent;
56 void *cfdata;
57 void *aux;
58 {
59 struct confargs *ca = aux;
60
61 /* Make sure that we're looking for a TurboChannel ASIC. */
62 if (strcmp(ca->ca_name, tcasiccd.cd_name))
63 return (0);
64
65 /* Make sure that the system supports a TurboChannel ASIC. */
66 if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
67 return (0);
68
69 if (tcasicfound)
70 return (0);
71
72 return (1);
73 }
74
75 void
76 tcasicattach(parent, self, aux)
77 struct device *parent;
78 struct device *self;
79 void *aux;
80 {
81 struct tc_attach_args tc;
82 void (*intr_setup) __P((void));
83 void (*iointr) __P((void *, int));
84
85 tcasicfound = 1;
86
87 switch (cputype) {
88 #ifdef DEC_3000_500
89 case ST_DEC_3000_500:
90 printf(": 25MHz\n");
91
92 intr_setup = tc_3000_500_intr_setup;
93 iointr = tc_3000_500_iointr;
94
95 tc.tca_nslots = tc_3000_500_nslots;
96 tc.tca_slots = tc_3000_500_slots;
97 tc.tca_nbuiltins = tc_3000_500_nbuiltins;
98 tc.tca_builtins = tc_3000_500_builtins;
99 tc.tca_intr_establish = tc_3000_500_intr_establish;
100 tc.tca_intr_disestablish = tc_3000_500_intr_disestablish;
101 break;
102 #endif /* DEC_3000_500 */
103
104 #ifdef DEC_3000_300
105 case ST_DEC_3000_300:
106 printf(": 12.5MHz\n");
107
108 intr_setup = tc_3000_300_intr_setup;
109 iointr = tc_3000_300_iointr;
110
111 tc.tca_nslots = tc_3000_300_nslots;
112 tc.tca_slots = tc_3000_300_slots;
113 tc.tca_nbuiltins = tc_3000_300_nbuiltins;
114 tc.tca_builtins = tc_3000_300_builtins;
115 tc.tca_intr_establish = tc_3000_300_intr_establish;
116 tc.tca_intr_disestablish = tc_3000_300_intr_disestablish;
117 break;
118 #endif /* DEC_3000_300 */
119
120 default:
121 printf("\n");
122 panic("tcasicattach: bad cputype");
123 }
124
125 (*intr_setup)();
126 set_iointr(iointr);
127
128 config_found(self, &tc, tcasicprint);
129 }
130
131 int
132 tcasicprint(aux, pnp)
133 void *aux;
134 char *pnp;
135 {
136
137 /* only TCs can attach to tcasics; easy. */
138 if (pnp)
139 printf("tc at %s", pnp);
140 return (UNCONF);
141 }
142