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-2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _CIS_HANDLERS_H
28*7c478bd9Sstevel@tonic-gate #define	_CIS_HANDLERS_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * This is the CIS tuple handler header file.
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * Each tuple that we recognize and are prepared to handle is assigned a
40*7c478bd9Sstevel@tonic-gate  *	cistpl_callout_t structure.  This lets us specify a handler for
41*7c478bd9Sstevel@tonic-gate  *	this tuple, as well as flags that describe this tuple and which
42*7c478bd9Sstevel@tonic-gate  *	are used by the CIS interpreter and tuple parser.
43*7c478bd9Sstevel@tonic-gate  */
44*7c478bd9Sstevel@tonic-gate typedef struct cistpl_callout_t {
45*7c478bd9Sstevel@tonic-gate     cisdata_t	type;		/* type of tuple */
46*7c478bd9Sstevel@tonic-gate     cisdata_t	subtype;	/* only used for CISTPL_FUNCE */
47*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* misc flags */
48*7c478bd9Sstevel@tonic-gate     uint32_t	(*handler)();	/* tuple handler */
49*7c478bd9Sstevel@tonic-gate     char	*text;		/* name of tuple */
50*7c478bd9Sstevel@tonic-gate } cistpl_callout_t;
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * Flags that are used by a tuple handler to specify what action it
54*7c478bd9Sstevel@tonic-gate  *	should perform.
55*7c478bd9Sstevel@tonic-gate  */
56*7c478bd9Sstevel@tonic-gate #define	HANDTPL_NOERROR		0x000000000 /* no error */
57*7c478bd9Sstevel@tonic-gate #define	HANDTPL_SET_FLAGS	0x000000001 /* set tuple flags */
58*7c478bd9Sstevel@tonic-gate #define	HANDTPL_COPY_DONE	0x000000002 /* tuple data copy is done */
59*7c478bd9Sstevel@tonic-gate #define	HANDTPL_PARSE_LTUPLE	0x000000004 /* parse tuple, return opt data */
60*7c478bd9Sstevel@tonic-gate #define	HANDTPL_RETURN_NAME	0x000000008 /* return tuple name string */
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate /*
63*7c478bd9Sstevel@tonic-gate  * This flag is returned by tuple handlers if they encounter an error. It
64*7c478bd9Sstevel@tonic-gate  *	is returned by cis_list_lcreate if any of the tuple handlers have
65*7c478bd9Sstevel@tonic-gate  *	return an error while processing the CIS.
66*7c478bd9Sstevel@tonic-gate  *
67*7c478bd9Sstevel@tonic-gate  * Note that the following bit is reserved:
68*7c478bd9Sstevel@tonic-gate  *		#define	BAD_CIS_ADDR	0x080000000
69*7c478bd9Sstevel@tonic-gate  *	It appears in cis.h and is used to indicate that cis_list_create
70*7c478bd9Sstevel@tonic-gate  *	tried to read past the end of the mapped in CIS space.
71*7c478bd9Sstevel@tonic-gate  */
72*7c478bd9Sstevel@tonic-gate #define	HANDTPL_ERROR		0x001000000 /* handler returned an error */
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate /*
75*7c478bd9Sstevel@tonic-gate  * General-use constants and macros that aren't specific to a tuple.
76*7c478bd9Sstevel@tonic-gate  */
77*7c478bd9Sstevel@tonic-gate #define	CISTPL_EXT_BIT	0x080		/* additional extension bytes follow */
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate /*
80*7c478bd9Sstevel@tonic-gate  * Constants, macros and structures used by cistpl_devspeed and
81*7c478bd9Sstevel@tonic-gate  *	cis_convert_devspeed functions.
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_TABLE	0x000000001 /* use the device speed table */
84*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_EXT	0x000000002 /* use the extended speed table */
85*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_MAX_TBL	8 		/* max devspeed table entries */
86*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_MAX_EXP	8		/* max exponent entries */
87*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_MAX_MAN	16		/* max mantissa entries */
88*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_TBL(t)	cistpl_devspeed_struct.table[(t) &	\
89*7c478bd9Sstevel@tonic-gate 						(CISTPL_DEVSPEED_MAX_TBL - 1)]
90*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_MAN(m)	cistpl_devspeed_struct.mantissa[(m) &	\
91*7c478bd9Sstevel@tonic-gate 						(CISTPL_DEVSPEED_MAX_MAN - 1)]
92*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVSPEED_EXP(e)	cistpl_devspeed_struct.exponent[(e) &	\
93*7c478bd9Sstevel@tonic-gate 						(CISTPL_DEVSPEED_MAX_EXP - 1)]
94*7c478bd9Sstevel@tonic-gate typedef struct cistpl_devspeed_struct_t {
95*7c478bd9Sstevel@tonic-gate 	uint32_t	*table;
96*7c478bd9Sstevel@tonic-gate 	uint32_t	*tenfac;
97*7c478bd9Sstevel@tonic-gate 	uint32_t	*mantissa;
98*7c478bd9Sstevel@tonic-gate 	uint32_t	*exponent;
99*7c478bd9Sstevel@tonic-gate } cistpl_devspeed_struct_t;
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate /*
102*7c478bd9Sstevel@tonic-gate  * Constants, flags and structure typedefs that are used by specific tuples.
103*7c478bd9Sstevel@tonic-gate  *
104*7c478bd9Sstevel@tonic-gate  * CISTPL_DEVICE, CISTPL_DEVICE_A, CISTPL_DEVICE_OC and CISTPL_DEVICE_OA
105*7c478bd9Sstevel@tonic-gate  */
106*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_NULL	0x00	/* a NULL device (hole) */
107*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_ROM		0x01	/* device is of type ROM */
108*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_OTPROM	0x02	/* device is of type OTPROM */
109*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_EPROM	0x03	/* device is of type EPROM */
110*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_EEPROM	0x04	/* device is of type EEPROM */
111*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_FLASH	0x05	/* device is of type FLASH */
112*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_SRAM	0x06	/* device is of type SRAM */
113*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_DRAM	0x07	/* device is of type DRAM */
114*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_8	0x08	/* reserved */
115*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_9	0x09	/* reserved */
116*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_a	0x0a	/* reserved */
117*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_b	0x0b	/* reserved */
118*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_c	0x0c	/* reserved */
119*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_FUNCSPEC	0x0d	/* device is of type FUNCSPEC */
120*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_EXTEND	0x0e	/* device is of type extended */
121*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_DTYPE_RSVD_f	0x0f	/* reserved */
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate /*
124*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_device_node_t->flags member for CISTPL_DEVICE
125*7c478bd9Sstevel@tonic-gate  *	and CISTPL_DEVICE_A tuples
126*7c478bd9Sstevel@tonic-gate  */
127*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_WPS		0x00000001	/* WPS bit is set */
128*7c478bd9Sstevel@tonic-gate /*
129*7c478bd9Sstevel@tonic-gate  * Flags and values for cistpl_device_node_t->flags member for
130*7c478bd9Sstevel@tonic-gate  *	CISTPL_DEVICE_OC and CISTPL_DEVICE_OA tuples
131*7c478bd9Sstevel@tonic-gate  */
132*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_MWAIT		0x00010000	/* use MWAIT */
133*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_Vcc_MASK	0x00060000	/* mask for Vcc value */
134*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_Vcc5		0x00000000	/* 5.0 volt operation */
135*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_Vcc33		0x00020000	/* 3.3 volt operation */
136*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_VccXX		0x00040000	/* X.X volt operation */
137*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_OC_VccYY		0x00060000	/* Y.Y volt operation */
138*7c478bd9Sstevel@tonic-gate /*
139*7c478bd9Sstevel@tonic-gate  * CISTPL_DEVICE_MAX_DEVICES defines the maximum number of devices that
140*7c478bd9Sstevel@tonic-gate  *	we can parse in a CISTPL_DEVICE{...} tuple
141*7c478bd9Sstevel@tonic-gate  */
142*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_MAX_DEVICES	10
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate /*
145*7c478bd9Sstevel@tonic-gate  * CISTPL_DEVICE_SPEED_SIZE_IGNORE if the device speed is set to this, then
146*7c478bd9Sstevel@tonic-gate  *	ignore the speed and size values
147*7c478bd9Sstevel@tonic-gate  */
148*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICE_SPEED_SIZE_IGNORE	0x0ff	/* ignore size and speed info */
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate typedef struct cistpl_device_node_t {
151*7c478bd9Sstevel@tonic-gate 	uint32_t	flags;	/* flags specific to this device */
152*7c478bd9Sstevel@tonic-gate 	uint32_t	speed;	/* device speed in device speed code format */
153*7c478bd9Sstevel@tonic-gate 	uint32_t	nS_speed; /* device speed in nS */
154*7c478bd9Sstevel@tonic-gate 	uint32_t	type;	/* device type */
155*7c478bd9Sstevel@tonic-gate 	uint32_t	size;	/* device size */
156*7c478bd9Sstevel@tonic-gate 	uint32_t	size_in_bytes; /* device size in bytes */
157*7c478bd9Sstevel@tonic-gate } cistpl_device_node_t;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate typedef struct cistpl_device_t {
160*7c478bd9Sstevel@tonic-gate 	uint32_t		num_devices; /* number of devices found */
161*7c478bd9Sstevel@tonic-gate 	cistpl_device_node_t	devnode[CISTPL_DEVICE_MAX_DEVICES];
162*7c478bd9Sstevel@tonic-gate } cistpl_device_t;
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate /*
165*7c478bd9Sstevel@tonic-gate  * CISTPL_CONFIG
166*7c478bd9Sstevel@tonic-gate  */
167*7c478bd9Sstevel@tonic-gate #define	MAKE_CONFIG_REG_ADDR(base, reg)	(base + (reg * 2))
168*7c478bd9Sstevel@tonic-gate #define	CISTPL_CONFIG_MAX_CONFIG_REGS	128 /* max num config regs */
169*7c478bd9Sstevel@tonic-gate typedef struct cistpl_config_t {
170*7c478bd9Sstevel@tonic-gate     uint32_t	present;	/* register present flags */
171*7c478bd9Sstevel@tonic-gate     uint32_t	nr;		/* number of config registers found */
172*7c478bd9Sstevel@tonic-gate     uint32_t	hr;		/* highest config register index found */
173*7c478bd9Sstevel@tonic-gate     uint32_t	regs[CISTPL_CONFIG_MAX_CONFIG_REGS];	/* reg offsets */
174*7c478bd9Sstevel@tonic-gate     uint32_t	base;		/* base offset of config registers */
175*7c478bd9Sstevel@tonic-gate     uint32_t	last;		/* last config index */
176*7c478bd9Sstevel@tonic-gate } cistpl_config_t;
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate /*
179*7c478bd9Sstevel@tonic-gate  * CISTPL_VERS_1
180*7c478bd9Sstevel@tonic-gate  */
181*7c478bd9Sstevel@tonic-gate #define	CISTPL_VERS_1_MAX_PROD_STRINGS	4 /* max number product strings */
182*7c478bd9Sstevel@tonic-gate typedef struct cistpl_vers_1_t {
183*7c478bd9Sstevel@tonic-gate     uint32_t	major;		/* major version number */
184*7c478bd9Sstevel@tonic-gate     uint32_t	minor;		/* minor version number */
185*7c478bd9Sstevel@tonic-gate     uint32_t	ns;		/* number of information strings */
186*7c478bd9Sstevel@tonic-gate 				/* pointers to product information strings */
187*7c478bd9Sstevel@tonic-gate     char	pi[CISTPL_VERS_1_MAX_PROD_STRINGS][CIS_MAX_TUPLE_DATA_LEN];
188*7c478bd9Sstevel@tonic-gate } cistpl_vers_1_t;
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate /*
191*7c478bd9Sstevel@tonic-gate  * CISTPL_VERS_2
192*7c478bd9Sstevel@tonic-gate  */
193*7c478bd9Sstevel@tonic-gate typedef struct cistpl_vers_2_t {
194*7c478bd9Sstevel@tonic-gate     uint32_t	vers;		/* version number */
195*7c478bd9Sstevel@tonic-gate     uint32_t	comply;		/* level of compliance */
196*7c478bd9Sstevel@tonic-gate     uint32_t	dindex;		/* byte address of first data byte in card */
197*7c478bd9Sstevel@tonic-gate     uint32_t	reserved;	/* two reserved bytes */
198*7c478bd9Sstevel@tonic-gate     uint32_t	vspec8;		/* vendor specific (byte 8) */
199*7c478bd9Sstevel@tonic-gate     uint32_t	vspec9;		/* vendor specific (byte 9) */
200*7c478bd9Sstevel@tonic-gate     uint32_t	nhdr;		/* number of copies of CIS present on device */
201*7c478bd9Sstevel@tonic-gate     char	oem[CIS_MAX_TUPLE_DATA_LEN];	/* Vendor of software that */
202*7c478bd9Sstevel@tonic-gate 							/* formatted card */
203*7c478bd9Sstevel@tonic-gate     char	info[CIS_MAX_TUPLE_DATA_LEN];	/* Informational message */
204*7c478bd9Sstevel@tonic-gate 							/* about card */
205*7c478bd9Sstevel@tonic-gate } cistpl_vers_2_t;
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate /*
208*7c478bd9Sstevel@tonic-gate  * CISTPL_JEDEC_A and CISTPL_JEDEC_C
209*7c478bd9Sstevel@tonic-gate  */
210*7c478bd9Sstevel@tonic-gate #define	CISTPL_JEDEC_MAX_IDENTIFIERS	4
211*7c478bd9Sstevel@tonic-gate typedef struct jedec_ident_t {
212*7c478bd9Sstevel@tonic-gate 	uint32_t	id;	/* manufacturer id */
213*7c478bd9Sstevel@tonic-gate 	uint32_t	info;	/* manufacturer specific info */
214*7c478bd9Sstevel@tonic-gate } jedec_ident_t;
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate typedef struct cistpl_jedec_t {
217*7c478bd9Sstevel@tonic-gate 	uint32_t	nid;		/* # of JEDEC identifiers present */
218*7c478bd9Sstevel@tonic-gate 	jedec_ident_t	jid[CISTPL_JEDEC_MAX_IDENTIFIERS];
219*7c478bd9Sstevel@tonic-gate } cistpl_jedec_t;
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate /*
222*7c478bd9Sstevel@tonic-gate  * CISTPL_FORMAT and CISTPL_FORMAT_A
223*7c478bd9Sstevel@tonic-gate  *
224*7c478bd9Sstevel@tonic-gate  * These tuples describe the data recording format for a region.
225*7c478bd9Sstevel@tonic-gate  */
226*7c478bd9Sstevel@tonic-gate typedef struct cistpl_format_t {
227*7c478bd9Sstevel@tonic-gate 	uint32_t	type;	/* format type code */
228*7c478bd9Sstevel@tonic-gate 	uint32_t	edc_length; /* error detection code length */
229*7c478bd9Sstevel@tonic-gate 	uint32_t	edc_type; /* error detection code type */
230*7c478bd9Sstevel@tonic-gate 	uint32_t	offset;	/* offset of first byte of data in this part */
231*7c478bd9Sstevel@tonic-gate 	uint32_t	nbytes;	/* number of bytes of data in this partition */
232*7c478bd9Sstevel@tonic-gate 	union {
233*7c478bd9Sstevel@tonic-gate 		struct disk {
234*7c478bd9Sstevel@tonic-gate 		    uint32_t	bksize; /* block size */
235*7c478bd9Sstevel@tonic-gate 		    uint32_t	nblocks; /* nblocks data for disk-like device */
236*7c478bd9Sstevel@tonic-gate 		    uint32_t	edcloc; /* location of error detection code */
237*7c478bd9Sstevel@tonic-gate 		} disk;
238*7c478bd9Sstevel@tonic-gate 		struct mem {
239*7c478bd9Sstevel@tonic-gate 		    uint32_t	flags; /* various flags */
240*7c478bd9Sstevel@tonic-gate 		    uint32_t	reserved; /* reserved byte */
241*7c478bd9Sstevel@tonic-gate 		    caddr_t	address; /* physical addr for mem-like device */
242*7c478bd9Sstevel@tonic-gate 		    uint32_t	edcloc; /* location of error detection code */
243*7c478bd9Sstevel@tonic-gate 		} mem;
244*7c478bd9Sstevel@tonic-gate 	} dev;
245*7c478bd9Sstevel@tonic-gate } cistpl_format_t;
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate /*
248*7c478bd9Sstevel@tonic-gate  * device format types
249*7c478bd9Sstevel@tonic-gate  */
250*7c478bd9Sstevel@tonic-gate #define	TPLFMTTYPE_DISK	0x00	/* disk-like format */
251*7c478bd9Sstevel@tonic-gate #define	TPLFMTTYPE_MEM	0x01	/* memory-like format */
252*7c478bd9Sstevel@tonic-gate #define	TPLFMTTYPE_VS	0x80	/* vendor specific format */
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate /*
255*7c478bd9Sstevel@tonic-gate  * error detection code types
256*7c478bd9Sstevel@tonic-gate  */
257*7c478bd9Sstevel@tonic-gate #define	TPLFMTEDC_NONE	0x00	/* no error detection code */
258*7c478bd9Sstevel@tonic-gate #define	TPLFMTEDC_CKSUM	0x01	/* arithmetic checksum is used */
259*7c478bd9Sstevel@tonic-gate #define	TPLFMTEDC_CRC	0x02	/* 16-bit CRC */
260*7c478bd9Sstevel@tonic-gate #define	TPLFMTEDC_PCC	0x03	/* whole-partition arithmetic checksum */
261*7c478bd9Sstevel@tonic-gate #define	TPLFMTEDC_VS	0x80	/* vendor specific error checking */
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate #define	EDC_LENGTH_MASK	0x07
264*7c478bd9Sstevel@tonic-gate #define	EDC_TYPE_MASK   0x0f
265*7c478bd9Sstevel@tonic-gate #define	EDC_TYPE_SHIFT	3
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate /*
268*7c478bd9Sstevel@tonic-gate  * flags for memory-like devices
269*7c478bd9Sstevel@tonic-gate  */
270*7c478bd9Sstevel@tonic-gate #define	TPLFMTFLAGS_ADDR	0x01	/* address is valid */
271*7c478bd9Sstevel@tonic-gate #define	TPLFMTFLAGS_AUTO	0x02	/* automatically map memory region */
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate /*
274*7c478bd9Sstevel@tonic-gate  * CISTPL_GEOMETRY
275*7c478bd9Sstevel@tonic-gate  */
276*7c478bd9Sstevel@tonic-gate typedef struct cistpl_geometry_t {
277*7c478bd9Sstevel@tonic-gate 	uint32_t	spt;
278*7c478bd9Sstevel@tonic-gate 	uint32_t	tpc;
279*7c478bd9Sstevel@tonic-gate 	uint32_t	ncyl;
280*7c478bd9Sstevel@tonic-gate } cistpl_geometry_t;
281*7c478bd9Sstevel@tonic-gate 
282*7c478bd9Sstevel@tonic-gate /*
283*7c478bd9Sstevel@tonic-gate  * CISTPL_BYTEORDER
284*7c478bd9Sstevel@tonic-gate  */
285*7c478bd9Sstevel@tonic-gate typedef struct cistpl_byteorder_t {
286*7c478bd9Sstevel@tonic-gate 	uint32_t	order;		/* byte order code */
287*7c478bd9Sstevel@tonic-gate 	uint32_t	map;		/* byte mapping code */
288*7c478bd9Sstevel@tonic-gate } cistpl_byteorder_t;
289*7c478bd9Sstevel@tonic-gate 
290*7c478bd9Sstevel@tonic-gate /*
291*7c478bd9Sstevel@tonic-gate  * byte order and mapping codes
292*7c478bd9Sstevel@tonic-gate  */
293*7c478bd9Sstevel@tonic-gate #define	TPLBYTEORD_LOW	0x00	/* specifies little endian order */
294*7c478bd9Sstevel@tonic-gate #define	TPLBYTEORD_HIGH	0x01	/* specifies big endian order */
295*7c478bd9Sstevel@tonic-gate #define	TPLBYTEORD_VS	0x80	/* vendor specific order 0x80-0xFF */
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate #define	TPLBYTEMAP_LOW	0x00	/* byte zero is least significant byte */
298*7c478bd9Sstevel@tonic-gate #define	TPLBYTEMAP_HIGH	0x01	/* byte zero is most significant byte */
299*7c478bd9Sstevel@tonic-gate #define	TPLBYTEMAP_VS	0x80	/* vendor specific mapping */
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate /*
302*7c478bd9Sstevel@tonic-gate  * CISTPL_DATE
303*7c478bd9Sstevel@tonic-gate  */
304*7c478bd9Sstevel@tonic-gate typedef struct cistpl_date_t {
305*7c478bd9Sstevel@tonic-gate 	uint32_t	time;
306*7c478bd9Sstevel@tonic-gate 	uint32_t	day;
307*7c478bd9Sstevel@tonic-gate } cistpl_date_t;
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate /*
310*7c478bd9Sstevel@tonic-gate  * CISTPL_BATTERY
311*7c478bd9Sstevel@tonic-gate  */
312*7c478bd9Sstevel@tonic-gate typedef struct cistpl_battery_t {
313*7c478bd9Sstevel@tonic-gate 	uint32_t	rday;		/* replacement date */
314*7c478bd9Sstevel@tonic-gate 	uint32_t	xday;		/* expiration date */
315*7c478bd9Sstevel@tonic-gate } cistpl_battery_t;
316*7c478bd9Sstevel@tonic-gate 
317*7c478bd9Sstevel@tonic-gate /*
318*7c478bd9Sstevel@tonic-gate  * CISTPL_ORG
319*7c478bd9Sstevel@tonic-gate  */
320*7c478bd9Sstevel@tonic-gate typedef struct cistpl_org_t {
321*7c478bd9Sstevel@tonic-gate 	uint32_t	type;		/* data organization code */
322*7c478bd9Sstevel@tonic-gate 	char	desc[CIS_MAX_TUPLE_DATA_LEN];	/* text description of */
323*7c478bd9Sstevel@tonic-gate 						/* this organization */
324*7c478bd9Sstevel@tonic-gate } cistpl_org_t;
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate /*
327*7c478bd9Sstevel@tonic-gate  * CISTPL_MANFID
328*7c478bd9Sstevel@tonic-gate  */
329*7c478bd9Sstevel@tonic-gate typedef struct cistpl_manfid_t {
330*7c478bd9Sstevel@tonic-gate 	uint32_t	manf;		/* PCMCIA PC Card manufacturer code */
331*7c478bd9Sstevel@tonic-gate 	uint32_t	card;		/* manufacturer information */
332*7c478bd9Sstevel@tonic-gate } cistpl_manfid_t;
333*7c478bd9Sstevel@tonic-gate 
334*7c478bd9Sstevel@tonic-gate /*
335*7c478bd9Sstevel@tonic-gate  * CISTPL_FUNCID
336*7c478bd9Sstevel@tonic-gate  */
337*7c478bd9Sstevel@tonic-gate typedef struct cistpl_funcid_t {
338*7c478bd9Sstevel@tonic-gate 	uint32_t	function;		/* PC Card function code */
339*7c478bd9Sstevel@tonic-gate 	uint32_t	sysinit;		/* system initialization mask */
340*7c478bd9Sstevel@tonic-gate } cistpl_funcid_t;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate /*
343*7c478bd9Sstevel@tonic-gate  * Function types for CISTPL_FUNCID; note that the TPLFUNC_UNKNOWN is
344*7c478bd9Sstevel@tonic-gate  *	not defined by the PCMCIA standard.
345*7c478bd9Sstevel@tonic-gate  *
346*7c478bd9Sstevel@tonic-gate  * Definitions for cistpl_funcid_t->function
347*7c478bd9Sstevel@tonic-gate  */
348*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_MULTI		0x000	/* vendor-specific multifunction card */
349*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_MEMORY		0x001	/* memory card */
350*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_SERIAL		0x002	/* serial I/O port */
351*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_PARALLEL	0x003	/* parallel printer port */
352*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_FIXED		0x004	/* fixed disk, silicon or removeable */
353*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_VIDEO		0x005	/* video interface */
354*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_LAN		0x006	/* Local Area Network adapter */
355*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_AIMS		0x007	/* Auto Incrementing Mass Storage */
356*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_SCSI		0x008	/* SCSI bridge */
357*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_SECURITY	0x009	/* Security Cards */
358*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_VENDOR_SPECIFIC	0x0fe	/* Vendor Specific */
359*7c478bd9Sstevel@tonic-gate #define	TPLFUNC_UNKNOWN		0x0ff	/* unknown function(s) */
360*7c478bd9Sstevel@tonic-gate /*
361*7c478bd9Sstevel@tonic-gate  * Definitions for cistpl_funcid_t->sysinit
362*7c478bd9Sstevel@tonic-gate  */
363*7c478bd9Sstevel@tonic-gate #define	TPLINIT_POST		0x01	/* POST should attempt configure */
364*7c478bd9Sstevel@tonic-gate #define	TPLINIT_ROM		0x02	/* map ROM during sys init */
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate /*
367*7c478bd9Sstevel@tonic-gate  * CISTPL_FUNCE
368*7c478bd9Sstevel@tonic-gate  */
369*7c478bd9Sstevel@tonic-gate typedef struct cistpl_funce_t {
370*7c478bd9Sstevel@tonic-gate 	uint32_t	function;		/* type of extended data */
371*7c478bd9Sstevel@tonic-gate 	uint32_t	subfunction;
372*7c478bd9Sstevel@tonic-gate 	union {
373*7c478bd9Sstevel@tonic-gate 		struct serial {
374*7c478bd9Sstevel@tonic-gate 			uint32_t ua;	/* UART in use */
375*7c478bd9Sstevel@tonic-gate 			uint32_t uc;	/* UART capabilities */
376*7c478bd9Sstevel@tonic-gate 		} serial;
377*7c478bd9Sstevel@tonic-gate 		struct modem {
378*7c478bd9Sstevel@tonic-gate 			uint32_t fc;	/* supported flow control methods */
379*7c478bd9Sstevel@tonic-gate 			uint32_t cb;	/* size of DCE command buffer */
380*7c478bd9Sstevel@tonic-gate 			uint32_t eb;	/* size of DCE to DCE buffer */
381*7c478bd9Sstevel@tonic-gate 			uint32_t tb;	/* size of DTE to DCE buffer */
382*7c478bd9Sstevel@tonic-gate 		} modem;
383*7c478bd9Sstevel@tonic-gate 		struct data_modem {
384*7c478bd9Sstevel@tonic-gate 			uint32_t ud;	/* highest data rate */
385*7c478bd9Sstevel@tonic-gate 			uint32_t ms;	/* modulation standards */
386*7c478bd9Sstevel@tonic-gate 			/* err correct proto and non-CCITT modulation */
387*7c478bd9Sstevel@tonic-gate 			uint32_t em;
388*7c478bd9Sstevel@tonic-gate 			uint32_t dc;	/* data compression protocols */
389*7c478bd9Sstevel@tonic-gate 			uint32_t cm;	/* command protocols */
390*7c478bd9Sstevel@tonic-gate 			uint32_t ex;	/* escape mechanisms */
391*7c478bd9Sstevel@tonic-gate 			uint32_t dy;	/* standardized data encryption */
392*7c478bd9Sstevel@tonic-gate 			uint32_t ef;	/* misc. end user features */
393*7c478bd9Sstevel@tonic-gate 			uint32_t ncd;	/* number of country codes */
394*7c478bd9Sstevel@tonic-gate 			uchar_t cd[16];	/* CCITT country code */
395*7c478bd9Sstevel@tonic-gate 		} data_modem;
396*7c478bd9Sstevel@tonic-gate 		struct fax {
397*7c478bd9Sstevel@tonic-gate 			uint32_t uf;	/* highest data rate in DTE/UART */
398*7c478bd9Sstevel@tonic-gate 			uint32_t fm;	/* CCITT modulation standards */
399*7c478bd9Sstevel@tonic-gate 			uint32_t fy;	/* standardized data encryption */
400*7c478bd9Sstevel@tonic-gate 			uint32_t fs;	/* feature selection */
401*7c478bd9Sstevel@tonic-gate 			uint32_t ncf; /* number of country codes */
402*7c478bd9Sstevel@tonic-gate 			uchar_t cf[16];	/* CCITT country codes */
403*7c478bd9Sstevel@tonic-gate 		} fax;
404*7c478bd9Sstevel@tonic-gate 		struct voice {
405*7c478bd9Sstevel@tonic-gate 			uint32_t uv;	/* highest data rate */
406*7c478bd9Sstevel@tonic-gate 			uint32_t nsr;
407*7c478bd9Sstevel@tonic-gate 			uint32_t sr[16]; /* voice sampling rates (*100) */
408*7c478bd9Sstevel@tonic-gate 			uint32_t nss;
409*7c478bd9Sstevel@tonic-gate 			uint32_t ss[16]; /* voice sample sizes (*10) */
410*7c478bd9Sstevel@tonic-gate 			uint32_t nsc;
411*7c478bd9Sstevel@tonic-gate 			uint32_t sc[16]; /* voice compression methods */
412*7c478bd9Sstevel@tonic-gate 		} voice;
413*7c478bd9Sstevel@tonic-gate 		struct lan {
414*7c478bd9Sstevel@tonic-gate 			uint32_t tech; /* network technology */
415*7c478bd9Sstevel@tonic-gate 			uint32_t speed; /* media bit or baud rate */
416*7c478bd9Sstevel@tonic-gate 			uint32_t media; /* network media supported */
417*7c478bd9Sstevel@tonic-gate 			uint32_t con; /* open/closed connector standard */
418*7c478bd9Sstevel@tonic-gate 			uint32_t id_sz; /* length of lan station id */
419*7c478bd9Sstevel@tonic-gate 			uchar_t id[16]; /* station ID */
420*7c478bd9Sstevel@tonic-gate 		} lan;
421*7c478bd9Sstevel@tonic-gate 	}   data;
422*7c478bd9Sstevel@tonic-gate } cistpl_funce_t;
423*7c478bd9Sstevel@tonic-gate 
424*7c478bd9Sstevel@tonic-gate /* serial port subfunctions */
425*7c478bd9Sstevel@tonic-gate #define	TPLFE_SUB_SERIAL	0 /* serial port */
426*7c478bd9Sstevel@tonic-gate #define	TPLFE_SUB_MODEM_COMMON	1 /* common modem interface */
427*7c478bd9Sstevel@tonic-gate #define	TPLFE_SUB_MODEM_DATA	2 /* data modem services */
428*7c478bd9Sstevel@tonic-gate #define	TPLFE_SUB_MODEM_FAX	3 /* fax modem services */
429*7c478bd9Sstevel@tonic-gate #define	TPLFE_SUB_VOICE		4 /* voice services */
430*7c478bd9Sstevel@tonic-gate /* modem subfunctions for description of capabilities */
431*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_MODEM_DATA	5 /* data modem capabilities */
432*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_MODEM_FAX	6 /* fax modem capabilities */
433*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_MODEM_VOICE	7 /* voice modem capabilities */
434*7c478bd9Sstevel@tonic-gate /* serial port subfunctions for description of capabilities */
435*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_SERIAL_DATA	8 /* serial port capabilities - data modem */
436*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_SERIAL_FAX	9 /* serial port capabilities - fax modem */
437*7c478bd9Sstevel@tonic-gate #define	TPLFE_CAP_SERIAL_VOICE 10 /* serial port capabilities - voice */
438*7c478bd9Sstevel@tonic-gate 
439*7c478bd9Sstevel@tonic-gate /* serial port UART definitions */
440*7c478bd9Sstevel@tonic-gate #define	TPLFE_UA_8250		0 /* Intel 8250 */
441*7c478bd9Sstevel@tonic-gate #define	TPLFE_UA_16450		1 /* NS 16450 */
442*7c478bd9Sstevel@tonic-gate #define	TPLFE_UA_16550		2 /* NS 16550 */
443*7c478bd9Sstevel@tonic-gate 
444*7c478bd9Sstevel@tonic-gate /* serial port capabilities definitions */
445*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_PARITY_SPACE	0x0001 /* space parity supported */
446*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_PARITY_MARK	0x0002 /* mark parity supported */
447*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_PARITY_ODD	0x0004 /* odd parity supported */
448*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_PARITY_EVEN	0x0008 /* even parity supported */
449*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_CS5		0x0100 /* 5 bit characters supported */
450*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_CS6		0x0200 /* 6 bit characters supported */
451*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_CS7		0x0400 /* 7 bit characters supported */
452*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_CS8		0x0800 /* 8 bit characters supported */
453*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_STOP_1		0x1000 /* 1 stop bit supported */
454*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_STOP_15	0x2000 /* 1.5 stop bits supported */
455*7c478bd9Sstevel@tonic-gate #define	TPLFE_UC_STOP_2		0x4000 /* 2 stop bits supported */
456*7c478bd9Sstevel@tonic-gate 
457*7c478bd9Sstevel@tonic-gate /* modem flow control methods */
458*7c478bd9Sstevel@tonic-gate #define	TPLFE_FC_TX_XONOFF	0x01 /* transmit XON/XOFF */
459*7c478bd9Sstevel@tonic-gate #define	TPLFE_FC_RX_XONOFF	0x02 /* receiver XON/XOFF */
460*7c478bd9Sstevel@tonic-gate #define	TPLFE_FC_TX_HW		0x04 /* transmit hardware flow control (CTS) */
461*7c478bd9Sstevel@tonic-gate #define	TPLFE_FC_RX_HW		0x08 /* receiver hardware flow control (RTS) */
462*7c478bd9Sstevel@tonic-gate #define	TPLFE_FC_TRANS		0x10 /* tranparent flow control */
463*7c478bd9Sstevel@tonic-gate 
464*7c478bd9Sstevel@tonic-gate /* modem modulation standards */
465*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_BELL103	0x0001 /* 300bps */
466*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V21		0x0002 /* 300bps (V.21) */
467*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V23		0x0004 /* 600/1200bps (V.23) */
468*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V22AB		0x0008 /* 1200bps (V.22A V.22B) */
469*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_BELL212	0x0010 /* 2400bsp (US Bell 212) */
470*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V22BIS		0x0020 /* 2400bps (V.22bis) */
471*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V26		0x0040 /* 2400bps leased line (V.26) */
472*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V26BIS		0x0080 /* 2400bps (V.26bis) */
473*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V27BIS		0x0100 /* 4800/2400bps leased line (V.27bis) */
474*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V29		0x0200 /* 9600/7200/4800 leased line (V.29) */
475*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V32		0x0400 /* up to 9600bps (V.32) */
476*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_V32BIS		0x0800 /* up to 14400bps (V.32bis) */
477*7c478bd9Sstevel@tonic-gate #define	TPLFE_MS_VFAST		0x1000 /* up to 28800 V.FAST */
478*7c478bd9Sstevel@tonic-gate 
479*7c478bd9Sstevel@tonic-gate /* modem error correction/detection protocols */
480*7c478bd9Sstevel@tonic-gate #define	TPLFE_EM_MNP		0x01 /* MNP levels 2-4 */
481*7c478bd9Sstevel@tonic-gate #define	TPLFE_EM_V42		0x02 /* CCITT LAPM (V.42) */
482*7c478bd9Sstevel@tonic-gate 
483*7c478bd9Sstevel@tonic-gate /* modem data compression protocols */
484*7c478bd9Sstevel@tonic-gate #define	TPLFE_DC_V42BIS		0x01 /* CCITT compression V.42 */
485*7c478bd9Sstevel@tonic-gate #define	TPLFE_DC_MNP5		0x02 /* MNP compression (uses MNP 2, 3 or 4) */
486*7c478bd9Sstevel@tonic-gate 
487*7c478bd9Sstevel@tonic-gate /* modem command protocols */
488*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_AT1	0x01 /* ANSI/EIA/TIA 602 "Action" commands */
489*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_AT2	0x02 /* ANSI/EIA/TIA 602 "ACE/DCE IF Params" */
490*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_AT3	0x04 /* ANSI/EIA/TIA 602 "Ace Parameters" */
491*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_MNP_AT	0x08 /* MNP specificat AT commands */
492*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_V25BIS	0x10 /* V.25bis calling commands */
493*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_V25A	0x20 /* V.25bis test procedures */
494*7c478bd9Sstevel@tonic-gate #define	TPLFE_CM_DMCL	0x40 /* DMCL command mode */
495*7c478bd9Sstevel@tonic-gate 
496*7c478bd9Sstevel@tonic-gate /* modem escape mechanism */
497*7c478bd9Sstevel@tonic-gate #define	TPLFE_EX_BREAK		0x01 /* BREAK support standardized */
498*7c478bd9Sstevel@tonic-gate #define	TPLFE_EX_PLUS		0x02 /* +++ returns to command mode */
499*7c478bd9Sstevel@tonic-gate #define	TPLFE_EX_UD		0x04 /* user defined escape character */
500*7c478bd9Sstevel@tonic-gate 
501*7c478bd9Sstevel@tonic-gate /* modem miscellaneous features */
502*7c478bd9Sstevel@tonic-gate #define	TPLFE_EF_CALLERID	0x01 /* Caller ID is supported */
503*7c478bd9Sstevel@tonic-gate 
504*7c478bd9Sstevel@tonic-gate /* fax modulation standards */
505*7c478bd9Sstevel@tonic-gate #define	TPLFE_FM_V21C2	0x01 /* 300bps (V.21-C2) */
506*7c478bd9Sstevel@tonic-gate #define	TPLFE_FM_V27TER	0x02 /* 4800/2400bps (V.27ter) */
507*7c478bd9Sstevel@tonic-gate #define	TPLFE_FM_V29	0x04 /* 9600/7200/4800 leased line (V.29) */
508*7c478bd9Sstevel@tonic-gate #define	TPLFE_FM_V17	0x08 /* 14.4K/12K/9600/7200bps (V.17) */
509*7c478bd9Sstevel@tonic-gate #define	TPLFE_FM_V33	0x10 /* 14.4K/12K/9600/7200 lease line (V.33) */
510*7c478bd9Sstevel@tonic-gate 
511*7c478bd9Sstevel@tonic-gate /* fax feature selection */
512*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_T3		0x01 /* Group 2 (T.3) service class */
513*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_T4		0x02 /* Group 3 (T.4) service class */
514*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_T6		0x04 /* Group 4 (T.6) service class */
515*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_ECM		0x08 /* Error Correction Modeer */
516*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_VOICEREQ	0x10 /* voice requests allowed */
517*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_POLLING	0x20 /* polling support */
518*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_FTP		0x40 /* file transfer support */
519*7c478bd9Sstevel@tonic-gate #define	TPLFE_FS_PASSWORD	0x80 /* password support */
520*7c478bd9Sstevel@tonic-gate 
521*7c478bd9Sstevel@tonic-gate /* LAN tuple definitions */
522*7c478bd9Sstevel@tonic-gate #define	TPLFE_NETWORK_INFO	0x00
523*7c478bd9Sstevel@tonic-gate 
524*7c478bd9Sstevel@tonic-gate /* LAN technology types */
525*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_ARCNET		1
526*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_ETHERNET		2
527*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_TOKENRING	3
528*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_LOCALTALK	4
529*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_FDDI		5
530*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_ATM		6
531*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_TECH_WIRELESS		7
532*7c478bd9Sstevel@tonic-gate 
533*7c478bd9Sstevel@tonic-gate /* LAN media types */
534*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_INHERENT	0
535*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_UTP		1
536*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_STP		2
537*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_THIN_COAX	3
538*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_THICK_COAX	4
539*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_FIBER		5
540*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_SSR_902		6
541*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_SSR_2_4		7
542*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_SSR_5_4		8
543*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_DIFFUSE_IR	9
544*7c478bd9Sstevel@tonic-gate #define	TPLFE_LAN_MEDIA_PTP_IR		10
545*7c478bd9Sstevel@tonic-gate 
546*7c478bd9Sstevel@tonic-gate /*
547*7c478bd9Sstevel@tonic-gate  * CISTPL_CFTABLE_ENTRY
548*7c478bd9Sstevel@tonic-gate  *
549*7c478bd9Sstevel@tonic-gate  * These flags and macros are used internally to the handler.
550*7c478bd9Sstevel@tonic-gate  */
551*7c478bd9Sstevel@tonic-gate 	/* mask to get the config entry number from TPCE_INDX */
552*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_CFGENTRYM		0x03f
553*7c478bd9Sstevel@tonic-gate 		/* default config bit in TPCE_INDX */
554*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_DEFAULTM		0x040
555*7c478bd9Sstevel@tonic-gate 		/* interface config byte follows */
556*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IFM			0x080
557*7c478bd9Sstevel@tonic-gate 
558*7c478bd9Sstevel@tonic-gate 		/* power bit mask for tpce_fs */
559*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWRM		0x003
560*7c478bd9Sstevel@tonic-gate 		/* Vcc, Vpp1 and Vpp2 descriptions */
561*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VPP2M	0x003
562*7c478bd9Sstevel@tonic-gate 		/* Vcc and Vpp1=Vpp2 descriptions */
563*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VPP1M	0x002
564*7c478bd9Sstevel@tonic-gate 		/* Vcc description only */
565*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VCCM		0x001
566*7c478bd9Sstevel@tonic-gate 		/* no connection on sleep/power down */
567*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_NC_SLEEPM		0x07d
568*7c478bd9Sstevel@tonic-gate 		/* zero value required */
569*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_ZEROM			0x07e
570*7c478bd9Sstevel@tonic-gate 		/* no connection ever */
571*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_NCM			0x07f
572*7c478bd9Sstevel@tonic-gate 
573*7c478bd9Sstevel@tonic-gate 		/* timing data exists */
574*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TDM		0x004
575*7c478bd9Sstevel@tonic-gate 		/* WAIT scale mask */
576*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_WAITM		0x003
577*7c478bd9Sstevel@tonic-gate #define	GET_TPCE_FS_TD_WAITS(sf)	((sf)& \
578*7c478bd9Sstevel@tonic-gate 					    CISTPL_CFTABLE_TPCE_FS_TD_WAITM)
579*7c478bd9Sstevel@tonic-gate 		/* RDY/BSY scale mask */
580*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_RDYM		0x01c
581*7c478bd9Sstevel@tonic-gate #define	GET_TPCE_FS_TD_RDYS(sf)	(((sf)>>2)& \
582*7c478bd9Sstevel@tonic-gate 					CISTPL_CFTABLE_TPCE_FS_TD_RDYM)
583*7c478bd9Sstevel@tonic-gate 		/* RSVD scale mask */
584*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_RSVDM		0x0e0
585*7c478bd9Sstevel@tonic-gate #define	GET_TPCE_FS_TD_RSVDS(sf)	(((sf)>>5)& \
586*7c478bd9Sstevel@tonic-gate 					    CISTPL_CFTABLE_TPCE_FS_TD_RSVDM)
587*7c478bd9Sstevel@tonic-gate 
588*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IOM		0x008	/* I/O data exists */
589*7c478bd9Sstevel@tonic-gate 		/* I/O addr lines mask */
590*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_ALM		0x01f
591*7c478bd9Sstevel@tonic-gate 		/* RANGE bit in TPCE_IO */
592*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_RANGEM	0x080
593*7c478bd9Sstevel@tonic-gate 		/* max of 16 I/O ranges */
594*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_ENTRY_MAX_IO_RANGES	16
595*7c478bd9Sstevel@tonic-gate 
596*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IRQM		0x010	/* IRQ data exists */
597*7c478bd9Sstevel@tonic-gate 		/* extended IRQ mask exists */
598*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IRQ_MASKM	0x010
599*7c478bd9Sstevel@tonic-gate 
600*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEMM		0x060	/* mem space mask */
601*7c478bd9Sstevel@tonic-gate 		/* space selection byte ... */
602*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM3M		0x060
603*7c478bd9Sstevel@tonic-gate 		/* length (2 bytes) and card address (2 bytes) */
604*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM2M		0x040
605*7c478bd9Sstevel@tonic-gate 		/* single 2-byte length */
606*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM1M		0x020
607*7c478bd9Sstevel@tonic-gate 		/* max of 8 mem space descriptors */
608*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_ENTRY_MAX_MEM_WINDOWS	8
609*7c478bd9Sstevel@tonic-gate 		/* number of bytes/page description */
610*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM_PGSIZE	256
611*7c478bd9Sstevel@tonic-gate 		/* host addr info present */
612*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM_HOSTM	0x080
613*7c478bd9Sstevel@tonic-gate 
614*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MISCM		0x080	/* misc fields mask */
615*7c478bd9Sstevel@tonic-gate 
616*7c478bd9Sstevel@tonic-gate /*
617*7c478bd9Sstevel@tonic-gate  * Constants, macros, structures and flags used by cistpl_pd_parse()
618*7c478bd9Sstevel@tonic-gate  *	cistpl_expd_parse() and the CISTPL_CFTABLE_ENTRY tuple handler.
619*7c478bd9Sstevel@tonic-gate  */
620*7c478bd9Sstevel@tonic-gate #define	CISTPL_PD_MAN(m)	cistpl_pd_struct.mantissa[m&15]
621*7c478bd9Sstevel@tonic-gate #define	CISTPL_PD_EXP(e)	cistpl_pd_struct.exponent[e&7]
622*7c478bd9Sstevel@tonic-gate typedef struct cistpl_pd_struct_t {
623*7c478bd9Sstevel@tonic-gate     uint32_t	*mantissa;
624*7c478bd9Sstevel@tonic-gate     uint32_t	*exponent;
625*7c478bd9Sstevel@tonic-gate } cistpl_pd_struct_t;
626*7c478bd9Sstevel@tonic-gate 
627*7c478bd9Sstevel@tonic-gate /*
628*7c478bd9Sstevel@tonic-gate  * These flags are passed to the caller in the cistpl_cftable_entry_t->flags
629*7c478bd9Sstevel@tonic-gate  *	field and indicate what interface information is available.  The low
630*7c478bd9Sstevel@tonic-gate  *	order byte of this field is reserved and no flags should be defined
631*7c478bd9Sstevel@tonic-gate  *	to exist there.
632*7c478bd9Sstevel@tonic-gate  */
633*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_DEFAULT	0x000000100 /* this is a default conf */
634*7c478bd9Sstevel@tonic-gate 
635*7c478bd9Sstevel@tonic-gate /* interface config description present flags */
636*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF		0x000000200 /* if config byte exists */
637*7c478bd9Sstevel@tonic-gate /*
638*7c478bd9Sstevel@tonic-gate  * When the CISTPL_CFTABLE_TPCE_IF flag is set, the following flags
639*7c478bd9Sstevel@tonic-gate  *	are available in the ifc member of the cistpl_cftable_entry_t
640*7c478bd9Sstevel@tonic-gate  *	structure.
641*7c478bd9Sstevel@tonic-gate  */
642*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_MEMORY	0x00	/* memory interface */
643*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_IO_MEM	0x01	/* IO and memory */
644*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_2	0x02	/* reserved */
645*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_3	0x03	/* reserved */
646*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_CUSTOM_0	0x04	/* custom interface 0 */
647*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_CUSTOM_1	0x05	/* custom interface 1 */
648*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_CUSTOM_2	0x06	/* custom interface 2 */
649*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_CUSTOM_3	0x07	/* custom interface 3 */
650*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_8	0x08	/* reserved */
651*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_9	0x09	/* reserved */
652*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_a	0x0a	/* reserved */
653*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_b	0x0b	/* reserved */
654*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_c	0x0c	/* reserved */
655*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_d	0x0d	/* reserved */
656*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_e	0x0e	/* reserved */
657*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RSVD_f	0x0f	/* reserved */
658*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_MASK	0x0f	/* interface type mask */
659*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_BVD	0x10	/* BVD active in PRR */
660*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_WP	0x20	/* WP active in PRR */
661*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_RDY	0x40	/* RDY active in PRR */
662*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_IF_MWAIT	0x80	/* WAIT - mem cycles */
663*7c478bd9Sstevel@tonic-gate 
664*7c478bd9Sstevel@tonic-gate /* power description present flags */
665*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR	0x000001000 /* power info exists */
666*7c478bd9Sstevel@tonic-gate 
667*7c478bd9Sstevel@tonic-gate /* timing description present flags */
668*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD	0x000010000 /* timing info exists */
669*7c478bd9Sstevel@tonic-gate 
670*7c478bd9Sstevel@tonic-gate /* I/O description present flags */
671*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO	0x000100000 /* I/O information exists */
672*7c478bd9Sstevel@tonic-gate 
673*7c478bd9Sstevel@tonic-gate /* IRQ description present flags */
674*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IRQ	0x000200000 /* IRQ information exists */
675*7c478bd9Sstevel@tonic-gate 
676*7c478bd9Sstevel@tonic-gate /* memory space description present flags */
677*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM	0x001000000 /* MEM space info exists */
678*7c478bd9Sstevel@tonic-gate 
679*7c478bd9Sstevel@tonic-gate /* misc description present flags */
680*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MISC	0x002000000 /* MISC info exists */
681*7c478bd9Sstevel@tonic-gate 
682*7c478bd9Sstevel@tonic-gate /* additional information tuples present flags */
683*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_STCE_EV	0x004000000 /* STCE_EV exists */
684*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_STCE_PD	0x008000000 /* STCE_PD exists */
685*7c478bd9Sstevel@tonic-gate 
686*7c478bd9Sstevel@tonic-gate /*
687*7c478bd9Sstevel@tonic-gate  * Power description flags and structures.
688*7c478bd9Sstevel@tonic-gate  *
689*7c478bd9Sstevel@tonic-gate  * The following eight values represent what the power description structure
690*7c478bd9Sstevel@tonic-gate  *	parameter selection byte tells us is present.  A copy of this byte
691*7c478bd9Sstevel@tonic-gate  *	is in the low order byte of each parameter's flag field.
692*7c478bd9Sstevel@tonic-gate  */
693*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_NOMV		0x001	/* nominal supply voltage */
694*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_MINV		0x002	/* minimum supply voltage */
695*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_MAXV		0x004	/* maximum supply voltage */
696*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_STATICI	0x008	/* continuous supply current */
697*7c478bd9Sstevel@tonic-gate 		/* max current required averaged over 1 second */
698*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_AVGI		0x010
699*7c478bd9Sstevel@tonic-gate 		/* maximum current required averaged over 10mS */
700*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_PEAKI		0x020
701*7c478bd9Sstevel@tonic-gate 		/* power down supply curent required */
702*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_PDOWNI	0x040
703*7c478bd9Sstevel@tonic-gate 		/* power supply is about to blow up */
704*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_RFU		0x080
705*7c478bd9Sstevel@tonic-gate 
706*7c478bd9Sstevel@tonic-gate /*
707*7c478bd9Sstevel@tonic-gate  * For each voltage/current parameter, there is an associated flags field.
708*7c478bd9Sstevel@tonic-gate  *	The following flags are in this field.  The low order byte of each
709*7c478bd9Sstevel@tonic-gate  *	of these flags fields also contains a copy of the power description
710*7c478bd9Sstevel@tonic-gate  *	structure parameter selection byte as read from the tuple, that's why
711*7c478bd9Sstevel@tonic-gate  *	we start the flag values at 0x0100 and go up from there.
712*7c478bd9Sstevel@tonic-gate  */
713*7c478bd9Sstevel@tonic-gate 		/* this parameter exists */
714*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_EXISTS	0x000000100
715*7c478bd9Sstevel@tonic-gate 		/* multiply return value by 10 */
716*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_MUL10		0x000000200
717*7c478bd9Sstevel@tonic-gate 		/* no connection on sleep/power down */
718*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_NC_SLEEP	0x000001000
719*7c478bd9Sstevel@tonic-gate 		/* zero value required */
720*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_ZERO		0x000002000
721*7c478bd9Sstevel@tonic-gate 		/* no connection ever */
722*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_PD_NC		0x000004000
723*7c478bd9Sstevel@tonic-gate 
724*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_pwr_t {
725*7c478bd9Sstevel@tonic-gate 	uint32_t	nomV;		/* nominal supply voltage */
726*7c478bd9Sstevel@tonic-gate 	uint32_t	nomV_flags;
727*7c478bd9Sstevel@tonic-gate 	uint32_t	minV;		/* minimum supply voltage */
728*7c478bd9Sstevel@tonic-gate 	uint32_t	minV_flags;
729*7c478bd9Sstevel@tonic-gate 	uint32_t	maxV;		/* maximum supply voltage */
730*7c478bd9Sstevel@tonic-gate 	uint32_t	maxV_flags;
731*7c478bd9Sstevel@tonic-gate 	uint32_t	staticI;	/* continuous supply current */
732*7c478bd9Sstevel@tonic-gate 	uint32_t	staticI_flags;
733*7c478bd9Sstevel@tonic-gate 	uint32_t	avgI;		/* max current required */
734*7c478bd9Sstevel@tonic-gate 					/* averaged over 1 sec. */
735*7c478bd9Sstevel@tonic-gate 	uint32_t	avgI_flags;
736*7c478bd9Sstevel@tonic-gate 	uint32_t	peakI;		/* max current required */
737*7c478bd9Sstevel@tonic-gate 					/* averaged over 10mS */
738*7c478bd9Sstevel@tonic-gate 	uint32_t	peakI_flags;
739*7c478bd9Sstevel@tonic-gate 	uint32_t	pdownI;		/* power down supply curent required */
740*7c478bd9Sstevel@tonic-gate 	uint32_t	pdownI_flags;
741*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_pwr_t;
742*7c478bd9Sstevel@tonic-gate 
743*7c478bd9Sstevel@tonic-gate /*
744*7c478bd9Sstevel@tonic-gate  * Flags for the global power description structure.  These show up in
745*7c478bd9Sstevel@tonic-gate  *	the flags field of the structure.
746*7c478bd9Sstevel@tonic-gate  */
747*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VCC	0x000000001 /* Vcc description valid  */
748*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VPP1	0x000000002 /* vpp1 description valid */
749*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_PWR_VPP2	0x000000004 /* Vpp2 description valid */
750*7c478bd9Sstevel@tonic-gate 
751*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_pd_t {
752*7c478bd9Sstevel@tonic-gate 	uint32_t	flags; /* which descriptions are valid */
753*7c478bd9Sstevel@tonic-gate 	struct cistpl_cftable_entry_pwr_t pd_vcc; /* VCC power description */
754*7c478bd9Sstevel@tonic-gate 	struct cistpl_cftable_entry_pwr_t pd_vpp1; /* Vpp1 power description */
755*7c478bd9Sstevel@tonic-gate 	struct cistpl_cftable_entry_pwr_t pd_vpp2; /* Vpp2 power description */
756*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_pd_t;
757*7c478bd9Sstevel@tonic-gate 
758*7c478bd9Sstevel@tonic-gate /*
759*7c478bd9Sstevel@tonic-gate  * Device speed structure.  Each field is only valid if the
760*7c478bd9Sstevel@tonic-gate  *	CISTPL_CFTABLE_TPCE_FS_TD flag is set.
761*7c478bd9Sstevel@tonic-gate  *
762*7c478bd9Sstevel@tonic-gate  * The following flags describe which timing information is available.
763*7c478bd9Sstevel@tonic-gate  *	They appear in the flags field of the device speed structure.
764*7c478bd9Sstevel@tonic-gate  */
765*7c478bd9Sstevel@tonic-gate 		/* WAIT timing exists */
766*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_WAIT	0x000000001
767*7c478bd9Sstevel@tonic-gate 		/* RDY/BSY timing exists */
768*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_RDY	0x000000002
769*7c478bd9Sstevel@tonic-gate 		/* RSVD timing exists */
770*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_TD_RSVD	0x000000004
771*7c478bd9Sstevel@tonic-gate 
772*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_speed_t {
773*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* which timing information is present */
774*7c478bd9Sstevel@tonic-gate     uint32_t	wait;		/* max WAIT time in device speed format */
775*7c478bd9Sstevel@tonic-gate     uint32_t	nS_wait;	/* max WAIT time in nS */
776*7c478bd9Sstevel@tonic-gate     uint32_t	rdybsy;		/* max RDY/BSY time in device speed format */
777*7c478bd9Sstevel@tonic-gate     uint32_t	nS_rdybsy;	/* max RDY/BSY time in nS */
778*7c478bd9Sstevel@tonic-gate     uint32_t	rsvd;		/* max RSVD time in device speed format */
779*7c478bd9Sstevel@tonic-gate     uint32_t	nS_rsvd;	/* max RSVD time in nS */
780*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_speed_t;
781*7c478bd9Sstevel@tonic-gate 
782*7c478bd9Sstevel@tonic-gate /*
783*7c478bd9Sstevel@tonic-gate  * Device I/O range description structures.  Only valid if the
784*7c478bd9Sstevel@tonic-gate  *	CISTPL_CFTABLE_TPCE_FS_IO flag is set.
785*7c478bd9Sstevel@tonic-gate  *
786*7c478bd9Sstevel@tonic-gate  * The following flags describe the IO description information. They
787*7c478bd9Sstevel@tonic-gate  *	appear in the flags field of the IO space description structure.
788*7c478bd9Sstevel@tonic-gate  */
789*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_BUS	0x060	/* bus width mask */
790*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_BUS8	0x020	/* 8-bit flag */
791*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_BUS16	0x040	/* 16-bit flag */
792*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_IO_RANGE	0x080	/* IO address ranges exist */
793*7c478bd9Sstevel@tonic-gate 
794*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_io_range_t {
795*7c478bd9Sstevel@tonic-gate     uint32_t	addr;		/* I/O start address */
796*7c478bd9Sstevel@tonic-gate     uint32_t	length;		/* I/O register length */
797*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_io_range_t;
798*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_io_t {
799*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* direct copy of TPCE_IO byte in tuple */
800*7c478bd9Sstevel@tonic-gate     uint32_t	addr_lines;	/* number of decoded I/O address lines */
801*7c478bd9Sstevel@tonic-gate     uint32_t	ranges;		/* number of I/O ranges */
802*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_io_range_t
803*7c478bd9Sstevel@tonic-gate 	    range[CISTPL_CFTABLE_ENTRY_MAX_IO_RANGES];
804*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_io_t;
805*7c478bd9Sstevel@tonic-gate 
806*7c478bd9Sstevel@tonic-gate /*
807*7c478bd9Sstevel@tonic-gate  * Device IRQ description structure.  Only valid if the
808*7c478bd9Sstevel@tonic-gate  *	CISTPL_CFTABLE_TPCE_FS_IRQ flag is set.
809*7c478bd9Sstevel@tonic-gate  */
810*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_irq_t {
811*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* direct copy of TPCE_IR byte in tuple */
812*7c478bd9Sstevel@tonic-gate     uint32_t	irqs;		/* bit mask for each allowed IRQ */
813*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_irq_t;
814*7c478bd9Sstevel@tonic-gate 
815*7c478bd9Sstevel@tonic-gate /*
816*7c478bd9Sstevel@tonic-gate  * Device memory space description structure.  Only valid if the
817*7c478bd9Sstevel@tonic-gate  *	CISTPL_CFTABLE_TPCE_FS_MEM flag is set.
818*7c478bd9Sstevel@tonic-gate  *
819*7c478bd9Sstevel@tonic-gate  * The following flags describe the memory description information.  They
820*7c478bd9Sstevel@tonic-gate  *	appear in the flags field of the memory space description structure.
821*7c478bd9Sstevel@tonic-gate  */
822*7c478bd9Sstevel@tonic-gate 		/* space descriptors */
823*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM3	0x000000001
824*7c478bd9Sstevel@tonic-gate 		/* host_addr=card_addr */
825*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM2	0x000000002
826*7c478bd9Sstevel@tonic-gate 		/* card address=0, any host address */
827*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM1	0x000000004
828*7c478bd9Sstevel@tonic-gate 		/* if host address is present in MEM3 */
829*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MEM_HOST	0x000000008
830*7c478bd9Sstevel@tonic-gate 
831*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_mem_window_t {
832*7c478bd9Sstevel@tonic-gate     uint32_t	length;		/* length of this window */
833*7c478bd9Sstevel@tonic-gate     uint32_t	card_addr;	/* card address */
834*7c478bd9Sstevel@tonic-gate     uint32_t	host_addr;	/* host address */
835*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_mem_window_t;
836*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_mem_t {
837*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* memory desc type and host addr info */
838*7c478bd9Sstevel@tonic-gate     uint32_t	windows;	/* number of memory space descriptors */
839*7c478bd9Sstevel@tonic-gate     cistpl_cftable_entry_mem_window_t
840*7c478bd9Sstevel@tonic-gate 	    window[CISTPL_CFTABLE_ENTRY_MAX_MEM_WINDOWS];
841*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_mem_t;
842*7c478bd9Sstevel@tonic-gate 
843*7c478bd9Sstevel@tonic-gate /*
844*7c478bd9Sstevel@tonic-gate  * Devices misc description structure.  Only valid if the
845*7c478bd9Sstevel@tonic-gate  *	CISTPL_CFTABLE_TPCE_FS_MISC flag is set.
846*7c478bd9Sstevel@tonic-gate  */
847*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_FS_MISC_MAX	2	   /* # bytes we understand */
848*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_MTC_MASK	0x00000007 /* max twin cards mask */
849*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_AUDIO	0x00000008 /* audio on BVD2 */
850*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_READONLY	0x00000010 /* R/O storage */
851*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_PWRDOWN	0x00000020 /* powerdown capable */
852*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DRQ_MASK	0x00000c00 /* DMAREQ mask */
853*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DRQ_SPK	0x00000400 /* DMAREQ on SPKR */
854*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DRQ_IOIS	0x00000800 /* DMAREQ on IOIS16 */
855*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DRQ_INP	0x00000c00 /* DMAREQ on INPACK */
856*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DMA_8	0x00000000 /* DMA width 8 bits */
857*7c478bd9Sstevel@tonic-gate #define	CISTPL_CFTABLE_TPCE_MI_DMA_16	0x00001000 /* DMA width 16 bits */
858*7c478bd9Sstevel@tonic-gate 
859*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_misc_t {
860*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* misc features flags */
861*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_misc_t;
862*7c478bd9Sstevel@tonic-gate 
863*7c478bd9Sstevel@tonic-gate /*
864*7c478bd9Sstevel@tonic-gate  * Additional information sub-tuples defines and structure
865*7c478bd9Sstevel@tonic-gate  */
866*7c478bd9Sstevel@tonic-gate #define	STCE_EV		0x0c0	/* Environment Descriptor Subtuple */
867*7c478bd9Sstevel@tonic-gate #define	STCE_PD		0x0c1	/* Physical Device Name Subtuple */
868*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_stce_ev_t {
869*7c478bd9Sstevel@tonic-gate 	char	stev_strs[CIS_MAX_TUPLE_DATA_LEN];
870*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_stce_ev_t;
871*7c478bd9Sstevel@tonic-gate 
872*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_stce_pd_t {
873*7c478bd9Sstevel@tonic-gate 	char	stpd_strs[CIS_MAX_TUPLE_DATA_LEN];
874*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_stce_pd_t;
875*7c478bd9Sstevel@tonic-gate 
876*7c478bd9Sstevel@tonic-gate /*
877*7c478bd9Sstevel@tonic-gate  * cistpl_cftable_entry_t - this is the struct that the caller passes
878*7c478bd9Sstevel@tonic-gate  *				to the CISTPL_CFTABLE_ENTRY handler
879*7c478bd9Sstevel@tonic-gate  */
880*7c478bd9Sstevel@tonic-gate typedef struct cistpl_cftable_entry_t {
881*7c478bd9Sstevel@tonic-gate     uint32_t	flags;		/* which descriptions are valid */
882*7c478bd9Sstevel@tonic-gate     uint32_t	ifc;		/* interface description info */
883*7c478bd9Sstevel@tonic-gate     uint32_t	pin;		/* values for PRR */
884*7c478bd9Sstevel@tonic-gate     uint32_t	index;		/* configuration index number */
885*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_pd_t	pd; /* power requirements description */
886*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_speed_t	speed; /* device speed description */
887*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_io_t	io; /* device I/O map */
888*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_irq_t	irq; /* device IRQ utilization */
889*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_mem_t	mem; /* device memory space */
890*7c478bd9Sstevel@tonic-gate     struct cistpl_cftable_entry_misc_t	misc; /* misc device features */
891*7c478bd9Sstevel@tonic-gate } cistpl_cftable_entry_t;
892*7c478bd9Sstevel@tonic-gate 
893*7c478bd9Sstevel@tonic-gate /*
894*7c478bd9Sstevel@tonic-gate  * CISTPL_LINKTARGET
895*7c478bd9Sstevel@tonic-gate  *
896*7c478bd9Sstevel@tonic-gate  * This tuple is used to verify that tuple chains other than the primary
897*7c478bd9Sstevel@tonic-gate  *	chain which starts at offset 0 in Attribute Memory are valid. All
898*7c478bd9Sstevel@tonic-gate  *	secondary tuple chains are required to contain this tuple as the
899*7c478bd9Sstevel@tonic-gate  *	first tuple of the chain.
900*7c478bd9Sstevel@tonic-gate  * This tuple must have a link field of at least MIN_LINKTARGET_LENGTH and
901*7c478bd9Sstevel@tonic-gate  *	must contain the byte pattern CISTPL_LINKTARGET_MAGIC.
902*7c478bd9Sstevel@tonic-gate  * LINKTARGET_AC_HEADER_LENGTH is the number of bytes contained in a
903*7c478bd9Sstevel@tonic-gate  *	valid CISTPL_LINKTARGET tuple header.
904*7c478bd9Sstevel@tonic-gate  */
905*7c478bd9Sstevel@tonic-gate #define	MIN_LINKTARGET_LENGTH		3
906*7c478bd9Sstevel@tonic-gate #define	CISTPL_LINKTARGET_MAGIC		"CIS"
907*7c478bd9Sstevel@tonic-gate #define	LINKTARGET_AC_HEADER_LENGTH	2
908*7c478bd9Sstevel@tonic-gate 
909*7c478bd9Sstevel@tonic-gate typedef struct cistpl_linktarget_t {
910*7c478bd9Sstevel@tonic-gate 	uint32_t	length;		/* number of bytes in tpltg_tag */
911*7c478bd9Sstevel@tonic-gate 	char	tpltg_tag[CIS_MAX_TUPLE_DATA_LEN];
912*7c478bd9Sstevel@tonic-gate } cistpl_linktarget_t;
913*7c478bd9Sstevel@tonic-gate 
914*7c478bd9Sstevel@tonic-gate /*
915*7c478bd9Sstevel@tonic-gate  * CISTPL_LONGLINK_A and CISTPL_LONGLINK_C
916*7c478bd9Sstevel@tonic-gate  *
917*7c478bd9Sstevel@tonic-gate  * Both of these tuples are processed the same way. The target address is
918*7c478bd9Sstevel@tonic-gate  *	really an offset from the beginning of the specified address space
919*7c478bd9Sstevel@tonic-gate  *	and is not a virtual address.
920*7c478bd9Sstevel@tonic-gate  * This tuple must have a link field of at least MIN_LONGLINK_AC_LENGTH.
921*7c478bd9Sstevel@tonic-gate  */
922*7c478bd9Sstevel@tonic-gate #define	MIN_LONGLINK_AC_LENGTH		4
923*7c478bd9Sstevel@tonic-gate 
924*7c478bd9Sstevel@tonic-gate typedef struct cistpl_longlink_ac_t {
925*7c478bd9Sstevel@tonic-gate 	uint32_t		flags;		/* space flags */
926*7c478bd9Sstevel@tonic-gate 	uint32_t		tpll_addr;	/* target address, normalized */
927*7c478bd9Sstevel@tonic-gate } cistpl_longlink_ac_t;
928*7c478bd9Sstevel@tonic-gate /*
929*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_longlink_ac_t->flags
930*7c478bd9Sstevel@tonic-gate  */
931*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_AC_AM	0x0001	/* longlink to AM */
932*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_AC_CM	0x0002	/* longlink to CM */
933*7c478bd9Sstevel@tonic-gate 
934*7c478bd9Sstevel@tonic-gate /*
935*7c478bd9Sstevel@tonic-gate  * CISTPL_LONGLINK_MFC
936*7c478bd9Sstevel@tonic-gate  *
937*7c478bd9Sstevel@tonic-gate  * This tuple describes the start of the function-specific CIS for each
938*7c478bd9Sstevel@tonic-gate  *	function on a multi-function card.
939*7c478bd9Sstevel@tonic-gate  *
940*7c478bd9Sstevel@tonic-gate  * This tuple must have a link field of at least MIN_LONGLINK_AC_LENGTH.
941*7c478bd9Sstevel@tonic-gate  */
942*7c478bd9Sstevel@tonic-gate #define	MIN_LONGLINK_MFC_LENGTH		6
943*7c478bd9Sstevel@tonic-gate #define	MIN_LONGLINK_MFC_NREGS		1
944*7c478bd9Sstevel@tonic-gate 
945*7c478bd9Sstevel@tonic-gate typedef struct cis_function_t {
946*7c478bd9Sstevel@tonic-gate 	uint32_t	tas;    /* target address space of function */
947*7c478bd9Sstevel@tonic-gate 	uint32_t	addr;   /* target address offset */
948*7c478bd9Sstevel@tonic-gate } cis_function_t;
949*7c478bd9Sstevel@tonic-gate 
950*7c478bd9Sstevel@tonic-gate typedef struct cistpl_longlink_mfc_t {
951*7c478bd9Sstevel@tonic-gate 	uint32_t	nfuncs;		/* number of functions */
952*7c478bd9Sstevel@tonic-gate 	uint32_t	nregs;		/* number of config register sets */
953*7c478bd9Sstevel@tonic-gate 	cis_function_t	function[CIS_MAX_FUNCTIONS];
954*7c478bd9Sstevel@tonic-gate } cistpl_longlink_mfc_t;
955*7c478bd9Sstevel@tonic-gate /*
956*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_longlink_mfc_t->function[n]->tas
957*7c478bd9Sstevel@tonic-gate  */
958*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_MFC_TAS_AM	0x00	/* CIS in attribute memory */
959*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_MFC_TAS_CM	0x01	/* CIS in common memory */
960*7c478bd9Sstevel@tonic-gate 
961*7c478bd9Sstevel@tonic-gate /*
962*7c478bd9Sstevel@tonic-gate  * CISTPL_LONGLINK_CB
963*7c478bd9Sstevel@tonic-gate  *
964*7c478bd9Sstevel@tonic-gate  * This tuple describes the start of a function's CIS chain
965*7c478bd9Sstevel@tonic-gate  *	for CardBus cards
966*7c478bd9Sstevel@tonic-gate  */
967*7c478bd9Sstevel@tonic-gate typedef struct cistpl_longlink_cb_t {
968*7c478bd9Sstevel@tonic-gate 	uint32_t	flags;		/* address space flags */
969*7c478bd9Sstevel@tonic-gate 	uint32_t	addr;		/* raw (unproessed) address value */
970*7c478bd9Sstevel@tonic-gate 	union {
971*7c478bd9Sstevel@tonic-gate 	    /* device-dependant config space info */
972*7c478bd9Sstevel@tonic-gate 	    struct {
973*7c478bd9Sstevel@tonic-gate 		uint32_t	offset;	/* offset within config space */
974*7c478bd9Sstevel@tonic-gate 	    } cfg;
975*7c478bd9Sstevel@tonic-gate 	    /* memory space info */
976*7c478bd9Sstevel@tonic-gate 	    struct {
977*7c478bd9Sstevel@tonic-gate 		uint32_t	asi;	/* BAR */
978*7c478bd9Sstevel@tonic-gate 		uint32_t	offset;	/* offset within BAR space */
979*7c478bd9Sstevel@tonic-gate 	    } mem;
980*7c478bd9Sstevel@tonic-gate 	    /* expansion ROM space info */
981*7c478bd9Sstevel@tonic-gate 	    struct {
982*7c478bd9Sstevel@tonic-gate 		uint32_t	image;	/* image number */
983*7c478bd9Sstevel@tonic-gate 		uint32_t	offset;	/* offset from iamge base */
984*7c478bd9Sstevel@tonic-gate 	    } rom;
985*7c478bd9Sstevel@tonic-gate 	} space;
986*7c478bd9Sstevel@tonic-gate } cistpl_longlink_cb_t;
987*7c478bd9Sstevel@tonic-gate /*
988*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_longlink_cb_t->flags
989*7c478bd9Sstevel@tonic-gate  */
990*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_CB_CFG	0x0001	/* config space info valid */
991*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_CB_MEM	0x0002	/* memory space info valid */
992*7c478bd9Sstevel@tonic-gate #define	CISTPL_LONGLINK_CB_ROM	0x0004	/* expansion ROM space info valid */
993*7c478bd9Sstevel@tonic-gate 
994*7c478bd9Sstevel@tonic-gate /*
995*7c478bd9Sstevel@tonic-gate  * CISTPL_SPCL
996*7c478bd9Sstevel@tonic-gate  *
997*7c478bd9Sstevel@tonic-gate  * This tuple is the Special Purpose tuple and it's contents are dependant
998*7c478bd9Sstevel@tonic-gate  *	on the meaning of the header information in this tuple.
999*7c478bd9Sstevel@tonic-gate  */
1000*7c478bd9Sstevel@tonic-gate typedef struct cistpl_spcl_t {
1001*7c478bd9Sstevel@tonic-gate 	uint32_t	id;		/* tuple contents identification */
1002*7c478bd9Sstevel@tonic-gate 	uint32_t	seq;		/* data sequence number */
1003*7c478bd9Sstevel@tonic-gate 	uint32_t	bytes;		/* number of bytes following */
1004*7c478bd9Sstevel@tonic-gate 	uchar_t		data[CIS_MAX_TUPLE_DATA_LEN];
1005*7c478bd9Sstevel@tonic-gate } cistpl_spcl_t;
1006*7c478bd9Sstevel@tonic-gate /*
1007*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_spcl_t->seq
1008*7c478bd9Sstevel@tonic-gate  */
1009*7c478bd9Sstevel@tonic-gate #define	CISTPL_SPCL_SEQ_END	0x080	/* last tuple in sequence */
1010*7c478bd9Sstevel@tonic-gate 
1011*7c478bd9Sstevel@tonic-gate /*
1012*7c478bd9Sstevel@tonic-gate  * CISTPL_SWIL
1013*7c478bd9Sstevel@tonic-gate  *
1014*7c478bd9Sstevel@tonic-gate  * This tuple describes the software interleaving of data within a
1015*7c478bd9Sstevel@tonic-gate  *	partition on the card.
1016*7c478bd9Sstevel@tonic-gate  */
1017*7c478bd9Sstevel@tonic-gate typedef struct cistpl_swil_t {
1018*7c478bd9Sstevel@tonic-gate 	uint32_t	intrlv;		/* interleave */
1019*7c478bd9Sstevel@tonic-gate } cistpl_swil_t;
1020*7c478bd9Sstevel@tonic-gate 
1021*7c478bd9Sstevel@tonic-gate /*
1022*7c478bd9Sstevel@tonic-gate  * CISTPL_BAR
1023*7c478bd9Sstevel@tonic-gate  *
1024*7c478bd9Sstevel@tonic-gate  * This tuple describes the CardBus Base Address Registers
1025*7c478bd9Sstevel@tonic-gate  */
1026*7c478bd9Sstevel@tonic-gate typedef struct cistpl_bar_t {
1027*7c478bd9Sstevel@tonic-gate 	uint32_t	attributes;	/* attributes */
1028*7c478bd9Sstevel@tonic-gate 	uint32_t	size;		/* BAR size */
1029*7c478bd9Sstevel@tonic-gate } cistpl_bar_t;
1030*7c478bd9Sstevel@tonic-gate /*
1031*7c478bd9Sstevel@tonic-gate  * Flags for cistpl_bar_t->attributes
1032*7c478bd9Sstevel@tonic-gate  */
1033*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_MASK	0x007	/* Base Address Register mask */
1034*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_1	0x001	/* Base Address Register 1 */
1035*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_2	0x002	/* Base Address Register 2 */
1036*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_3	0x003	/* Base Address Register 3 */
1037*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_4	0x004	/* Base Address Register 4 */
1038*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_5	0x005	/* Base Address Register 5 */
1039*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_6	0x006	/* Base Address Register 6 */
1040*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_BAR_7	0x007	/* Base Address Register 7 */
1041*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_ASI_EXP_ROM	0x007	/* Expansion ROM BAR */
1042*7c478bd9Sstevel@tonic-gate 
1043*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_AS_MEM	0x000	/* BAR is of type memory */
1044*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_AS_IO	0x008	/* BAR is of type IO */
1045*7c478bd9Sstevel@tonic-gate 
1046*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_PREFETCH_CACHE_MASK	0x060	/* prefetch/cache mask */
1047*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_PREFETCH		0x020	/* prefetchable not cacheable */
1048*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_PREFETCH_CACHE	0x040	/* prefetchable and cacheable */
1049*7c478bd9Sstevel@tonic-gate 
1050*7c478bd9Sstevel@tonic-gate #define	CISTPL_BAR_BELOW_1MB	0x080	/* must locate within first MB */
1051*7c478bd9Sstevel@tonic-gate 
1052*7c478bd9Sstevel@tonic-gate /*
1053*7c478bd9Sstevel@tonic-gate  * CISTPL_DEVICEGEO and CISTPL_DEVICEGEO_A
1054*7c478bd9Sstevel@tonic-gate  *
1055*7c478bd9Sstevel@tonic-gate  * These tuples describe the device geometry of memory partitions.
1056*7c478bd9Sstevel@tonic-gate  */
1057*7c478bd9Sstevel@tonic-gate #define	CISTPL_DEVICEGEO_MAX_PARTITIONS	42
1058*7c478bd9Sstevel@tonic-gate typedef struct cistpl_devicegeo_info_t {
1059*7c478bd9Sstevel@tonic-gate 	uint32_t	bus;		/* card interface width in bytes */
1060*7c478bd9Sstevel@tonic-gate 	uint32_t	ebs;		/* minimum erase block size */
1061*7c478bd9Sstevel@tonic-gate 	uint32_t	rbs;		/* minimum read block size */
1062*7c478bd9Sstevel@tonic-gate 	uint32_t	wbs;		/* minimum write bock size */
1063*7c478bd9Sstevel@tonic-gate 	uint32_t	part;		/* segment partition subdivisions */
1064*7c478bd9Sstevel@tonic-gate 	uint32_t	hwil;		/* hardware interleave */
1065*7c478bd9Sstevel@tonic-gate } cistpl_devicegeo_info_t;
1066*7c478bd9Sstevel@tonic-gate typedef struct cistpl_devicegeo_t {
1067*7c478bd9Sstevel@tonic-gate 	cistpl_devicegeo_info_t	info[CISTPL_DEVICEGEO_MAX_PARTITIONS];
1068*7c478bd9Sstevel@tonic-gate } cistpl_devicegeo_t;
1069*7c478bd9Sstevel@tonic-gate 
1070*7c478bd9Sstevel@tonic-gate /*
1071*7c478bd9Sstevel@tonic-gate  * The cistpl_get_tuple_name_t used to support the HANDTPL_RETURN_NAME
1072*7c478bd9Sstevel@tonic-gate  *	operation of the CIS parser.
1073*7c478bd9Sstevel@tonic-gate  */
1074*7c478bd9Sstevel@tonic-gate typedef struct cistpl_get_tuple_name_t {
1075*7c478bd9Sstevel@tonic-gate 	char	name[CIS_MAX_TUPLE_NAME_LEN];
1076*7c478bd9Sstevel@tonic-gate } cistpl_get_tuple_name_t;
1077*7c478bd9Sstevel@tonic-gate 
1078*7c478bd9Sstevel@tonic-gate /*
1079*7c478bd9Sstevel@tonic-gate  * cisparse_t - the structure that unifies all tuple parsing structures
1080*7c478bd9Sstevel@tonic-gate  */
1081*7c478bd9Sstevel@tonic-gate typedef union cisparse_t {
1082*7c478bd9Sstevel@tonic-gate 	cistpl_config_t		cistpl_config;
1083*7c478bd9Sstevel@tonic-gate 	cistpl_device_t		cistpl_device;
1084*7c478bd9Sstevel@tonic-gate 	cistpl_vers_1_t		cistpl_vers_1;
1085*7c478bd9Sstevel@tonic-gate 	cistpl_vers_2_t		cistpl_vers_2;
1086*7c478bd9Sstevel@tonic-gate 	cistpl_jedec_t		cistpl_jedec;
1087*7c478bd9Sstevel@tonic-gate 	cistpl_format_t		cistpl_format;
1088*7c478bd9Sstevel@tonic-gate 	cistpl_geometry_t	cistpl_geometry;
1089*7c478bd9Sstevel@tonic-gate 	cistpl_byteorder_t	cistpl_byteorder;
1090*7c478bd9Sstevel@tonic-gate 	cistpl_date_t		cistpl_date;
1091*7c478bd9Sstevel@tonic-gate 	cistpl_battery_t	cistpl_battery;
1092*7c478bd9Sstevel@tonic-gate 	cistpl_org_t		cistpl_org;
1093*7c478bd9Sstevel@tonic-gate 	cistpl_manfid_t		cistpl_manfid;
1094*7c478bd9Sstevel@tonic-gate 	cistpl_funcid_t		cistpl_funcid;
1095*7c478bd9Sstevel@tonic-gate 	cistpl_funce_t		cistpl_funce;
1096*7c478bd9Sstevel@tonic-gate 	cistpl_cftable_entry_t	cistpl_cftable_entry;
1097*7c478bd9Sstevel@tonic-gate 	cistpl_linktarget_t	cistpl_linktarget;
1098*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_ac_t	cistpl_longlink_ac;
1099*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_mfc_t	cistpl_longlink_mfc;
1100*7c478bd9Sstevel@tonic-gate 	cistpl_spcl_t		cistpl_spcl;
1101*7c478bd9Sstevel@tonic-gate 	cistpl_swil_t		cistpl_swil;
1102*7c478bd9Sstevel@tonic-gate 	cistpl_bar_t		cistpl_bar;
1103*7c478bd9Sstevel@tonic-gate 	cistpl_devicegeo_t	cistpl_devicegeo;
1104*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_cb_t	cistpl_longlink_cb;
1105*7c478bd9Sstevel@tonic-gate 	cistpl_get_tuple_name_t	cistpl_get_tuple_name;
1106*7c478bd9Sstevel@tonic-gate 	/* members below are for legacy support - REMOVE THEM BEFORE FCS!! */
1107*7c478bd9Sstevel@tonic-gate 	cistpl_config_t		config;
1108*7c478bd9Sstevel@tonic-gate 	cistpl_device_t		device;
1109*7c478bd9Sstevel@tonic-gate 	cistpl_vers_1_t		version_1;
1110*7c478bd9Sstevel@tonic-gate 	cistpl_vers_2_t		version_2;
1111*7c478bd9Sstevel@tonic-gate 	cistpl_jedec_t		jedec;
1112*7c478bd9Sstevel@tonic-gate 	cistpl_format_t		format;
1113*7c478bd9Sstevel@tonic-gate 	cistpl_geometry_t	geometry;
1114*7c478bd9Sstevel@tonic-gate 	cistpl_byteorder_t	byteorder;
1115*7c478bd9Sstevel@tonic-gate 	cistpl_date_t		date;
1116*7c478bd9Sstevel@tonic-gate 	cistpl_battery_t	battery;
1117*7c478bd9Sstevel@tonic-gate 	cistpl_org_t		org;
1118*7c478bd9Sstevel@tonic-gate 	cistpl_manfid_t		manfid;
1119*7c478bd9Sstevel@tonic-gate 	cistpl_funcid_t		funcid;
1120*7c478bd9Sstevel@tonic-gate 	cistpl_funce_t		funce;
1121*7c478bd9Sstevel@tonic-gate 	cistpl_cftable_entry_t	cftable;
1122*7c478bd9Sstevel@tonic-gate 	cistpl_linktarget_t	linktarget;
1123*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_ac_t	longlink_ac;
1124*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_mfc_t	longlink_mfc;
1125*7c478bd9Sstevel@tonic-gate 	cistpl_spcl_t		spcl;
1126*7c478bd9Sstevel@tonic-gate 	cistpl_swil_t		swil;
1127*7c478bd9Sstevel@tonic-gate 	cistpl_bar_t		bar;
1128*7c478bd9Sstevel@tonic-gate 	cistpl_devicegeo_t	devgeo;
1129*7c478bd9Sstevel@tonic-gate 	cistpl_longlink_cb_t	longlink_cb;
1130*7c478bd9Sstevel@tonic-gate 	cistpl_get_tuple_name_t	tuple_name;
1131*7c478bd9Sstevel@tonic-gate } cisparse_t;
1132*7c478bd9Sstevel@tonic-gate</