1b1dd958fScth /* 2b1dd958fScth * CDDL HEADER START 3b1dd958fScth * 4b1dd958fScth * The contents of this file are subject to the terms of the 5b1dd958fScth * Common Development and Distribution License, Version 1.0 only 6b1dd958fScth * (the "License"). You may not use this file except in compliance 7b1dd958fScth * with the License. 8b1dd958fScth * 9b1dd958fScth * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10b1dd958fScth * or http://www.opensolaris.org/os/licensing. 11b1dd958fScth * See the License for the specific language governing permissions 12b1dd958fScth * and limitations under the License. 13b1dd958fScth * 14b1dd958fScth * When distributing Covered Code, include this CDDL HEADER in each 15b1dd958fScth * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16b1dd958fScth * If applicable, add the following below this CDDL HEADER, with the 17b1dd958fScth * fields enclosed by brackets "[]" replaced with your own identifying 18b1dd958fScth * information: Portions Copyright [yyyy] [name of copyright owner] 19b1dd958fScth * 20b1dd958fScth * CDDL HEADER END 21b1dd958fScth */ 22b1dd958fScth /* 23b1dd958fScth * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24b1dd958fScth * Use is subject to license terms. 25b1dd958fScth */ 26b1dd958fScth 27b1dd958fScth #ifndef _SYS_SCSI_ADAPTERS_EMUL64_H 28b1dd958fScth #define _SYS_SCSI_ADAPTERS_EMUL64_H 29b1dd958fScth 30b1dd958fScth #pragma ident "%Z%%M% %I% %E% SMI" 31b1dd958fScth 32b1dd958fScth /* 33b1dd958fScth * This file defines the commands and structures for three emul64 ioctls, 34b1dd958fScth * that may be useful in speeding up tests involving large devices. The 35b1dd958fScth * ioctls are documented at 36b1dd958fScth * http://lvm.central.sun.com/projects/lagavulin/emul64_design.html#ioctl. 37b1dd958fScth * Briefly, there are three ioctls: 38b1dd958fScth * 39b1dd958fScth * EMUL64_WRITE_OFF - ignore all write operations to a specified block 40b1dd958fScth * range. 41b1dd958fScth * EMUL64_WRITE_ON - enable writes to a specified block range. 42b1dd958fScth * EMUL64_ZERO_RANGE - zero all blocks in the specified range. 43b1dd958fScth * 44b1dd958fScth * The emul64_range structure is used to specify a block range for these 45b1dd958fScth * ioctls. 46b1dd958fScth */ 47b1dd958fScth 48b1dd958fScth #ifdef __cplusplus 49b1dd958fScth extern "C" { 50b1dd958fScth #endif 51b1dd958fScth 52b1dd958fScth #include <sys/inttypes.h> 53b1dd958fScth #include <sys/types.h> 54*cefe316eSpd144616 #include <sys/scsi/scsi.h> 55b1dd958fScth 56b1dd958fScth /* 57b1dd958fScth * emul64 ioctl commands: 58b1dd958fScth */ 59b1dd958fScth 60b1dd958fScth #define EMUL64IOC ('e' << 8) 61b1dd958fScth 62b1dd958fScth #define EMUL64_WRITE_OFF (EMUL64IOC|37) 63b1dd958fScth #define EMUL64_WRITE_ON (EMUL64IOC|38) 64b1dd958fScth #define EMUL64_ZERO_RANGE (EMUL64IOC|39) 65*cefe316eSpd144616 #define EMUL64_ERROR_INJECT (EMUL64IOC|40) 66b1dd958fScth 67b1dd958fScth struct emul64_range { 68b1dd958fScth diskaddr_t emul64_sb; /* starting block # of range */ 69b1dd958fScth uint64_t emul64_blkcnt; /* # of blocks in range */ 70b1dd958fScth }; 71b1dd958fScth 72b1dd958fScth typedef struct emul64_range emul64_range_t; 73b1dd958fScth 74b1dd958fScth /* 75b1dd958fScth * Structure to use when specifying an ioctl for a range of blocks on a 76b1dd958fScth * specific target. 77b1dd958fScth */ 78b1dd958fScth struct emul64_tgt_range { 79b1dd958fScth emul64_range_t emul64_blkrange; /* blocks affected by ioctl */ 80b1dd958fScth ushort_t emul64_target; /* target number of disk */ 81b1dd958fScth ushort_t emul64_lun; /* lun of disk */ 82b1dd958fScth }; 83b1dd958fScth 84b1dd958fScth typedef struct emul64_tgt_range emul64_tgt_range_t; 85b1dd958fScth 86*cefe316eSpd144616 /* 87*cefe316eSpd144616 * Structure to use for specifying error injection sense data 88*cefe316eSpd144616 */ 89*cefe316eSpd144616 #define ERR_INJ_DISABLE 0 90*cefe316eSpd144616 #define ERR_INJ_ENABLE 1 91*cefe316eSpd144616 #define ERR_INJ_ENABLE_NODATA 2 92*cefe316eSpd144616 93*cefe316eSpd144616 struct emul64_error_inj_data { 94*cefe316eSpd144616 ushort_t eccd_target; 95*cefe316eSpd144616 ushort_t eccd_lun; 96*cefe316eSpd144616 ushort_t eccd_inj_state; /* ERR_INJ_DISABLE, ... */ 97*cefe316eSpd144616 ushort_t eccd_sns_dlen; /* Number of bytes of sense data */ 98*cefe316eSpd144616 struct scsi_status eccd_scsi_status; 99*cefe316eSpd144616 uchar_t eccd_pkt_reason; 100*cefe316eSpd144616 uint_t eccd_pkt_state; 101*cefe316eSpd144616 }; 102*cefe316eSpd144616 103b1dd958fScth #ifdef __cplusplus 104b1dd958fScth } 105b1dd958fScth #endif 106b1dd958fScth 107b1dd958fScth #endif /* _SYS_SCSI_ADAPTERS_EMUL64_H */ 108