xref: /titanic_51/usr/src/uts/common/avs/ns/contract.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * The sole purpose of this file is to document our violations of the DDI
28  * in Solaris and to get ddict to run on the data services stack.
29  * Definitions and declarations contained in this file are never compiled
30  * into the code.  It is only included if we are running ddict on our src.
31  *
32  * IMPORTANT NOTE:
33  * Many of the declarations are not correct. It does not matter.
34  * Structure declarations only define the fields we require.
35  * Structures which we use in an opaque manner are defined as void *
36  */
37 
38 #ifndef	_SYS_CONTRACT_H
39 #define	_SYS_CONTRACT_H
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Define our interfaces for nsctl because ddict is stupid
47  * about intermodule dependencies
48  */
49 #include <sys/nsctl/nsctl_inter.h>
50 
51 /*
52  * Define our ncall interfaces
53  */
54 #include <sys/nsctl/ncall_inter.h>
55 
56 /*
57  * The STRUCT_DECL definitions in the ddict headers are fouled up
58  * we include our own model.h here to redefine it to avoid errors.
59  */
60 #if !defined(_SunOS_5_6)
61 #include <sys/nsctl/model.h>
62 #endif
63 
64 /*
65  * General violations
66  * Everybody violates these
67  * Why are they called ddi if it is not part of it?
68  */
69 
70 #define	DDI_PROP_NOTPROM 0
71 
72 int ddi_rele_driver(void) { }
73 int ddi_hold_installed_driver(void) { }
74 
75 /*
76  * SV module violations
77  */
78 void *curthread;
79 int devcnt;
80 
81 /*
82  * The following from vnode.h
83  */
84 typedef struct  vode {
85 	int v_lock;	/* SDBC uses this too */
86 	int v_type;	/* nskern too */
87 	int v_rdev;	/* nskern too */
88 } vnode_t;
89 
90 #define	FOLLOW 0
91 #define	NULLVPP NULL
92 #define	AT_RDEV 0
93 #define	VOP_GETATTR(vp, vap, f, cr) ((void)0)
94 #define	VN_RELE(vp) ((void)0)
95 
96 /*
97  *  The fields we use from vattr_t
98  */
99 typedef struct vattr {
100 	uint_t	va_mask;
101 	dev_t	va_rdev;
102 	int	va_size;	/* nskern */
103 } vattr_t;
104 
105 int lookupname(void, void, void, void, void) { }
106 
107 /*
108  * End of SV module violations
109  */
110 
111 /*
112  * DSW/II module violations
113  */
114 
115 /*
116  * This is really bogus that ddict does not understand sys/inttypes.h
117  */
118 #define	INT32_MIN	0
119 #define	INT32_MAX	0
120 #define	INT64_MAX	0
121 
122 /*
123  * End of DSW/II module violations
124  */
125 
126 /*
127  * UNISTAT module violations
128  */
129 
130 void mod_miscops;
131 typedef enum { B_FALSE, B_TRUE } boolean_t;
132 
133 /*
134  * End of UNISTAT module violations
135  */
136 
137 /*
138  * NSCTL module violations
139  */
140 #define	ERESTART 0
141 #define	EUSERS 0
142 #define	ENAMETOOLONG 0
143 #define	ENOSYS	0
144 #define	FOPEN	0
145 int ddi_name_to_major() { }
146 /*
147  * End of NSCTL module violations
148  */
149 
150 /*
151  * NSKERN module violations
152  */
153 #define	UL_GETFSIZE	0
154 #define	USHRT_MAX	0
155 
156 typedef	u_longlong_t	rlim64_t;
157 int ulimit() { }
158 int maxphys;
159 
160 #define	AT_SIZE	0
161 #define	VBLK	0
162 #define	VCHR	0
163 #define	VREG	0
164 #define	VLNK	0
165 
166 #define	VOP_CLOSE(vp, f, c, o, cr)	((void)0)
167 #define	VOP_RWLOCK(vp, w)	((void)0)
168 #define	VOP_RWUNLOCK(vp, w)	((void)0)
169 #define	VOP_READ(vp, uiop, iof, cr)	((void)0)
170 #define	VOP_WRITE(vp, uiop, iof, cr)	((void)0)
171 
172 int vn_open(char *pnamep, void seg, int filemode, int createmode,
173 		struct vnode **vpp, void crwhy, mode_t umask) { }
174 
175 /*
176  * End of NSKERN module violations
177  */
178 
179 /*
180  * NVRAM module violations
181  */
182 #define	MMU_PAGESIZE	0
183 
184 #ifndef MAXNAMELEN
185 #define	MAXNAMELEN	1
186 #endif
187 
188 #define	DEVMAP_DEFAULTS 0
189 #define	PFN_INVALID	-1
190 
191 char hw_serial[1];
192 int mmu_ptob(void arg) { }
193 int roundup(void arg) { }
194 
195 /*
196  * End of NVRAM module violations
197  */
198 
199 /*
200  * RDCSVR (SNDR) module
201  * Contract PSARC 2001/699
202  */
203 #define	DUP_DONE	0
204 #define	DUP_ERROR	0
205 #define	DUP_INPROGRESS	0
206 #define	DUP_NEW		0
207 #define	DUP_DROP	0
208 
209 #define	RPC_MAXDATASIZE	0
210 
211 
212 typedef void * file_t;		/* opaque */
213 typedef	void SVCXPRT;		/* opaque */
214 typedef	void SVCMASTERXPRT;	/* opaque */
215 typedef void xdrproc_t;		/* opaque */
216 typedef int enum_t;
217 
218 typedef struct svc_req {	/* required fields */
219 	int rq_vers;
220 	int rq_proc;
221 } svc_req_t;
222 
223 void SVC_FREEARGS(void xprt, void a, void *b) { }
224 void SVC_DUP(void xprt, void req, void i, void j, void *dr) { }
225 void svcerr_systemerr(void xprt) { }
226 void svcerr_noproc(void xprt) { }
227 void SVC_DUPDONE(void xprt, void dr, void a, void b, void c) { }
228 
229 SVCXPRT *svc_tli_kcreate(void *f, void *n, void *b, void **x, void *t,
230 	uint_t c, uint_t d) { }
231 
232 /*
233  * non-ddi not under contracts
234  */
235 struct netbuf {
236 	int	maxlen;
237 	int	len;
238 	char	*buf;
239 }
240 
241 /*
242  * End of RDCSRV module Contracts
243  */
244 
245 /*
246  * RDC (SNDR) module
247  * Contract PSARC 2001/699
248  */
249 
250 typedef	u_longlong_t	rpcproc_t;
251 typedef	u_longlong_t	xdrproc_t;
252 typedef	u_longlong_t	rpcvers_t;
253 #define	__dontcare__    -1
254 #define	RPC_INTR 0
255 #define	RPC_SUCCESS	0
256 #define	RPC_TLIERROR	0
257 #define	RPC_XPRTFAILED	0
258 #define	RPC_VERSMISMATCH	0
259 #define	RPC_PROGVERSMISMATCH 0
260 #define	RPC_INPROGRESS	0
261 
262 #define	ENOEXEC	0
263 #define	EBADF	0
264 
265 /*
266  * XDR routines
267  * from rpc/xdr.h
268  */
269 typedef	void * XDR;	/* opaque */
270 int xdr_void() { }
271 int xdr_int() { }
272 int xdr_union() { }
273 int xdr_enum() { }
274 int xdr_u_int() { }
275 int xdr_u_longlong_t() { }
276 int xdr_opaque() { }
277 int xdr_bytes() { }
278 int xdr_array() { }
279 #define	NULL_xdrproc_t ((xdrproc_t)0)
280 
281 /*
282  * The following imported rpc/clnt.h
283  */
284 
285 /* Client is mostly opaque exccept for the following */
286 
287 typedef struct __client {	/* required fields */
288 	void *cl_auth;
289 	bool_t cl_nosignal;
290 } CLIENT;
291 
292 #define	CLSET_PROGRESS	0
293 #define	KNC_STRSIZE	128
294 struct knetconfig {
295 	unsigned int	knc_semantics;
296 	caddr_t		knc_protofmly;
297 	caddr_t		knc_proto;
298 	dev_t		knc_rdev;
299 };
300 
301 void *clnt_sperrno() { }
302 void IS_UNRECOVERABLE_RPC(a) { }
303 void CLNT_CONTROL(cl, request, info) { }
304 void AUTH_DESTROY(void *a) { }
305 void CLNT_DESTROY(void *a) { }
306 
307 int clnt_tli_kcreate(void *a, void *b, void c, void d, void e, void f,
308 	void *g, void **h) { }
309 
310 int clnt_tli_kinit(void *h, void *config, void *addr, uint_t a, int b,
311 	void *c) { }
312 
313 void	 CLNT_CALL(void, void, void, void, void, void, void) { }
314 
315 /*
316  * The following imported from rpc/svc.h
317  */
318 void svc_sendreply() { }
319 void svcerr_decode() { }
320 void SVC_GETARGS() { }
321 
322 /*
323  * The following imported from sys/file.h
324  */
325 
326 void getf(void) { }
327 void releasef(void) { }
328 
329 /*
330  * Not under contract
331  */
332 void sigintr(void) { }
333 void sigunintr(void) { }
334 dev_t expldev() { }
335 
336 /*
337  * End of RDC module
338  */
339 
340 /*
341  * SDBC module violations
342  */
343 
344 /*
345  *  devid uses internal structure
346  *  from sys/ddi_impldefs.h
347  */
348 typedef struct impl_devid {
349 	uchar_t did_type_hi;
350 	uchar_t did_type_lo;
351 } impl_devid_t;
352 
353 #define	DEVID_GETTYPE(devid)  0
354 #define	DEVID_SCSI_SERIAL 0
355 
356 #define	ENOLINK	0	/* NCALL too */
357 #define	E2BIG	0
358 #define	ENOENT 0
359 #define	EIDRM 0
360 
361 #define	B_KERNBUF 0
362 #define	KSTAT_TYPE_RAW 0
363 #define	MAXPATHLEN 0
364 
365 #define	VN_HOLD(bp) ((void)0)
366 
367 /* Page list IO stuff */
368 typedef struct page {
369 	int v_count;	/* sdbc */
370 } page_t;
371 page_t kvp;		/* We use the kernel segment */
372 int page_add(void) { }
373 int page_find(void) { }
374 int page_list_concat(void) { }
375 int pageio_setup(void) { }
376 int pageio_done(void) { }
377 
378 void kobj_getsymvalue(void) { }
379 int ddi_dev_pathname(void) { }
380 
381 /*
382  * HACK ALERT
383  * struct buf hack for ddict.
384  * SDBC currently violates in struct buf
385  * 	b_pages
386  *	b_proc
387  * which we will define as the pad fields for ddict since
388  * we can not overload the definition of struct buf with our own stuff.
389  */
390 
391 #define	b_pages	b_pad7	/* b_pages in struct buf */
392 #define	b_proc	b_pad8	/* b_proc in struct buf */
393 #define	b_forw	b_pad1	/* b_forw in struct buf */
394 #define	b_back	b_pad2	/* b_back in struct buf */
395 
396 /*
397  * End of SDBC moduel violations
398  */
399 
400 /*
401  * SCMTEST module violations
402  */
403 
404 #define	ESRCH	0	/* NCALL too */
405 
406 /*
407  * End of SCMTEST module violations
408  */
409 /*
410  * SFTM module violations
411  * Note: XXX This list is currently incomplete
412  */
413 
414 typedef void * cqe_t;			/* opaque */
415 typedef void * fcal_packet_t;		/* opaque */
416 typedef void * soc_response_t;		/* opaque */
417 typedef void * la_els_logi_t;		/* opaque */
418 typedef void * la_els_adisc_t;		/* opaque */
419 typedef void * fcp_rsp_t;		/* opaque */
420 typedef void * soc_request_t;		/* opaque */
421 typedef void * els_payload_t;		/* opaque */
422 typedef void * la_els_logo_t;		/* opaque */
423 typedef void * fc_frame_header_t;	/* opaque */
424 
425 typedef struct la_els_prli_s {
426 	uchar_t		ls_code;
427 	uchar_t		page_length;
428 	ushort_t	payload_length;
429 	uchar_t		service_params[1];
430 } la_els_prli_t;
431 
432 typedef	la_els_prli_t la_els_prli_reply_t;
433 typedef la_els_prli_t la_els_prlo_t;
434 typedef	la_els_prli_t la_els_prlo_reply_t;
435 
436 /*
437  * The following from /usr/include/sys/fc4/fcp.h
438  */
439 typedef struct fcp_cntl {
440 	uchar_t	cntl_reserved_1	: 5,
441 		cntl_qtype	: 3;
442 	uchar_t	cntl_kill_tsk	: 1,
443 		cntl_clr_aca	: 1,
444 		cntl_reset	: 1,
445 		cntl_reserved_2	: 2,
446 		cntl_clr_tsk	: 1,
447 		cntl_abort_tsk	: 1,
448 		cntl_reserved_3	: 1;
449 	uchar_t	cntl_reserved_4	: 6,
450 		cntl_read_data	: 1,
451 		cntl_write_data	: 1;
452 } fcp_cntl_t;
453 
454 typedef struct fcp_ent_addr {
455 	ushort_t ent_addr_0;
456 	ushort_t ent_addr_1;
457 	ushort_t ent_addr_2;
458 	ushort_t ent_addr_3;
459 } fcp_ent_addr_t;
460 
461 typedef struct fcp_cmd_s {
462 	fcp_ent_addr_t	fcp_ent_addr;
463 	fcp_cntl_t	fcp_cntl;
464 	uchar_t		fcp_cdb[1];
465 	int		fcp_data_len;
466 } fcp_cmd_t;
467 
468 typedef struct fcal_transport {
469 	uchar_t dummy1;
470 	uchar_t dummy2;
471 } fcal_transport_t;
472 
473 /*
474  * End of SFTM module violations
475  */
476 
477 /*
478  * STE module violations
479  */
480 
481 typedef void  la_wwn_t;		/* opaque */
482 /* WWN formats from sys/fcal/fcal_linkapp.h */
483 typedef union la_wwn {
484 	uchar_t		raw_wwn[8];
485 	struct {
486 		uint_t	naa_id : 4;
487 		uint_t	nport_id : 12;
488 		uint_t	wwn_hi : 16;
489 		uint_t	wwn_lo;
490 	} w;
491 } la_wwn_t;
492 
493 insque(void) { }
494 remque(void) { }
495 snprintf(void) { }
496 
497 /*
498  * STE uses inq_serial and inq_ackqreqq from struct scsi_inquiry
499  */
500 #define	inq_serial	inq_pid
501 #define	inq_ackqreqq	inq_pid
502 /*
503  * End of STE module violations
504  */
505 
506 /*
507  * NCALL module violations
508  */
509 #define	ENONET	0
510 
511 /* NCALLSRV */
512 typedef int bool_t;
513 
514 /* NCALLIP */
515 #ifndef TRUE
516 #define	TRUE	1
517 #endif
518 
519 #ifndef FALSE
520 #define	FALSE	0
521 #endif
522 
523 #define	ERANGE	0
524 #define	ENODATA	0
525 
526 #define	RPC_TIMEDOUT 0
527 
528 /*
529  * End of NCALL violations
530  */
531 #ifdef	__cplusplus
532 }
533 #endif
534 
535 #endif /* _SYS_CONTRACT_H */
536