1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _CS_H
28*0Sstevel@tonic-gate #define	_CS_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * PCMCIA Card Services header file
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * XXX - This define really should be in a global header file
42*0Sstevel@tonic-gate  *	somewhere; we do this stunt here since a lot of
43*0Sstevel@tonic-gate  *	people include this header file but not necessarily
44*0Sstevel@tonic-gate  *	the header file in which this is defined.
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate #ifndef	_VERSION
47*0Sstevel@tonic-gate #define	_VERSION(major, minor)	((major)<<16|(minor))
48*0Sstevel@tonic-gate #endif
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate /*
51*0Sstevel@tonic-gate  * Define this version of CS - this should correspond to the PCMCIA
52*0Sstevel@tonic-gate  *	version number specified in the PCMCIA standard.
53*0Sstevel@tonic-gate  */
54*0Sstevel@tonic-gate #define	CS_VERSION	_VERSION(5, 2)
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate /*
57*0Sstevel@tonic-gate  * CS_INTERNAL_REVISION_LEVEL is our internal revision level value returned
58*0Sstevel@tonic-gate  *	via GetCardServicesInfo in get_cardservices_info_t->Revision
59*0Sstevel@tonic-gate  */
60*0Sstevel@tonic-gate #define	CS_INTERNAL_REVISION_LEVEL	_VERSION(2, 0)
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate #define	CS_GET_CARDSERVICES_INFO_VENDOR_STRING	"Solaris UNIX Card Services\n" \
63*0Sstevel@tonic-gate 		"Copyright (c) 1996 by Sun Microsystems, Inc.\n"	\
64*0Sstevel@tonic-gate 		"All rights reserved\n"					\
65*0Sstevel@tonic-gate 		"%W% %E% SMI\n"	\
66*0Sstevel@tonic-gate 		"Based on the PC Card Standard, February 1995\n"
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate /*
69*0Sstevel@tonic-gate  * typedef for function pointers to quiet lint and cc -v
70*0Sstevel@tonic-gate  */
71*0Sstevel@tonic-gate typedef	int32_t (csfunction_t)(int32_t, ...);	/* for lint - cc -v quieting */
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate /*
74*0Sstevel@tonic-gate  * CS_SUN_VENDOR_DESCRIPTION - can be returned by clients handling
75*0Sstevel@tonic-gate  *				the CS_EVENT_CLIENT_INFO event in the
76*0Sstevel@tonic-gate  *				client_info_t->VendorName member.
77*0Sstevel@tonic-gate  */
78*0Sstevel@tonic-gate #define	CS_SUN_VENDOR_DESCRIPTION	"Sun Microsystems, Inc. (c) 1996"
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate /*
81*0Sstevel@tonic-gate  * Return codes from Card Services - these correspond to the PCMCIA
82*0Sstevel@tonic-gate  *	standard and also include some implementation-specific return
83*0Sstevel@tonic-gate  *	codes.
84*0Sstevel@tonic-gate  */
85*0Sstevel@tonic-gate #define	CS_SUCCESS		0x00	/* Request succeeded */
86*0Sstevel@tonic-gate #define	CS_BAD_ADAPTER		0x01	/* Specified adapter is invalid */
87*0Sstevel@tonic-gate #define	CS_BAD_ATTRIBUTE	0x02	/* Bad attribute value */
88*0Sstevel@tonic-gate #define	CS_BAD_BASE		0x03	/* System base address invalid */
89*0Sstevel@tonic-gate #define	CS_BAD_EDC		0x04	/* EDC generator is invalid */
90*0Sstevel@tonic-gate 	/* RESERVED - 0x05 */
91*0Sstevel@tonic-gate #define	CS_BAD_IRQ		0x06	/* Invalid IRQ */
92*0Sstevel@tonic-gate #define	CS_BAD_OFFSET		0x07	/* Card offset invalid */
93*0Sstevel@tonic-gate #define	CS_BAD_PAGE		0x08	/* Card page invalid */
94*0Sstevel@tonic-gate #define	CS_READ_FAILURE		0x09	/* Unable to complete read request */
95*0Sstevel@tonic-gate #define	CS_BAD_SIZE		0x0a	/* Size is invalid */
96*0Sstevel@tonic-gate #define	CS_BAD_SOCKET		0x0b	/* Specified socket is invalid */
97*0Sstevel@tonic-gate 	/* RESERVED - 0x0c */
98*0Sstevel@tonic-gate #define	CS_BAD_TYPE		0x0d	/* Window/interface type invalid */
99*0Sstevel@tonic-gate #define	CS_BAD_VCC		0x0e	/* Vcc value/index invalid */
100*0Sstevel@tonic-gate #define	CS_BAD_VPP		0x0f	/* Vpp value/index invalid */
101*0Sstevel@tonic-gate #define	CS_BAD_WINDOW		0x11	/* Specified window is invalid */
102*0Sstevel@tonic-gate #define	CS_WRITE_FAILURE	0x12	/* Unable to complete write request */
103*0Sstevel@tonic-gate 	/* RESERVED - 0x13 */
104*0Sstevel@tonic-gate #define	CS_NO_CARD		0x14	/* No PC card in socket */
105*0Sstevel@tonic-gate #define	CS_UNSUPPORTED_FUNCTION	0x15	/* Unsupported function */
106*0Sstevel@tonic-gate #define	CS_UNSUPPORTED_MODE	0x16	/* Unsupported processor mode */
107*0Sstevel@tonic-gate #define	CS_BAD_SPEED		0x17	/* Specified speed is unavailable */
108*0Sstevel@tonic-gate #define	CS_BUSY			0x18	/* CS is busy - try again later */
109*0Sstevel@tonic-gate #define	CS_GENERAL_FAILURE	0x19	/* Undefined error */
110*0Sstevel@tonic-gate #define	CS_WRITE_PROTECTED	0x1a	/* Media is write protected */
111*0Sstevel@tonic-gate #define	CS_BAD_ARG_LENGTH	0x1b	/* Arg length invalid */
112*0Sstevel@tonic-gate #define	CS_BAD_ARGS		0x1c	/* Arg values invalid */
113*0Sstevel@tonic-gate #define	CS_CONFIGURATION_LOCKED	0x1d	/* This configuration is locked */
114*0Sstevel@tonic-gate #define	CS_IN_USE		0x1e	/* Requested resource in use */
115*0Sstevel@tonic-gate #define	CS_NO_MORE_ITEMS	0x1f	/* No more of requested item */
116*0Sstevel@tonic-gate #define	CS_OUT_OF_RESOURCE	0x20	/* Internal CS resources exhausted */
117*0Sstevel@tonic-gate #define	CS_BAD_HANDLE		0x21	/* client or window handle invalid */
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate /*
120*0Sstevel@tonic-gate  * The following are Solaris-specific extended return codes
121*0Sstevel@tonic-gate  */
122*0Sstevel@tonic-gate #define	CS_NO_CIS		0x80	/* No CIS on card */
123*0Sstevel@tonic-gate #define	CS_BAD_CIS		0x81	/* Bad CIS on card */
124*0Sstevel@tonic-gate #define	CS_UNKNOWN_TUPLE	0x82	/* unknown tuple */
125*0Sstevel@tonic-gate #define	CS_BAD_VERSION		0x83	/* bad CS version */
126*0Sstevel@tonic-gate #define	CS_UNSUPPORTED_EVENT	0x84	/* Unsupported event in client */
127*0Sstevel@tonic-gate #define	CS_CSI_ERROR		0x85	/* error in csi driver protocol */
128*0Sstevel@tonic-gate #define	CS_CSI_NOT_INIT		0x86	/* csi library/driver not initialized */
129*0Sstevel@tonic-gate #define	CS_NO_TUPLE_PARSER	0x87	/* no tuple parser for this tuple */
130*0Sstevel@tonic-gate #define	CS_CARD_NOT_READY	0x88	/* card not ready */
131*0Sstevel@tonic-gate #define	CS_ERRORLIST_END	0x8000	/* end of error list */
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate /*
134*0Sstevel@tonic-gate  * Card Services event codes - these do NOT correspond to the PCMCIA
135*0Sstevel@tonic-gate  *	standard event codes for CS since these events are encoded as
136*0Sstevel@tonic-gate  *	bit flags, while the PCMCIA standard event codes are encoded
137*0Sstevel@tonic-gate  *	as numerical values.  In practice, this shouldn't be a problem
138*0Sstevel@tonic-gate  *	since no one should be looking at the absolute value of the
139*0Sstevel@tonic-gate  *	event codes; these defines should be used.
140*0Sstevel@tonic-gate  *
141*0Sstevel@tonic-gate  * The numerical value of an event code determines in what order a client
142*0Sstevel@tonic-gate  *	will receive the event if other events are also pending for that
143*0Sstevel@tonic-gate  *	client. XXX - need to make event_t a 64-bit field.
144*0Sstevel@tonic-gate  *
145*0Sstevel@tonic-gate  * Card Services receives these events from Socket Services or by reading
146*0Sstevel@tonic-gate  *	the card's Pin Replacement Register.  In either case, the client
147*0Sstevel@tonic-gate  *	always gets the same type of notification.
148*0Sstevel@tonic-gate  */
149*0Sstevel@tonic-gate #define	CS_EVENT_REGISTRATION_COMPLETE	0x00000001 /* 0x82 */
150*0Sstevel@tonic-gate #define	CS_EVENT_PM_RESUME		0x00000002 /* 0x05 */
151*0Sstevel@tonic-gate #define	CS_EVENT_CARD_INSERTION		0x00000004 /* 0x0c */
152*0Sstevel@tonic-gate #define	CS_EVENT_CARD_READY		0x00000008 /* 0x01 */
153*0Sstevel@tonic-gate #define	CS_EVENT_BATTERY_LOW		0x00000010 /* 0x02 is also BVD2 */
154*0Sstevel@tonic-gate #define	CS_EVENT_BATTERY_DEAD		0x00000020 /* 0x40 is also BVD1 */
155*0Sstevel@tonic-gate #define	CS_EVENT_CARD_LOCK		0x00000040 /* 0x03 */
156*0Sstevel@tonic-gate #define	CS_EVENT_PM_SUSPEND		0x00000080 /* 0x04 */
157*0Sstevel@tonic-gate #define	CS_EVENT_CARD_RESET		0x00000100 /* 0x11 */
158*0Sstevel@tonic-gate #define	CS_EVENT_CARD_UNLOCK		0x00000200 /* 0x06 */
159*0Sstevel@tonic-gate #define	CS_EVENT_EJECTION_COMPLETE	0x00000400 /* 0x07 */
160*0Sstevel@tonic-gate #define	CS_EVENT_EJECTION_REQUEST	0x00000800 /* 0x08 */
161*0Sstevel@tonic-gate #define	CS_EVENT_ERASE_COMPLETE		0x00001000 /* 0x81 */
162*0Sstevel@tonic-gate #define	CS_EVENT_EXCLUSIVE_COMPLETE	0x00002000 /* 0x0d */
163*0Sstevel@tonic-gate #define	CS_EVENT_EXCLUSIVE_REQUEST	0x00004000 /* 0x0e */
164*0Sstevel@tonic-gate #define	CS_EVENT_INSERTION_COMPLETE	0x00008000 /* 0x09 */
165*0Sstevel@tonic-gate #define	CS_EVENT_INSERTION_REQUEST	0x00010000 /* 0x0a */
166*0Sstevel@tonic-gate #define	CS_EVENT_RESET_COMPLETE		0x00020000 /* 0x80 */
167*0Sstevel@tonic-gate #define	CS_EVENT_RESET_PHYSICAL		0x00040000 /* 0x0f */
168*0Sstevel@tonic-gate #define	CS_EVENT_RESET_REQUEST		0x00080000 /* 0x10 */
169*0Sstevel@tonic-gate #define	CS_EVENT_MTD_REQUEST		0x00100000 /* 0x12 */
170*0Sstevel@tonic-gate #define	CS_EVENT_CLIENT_INFO		0x00200000 /* 0x14 */
171*0Sstevel@tonic-gate #define	CS_EVENT_TIMER_EXPIRED		0x00400000 /* 0x15 */
172*0Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT		0x01000000 /* 0x17 */
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate /*
175*0Sstevel@tonic-gate  * The CS_EVENT_SS_UPDATED event is generated when Socket Services
176*0Sstevel@tonic-gate  *	has completed parsing the CIS and has done any necessary
177*0Sstevel@tonic-gate  *	work to get the client driver loaded and attached.
178*0Sstevel@tonic-gate  */
179*0Sstevel@tonic-gate #define	CS_EVENT_SS_UPDATED		0x00800000 /* 0x16 */
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate /*
182*0Sstevel@tonic-gate  * The CS_EVENT_STATUS_CHANGE event is generated by a Socket Services
183*0Sstevel@tonic-gate  *	PCE_CARD_STATUS_CHANGE event; this event gets converted to
184*0Sstevel@tonic-gate  *	the appropriate Card Services events when Card Services
185*0Sstevel@tonic-gate  *	reads the PRR.
186*0Sstevel@tonic-gate  */
187*0Sstevel@tonic-gate #define	CS_EVENT_STATUS_CHANGE		0x02000000 /* ?? */
188*0Sstevel@tonic-gate 
189*0Sstevel@tonic-gate /*
190*0Sstevel@tonic-gate  * The CS_EVENT_CARD_REMOVAL is the last "real" CS event and must
191*0Sstevel@tonic-gate  *	have the highest value of all "real" CS events so that this
192*0Sstevel@tonic-gate  *	event is handed to the client after all other queued events
193*0Sstevel@tonic-gate  *	have been processed.
194*0Sstevel@tonic-gate  * If the client has set the CS_EVENT_CARD_REMOVAL_LOWP flag in
195*0Sstevel@tonic-gate  *	either of their event masks, then they will also receive
196*0Sstevel@tonic-gate  *	a CS_EVENT_CARD_REMOVAL at low (cs_event_thread) priority;
197*0Sstevel@tonic-gate  *	in this low priority removal event, the client can call
198*0Sstevel@tonic-gate  *	many CS functions that they can't call when they recieve
199*0Sstevel@tonic-gate  *	the high priority removal event.
200*0Sstevel@tonic-gate  */
201*0Sstevel@tonic-gate #define	CS_EVENT_CARD_REMOVAL		0x10000000 /* 0x0b */
202*0Sstevel@tonic-gate #define	CS_EVENT_CARD_REMOVAL_LOWP	0x20000000 /* ?? */
203*0Sstevel@tonic-gate /*
204*0Sstevel@tonic-gate  * The following are not events but they share the event flags field
205*0Sstevel@tonic-gate  *	and are used internally by CS.  These bit patterns will never
206*0Sstevel@tonic-gate  *	be seen by clients.
207*0Sstevel@tonic-gate  * CS_EVENT_ALL_CLIENTS can only be set by the super-client and by
208*0Sstevel@tonic-gate  *	the CSI clients; setting this bit causes the driver to
209*0Sstevel@tonic-gate  *	receive any events specified in their event masks whenever
210*0Sstevel@tonic-gate  *	any such events occur on the socket.
211*0Sstevel@tonic-gate  * CS_EVENT_READY_TIMEOUT is a CS-private flag and should never be
212*0Sstevel@tonic-gate  *	set by clients.
213*0Sstevel@tonic-gate  */
214*0Sstevel@tonic-gate #define	CS_EVENT_ALL_CLIENTS		0x40000000 /* ?? */
215*0Sstevel@tonic-gate #define	CS_EVENT_READY_TIMEOUT		0x80000000 /* ?? */
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate /*
218*0Sstevel@tonic-gate  * CS_EVENT_CLIENT_EVENTS_MASK is a msk of events that only the framework
219*0Sstevel@tonic-gate  *	is allowed to manipulate.
220*0Sstevel@tonic-gate  */
221*0Sstevel@tonic-gate #define	CS_EVENT_CLIENT_EVENTS_MASK	~(CS_EVENT_SS_UPDATED |		\
222*0Sstevel@tonic-gate 						CS_EVENT_ALL_CLIENTS |	\
223*0Sstevel@tonic-gate 						CS_EVENT_CARD_REMOVAL_LOWP)
224*0Sstevel@tonic-gate 
225*0Sstevel@tonic-gate /*
226*0Sstevel@tonic-gate  * client_info_t structure used by clients for a CS_EVENT_CLIENT_INFO
227*0Sstevel@tonic-gate  *	event and for the GetClientInfo function.
228*0Sstevel@tonic-gate  */
229*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_MAX_NAME_LEN	80
230*0Sstevel@tonic-gate typedef struct client_info_t {
231*0Sstevel@tonic-gate 	uint32_t	Attributes;
232*0Sstevel@tonic-gate 	uint32_t	Revision;	/* BCD value of client revision */
233*0Sstevel@tonic-gate 	uint32_t	CSLevel;	/* BCD value of CS release */
234*0Sstevel@tonic-gate 	uint32_t	RevDate;	/* revision date */
235*0Sstevel@tonic-gate 	char		ClientName[CS_CLIENT_INFO_MAX_NAME_LEN];
236*0Sstevel@tonic-gate 	char		VendorName[CS_CLIENT_INFO_MAX_NAME_LEN];
237*0Sstevel@tonic-gate 	char		DriverName[MODMAXNAMELEN];
238*0Sstevel@tonic-gate } client_info_t;
239*0Sstevel@tonic-gate 
240*0Sstevel@tonic-gate /*
241*0Sstevel@tonic-gate  * Flags for client_info_t->Attributes
242*0Sstevel@tonic-gate  *
243*0Sstevel@tonic-gate  * The low order byte bit values are used to return the data passed
244*0Sstevel@tonic-gate  *	in to RegisterClient in the client_reg_t->Attributes member.
245*0Sstevel@tonic-gate  */
246*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_SOCKET_SERVICES	INFO_SOCKET_SERVICES
247*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_IO_CLIENT	INFO_IO_CLIENT
248*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_MTD_CLIENT	INFO_MTD_CLIENT
249*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_MEM_CLIENT	INFO_MEM_CLIENT
250*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_CSI_CLIENT	INFO_CSI_CLIENT
251*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_CARD_SHARE	INFO_CARD_SHARE
252*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_CARD_EXCL	INFO_CARD_EXCL
253*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_CLIENT_MASK	0x000000ff
254*0Sstevel@tonic-gate /*
255*0Sstevel@tonic-gate  * Control and status flags.
256*0Sstevel@tonic-gate  */
257*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_VALID		0x00010000	/* client info valid */
258*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_CLIENT_ACTIVE	0x00020000	/* client is for card */
259*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_FLAGS_MASK	0xffff0000
260*0Sstevel@tonic-gate /*
261*0Sstevel@tonic-gate  * Client Info subservice flags and types.
262*0Sstevel@tonic-gate  */
263*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_SUBSVC_CS	0x00000000	/* CS client data */
264*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_SUBSVC_MASK	0x0000ff00	/* sub-service mask */
265*0Sstevel@tonic-gate #define	GET_CLIENT_INFO_SUBSVC(s)	(((s) & CS_CLIENT_INFO_SUBSVC_MASK)>>8)
266*0Sstevel@tonic-gate #define	SET_CLIENT_INFO_SUBSVC(s)	(((s)<<8) & CS_CLIENT_INFO_SUBSVC_MASK)
267*0Sstevel@tonic-gate 
268*0Sstevel@tonic-gate /*
269*0Sstevel@tonic-gate  * CS_CLIENT_INFO_MAKE_DATE - Macro to make constructing the
270*0Sstevel@tonic-gate  *	client_info_t->RevDate member easier. Parameters are:
271*0Sstevel@tonic-gate  *
272*0Sstevel@tonic-gate  *	day - from 1 to 31
273*0Sstevel@tonic-gate  *	month - from 1 to 12
274*0Sstevel@tonic-gate  *	year - year relative to 1980
275*0Sstevel@tonic-gate  *			00 - 1980
276*0Sstevel@tonic-gate  *			06 - 1986
277*0Sstevel@tonic-gate  *			12 = 1992
278*0Sstevel@tonic-gate  *			16 - 1996, etc...
279*0Sstevel@tonic-gate  */
280*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_MAKE_DATE(d, m, y)	(((d) & 0x01f) |	\
281*0Sstevel@tonic-gate 						(((m) & 0x0f) << 5) |	\
282*0Sstevel@tonic-gate 						(((y) & 0x7f) << 9))
283*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_DAY(d)		((d) & 0x1f)
284*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_MONTH(m)		(((m) >> 5) & 0x0f)
285*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_YEAR(y)		((((y) >> 9) & 0x7f) + 1980)
286*0Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_YEAR_OFFSET(y)	(((y) >> 9) & 0x7f)
287*0Sstevel@tonic-gate 
288*0Sstevel@tonic-gate /*
289*0Sstevel@tonic-gate  * get_firstnext_client_t_t structure used for GetFirstClient and GetNextClient
290*0Sstevel@tonic-gate  */
291*0Sstevel@tonic-gate typedef struct get_firstnext_client_t {
292*0Sstevel@tonic-gate 	uint32_t	Socket;
293*0Sstevel@tonic-gate 	uint32_t	Attributes;
294*0Sstevel@tonic-gate 	client_handle_t	client_handle;		/* returned client handle */
295*0Sstevel@tonic-gate 	uint32_t	num_clients;
296*0Sstevel@tonic-gate } get_firstnext_client_t;
297*0Sstevel@tonic-gate 
298*0Sstevel@tonic-gate /*
299*0Sstevel@tonic-gate  * Flags for get_firstnext_client_t->Attributes
300*0Sstevel@tonic-gate  */
301*0Sstevel@tonic-gate #define	CS_GET_FIRSTNEXT_CLIENT_ALL_CLIENTS	0x00000001
302*0Sstevel@tonic-gate #define	CS_GET_FIRSTNEXT_CLIENT_SOCKET_ONLY	0x00000002
303*0Sstevel@tonic-gate 
304*0Sstevel@tonic-gate /*
305*0Sstevel@tonic-gate  * The client event callback argument structure - this is passed in to
306*0Sstevel@tonic-gate  *	the client event handler.  Most of these arguments are identical
307*0Sstevel@tonic-gate  *	to the PCMCIA-specified arguments.
308*0Sstevel@tonic-gate  */
309*0Sstevel@tonic-gate typedef struct event_callback_args_t {
310*0Sstevel@tonic-gate 	client_handle_t	client_handle;
311*0Sstevel@tonic-gate 	void		*info;
312*0Sstevel@tonic-gate 	void		*mtdrequest;
313*0Sstevel@tonic-gate 	void		*buffer;
314*0Sstevel@tonic-gate 	void		*misc;
315*0Sstevel@tonic-gate 	void		*client_data;
316*0Sstevel@tonic-gate 	client_info_t	client_info;
317*0Sstevel@tonic-gate } event_callback_args_t;
318*0Sstevel@tonic-gate 
319*0Sstevel@tonic-gate /*
320*0Sstevel@tonic-gate  * Event priority flag passed to the client's event handler; the client
321*0Sstevel@tonic-gate  *	uses this priority to determine which mutex to use.
322*0Sstevel@tonic-gate  */
323*0Sstevel@tonic-gate #define	CS_EVENT_PRI_LOW	0x0001
324*0Sstevel@tonic-gate #define	CS_EVENT_PRI_HIGH	0x0002
325*0Sstevel@tonic-gate #define	CS_EVENT_PRI_NONE	0x0004
326*0Sstevel@tonic-gate 
327*0Sstevel@tonic-gate /*
328*0Sstevel@tonic-gate  * Event-specific event_callback_args_t->info values
329*0Sstevel@tonic-gate  *
330*0Sstevel@tonic-gate  * CS_EVENT_WRITE_PROTECT
331*0Sstevel@tonic-gate  *	CS_EVENT_WRITE_PROTECT_WPOFF - card is not write protected
332*0Sstevel@tonic-gate  *	CS_EVENT_WRITE_PROTECT_WPON - card is write protected
333*0Sstevel@tonic-gate  */
334*0Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT_WPOFF	0x0000
335*0Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT_WPON	0xffff
336*0Sstevel@tonic-gate 
337*0Sstevel@tonic-gate /*
338*0Sstevel@tonic-gate  * Endinanness and data ordering Attribute bits common to both R2 and
339*0Sstevel@tonic-gate  *	CardBus windows and common to RequestIO, RequestWindow and
340*0Sstevel@tonic-gate  *	DupHandle.
341*0Sstevel@tonic-gate  */
342*0Sstevel@tonic-gate #define	WIN_ACC_ENDIAN_MASK	0x00300000	/* endian mask */
343*0Sstevel@tonic-gate #define	WIN_ACC_NEVER_SWAP	0x00000000	/* i/o access: no swap */
344*0Sstevel@tonic-gate #define	WIN_ACC_BIG_ENDIAN	0x00100000	/* big endian */
345*0Sstevel@tonic-gate #define	WIN_ACC_LITTLE_ENDIAN	0x00200000	/* little endian */
346*0Sstevel@tonic-gate 
347*0Sstevel@tonic-gate #define	WIN_ACC_ORDER_MASK	0x00700000	/* order mask */
348*0Sstevel@tonic-gate #define	WIN_ACC_STRICT_ORDER	0x00000000	/* strict order */
349*0Sstevel@tonic-gate #define	WIN_ACC_UNORDERED_OK	0x00100000	/* may be re-ordered */
350*0Sstevel@tonic-gate #define	WIN_ACC_MERGING_OK	0x00200000	/* may merge i/o */
351*0Sstevel@tonic-gate #define	WIN_ACC_LOADCACHING_OK	0x00300000	/* may cache reads */
352*0Sstevel@tonic-gate #define	WIN_ACC_STORECACHING_OK	0x00400000	/* may cache all i/o */
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate /*
355*0Sstevel@tonic-gate  * io_req_t structure used for RequestIO and ReleaseIO
356*0Sstevel@tonic-gate  */
357*0Sstevel@tonic-gate typedef struct io_req_t {
358*0Sstevel@tonic-gate 	uint32_t	Socket;
359*0Sstevel@tonic-gate 	baseaddru_t	BasePort1;
360*0Sstevel@tonic-gate 	uint32_t	NumPorts1;	/* 1st IO range no. contiguous ports */
361*0Sstevel@tonic-gate 	uint32_t	Attributes1;	/* 1st IO range attributes */
362*0Sstevel@tonic-gate 	baseaddru_t	BasePort2;
363*0Sstevel@tonic-gate 	uint32_t	NumPorts2;	/* 2nd IO range no. contiguous ports */
364*0Sstevel@tonic-gate 	uint32_t	Attributes2;	/* 2nd IO range attributes */
365*0Sstevel@tonic-gate 	uint32_t	IOAddrLines;	/* number of IO address lines decoded */
366*0Sstevel@tonic-gate } io_req_t;
367*0Sstevel@tonic-gate 
368*0Sstevel@tonic-gate /*
369*0Sstevel@tonic-gate  * Flags for RequestIO and ReleaseIO
370*0Sstevel@tonic-gate  */
371*0Sstevel@tonic-gate #define	IO_DATA_WIDTH_MASK	0x00000001	/* data path width mask */
372*0Sstevel@tonic-gate #define	IO_DATA_WIDTH_8		0x00000000	/* 8 bit data path */
373*0Sstevel@tonic-gate #define	IO_DATA_WIDTH_16	0x00000001	/* 16 bit data path */
374*0Sstevel@tonic-gate 
375*0Sstevel@tonic-gate /*
376*0Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
377*0Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
378*0Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
379*0Sstevel@tonic-gate  *	are set on a call to RequestIO, CS_BAD_ATTRIBUTE is returned.
380*0Sstevel@tonic-gate  */
381*0Sstevel@tonic-gate #define	IO_SHARED		0x00010000	/* for compatability only */
382*0Sstevel@tonic-gate #define	IO_FIRST_SHARED		0x00020000	/* for compatability only */
383*0Sstevel@tonic-gate #define	IO_FORCE_ALIAS_ACCESS	0x00040000	/* for compatability only */
384*0Sstevel@tonic-gate 
385*0Sstevel@tonic-gate /*
386*0Sstevel@tonic-gate  * The following flags are private to Card Services and should never be set
387*0Sstevel@tonic-gate  *	by a client.  Doing so will cause the system to take a supervisor
388*0Sstevel@tonic-gate  *	trap at level twenty-nine.
389*0Sstevel@tonic-gate  */
390*0Sstevel@tonic-gate #define	IO_DEALLOCATE_WINDOW	0x10000000	/* CS private */
391*0Sstevel@tonic-gate #define	IO_DISABLE_WINDOW	0x20000000	/* CS private */
392*0Sstevel@tonic-gate 
393*0Sstevel@tonic-gate /*
394*0Sstevel@tonic-gate  * win_req_t structure used for RequestWindow
395*0Sstevel@tonic-gate  *
396*0Sstevel@tonic-gate  * Note that the ReqOffset member is not defined in the current PCMCIA
397*0Sstevel@tonic-gate  *	spec but is included here to aid clients in determining the
398*0Sstevel@tonic-gate  *	optimum offset to give to MapMemPage.
399*0Sstevel@tonic-gate  */
400*0Sstevel@tonic-gate typedef struct win_req_t {
401*0Sstevel@tonic-gate 	uint32_t	Socket;
402*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* window flags */
403*0Sstevel@tonic-gate 	union {
404*0Sstevel@tonic-gate 	    uint32_t		base;	/* requested window base address */
405*0Sstevel@tonic-gate 	    acc_handle_t	handle;	/* access handle for base of window */
406*0Sstevel@tonic-gate 	} Base;
407*0Sstevel@tonic-gate 	uint32_t	Size;		/* window size requested/granted */
408*0Sstevel@tonic-gate 	union {
409*0Sstevel@tonic-gate 	    uint32_t		AccessSpeed;	/* window access speed */
410*0Sstevel@tonic-gate 	    uint32_t		IOAddrLines;	/* for I/O windows only */
411*0Sstevel@tonic-gate 	} win_params;
412*0Sstevel@tonic-gate 	uint32_t	ReqOffset;	/* required window offest */
413*0Sstevel@tonic-gate } win_req_t;
414*0Sstevel@tonic-gate 
415*0Sstevel@tonic-gate /*
416*0Sstevel@tonic-gate  * modify_win_t structure used for ModifyWindow
417*0Sstevel@tonic-gate  */
418*0Sstevel@tonic-gate typedef struct modify_win_t {
419*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* window flags */
420*0Sstevel@tonic-gate 	uint32_t	AccessSpeed;	/* window access speed */
421*0Sstevel@tonic-gate } modify_win_t;
422*0Sstevel@tonic-gate 
423*0Sstevel@tonic-gate /*
424*0Sstevel@tonic-gate  * Flags for RequestWindow and ModifyWindow
425*0Sstevel@tonic-gate  */
426*0Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_MASK	0x00000021	/* window type mask */
427*0Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_CM	0x00000000	/* window points to CM */
428*0Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_AM	0x00000001	/* window points to AM */
429*0Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_IO	0x00000020	/* window points to IO */
430*0Sstevel@tonic-gate 
431*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH_MASK	0x00000042	/* data path width mask */
432*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH_8	0x00000000	/* 8-bit data path */
433*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH_16	0x00000002	/* 16-bit data path */
434*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH_32	0x00000040	/* 32-bit data path */
435*0Sstevel@tonic-gate 
436*0Sstevel@tonic-gate #define	WIN_ENABLE		0x00000004	/* enable/disable window */
437*0Sstevel@tonic-gate #define	WIN_OFFSET_SIZE		0x00000008	/* card offsets window sized */
438*0Sstevel@tonic-gate #define	WIN_ACCESS_SPEED_VALID	0x00000010	/* speed valid (ModifyWindow) */
439*0Sstevel@tonic-gate 
440*0Sstevel@tonic-gate #define	WIN_PREFETCH_CACHE_MASK	0x00000300	/* prefetch/cache mask */
441*0Sstevel@tonic-gate #define	WIN_PREFETCH		0x00000100	/* prefetchable not cacheable */
442*0Sstevel@tonic-gate #define	WIN_PREFETCH_CACHE	0x00000200	/* prefetchable and cacheable */
443*0Sstevel@tonic-gate 
444*0Sstevel@tonic-gate #define	WIN_BAR_MASK		0x00007000	/* Base Address Register mask */
445*0Sstevel@tonic-gate #define	WIN_BAR_1		0x00001000	/* Base Address Register 1 */
446*0Sstevel@tonic-gate #define	WIN_BAR_2		0x00002000	/* Base Address Register 2 */
447*0Sstevel@tonic-gate #define	WIN_BAR_3		0x00003000	/* Base Address Register 3 */
448*0Sstevel@tonic-gate #define	WIN_BAR_4		0x00004000	/* Base Address Register 4 */
449*0Sstevel@tonic-gate #define	WIN_BAR_5		0x00005000	/* Base Address Register 5 */
450*0Sstevel@tonic-gate #define	WIN_BAR_6		0x00006000	/* Base Address Register 6 */
451*0Sstevel@tonic-gate #define	WIN_BAR_7		0x00007000	/* Base Address Register 7 */
452*0Sstevel@tonic-gate 
453*0Sstevel@tonic-gate /*
454*0Sstevel@tonic-gate  * The following flag is used internally by Card Services and should never
455*0Sstevel@tonic-gate  *	be set by the caller.
456*0Sstevel@tonic-gate  */
457*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH_VALID	0x00008000	/* CS internal */
458*0Sstevel@tonic-gate 
459*0Sstevel@tonic-gate /*
460*0Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
461*0Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
462*0Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
463*0Sstevel@tonic-gate  *	are set on a call to RequestWindow, CS_BAD_ATTRIBUTE is returned.
464*0Sstevel@tonic-gate  */
465*0Sstevel@tonic-gate #define	WIN_PAGED		0x00010000	/* for compatability only */
466*0Sstevel@tonic-gate #define	WIN_SHARED		0x00020000	/* for compatability only */
467*0Sstevel@tonic-gate #define	WIN_FIRST_SHARED	0x00040000	/* for compatability only */
468*0Sstevel@tonic-gate #define	WIN_BINDING_SPECIFIC	0x00080000	/* for compatability only */
469*0Sstevel@tonic-gate 
470*0Sstevel@tonic-gate /*
471*0Sstevel@tonic-gate  * The following flag is actually part of the AccessSpeed member
472*0Sstevel@tonic-gate  */
473*0Sstevel@tonic-gate #define	WIN_USE_WAIT		0x80	/* use window that supports WAIT */
474*0Sstevel@tonic-gate 
475*0Sstevel@tonic-gate /*
476*0Sstevel@tonic-gate  * client_reg_t structure for RegisterClient
477*0Sstevel@tonic-gate  */
478*0Sstevel@tonic-gate typedef struct client_reg_t {
479*0Sstevel@tonic-gate 	uint32_t		Attributes;
480*0Sstevel@tonic-gate 	uint32_t		EventMask;
481*0Sstevel@tonic-gate 	event_callback_args_t	event_callback_args;
482*0Sstevel@tonic-gate 	uint32_t		Version;	/* CS version to expect */
483*0Sstevel@tonic-gate 	csfunction_t		*event_handler;
484*0Sstevel@tonic-gate 	/* DDI support */
485*0Sstevel@tonic-gate 	ddi_iblock_cookie_t	*iblk_cookie;	/* event iblk cookie */
486*0Sstevel@tonic-gate 	ddi_idevice_cookie_t	*idev_cookie;	/* event idev cookie */
487*0Sstevel@tonic-gate 	dev_info_t		*dip;		/* client's dip */
488*0Sstevel@tonic-gate 	char			driver_name[MODMAXNAMELEN];
489*0Sstevel@tonic-gate 	/* CS private */
490*0Sstevel@tonic-gate 	void			*priv;		/* CS private data */
491*0Sstevel@tonic-gate } client_reg_t;
492*0Sstevel@tonic-gate 
493*0Sstevel@tonic-gate /*
494*0Sstevel@tonic-gate  * Flags for RegisterClient - some of these flags are also used internally
495*0Sstevel@tonic-gate  *	by CS to sequence the order of event callbacks and to allow Socket
496*0Sstevel@tonic-gate  *	Services to register as a "super" client.
497*0Sstevel@tonic-gate  *
498*0Sstevel@tonic-gate  * The client_reg_t->Attributes structure member uses these flags.
499*0Sstevel@tonic-gate  *
500*0Sstevel@tonic-gate  * The client_info_t->Attributes, client_types_t->type and client_t->flags
501*0Sstevel@tonic-gate  *	tructure members use these flags as well.
502*0Sstevel@tonic-gate  *
503*0Sstevel@tonic-gate  * Client types - mutually exclusive.
504*0Sstevel@tonic-gate  */
505*0Sstevel@tonic-gate #define	INFO_SOCKET_SERVICES	0x00000001
506*0Sstevel@tonic-gate #define	INFO_IO_CLIENT		0x00000002
507*0Sstevel@tonic-gate #define	INFO_MTD_CLIENT		0x00000004
508*0Sstevel@tonic-gate #define	INFO_MEM_CLIENT		0x00000008
509*0Sstevel@tonic-gate #define	INFO_CSI_CLIENT		0x00000010
510*0Sstevel@tonic-gate #define	INFO_CLIENT_TYPE_MASK	(INFO_SOCKET_SERVICES |		\
511*0Sstevel@tonic-gate 					INFO_IO_CLIENT |	\
512*0Sstevel@tonic-gate 					INFO_MTD_CLIENT	|	\
513*0Sstevel@tonic-gate 					INFO_MEM_CLIENT |	\
514*0Sstevel@tonic-gate 					INFO_CSI_CLIENT)
515*0Sstevel@tonic-gate #define	MAX_CLIENT_TYPES	3	/* doesn't include SS or CSI clients */
516*0Sstevel@tonic-gate 
517*0Sstevel@tonic-gate /*
518*0Sstevel@tonic-gate  * The following two are for backwards-compatability with the PCMCIA spec.
519*0Sstevel@tonic-gate  *	We will give the client CARD_INSERTION and REGISTRATION_COMPLETE
520*0Sstevel@tonic-gate  *	if either of these two bits are set.  Normally, all IO and MEM
521*0Sstevel@tonic-gate  *	clients should set both of these bits.
522*0Sstevel@tonic-gate  */
523*0Sstevel@tonic-gate #define	INFO_CARD_SHARE		0x00000020
524*0Sstevel@tonic-gate #define	INFO_CARD_EXCL		0x00000040
525*0Sstevel@tonic-gate #define	INFO_CARD_FLAGS_MASK	(INFO_CARD_SHARE | INFO_CARD_EXCL)
526*0Sstevel@tonic-gate 
527*0Sstevel@tonic-gate /*
528*0Sstevel@tonic-gate  * tuple_t struct used for GetFirstTuple, GetNextTuple, GetTupleData
529*0Sstevel@tonic-gate  *	and ParseTuple
530*0Sstevel@tonic-gate  *
531*0Sstevel@tonic-gate  * Note that the values for DesiredTuple are defined in the cis.h header
532*0Sstevel@tonic-gate  *	file.
533*0Sstevel@tonic-gate  */
534*0Sstevel@tonic-gate typedef struct tuple_t {
535*0Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number to get tuple from */
536*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* tuple return attributes */
537*0Sstevel@tonic-gate 	cisdata_t	DesiredTuple;	/* tuple to search for or flags */
538*0Sstevel@tonic-gate 	cisdata_t	TupleOffset;	/* offset in tuple data body */
539*0Sstevel@tonic-gate 	uint32_t	Flags;		/* CS private */
540*0Sstevel@tonic-gate 	cistpl_t	*LinkOffset;	/* CS private */
541*0Sstevel@tonic-gate 	cistpl_t	*CISOffset;	/* CS private */
542*0Sstevel@tonic-gate 	cisdata_t	TupleDataMax;	/* max size of tuple data area */
543*0Sstevel@tonic-gate 	cisdata_t	TupleDataLen;	/* actual size of tuple data area */
544*0Sstevel@tonic-gate 					/* tuple body data buffer */
545*0Sstevel@tonic-gate 	cisdata_t	TupleData[CIS_MAX_TUPLE_DATA_LEN];
546*0Sstevel@tonic-gate 	cisdata_t	TupleCode;	/* tuple type code */
547*0Sstevel@tonic-gate 	cisdata_t	TupleLink;	/* tuple data body size */
548*0Sstevel@tonic-gate } tuple_t;
549*0Sstevel@tonic-gate 
550*0Sstevel@tonic-gate /*
551*0Sstevel@tonic-gate  * Attribute flags definitions for CS tuple functions.
552*0Sstevel@tonic-gate  *
553*0Sstevel@tonic-gate  */
554*0Sstevel@tonic-gate #define	TUPLE_RETURN_LINK		0x00000002 /* return link tuples */
555*0Sstevel@tonic-gate #define	TUPLE_RETURN_IGNORED_TUPLES	0x00010000 /* return ignored tuples */
556*0Sstevel@tonic-gate #define	TUPLE_RETURN_NAME		0x00020000 /* return tuple name */
557*0Sstevel@tonic-gate 
558*0Sstevel@tonic-gate /*
559*0Sstevel@tonic-gate  * cisinfo_t structure used for ValidateCIS
560*0Sstevel@tonic-gate  */
561*0Sstevel@tonic-gate typedef struct cisinfo_t {
562*0Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number to validate CIS on */
563*0Sstevel@tonic-gate 	uint32_t	Chains;		/* number of tuple chains in CIS */
564*0Sstevel@tonic-gate 	uint32_t	Tuples;		/* total number of tuples in CIS */
565*0Sstevel@tonic-gate } cisinfo_t;
566*0Sstevel@tonic-gate 
567*0Sstevel@tonic-gate /*
568*0Sstevel@tonic-gate  * map_mem_page_t structure used for MapMemPage
569*0Sstevel@tonic-gate  */
570*0Sstevel@tonic-gate typedef struct map_mem_page_t {
571*0Sstevel@tonic-gate 	uint32_t	CardOffset;	/* card offset */
572*0Sstevel@tonic-gate 	uint32_t	Page;		/* page number */
573*0Sstevel@tonic-gate } map_mem_page_t;
574*0Sstevel@tonic-gate 
575*0Sstevel@tonic-gate /*
576*0Sstevel@tonic-gate  * sockevent_t structure used for GetEventMask and SetEventMask
577*0Sstevel@tonic-gate  */
578*0Sstevel@tonic-gate typedef struct sockevent_t {
579*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* attribute flags for call */
580*0Sstevel@tonic-gate 	uint32_t	EventMask;	/* event mask to set or return */
581*0Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number if necessary */
582*0Sstevel@tonic-gate } sockevent_t;
583*0Sstevel@tonic-gate 
584*0Sstevel@tonic-gate /*
585*0Sstevel@tonic-gate  * request_socket_mask_t structure used for RequestSocketMask
586*0Sstevel@tonic-gate  */
587*0Sstevel@tonic-gate typedef struct request_socket_mask_t {
588*0Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number if necessary */
589*0Sstevel@tonic-gate 	uint32_t	EventMask;	/* event mask to set or return */
590*0Sstevel@tonic-gate } request_socket_mask_t;
591*0Sstevel@tonic-gate 
592*0Sstevel@tonic-gate /*
593*0Sstevel@tonic-gate  * release_socket_mask_t structure used for ReleaseSocketMask
594*0Sstevel@tonic-gate  */
595*0Sstevel@tonic-gate typedef struct release_socket_mask_t {
596*0Sstevel@tonic-gate 	uint32_t	Socket;
597*0Sstevel@tonic-gate } release_socket_mask_t;
598*0Sstevel@tonic-gate 
599*0Sstevel@tonic-gate /*
600*0Sstevel@tonic-gate  * Flags for GetEventMask and SetEventMask
601*0Sstevel@tonic-gate  */
602*0Sstevel@tonic-gate #define	CONF_EVENT_MASK_GLOBAL	0x00000000	/* global event mask */
603*0Sstevel@tonic-gate #define	CONF_EVENT_MASK_CLIENT	0x00000001	/* client event mask */
604*0Sstevel@tonic-gate #define	CONF_EVENT_MASK_VALID	0x00000001	/* client event mask */
605*0Sstevel@tonic-gate 
606*0Sstevel@tonic-gate /*
607*0Sstevel@tonic-gate  * convert_speed_t structure used for ConvertSpeed
608*0Sstevel@tonic-gate  */
609*0Sstevel@tonic-gate typedef struct convert_speed_t {
610*0Sstevel@tonic-gate 	uint32_t	Attributes;
611*0Sstevel@tonic-gate 	uint32_t	nS;
612*0Sstevel@tonic-gate 	uint32_t	devspeed;
613*0Sstevel@tonic-gate } convert_speed_t;
614*0Sstevel@tonic-gate 
615*0Sstevel@tonic-gate /*
616*0Sstevel@tonic-gate  * Flags for ConvertSpeed
617*0Sstevel@tonic-gate  */
618*0Sstevel@tonic-gate #define	CONVERT_NS_TO_DEVSPEED	0x00000001
619*0Sstevel@tonic-gate #define	CONVERT_DEVSPEED_TO_NS	0x00000002
620*0Sstevel@tonic-gate 
621*0Sstevel@tonic-gate /*
622*0Sstevel@tonic-gate  * convert_size_t structure used for ConvertSize
623*0Sstevel@tonic-gate  */
624*0Sstevel@tonic-gate typedef struct convert_size_t {
625*0Sstevel@tonic-gate 	uint32_t	Attributes;
626*0Sstevel@tonic-gate 	uint32_t	bytes;
627*0Sstevel@tonic-gate 	uint32_t	devsize;
628*0Sstevel@tonic-gate } convert_size_t;
629*0Sstevel@tonic-gate 
630*0Sstevel@tonic-gate /*
631*0Sstevel@tonic-gate  * Flags for ConvertSize
632*0Sstevel@tonic-gate  */
633*0Sstevel@tonic-gate #define	CONVERT_BYTES_TO_DEVSIZE	0x00000001
634*0Sstevel@tonic-gate #define	CONVERT_DEVSIZE_TO_BYTES	0x00000002
635*0Sstevel@tonic-gate 
636*0Sstevel@tonic-gate #define	MAX_CS_EVENT_BUFSIZE		64	/* single event */
637*0Sstevel@tonic-gate #define	MAX_MULTI_EVENT_BUFSIZE		512	/* all events */
638*0Sstevel@tonic-gate 
639*0Sstevel@tonic-gate #define	CS_EVENT_MAX_BUFSIZE	MAX_MULTI_EVENT_BUFSIZE
640*0Sstevel@tonic-gate #define	CS_ERROR_MAX_BUFSIZE	MAX_CS_EVENT_BUFSIZE
641*0Sstevel@tonic-gate 
642*0Sstevel@tonic-gate /*
643*0Sstevel@tonic-gate  * event2text_t structure used for Event2Text
644*0Sstevel@tonic-gate  */
645*0Sstevel@tonic-gate typedef struct event2text_t {
646*0Sstevel@tonic-gate 	event_t		event;		/* events */
647*0Sstevel@tonic-gate 					/* buffer to return text strings */
648*0Sstevel@tonic-gate 	char		text[CS_EVENT_MAX_BUFSIZE];
649*0Sstevel@tonic-gate } event2text_t;
650*0Sstevel@tonic-gate 
651*0Sstevel@tonic-gate /*
652*0Sstevel@tonic-gate  * error2text_t structure used for Error2Text
653*0Sstevel@tonic-gate  */
654*0Sstevel@tonic-gate typedef struct error2text_t {
655*0Sstevel@tonic-gate 	uint32_t	item;
656*0Sstevel@tonic-gate 	char		text[CS_ERROR_MAX_BUFSIZE];
657*0Sstevel@tonic-gate } error2text_t;
658*0Sstevel@tonic-gate 
659*0Sstevel@tonic-gate /*
660*0Sstevel@tonic-gate  * get_status_t structure used for GetStatus
661*0Sstevel@tonic-gate  *
662*0Sstevel@tonic-gate  * The values in the status members are the same as the CS_EVENT_XXX values.
663*0Sstevel@tonic-gate  */
664*0Sstevel@tonic-gate typedef struct get_status_t {
665*0Sstevel@tonic-gate 	uint32_t	Socket;
666*0Sstevel@tonic-gate 	uint32_t	CardState;	/* "live" card status for this client */
667*0Sstevel@tonic-gate 	uint32_t	SocketState;	/* latched socket values */
668*0Sstevel@tonic-gate 	uint32_t	raw_CardState;	/* raw live card status */
669*0Sstevel@tonic-gate } get_status_t;
670*0Sstevel@tonic-gate 
671*0Sstevel@tonic-gate /*
672*0Sstevel@tonic-gate  * GetStatus returns card state using the same bit definitions
673*0Sstevel@tonic-gate  *	as the CS_EVENT_XXX bits. Some of the CS_EVENT_XXX bits
674*0Sstevel@tonic-gate  *	are not meaningful for GetStatus and are reused here for
675*0Sstevel@tonic-gate  *	status definitions.
676*0Sstevel@tonic-gate  *
677*0Sstevel@tonic-gate  * get_status_t->CardState and get_status_t->raw_CardState bits
678*0Sstevel@tonic-gate  */
679*0Sstevel@tonic-gate #define	CS_STATUS_WRITE_PROTECTED	CS_EVENT_WRITE_PROTECT
680*0Sstevel@tonic-gate #define	CS_STATUS_CARD_LOCKED		CS_EVENT_CARD_LOCK
681*0Sstevel@tonic-gate #define	CS_STATUS_EJECTION_REQUEST	CS_EVENT_EJECTION_REQUEST
682*0Sstevel@tonic-gate #define	CS_STATUS_INSERTION_REQUEST	CS_EVENT_INSERTION_REQUEST
683*0Sstevel@tonic-gate #define	CS_STATUS_BATTERY_DEAD		CS_EVENT_BATTERY_DEAD
684*0Sstevel@tonic-gate #define	CS_STATUS_BATTERY_LOW		CS_EVENT_BATTERY_LOW
685*0Sstevel@tonic-gate #define	CS_STATUS_CARD_READY		CS_EVENT_CARD_READY
686*0Sstevel@tonic-gate #define	CS_STATUS_CARD_INSERTED		CS_EVENT_CARD_INSERTION
687*0Sstevel@tonic-gate #define	CS_STATUS_RES_EVT1		0x00100000
688*0Sstevel@tonic-gate #define	CS_STATUS_RES_EVT2		0x00200000
689*0Sstevel@tonic-gate #define	CS_STATUS_RES_EVT3		0x00400000
690*0Sstevel@tonic-gate #define	CS_STATUS_VCC_50		0x10000000
691*0Sstevel@tonic-gate #define	CS_STATUS_VCC_33		0x20000000
692*0Sstevel@tonic-gate #define	CS_STATUS_VCC_XX		0x40000000
693*0Sstevel@tonic-gate #define	CS_STATUS_REQ_ATTN		0x80000000
694*0Sstevel@tonic-gate /*
695*0Sstevel@tonic-gate  * get_status_t->SocketState bits
696*0Sstevel@tonic-gate  */
697*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_WRITE_PROTECT_CHANGE	CS_EVENT_WRITE_PROTECT
698*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_LOCK_CHNAGE		CS_EVENT_CARD_LOCK
699*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_EJECTION_PENDING		CS_EVENT_EJECTION_REQUEST
700*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_INSERTION_PENDING	CS_EVENT_INSERTION_REQUEST
701*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_BATTERY_DEAD_CHNAGE	CS_EVENT_BATTERY_DEAD
702*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_BATTERY_LOW_CHNAGE	CS_EVENT_BATTERY_LOW
703*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_READY_CHANGE	CS_EVENT_CARD_READY
704*0Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_DETECT_CHNAGE	CS_EVENT_CARD_INSERTION
705*0Sstevel@tonic-gate 
706*0Sstevel@tonic-gate /*
707*0Sstevel@tonic-gate  * map_log_socket_t structure used for MapLogSocket
708*0Sstevel@tonic-gate  */
709*0Sstevel@tonic-gate typedef struct map_log_socket_t {
710*0Sstevel@tonic-gate 	uint32_t	LogSocket;	/* logical socket */
711*0Sstevel@tonic-gate 	uint32_t	PhyAdapter;	/* physical adapter */
712*0Sstevel@tonic-gate 	uint32_t	PhySocket;	/* physical socket */
713*0Sstevel@tonic-gate } map_log_socket_t;
714*0Sstevel@tonic-gate 
715*0Sstevel@tonic-gate /*
716*0Sstevel@tonic-gate  * get_physical_adapter_info_t structure used for GetPhysicalAdapterInfo
717*0Sstevel@tonic-gate  */
718*0Sstevel@tonic-gate typedef struct get_physical_adapter_info_t {
719*0Sstevel@tonic-gate 	uint32_t	LogSocket;	/* logical socket */
720*0Sstevel@tonic-gate 	uint32_t	PhySocket;	/* physical socket */
721*0Sstevel@tonic-gate 	uint32_t	flags;		/* adapter flags */
722*0Sstevel@tonic-gate 	char		name[MODMAXNAMELEN]; /* adapter module name */
723*0Sstevel@tonic-gate 	uint32_t	major;		/* adapter major number */
724*0Sstevel@tonic-gate 	uint32_t	minor;		/* adapter minor number */
725*0Sstevel@tonic-gate 	uint32_t	instance;	/* instance number of this adapter */
726*0Sstevel@tonic-gate 	uint32_t	number;		/* canonical adapter number */
727*0Sstevel@tonic-gate 	uint32_t	num_sockets;	/* # sockets on this adapter */
728*0Sstevel@tonic-gate 	uint32_t	first_socket;	/* first socket # on this adapter */
729*0Sstevel@tonic-gate } get_physical_adapter_info_t;
730*0Sstevel@tonic-gate 
731*0Sstevel@tonic-gate /*
732*0Sstevel@tonic-gate  * irq_req_t structure used for RequestIRQ and ReleaseIRQ
733*0Sstevel@tonic-gate  */
734*0Sstevel@tonic-gate typedef struct irq_req_t {
735*0Sstevel@tonic-gate 	uint32_t		Socket;
736*0Sstevel@tonic-gate 	uint32_t		Attributes;	/* IRQ attribute flags */
737*0Sstevel@tonic-gate 	csfunction_t		*irq_handler;
738*0Sstevel@tonic-gate 	void			*irq_handler_arg;
739*0Sstevel@tonic-gate 	ddi_iblock_cookie_t	*iblk_cookie;	/* IRQ iblk cookie */
740*0Sstevel@tonic-gate 	ddi_idevice_cookie_t	*idev_cookie;	/* IRQ idev cookie */
741*0Sstevel@tonic-gate } irq_req_t;
742*0Sstevel@tonic-gate 
743*0Sstevel@tonic-gate /*
744*0Sstevel@tonic-gate  * Flags for RequestIRQ and ReleaseIRQ
745*0Sstevel@tonic-gate  */
746*0Sstevel@tonic-gate #define	IRQ_TYPE_EXCLUSIVE		0x00000002
747*0Sstevel@tonic-gate /*
748*0Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
749*0Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
750*0Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
751*0Sstevel@tonic-gate  *	are set on a call to RequestIRQ, CS_BAD_ATTRIBUTE is returned.
752*0Sstevel@tonic-gate  */
753*0Sstevel@tonic-gate #define	IRQ_FORCED_PULSE		0x00010000
754*0Sstevel@tonic-gate #define	IRQ_TYPE_TIME			0x00020000
755*0Sstevel@tonic-gate #define	IRQ_TYPE_DYNAMIC_SHARING	0x00040000
756*0Sstevel@tonic-gate #define	IRQ_FIRST_SHARED		0x00080000
757*0Sstevel@tonic-gate #define	IRQ_PULSE_ALLOCATED		0x00100000
758*0Sstevel@tonic-gate 
759*0Sstevel@tonic-gate /*
760*0Sstevel@tonic-gate  * release_config_t structure used for ReleaseConfiguration
761*0Sstevel@tonic-gate  */
762*0Sstevel@tonic-gate typedef struct release_config_t {
763*0Sstevel@tonic-gate 	uint32_t	Socket;
764*0Sstevel@tonic-gate } release_config_t;
765*0Sstevel@tonic-gate 
766*0Sstevel@tonic-gate /*
767*0Sstevel@tonic-gate  * config_req_t structure used for RequestConfiguration
768*0Sstevel@tonic-gate  */
769*0Sstevel@tonic-gate typedef struct config_req_t {
770*0Sstevel@tonic-gate 	uint32_t	Socket;
771*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* configuration attributes */
772*0Sstevel@tonic-gate 	uint32_t	Vcc;		/* Vcc value */
773*0Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
774*0Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
775*0Sstevel@tonic-gate 	uint32_t	IntType;	/* socket interface type - mem or IO */
776*0Sstevel@tonic-gate 	uint32_t	ConfigBase;	/* offset from start of AM space */
777*0Sstevel@tonic-gate 	uint32_t	Status;		/* value to write to STATUS register */
778*0Sstevel@tonic-gate 	uint32_t	Pin;		/* value to write to PRR */
779*0Sstevel@tonic-gate 	uint32_t	Copy;		/* value to write to COPY register */
780*0Sstevel@tonic-gate 	uint32_t	ConfigIndex;	/* value to write to COR */
781*0Sstevel@tonic-gate 	uint32_t	Present;	/* which config registers present */
782*0Sstevel@tonic-gate 	uint32_t	ExtendedStatus;	/* value to write to EXSTAT register */
783*0Sstevel@tonic-gate } config_req_t;
784*0Sstevel@tonic-gate 
785*0Sstevel@tonic-gate /*
786*0Sstevel@tonic-gate  * Flags for RequestConfiguration - note that the CONF_ENABLE_IRQ_STEERING
787*0Sstevel@tonic-gate  *	flag shares the same bit field as the Attributes flags for
788*0Sstevel@tonic-gate  *	ModifyConfiguration.
789*0Sstevel@tonic-gate  */
790*0Sstevel@tonic-gate #define	CONF_ENABLE_IRQ_STEERING	0x00010000
791*0Sstevel@tonic-gate /*
792*0Sstevel@tonic-gate  * The following flags are used for the IntType member to specify which
793*0Sstevel@tonic-gate  *	type of socket interface the client wants.
794*0Sstevel@tonic-gate  */
795*0Sstevel@tonic-gate #define	SOCKET_INTERFACE_MEMORY		0x00000001
796*0Sstevel@tonic-gate #define	SOCKET_INTERFACE_MEMORY_AND_IO	0x00000002
797*0Sstevel@tonic-gate /*
798*0Sstevel@tonic-gate  * The following flags are used for the Present member to specify which
799*0Sstevel@tonic-gate  *	configuration registers are present.  They may also be used by
800*0Sstevel@tonic-gate  *	clients for their internal state.
801*0Sstevel@tonic-gate  */
802*0Sstevel@tonic-gate #define	CONFIG_OPTION_REG_PRESENT	0x00000001 /* COR present */
803*0Sstevel@tonic-gate #define	CONFIG_STATUS_REG_PRESENT	0x00000002 /* STAT reg present */
804*0Sstevel@tonic-gate #define	CONFIG_PINREPL_REG_PRESENT	0x00000004 /* PRR present */
805*0Sstevel@tonic-gate #define	CONFIG_COPY_REG_PRESENT		0x00000008 /* COPY reg present */
806*0Sstevel@tonic-gate #define	CONFIG_EXSTAT_REG_PRESENT	0x00000010 /* EXSTAT reg present */
807*0Sstevel@tonic-gate #define	CONFIG_IOBASE0_REG_PRESENT	0x00000020 /* IOBASE0 reg present */
808*0Sstevel@tonic-gate #define	CONFIG_IOBASE1_REG_PRESENT	0x00000040 /* IOBASE1 reg present */
809*0Sstevel@tonic-gate #define	CONFIG_IOBASE2_REG_PRESENT	0x00000080 /* IOBASE2 reg present */
810*0Sstevel@tonic-gate #define	CONFIG_IOBASE3_REG_PRESENT	0x00000100 /* IOBASE3 reg present */
811*0Sstevel@tonic-gate #define	CONFIG_IOLIMIT_REG_PRESENT	0x00000200 /* IOLIMIT reg present */
812*0Sstevel@tonic-gate 
813*0Sstevel@tonic-gate /*
814*0Sstevel@tonic-gate  * CONFIG_IOBASE_REG_MASK - mask of IO Base Port register present bits
815*0Sstevel@tonic-gate  * CONFIG_IOBASE_REG_SHIFT - shifts IO Base Port register present bits
816*0Sstevel@tonic-gate  */
817*0Sstevel@tonic-gate #define	CONFIG_IOBASE_REG_MASK		0x000001e0 /* IOBASEn present mask */
818*0Sstevel@tonic-gate #define	CONFIG_IOBASE_REG_SHIFT		5
819*0Sstevel@tonic-gate 
820*0Sstevel@tonic-gate /*
821*0Sstevel@tonic-gate  * Bit definitions for configuration registers.
822*0Sstevel@tonic-gate  *
823*0Sstevel@tonic-gate  * Pin Replacement Register (PRR) bits - these are used for calls to
824*0Sstevel@tonic-gate  *	RequestConfiguration, AccessConfigurationRegister and
825*0Sstevel@tonic-gate  *	GetConfigurationInfo, as well as internally by clients
826*0Sstevel@tonic-gate  *	and Card Services.
827*0Sstevel@tonic-gate  * To inform Card Services that a particular bit in the PRR is valid on
828*0Sstevel@tonic-gate  *	a call to RequestConfiguration, both the XXX_STATUS and the
829*0Sstevel@tonic-gate  *	XXX_EVENT bits must be set.
830*0Sstevel@tonic-gate  */
831*0Sstevel@tonic-gate #define	PRR_WP_STATUS		0x01	/* R-WP state W-write WP Cbit */
832*0Sstevel@tonic-gate #define	PRR_READY_STATUS	0x02	/* R-READY state W-write READY Cbit */
833*0Sstevel@tonic-gate #define	PRR_BVD2_STATUS		0x04	/* R-BVD2 state W-write BVD2 Cbit */
834*0Sstevel@tonic-gate #define	PRR_BVD1_STATUS		0x08	/* R-BVD1 state W-write BVD1 Cbit */
835*0Sstevel@tonic-gate #define	PRR_WP_EVENT		0x10	/* WP changed */
836*0Sstevel@tonic-gate #define	PRR_READY_EVENT		0x20	/* READY changed */
837*0Sstevel@tonic-gate #define	PRR_BVD2_EVENT		0x40	/* BVD2 changed */
838*0Sstevel@tonic-gate #define	PRR_BVD1_EVENT		0x80	/* BVD1 changed */
839*0Sstevel@tonic-gate /*
840*0Sstevel@tonic-gate  * Configuration Option Register (COR) bits
841*0Sstevel@tonic-gate  */
842*0Sstevel@tonic-gate #define	COR_ENABLE_FUNCTION	0x01	/* enable function */
843*0Sstevel@tonic-gate #define	COR_ENABLE_BASE_LIMIT	0x02	/* enable base and limit registers */
844*0Sstevel@tonic-gate #define	COR_ENABLE_IREQ_ROUTING	0x04	/* enable IREQ routing */
845*0Sstevel@tonic-gate #define	COR_STATUS_CHANGE_MODE	0x08	/* status change mode */
846*0Sstevel@tonic-gate #define	COR_LEVEL_IRQ		0x40	/* set to enable level interrupts */
847*0Sstevel@tonic-gate #define	COR_SOFT_RESET		0x80	/* soft reset bit */
848*0Sstevel@tonic-gate /*
849*0Sstevel@tonic-gate  * Card Configuration Status Register (CCSR)
850*0Sstevel@tonic-gate  */
851*0Sstevel@tonic-gate #define	CCSR_INTR_ACK		0x01	/* interrupt acknowledge */
852*0Sstevel@tonic-gate #define	CCSR_INTR		0x02	/* interrupt pending */
853*0Sstevel@tonic-gate #define	CCSR_POWER_DOWN		0x04	/* power down card */
854*0Sstevel@tonic-gate #define	CCSR_AUDIO		0x08	/* enable Audio signal */
855*0Sstevel@tonic-gate #define	CCSR_IO_IS_8		0x20	/* only 8-bit IO data path */
856*0Sstevel@tonic-gate #define	CCSR_SIG_CHG		0x40	/* enable status changes */
857*0Sstevel@tonic-gate #define	CCSR_CHANGED		0x80	/* one of the PRR bits has changed */
858*0Sstevel@tonic-gate /*
859*0Sstevel@tonic-gate  * Macros to manipulate the Socket and Copy Register (SCR) values
860*0Sstevel@tonic-gate  */
861*0Sstevel@tonic-gate #define	SCR_GET_SOCKET(r)		((r)&0x0f)
862*0Sstevel@tonic-gate #define	SCR_GET_COPY(r)			(((r)>>4)&7)
863*0Sstevel@tonic-gate #define	SCR_SET_SOCKET(s)		((s)&0x0f)
864*0Sstevel@tonic-gate #define	SCR_SET_COPY(c)			(((c)&7)<<4)
865*0Sstevel@tonic-gate #define	SCR_SET_SOCKET_COPY(s, c)	(((s)&0x0f) | (((c)&7)<<4))
866*0Sstevel@tonic-gate 
867*0Sstevel@tonic-gate /*
868*0Sstevel@tonic-gate  * modify_config_t structure used for ModifyConfiguration
869*0Sstevel@tonic-gate  */
870*0Sstevel@tonic-gate typedef struct modify_config_t {
871*0Sstevel@tonic-gate 	uint32_t	Socket;
872*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* attributes to modify */
873*0Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
874*0Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
875*0Sstevel@tonic-gate } modify_config_t;
876*0Sstevel@tonic-gate 
877*0Sstevel@tonic-gate /*
878*0Sstevel@tonic-gate  * Flags for ModifyConfiguration - note that the CONF_ENABLE_IRQ_STEERING
879*0Sstevel@tonic-gate  *	flag used with RequestConfiguration shares this bit field.
880*0Sstevel@tonic-gate  */
881*0Sstevel@tonic-gate #define	CONF_VPP1_CHANGE_VALID		0x00000002	/* Vpp1 is valid */
882*0Sstevel@tonic-gate #define	CONF_VPP2_CHANGE_VALID		0x00000004	/* Vpp2 is valid */
883*0Sstevel@tonic-gate #define	CONF_IRQ_CHANGE_VALID		0x00000008	/* IRQ is valid */
884*0Sstevel@tonic-gate 
885*0Sstevel@tonic-gate /*
886*0Sstevel@tonic-gate  * access_config_reg_t structure used for AccessConfigurationRegister
887*0Sstevel@tonic-gate  */
888*0Sstevel@tonic-gate typedef struct access_config_reg_t {
889*0Sstevel@tonic-gate 	uint32_t	Socket;
890*0Sstevel@tonic-gate 	uint32_t	Action;		/* register access operation */
891*0Sstevel@tonic-gate 	uint32_t	Offset;		/* config register offset */
892*0Sstevel@tonic-gate 	uint32_t	Value;		/* value read or written */
893*0Sstevel@tonic-gate } access_config_reg_t;
894*0Sstevel@tonic-gate /*
895*0Sstevel@tonic-gate  * Flags for AccessConfigurationRegister
896*0Sstevel@tonic-gate  */
897*0Sstevel@tonic-gate #define	CONFIG_REG_READ		0x00000001	/* read config register */
898*0Sstevel@tonic-gate #define	CONFIG_REG_WRITE	0x00000002	/* write config register */
899*0Sstevel@tonic-gate /*
900*0Sstevel@tonic-gate  * The following offsets are used to specify the configuration register
901*0Sstevel@tonic-gate  *	offset to AccessConfigurationRegister
902*0Sstevel@tonic-gate  */
903*0Sstevel@tonic-gate #define	CONFIG_OPTION_REG_OFFSET	0x00	/* COR offset */
904*0Sstevel@tonic-gate #define	CONFIG_STATUS_REG_OFFSET	0x02	/* STAT reg offset */
905*0Sstevel@tonic-gate #define	CONFIG_PINREPL_REG_OFFSET	0x04	/* PRR offset */
906*0Sstevel@tonic-gate #define	CONFIG_COPY_REG_OFFSET		0x06	/* COPY reg offset */
907*0Sstevel@tonic-gate #define	CONFIG_EXSTAT_REG_OFFSET	0x08	/* EXSTAT reg offset */
908*0Sstevel@tonic-gate #define	CONFIG_IOBASE0_REG_OFFSET	0x0a	/* IOBASE0 reg offset */
909*0Sstevel@tonic-gate #define	CONFIG_IOBASE1_REG_OFFSET	0x0c	/* IOBASE1 reg offset */
910*0Sstevel@tonic-gate #define	CONFIG_IOBASE2_REG_OFFSET	0x0e	/* IOBASE2 reg offset */
911*0Sstevel@tonic-gate #define	CONFIG_IOBASE3_REG_OFFSET	0x10	/* IOBASE3 reg offset */
912*0Sstevel@tonic-gate #define	CONFIG_IOLIMIT_REG_OFFSET	0x12	/* IOLIMIT reg offset */
913*0Sstevel@tonic-gate 
914*0Sstevel@tonic-gate /*
915*0Sstevel@tonic-gate  * reset_function_t structure used for ResetFunction
916*0Sstevel@tonic-gate  */
917*0Sstevel@tonic-gate typedef struct reset_function_t {
918*0Sstevel@tonic-gate 	uint32_t	Socket;
919*0Sstevel@tonic-gate 	uint32_t	Attributes;
920*0Sstevel@tonic-gate } reset_function_t;
921*0Sstevel@tonic-gate 
922*0Sstevel@tonic-gate /*
923*0Sstevel@tonic-gate  * get_cardservices_info_t structure used for GetCardServicesInfo
924*0Sstevel@tonic-gate  */
925*0Sstevel@tonic-gate #define	CS_GET_CARDSERVICES_INFO_MAX_VS_LEN	512
926*0Sstevel@tonic-gate typedef struct get_cardservices_info_t {
927*0Sstevel@tonic-gate 	char		Signature[2];	/* CS signature bytes */
928*0Sstevel@tonic-gate 	uint32_t	NumSockets;	/* number of sockets */
929*0Sstevel@tonic-gate 	uint32_t	Revision;	/* BCD value of CS revision */
930*0Sstevel@tonic-gate 	uint32_t	CSLevel;	/* BCD value of CS release */
931*0Sstevel@tonic-gate 	uint32_t	FuncsPerSocket;	/* max number of functions per socket */
932*0Sstevel@tonic-gate 	char		VendorString[CS_GET_CARDSERVICES_INFO_MAX_VS_LEN];
933*0Sstevel@tonic-gate } get_cardservices_info_t;
934*0Sstevel@tonic-gate 
935*0Sstevel@tonic-gate /*
936*0Sstevel@tonic-gate  * get_configuration_info_t structure used by GetConfigurationInfo
937*0Sstevel@tonic-gate  */
938*0Sstevel@tonic-gate typedef struct get_configuration_info_t {
939*0Sstevel@tonic-gate 	uint32_t	Socket;		/* Socket/function to get info for */
940*0Sstevel@tonic-gate 	uint32_t	Attributes;	/* configuration attributes */
941*0Sstevel@tonic-gate 	uint32_t	Vcc;		/* Vcc value */
942*0Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
943*0Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
944*0Sstevel@tonic-gate 	uint32_t	IntType;	/* memory only or memory and IO ifc */
945*0Sstevel@tonic-gate 	uint32_t	ConfigBase;	/* offset from start of AM space */
946*0Sstevel@tonic-gate 	uint32_t	Status;		/* value written to STATUS register */
947*0Sstevel@tonic-gate 	uint32_t	Pin;		/* value written to PRR */
948*0Sstevel@tonic-gate 	uint32_t	Copy;		/* value to written COPY register */
949*0Sstevel@tonic-gate 	uint32_t	Option;		/* which written to COR */
950*0Sstevel@tonic-gate 	uint32_t	Present;	/* which config registers present */
951*0Sstevel@tonic-gate 	uint32_t	FirstDevType;	/* from CISTPL_DEVICE */
952*0Sstevel@tonic-gate 	uint32_t	FuncCode;	/* from CISTPL_FUNCID */
953*0Sstevel@tonic-gate 	uint32_t	SysInitMask;	/* from CISTPL_FUNCID */
954*0Sstevel@tonic-gate 	uint32_t	ManufCode;	/* from CISTPL_MANFID */
955*0Sstevel@tonic-gate 	uint32_t	ManufInfo;	/* from CISTPL_MANFID */
956*0Sstevel@tonic-gate 	uint32_t	CardValues;	/* which config registers written */
957*0Sstevel@tonic-gate 	uint32_t	AssignedIRQ;	/* IRQ assigned to card */
958*0Sstevel@tonic-gate 	uint32_t	IRQ_Attributes;	/* IRQ attributes */
959*0Sstevel@tonic-gate 	uint32_t	BasePort1;	/* address of 1st IO range */
960*0Sstevel@tonic-gate 	uint32_t	NumPorts1;	/* 1st IO range no. contiguous ports */
961*0Sstevel@tonic-gate 	uint32_t	Attributes1;	/* 1st IO range attributes */
962*0Sstevel@tonic-gate 	uint32_t	BasePort2;	/* address of 2nd IO range */
963*0Sstevel@tonic-gate 	uint32_t	NumPorts2;	/* 2nd IO range no. contiguous ports */
964*0Sstevel@tonic-gate 	uint32_t	Attributes2;	/* 2nd IO range attributes */
965*0Sstevel@tonic-gate 	uint32_t	IOAddrLines;	/* number of IO address lines decoded */
966*0Sstevel@tonic-gate 	uint32_t	ExStat;		/* value written to EXSTAT register */
967*0Sstevel@tonic-gate 	uint32_t	DMA_Attributes;	/* signals used for DMA */
968*0Sstevel@tonic-gate 	uint32_t	DMA_Assign_Chan;	/* assigned DMA channel */
969*0Sstevel@tonic-gate 	uint32_t	NumIOWindows;	/* number of IO windows in use */
970*0Sstevel@tonic-gate 	uint32_t	NumMemWindows;	/* number of memory windows in use */
971*0Sstevel@tonic-gate } get_configuration_info_t;
972*0Sstevel@tonic-gate 
973*0Sstevel@tonic-gate /*
974*0Sstevel@tonic-gate  * devnode_desc_t structure used in make_device_node_t and remove_device_node_t
975*0Sstevel@tonic-gate  *	for MakeDeviceNode and RemoveDeviceNode
976*0Sstevel@tonic-gate  */
977*0Sstevel@tonic-gate typedef struct devnode_desc_t {
978*0Sstevel@tonic-gate 	char	*name;		/* device node path and name */
979*0Sstevel@tonic-gate 	int32_t	spec_type;	/* dev special type (block or char) */
980*0Sstevel@tonic-gate 	int32_t	minor_num;	/* device node minor number */
981*0Sstevel@tonic-gate 	char	*node_type;	/* device node type */
982*0Sstevel@tonic-gate } devnode_desc_t;
983*0Sstevel@tonic-gate 
984*0Sstevel@tonic-gate /*
985*0Sstevel@tonic-gate  * make_device_node_t structure used for MakeDeviceNode
986*0Sstevel@tonic-gate  */
987*0Sstevel@tonic-gate typedef struct make_device_node_t {
988*0Sstevel@tonic-gate 	uint32_t	Action;		/* device operation */
989*0Sstevel@tonic-gate 	uint32_t	NumDevNodes;	/* number of nodes to create */
990*0Sstevel@tonic-gate 	devnode_desc_t	*devnode_desc;	/* description of device nodes */
991*0Sstevel@tonic-gate } make_device_node_t;
992*0Sstevel@tonic-gate /*
993*0Sstevel@tonic-gate  * Action values for MakeDeviceNode
994*0Sstevel@tonic-gate  */
995*0Sstevel@tonic-gate #define	CREATE_DEVICE_NODE		0x01	/* create device node */
996*0Sstevel@tonic-gate 
997*0Sstevel@tonic-gate /*
998*0Sstevel@tonic-gate  * remove_device_node_t structure used for RemoveDeviceNode
999*0Sstevel@tonic-gate  */
1000*0Sstevel@tonic-gate typedef struct remove_device_node_t {
1001*0Sstevel@tonic-gate 	uint32_t	Action;		/* device operation */
1002*0Sstevel@tonic-gate 	uint32_t	NumDevNodes;	/* number of nodes to remove */
1003*0Sstevel@tonic-gate 	devnode_desc_t	*devnode_desc;	/* description of device nodes */
1004*0Sstevel@tonic-gate } remove_device_node_t;
1005*0Sstevel@tonic-gate /*
1006*0Sstevel@tonic-gate  * Action values for RemoveDeviceNode
1007*0Sstevel@tonic-gate  *
1008*0Sstevel@tonic-gate  * Note: The "Action" member for make_device_node_t and remove_device_node_t
1009*0Sstevel@tonic-gate  *		share the same set of values.
1010*0Sstevel@tonic-gate  */
1011*0Sstevel@tonic-gate #define	REMOVE_DEVICE_NODE		0x02	/* remove device node */
1012*0Sstevel@tonic-gate #define	REMOVE_ALL_DEVICE_NODES		0x03	/* remove all device nodes */
1013*0Sstevel@tonic-gate 
1014*0Sstevel@tonic-gate /*
1015*0Sstevel@tonic-gate  * cs_ddi_info_t for CS_DDI_Info
1016*0Sstevel@tonic-gate  */
1017*0Sstevel@tonic-gate typedef struct cs_ddi_info_t {
1018*0Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number */
1019*0Sstevel@tonic-gate 	char		*driver_name;	/* unique driver name */
1020*0Sstevel@tonic-gate 	dev_info_t	*dip;		/* dip */
1021*0Sstevel@tonic-gate 	int32_t		instance;	/* instance */
1022*0Sstevel@tonic-gate } cs_ddi_info_t;
1023*0Sstevel@tonic-gate 
1024*0Sstevel@tonic-gate /*
1025*0Sstevel@tonic-gate  * cs_sys_ctl_t for CS_Sys_Ctl
1026*0Sstevel@tonic-gate  */
1027*0Sstevel@tonic-gate typedef struct cs_sys_ctl_t {
1028*0Sstevel@tonic-gate 	uint32_t	Socket;
1029*0Sstevel@tonic-gate 	uint32_t	Action;
1030*0Sstevel@tonic-gate 	uint32_t	Flags;
1031*0Sstevel@tonic-gate 	uint32_t	Events;
1032*0Sstevel@tonic-gate 	client_handle_t	client_handle;
1033*0Sstevel@tonic-gate } cs_sys_ctl_t;
1034*0Sstevel@tonic-gate /*
1035*0Sstevel@tonic-gate  * cs_sys_ctl_t->Action defines
1036*0Sstevel@tonic-gate  *
1037*0Sstevel@tonic-gate  * CS_SYS_CTL_SEND_EVENT - send events in cs_sys_ctl_t->Events to clients
1038*0Sstevel@tonic-gate  */
1039*0Sstevel@tonic-gate #define	CS_SYS_CTL_SEND_EVENT	0x0001	/* simulate events */
1040*0Sstevel@tonic-gate /*
1041*0Sstevel@tonic-gate  * cs_sys_ctl_t->Flags defines
1042*0Sstevel@tonic-gate  *
1043*0Sstevel@tonic-gate  * CS_SYS_CTL_WAIT_SYNC - wait for operation to complete, otherwise
1044*0Sstevel@tonic-gate  *	return immediately
1045*0Sstevel@tonic-gate  * CS_SYS_CTL_EVENT_SOCKET - send events to all clients on specified
1046*0Sstevel@tonic-gate  *	socket
1047*0Sstevel@tonic-gate  * CS_SYS_CTL_EVENT_CLIENT - send events to client specified by
1048*0Sstevel@tonic-gate  *	cs_sys_ctl_t->client_handle
1049*0Sstevel@tonic-gate  */
1050*0Sstevel@tonic-gate #define	CS_SYS_CTL_WAIT_SYNC	0x00000001	/* synchornize with thread */
1051*0Sstevel@tonic-gate #define	CS_SYS_CTL_EVENT_SOCKET	0x00000002	/* to all clients on socket */
1052*0Sstevel@tonic-gate #define	CS_SYS_CTL_EVENT_CLIENT	0x00000004	/* to client specified */
1053*0Sstevel@tonic-gate 
1054*0Sstevel@tonic-gate /*
1055*0Sstevel@tonic-gate  * Autoincrement control flags for RepPut8, RepPut16, RepPut32, RepPut32,
1056*0Sstevel@tonic-gate  *	RepGet8, RepGet16, RepGet32, RepGet64
1057*0Sstevel@tonic-gate  */
1058*0Sstevel@tonic-gate #define	CS_DEV_AUTOINCR		DDI_DEV_AUTOINCR
1059*0Sstevel@tonic-gate #define	CS_DEV_NO_AUTOINCR	DDI_DEV_NO_AUTOINCR
1060*0Sstevel@tonic-gate 
1061*0Sstevel@tonic-gate /*
1062*0Sstevel@tonic-gate  * Card Services function prototypes
1063*0Sstevel@tonic-gate  */
1064*0Sstevel@tonic-gate int32_t csx_RegisterClient(client_handle_t *, client_reg_t *);
1065*0Sstevel@tonic-gate int32_t csx_DeregisterClient(client_handle_t);
1066*0Sstevel@tonic-gate int32_t csx_GetStatus(client_handle_t, get_status_t *);
1067*0Sstevel@tonic-gate int32_t csx_SetEventMask(client_handle_t, sockevent_t *);
1068*0Sstevel@tonic-gate int32_t csx_GetEventMask(client_handle_t, sockevent_t *);
1069*0Sstevel@tonic-gate int32_t csx_RequestIO(client_handle_t, io_req_t *);
1070*0Sstevel@tonic-gate int32_t csx_ReleaseIO(client_handle_t, io_req_t *);
1071*0Sstevel@tonic-gate int32_t csx_RequestIRQ(client_handle_t, irq_req_t *);
1072*0Sstevel@tonic-gate int32_t csx_ReleaseIRQ(client_handle_t, irq_req_t *);
1073*0Sstevel@tonic-gate int32_t csx_RequestWindow(client_handle_t, window_handle_t *, win_req_t *);
1074*0Sstevel@tonic-gate int32_t csx_ReleaseWindow(window_handle_t);
1075*0Sstevel@tonic-gate int32_t csx_ModifyWindow(window_handle_t, modify_win_t *);
1076*0Sstevel@tonic-gate int32_t csx_MapMemPage(window_handle_t, map_mem_page_t *);
1077*0Sstevel@tonic-gate int32_t csx_RequestSocketMask(client_handle_t, request_socket_mask_t *);
1078*0Sstevel@tonic-gate int32_t csx_ReleaseSocketMask(client_handle_t, release_socket_mask_t *);
1079*0Sstevel@tonic-gate int32_t csx_RequestConfiguration(client_handle_t, config_req_t *);
1080*0Sstevel@tonic-gate int32_t csx_ModifyConfiguration(client_handle_t, modify_config_t *);
1081*0Sstevel@tonic-gate int32_t csx_ReleaseConfiguration(client_handle_t, release_config_t *);
1082*0Sstevel@tonic-gate int32_t csx_AccessConfigurationRegister(client_handle_t, access_config_reg_t *);
1083*0Sstevel@tonic-gate int32_t csx_GetFirstTuple(client_handle_t, tuple_t *);
1084*0Sstevel@tonic-gate int32_t csx_GetNextTuple(client_handle_t, tuple_t *);
1085*0Sstevel@tonic-gate int32_t csx_GetTupleData(client_handle_t, tuple_t *);
1086*0Sstevel@tonic-gate int32_t csx_MapLogSocket(client_handle_t, map_log_socket_t *);
1087*0Sstevel@tonic-gate int32_t csx_ValidateCIS(client_handle_t, cisinfo_t *);
1088*0Sstevel@tonic-gate int32_t csx_MakeDeviceNode(client_handle_t, make_device_node_t *);
1089*0Sstevel@tonic-gate int32_t csx_RemoveDeviceNode(client_handle_t, remove_device_node_t *);
1090*0Sstevel@tonic-gate int32_t csx_ConvertSpeed(convert_speed_t *);
1091*0Sstevel@tonic-gate int32_t csx_ConvertSize(convert_size_t *);
1092*0Sstevel@tonic-gate int32_t csx_Event2Text(event2text_t *);
1093*0Sstevel@tonic-gate int32_t csx_Error2Text(error2text_t *);
1094*0Sstevel@tonic-gate int32_t csx_CS_DDI_Info(cs_ddi_info_t *);
1095*0Sstevel@tonic-gate int32_t csx_CS_Sys_Ctl(cs_sys_ctl_t *);
1096*0Sstevel@tonic-gate int32_t csx_ResetFunction(client_handle_t, reset_function_t *);
1097*0Sstevel@tonic-gate int32_t csx_GetFirstClient(get_firstnext_client_t *);
1098*0Sstevel@tonic-gate int32_t csx_GetNextClient(get_firstnext_client_t *);
1099*0Sstevel@tonic-gate int32_t csx_GetClientInfo(client_handle_t, client_info_t *);
1100*0Sstevel@tonic-gate int32_t csx_GetCardServicesInfo(client_handle_t, get_cardservices_info_t *);
1101*0Sstevel@tonic-gate int32_t csx_GetConfigurationInfo(client_handle_t *, get_configuration_info_t *);
1102*0Sstevel@tonic-gate int32_t csx_GetPhysicalAdapterInfo(client_handle_t,
1103*0Sstevel@tonic-gate 					get_physical_adapter_info_t *);
1104*0Sstevel@tonic-gate 
1105*0Sstevel@tonic-gate /*
1106*0Sstevel@tonic-gate  * CIS tuple parsing functions
1107*0Sstevel@tonic-gate  */
1108*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_CONFIG(client_handle_t, tuple_t *, cistpl_config_t *);
1109*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE(client_handle_t, tuple_t *, cistpl_device_t *);
1110*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_A(client_handle_t, tuple_t *,
1111*0Sstevel@tonic-gate 					cistpl_device_t *);
1112*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_OA(client_handle_t, tuple_t *,
1113*0Sstevel@tonic-gate 					cistpl_device_t *);
1114*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_OC(client_handle_t, tuple_t *,
1115*0Sstevel@tonic-gate 					cistpl_device_t *);
1116*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_VERS_1(client_handle_t, tuple_t *, cistpl_vers_1_t *);
1117*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_VERS_2(client_handle_t, tuple_t *, cistpl_vers_2_t *);
1118*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_JEDEC_A(client_handle_t, tuple_t *, cistpl_jedec_t *);
1119*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_JEDEC_C(client_handle_t, tuple_t *, cistpl_jedec_t *);
1120*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FORMAT(client_handle_t, tuple_t *, cistpl_format_t *);
1121*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FORMAT_A(client_handle_t, tuple_t *,
1122*0Sstevel@tonic-gate 					cistpl_format_t *);
1123*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_GEOMETRY(client_handle_t, tuple_t *,
1124*0Sstevel@tonic-gate 					cistpl_geometry_t *);
1125*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BYTEORDER(client_handle_t, tuple_t *,
1126*0Sstevel@tonic-gate 					cistpl_byteorder_t *);
1127*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DATE(client_handle_t, tuple_t *, cistpl_date_t *);
1128*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BATTERY(client_handle_t, tuple_t *,
1129*0Sstevel@tonic-gate 					cistpl_battery_t *);
1130*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_ORG(client_handle_t, tuple_t *, cistpl_org_t *);
1131*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_MANFID(client_handle_t, tuple_t *, cistpl_manfid_t *);
1132*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FUNCID(client_handle_t, tuple_t *, cistpl_funcid_t *);
1133*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FUNCE(client_handle_t, tuple_t *, cistpl_funce_t *,
1134*0Sstevel@tonic-gate 					uint32_t);
1135*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_CFTABLE_ENTRY(client_handle_t, tuple_t *,
1136*0Sstevel@tonic-gate 					cistpl_cftable_entry_t *);
1137*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LINKTARGET(client_handle_t, tuple_t *,
1138*0Sstevel@tonic-gate 					cistpl_linktarget_t *);
1139*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_A(client_handle_t, tuple_t *,
1140*0Sstevel@tonic-gate 					cistpl_longlink_ac_t *);
1141*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_C(client_handle_t, tuple_t *,
1142*0Sstevel@tonic-gate 					cistpl_longlink_ac_t *);
1143*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_MFC(client_handle_t, tuple_t *,
1144*0Sstevel@tonic-gate 					cistpl_longlink_mfc_t *);
1145*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_SPCL(client_handle_t, tuple_t *,
1146*0Sstevel@tonic-gate 					cistpl_spcl_t *);
1147*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_SWIL(client_handle_t, tuple_t *,
1148*0Sstevel@tonic-gate 					cistpl_swil_t *);
1149*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BAR(client_handle_t, tuple_t *,
1150*0Sstevel@tonic-gate 					cistpl_bar_t *);
1151*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICEGEO(client_handle_t, tuple_t *,
1152*0Sstevel@tonic-gate 					cistpl_devicegeo_t *);
1153*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICEGEO_A(client_handle_t, tuple_t *,
1154*0Sstevel@tonic-gate 					cistpl_devicegeo_t *);
1155*0Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_CB(client_handle_t, tuple_t *,
1156*0Sstevel@tonic-gate 					cistpl_longlink_cb_t *);
1157*0Sstevel@tonic-gate int32_t csx_ParseTuple(client_handle_t, tuple_t *, cisparse_t *, uint32_t);
1158*0Sstevel@tonic-gate 
1159*0Sstevel@tonic-gate /*
1160*0Sstevel@tonic-gate  * Data access functions
1161*0Sstevel@tonic-gate  */
1162*0Sstevel@tonic-gate void csx_Put8(acc_handle_t, uint32_t, uint8_t);
1163*0Sstevel@tonic-gate void csx_Put16(acc_handle_t, uint32_t, uint16_t);
1164*0Sstevel@tonic-gate void csx_Put32(acc_handle_t, uint32_t, uint32_t);
1165*0Sstevel@tonic-gate void csx_Put64(acc_handle_t, uint32_t, uint64_t);
1166*0Sstevel@tonic-gate uint8_t csx_Get8(acc_handle_t, uint32_t);
1167*0Sstevel@tonic-gate uint16_t csx_Get16(acc_handle_t, uint32_t);
1168*0Sstevel@tonic-gate uint32_t csx_Get32(acc_handle_t, uint32_t);
1169*0Sstevel@tonic-gate uint64_t csx_Get64(acc_handle_t, uint32_t);
1170*0Sstevel@tonic-gate void csx_RepPut8(acc_handle_t, uint8_t *, uint32_t, uint32_t, uint32_t);
1171*0Sstevel@tonic-gate void csx_RepPut16(acc_handle_t, uint16_t *, uint32_t, uint32_t, uint32_t);
1172*0Sstevel@tonic-gate void csx_RepPut32(acc_handle_t, uint32_t *, uint32_t, uint32_t, uint32_t);
1173*0Sstevel@tonic-gate void csx_RepPut64(acc_handle_t, uint64_t *, uint32_t, uint32_t, uint32_t);
1174*0Sstevel@tonic-gate void csx_RepGet8(acc_handle_t, uint8_t *, uint32_t, uint32_t, uint32_t);
1175*0Sstevel@tonic-gate void csx_RepGet16(acc_handle_t, uint16_t *, uint32_t, uint32_t, uint32_t);
1176*0Sstevel@tonic-gate void csx_RepGet32(acc_handle_t, uint32_t *, uint32_t, uint32_t, uint32_t);
1177*0Sstevel@tonic-gate void csx_RepGet64(acc_handle_t, uint64_t *, uint32_t, uint32_t, uint32_t);
1178*0Sstevel@tonic-gate 
1179*0Sstevel@tonic-gate /*
1180*0Sstevel@tonic-gate  * Data access handle manipulation functions
1181*0Sstevel@tonic-gate  */
1182*0Sstevel@tonic-gate int32_t csx_GetMappedAddr(acc_handle_t, void **);
1183*0Sstevel@tonic-gate int32_t csx_GetPhysAddr(acc_handle_t, void **);
1184*0Sstevel@tonic-gate int32_t csx_DupHandle(acc_handle_t, acc_handle_t *, uint32_t);
1185*0Sstevel@tonic-gate int32_t csx_FreeHandle(acc_handle_t *);
1186*0Sstevel@tonic-gate int32_t csx_GetHandleOffset(acc_handle_t, uint32_t *);
1187*0Sstevel@tonic-gate int32_t csx_SetHandleOffset(acc_handle_t, uint32_t);
1188*0Sstevel@tonic-gate 
1189*0Sstevel@tonic-gate /*
1190*0Sstevel@tonic-gate  * XXX - PCMCIA Shady Meadows Retirement Community
1191*0Sstevel@tonic-gate  *
1192*0Sstevel@tonic-gate  * The defines in this section should be retired once the PS drivers
1193*0Sstevel@tonic-gate  *	get updated.
1194*0Sstevel@tonic-gate  *
1195*0Sstevel@tonic-gate  * XXX This is an old version of WIN_DATA_WIDTH_MASK and should be
1196*0Sstevel@tonic-gate  *	retired soon. RETIRE
1197*0Sstevel@tonic-gate  */
1198*0Sstevel@tonic-gate #define	WIN_DATA_WIDTH		0x00000002	/* 16-bit data path */
1199*0Sstevel@tonic-gate /*
1200*0Sstevel@tonic-gate  * XXX The following are old versions of the IO_DATA_WIDTH_XXX names and
1201*0Sstevel@tonic-gate  *	should be retured soon. RETIRE
1202*0Sstevel@tonic-gate  */
1203*0Sstevel@tonic-gate #define	IO_DATA_PATH_WIDTH	0x00000001	/* 16 bit data path */
1204*0Sstevel@tonic-gate #define	IO_DATA_PATH_WIDTH_8	0x00000000	/* 8 bit data path */
1205*0Sstevel@tonic-gate #define	IO_DATA_PATH_WIDTH_16	0x00000001	/* 16 bit data path */
1206*0Sstevel@tonic-gate /*
1207*0Sstevel@tonic-gate  * XXX - REMOVAL_ALL_DEVICE_NODES typo, remove soon. RETIRE
1208*0Sstevel@tonic-gate  */
1209*0Sstevel@tonic-gate #define	REMOVAL_ALL_DEVICE_NODES	0x03	/* remove all device nodes */
1210*0Sstevel@tonic-gate 
1211*0Sstevel@tonic-gate /*
1212*0Sstevel@tonic-gate  * The old name of the csx_RequestSocketMask structure was
1213*0Sstevel@tonic-gate  *	sockmask_t for some bizzare reason. This typedef
1214*0Sstevel@tonic-gate  *	keeps that old name around until we can fix
1215*0Sstevel@tonic-gate  *	the drivers.
1216*0Sstevel@tonic-gate  */
1217*0Sstevel@tonic-gate typedef struct request_socket_mask_t sockmask_t;	/* RETIRE */
1218*0Sstevel@tonic-gate 
1219*0Sstevel@tonic-gate /* XXX - RETIRE and change to a typedef XXX */
1220*0Sstevel@tonic-gate struct devnode_desc {
1221*0Sstevel@tonic-gate     char	*name;		/* device node path and name */
1222*0Sstevel@tonic-gate     int32_t	spec_type;	/* dev special type (block or char) */
1223*0Sstevel@tonic-gate     int32_t	minor_num;	/* device node minor number */
1224*0Sstevel@tonic-gate     char	*node_type;	/* device node type */
1225*0Sstevel@tonic-gate };
1226*0Sstevel@tonic-gate 
1227*0Sstevel@tonic-gate #ifdef	__cplusplus
1228*0Sstevel@tonic-gate }
1229*0Sstevel@tonic-gate #endif
1230*0Sstevel@tonic-gate 
1231*0Sstevel@tonic-gate #endif	/* _CS_H */
1232