xref: /onnv-gate/usr/src/uts/common/pcmcia/cis/cis_params.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1995-1999 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate #include <sys/types.h>
30*0Sstevel@tonic-gate #include <sys/systm.h>
31*0Sstevel@tonic-gate #include <sys/user.h>
32*0Sstevel@tonic-gate #include <sys/buf.h>
33*0Sstevel@tonic-gate #include <sys/file.h>
34*0Sstevel@tonic-gate #include <sys/uio.h>
35*0Sstevel@tonic-gate #include <sys/conf.h>
36*0Sstevel@tonic-gate #include <sys/stat.h>
37*0Sstevel@tonic-gate #include <sys/autoconf.h>
38*0Sstevel@tonic-gate #include <sys/vtoc.h>
39*0Sstevel@tonic-gate #include <sys/dkio.h>
40*0Sstevel@tonic-gate #include <sys/ddi.h>
41*0Sstevel@tonic-gate #include <sys/sunddi.h>
42*0Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
43*0Sstevel@tonic-gate #include <sys/kstat.h>
44*0Sstevel@tonic-gate #include <sys/kmem.h>
45*0Sstevel@tonic-gate #include <sys/modctl.h>
46*0Sstevel@tonic-gate #include <sys/kobj.h>
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate #include <sys/pctypes.h>
49*0Sstevel@tonic-gate #include <pcmcia/sys/cs_types.h>
50*0Sstevel@tonic-gate #include <pcmcia/sys/cis.h>
51*0Sstevel@tonic-gate #include <pcmcia/sys/cis_handlers.h>
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate /*
54*0Sstevel@tonic-gate  *
55*0Sstevel@tonic-gate  * The following speed tables are used by cistpl_devspeed() to generate
56*0Sstevel@tonic-gate  *	device speeds from tuple data.
57*0Sstevel@tonic-gate  *
58*0Sstevel@tonic-gate  * Define the device speed table.  For a description of this table's contents,
59*0Sstevel@tonic-gate  *	see PCMCIA Release 2.01 Card Metaformat pg. 5-14 table 5-12.
60*0Sstevel@tonic-gate  *
61*0Sstevel@tonic-gate  * All times in this table are in nS.
62*0Sstevel@tonic-gate  */
63*0Sstevel@tonic-gate uint32_t cistpl_devspeed_table[CISTPL_DEVSPEED_MAX_TBL] = {
64*0Sstevel@tonic-gate     0,		/* 0x00 - DSPEED_NULL */
65*0Sstevel@tonic-gate     250,	/* 0x01 - DSPEED_250NS */
66*0Sstevel@tonic-gate     200,	/* 0x02 - DSPEED_200NS */
67*0Sstevel@tonic-gate     150,	/* 0x03 - DSPEED_150NS */
68*0Sstevel@tonic-gate     100,	/* 0x04 - DSPEED_100NS */
69*0Sstevel@tonic-gate     0,		/* 0x05 - reserved */
70*0Sstevel@tonic-gate     0,		/* 0x06 - reserved */
71*0Sstevel@tonic-gate     0		/* 0x07 - use extended speed byte */
72*0Sstevel@tonic-gate };
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate /*
75*0Sstevel@tonic-gate  * Define the power-of-10 table.
76*0Sstevel@tonic-gate  */
77*0Sstevel@tonic-gate uint32_t cistpl_exspeed_tenfac[] = {
78*0Sstevel@tonic-gate     1,		/* 10^0 */
79*0Sstevel@tonic-gate     10,		/* 10^1 */
80*0Sstevel@tonic-gate     100,	/* 10^2 */
81*0Sstevel@tonic-gate     1000,	/* 10^3 */
82*0Sstevel@tonic-gate     10000,	/* 10^4 */
83*0Sstevel@tonic-gate     100000,	/* 10^5 */
84*0Sstevel@tonic-gate     1000000,	/* 10^6 */
85*0Sstevel@tonic-gate     10000000	/* 10^7	 */
86*0Sstevel@tonic-gate };
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate /*
89*0Sstevel@tonic-gate  * The extended device speed code mantissa table.
90*0Sstevel@tonic-gate  *
91*0Sstevel@tonic-gate  * This table is described in PCMCIA Release 2.01 Card Metaformat
92*0Sstevel@tonic-gate  *	pg. 5-15 table 5-13.
93*0Sstevel@tonic-gate  *
94*0Sstevel@tonic-gate  * The description of this table uses non-integer values.  We multiply
95*0Sstevel@tonic-gate  *	everything by 10 before it goes into the table, and the code
96*0Sstevel@tonic-gate  *	will divide by 10 after it calculates the device speed.
97*0Sstevel@tonic-gate  */
98*0Sstevel@tonic-gate uint32_t cistpl_devspeed_man[CISTPL_DEVSPEED_MAX_MAN] = {
99*0Sstevel@tonic-gate     0,		/* no units */
100*0Sstevel@tonic-gate     10,		/* no units */
101*0Sstevel@tonic-gate     12,		/* no units */
102*0Sstevel@tonic-gate     13,		/* no units */
103*0Sstevel@tonic-gate     15,		/* no units */
104*0Sstevel@tonic-gate     20,		/* no units */
105*0Sstevel@tonic-gate     25,		/* no units */
106*0Sstevel@tonic-gate     30,		/* no units */
107*0Sstevel@tonic-gate     35,		/* no units */
108*0Sstevel@tonic-gate     40,		/* no units */
109*0Sstevel@tonic-gate     45,		/* no units */
110*0Sstevel@tonic-gate     50,		/* no units */
111*0Sstevel@tonic-gate     55,		/* no units */
112*0Sstevel@tonic-gate     60,		/* no units */
113*0Sstevel@tonic-gate     70,		/* no units */
114*0Sstevel@tonic-gate     80,		/* no units */
115*0Sstevel@tonic-gate };
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate /*
118*0Sstevel@tonic-gate  * The extended device speed code exponent table.
119*0Sstevel@tonic-gate  *
120*0Sstevel@tonic-gate  * This table is described in PCMCIA Release 2.01 Card Metaformat
121*0Sstevel@tonic-gate  *	pg. 5-15 table 5-13.
122*0Sstevel@tonic-gate  *
123*0Sstevel@tonic-gate  * The description of this table uses various timing units.  This
124*0Sstevel@tonic-gate  *	table contains all times in nS.
125*0Sstevel@tonic-gate  */
126*0Sstevel@tonic-gate uint32_t cistpl_devspeed_exp[CISTPL_DEVSPEED_MAX_EXP] = {
127*0Sstevel@tonic-gate     1,		/* 1 nS */
128*0Sstevel@tonic-gate     10,		/* 10 nS */
129*0Sstevel@tonic-gate     100,	/* 100 nS */
130*0Sstevel@tonic-gate     1000,	/* 1000 nS */
131*0Sstevel@tonic-gate     10000,	/* 10000 nS */
132*0Sstevel@tonic-gate     100000,	/* 100000 nS */
133*0Sstevel@tonic-gate     1000000,	/* 1000000 nS */
134*0Sstevel@tonic-gate     10000000	/* 10000000 nS */
135*0Sstevel@tonic-gate };
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate /*
138*0Sstevel@tonic-gate  * The power description mantissa table.
139*0Sstevel@tonic-gate  *
140*0Sstevel@tonic-gate  * This table is described in PCMCIA Release 2.01 Card Metaformat
141*0Sstevel@tonic-gate  *	pg. 5-28 table 5-32.
142*0Sstevel@tonic-gate  *
143*0Sstevel@tonic-gate  * The description of this table uses non-integer values.  We multiply
144*0Sstevel@tonic-gate  *	everything by 10 before it goes into the table, and the code
145*0Sstevel@tonic-gate  *	will divide by 10 after it calculates the device power.
146*0Sstevel@tonic-gate  */
147*0Sstevel@tonic-gate uint32_t cistpl_pd_man[] = {
148*0Sstevel@tonic-gate     10,		/* no units */
149*0Sstevel@tonic-gate     12,		/* no units */
150*0Sstevel@tonic-gate     13,		/* no units */
151*0Sstevel@tonic-gate     15,		/* no units */
152*0Sstevel@tonic-gate     20,		/* no units */
153*0Sstevel@tonic-gate     25,		/* no units */
154*0Sstevel@tonic-gate     30,		/* no units */
155*0Sstevel@tonic-gate     35,		/* no units */
156*0Sstevel@tonic-gate     40,		/* no units */
157*0Sstevel@tonic-gate     45,		/* no units */
158*0Sstevel@tonic-gate     50,		/* no units */
159*0Sstevel@tonic-gate     55,		/* no units */
160*0Sstevel@tonic-gate     60,		/* no units */
161*0Sstevel@tonic-gate     70,		/* no units */
162*0Sstevel@tonic-gate     80,		/* no units */
163*0Sstevel@tonic-gate     90,		/* no units */
164*0Sstevel@tonic-gate };
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate /*
167*0Sstevel@tonic-gate  * The power description exponent table.
168*0Sstevel@tonic-gate  *
169*0Sstevel@tonic-gate  * This table is described in PCMCIA Release 2.01 Card Metaformat
170*0Sstevel@tonic-gate  *	pg. 5-28 table 5-32.
171*0Sstevel@tonic-gate  *
172*0Sstevel@tonic-gate  * The description of this table uses various voltage and current units.
173*0Sstevel@tonic-gate  *	This table contains all currents in nanoAMPS and all voltages
174*0Sstevel@tonic-gate  *	in microVOLTS.
175*0Sstevel@tonic-gate  *
176*0Sstevel@tonic-gate  * Note if you're doing a current table lookup, you need to multiply
177*0Sstevel@tonic-gate  *	the lookup value by ten.
178*0Sstevel@tonic-gate  */
179*0Sstevel@tonic-gate uint32_t cistpl_pd_exp[] = {
180*0Sstevel@tonic-gate     10,		/* 10 microVOLTS, 100 nanoAMPS */
181*0Sstevel@tonic-gate     100,	/* 100 microVOLTS, 1000 nanoAMPS */
182*0Sstevel@tonic-gate     1000,	/* 1000 microVOLTS, 10000 nanoAMPS */
183*0Sstevel@tonic-gate     10000,	/* 10000 microVOLTS, 100000 nanoAMPS */
184*0Sstevel@tonic-gate     100000,	/* 100000 microVOLTS, 1000000 nanoAMPS */
185*0Sstevel@tonic-gate     1000000,	/* 1000000 microVOLTS, 10000000 nanoAMPS */
186*0Sstevel@tonic-gate     10000000,	/* 10000000 microVOLTS, 100000000 nanoAMPS */
187*0Sstevel@tonic-gate     100000000	/* 100000000 microVOLTS, 1000000000 nanoAMPS */
188*0Sstevel@tonic-gate };
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate /*
191*0Sstevel@tonic-gate  * Fill out the structure pointers.
192*0Sstevel@tonic-gate  */
193*0Sstevel@tonic-gate cistpl_devspeed_struct_t cistpl_devspeed_struct = {
194*0Sstevel@tonic-gate 	cistpl_devspeed_table,
195*0Sstevel@tonic-gate 	cistpl_exspeed_tenfac,
196*0Sstevel@tonic-gate 	cistpl_devspeed_man,
197*0Sstevel@tonic-gate 	cistpl_devspeed_exp,
198*0Sstevel@tonic-gate };
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate cistpl_pd_struct_t cistpl_pd_struct = {
201*0Sstevel@tonic-gate 	cistpl_pd_man,
202*0Sstevel@tonic-gate 	cistpl_pd_exp,
203*0Sstevel@tonic-gate };
204*0Sstevel@tonic-gate 
205*0Sstevel@tonic-gate /*
206*0Sstevel@tonic-gate  * Some handy lookup tables that should probably eventually be
207*0Sstevel@tonic-gate  *	done away with.
208*0Sstevel@tonic-gate  *
209*0Sstevel@tonic-gate  * These are used mostly by the CISTPL_CFTABLE_ENTRY tuple handler.
210*0Sstevel@tonic-gate  */
211*0Sstevel@tonic-gate uint32_t cistpl_cftable_io_size_table[] = {
212*0Sstevel@tonic-gate 	0,
213*0Sstevel@tonic-gate 	1,
214*0Sstevel@tonic-gate 	2,
215*0Sstevel@tonic-gate 	4,
216*0Sstevel@tonic-gate };
217*0Sstevel@tonic-gate 
218*0Sstevel@tonic-gate uint32_t cistpl_cftable_shift_table[] = {
219*0Sstevel@tonic-gate 	0,
220*0Sstevel@tonic-gate 	8,
221*0Sstevel@tonic-gate 	16,
222*0Sstevel@tonic-gate 	24,
223*0Sstevel@tonic-gate };
224*0Sstevel@tonic-gate 
225*0Sstevel@tonic-gate /*
226*0Sstevel@tonic-gate  * List of tuples in the global CIS to ignore if they show
227*0Sstevel@tonic-gate  *	up in both the global and function-specific CIS lists.
228*0Sstevel@tonic-gate  * This list MUST end with CISTPL_NULL.
229*0Sstevel@tonic-gate  */
230*0Sstevel@tonic-gate cistpl_ignore_list_t cistpl_ignore_list[] = {
231*0Sstevel@tonic-gate 	CISTPL_FUNCID,
232*0Sstevel@tonic-gate 	CISTPL_FUNCE,
233*0Sstevel@tonic-gate 	CISTPL_CONFIG,
234*0Sstevel@tonic-gate 	CISTPL_CFTABLE_ENTRY,
235*0Sstevel@tonic-gate 	CISTPL_NULL	/* list must end with CISTPL_NULL */
236*0Sstevel@tonic-gate };
237