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