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