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