xref: /illumos-gate/usr/src/uts/common/pcmcia/cis/cis_callout.c (revision 711890bc9379ceea66272dc8d4981812224ea86e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1995-1996 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * This file contains an array of structures, each of which refers to
31  *	a tuple that we are prepared to handle.  The last structure
32  *	in this array must have a type of CISTPL_END.
33  *
34  * If you want the generic tuple handler to be called for a tuple, use
35  *	the cis_no_tuple_handler() entry point.
36  */
37 
38 #include <sys/types.h>
39 #include <sys/systm.h>
40 #include <sys/user.h>
41 #include <sys/buf.h>
42 #include <sys/file.h>
43 #include <sys/uio.h>
44 #include <sys/conf.h>
45 #include <sys/stat.h>
46 #include <sys/autoconf.h>
47 #include <sys/vtoc.h>
48 #include <sys/dkio.h>
49 #include <sys/ddi.h>
50 #include <sys/sunddi.h>
51 #include <sys/debug.h>
52 #include <sys/ddi_impldefs.h>
53 #include <sys/kstat.h>
54 #include <sys/kmem.h>
55 #include <sys/modctl.h>
56 #include <sys/kobj.h>
57 #include <sys/callb.h>
58 
59 #include <sys/pctypes.h>
60 #include <pcmcia/sys/cs_types.h>
61 #include <pcmcia/sys/cis.h>
62 #include <pcmcia/sys/cis_handlers.h>
63 #include <pcmcia/sys/cs.h>
64 #include <pcmcia/sys/cs_priv.h>
65 #include <pcmcia/sys/cis_protos.h>
66 
67 /*
68  * cistpl_std_callout - callout list for standard tuples
69  */
70 cistpl_callout_t cistpl_std_callout[] = {
71 	{	CISTPL_DEVICE,			/* device information */
72 		0,
73 		0,
74 		cistpl_device_handler,
75 		"CISTPL_DEVICE"		},
76 	{	CISTPL_CHECKSUM,		/* checksum control */
77 		0,
78 		0,
79 		cis_no_tuple_handler,
80 		"CISTPL_CHECKSUM"	},
81 	{	CISTPL_LONGLINK_A,		/* long-link to AM */
82 		0,
83 		0,
84 		cistpl_longlink_ac_handler,
85 		"CISTPL_LONGLINK_A"	},
86 	{	CISTPL_LONGLINK_C,		/* long-link to CM */
87 		0,
88 		0,
89 		cistpl_longlink_ac_handler,
90 		"CISTPL_LONGLINK_C"	},
91 	{	CISTPL_LONGLINK_MFC,		/* long-link to MFC CIS */
92 		0,
93 		0,
94 		cistpl_longlink_mfc_handler,
95 		"CISTPL_LONGLINK_MFC"	},
96 	{	CISTPL_LINKTARGET,		/* link-target control */
97 		0,
98 		0,
99 		cistpl_linktarget_handler,
100 		"CISTPL_LINKTARGET"	},
101 	{	CISTPL_NO_LINK,			/* no-link control */
102 		0,
103 		0,
104 		cis_no_tuple_handler,
105 		"CISTPL_NO_LINK"	},
106 	{	CISTPL_VERS_1,			/* level 1 version info */
107 		0,
108 		0,
109 		cistpl_vers_1_handler,
110 		"CISTPL_VERS_1"		},
111 	{	CISTPL_ALTSTR,			/* alternate language string */
112 		0,
113 		0,
114 		cis_no_tuple_handler,
115 		"CISTPL_ALTSTR"		},
116 	{	CISTPL_DEVICE_A,		/* AM device information */
117 		0,
118 		0,
119 		cistpl_device_handler,
120 		"CISTPL_DEVICE_A"	},
121 	{	CISTPL_JEDEC_C,			/* JEDEC info for CM */
122 		0,
123 		0,
124 		cistpl_jedec_handler,
125 		"CISTPL_JEDEC_C"	},
126 	{	CISTPL_JEDEC_A,			/* JEDEC info for AM */
127 		0,
128 		0,
129 		cistpl_jedec_handler,
130 		"CISTPL_JEDEC_A"	},
131 	{	CISTPL_CONFIG,			/* configuration */
132 		0,
133 		0,
134 		cistpl_config_handler,
135 		"CISTPL_CONFIG"		},
136 	{	CISTPL_CFTABLE_ENTRY,		/* configuration-table-entry */
137 		0,
138 		0,
139 		cistpl_cftable_handler,
140 		"CISTPL_CFTABLE_ENTRY"	},
141 	{	CISTPL_DEVICE_OC,		/* other conditions for CM */
142 		0,
143 		0,
144 		cistpl_device_handler,
145 		"CISTPL_DEVICE_OC"	},
146 	{	CISTPL_DEVICE_OA,		/* other conditions for AM */
147 		0,
148 		0,
149 		cistpl_device_handler,
150 		"CISTPL_DEVICE_OA"	},
151 	{	CISTPL_VERS_2,			/* level 2 version info */
152 		0,
153 		0,
154 		cistpl_vers_2_handler,
155 		"CISTPL_VERS_2"		},
156 	{	CISTPL_FORMAT,			/* format type */
157 		0,
158 		0,
159 		cistpl_format_handler,
160 		"CISTPL_FORMAT"		},
161 	{	CISTPL_FORMAT_A,		/* Attribute Memory */
162 		0,				/* recording format */
163 		0,
164 		cistpl_format_handler,
165 		"CISTPL_FORMAT_A"	},
166 	{	CISTPL_GEOMETRY,		/* geometry */
167 		0,
168 		0,
169 		cistpl_geometry_handler,
170 		"CISTPL_GEOMETRY"	},
171 	{	CISTPL_BYTEORDER,		/* byte order */
172 		0,
173 		0,
174 		cistpl_byteorder_handler,
175 		"CISTPL_BYTEORDER"	},
176 	{	CISTPL_DATE,			/* card initialization date */
177 		0,
178 		0,
179 		cistpl_date_handler,
180 		"CISTPL_DATE"		},
181 	{	CISTPL_BATTERY,			/* battery replacement date */
182 		0,
183 		0,
184 		cistpl_battery_handler,
185 		"CISTPL_BATTERY"	},
186 	{	CISTPL_ORG,			/* organization */
187 		0,
188 		0,
189 		cistpl_org_handler,
190 		"CISTPL_ORG"		},
191 	{	CISTPL_FUNCID,			/* card function ID */
192 		0,
193 		0,
194 		cistpl_funcid_handler,
195 		"CISTPL_FUNCID"		},
196 	{	CISTPL_FUNCE,			/* card function extension */
197 		TPLFUNC_MULTI,		/* for multifunction cards */
198 		0,
199 		cis_no_tuple_handler,
200 		"CISTPL_FUNCE/MULTI"	},
201 	{	CISTPL_FUNCE,			/* card function extension */
202 		TPLFUNC_MEMORY,		/* for memory cards */
203 		0,
204 		cis_no_tuple_handler,
205 		"CISTPL_FUNCE/MEMORY"	},
206 	{	CISTPL_FUNCE,			/* card function extension */
207 		TPLFUNC_SERIAL,		/* for serial port cards */
208 		0,
209 		cistpl_funce_serial_handler,
210 		"CISTPL_FUNCE/SERIAL"	},
211 	{	CISTPL_FUNCE,			/* card function extension */
212 		TPLFUNC_PARALLEL,		/* for parallel port cards */
213 		0,
214 		cis_no_tuple_handler,
215 		"CISTPL_FUNCE/PARALLEL"	},
216 	{	CISTPL_FUNCE,			/* card function extension */
217 		TPLFUNC_FIXED,		/* for fixed disk cards */
218 		0,
219 		cis_no_tuple_handler,
220 		"CISTPL_FUNCE/FIXED"	},
221 	{	CISTPL_FUNCE,			/* card function extension */
222 		TPLFUNC_VIDEO,		/* for video cards */
223 		0,
224 		cis_no_tuple_handler,
225 		"CISTPL_FUNCE/VIDEO"	},
226 	{	CISTPL_FUNCE,			/* card function extension */
227 		TPLFUNC_LAN,		/* for LAN cards */
228 		0,
229 		cistpl_funce_lan_handler,
230 		"CISTPL_FUNCE/LAN"	},
231 
232 	{	CISTPL_FUNCE,			/* card function extension */
233 		TPLFUNC_AIMS,		/* Auto Incrementing Mass Storage */
234 		0,
235 		cis_no_tuple_handler,
236 		"CISTPL_FUNCE/AIMS"	},
237 	{	CISTPL_FUNCE,			/* card function extension */
238 		TPLFUNC_SCSI,		/* SCSI bridge */
239 		0,
240 		cis_no_tuple_handler,
241 		"CISTPL_FUNCE/SCSI"	},
242 	{	CISTPL_FUNCE,			/* card function extension */
243 		TPLFUNC_VENDOR_SPECIFIC,	/* Vendor Specific */
244 		0,
245 		cis_no_tuple_handler,
246 		"CISTPL_FUNCE/VENDOR_SPECIFIC"	},
247 	{	CISTPL_FUNCE,			/* card function extension */
248 		TPLFUNC_UNKNOWN,	/* for unknown functions */
249 		0,
250 		cis_no_tuple_handler,
251 		"CISTPL_FUNCE/unknown"	},
252 	{	CISTPL_MANFID,			/* manufacturer ID */
253 		0,
254 		0,
255 		cistpl_manfid_handler,
256 		"CISTPL_MANFID"		},
257 	{	CISTPL_SPCL,			/* special-purpose tuple */
258 		0,
259 		0,
260 		cis_no_tuple_handler,
261 		"CISTPL_SPCL"		},
262 	{	CISTPL_LONGLINK_CB,		/* longlink to next */
263 		0,				/* tuple chain */
264 		0,
265 		cis_no_tuple_handler,
266 		"CISTPL_LONGLINK_CB"	},
267 	{	CISTPL_CONFIG_CB,		/* configuration tuple */
268 		0,
269 		0,
270 		cis_no_tuple_handler,
271 		"CISTPL_CONFIG_CB"	},
272 	{	CISTPL_CFTABLE_ENTRY_CB,	/* configuration table */
273 		0,				/* entry */
274 		0,
275 		cis_no_tuple_handler,
276 		"CISTPL_CFTABLE_ENTRY_CB"	},
277 	{	CISTPL_BAR,			/* Base Address Register */
278 		0,				/* definition */
279 		0,
280 		cis_no_tuple_handler,
281 		"CISTPL_BAR"		},
282 	{	CISTPL_DEVICEGEO,		/* Common Memory */
283 		0,				/* device geometry */
284 		0,
285 		cis_no_tuple_handler,
286 		"CISTPL_DEVICEGEO"	},
287 	{	CISTPL_DEVICEGEO_A,		/* Attribute Memory */
288 		0,				/* device geometry */
289 		0,
290 		cis_no_tuple_handler,
291 		"CISTPL_DEVICEGEO_A"	},
292 	{	CISTPL_SWIL,			/* software interleave */
293 		0,
294 		0,
295 		cis_no_tuple_handler,
296 		"CISTPL_SWIL"		},
297 	{	CISTPL_VEND_SPEC_80,		/* vendor-specific 0x80 */
298 		0,
299 		0,
300 		cis_unknown_tuple_handler,
301 		"CISTPL_VEND_SPEC_80"	},
302 	{	CISTPL_VEND_SPEC_81,		/* vendor-specific 0x81 */
303 		0,
304 		0,
305 		cis_unknown_tuple_handler,
306 		"CISTPL_VEND_SPEC_81"	},
307 	{	CISTPL_VEND_SPEC_82,		/* vendor-specific 0x82 */
308 		0,
309 		0,
310 		cis_unknown_tuple_handler,
311 		"CISTPL_VEND_SPEC_82"	},
312 	{	CISTPL_VEND_SPEC_83,		/* vendor-specific 0x83 */
313 		0,
314 		0,
315 		cis_unknown_tuple_handler,
316 		"CISTPL_VEND_SPEC_83"	},
317 	{	CISTPL_VEND_SPEC_84,		/* vendor-specific 0x84 */
318 		0,
319 		0,
320 		cis_unknown_tuple_handler,
321 		"CISTPL_VEND_SPEC_84"	},
322 	{	CISTPL_VEND_SPEC_85,		/* vendor-specific 0x85 */
323 		0,
324 		0,
325 		cis_unknown_tuple_handler,
326 		"CISTPL_VEND_SPEC_85"	},
327 	{	CISTPL_VEND_SPEC_86,		/* vendor-specific 0x86 */
328 		0,
329 		0,
330 		cis_unknown_tuple_handler,
331 		"CISTPL_VEND_SPEC_86"	},
332 	{	CISTPL_VEND_SPEC_87,		/* vendor-specific 0x87 */
333 		0,
334 		0,
335 		cis_unknown_tuple_handler,
336 		"CISTPL_VEND_SPEC_87"	},
337 	{	CISTPL_VEND_SPEC_88,		/* vendor-specific 0x88 */
338 		0,
339 		0,
340 		cis_unknown_tuple_handler,
341 		"CISTPL_VEND_SPEC_88"	},
342 	{	CISTPL_VEND_SPEC_89,		/* vendor-specific 0x89 */
343 		0,
344 		0,
345 		cis_unknown_tuple_handler,
346 		"CISTPL_VEND_SPEC_89"	},
347 	{	CISTPL_VEND_SPEC_8a,		/* vendor-specific 0x8a */
348 		0,
349 		0,
350 		cis_unknown_tuple_handler,
351 		"CISTPL_VEND_SPEC_8a"	},
352 	{	CISTPL_VEND_SPEC_8b,		/* vendor-specific 0x8b */
353 		0,
354 		0,
355 		cis_unknown_tuple_handler,
356 		"CISTPL_VEND_SPEC_8b"	},
357 	{	CISTPL_VEND_SPEC_8c,		/* vendor-specific 0x8c */
358 		0,
359 		0,
360 		cis_unknown_tuple_handler,
361 		"CISTPL_VEND_SPEC_8c"	},
362 	{	CISTPL_VEND_SPEC_8d,		/* vendor-specific 0x8d */
363 		0,
364 		0,
365 		cis_unknown_tuple_handler,
366 		"CISTPL_VEND_SPEC_8d"	},
367 	{	CISTPL_VEND_SPEC_8e,		/* vendor-specific 0x8e */
368 		0,
369 		0,
370 		cis_unknown_tuple_handler,
371 		"CISTPL_VEND_SPEC_8e"	},
372 	{	CISTPL_VEND_SPEC_8f,		/* vendor-specific 0x8f */
373 		0,
374 		0,
375 		cis_unknown_tuple_handler,
376 		"CISTPL_VEND_SPEC_8f"	},
377 	{	CISTPL_END,			/* end-of-list tuple */
378 		0,
379 		0,
380 		cis_no_tuple_handler,
381 		"unknown tuple"		},
382 	};
383