1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _CS_STUBS_H
28 #define	_CS_STUBS_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 
35 /*
36  * Magic number for Card Services to use when registering it's entry
37  *	point with the Card Services stubs module.
38  */
39 #define	CS_STUBS_MAGIC	0x19960300
40 
41 /*
42  * Card Services function identifiers - these correspond to the PCMCIA
43  *	standard function codes for CS with the exception of a few
44  *	private and implementation-specific function identifiers.
45  *
46  * client services functions
47  */
48 #define	GetCardServicesInfo		0x000b
49 #define	RegisterClient			0x0010
50 #define	DeregisterClient		0x0002
51 #define	GetStatus			0x000c
52 #define	ResetFunction			0x0011
53 #define	SetEventMask			0x0031
54 #define	GetEventMask			0x002e
55 /*
56  * reource management functions
57  */
58 #define	RequestIO			0x001f
59 #define	ReleaseIO			0x001b
60 #define	RequestIRQ			0x0020
61 #define	ReleaseIRQ			0x001c
62 #define	RequestWindow			0x0021
63 #define	ReleaseWindow			0x001d
64 #define	ModifyWindow			0x0017
65 #define	MapMemPage			0x0014
66 #define	RequestSocketMask		0x0022
67 #define	ReleaseSocketMask		0x002f
68 #define	RequestConfiguration		0x0030
69 #define	GetConfigurationInfo		0x0004
70 #define	ModifyConfiguration		0x0027
71 #define	ReleaseConfiguration		0x001e
72 #define	AccessConfigurationRegister	0x0036
73 /*
74  * bulk memory service functions
75  */
76 #define	OpenMemory			0x0018
77 #define	ReadMemory			0x0019
78 #define	WriteMemory			0x0024
79 #define	CopyMemory			0x0001
80 #define	RegisterEraseQueue		0x000f
81 #define	CheckEraseQueue			0x0026
82 #define	DeregisterEraseQueue		0x0025
83 #define	CloseMemory			0x0000
84 /*
85  * client utility functions
86  */
87 #define	GetFirstTuple			0x0007
88 #define	GetNextTuple			0x000a
89 #define	GetTupleData			0x000d
90 #define	GetFirstRegion			0x0006
91 #define	GetNextRegion			0x0009
92 #define	GetFirstPartition		0x0005
93 #define	GetNextPartition		0x0008
94 /*
95  * advanced client services functions
96  */
97 #define	ReturnSSEntry			0x0023
98 #define	MapLogSocket			0x0012
99 #define	MapPhySocket			0x0015
100 #define	MapLogWindow			0x0013
101 #define	MapPhyWindow			0x0016
102 #define	RegisterMTD			0x001a
103 #define	RegisterTimer			0x0028
104 #define	SetRegion			0x0029
105 #define	ValidateCIS			0x002b
106 #define	RequestExclusive		0x002c
107 #define	ReleaseExclusive		0x002d
108 #define	GetFirstClient			0x000e
109 #define	GetNextClient			0x002a
110 #define	GetClientInfo			0x0003
111 #define	AddSocketServices		0x0032
112 #define	ReplaceSocketServices		0x0033
113 #define	VendorSpecific			0x0034
114 #define	AdjustResourceInfo		0x0035
115 /*
116  * private functions - clients should never call these; if they do,
117  *	the system will esplode.
118  */
119 #define	CISRegister			0x1000
120 #define	CISUnregister			0x1001
121 #define	InitCISWindow			0x1002
122 /*
123  * Card Services functions specific to this implementation
124  */
125 #define	ParseTuple		0x2000	/* parses contents of tuples */
126 #define	MakeDeviceNode		0x2001	/* makes device nodes in fs */
127 #define	ConvertSpeed		0x2002	/* converts device speeds */
128 #define	ConvertSize		0x2003	/* converts device sizes */
129 #define	Event2Text		0x2004	/* return string of event type */
130 #define	Error2Text		0x2005	/* function or ret code string */
131 #define	CS_DDI_Info		0x2006	/* set/get DDI info */
132 #define	CS_Sys_Ctl		0x2007  /* CS system control */
133 #define	RemoveDeviceNode	0x2008	/* removes device nodes in fs */
134 #define	GetPhysicalAdapterInfo	0x2009	/* returns physical adapter info */
135 #define	CSFuncListEnd		0x8000	/* end of CS function list */
136 
137 /*
138  * Structure used when Card Services registers it's entry point with
139  *	the Card Services stubs module
140  */
141 typedef struct cs_register_cardservices_t {
142 	uint32_t	function;
143 	uint32_t	magic;
144 	csfunction_t	*cardservices;
145 	csfunction_t	*socketservices;
146 } cs_register_cardservices_t;
147 
148 /*
149  * Functions for cs_register_cardservices_t
150  */
151 #define	CS_ENTRY_REGISTER	0x0001
152 #define	CS_ENTRY_DEREGISTER	0x0002
153 #define	CS_ENTRY_INQUIRE	0x0003
154 
155 /*
156  * Function prototypes
157  */
158 int32_t csx_register_cardservices(cs_register_cardservices_t *);
159 
160 #ifdef	__cplusplus
161 }
162 #endif
163 
164 #endif	/* _CS_STUBS_H */
165