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