tcvar.h revision 1.3 1 /* $NetBSD: tcvar.h,v 1.3 1996/02/27 01:37:33 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 * TurboChannel autoconfiguration definitions.
35 */
36
37 #include <dev/tc/tcreg.h>
38 #include <machine/tc_machdep.h>
39
40 /*
41 * Interrupt levels. XXX should be common, elsewhere.
42 */
43 typedef enum {
44 TC_IPL_NONE, /* block only this interrupt */
45 TC_IPL_BIO, /* block disk interrupts */
46 TC_IPL_NET, /* block network interrupts */
47 TC_IPL_TTY, /* block terminal interrupts */
48 TC_IPL_CLOCK, /* block clock interrupts */
49 } tc_intrlevel_t;
50
51 /*
52 * Arguments used to attach TurboChannel busses.
53 */
54 struct tcbus_attach_args {
55 char *tba_busname; /* XXX should be common */
56
57 /* Bus information */
58 u_int tba_speed; /* see TC_SPEED_* below */
59 u_int tba_nslots;
60 struct tc_slotdesc *tba_slots;
61 u_int tba_nbuiltins;
62 const struct tc_builtin *tba_builtins;
63
64
65 /* TC bus resource management; XXX will move elsewhere eventually. */
66 void (*tba_intr_establish) __P((struct device *, void *,
67 tc_intrlevel_t, int (*)(void *), void *));
68 void (*tba_intr_disestablish) __P((struct device *, void *));
69 };
70
71 /*
72 * Arguments used to attach TurboChannel devices.
73 */
74 struct tc_attach_args {
75 char ta_modname[TC_ROM_LLEN+1];
76 u_int ta_slot;
77 tc_offset_t ta_offset;
78 tc_addr_t ta_addr;
79 void *ta_cookie;
80 u_int ta_busspeed; /* see TC_SPEED_* below */
81 };
82
83 /*
84 * Description of TurboChannel slots, provided by machine-dependent
85 * code to the TurboChannel bus driver.
86 */
87 struct tc_slotdesc {
88 tc_addr_t tcs_addr;
89 void *tcs_cookie;
90 int tcs_used;
91 };
92
93 /*
94 * Description of built-in TurboChannel devices, provided by
95 * machine-dependent code to the TurboChannel bus driver.
96 */
97 struct tc_builtin {
98 char *tcb_modname;
99 u_int tcb_slot;
100 tc_offset_t tcb_offset;
101 void *tcb_cookie;
102 };
103
104 /*
105 * Interrupt establishment functions.
106 */
107 void tc_intr_establish __P((struct device *, void *, tc_intrlevel_t,
108 int (*)(void *), void *));
109 void tc_intr_disestablish __P((struct device *, void *));
110
111 /*
112 * Easy to remember names for TurboChannel device locators.
113 */
114 #define tccf_slot cf_loc[0] /* slot */
115 #define tccf_offset cf_loc[1] /* offset */
116
117 #define TCCF_SLOT_UNKNOWN -1
118 #define TCCF_OFFSET_UNKNOWN -1
119
120 /*
121 * Miscellaneous definitions.
122 */
123 #define TC_SPEED_12_5_MHZ 0 /* 12.5MHz TC bus */
124 #define TC_SPEED_25_MHZ 1 /* 25MHz TC bus */
125
126 /*
127 * The TurboChannel bus cfdriver, so that subdevices can more
128 * easily tell what bus they're on.
129 */
130 extern struct cfdriver tccd;
131
132 #endif /* __DEV_TC_TCVAR_H__ */
133