tcvar.h revision 1.16 1 /* $NetBSD: tcvar.h,v 1.16 2000/06/01 00:22:52 cgd Exp $ */
2
3 /*
4 * Copyright (c) 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 #ifndef __DEV_TC_TCVAR_H__
31 #define __DEV_TC_TCVAR_H__
32
33 /*
34 * Definitions for TURBOchannel autoconfiguration.
35 */
36
37 #include <machine/bus.h>
38 #include <dev/tc/tcreg.h>
39
40 /*
41 * Machine-dependent definitions.
42 */
43 #include <machine/tc_machdep.h>
44
45 /*
46 * In the long run, the following block will go completely away.
47 * For now, the MI TC code still uses the old TC_IPL_ names
48 * and not the new IPL_ names.
49 */
50 #if 1
51 /*
52 * Map the new definitions to the old.
53 */
54 #include <machine/intr.h>
55
56 #define tc_intrlevel_t int
57
58 #define TC_IPL_NONE IPL_NONE
59 #define TC_IPL_BIO IPL_BIO
60 #define TC_IPL_NET IPL_NET
61 #define TC_IPL_TTY IPL_TTY
62 #define TC_IPL_CLOCK IPL_CLOCK
63 #endif /* 1 */
64
65 struct tc_softc {
66 struct device sc_dv;
67
68 int sc_speed;
69 int sc_nslots;
70 struct tc_slotdesc *sc_slots;
71
72 void (*sc_intr_establish)(struct device *, void *,
73 int, int (*)(void *), void *);
74 void (*sc_intr_disestablish)(struct device *, void *);
75 bus_dma_tag_t (*sc_get_dma_tag)(int);
76 };
77
78 /*
79 * Arguments used to attach TURBOchannel busses.
80 */
81 struct tcbus_attach_args {
82 char *tba_busname; /* XXX should be common */
83 bus_space_tag_t tba_memt;
84
85 /* Bus information */
86 u_int tba_speed; /* see TC_SPEED_* below */
87 u_int tba_nslots;
88 struct tc_slotdesc *tba_slots;
89 u_int tba_nbuiltins;
90 const struct tc_builtin *tba_builtins;
91
92
93 /* TC bus resource management; XXX will move elsewhere eventually. */
94 void (*tba_intr_establish)(struct device *, void *,
95 int, int (*)(void *), void *);
96 void (*tba_intr_disestablish)(struct device *, void *);
97 bus_dma_tag_t (*tba_get_dma_tag)(int);
98 };
99
100 /*
101 * Arguments used to attach TURBOchannel devices.
102 */
103 struct tc_attach_args {
104 bus_space_tag_t ta_memt;
105 bus_dma_tag_t ta_dmat;
106
107 char ta_modname[TC_ROM_LLEN+1];
108 u_int ta_slot;
109 tc_offset_t ta_offset;
110 tc_addr_t ta_addr;
111 void *ta_cookie;
112 u_int ta_busspeed; /* see TC_SPEED_* below */
113 };
114
115 /*
116 * Description of TURBOchannel slots, provided by machine-dependent
117 * code to the TURBOchannel bus driver.
118 */
119 struct tc_slotdesc {
120 tc_addr_t tcs_addr;
121 void *tcs_cookie;
122 int tcs_used;
123 };
124
125 /*
126 * Description of built-in TURBOchannel devices, provided by
127 * machine-dependent code to the TURBOchannel bus driver.
128 */
129 struct tc_builtin {
130 char *tcb_modname;
131 u_int tcb_slot;
132 tc_offset_t tcb_offset;
133 void *tcb_cookie;
134 };
135
136 /*
137 * Interrupt establishment functions.
138 */
139 int tc_checkslot(tc_addr_t, char *);
140 void tc_devinfo(const char *, char *);
141 void tcattach(struct device *, struct device *, void *);
142 void tc_intr_establish(struct device *, void *, int, int (*)(void *),
143 void *);
144 void tc_intr_disestablish(struct device *, void *);
145
146 #include "locators.h"
147 /*
148 * Easy to remember names for TURBOchannel device locators.
149 */
150 #define tccf_slot cf_loc[TCCF_SLOT] /* slot */
151 #define tccf_offset cf_loc[TCCF_OFFSET] /* offset */
152
153 #define TCCF_SLOT_UNKNOWN TCCF_SLOT_DEFAULT
154 #define TCCF_OFFSET_UNKNOWN TCCF_OFFSET_DEFAULT
155
156 /*
157 * Miscellaneous definitions.
158 */
159 #define TC_SPEED_12_5_MHZ 0 /* 12.5MHz TC bus */
160 #define TC_SPEED_25_MHZ 1 /* 25MHz TC bus */
161
162 #endif /* __DEV_TC_TCVAR_H__ */
163