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