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