tcvar.h revision 1.5 1 1.5 cgd /* $NetBSD: tcvar.h,v 1.5 1996/05/17 23:38:16 cgd Exp $ */
2 1.1 cgd
3 1.1 cgd /*
4 1.1 cgd * Copyright (c) 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 #ifndef __DEV_TC_TCVAR_H__
31 1.1 cgd #define __DEV_TC_TCVAR_H__
32 1.1 cgd
33 1.1 cgd /*
34 1.5 cgd * Definitions for TurboChannel autoconfiguration.
35 1.1 cgd */
36 1.1 cgd
37 1.5 cgd #ifdef __alpha__ /* XXX pmax does not yet have machine/bus.h */
38 1.5 cgd #include <machine/bus.h>
39 1.5 cgd #endif
40 1.1 cgd #include <dev/tc/tcreg.h>
41 1.5 cgd
42 1.5 cgd /*
43 1.5 cgd * Machine-dependent definitions.
44 1.5 cgd */
45 1.5 cgd #if (alpha + pmax != 1)
46 1.5 cgd ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE.
47 1.5 cgd #endif
48 1.5 cgd #if alpha
49 1.5 cgd #include <alpha/tc/tc_machdep.h>
50 1.5 cgd #endif
51 1.5 cgd #if pmax
52 1.1 cgd #include <machine/tc_machdep.h>
53 1.5 cgd #endif
54 1.1 cgd
55 1.1 cgd /*
56 1.5 cgd * In the long run, the following block will go completely away
57 1.5 cgd * (i.e. both parts of the #if, including the #include, etc.).
58 1.5 cgd * For now, the MI TC code still uses the old definitions provided
59 1.5 cgd * by the pmax port, and not the new definitions provided by the
60 1.5 cgd * alpha port.
61 1.5 cgd */
62 1.5 cgd #ifdef __alpha_
63 1.5 cgd /*
64 1.5 cgd * On the alpha, map the new definitions to the old.
65 1.5 cgd */
66 1.5 cgd #include <machine/intr.h>
67 1.5 cgd
68 1.5 cgd #define tc_intrlevel_t int
69 1.5 cgd
70 1.5 cgd #define TC_IPL_NONE IPL_NONE
71 1.5 cgd #define TC_IPL_BIO IPL_BIO
72 1.5 cgd #define TC_IPL_NET IPL_NET
73 1.5 cgd #define TC_IPL_TTY IPL_TTY
74 1.5 cgd #define TC_IPL_CLOCK IPL_CLOCK
75 1.5 cgd
76 1.5 cgd #else
77 1.5 cgd /*
78 1.5 cgd * On the pmax, we still need the old definitions.
79 1.1 cgd */
80 1.1 cgd typedef enum {
81 1.1 cgd TC_IPL_NONE, /* block only this interrupt */
82 1.1 cgd TC_IPL_BIO, /* block disk interrupts */
83 1.1 cgd TC_IPL_NET, /* block network interrupts */
84 1.1 cgd TC_IPL_TTY, /* block terminal interrupts */
85 1.1 cgd TC_IPL_CLOCK, /* block clock interrupts */
86 1.1 cgd } tc_intrlevel_t;
87 1.5 cgd #endif
88 1.1 cgd
89 1.1 cgd /*
90 1.1 cgd * Arguments used to attach TurboChannel busses.
91 1.1 cgd */
92 1.2 cgd struct tcbus_attach_args {
93 1.2 cgd char *tba_busname; /* XXX should be common */
94 1.5 cgd #ifdef __alpha__ /* XXX */
95 1.5 cgd bus_chipset_tag_t tba_bc; /* XXX should be common */
96 1.5 cgd #endif
97 1.1 cgd
98 1.2 cgd /* Bus information */
99 1.3 cgd u_int tba_speed; /* see TC_SPEED_* below */
100 1.2 cgd u_int tba_nslots;
101 1.2 cgd struct tc_slotdesc *tba_slots;
102 1.2 cgd u_int tba_nbuiltins;
103 1.2 cgd const struct tc_builtin *tba_builtins;
104 1.2 cgd
105 1.1 cgd
106 1.2 cgd /* TC bus resource management; XXX will move elsewhere eventually. */
107 1.2 cgd void (*tba_intr_establish) __P((struct device *, void *,
108 1.1 cgd tc_intrlevel_t, int (*)(void *), void *));
109 1.2 cgd void (*tba_intr_disestablish) __P((struct device *, void *));
110 1.1 cgd };
111 1.1 cgd
112 1.1 cgd /*
113 1.1 cgd * Arguments used to attach TurboChannel devices.
114 1.1 cgd */
115 1.2 cgd struct tc_attach_args {
116 1.5 cgd #ifdef __alpha__ /* XXX */
117 1.5 cgd bus_chipset_tag_t ta_bc;
118 1.5 cgd #endif
119 1.5 cgd
120 1.2 cgd char ta_modname[TC_ROM_LLEN+1];
121 1.2 cgd u_int ta_slot;
122 1.2 cgd tc_offset_t ta_offset;
123 1.2 cgd tc_addr_t ta_addr;
124 1.2 cgd void *ta_cookie;
125 1.3 cgd u_int ta_busspeed; /* see TC_SPEED_* below */
126 1.1 cgd };
127 1.1 cgd
128 1.1 cgd /*
129 1.1 cgd * Description of TurboChannel slots, provided by machine-dependent
130 1.1 cgd * code to the TurboChannel bus driver.
131 1.1 cgd */
132 1.1 cgd struct tc_slotdesc {
133 1.2 cgd tc_addr_t tcs_addr;
134 1.2 cgd void *tcs_cookie;
135 1.2 cgd int tcs_used;
136 1.1 cgd };
137 1.1 cgd
138 1.1 cgd /*
139 1.1 cgd * Description of built-in TurboChannel devices, provided by
140 1.1 cgd * machine-dependent code to the TurboChannel bus driver.
141 1.1 cgd */
142 1.1 cgd struct tc_builtin {
143 1.2 cgd char *tcb_modname;
144 1.2 cgd u_int tcb_slot;
145 1.2 cgd tc_offset_t tcb_offset;
146 1.2 cgd void *tcb_cookie;
147 1.1 cgd };
148 1.1 cgd
149 1.1 cgd /*
150 1.1 cgd * Interrupt establishment functions.
151 1.1 cgd */
152 1.1 cgd void tc_intr_establish __P((struct device *, void *, tc_intrlevel_t,
153 1.1 cgd int (*)(void *), void *));
154 1.1 cgd void tc_intr_disestablish __P((struct device *, void *));
155 1.1 cgd
156 1.1 cgd /*
157 1.1 cgd * Easy to remember names for TurboChannel device locators.
158 1.1 cgd */
159 1.1 cgd #define tccf_slot cf_loc[0] /* slot */
160 1.1 cgd #define tccf_offset cf_loc[1] /* offset */
161 1.1 cgd
162 1.1 cgd #define TCCF_SLOT_UNKNOWN -1
163 1.1 cgd #define TCCF_OFFSET_UNKNOWN -1
164 1.3 cgd
165 1.3 cgd /*
166 1.3 cgd * Miscellaneous definitions.
167 1.3 cgd */
168 1.3 cgd #define TC_SPEED_12_5_MHZ 0 /* 12.5MHz TC bus */
169 1.3 cgd #define TC_SPEED_25_MHZ 1 /* 25MHz TC bus */
170 1.1 cgd
171 1.1 cgd /*
172 1.1 cgd * The TurboChannel bus cfdriver, so that subdevices can more
173 1.1 cgd * easily tell what bus they're on.
174 1.1 cgd */
175 1.4 jonathan extern struct cfdriver tc_cd;
176 1.1 cgd
177 1.1 cgd #endif /* __DEV_TC_TCVAR_H__ */
178