xref: /openbsd-src/sys/dev/tc/tcvar.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /*	$OpenBSD: tcvar.h,v 1.7 2001/06/27 20:23:38 miod Exp $	*/
2 /*	$NetBSD: tcvar.h,v 1.7 1996/10/22 21:37:31 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1995 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Chris G. Demetriou
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 #ifndef __DEV_TC_TCVAR_H__
32 #define __DEV_TC_TCVAR_H__
33 
34 /*
35  * Definitions for TurboChannel autoconfiguration.
36  */
37 
38 #include <machine/bus.h>
39 #include <dev/tc/tcreg.h>
40 
41 /*
42  * Machine-dependent definitions.
43  */
44 #if !defined(__alpha__)
45 ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE.
46 #endif
47 #ifdef __alpha__
48 #include <alpha/tc/tc_machdep.h>
49 #endif
50 
51 /*
52  * In the long run, the following block will go completely away
53  * (i.e. both parts of the #if, including the #include, etc.).
54  * For now, the MI TC code still uses the old definitions provided
55  * by the pmax port, and not the new definitions provided by the
56  * alpha port.
57  */
58 #ifdef __alpha__
59 /*
60  * On the alpha, map the new definitions to the old.
61  */
62 #include <machine/intr.h>
63 
64 #define tc_intrlevel_t	int
65 
66 #define	TC_IPL_NONE	IPL_NONE
67 #define	TC_IPL_BIO	IPL_BIO
68 #define	TC_IPL_NET	IPL_NET
69 #define	TC_IPL_TTY	IPL_TTY
70 #define	TC_IPL_CLOCK	IPL_CLOCK
71 
72 #endif
73 
74 /*
75  * Arguments used to attach TurboChannel busses.
76  */
77 struct tcbus_attach_args {
78 	char		*tba_busname;		/* XXX should be common */
79 #ifdef __alpha__ /* XXX */
80 	bus_space_tag_t tba_memt;
81 #endif
82 
83 	/* Bus information */
84 	u_int		tba_speed;		/* see TC_SPEED_* below */
85 	u_int		tba_nslots;
86 	struct tc_slotdesc *tba_slots;
87 	u_int		tba_nbuiltins;
88 	const struct tc_builtin *tba_builtins;
89 
90 
91 	/* TC bus resource management; XXX will move elsewhere eventually. */
92 	void	(*tba_intr_establish) __P((struct device *, void *,
93 		    tc_intrlevel_t, int (*)(void *), void *));
94 	void	(*tba_intr_disestablish) __P((struct device *, void *));
95 };
96 
97 /*
98  * Arguments used to attach TurboChannel devices.
99  */
100 struct tc_attach_args {
101 #ifdef __alpha__ /* XXX */
102 	bus_space_tag_t ta_memt;
103 #endif
104 
105 	char		ta_modname[TC_ROM_LLEN+1];
106 	u_int		ta_slot;
107 	tc_offset_t	ta_offset;
108 	tc_addr_t	ta_addr;
109 	void		*ta_cookie;
110 	u_int		ta_busspeed;		/* see TC_SPEED_* below */
111 };
112 
113 /*
114  * Description of TurboChannel slots, provided by machine-dependent
115  * code to the TurboChannel bus driver.
116  */
117 struct tc_slotdesc {
118 	tc_addr_t	tcs_addr;
119 	void		*tcs_cookie;
120 	int		tcs_used;
121 };
122 
123 /*
124  * Description of built-in TurboChannel devices, provided by
125  * machine-dependent code to the TurboChannel bus driver.
126  */
127 struct tc_builtin {
128 	char		*tcb_modname;
129 	u_int		tcb_slot;
130 	tc_offset_t	tcb_offset;
131 	void		*tcb_cookie;
132 };
133 
134 /*
135  * Interrupt establishment functions.
136  */
137 void	tc_intr_establish __P((struct device *, void *, tc_intrlevel_t,
138 	    int (*)(void *), void *));
139 void	tc_intr_disestablish __P((struct device *, void *));
140 
141 /*
142  * Easy to remember names for TurboChannel device locators.
143  */
144 #define	tccf_slot	cf_loc[0]		/* slot */
145 #define	tccf_offset	cf_loc[1]		/* offset */
146 
147 #define	TCCF_SLOT_UNKNOWN	-1
148 #define	TCCF_OFFSET_UNKNOWN	-1
149 
150 /*
151  * Miscellaneous definitions.
152  */
153 #define	TC_SPEED_12_5_MHZ	0		/* 12.5MHz TC bus */
154 #define	TC_SPEED_25_MHZ		1		/* 25MHz TC bus */
155 
156 /*
157  * The TurboChannel bus cfdriver, so that subdevices can more
158  * easily tell what bus they're on.
159  */
160 extern struct cfdriver tc_cd;
161 
162 #endif /* __DEV_TC_TCVAR_H__ */
163