xref: /illumos-gate/usr/src/uts/common/sys/scsi/impl/usmp.h (revision 2d6eb4a5)
1*936b7af6Sjw /*
2*936b7af6Sjw  * CDDL HEADER START
3*936b7af6Sjw  *
4*936b7af6Sjw  * The contents of this file are subject to the terms of the
5*936b7af6Sjw  * Common Development and Distribution License (the "License").
6*936b7af6Sjw  * You may not use this file except in compliance with the License.
7*936b7af6Sjw  *
8*936b7af6Sjw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*936b7af6Sjw  * or http://www.opensolaris.org/os/licensing.
10*936b7af6Sjw  * See the License for the specific language governing permissions
11*936b7af6Sjw  * and limitations under the License.
12*936b7af6Sjw  *
13*936b7af6Sjw  * When distributing Covered Code, include this CDDL HEADER in each
14*936b7af6Sjw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*936b7af6Sjw  * If applicable, add the following below this CDDL HEADER, with the
16*936b7af6Sjw  * fields enclosed by brackets "[]" replaced with your own identifying
17*936b7af6Sjw  * information: Portions Copyright [yyyy] [name of copyright owner]
18*936b7af6Sjw  *
19*936b7af6Sjw  * CDDL HEADER END
20*936b7af6Sjw  */
21*936b7af6Sjw 
22*936b7af6Sjw /*
23*936b7af6Sjw  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*936b7af6Sjw  * Use is subject to license terms.
25*936b7af6Sjw  */
26*936b7af6Sjw 
27*936b7af6Sjw #ifndef _SYS_SCSI_IMPL_USMP_H
28*936b7af6Sjw #define	_SYS_SCSI_IMPL_USMP_H
29*936b7af6Sjw 
30*936b7af6Sjw #ifdef	__cplusplus
31*936b7af6Sjw extern "C" {
32*936b7af6Sjw #endif
33*936b7af6Sjw 
34*936b7af6Sjw #include <sys/types.h>
35*936b7af6Sjw #include <sys/ioccom.h>
36*936b7af6Sjw #include <sys/scsi/generic/smp_frames.h>
37*936b7af6Sjw 
38*936b7af6Sjw #define	SAS_WWN_BYTE_SIZE	8
39*936b7af6Sjw 
40*936b7af6Sjw typedef struct usmp_cmd {
41*936b7af6Sjw 	caddr_t		usmp_req;
42*936b7af6Sjw 	caddr_t		usmp_rsp;
43*936b7af6Sjw 	size_t		usmp_reqsize;
44*936b7af6Sjw 	size_t		usmp_rspsize;
45*936b7af6Sjw 	int		usmp_timeout;
46*936b7af6Sjw } usmp_cmd_t;
47*936b7af6Sjw 
48*936b7af6Sjw #if defined(_SYSCALL32) && defined(_KERNEL)
49*936b7af6Sjw 
50*936b7af6Sjw typedef struct usmp_cmd32 {
51*936b7af6Sjw 	caddr32_t	usmp_req;
52*936b7af6Sjw 	caddr32_t	usmp_rsp;
53*936b7af6Sjw 	size32_t	usmp_reqsize;
54*936b7af6Sjw 	size32_t	usmp_rspsize;
55*936b7af6Sjw 	int		usmp_timeout;
56*936b7af6Sjw } usmp_cmd32_t;
57*936b7af6Sjw 
58*936b7af6Sjw #define	usmp_cmd32tousmp_cmd(u32, ucmd)				\
59*936b7af6Sjw 	ucmd->usmp_req		= (caddr_t)(uintptr_t)u32->usmp_req;	\
60*936b7af6Sjw 	ucmd->usmp_rsp		= (caddr_t)(uintptr_t)u32->usmp_rsp; 	\
61*936b7af6Sjw 	ucmd->usmp_reqsize	= (size_t)u32->usmp_reqsize;		\
62*936b7af6Sjw 	ucmd->usmp_rspsize	= (size_t)u32->usmp_rspsize;		\
63*936b7af6Sjw 	ucmd->usmp_timeout	= u32->usmp_timeout;
64*936b7af6Sjw 
65*936b7af6Sjw #define	usmp_cmdtousmp_cmd32(ucmd, u32)				\
66*936b7af6Sjw 	u32->usmp_req		= (caddr32_t)(uintptr_t)ucmd->usmp_req;	\
67*936b7af6Sjw 	u32->usmp_rsp		= (caddr32_t)(uintptr_t)ucmd->usmp_rsp;	\
68*936b7af6Sjw 	u32->usmp_reqsize	= (size32_t)ucmd->usmp_reqsize;		\
69*936b7af6Sjw 	u32->usmp_rspsize	= (size32_t)ucmd->usmp_rspsize;		\
70*936b7af6Sjw 	u32->usmp_timeout	= ucmd->usmp_timeout;
71*936b7af6Sjw 
72*936b7af6Sjw #endif	/* _SYSCALL32 && _KERNEL */
73*936b7af6Sjw 
74*936b7af6Sjw #define	USMPFUNC	_IO('S', 01)		/* user smp function */
75*936b7af6Sjw 
76*936b7af6Sjw #define	SMP_DEFAULT_TIMEOUT	60
77*936b7af6Sjw #define	SMP_MIN_RESPONSE_SIZE	8
78*936b7af6Sjw #define	SMP_MIN_REQUEST_SIZE		8
79*936b7af6Sjw #define	SMP_MAX_RESPONSE_SIZE	1032
80*936b7af6Sjw #define	SMP_MAX_REQUEST_SIZE		1032
81*936b7af6Sjw 
82*936b7af6Sjw #ifdef	__cplusplus
83*936b7af6Sjw }
84*936b7af6Sjw #endif
85*936b7af6Sjw 
86*936b7af6Sjw #endif	/* _SYS_SCSI_IMPL_USMP_H */
87