summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/pem.h
blob: 55a15713ecf1671b6b43b81149d5e54702e88f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 1999 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*
 * PCMCIA Event Manager Driver
 */

#ifndef _PEM_H
#define	_PEM_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef __cplusplus
extern "C" {
#endif

/* #define	PEM_DEBUG */

#define	PEM_MAX_EVENTS	64
#define	PEM_IDNUM	0x454D
#define	PEM_NAME	"pem"
#define	PEM_MIN		0
#define	PEM_MAX		1024
#define	PEM_HIWATER	4096
#define	PEM_LOWATER	1024

#define	EM_INIT_REQ	0
#define	EM_INFO_REQ	1
#define	EM_MODIFY_EVENT_MASK_REQ	2
#define	EM_GET_FIRST_TUPLE_REQ	3
#define	EM_GET_NEXT_TUPLE_REQ	4

#define	EM_INIT_ACK	5
#define	EM_INFO_ACK	6
#define	EM_EVENT_IND	7

#define	EM_ADAPTER_INFO_REQ	8
#define	EM_ADAPTER_INFO_ACK	9
#define	EM_SOCKET_INFO_REQ	10
#define	EM_SOCKET_INFO_ACK	11
#define	EM_GET_SOCKET_REQ	12
#define	EM_GET_SOCKET_ACK	13
#define	EM_IDENT_SOCKET_REQ	14
#define	EM_GET_FIRST_TUPLE_ACK	15

#define	EM_BADPRIM	1


#define	___VERSION(a, b)	(((a)<<8)|(b))
#define	EM_VERSION	___VERSION(0, 1)
#define	EM_CURRENT_VERSION	EM_VERSION

typedef
struct em_init_req {
	uint32_t	em_primitive;
	uint32_t	em_logical_socket;
	uint32_t	em_event_mask_offset;
	uint32_t	em_event_mask_length;
	uint32_t	em_event_class_offset;
	uint32_t	em_event_class_length;
} em_init_req_t;

typedef
struct em_info_req {
	uint32_t	em_primitive;
} em_info_req_t;

typedef
struct em_modify_event_mask_req {
	uint32_t	em_primitive;
} em_modify_event_mask_req_t;

typedef
struct em_get_first_tuple_req {
	uint32_t	em_primitive;
	uint32_t	em_socket;
	uint32_t	em_desired_tuple;
} em_get_first_tuple_req_t;

typedef
struct em_get_first_tuple_ack {
	uint32_t	em_primitive;
} em_get_first_tuple_ack_t;

typedef
struct em_get_next_tuple_req {
	uint32_t	em_primitive;
} em_get_next_tuple_req_t;

typedef
struct em_get_next_tuple_ack {
	uint32_t	em_primitive;
} em_get_next_tuple_ack_t;

typedef
struct em_info_ack {
	uint32_t	em_primitive;
	uint32_t	em_version;
	uint32_t	em_state;
	uint32_t	em_event_mask_offset;
	uint32_t	em_event_mask_length;
	uint32_t	em_event_class_offset;
	uint32_t	em_event_class_length;
} em_info_ack_t;

typedef
struct em_event_ind {
	uint32_t	em_primitive;
	uint32_t	em_logical_socket;
	uint32_t	em_event;
	uint32_t	em_event_info_offset;
	uint32_t	em_event_info_length;
} em_event_ind_t;

typedef
struct em_init_ack {
	uint32_t	em_primitive;
} em_init_ack_t;

/* adapter info is essentially InquireAdapter */
typedef
struct em_adapter_info_req {
	uint32_t	em_primitive;
} em_adapter_info_req_t;

typedef
struct em_adapter_info_ack {
	uint32_t	em_primitive;
	uint32_t	em_num_sockets;
	uint32_t	em_num_windows;
	uint32_t	em_num_power;
	uint32_t	em_power_offset;
	uint32_t	em_power_length;
} em_adapter_info_ack_t;

/* socket_info is essentially InquireSocket */
typedef
struct em_socket_info_req {
	uint32_t	em_primitive;
	uint32_t	em_socket;
} em_socket_info_req_t;

typedef
struct em_socket_info_ack {
	uint32_t	em_primitive;
	uint32_t	em_status_int_caps;
	uint32_t	em_status_report_caps;
	uint32_t	em_control_indicator_caps;
	uint32_t	em_socket_caps;
} em_socket_info_ack_t;

/* get_socket */
typedef
struct em_get_socket_req {
	uint32_t	em_primitive;
	uint32_t	em_socket;
} em_get_socket_req_t;

typedef
struct em_get_socket_ack {
	uint32_t	em_primitive;
	uint32_t	em_socket;
	uint32_t	em_vcc_level;
	uint32_t	em_vpp1_level;
	uint32_t	em_vpp2_level;
	uint32_t	em_state;
	uint32_t	em_control_ind;
	uint32_t	em_ireq_routing;
	uint32_t	em_iftype;
} em_get_socket_ack_t;

typedef
struct em_ident_socket_req {
	uint32_t	em_primitive;
	uint32_t	em_socket;
} em_ident_socket_req_t;

union em_primitives {
	uint32_t		   em_primitive;
	em_init_req_t		   init_req;
	em_info_req_t		   info_req;
	em_get_first_tuple_req_t   get_first_tuple_req;
	em_get_next_tuple_req_t	   get_next_tuple_req;
	em_info_ack_t		   info_ack;
	em_event_ind_t		   event_ind;
	em_modify_event_mask_req_t modify_event_mask_req;
	em_get_socket_req_t	   get_socket_req;
	em_ident_socket_req_t	   ident_socket_req;
};

#define	EM_CLASS_SIZE	32
#define	EM_EVENT_MASK_SIZE	32

#if defined(_KERNEL)
#define	EM_EVENT_SIZE	4
typedef struct pem {
	uint32_t pem_flags;
	uint32_t pem_state;
	uint32_t pem_id;
	minor_t  pem_minor;
	queue_t *pem_qptr;
	mblk_t	*pem_mb;
	uchar_t  pem_event_class[EM_CLASS_SIZE/sizeof (uchar_t)];
	uchar_t	 pem_event_mask[EM_EVENT_MASK_SIZE/sizeof (uchar_t)];
} pem_t;

#define	EM_INIT	1
#define	PEMF_EVENTS	0x0001
#define	PEMF_CLASSES	0x0002
#define	PEMF_INIT	0x0004

#define	PEMMAXINFO	(16 + sizeof (struct pcm_make_dev))
struct pem_event {
	int	pe_owner;
	int	pe_id;
	int	pe_event;
	int	pe_socket;
	uchar_t	pe_info[PEMMAXINFO];
};
#define	PE_OWN_FREE	0
#define	PE_OWN_CLAIMED	1
#define	PE_OWN_HANDLER	2

#define	PEME_OK			0
#define	PEME_NO_INFO		1
#define	PEME_UNAVAILABLE	2
#define	PEME_NO_CIS		3
#define	PEME_NO_TUPLE		4

#define	PEMTRACE	0x0001
#define	PEMERRS		0x0002

#endif

#ifdef __cplusplus
}
#endif

#endif /* _PEM_H */