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