tcasic.c revision 1.4 1 /* $NetBSD: tcasic.c,v 1.4 1996/04/12 06:10:04 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/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
43 struct cfattach tcasic_ca = {
44 sizeof (struct device), tcasicmatch, tcasicattach,
45 };
46
47 struct cfdriver tcasic_cd = {
48 NULL, "tcasic", DV_DULL,
49 };
50
51 int tcasicprint __P((void *, char *));
52
53 extern int cputype;
54
55 /* There can be only one. */
56 int tcasicfound;
57
58 int
59 tcasicmatch(parent, cfdata, aux)
60 struct device *parent;
61 void *cfdata;
62 void *aux;
63 {
64 struct confargs *ca = aux;
65
66 /* Make sure that we're looking for a TurboChannel ASIC. */
67 if (strcmp(ca->ca_name, tcasic_cd.cd_name))
68 return (0);
69
70 /* Make sure that the system supports a TurboChannel ASIC. */
71 if ((cputype != ST_DEC_3000_500) && (cputype != ST_DEC_3000_300))
72 return (0);
73
74 if (tcasicfound)
75 return (0);
76
77 return (1);
78 }
79
80 void
81 tcasicattach(parent, self, aux)
82 struct device *parent;
83 struct device *self;
84 void *aux;
85 {
86 struct tcbus_attach_args tba;
87 void (*intr_setup) __P((void));
88 void (*iointr) __P((void *, int));
89
90 printf("\n");
91 tcasicfound = 1;
92
93 switch (cputype) {
94 #ifdef DEC_3000_500
95 case ST_DEC_3000_500:
96
97 intr_setup = tc_3000_500_intr_setup;
98 iointr = tc_3000_500_iointr;
99
100 tba.tba_busname = "tc";
101 tba.tba_speed = TC_SPEED_25_MHZ;
102 tba.tba_nslots = tc_3000_500_nslots;
103 tba.tba_slots = tc_3000_500_slots;
104 tba.tba_nbuiltins = tc_3000_500_nbuiltins;
105 tba.tba_builtins = tc_3000_500_builtins;
106 tba.tba_intr_establish = tc_3000_500_intr_establish;
107 tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
108 break;
109 #endif /* DEC_3000_500 */
110
111 #ifdef DEC_3000_300
112 case ST_DEC_3000_300:
113
114 intr_setup = tc_3000_300_intr_setup;
115 iointr = tc_3000_300_iointr;
116
117 tba.tba_busname = "tc";
118 tba.tba_speed = TC_SPEED_12_5_MHZ;
119 tba.tba_nslots = tc_3000_300_nslots;
120 tba.tba_slots = tc_3000_300_slots;
121 tba.tba_nbuiltins = tc_3000_300_nbuiltins;
122 tba.tba_builtins = tc_3000_300_builtins;
123 tba.tba_intr_establish = tc_3000_300_intr_establish;
124 tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
125 break;
126 #endif /* DEC_3000_300 */
127
128 default:
129 panic("tcasicattach: bad cputype");
130 }
131
132 (*intr_setup)();
133 set_iointr(iointr);
134
135 config_found(self, &tba, tcasicprint);
136 }
137
138 int
139 tcasicprint(aux, pnp)
140 void *aux;
141 char *pnp;
142 {
143
144 /* only TCs can attach to tcasics; easy. */
145 if (pnp)
146 printf("tc at %s", pnp);
147 return (UNCONF);
148 }
149