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