xref: /illumos-gate/usr/src/uts/common/pcmcia/sys/cs.h (revision 39b361b2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*39b361b2SRichard Bean  * Common Development and Distribution License (the "License").
6*39b361b2SRichard Bean  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*39b361b2SRichard Bean  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*39b361b2SRichard Bean  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _CS_H
277c478bd9Sstevel@tonic-gate #define	_CS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * PCMCIA Card Services header file
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * XXX - This define really should be in a global header file
397c478bd9Sstevel@tonic-gate  *	somewhere; we do this stunt here since a lot of
407c478bd9Sstevel@tonic-gate  *	people include this header file but not necessarily
417c478bd9Sstevel@tonic-gate  *	the header file in which this is defined.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate #ifndef	_VERSION
447c478bd9Sstevel@tonic-gate #define	_VERSION(major, minor)	((major)<<16|(minor))
457c478bd9Sstevel@tonic-gate #endif
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Define this version of CS - this should correspond to the PCMCIA
497c478bd9Sstevel@tonic-gate  *	version number specified in the PCMCIA standard.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	CS_VERSION	_VERSION(5, 2)
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * CS_INTERNAL_REVISION_LEVEL is our internal revision level value returned
557c478bd9Sstevel@tonic-gate  *	via GetCardServicesInfo in get_cardservices_info_t->Revision
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	CS_INTERNAL_REVISION_LEVEL	_VERSION(2, 0)
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define	CS_GET_CARDSERVICES_INFO_VENDOR_STRING	"Solaris UNIX Card Services\n" \
60*39b361b2SRichard Bean 	"Copyright 2008 Sun Microsystems, Inc.  All rights reserved.\n" \
61*39b361b2SRichard Bean 	"Use is subject to license terms.\n" \
62*39b361b2SRichard Bean 	"@(#)cs.h	1.69 08/10/17 SMI\n" \
63*39b361b2SRichard Bean 	"Based on the PC Card Standard, February 1995\n"
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * typedef for function pointers to quiet lint and cc -v
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate typedef	int32_t (csfunction_t)(int32_t, ...);	/* for lint - cc -v quieting */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * CS_SUN_VENDOR_DESCRIPTION - can be returned by clients handling
727c478bd9Sstevel@tonic-gate  *				the CS_EVENT_CLIENT_INFO event in the
737c478bd9Sstevel@tonic-gate  *				client_info_t->VendorName member.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate #define	CS_SUN_VENDOR_DESCRIPTION	"Sun Microsystems, Inc. (c) 1996"
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Return codes from Card Services - these correspond to the PCMCIA
797c478bd9Sstevel@tonic-gate  *	standard and also include some implementation-specific return
807c478bd9Sstevel@tonic-gate  *	codes.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate #define	CS_SUCCESS		0x00	/* Request succeeded */
837c478bd9Sstevel@tonic-gate #define	CS_BAD_ADAPTER		0x01	/* Specified adapter is invalid */
847c478bd9Sstevel@tonic-gate #define	CS_BAD_ATTRIBUTE	0x02	/* Bad attribute value */
857c478bd9Sstevel@tonic-gate #define	CS_BAD_BASE		0x03	/* System base address invalid */
867c478bd9Sstevel@tonic-gate #define	CS_BAD_EDC		0x04	/* EDC generator is invalid */
877c478bd9Sstevel@tonic-gate 	/* RESERVED - 0x05 */
887c478bd9Sstevel@tonic-gate #define	CS_BAD_IRQ		0x06	/* Invalid IRQ */
897c478bd9Sstevel@tonic-gate #define	CS_BAD_OFFSET		0x07	/* Card offset invalid */
907c478bd9Sstevel@tonic-gate #define	CS_BAD_PAGE		0x08	/* Card page invalid */
917c478bd9Sstevel@tonic-gate #define	CS_READ_FAILURE		0x09	/* Unable to complete read request */
927c478bd9Sstevel@tonic-gate #define	CS_BAD_SIZE		0x0a	/* Size is invalid */
937c478bd9Sstevel@tonic-gate #define	CS_BAD_SOCKET		0x0b	/* Specified socket is invalid */
947c478bd9Sstevel@tonic-gate 	/* RESERVED - 0x0c */
957c478bd9Sstevel@tonic-gate #define	CS_BAD_TYPE		0x0d	/* Window/interface type invalid */
967c478bd9Sstevel@tonic-gate #define	CS_BAD_VCC		0x0e	/* Vcc value/index invalid */
977c478bd9Sstevel@tonic-gate #define	CS_BAD_VPP		0x0f	/* Vpp value/index invalid */
987c478bd9Sstevel@tonic-gate #define	CS_BAD_WINDOW		0x11	/* Specified window is invalid */
997c478bd9Sstevel@tonic-gate #define	CS_WRITE_FAILURE	0x12	/* Unable to complete write request */
1007c478bd9Sstevel@tonic-gate 	/* RESERVED - 0x13 */
1017c478bd9Sstevel@tonic-gate #define	CS_NO_CARD		0x14	/* No PC card in socket */
1027c478bd9Sstevel@tonic-gate #define	CS_UNSUPPORTED_FUNCTION	0x15	/* Unsupported function */
1037c478bd9Sstevel@tonic-gate #define	CS_UNSUPPORTED_MODE	0x16	/* Unsupported processor mode */
1047c478bd9Sstevel@tonic-gate #define	CS_BAD_SPEED		0x17	/* Specified speed is unavailable */
1057c478bd9Sstevel@tonic-gate #define	CS_BUSY			0x18	/* CS is busy - try again later */
1067c478bd9Sstevel@tonic-gate #define	CS_GENERAL_FAILURE	0x19	/* Undefined error */
1077c478bd9Sstevel@tonic-gate #define	CS_WRITE_PROTECTED	0x1a	/* Media is write protected */
1087c478bd9Sstevel@tonic-gate #define	CS_BAD_ARG_LENGTH	0x1b	/* Arg length invalid */
1097c478bd9Sstevel@tonic-gate #define	CS_BAD_ARGS		0x1c	/* Arg values invalid */
1107c478bd9Sstevel@tonic-gate #define	CS_CONFIGURATION_LOCKED	0x1d	/* This configuration is locked */
1117c478bd9Sstevel@tonic-gate #define	CS_IN_USE		0x1e	/* Requested resource in use */
1127c478bd9Sstevel@tonic-gate #define	CS_NO_MORE_ITEMS	0x1f	/* No more of requested item */
1137c478bd9Sstevel@tonic-gate #define	CS_OUT_OF_RESOURCE	0x20	/* Internal CS resources exhausted */
1147c478bd9Sstevel@tonic-gate #define	CS_BAD_HANDLE		0x21	/* client or window handle invalid */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * The following are Solaris-specific extended return codes
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #define	CS_NO_CIS		0x80	/* No CIS on card */
1207c478bd9Sstevel@tonic-gate #define	CS_BAD_CIS		0x81	/* Bad CIS on card */
1217c478bd9Sstevel@tonic-gate #define	CS_UNKNOWN_TUPLE	0x82	/* unknown tuple */
1227c478bd9Sstevel@tonic-gate #define	CS_BAD_VERSION		0x83	/* bad CS version */
1237c478bd9Sstevel@tonic-gate #define	CS_UNSUPPORTED_EVENT	0x84	/* Unsupported event in client */
1247c478bd9Sstevel@tonic-gate #define	CS_CSI_ERROR		0x85	/* error in csi driver protocol */
1257c478bd9Sstevel@tonic-gate #define	CS_CSI_NOT_INIT		0x86	/* csi library/driver not initialized */
1267c478bd9Sstevel@tonic-gate #define	CS_NO_TUPLE_PARSER	0x87	/* no tuple parser for this tuple */
1277c478bd9Sstevel@tonic-gate #define	CS_CARD_NOT_READY	0x88	/* card not ready */
1287c478bd9Sstevel@tonic-gate #define	CS_ERRORLIST_END	0x8000	/* end of error list */
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate /*
1317c478bd9Sstevel@tonic-gate  * Card Services event codes - these do NOT correspond to the PCMCIA
1327c478bd9Sstevel@tonic-gate  *	standard event codes for CS since these events are encoded as
1337c478bd9Sstevel@tonic-gate  *	bit flags, while the PCMCIA standard event codes are encoded
1347c478bd9Sstevel@tonic-gate  *	as numerical values.  In practice, this shouldn't be a problem
1357c478bd9Sstevel@tonic-gate  *	since no one should be looking at the absolute value of the
1367c478bd9Sstevel@tonic-gate  *	event codes; these defines should be used.
1377c478bd9Sstevel@tonic-gate  *
1387c478bd9Sstevel@tonic-gate  * The numerical value of an event code determines in what order a client
1397c478bd9Sstevel@tonic-gate  *	will receive the event if other events are also pending for that
1407c478bd9Sstevel@tonic-gate  *	client. XXX - need to make event_t a 64-bit field.
1417c478bd9Sstevel@tonic-gate  *
1427c478bd9Sstevel@tonic-gate  * Card Services receives these events from Socket Services or by reading
1437c478bd9Sstevel@tonic-gate  *	the card's Pin Replacement Register.  In either case, the client
1447c478bd9Sstevel@tonic-gate  *	always gets the same type of notification.
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate #define	CS_EVENT_REGISTRATION_COMPLETE	0x00000001 /* 0x82 */
1477c478bd9Sstevel@tonic-gate #define	CS_EVENT_PM_RESUME		0x00000002 /* 0x05 */
1487c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_INSERTION		0x00000004 /* 0x0c */
1497c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_READY		0x00000008 /* 0x01 */
1507c478bd9Sstevel@tonic-gate #define	CS_EVENT_BATTERY_LOW		0x00000010 /* 0x02 is also BVD2 */
1517c478bd9Sstevel@tonic-gate #define	CS_EVENT_BATTERY_DEAD		0x00000020 /* 0x40 is also BVD1 */
1527c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_LOCK		0x00000040 /* 0x03 */
1537c478bd9Sstevel@tonic-gate #define	CS_EVENT_PM_SUSPEND		0x00000080 /* 0x04 */
1547c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_RESET		0x00000100 /* 0x11 */
1557c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_UNLOCK		0x00000200 /* 0x06 */
1567c478bd9Sstevel@tonic-gate #define	CS_EVENT_EJECTION_COMPLETE	0x00000400 /* 0x07 */
1577c478bd9Sstevel@tonic-gate #define	CS_EVENT_EJECTION_REQUEST	0x00000800 /* 0x08 */
1587c478bd9Sstevel@tonic-gate #define	CS_EVENT_ERASE_COMPLETE		0x00001000 /* 0x81 */
1597c478bd9Sstevel@tonic-gate #define	CS_EVENT_EXCLUSIVE_COMPLETE	0x00002000 /* 0x0d */
1607c478bd9Sstevel@tonic-gate #define	CS_EVENT_EXCLUSIVE_REQUEST	0x00004000 /* 0x0e */
1617c478bd9Sstevel@tonic-gate #define	CS_EVENT_INSERTION_COMPLETE	0x00008000 /* 0x09 */
1627c478bd9Sstevel@tonic-gate #define	CS_EVENT_INSERTION_REQUEST	0x00010000 /* 0x0a */
1637c478bd9Sstevel@tonic-gate #define	CS_EVENT_RESET_COMPLETE		0x00020000 /* 0x80 */
1647c478bd9Sstevel@tonic-gate #define	CS_EVENT_RESET_PHYSICAL		0x00040000 /* 0x0f */
1657c478bd9Sstevel@tonic-gate #define	CS_EVENT_RESET_REQUEST		0x00080000 /* 0x10 */
1667c478bd9Sstevel@tonic-gate #define	CS_EVENT_MTD_REQUEST		0x00100000 /* 0x12 */
1677c478bd9Sstevel@tonic-gate #define	CS_EVENT_CLIENT_INFO		0x00200000 /* 0x14 */
1687c478bd9Sstevel@tonic-gate #define	CS_EVENT_TIMER_EXPIRED		0x00400000 /* 0x15 */
1697c478bd9Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT		0x01000000 /* 0x17 */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate /*
1727c478bd9Sstevel@tonic-gate  * The CS_EVENT_SS_UPDATED event is generated when Socket Services
1737c478bd9Sstevel@tonic-gate  *	has completed parsing the CIS and has done any necessary
1747c478bd9Sstevel@tonic-gate  *	work to get the client driver loaded and attached.
1757c478bd9Sstevel@tonic-gate  */
1767c478bd9Sstevel@tonic-gate #define	CS_EVENT_SS_UPDATED		0x00800000 /* 0x16 */
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * The CS_EVENT_STATUS_CHANGE event is generated by a Socket Services
1807c478bd9Sstevel@tonic-gate  *	PCE_CARD_STATUS_CHANGE event; this event gets converted to
1817c478bd9Sstevel@tonic-gate  *	the appropriate Card Services events when Card Services
1827c478bd9Sstevel@tonic-gate  *	reads the PRR.
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate #define	CS_EVENT_STATUS_CHANGE		0x02000000 /* ?? */
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * The CS_EVENT_CARD_REMOVAL is the last "real" CS event and must
1887c478bd9Sstevel@tonic-gate  *	have the highest value of all "real" CS events so that this
1897c478bd9Sstevel@tonic-gate  *	event is handed to the client after all other queued events
1907c478bd9Sstevel@tonic-gate  *	have been processed.
1917c478bd9Sstevel@tonic-gate  * If the client has set the CS_EVENT_CARD_REMOVAL_LOWP flag in
1927c478bd9Sstevel@tonic-gate  *	either of their event masks, then they will also receive
1937c478bd9Sstevel@tonic-gate  *	a CS_EVENT_CARD_REMOVAL at low (cs_event_thread) priority;
1947c478bd9Sstevel@tonic-gate  *	in this low priority removal event, the client can call
1957c478bd9Sstevel@tonic-gate  *	many CS functions that they can't call when they recieve
1967c478bd9Sstevel@tonic-gate  *	the high priority removal event.
1977c478bd9Sstevel@tonic-gate  */
1987c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_REMOVAL		0x10000000 /* 0x0b */
1997c478bd9Sstevel@tonic-gate #define	CS_EVENT_CARD_REMOVAL_LOWP	0x20000000 /* ?? */
2007c478bd9Sstevel@tonic-gate /*
2017c478bd9Sstevel@tonic-gate  * The following are not events but they share the event flags field
2027c478bd9Sstevel@tonic-gate  *	and are used internally by CS.  These bit patterns will never
2037c478bd9Sstevel@tonic-gate  *	be seen by clients.
2047c478bd9Sstevel@tonic-gate  * CS_EVENT_ALL_CLIENTS can only be set by the super-client and by
2057c478bd9Sstevel@tonic-gate  *	the CSI clients; setting this bit causes the driver to
2067c478bd9Sstevel@tonic-gate  *	receive any events specified in their event masks whenever
2077c478bd9Sstevel@tonic-gate  *	any such events occur on the socket.
2087c478bd9Sstevel@tonic-gate  * CS_EVENT_READY_TIMEOUT is a CS-private flag and should never be
2097c478bd9Sstevel@tonic-gate  *	set by clients.
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate #define	CS_EVENT_ALL_CLIENTS		0x40000000 /* ?? */
2127c478bd9Sstevel@tonic-gate #define	CS_EVENT_READY_TIMEOUT		0x80000000 /* ?? */
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate /*
2157c478bd9Sstevel@tonic-gate  * CS_EVENT_CLIENT_EVENTS_MASK is a msk of events that only the framework
2167c478bd9Sstevel@tonic-gate  *	is allowed to manipulate.
2177c478bd9Sstevel@tonic-gate  */
2187c478bd9Sstevel@tonic-gate #define	CS_EVENT_CLIENT_EVENTS_MASK	~(CS_EVENT_SS_UPDATED |		\
2197c478bd9Sstevel@tonic-gate 						CS_EVENT_ALL_CLIENTS |	\
2207c478bd9Sstevel@tonic-gate 						CS_EVENT_CARD_REMOVAL_LOWP)
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate /*
2237c478bd9Sstevel@tonic-gate  * client_info_t structure used by clients for a CS_EVENT_CLIENT_INFO
2247c478bd9Sstevel@tonic-gate  *	event and for the GetClientInfo function.
2257c478bd9Sstevel@tonic-gate  */
2267c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_MAX_NAME_LEN	80
2277c478bd9Sstevel@tonic-gate typedef struct client_info_t {
2287c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;
2297c478bd9Sstevel@tonic-gate 	uint32_t	Revision;	/* BCD value of client revision */
2307c478bd9Sstevel@tonic-gate 	uint32_t	CSLevel;	/* BCD value of CS release */
2317c478bd9Sstevel@tonic-gate 	uint32_t	RevDate;	/* revision date */
2327c478bd9Sstevel@tonic-gate 	char		ClientName[CS_CLIENT_INFO_MAX_NAME_LEN];
2337c478bd9Sstevel@tonic-gate 	char		VendorName[CS_CLIENT_INFO_MAX_NAME_LEN];
2347c478bd9Sstevel@tonic-gate 	char		DriverName[MODMAXNAMELEN];
2357c478bd9Sstevel@tonic-gate } client_info_t;
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * Flags for client_info_t->Attributes
2397c478bd9Sstevel@tonic-gate  *
2407c478bd9Sstevel@tonic-gate  * The low order byte bit values are used to return the data passed
2417c478bd9Sstevel@tonic-gate  *	in to RegisterClient in the client_reg_t->Attributes member.
2427c478bd9Sstevel@tonic-gate  */
2437c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_SOCKET_SERVICES	INFO_SOCKET_SERVICES
2447c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_IO_CLIENT	INFO_IO_CLIENT
2457c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_MTD_CLIENT	INFO_MTD_CLIENT
2467c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_MEM_CLIENT	INFO_MEM_CLIENT
2477c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_CSI_CLIENT	INFO_CSI_CLIENT
2487c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_CARD_SHARE	INFO_CARD_SHARE
2497c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_CARD_EXCL	INFO_CARD_EXCL
2507c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_CLIENT_MASK	0x000000ff
2517c478bd9Sstevel@tonic-gate /*
2527c478bd9Sstevel@tonic-gate  * Control and status flags.
2537c478bd9Sstevel@tonic-gate  */
2547c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_VALID		0x00010000	/* client info valid */
2557c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_CLIENT_ACTIVE	0x00020000	/* client is for card */
2567c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_FLAGS_MASK	0xffff0000
2577c478bd9Sstevel@tonic-gate /*
2587c478bd9Sstevel@tonic-gate  * Client Info subservice flags and types.
2597c478bd9Sstevel@tonic-gate  */
2607c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_SUBSVC_CS	0x00000000	/* CS client data */
2617c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_SUBSVC_MASK	0x0000ff00	/* sub-service mask */
2627c478bd9Sstevel@tonic-gate #define	GET_CLIENT_INFO_SUBSVC(s)	(((s) & CS_CLIENT_INFO_SUBSVC_MASK)>>8)
2637c478bd9Sstevel@tonic-gate #define	SET_CLIENT_INFO_SUBSVC(s)	(((s)<<8) & CS_CLIENT_INFO_SUBSVC_MASK)
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate /*
2667c478bd9Sstevel@tonic-gate  * CS_CLIENT_INFO_MAKE_DATE - Macro to make constructing the
2677c478bd9Sstevel@tonic-gate  *	client_info_t->RevDate member easier. Parameters are:
2687c478bd9Sstevel@tonic-gate  *
2697c478bd9Sstevel@tonic-gate  *	day - from 1 to 31
2707c478bd9Sstevel@tonic-gate  *	month - from 1 to 12
2717c478bd9Sstevel@tonic-gate  *	year - year relative to 1980
2727c478bd9Sstevel@tonic-gate  *			00 - 1980
2737c478bd9Sstevel@tonic-gate  *			06 - 1986
2747c478bd9Sstevel@tonic-gate  *			12 = 1992
2757c478bd9Sstevel@tonic-gate  *			16 - 1996, etc...
2767c478bd9Sstevel@tonic-gate  */
2777c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_MAKE_DATE(d, m, y)	(((d) & 0x01f) |	\
2787c478bd9Sstevel@tonic-gate 						(((m) & 0x0f) << 5) |	\
2797c478bd9Sstevel@tonic-gate 						(((y) & 0x7f) << 9))
2807c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_DAY(d)		((d) & 0x1f)
2817c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_MONTH(m)		(((m) >> 5) & 0x0f)
2827c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_YEAR(y)		((((y) >> 9) & 0x7f) + 1980)
2837c478bd9Sstevel@tonic-gate #define	CS_CLIENT_INFO_GET_YEAR_OFFSET(y)	(((y) >> 9) & 0x7f)
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate /*
2867c478bd9Sstevel@tonic-gate  * get_firstnext_client_t_t structure used for GetFirstClient and GetNextClient
2877c478bd9Sstevel@tonic-gate  */
2887c478bd9Sstevel@tonic-gate typedef struct get_firstnext_client_t {
2897c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
2907c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;
2917c478bd9Sstevel@tonic-gate 	client_handle_t	client_handle;		/* returned client handle */
2927c478bd9Sstevel@tonic-gate 	uint32_t	num_clients;
2937c478bd9Sstevel@tonic-gate } get_firstnext_client_t;
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate /*
2967c478bd9Sstevel@tonic-gate  * Flags for get_firstnext_client_t->Attributes
2977c478bd9Sstevel@tonic-gate  */
2987c478bd9Sstevel@tonic-gate #define	CS_GET_FIRSTNEXT_CLIENT_ALL_CLIENTS	0x00000001
2997c478bd9Sstevel@tonic-gate #define	CS_GET_FIRSTNEXT_CLIENT_SOCKET_ONLY	0x00000002
3007c478bd9Sstevel@tonic-gate 
3017c478bd9Sstevel@tonic-gate /*
3027c478bd9Sstevel@tonic-gate  * The client event callback argument structure - this is passed in to
3037c478bd9Sstevel@tonic-gate  *	the client event handler.  Most of these arguments are identical
3047c478bd9Sstevel@tonic-gate  *	to the PCMCIA-specified arguments.
3057c478bd9Sstevel@tonic-gate  */
3067c478bd9Sstevel@tonic-gate typedef struct event_callback_args_t {
3077c478bd9Sstevel@tonic-gate 	client_handle_t	client_handle;
3087c478bd9Sstevel@tonic-gate 	void		*info;
3097c478bd9Sstevel@tonic-gate 	void		*mtdrequest;
3107c478bd9Sstevel@tonic-gate 	void		*buffer;
3117c478bd9Sstevel@tonic-gate 	void		*misc;
3127c478bd9Sstevel@tonic-gate 	void		*client_data;
3137c478bd9Sstevel@tonic-gate 	client_info_t	client_info;
3147c478bd9Sstevel@tonic-gate } event_callback_args_t;
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate /*
3177c478bd9Sstevel@tonic-gate  * Event priority flag passed to the client's event handler; the client
3187c478bd9Sstevel@tonic-gate  *	uses this priority to determine which mutex to use.
3197c478bd9Sstevel@tonic-gate  */
3207c478bd9Sstevel@tonic-gate #define	CS_EVENT_PRI_LOW	0x0001
3217c478bd9Sstevel@tonic-gate #define	CS_EVENT_PRI_HIGH	0x0002
3227c478bd9Sstevel@tonic-gate #define	CS_EVENT_PRI_NONE	0x0004
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate /*
3257c478bd9Sstevel@tonic-gate  * Event-specific event_callback_args_t->info values
3267c478bd9Sstevel@tonic-gate  *
3277c478bd9Sstevel@tonic-gate  * CS_EVENT_WRITE_PROTECT
3287c478bd9Sstevel@tonic-gate  *	CS_EVENT_WRITE_PROTECT_WPOFF - card is not write protected
3297c478bd9Sstevel@tonic-gate  *	CS_EVENT_WRITE_PROTECT_WPON - card is write protected
3307c478bd9Sstevel@tonic-gate  */
3317c478bd9Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT_WPOFF	0x0000
3327c478bd9Sstevel@tonic-gate #define	CS_EVENT_WRITE_PROTECT_WPON	0xffff
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate /*
3357c478bd9Sstevel@tonic-gate  * Endinanness and data ordering Attribute bits common to both R2 and
3367c478bd9Sstevel@tonic-gate  *	CardBus windows and common to RequestIO, RequestWindow and
3377c478bd9Sstevel@tonic-gate  *	DupHandle.
3387c478bd9Sstevel@tonic-gate  */
3397c478bd9Sstevel@tonic-gate #define	WIN_ACC_ENDIAN_MASK	0x00300000	/* endian mask */
3407c478bd9Sstevel@tonic-gate #define	WIN_ACC_NEVER_SWAP	0x00000000	/* i/o access: no swap */
3417c478bd9Sstevel@tonic-gate #define	WIN_ACC_BIG_ENDIAN	0x00100000	/* big endian */
3427c478bd9Sstevel@tonic-gate #define	WIN_ACC_LITTLE_ENDIAN	0x00200000	/* little endian */
3437c478bd9Sstevel@tonic-gate 
3447c478bd9Sstevel@tonic-gate #define	WIN_ACC_ORDER_MASK	0x00700000	/* order mask */
3457c478bd9Sstevel@tonic-gate #define	WIN_ACC_STRICT_ORDER	0x00000000	/* strict order */
3467c478bd9Sstevel@tonic-gate #define	WIN_ACC_UNORDERED_OK	0x00100000	/* may be re-ordered */
3477c478bd9Sstevel@tonic-gate #define	WIN_ACC_MERGING_OK	0x00200000	/* may merge i/o */
3487c478bd9Sstevel@tonic-gate #define	WIN_ACC_LOADCACHING_OK	0x00300000	/* may cache reads */
3497c478bd9Sstevel@tonic-gate #define	WIN_ACC_STORECACHING_OK	0x00400000	/* may cache all i/o */
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate /*
3527c478bd9Sstevel@tonic-gate  * io_req_t structure used for RequestIO and ReleaseIO
3537c478bd9Sstevel@tonic-gate  */
3547c478bd9Sstevel@tonic-gate typedef struct io_req_t {
3557c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
3567c478bd9Sstevel@tonic-gate 	baseaddru_t	BasePort1;
3577c478bd9Sstevel@tonic-gate 	uint32_t	NumPorts1;	/* 1st IO range no. contiguous ports */
3587c478bd9Sstevel@tonic-gate 	uint32_t	Attributes1;	/* 1st IO range attributes */
3597c478bd9Sstevel@tonic-gate 	baseaddru_t	BasePort2;
3607c478bd9Sstevel@tonic-gate 	uint32_t	NumPorts2;	/* 2nd IO range no. contiguous ports */
3617c478bd9Sstevel@tonic-gate 	uint32_t	Attributes2;	/* 2nd IO range attributes */
3627c478bd9Sstevel@tonic-gate 	uint32_t	IOAddrLines;	/* number of IO address lines decoded */
3637c478bd9Sstevel@tonic-gate } io_req_t;
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate /*
3667c478bd9Sstevel@tonic-gate  * Flags for RequestIO and ReleaseIO
3677c478bd9Sstevel@tonic-gate  */
3687c478bd9Sstevel@tonic-gate #define	IO_DATA_WIDTH_MASK	0x00000001	/* data path width mask */
3697c478bd9Sstevel@tonic-gate #define	IO_DATA_WIDTH_8		0x00000000	/* 8 bit data path */
3707c478bd9Sstevel@tonic-gate #define	IO_DATA_WIDTH_16	0x00000001	/* 16 bit data path */
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate /*
3737c478bd9Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
3747c478bd9Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
3757c478bd9Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
3767c478bd9Sstevel@tonic-gate  *	are set on a call to RequestIO, CS_BAD_ATTRIBUTE is returned.
3777c478bd9Sstevel@tonic-gate  */
3787c478bd9Sstevel@tonic-gate #define	IO_SHARED		0x00010000	/* for compatability only */
3797c478bd9Sstevel@tonic-gate #define	IO_FIRST_SHARED		0x00020000	/* for compatability only */
3807c478bd9Sstevel@tonic-gate #define	IO_FORCE_ALIAS_ACCESS	0x00040000	/* for compatability only */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate /*
3837c478bd9Sstevel@tonic-gate  * The following flags are private to Card Services and should never be set
3847c478bd9Sstevel@tonic-gate  *	by a client.  Doing so will cause the system to take a supervisor
3857c478bd9Sstevel@tonic-gate  *	trap at level twenty-nine.
3867c478bd9Sstevel@tonic-gate  */
3877c478bd9Sstevel@tonic-gate #define	IO_DEALLOCATE_WINDOW	0x10000000	/* CS private */
3887c478bd9Sstevel@tonic-gate #define	IO_DISABLE_WINDOW	0x20000000	/* CS private */
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate /*
3917c478bd9Sstevel@tonic-gate  * win_req_t structure used for RequestWindow
3927c478bd9Sstevel@tonic-gate  *
3937c478bd9Sstevel@tonic-gate  * Note that the ReqOffset member is not defined in the current PCMCIA
3947c478bd9Sstevel@tonic-gate  *	spec but is included here to aid clients in determining the
3957c478bd9Sstevel@tonic-gate  *	optimum offset to give to MapMemPage.
3967c478bd9Sstevel@tonic-gate  */
3977c478bd9Sstevel@tonic-gate typedef struct win_req_t {
3987c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
3997c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* window flags */
4007c478bd9Sstevel@tonic-gate 	union {
4017c478bd9Sstevel@tonic-gate 	    uint32_t		base;	/* requested window base address */
4027c478bd9Sstevel@tonic-gate 	    acc_handle_t	handle;	/* access handle for base of window */
4037c478bd9Sstevel@tonic-gate 	} Base;
4047c478bd9Sstevel@tonic-gate 	uint32_t	Size;		/* window size requested/granted */
4057c478bd9Sstevel@tonic-gate 	union {
4067c478bd9Sstevel@tonic-gate 	    uint32_t		AccessSpeed;	/* window access speed */
4077c478bd9Sstevel@tonic-gate 	    uint32_t		IOAddrLines;	/* for I/O windows only */
4087c478bd9Sstevel@tonic-gate 	} win_params;
4097c478bd9Sstevel@tonic-gate 	uint32_t	ReqOffset;	/* required window offest */
4107c478bd9Sstevel@tonic-gate } win_req_t;
4117c478bd9Sstevel@tonic-gate 
4127c478bd9Sstevel@tonic-gate /*
4137c478bd9Sstevel@tonic-gate  * modify_win_t structure used for ModifyWindow
4147c478bd9Sstevel@tonic-gate  */
4157c478bd9Sstevel@tonic-gate typedef struct modify_win_t {
4167c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* window flags */
4177c478bd9Sstevel@tonic-gate 	uint32_t	AccessSpeed;	/* window access speed */
4187c478bd9Sstevel@tonic-gate } modify_win_t;
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate /*
4217c478bd9Sstevel@tonic-gate  * Flags for RequestWindow and ModifyWindow
4227c478bd9Sstevel@tonic-gate  */
4237c478bd9Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_MASK	0x00000021	/* window type mask */
4247c478bd9Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_CM	0x00000000	/* window points to CM */
4257c478bd9Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_AM	0x00000001	/* window points to AM */
4267c478bd9Sstevel@tonic-gate #define	WIN_MEMORY_TYPE_IO	0x00000020	/* window points to IO */
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate #define	WIN_DATA_WIDTH_MASK	0x00000042	/* data path width mask */
4297c478bd9Sstevel@tonic-gate #define	WIN_DATA_WIDTH_8	0x00000000	/* 8-bit data path */
4307c478bd9Sstevel@tonic-gate #define	WIN_DATA_WIDTH_16	0x00000002	/* 16-bit data path */
4317c478bd9Sstevel@tonic-gate #define	WIN_DATA_WIDTH_32	0x00000040	/* 32-bit data path */
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate #define	WIN_ENABLE		0x00000004	/* enable/disable window */
4347c478bd9Sstevel@tonic-gate #define	WIN_OFFSET_SIZE		0x00000008	/* card offsets window sized */
4357c478bd9Sstevel@tonic-gate #define	WIN_ACCESS_SPEED_VALID	0x00000010	/* speed valid (ModifyWindow) */
4367c478bd9Sstevel@tonic-gate 
4377c478bd9Sstevel@tonic-gate #define	WIN_PREFETCH_CACHE_MASK	0x00000300	/* prefetch/cache mask */
4387c478bd9Sstevel@tonic-gate #define	WIN_PREFETCH		0x00000100	/* prefetchable not cacheable */
4397c478bd9Sstevel@tonic-gate #define	WIN_PREFETCH_CACHE	0x00000200	/* prefetchable and cacheable */
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate #define	WIN_BAR_MASK		0x00007000	/* Base Address Register mask */
4427c478bd9Sstevel@tonic-gate #define	WIN_BAR_1		0x00001000	/* Base Address Register 1 */
4437c478bd9Sstevel@tonic-gate #define	WIN_BAR_2		0x00002000	/* Base Address Register 2 */
4447c478bd9Sstevel@tonic-gate #define	WIN_BAR_3		0x00003000	/* Base Address Register 3 */
4457c478bd9Sstevel@tonic-gate #define	WIN_BAR_4		0x00004000	/* Base Address Register 4 */
4467c478bd9Sstevel@tonic-gate #define	WIN_BAR_5		0x00005000	/* Base Address Register 5 */
4477c478bd9Sstevel@tonic-gate #define	WIN_BAR_6		0x00006000	/* Base Address Register 6 */
4487c478bd9Sstevel@tonic-gate #define	WIN_BAR_7		0x00007000	/* Base Address Register 7 */
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate /*
4517c478bd9Sstevel@tonic-gate  * The following flag is used internally by Card Services and should never
4527c478bd9Sstevel@tonic-gate  *	be set by the caller.
4537c478bd9Sstevel@tonic-gate  */
4547c478bd9Sstevel@tonic-gate #define	WIN_DATA_WIDTH_VALID	0x00008000	/* CS internal */
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate /*
4577c478bd9Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
4587c478bd9Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
4597c478bd9Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
4607c478bd9Sstevel@tonic-gate  *	are set on a call to RequestWindow, CS_BAD_ATTRIBUTE is returned.
4617c478bd9Sstevel@tonic-gate  */
4627c478bd9Sstevel@tonic-gate #define	WIN_PAGED		0x00010000	/* for compatability only */
4637c478bd9Sstevel@tonic-gate #define	WIN_SHARED		0x00020000	/* for compatability only */
4647c478bd9Sstevel@tonic-gate #define	WIN_FIRST_SHARED	0x00040000	/* for compatability only */
4657c478bd9Sstevel@tonic-gate #define	WIN_BINDING_SPECIFIC	0x00080000	/* for compatability only */
4667c478bd9Sstevel@tonic-gate 
4677c478bd9Sstevel@tonic-gate /*
4687c478bd9Sstevel@tonic-gate  * The following flag is actually part of the AccessSpeed member
4697c478bd9Sstevel@tonic-gate  */
4707c478bd9Sstevel@tonic-gate #define	WIN_USE_WAIT		0x80	/* use window that supports WAIT */
4717c478bd9Sstevel@tonic-gate 
4727c478bd9Sstevel@tonic-gate /*
4737c478bd9Sstevel@tonic-gate  * client_reg_t structure for RegisterClient
4747c478bd9Sstevel@tonic-gate  */
4757c478bd9Sstevel@tonic-gate typedef struct client_reg_t {
4767c478bd9Sstevel@tonic-gate 	uint32_t		Attributes;
4777c478bd9Sstevel@tonic-gate 	uint32_t		EventMask;
4787c478bd9Sstevel@tonic-gate 	event_callback_args_t	event_callback_args;
4797c478bd9Sstevel@tonic-gate 	uint32_t		Version;	/* CS version to expect */
4807c478bd9Sstevel@tonic-gate 	csfunction_t		*event_handler;
4817c478bd9Sstevel@tonic-gate 	/* DDI support */
4827c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	*iblk_cookie;	/* event iblk cookie */
4837c478bd9Sstevel@tonic-gate 	ddi_idevice_cookie_t	*idev_cookie;	/* event idev cookie */
4847c478bd9Sstevel@tonic-gate 	dev_info_t		*dip;		/* client's dip */
4857c478bd9Sstevel@tonic-gate 	char			driver_name[MODMAXNAMELEN];
4867c478bd9Sstevel@tonic-gate 	/* CS private */
4877c478bd9Sstevel@tonic-gate 	void			*priv;		/* CS private data */
4887c478bd9Sstevel@tonic-gate } client_reg_t;
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate /*
4917c478bd9Sstevel@tonic-gate  * Flags for RegisterClient - some of these flags are also used internally
4927c478bd9Sstevel@tonic-gate  *	by CS to sequence the order of event callbacks and to allow Socket
4937c478bd9Sstevel@tonic-gate  *	Services to register as a "super" client.
4947c478bd9Sstevel@tonic-gate  *
4957c478bd9Sstevel@tonic-gate  * The client_reg_t->Attributes structure member uses these flags.
4967c478bd9Sstevel@tonic-gate  *
4977c478bd9Sstevel@tonic-gate  * The client_info_t->Attributes, client_types_t->type and client_t->flags
4987c478bd9Sstevel@tonic-gate  *	tructure members use these flags as well.
4997c478bd9Sstevel@tonic-gate  *
5007c478bd9Sstevel@tonic-gate  * Client types - mutually exclusive.
5017c478bd9Sstevel@tonic-gate  */
5027c478bd9Sstevel@tonic-gate #define	INFO_SOCKET_SERVICES	0x00000001
5037c478bd9Sstevel@tonic-gate #define	INFO_IO_CLIENT		0x00000002
5047c478bd9Sstevel@tonic-gate #define	INFO_MTD_CLIENT		0x00000004
5057c478bd9Sstevel@tonic-gate #define	INFO_MEM_CLIENT		0x00000008
5067c478bd9Sstevel@tonic-gate #define	INFO_CSI_CLIENT		0x00000010
5077c478bd9Sstevel@tonic-gate #define	INFO_CLIENT_TYPE_MASK	(INFO_SOCKET_SERVICES |		\
5087c478bd9Sstevel@tonic-gate 					INFO_IO_CLIENT |	\
5097c478bd9Sstevel@tonic-gate 					INFO_MTD_CLIENT	|	\
5107c478bd9Sstevel@tonic-gate 					INFO_MEM_CLIENT |	\
5117c478bd9Sstevel@tonic-gate 					INFO_CSI_CLIENT)
5127c478bd9Sstevel@tonic-gate #define	MAX_CLIENT_TYPES	3	/* doesn't include SS or CSI clients */
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate /*
5157c478bd9Sstevel@tonic-gate  * The following two are for backwards-compatability with the PCMCIA spec.
5167c478bd9Sstevel@tonic-gate  *	We will give the client CARD_INSERTION and REGISTRATION_COMPLETE
5177c478bd9Sstevel@tonic-gate  *	if either of these two bits are set.  Normally, all IO and MEM
5187c478bd9Sstevel@tonic-gate  *	clients should set both of these bits.
5197c478bd9Sstevel@tonic-gate  */
5207c478bd9Sstevel@tonic-gate #define	INFO_CARD_SHARE		0x00000020
5217c478bd9Sstevel@tonic-gate #define	INFO_CARD_EXCL		0x00000040
5227c478bd9Sstevel@tonic-gate #define	INFO_CARD_FLAGS_MASK	(INFO_CARD_SHARE | INFO_CARD_EXCL)
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate /*
5257c478bd9Sstevel@tonic-gate  * tuple_t struct used for GetFirstTuple, GetNextTuple, GetTupleData
5267c478bd9Sstevel@tonic-gate  *	and ParseTuple
5277c478bd9Sstevel@tonic-gate  *
5287c478bd9Sstevel@tonic-gate  * Note that the values for DesiredTuple are defined in the cis.h header
5297c478bd9Sstevel@tonic-gate  *	file.
5307c478bd9Sstevel@tonic-gate  */
5317c478bd9Sstevel@tonic-gate typedef struct tuple_t {
5327c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number to get tuple from */
5337c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* tuple return attributes */
5347c478bd9Sstevel@tonic-gate 	cisdata_t	DesiredTuple;	/* tuple to search for or flags */
5357c478bd9Sstevel@tonic-gate 	cisdata_t	TupleOffset;	/* offset in tuple data body */
5367c478bd9Sstevel@tonic-gate 	uint32_t	Flags;		/* CS private */
5377c478bd9Sstevel@tonic-gate 	cistpl_t	*LinkOffset;	/* CS private */
5387c478bd9Sstevel@tonic-gate 	cistpl_t	*CISOffset;	/* CS private */
5397c478bd9Sstevel@tonic-gate 	cisdata_t	TupleDataMax;	/* max size of tuple data area */
5407c478bd9Sstevel@tonic-gate 	cisdata_t	TupleDataLen;	/* actual size of tuple data area */
5417c478bd9Sstevel@tonic-gate 					/* tuple body data buffer */
5427c478bd9Sstevel@tonic-gate 	cisdata_t	TupleData[CIS_MAX_TUPLE_DATA_LEN];
5437c478bd9Sstevel@tonic-gate 	cisdata_t	TupleCode;	/* tuple type code */
5447c478bd9Sstevel@tonic-gate 	cisdata_t	TupleLink;	/* tuple data body size */
5457c478bd9Sstevel@tonic-gate } tuple_t;
5467c478bd9Sstevel@tonic-gate 
5477c478bd9Sstevel@tonic-gate /*
5487c478bd9Sstevel@tonic-gate  * Attribute flags definitions for CS tuple functions.
5497c478bd9Sstevel@tonic-gate  *
5507c478bd9Sstevel@tonic-gate  */
5517c478bd9Sstevel@tonic-gate #define	TUPLE_RETURN_LINK		0x00000002 /* return link tuples */
5527c478bd9Sstevel@tonic-gate #define	TUPLE_RETURN_IGNORED_TUPLES	0x00010000 /* return ignored tuples */
5537c478bd9Sstevel@tonic-gate #define	TUPLE_RETURN_NAME		0x00020000 /* return tuple name */
5547c478bd9Sstevel@tonic-gate 
5557c478bd9Sstevel@tonic-gate /*
5567c478bd9Sstevel@tonic-gate  * cisinfo_t structure used for ValidateCIS
5577c478bd9Sstevel@tonic-gate  */
5587c478bd9Sstevel@tonic-gate typedef struct cisinfo_t {
5597c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number to validate CIS on */
5607c478bd9Sstevel@tonic-gate 	uint32_t	Chains;		/* number of tuple chains in CIS */
5617c478bd9Sstevel@tonic-gate 	uint32_t	Tuples;		/* total number of tuples in CIS */
5627c478bd9Sstevel@tonic-gate } cisinfo_t;
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate /*
5657c478bd9Sstevel@tonic-gate  * map_mem_page_t structure used for MapMemPage
5667c478bd9Sstevel@tonic-gate  */
5677c478bd9Sstevel@tonic-gate typedef struct map_mem_page_t {
5687c478bd9Sstevel@tonic-gate 	uint32_t	CardOffset;	/* card offset */
5697c478bd9Sstevel@tonic-gate 	uint32_t	Page;		/* page number */
5707c478bd9Sstevel@tonic-gate } map_mem_page_t;
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate /*
5737c478bd9Sstevel@tonic-gate  * sockevent_t structure used for GetEventMask and SetEventMask
5747c478bd9Sstevel@tonic-gate  */
5757c478bd9Sstevel@tonic-gate typedef struct sockevent_t {
5767c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* attribute flags for call */
5777c478bd9Sstevel@tonic-gate 	uint32_t	EventMask;	/* event mask to set or return */
5787c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number if necessary */
5797c478bd9Sstevel@tonic-gate } sockevent_t;
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate /*
5827c478bd9Sstevel@tonic-gate  * request_socket_mask_t structure used for RequestSocketMask
5837c478bd9Sstevel@tonic-gate  */
5847c478bd9Sstevel@tonic-gate typedef struct request_socket_mask_t {
5857c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number if necessary */
5867c478bd9Sstevel@tonic-gate 	uint32_t	EventMask;	/* event mask to set or return */
5877c478bd9Sstevel@tonic-gate } request_socket_mask_t;
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate /*
5907c478bd9Sstevel@tonic-gate  * release_socket_mask_t structure used for ReleaseSocketMask
5917c478bd9Sstevel@tonic-gate  */
5927c478bd9Sstevel@tonic-gate typedef struct release_socket_mask_t {
5937c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
5947c478bd9Sstevel@tonic-gate } release_socket_mask_t;
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate /*
5977c478bd9Sstevel@tonic-gate  * Flags for GetEventMask and SetEventMask
5987c478bd9Sstevel@tonic-gate  */
5997c478bd9Sstevel@tonic-gate #define	CONF_EVENT_MASK_GLOBAL	0x00000000	/* global event mask */
6007c478bd9Sstevel@tonic-gate #define	CONF_EVENT_MASK_CLIENT	0x00000001	/* client event mask */
6017c478bd9Sstevel@tonic-gate #define	CONF_EVENT_MASK_VALID	0x00000001	/* client event mask */
6027c478bd9Sstevel@tonic-gate 
6037c478bd9Sstevel@tonic-gate /*
6047c478bd9Sstevel@tonic-gate  * convert_speed_t structure used for ConvertSpeed
6057c478bd9Sstevel@tonic-gate  */
6067c478bd9Sstevel@tonic-gate typedef struct convert_speed_t {
6077c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;
6087c478bd9Sstevel@tonic-gate 	uint32_t	nS;
6097c478bd9Sstevel@tonic-gate 	uint32_t	devspeed;
6107c478bd9Sstevel@tonic-gate } convert_speed_t;
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate /*
6137c478bd9Sstevel@tonic-gate  * Flags for ConvertSpeed
6147c478bd9Sstevel@tonic-gate  */
6157c478bd9Sstevel@tonic-gate #define	CONVERT_NS_TO_DEVSPEED	0x00000001
6167c478bd9Sstevel@tonic-gate #define	CONVERT_DEVSPEED_TO_NS	0x00000002
6177c478bd9Sstevel@tonic-gate 
6187c478bd9Sstevel@tonic-gate /*
6197c478bd9Sstevel@tonic-gate  * convert_size_t structure used for ConvertSize
6207c478bd9Sstevel@tonic-gate  */
6217c478bd9Sstevel@tonic-gate typedef struct convert_size_t {
6227c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;
6237c478bd9Sstevel@tonic-gate 	uint32_t	bytes;
6247c478bd9Sstevel@tonic-gate 	uint32_t	devsize;
6257c478bd9Sstevel@tonic-gate } convert_size_t;
6267c478bd9Sstevel@tonic-gate 
6277c478bd9Sstevel@tonic-gate /*
6287c478bd9Sstevel@tonic-gate  * Flags for ConvertSize
6297c478bd9Sstevel@tonic-gate  */
6307c478bd9Sstevel@tonic-gate #define	CONVERT_BYTES_TO_DEVSIZE	0x00000001
6317c478bd9Sstevel@tonic-gate #define	CONVERT_DEVSIZE_TO_BYTES	0x00000002
6327c478bd9Sstevel@tonic-gate 
6337c478bd9Sstevel@tonic-gate #define	MAX_CS_EVENT_BUFSIZE		64	/* single event */
6347c478bd9Sstevel@tonic-gate #define	MAX_MULTI_EVENT_BUFSIZE		512	/* all events */
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate #define	CS_EVENT_MAX_BUFSIZE	MAX_MULTI_EVENT_BUFSIZE
6377c478bd9Sstevel@tonic-gate #define	CS_ERROR_MAX_BUFSIZE	MAX_CS_EVENT_BUFSIZE
6387c478bd9Sstevel@tonic-gate 
6397c478bd9Sstevel@tonic-gate /*
6407c478bd9Sstevel@tonic-gate  * event2text_t structure used for Event2Text
6417c478bd9Sstevel@tonic-gate  */
6427c478bd9Sstevel@tonic-gate typedef struct event2text_t {
6437c478bd9Sstevel@tonic-gate 	event_t		event;		/* events */
6447c478bd9Sstevel@tonic-gate 					/* buffer to return text strings */
6457c478bd9Sstevel@tonic-gate 	char		text[CS_EVENT_MAX_BUFSIZE];
6467c478bd9Sstevel@tonic-gate } event2text_t;
6477c478bd9Sstevel@tonic-gate 
6487c478bd9Sstevel@tonic-gate /*
6497c478bd9Sstevel@tonic-gate  * error2text_t structure used for Error2Text
6507c478bd9Sstevel@tonic-gate  */
6517c478bd9Sstevel@tonic-gate typedef struct error2text_t {
6527c478bd9Sstevel@tonic-gate 	uint32_t	item;
6537c478bd9Sstevel@tonic-gate 	char		text[CS_ERROR_MAX_BUFSIZE];
6547c478bd9Sstevel@tonic-gate } error2text_t;
6557c478bd9Sstevel@tonic-gate 
6567c478bd9Sstevel@tonic-gate /*
6577c478bd9Sstevel@tonic-gate  * get_status_t structure used for GetStatus
6587c478bd9Sstevel@tonic-gate  *
6597c478bd9Sstevel@tonic-gate  * The values in the status members are the same as the CS_EVENT_XXX values.
6607c478bd9Sstevel@tonic-gate  */
6617c478bd9Sstevel@tonic-gate typedef struct get_status_t {
6627c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
6637c478bd9Sstevel@tonic-gate 	uint32_t	CardState;	/* "live" card status for this client */
6647c478bd9Sstevel@tonic-gate 	uint32_t	SocketState;	/* latched socket values */
6657c478bd9Sstevel@tonic-gate 	uint32_t	raw_CardState;	/* raw live card status */
6667c478bd9Sstevel@tonic-gate } get_status_t;
6677c478bd9Sstevel@tonic-gate 
6687c478bd9Sstevel@tonic-gate /*
6697c478bd9Sstevel@tonic-gate  * GetStatus returns card state using the same bit definitions
6707c478bd9Sstevel@tonic-gate  *	as the CS_EVENT_XXX bits. Some of the CS_EVENT_XXX bits
6717c478bd9Sstevel@tonic-gate  *	are not meaningful for GetStatus and are reused here for
6727c478bd9Sstevel@tonic-gate  *	status definitions.
6737c478bd9Sstevel@tonic-gate  *
6747c478bd9Sstevel@tonic-gate  * get_status_t->CardState and get_status_t->raw_CardState bits
6757c478bd9Sstevel@tonic-gate  */
6767c478bd9Sstevel@tonic-gate #define	CS_STATUS_WRITE_PROTECTED	CS_EVENT_WRITE_PROTECT
6777c478bd9Sstevel@tonic-gate #define	CS_STATUS_CARD_LOCKED		CS_EVENT_CARD_LOCK
6787c478bd9Sstevel@tonic-gate #define	CS_STATUS_EJECTION_REQUEST	CS_EVENT_EJECTION_REQUEST
6797c478bd9Sstevel@tonic-gate #define	CS_STATUS_INSERTION_REQUEST	CS_EVENT_INSERTION_REQUEST
6807c478bd9Sstevel@tonic-gate #define	CS_STATUS_BATTERY_DEAD		CS_EVENT_BATTERY_DEAD
6817c478bd9Sstevel@tonic-gate #define	CS_STATUS_BATTERY_LOW		CS_EVENT_BATTERY_LOW
6827c478bd9Sstevel@tonic-gate #define	CS_STATUS_CARD_READY		CS_EVENT_CARD_READY
6837c478bd9Sstevel@tonic-gate #define	CS_STATUS_CARD_INSERTED		CS_EVENT_CARD_INSERTION
6847c478bd9Sstevel@tonic-gate #define	CS_STATUS_RES_EVT1		0x00100000
6857c478bd9Sstevel@tonic-gate #define	CS_STATUS_RES_EVT2		0x00200000
6867c478bd9Sstevel@tonic-gate #define	CS_STATUS_RES_EVT3		0x00400000
6877c478bd9Sstevel@tonic-gate #define	CS_STATUS_VCC_50		0x10000000
6887c478bd9Sstevel@tonic-gate #define	CS_STATUS_VCC_33		0x20000000
6897c478bd9Sstevel@tonic-gate #define	CS_STATUS_VCC_XX		0x40000000
6907c478bd9Sstevel@tonic-gate #define	CS_STATUS_REQ_ATTN		0x80000000
6917c478bd9Sstevel@tonic-gate /*
6927c478bd9Sstevel@tonic-gate  * get_status_t->SocketState bits
6937c478bd9Sstevel@tonic-gate  */
6947c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_WRITE_PROTECT_CHANGE	CS_EVENT_WRITE_PROTECT
6957c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_LOCK_CHNAGE		CS_EVENT_CARD_LOCK
6967c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_EJECTION_PENDING		CS_EVENT_EJECTION_REQUEST
6977c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_INSERTION_PENDING	CS_EVENT_INSERTION_REQUEST
6987c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_BATTERY_DEAD_CHNAGE	CS_EVENT_BATTERY_DEAD
6997c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_BATTERY_LOW_CHNAGE	CS_EVENT_BATTERY_LOW
7007c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_READY_CHANGE	CS_EVENT_CARD_READY
7017c478bd9Sstevel@tonic-gate #define	CS_SOCK_STATUS_CARD_DETECT_CHNAGE	CS_EVENT_CARD_INSERTION
7027c478bd9Sstevel@tonic-gate 
7037c478bd9Sstevel@tonic-gate /*
7047c478bd9Sstevel@tonic-gate  * map_log_socket_t structure used for MapLogSocket
7057c478bd9Sstevel@tonic-gate  */
7067c478bd9Sstevel@tonic-gate typedef struct map_log_socket_t {
7077c478bd9Sstevel@tonic-gate 	uint32_t	LogSocket;	/* logical socket */
7087c478bd9Sstevel@tonic-gate 	uint32_t	PhyAdapter;	/* physical adapter */
7097c478bd9Sstevel@tonic-gate 	uint32_t	PhySocket;	/* physical socket */
7107c478bd9Sstevel@tonic-gate } map_log_socket_t;
7117c478bd9Sstevel@tonic-gate 
7127c478bd9Sstevel@tonic-gate /*
7137c478bd9Sstevel@tonic-gate  * get_physical_adapter_info_t structure used for GetPhysicalAdapterInfo
7147c478bd9Sstevel@tonic-gate  */
7157c478bd9Sstevel@tonic-gate typedef struct get_physical_adapter_info_t {
7167c478bd9Sstevel@tonic-gate 	uint32_t	LogSocket;	/* logical socket */
7177c478bd9Sstevel@tonic-gate 	uint32_t	PhySocket;	/* physical socket */
7187c478bd9Sstevel@tonic-gate 	uint32_t	flags;		/* adapter flags */
7197c478bd9Sstevel@tonic-gate 	char		name[MODMAXNAMELEN]; /* adapter module name */
7207c478bd9Sstevel@tonic-gate 	uint32_t	major;		/* adapter major number */
7217c478bd9Sstevel@tonic-gate 	uint32_t	minor;		/* adapter minor number */
7227c478bd9Sstevel@tonic-gate 	uint32_t	instance;	/* instance number of this adapter */
7237c478bd9Sstevel@tonic-gate 	uint32_t	number;		/* canonical adapter number */
7247c478bd9Sstevel@tonic-gate 	uint32_t	num_sockets;	/* # sockets on this adapter */
7257c478bd9Sstevel@tonic-gate 	uint32_t	first_socket;	/* first socket # on this adapter */
7267c478bd9Sstevel@tonic-gate } get_physical_adapter_info_t;
7277c478bd9Sstevel@tonic-gate 
7287c478bd9Sstevel@tonic-gate /*
7297c478bd9Sstevel@tonic-gate  * irq_req_t structure used for RequestIRQ and ReleaseIRQ
7307c478bd9Sstevel@tonic-gate  */
7317c478bd9Sstevel@tonic-gate typedef struct irq_req_t {
7327c478bd9Sstevel@tonic-gate 	uint32_t		Socket;
7337c478bd9Sstevel@tonic-gate 	uint32_t		Attributes;	/* IRQ attribute flags */
7347c478bd9Sstevel@tonic-gate 	csfunction_t		*irq_handler;
7357c478bd9Sstevel@tonic-gate 	void			*irq_handler_arg;
7367c478bd9Sstevel@tonic-gate 	ddi_iblock_cookie_t	*iblk_cookie;	/* IRQ iblk cookie */
7377c478bd9Sstevel@tonic-gate 	ddi_idevice_cookie_t	*idev_cookie;	/* IRQ idev cookie */
7387c478bd9Sstevel@tonic-gate } irq_req_t;
7397c478bd9Sstevel@tonic-gate 
7407c478bd9Sstevel@tonic-gate /*
7417c478bd9Sstevel@tonic-gate  * Flags for RequestIRQ and ReleaseIRQ
7427c478bd9Sstevel@tonic-gate  */
7437c478bd9Sstevel@tonic-gate #define	IRQ_TYPE_EXCLUSIVE		0x00000002
7447c478bd9Sstevel@tonic-gate /*
7457c478bd9Sstevel@tonic-gate  * The following flags are included for compatability with other versions of
7467c478bd9Sstevel@tonic-gate  *	Card Services, but they are not implemented in this version.  They
7477c478bd9Sstevel@tonic-gate  *	are assigned values as placeholders only.  If any of these flags
7487c478bd9Sstevel@tonic-gate  *	are set on a call to RequestIRQ, CS_BAD_ATTRIBUTE is returned.
7497c478bd9Sstevel@tonic-gate  */
7507c478bd9Sstevel@tonic-gate #define	IRQ_FORCED_PULSE		0x00010000
7517c478bd9Sstevel@tonic-gate #define	IRQ_TYPE_TIME			0x00020000
7527c478bd9Sstevel@tonic-gate #define	IRQ_TYPE_DYNAMIC_SHARING	0x00040000
7537c478bd9Sstevel@tonic-gate #define	IRQ_FIRST_SHARED		0x00080000
7547c478bd9Sstevel@tonic-gate #define	IRQ_PULSE_ALLOCATED		0x00100000
7557c478bd9Sstevel@tonic-gate 
7567c478bd9Sstevel@tonic-gate /*
7577c478bd9Sstevel@tonic-gate  * release_config_t structure used for ReleaseConfiguration
7587c478bd9Sstevel@tonic-gate  */
7597c478bd9Sstevel@tonic-gate typedef struct release_config_t {
7607c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
7617c478bd9Sstevel@tonic-gate } release_config_t;
7627c478bd9Sstevel@tonic-gate 
7637c478bd9Sstevel@tonic-gate /*
7647c478bd9Sstevel@tonic-gate  * config_req_t structure used for RequestConfiguration
7657c478bd9Sstevel@tonic-gate  */
7667c478bd9Sstevel@tonic-gate typedef struct config_req_t {
7677c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
7687c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* configuration attributes */
7697c478bd9Sstevel@tonic-gate 	uint32_t	Vcc;		/* Vcc value */
7707c478bd9Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
7717c478bd9Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
7727c478bd9Sstevel@tonic-gate 	uint32_t	IntType;	/* socket interface type - mem or IO */
7737c478bd9Sstevel@tonic-gate 	uint32_t	ConfigBase;	/* offset from start of AM space */
7747c478bd9Sstevel@tonic-gate 	uint32_t	Status;		/* value to write to STATUS register */
7757c478bd9Sstevel@tonic-gate 	uint32_t	Pin;		/* value to write to PRR */
7767c478bd9Sstevel@tonic-gate 	uint32_t	Copy;		/* value to write to COPY register */
7777c478bd9Sstevel@tonic-gate 	uint32_t	ConfigIndex;	/* value to write to COR */
7787c478bd9Sstevel@tonic-gate 	uint32_t	Present;	/* which config registers present */
7797c478bd9Sstevel@tonic-gate 	uint32_t	ExtendedStatus;	/* value to write to EXSTAT register */
7807c478bd9Sstevel@tonic-gate } config_req_t;
7817c478bd9Sstevel@tonic-gate 
7827c478bd9Sstevel@tonic-gate /*
7837c478bd9Sstevel@tonic-gate  * Flags for RequestConfiguration - note that the CONF_ENABLE_IRQ_STEERING
7847c478bd9Sstevel@tonic-gate  *	flag shares the same bit field as the Attributes flags for
7857c478bd9Sstevel@tonic-gate  *	ModifyConfiguration.
7867c478bd9Sstevel@tonic-gate  */
7877c478bd9Sstevel@tonic-gate #define	CONF_ENABLE_IRQ_STEERING	0x00010000
7887c478bd9Sstevel@tonic-gate /*
7897c478bd9Sstevel@tonic-gate  * The following flags are used for the IntType member to specify which
7907c478bd9Sstevel@tonic-gate  *	type of socket interface the client wants.
7917c478bd9Sstevel@tonic-gate  */
7927c478bd9Sstevel@tonic-gate #define	SOCKET_INTERFACE_MEMORY		0x00000001
7937c478bd9Sstevel@tonic-gate #define	SOCKET_INTERFACE_MEMORY_AND_IO	0x00000002
7947c478bd9Sstevel@tonic-gate /*
7957c478bd9Sstevel@tonic-gate  * The following flags are used for the Present member to specify which
7967c478bd9Sstevel@tonic-gate  *	configuration registers are present.  They may also be used by
7977c478bd9Sstevel@tonic-gate  *	clients for their internal state.
7987c478bd9Sstevel@tonic-gate  */
7997c478bd9Sstevel@tonic-gate #define	CONFIG_OPTION_REG_PRESENT	0x00000001 /* COR present */
8007c478bd9Sstevel@tonic-gate #define	CONFIG_STATUS_REG_PRESENT	0x00000002 /* STAT reg present */
8017c478bd9Sstevel@tonic-gate #define	CONFIG_PINREPL_REG_PRESENT	0x00000004 /* PRR present */
8027c478bd9Sstevel@tonic-gate #define	CONFIG_COPY_REG_PRESENT		0x00000008 /* COPY reg present */
8037c478bd9Sstevel@tonic-gate #define	CONFIG_EXSTAT_REG_PRESENT	0x00000010 /* EXSTAT reg present */
8047c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE0_REG_PRESENT	0x00000020 /* IOBASE0 reg present */
8057c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE1_REG_PRESENT	0x00000040 /* IOBASE1 reg present */
8067c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE2_REG_PRESENT	0x00000080 /* IOBASE2 reg present */
8077c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE3_REG_PRESENT	0x00000100 /* IOBASE3 reg present */
8087c478bd9Sstevel@tonic-gate #define	CONFIG_IOLIMIT_REG_PRESENT	0x00000200 /* IOLIMIT reg present */
8097c478bd9Sstevel@tonic-gate 
8107c478bd9Sstevel@tonic-gate /*
8117c478bd9Sstevel@tonic-gate  * CONFIG_IOBASE_REG_MASK - mask of IO Base Port register present bits
8127c478bd9Sstevel@tonic-gate  * CONFIG_IOBASE_REG_SHIFT - shifts IO Base Port register present bits
8137c478bd9Sstevel@tonic-gate  */
8147c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE_REG_MASK		0x000001e0 /* IOBASEn present mask */
8157c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE_REG_SHIFT		5
8167c478bd9Sstevel@tonic-gate 
8177c478bd9Sstevel@tonic-gate /*
8187c478bd9Sstevel@tonic-gate  * Bit definitions for configuration registers.
8197c478bd9Sstevel@tonic-gate  *
8207c478bd9Sstevel@tonic-gate  * Pin Replacement Register (PRR) bits - these are used for calls to
8217c478bd9Sstevel@tonic-gate  *	RequestConfiguration, AccessConfigurationRegister and
8227c478bd9Sstevel@tonic-gate  *	GetConfigurationInfo, as well as internally by clients
8237c478bd9Sstevel@tonic-gate  *	and Card Services.
8247c478bd9Sstevel@tonic-gate  * To inform Card Services that a particular bit in the PRR is valid on
8257c478bd9Sstevel@tonic-gate  *	a call to RequestConfiguration, both the XXX_STATUS and the
8267c478bd9Sstevel@tonic-gate  *	XXX_EVENT bits must be set.
8277c478bd9Sstevel@tonic-gate  */
8287c478bd9Sstevel@tonic-gate #define	PRR_WP_STATUS		0x01	/* R-WP state W-write WP Cbit */
8297c478bd9Sstevel@tonic-gate #define	PRR_READY_STATUS	0x02	/* R-READY state W-write READY Cbit */
8307c478bd9Sstevel@tonic-gate #define	PRR_BVD2_STATUS		0x04	/* R-BVD2 state W-write BVD2 Cbit */
8317c478bd9Sstevel@tonic-gate #define	PRR_BVD1_STATUS		0x08	/* R-BVD1 state W-write BVD1 Cbit */
8327c478bd9Sstevel@tonic-gate #define	PRR_WP_EVENT		0x10	/* WP changed */
8337c478bd9Sstevel@tonic-gate #define	PRR_READY_EVENT		0x20	/* READY changed */
8347c478bd9Sstevel@tonic-gate #define	PRR_BVD2_EVENT		0x40	/* BVD2 changed */
8357c478bd9Sstevel@tonic-gate #define	PRR_BVD1_EVENT		0x80	/* BVD1 changed */
8367c478bd9Sstevel@tonic-gate /*
8377c478bd9Sstevel@tonic-gate  * Configuration Option Register (COR) bits
8387c478bd9Sstevel@tonic-gate  */
8397c478bd9Sstevel@tonic-gate #define	COR_ENABLE_FUNCTION	0x01	/* enable function */
8407c478bd9Sstevel@tonic-gate #define	COR_ENABLE_BASE_LIMIT	0x02	/* enable base and limit registers */
8417c478bd9Sstevel@tonic-gate #define	COR_ENABLE_IREQ_ROUTING	0x04	/* enable IREQ routing */
8427c478bd9Sstevel@tonic-gate #define	COR_STATUS_CHANGE_MODE	0x08	/* status change mode */
8437c478bd9Sstevel@tonic-gate #define	COR_LEVEL_IRQ		0x40	/* set to enable level interrupts */
8447c478bd9Sstevel@tonic-gate #define	COR_SOFT_RESET		0x80	/* soft reset bit */
8457c478bd9Sstevel@tonic-gate /*
8467c478bd9Sstevel@tonic-gate  * Card Configuration Status Register (CCSR)
8477c478bd9Sstevel@tonic-gate  */
8487c478bd9Sstevel@tonic-gate #define	CCSR_INTR_ACK		0x01	/* interrupt acknowledge */
8497c478bd9Sstevel@tonic-gate #define	CCSR_INTR		0x02	/* interrupt pending */
8507c478bd9Sstevel@tonic-gate #define	CCSR_POWER_DOWN		0x04	/* power down card */
8517c478bd9Sstevel@tonic-gate #define	CCSR_AUDIO		0x08	/* enable Audio signal */
8527c478bd9Sstevel@tonic-gate #define	CCSR_IO_IS_8		0x20	/* only 8-bit IO data path */
8537c478bd9Sstevel@tonic-gate #define	CCSR_SIG_CHG		0x40	/* enable status changes */
8547c478bd9Sstevel@tonic-gate #define	CCSR_CHANGED		0x80	/* one of the PRR bits has changed */
8557c478bd9Sstevel@tonic-gate /*
8567c478bd9Sstevel@tonic-gate  * Macros to manipulate the Socket and Copy Register (SCR) values
8577c478bd9Sstevel@tonic-gate  */
8587c478bd9Sstevel@tonic-gate #define	SCR_GET_SOCKET(r)		((r)&0x0f)
8597c478bd9Sstevel@tonic-gate #define	SCR_GET_COPY(r)			(((r)>>4)&7)
8607c478bd9Sstevel@tonic-gate #define	SCR_SET_SOCKET(s)		((s)&0x0f)
8617c478bd9Sstevel@tonic-gate #define	SCR_SET_COPY(c)			(((c)&7)<<4)
8627c478bd9Sstevel@tonic-gate #define	SCR_SET_SOCKET_COPY(s, c)	(((s)&0x0f) | (((c)&7)<<4))
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate /*
8657c478bd9Sstevel@tonic-gate  * modify_config_t structure used for ModifyConfiguration
8667c478bd9Sstevel@tonic-gate  */
8677c478bd9Sstevel@tonic-gate typedef struct modify_config_t {
8687c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
8697c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* attributes to modify */
8707c478bd9Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
8717c478bd9Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
8727c478bd9Sstevel@tonic-gate } modify_config_t;
8737c478bd9Sstevel@tonic-gate 
8747c478bd9Sstevel@tonic-gate /*
8757c478bd9Sstevel@tonic-gate  * Flags for ModifyConfiguration - note that the CONF_ENABLE_IRQ_STEERING
8767c478bd9Sstevel@tonic-gate  *	flag used with RequestConfiguration shares this bit field.
8777c478bd9Sstevel@tonic-gate  */
8787c478bd9Sstevel@tonic-gate #define	CONF_VPP1_CHANGE_VALID		0x00000002	/* Vpp1 is valid */
8797c478bd9Sstevel@tonic-gate #define	CONF_VPP2_CHANGE_VALID		0x00000004	/* Vpp2 is valid */
8807c478bd9Sstevel@tonic-gate #define	CONF_IRQ_CHANGE_VALID		0x00000008	/* IRQ is valid */
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate /*
8837c478bd9Sstevel@tonic-gate  * access_config_reg_t structure used for AccessConfigurationRegister
8847c478bd9Sstevel@tonic-gate  */
8857c478bd9Sstevel@tonic-gate typedef struct access_config_reg_t {
8867c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
8877c478bd9Sstevel@tonic-gate 	uint32_t	Action;		/* register access operation */
8887c478bd9Sstevel@tonic-gate 	uint32_t	Offset;		/* config register offset */
8897c478bd9Sstevel@tonic-gate 	uint32_t	Value;		/* value read or written */
8907c478bd9Sstevel@tonic-gate } access_config_reg_t;
8917c478bd9Sstevel@tonic-gate /*
8927c478bd9Sstevel@tonic-gate  * Flags for AccessConfigurationRegister
8937c478bd9Sstevel@tonic-gate  */
8947c478bd9Sstevel@tonic-gate #define	CONFIG_REG_READ		0x00000001	/* read config register */
8957c478bd9Sstevel@tonic-gate #define	CONFIG_REG_WRITE	0x00000002	/* write config register */
8967c478bd9Sstevel@tonic-gate /*
8977c478bd9Sstevel@tonic-gate  * The following offsets are used to specify the configuration register
8987c478bd9Sstevel@tonic-gate  *	offset to AccessConfigurationRegister
8997c478bd9Sstevel@tonic-gate  */
9007c478bd9Sstevel@tonic-gate #define	CONFIG_OPTION_REG_OFFSET	0x00	/* COR offset */
9017c478bd9Sstevel@tonic-gate #define	CONFIG_STATUS_REG_OFFSET	0x02	/* STAT reg offset */
9027c478bd9Sstevel@tonic-gate #define	CONFIG_PINREPL_REG_OFFSET	0x04	/* PRR offset */
9037c478bd9Sstevel@tonic-gate #define	CONFIG_COPY_REG_OFFSET		0x06	/* COPY reg offset */
9047c478bd9Sstevel@tonic-gate #define	CONFIG_EXSTAT_REG_OFFSET	0x08	/* EXSTAT reg offset */
9057c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE0_REG_OFFSET	0x0a	/* IOBASE0 reg offset */
9067c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE1_REG_OFFSET	0x0c	/* IOBASE1 reg offset */
9077c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE2_REG_OFFSET	0x0e	/* IOBASE2 reg offset */
9087c478bd9Sstevel@tonic-gate #define	CONFIG_IOBASE3_REG_OFFSET	0x10	/* IOBASE3 reg offset */
9097c478bd9Sstevel@tonic-gate #define	CONFIG_IOLIMIT_REG_OFFSET	0x12	/* IOLIMIT reg offset */
9107c478bd9Sstevel@tonic-gate 
9117c478bd9Sstevel@tonic-gate /*
9127c478bd9Sstevel@tonic-gate  * reset_function_t structure used for ResetFunction
9137c478bd9Sstevel@tonic-gate  */
9147c478bd9Sstevel@tonic-gate typedef struct reset_function_t {
9157c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
9167c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;
9177c478bd9Sstevel@tonic-gate } reset_function_t;
9187c478bd9Sstevel@tonic-gate 
9197c478bd9Sstevel@tonic-gate /*
9207c478bd9Sstevel@tonic-gate  * get_cardservices_info_t structure used for GetCardServicesInfo
9217c478bd9Sstevel@tonic-gate  */
9227c478bd9Sstevel@tonic-gate #define	CS_GET_CARDSERVICES_INFO_MAX_VS_LEN	512
9237c478bd9Sstevel@tonic-gate typedef struct get_cardservices_info_t {
9247c478bd9Sstevel@tonic-gate 	char		Signature[2];	/* CS signature bytes */
9257c478bd9Sstevel@tonic-gate 	uint32_t	NumSockets;	/* number of sockets */
9267c478bd9Sstevel@tonic-gate 	uint32_t	Revision;	/* BCD value of CS revision */
9277c478bd9Sstevel@tonic-gate 	uint32_t	CSLevel;	/* BCD value of CS release */
9287c478bd9Sstevel@tonic-gate 	uint32_t	FuncsPerSocket;	/* max number of functions per socket */
9297c478bd9Sstevel@tonic-gate 	char		VendorString[CS_GET_CARDSERVICES_INFO_MAX_VS_LEN];
9307c478bd9Sstevel@tonic-gate } get_cardservices_info_t;
9317c478bd9Sstevel@tonic-gate 
9327c478bd9Sstevel@tonic-gate /*
9337c478bd9Sstevel@tonic-gate  * get_configuration_info_t structure used by GetConfigurationInfo
9347c478bd9Sstevel@tonic-gate  */
9357c478bd9Sstevel@tonic-gate typedef struct get_configuration_info_t {
9367c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* Socket/function to get info for */
9377c478bd9Sstevel@tonic-gate 	uint32_t	Attributes;	/* configuration attributes */
9387c478bd9Sstevel@tonic-gate 	uint32_t	Vcc;		/* Vcc value */
9397c478bd9Sstevel@tonic-gate 	uint32_t	Vpp1;		/* Vpp1 value */
9407c478bd9Sstevel@tonic-gate 	uint32_t	Vpp2;		/* Vpp2 value */
9417c478bd9Sstevel@tonic-gate 	uint32_t	IntType;	/* memory only or memory and IO ifc */
9427c478bd9Sstevel@tonic-gate 	uint32_t	ConfigBase;	/* offset from start of AM space */
9437c478bd9Sstevel@tonic-gate 	uint32_t	Status;		/* value written to STATUS register */
9447c478bd9Sstevel@tonic-gate 	uint32_t	Pin;		/* value written to PRR */
9457c478bd9Sstevel@tonic-gate 	uint32_t	Copy;		/* value to written COPY register */
9467c478bd9Sstevel@tonic-gate 	uint32_t	Option;		/* which written to COR */
9477c478bd9Sstevel@tonic-gate 	uint32_t	Present;	/* which config registers present */
9487c478bd9Sstevel@tonic-gate 	uint32_t	FirstDevType;	/* from CISTPL_DEVICE */
9497c478bd9Sstevel@tonic-gate 	uint32_t	FuncCode;	/* from CISTPL_FUNCID */
9507c478bd9Sstevel@tonic-gate 	uint32_t	SysInitMask;	/* from CISTPL_FUNCID */
9517c478bd9Sstevel@tonic-gate 	uint32_t	ManufCode;	/* from CISTPL_MANFID */
9527c478bd9Sstevel@tonic-gate 	uint32_t	ManufInfo;	/* from CISTPL_MANFID */
9537c478bd9Sstevel@tonic-gate 	uint32_t	CardValues;	/* which config registers written */
9547c478bd9Sstevel@tonic-gate 	uint32_t	AssignedIRQ;	/* IRQ assigned to card */
9557c478bd9Sstevel@tonic-gate 	uint32_t	IRQ_Attributes;	/* IRQ attributes */
9567c478bd9Sstevel@tonic-gate 	uint32_t	BasePort1;	/* address of 1st IO range */
9577c478bd9Sstevel@tonic-gate 	uint32_t	NumPorts1;	/* 1st IO range no. contiguous ports */
9587c478bd9Sstevel@tonic-gate 	uint32_t	Attributes1;	/* 1st IO range attributes */
9597c478bd9Sstevel@tonic-gate 	uint32_t	BasePort2;	/* address of 2nd IO range */
9607c478bd9Sstevel@tonic-gate 	uint32_t	NumPorts2;	/* 2nd IO range no. contiguous ports */
9617c478bd9Sstevel@tonic-gate 	uint32_t	Attributes2;	/* 2nd IO range attributes */
9627c478bd9Sstevel@tonic-gate 	uint32_t	IOAddrLines;	/* number of IO address lines decoded */
9637c478bd9Sstevel@tonic-gate 	uint32_t	ExStat;		/* value written to EXSTAT register */
9647c478bd9Sstevel@tonic-gate 	uint32_t	DMA_Attributes;	/* signals used for DMA */
9657c478bd9Sstevel@tonic-gate 	uint32_t	DMA_Assign_Chan;	/* assigned DMA channel */
9667c478bd9Sstevel@tonic-gate 	uint32_t	NumIOWindows;	/* number of IO windows in use */
9677c478bd9Sstevel@tonic-gate 	uint32_t	NumMemWindows;	/* number of memory windows in use */
9687c478bd9Sstevel@tonic-gate } get_configuration_info_t;
9697c478bd9Sstevel@tonic-gate 
9707c478bd9Sstevel@tonic-gate /*
9717c478bd9Sstevel@tonic-gate  * devnode_desc_t structure used in make_device_node_t and remove_device_node_t
9727c478bd9Sstevel@tonic-gate  *	for MakeDeviceNode and RemoveDeviceNode
9737c478bd9Sstevel@tonic-gate  */
9747c478bd9Sstevel@tonic-gate typedef struct devnode_desc_t {
9757c478bd9Sstevel@tonic-gate 	char	*name;		/* device node path and name */
9767c478bd9Sstevel@tonic-gate 	int32_t	spec_type;	/* dev special type (block or char) */
9777c478bd9Sstevel@tonic-gate 	int32_t	minor_num;	/* device node minor number */
9787c478bd9Sstevel@tonic-gate 	char	*node_type;	/* device node type */
9797c478bd9Sstevel@tonic-gate } devnode_desc_t;
9807c478bd9Sstevel@tonic-gate 
9817c478bd9Sstevel@tonic-gate /*
9827c478bd9Sstevel@tonic-gate  * make_device_node_t structure used for MakeDeviceNode
9837c478bd9Sstevel@tonic-gate  */
9847c478bd9Sstevel@tonic-gate typedef struct make_device_node_t {
9857c478bd9Sstevel@tonic-gate 	uint32_t	Action;		/* device operation */
9867c478bd9Sstevel@tonic-gate 	uint32_t	NumDevNodes;	/* number of nodes to create */
9877c478bd9Sstevel@tonic-gate 	devnode_desc_t	*devnode_desc;	/* description of device nodes */
9887c478bd9Sstevel@tonic-gate } make_device_node_t;
9897c478bd9Sstevel@tonic-gate /*
9907c478bd9Sstevel@tonic-gate  * Action values for MakeDeviceNode
9917c478bd9Sstevel@tonic-gate  */
9927c478bd9Sstevel@tonic-gate #define	CREATE_DEVICE_NODE		0x01	/* create device node */
9937c478bd9Sstevel@tonic-gate 
9947c478bd9Sstevel@tonic-gate /*
9957c478bd9Sstevel@tonic-gate  * remove_device_node_t structure used for RemoveDeviceNode
9967c478bd9Sstevel@tonic-gate  */
9977c478bd9Sstevel@tonic-gate typedef struct remove_device_node_t {
9987c478bd9Sstevel@tonic-gate 	uint32_t	Action;		/* device operation */
9997c478bd9Sstevel@tonic-gate 	uint32_t	NumDevNodes;	/* number of nodes to remove */
10007c478bd9Sstevel@tonic-gate 	devnode_desc_t	*devnode_desc;	/* description of device nodes */
10017c478bd9Sstevel@tonic-gate } remove_device_node_t;
10027c478bd9Sstevel@tonic-gate /*
10037c478bd9Sstevel@tonic-gate  * Action values for RemoveDeviceNode
10047c478bd9Sstevel@tonic-gate  *
10057c478bd9Sstevel@tonic-gate  * Note: The "Action" member for make_device_node_t and remove_device_node_t
10067c478bd9Sstevel@tonic-gate  *		share the same set of values.
10077c478bd9Sstevel@tonic-gate  */
10087c478bd9Sstevel@tonic-gate #define	REMOVE_DEVICE_NODE		0x02	/* remove device node */
10097c478bd9Sstevel@tonic-gate #define	REMOVE_ALL_DEVICE_NODES		0x03	/* remove all device nodes */
10107c478bd9Sstevel@tonic-gate 
10117c478bd9Sstevel@tonic-gate /*
10127c478bd9Sstevel@tonic-gate  * cs_ddi_info_t for CS_DDI_Info
10137c478bd9Sstevel@tonic-gate  */
10147c478bd9Sstevel@tonic-gate typedef struct cs_ddi_info_t {
10157c478bd9Sstevel@tonic-gate 	uint32_t	Socket;		/* socket number */
10167c478bd9Sstevel@tonic-gate 	char		*driver_name;	/* unique driver name */
10177c478bd9Sstevel@tonic-gate 	dev_info_t	*dip;		/* dip */
10187c478bd9Sstevel@tonic-gate 	int32_t		instance;	/* instance */
10197c478bd9Sstevel@tonic-gate } cs_ddi_info_t;
10207c478bd9Sstevel@tonic-gate 
10217c478bd9Sstevel@tonic-gate /*
10227c478bd9Sstevel@tonic-gate  * cs_sys_ctl_t for CS_Sys_Ctl
10237c478bd9Sstevel@tonic-gate  */
10247c478bd9Sstevel@tonic-gate typedef struct cs_sys_ctl_t {
10257c478bd9Sstevel@tonic-gate 	uint32_t	Socket;
10267c478bd9Sstevel@tonic-gate 	uint32_t	Action;
10277c478bd9Sstevel@tonic-gate 	uint32_t	Flags;
10287c478bd9Sstevel@tonic-gate 	uint32_t	Events;
10297c478bd9Sstevel@tonic-gate 	client_handle_t	client_handle;
10307c478bd9Sstevel@tonic-gate } cs_sys_ctl_t;
10317c478bd9Sstevel@tonic-gate /*
10327c478bd9Sstevel@tonic-gate  * cs_sys_ctl_t->Action defines
10337c478bd9Sstevel@tonic-gate  *
10347c478bd9Sstevel@tonic-gate  * CS_SYS_CTL_SEND_EVENT - send events in cs_sys_ctl_t->Events to clients
10357c478bd9Sstevel@tonic-gate  */
10367c478bd9Sstevel@tonic-gate #define	CS_SYS_CTL_SEND_EVENT	0x0001	/* simulate events */
10377c478bd9Sstevel@tonic-gate /*
10387c478bd9Sstevel@tonic-gate  * cs_sys_ctl_t->Flags defines
10397c478bd9Sstevel@tonic-gate  *
10407c478bd9Sstevel@tonic-gate  * CS_SYS_CTL_WAIT_SYNC - wait for operation to complete, otherwise
10417c478bd9Sstevel@tonic-gate  *	return immediately
10427c478bd9Sstevel@tonic-gate  * CS_SYS_CTL_EVENT_SOCKET - send events to all clients on specified
10437c478bd9Sstevel@tonic-gate  *	socket
10447c478bd9Sstevel@tonic-gate  * CS_SYS_CTL_EVENT_CLIENT - send events to client specified by
10457c478bd9Sstevel@tonic-gate  *	cs_sys_ctl_t->client_handle
10467c478bd9Sstevel@tonic-gate  */
10477c478bd9Sstevel@tonic-gate #define	CS_SYS_CTL_WAIT_SYNC	0x00000001	/* synchornize with thread */
10487c478bd9Sstevel@tonic-gate #define	CS_SYS_CTL_EVENT_SOCKET	0x00000002	/* to all clients on socket */
10497c478bd9Sstevel@tonic-gate #define	CS_SYS_CTL_EVENT_CLIENT	0x00000004	/* to client specified */
10507c478bd9Sstevel@tonic-gate 
10517c478bd9Sstevel@tonic-gate /*
10527c478bd9Sstevel@tonic-gate  * Autoincrement control flags for RepPut8, RepPut16, RepPut32, RepPut32,
10537c478bd9Sstevel@tonic-gate  *	RepGet8, RepGet16, RepGet32, RepGet64
10547c478bd9Sstevel@tonic-gate  */
10557c478bd9Sstevel@tonic-gate #define	CS_DEV_AUTOINCR		DDI_DEV_AUTOINCR
10567c478bd9Sstevel@tonic-gate #define	CS_DEV_NO_AUTOINCR	DDI_DEV_NO_AUTOINCR
10577c478bd9Sstevel@tonic-gate 
10587c478bd9Sstevel@tonic-gate /*
10597c478bd9Sstevel@tonic-gate  * Card Services function prototypes
10607c478bd9Sstevel@tonic-gate  */
10617c478bd9Sstevel@tonic-gate int32_t csx_RegisterClient(client_handle_t *, client_reg_t *);
10627c478bd9Sstevel@tonic-gate int32_t csx_DeregisterClient(client_handle_t);
10637c478bd9Sstevel@tonic-gate int32_t csx_GetStatus(client_handle_t, get_status_t *);
10647c478bd9Sstevel@tonic-gate int32_t csx_SetEventMask(client_handle_t, sockevent_t *);
10657c478bd9Sstevel@tonic-gate int32_t csx_GetEventMask(client_handle_t, sockevent_t *);
10667c478bd9Sstevel@tonic-gate int32_t csx_RequestIO(client_handle_t, io_req_t *);
10677c478bd9Sstevel@tonic-gate int32_t csx_ReleaseIO(client_handle_t, io_req_t *);
10687c478bd9Sstevel@tonic-gate int32_t csx_RequestIRQ(client_handle_t, irq_req_t *);
10697c478bd9Sstevel@tonic-gate int32_t csx_ReleaseIRQ(client_handle_t, irq_req_t *);
10707c478bd9Sstevel@tonic-gate int32_t csx_RequestWindow(client_handle_t, window_handle_t *, win_req_t *);
10717c478bd9Sstevel@tonic-gate int32_t csx_ReleaseWindow(window_handle_t);
10727c478bd9Sstevel@tonic-gate int32_t csx_ModifyWindow(window_handle_t, modify_win_t *);
10737c478bd9Sstevel@tonic-gate int32_t csx_MapMemPage(window_handle_t, map_mem_page_t *);
10747c478bd9Sstevel@tonic-gate int32_t csx_RequestSocketMask(client_handle_t, request_socket_mask_t *);
10757c478bd9Sstevel@tonic-gate int32_t csx_ReleaseSocketMask(client_handle_t, release_socket_mask_t *);
10767c478bd9Sstevel@tonic-gate int32_t csx_RequestConfiguration(client_handle_t, config_req_t *);
10777c478bd9Sstevel@tonic-gate int32_t csx_ModifyConfiguration(client_handle_t, modify_config_t *);
10787c478bd9Sstevel@tonic-gate int32_t csx_ReleaseConfiguration(client_handle_t, release_config_t *);
10797c478bd9Sstevel@tonic-gate int32_t csx_AccessConfigurationRegister(client_handle_t, access_config_reg_t *);
10807c478bd9Sstevel@tonic-gate int32_t csx_GetFirstTuple(client_handle_t, tuple_t *);
10817c478bd9Sstevel@tonic-gate int32_t csx_GetNextTuple(client_handle_t, tuple_t *);
10827c478bd9Sstevel@tonic-gate int32_t csx_GetTupleData(client_handle_t, tuple_t *);
10837c478bd9Sstevel@tonic-gate int32_t csx_MapLogSocket(client_handle_t, map_log_socket_t *);
10847c478bd9Sstevel@tonic-gate int32_t csx_ValidateCIS(client_handle_t, cisinfo_t *);
10857c478bd9Sstevel@tonic-gate int32_t csx_MakeDeviceNode(client_handle_t, make_device_node_t *);
10867c478bd9Sstevel@tonic-gate int32_t csx_RemoveDeviceNode(client_handle_t, remove_device_node_t *);
10877c478bd9Sstevel@tonic-gate int32_t csx_ConvertSpeed(convert_speed_t *);
10887c478bd9Sstevel@tonic-gate int32_t csx_ConvertSize(convert_size_t *);
10897c478bd9Sstevel@tonic-gate int32_t csx_Event2Text(event2text_t *);
10907c478bd9Sstevel@tonic-gate int32_t csx_Error2Text(error2text_t *);
10917c478bd9Sstevel@tonic-gate int32_t csx_CS_DDI_Info(cs_ddi_info_t *);
10927c478bd9Sstevel@tonic-gate int32_t csx_CS_Sys_Ctl(cs_sys_ctl_t *);
10937c478bd9Sstevel@tonic-gate int32_t csx_ResetFunction(client_handle_t, reset_function_t *);
10947c478bd9Sstevel@tonic-gate int32_t csx_GetFirstClient(get_firstnext_client_t *);
10957c478bd9Sstevel@tonic-gate int32_t csx_GetNextClient(get_firstnext_client_t *);
10967c478bd9Sstevel@tonic-gate int32_t csx_GetClientInfo(client_handle_t, client_info_t *);
10977c478bd9Sstevel@tonic-gate int32_t csx_GetCardServicesInfo(client_handle_t, get_cardservices_info_t *);
10987c478bd9Sstevel@tonic-gate int32_t csx_GetConfigurationInfo(client_handle_t *, get_configuration_info_t *);
10997c478bd9Sstevel@tonic-gate int32_t csx_GetPhysicalAdapterInfo(client_handle_t,
11007c478bd9Sstevel@tonic-gate 					get_physical_adapter_info_t *);
11017c478bd9Sstevel@tonic-gate 
11027c478bd9Sstevel@tonic-gate /*
11037c478bd9Sstevel@tonic-gate  * CIS tuple parsing functions
11047c478bd9Sstevel@tonic-gate  */
11057c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_CONFIG(client_handle_t, tuple_t *, cistpl_config_t *);
11067c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE(client_handle_t, tuple_t *, cistpl_device_t *);
11077c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_A(client_handle_t, tuple_t *,
11087c478bd9Sstevel@tonic-gate 					cistpl_device_t *);
11097c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_OA(client_handle_t, tuple_t *,
11107c478bd9Sstevel@tonic-gate 					cistpl_device_t *);
11117c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICE_OC(client_handle_t, tuple_t *,
11127c478bd9Sstevel@tonic-gate 					cistpl_device_t *);
11137c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_VERS_1(client_handle_t, tuple_t *, cistpl_vers_1_t *);
11147c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_VERS_2(client_handle_t, tuple_t *, cistpl_vers_2_t *);
11157c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_JEDEC_A(client_handle_t, tuple_t *, cistpl_jedec_t *);
11167c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_JEDEC_C(client_handle_t, tuple_t *, cistpl_jedec_t *);
11177c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FORMAT(client_handle_t, tuple_t *, cistpl_format_t *);
11187c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FORMAT_A(client_handle_t, tuple_t *,
11197c478bd9Sstevel@tonic-gate 					cistpl_format_t *);
11207c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_GEOMETRY(client_handle_t, tuple_t *,
11217c478bd9Sstevel@tonic-gate 					cistpl_geometry_t *);
11227c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BYTEORDER(client_handle_t, tuple_t *,
11237c478bd9Sstevel@tonic-gate 					cistpl_byteorder_t *);
11247c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DATE(client_handle_t, tuple_t *, cistpl_date_t *);
11257c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BATTERY(client_handle_t, tuple_t *,
11267c478bd9Sstevel@tonic-gate 					cistpl_battery_t *);
11277c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_ORG(client_handle_t, tuple_t *, cistpl_org_t *);
11287c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_MANFID(client_handle_t, tuple_t *, cistpl_manfid_t *);
11297c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FUNCID(client_handle_t, tuple_t *, cistpl_funcid_t *);
11307c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_FUNCE(client_handle_t, tuple_t *, cistpl_funce_t *,
11317c478bd9Sstevel@tonic-gate 					uint32_t);
11327c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_CFTABLE_ENTRY(client_handle_t, tuple_t *,
11337c478bd9Sstevel@tonic-gate 					cistpl_cftable_entry_t *);
11347c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LINKTARGET(client_handle_t, tuple_t *,
11357c478bd9Sstevel@tonic-gate 					cistpl_linktarget_t *);
11367c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_A(client_handle_t, tuple_t *,
11377c478bd9Sstevel@tonic-gate 					cistpl_longlink_ac_t *);
11387c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_C(client_handle_t, tuple_t *,
11397c478bd9Sstevel@tonic-gate 					cistpl_longlink_ac_t *);
11407c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_MFC(client_handle_t, tuple_t *,
11417c478bd9Sstevel@tonic-gate 					cistpl_longlink_mfc_t *);
11427c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_SPCL(client_handle_t, tuple_t *,
11437c478bd9Sstevel@tonic-gate 					cistpl_spcl_t *);
11447c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_SWIL(client_handle_t, tuple_t *,
11457c478bd9Sstevel@tonic-gate 					cistpl_swil_t *);
11467c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_BAR(client_handle_t, tuple_t *,
11477c478bd9Sstevel@tonic-gate 					cistpl_bar_t *);
11487c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICEGEO(client_handle_t, tuple_t *,
11497c478bd9Sstevel@tonic-gate 					cistpl_devicegeo_t *);
11507c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_DEVICEGEO_A(client_handle_t, tuple_t *,
11517c478bd9Sstevel@tonic-gate 					cistpl_devicegeo_t *);
11527c478bd9Sstevel@tonic-gate int32_t csx_Parse_CISTPL_LONGLINK_CB(client_handle_t, tuple_t *,
11537c478bd9Sstevel@tonic-gate 					cistpl_longlink_cb_t *);
11547c478bd9Sstevel@tonic-gate int32_t csx_ParseTuple(client_handle_t, tuple_t *, cisparse_t *, uint32_t);
11557c478bd9Sstevel@tonic-gate 
11567c478bd9Sstevel@tonic-gate /*
11577c478bd9Sstevel@tonic-gate  * Data access functions
11587c478bd9Sstevel@tonic-gate  */
11597c478bd9Sstevel@tonic-gate void csx_Put8(acc_handle_t, uint32_t, uint8_t);
11607c478bd9Sstevel@tonic-gate void csx_Put16(acc_handle_t, uint32_t, uint16_t);
11617c478bd9Sstevel@tonic-gate void csx_Put32(acc_handle_t, uint32_t, uint32_t);
11627c478bd9Sstevel@tonic-gate void csx_Put64(acc_handle_t, uint32_t, uint64_t);
11637c478bd9Sstevel@tonic-gate uint8_t csx_Get8(acc_handle_t, uint32_t);
11647c478bd9Sstevel@tonic-gate uint16_t csx_Get16(acc_handle_t, uint32_t);
11657c478bd9Sstevel@tonic-gate uint32_t csx_Get32(acc_handle_t, uint32_t);
11667c478bd9Sstevel@tonic-gate uint64_t csx_Get64(acc_handle_t, uint32_t);
11677c478bd9Sstevel@tonic-gate void csx_RepPut8(acc_handle_t, uint8_t *, uint32_t, uint32_t, uint32_t);
11687c478bd9Sstevel@tonic-gate void csx_RepPut16(acc_handle_t, uint16_t *, uint32_t, uint32_t, uint32_t);
11697c478bd9Sstevel@tonic-gate void csx_RepPut32(acc_handle_t, uint32_t *, uint32_t, uint32_t, uint32_t);
11707c478bd9Sstevel@tonic-gate void csx_RepPut64(acc_handle_t, uint64_t *, uint32_t, uint32_t, uint32_t);
11717c478bd9Sstevel@tonic-gate void csx_RepGet8(acc_handle_t, uint8_t *, uint32_t, uint32_t, uint32_t);
11727c478bd9Sstevel@tonic-gate void csx_RepGet16(acc_handle_t, uint16_t *, uint32_t, uint32_t, uint32_t);
11737c478bd9Sstevel@tonic-gate void csx_RepGet32(acc_handle_t, uint32_t *, uint32_t, uint32_t, uint32_t);
11747c478bd9Sstevel@tonic-gate void csx_RepGet64(acc_handle_t, uint64_t *, uint32_t, uint32_t, uint32_t);
11757c478bd9Sstevel@tonic-gate 
11767c478bd9Sstevel@tonic-gate /*
11777c478bd9Sstevel@tonic-gate  * Data access handle manipulation functions
11787c478bd9Sstevel@tonic-gate  */
11797c478bd9Sstevel@tonic-gate int32_t csx_GetMappedAddr(acc_handle_t, void **);
11807c478bd9Sstevel@tonic-gate int32_t csx_GetPhysAddr(acc_handle_t, void **);
11817c478bd9Sstevel@tonic-gate int32_t csx_DupHandle(acc_handle_t, acc_handle_t *, uint32_t);
11827c478bd9Sstevel@tonic-gate int32_t csx_FreeHandle(acc_handle_t *);
11837c478bd9Sstevel@tonic-gate int32_t csx_GetHandleOffset(acc_handle_t,