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 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <sys/types.h> 35 #include <sys/ioccom.h> 36 #include <sys/scsi/generic/smp_frames.h> 37 38 #define SAS_WWN_BYTE_SIZE 8 39 40 typedef struct usmp_cmd { 41 caddr_t usmp_req; 42 caddr_t usmp_rsp; 43 size_t usmp_reqsize; 44 size_t usmp_rspsize; 45 int usmp_timeout; 46 } usmp_cmd_t; 47 48 #if defined(_SYSCALL32) && defined(_KERNEL) 49 50 typedef struct usmp_cmd32 { 51 caddr32_t usmp_req; 52 caddr32_t usmp_rsp; 53 size32_t usmp_reqsize; 54 size32_t usmp_rspsize; 55 int usmp_timeout; 56 } usmp_cmd32_t; 57 58 #define usmp_cmd32tousmp_cmd(u32, ucmd) \ 59 ucmd->usmp_req = (caddr_t)(uintptr_t)u32->usmp_req; \ 60 ucmd->usmp_rsp = (caddr_t)(uintptr_t)u32->usmp_rsp; \ 61 ucmd->usmp_reqsize = (size_t)u32->usmp_reqsize; \ 62 ucmd->usmp_rspsize = (size_t)u32->usmp_rspsize; \ 63 ucmd->usmp_timeout = u32->usmp_timeout; 64 65 #define usmp_cmdtousmp_cmd32(ucmd, u32) \ 66 u32->usmp_req = (caddr32_t)(uintptr_t)ucmd->usmp_req; \ 67 u32->usmp_rsp = (caddr32_t)(uintptr_t)ucmd->usmp_rsp; \ 68 u32->usmp_reqsize = (size32_t)ucmd->usmp_reqsize; \ 69 u32->usmp_rspsize = (size32_t)ucmd->usmp_rspsize; \ 70 u32->usmp_timeout = ucmd->usmp_timeout; 71 72 #endif /* _SYSCALL32 && _KERNEL */ 73 74 #define USMPFUNC _IO('S', 01) /* user smp function */ 75 76 #define SMP_DEFAULT_TIMEOUT 60 77 #define SMP_MIN_RESPONSE_SIZE 8 78 #define SMP_MIN_REQUEST_SIZE 8 79 #define SMP_MAX_RESPONSE_SIZE 1032 80 #define SMP_MAX_REQUEST_SIZE 1032 81 82 #ifdef __cplusplus 83 } 84 #endif 85 86 #endif /* _SYS_SCSI_IMPL_USMP_H */ 87