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