xref: /titanic_44/usr/src/uts/common/sys/scsi/impl/usmp.h (revision 56b2bdd1f04d465cfe4a95b88ae5cba5884154e4)
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 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SCSI_IMPL_USMP_H
28 #define	_SYS_SCSI_IMPL_USMP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/ioccom.h>
38 #include <sys/scsi/generic/smp_frames.h>
39 
40 #define	SAS_WWN_BYTE_SIZE	8
41 
42 typedef struct usmp_cmd {
43 	caddr_t		usmp_req;
44 	caddr_t		usmp_rsp;
45 	size_t		usmp_reqsize;
46 	size_t		usmp_rspsize;
47 	int		usmp_timeout;
48 } usmp_cmd_t;
49 
50 #if defined(_SYSCALL32) && defined(_KERNEL)
51 
52 typedef struct usmp_cmd32 {
53 	caddr32_t	usmp_req;
54 	caddr32_t	usmp_rsp;
55 	size32_t	usmp_reqsize;
56 	size32_t	usmp_rspsize;
57 	int		usmp_timeout;
58 } usmp_cmd32_t;
59 
60 #define	usmp_cmd32tousmp_cmd(u32, ucmd)				\
61 	ucmd->usmp_req		= (caddr_t)(uintptr_t)u32->usmp_req;	\
62 	ucmd->usmp_rsp		= (caddr_t)(uintptr_t)u32->usmp_rsp; 	\
63 	ucmd->usmp_reqsize	= (size_t)u32->usmp_reqsize;		\
64 	ucmd->usmp_rspsize	= (size_t)u32->usmp_rspsize;		\
65 	ucmd->usmp_timeout	= u32->usmp_timeout;
66 
67 #define	usmp_cmdtousmp_cmd32(ucmd, u32)				\
68 	u32->usmp_req		= (caddr32_t)(uintptr_t)ucmd->usmp_req;	\
69 	u32->usmp_rsp		= (caddr32_t)(uintptr_t)ucmd->usmp_rsp;	\
70 	u32->usmp_reqsize	= (size32_t)ucmd->usmp_reqsize;		\
71 	u32->usmp_rspsize	= (size32_t)ucmd->usmp_rspsize;		\
72 	u32->usmp_timeout	= ucmd->usmp_timeout;
73 
74 #endif	/* _SYSCALL32 && _KERNEL */
75 
76 #define	USMPFUNC	_IO('S', 01)		/* user smp function */
77 
78 #define	SMP_DEFAULT_TIMEOUT	60
79 #define	SMP_MIN_RESPONSE_SIZE	8
80 #define	SMP_MIN_REQUEST_SIZE		8
81 #define	SMP_MAX_RESPONSE_SIZE	1032
82 #define	SMP_MAX_REQUEST_SIZE		1032
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _SYS_SCSI_IMPL_USMP_H */
89