185Scth /* 285Scth * CDDL HEADER START 385Scth * 485Scth * The contents of this file are subject to the terms of the 585Scth * Common Development and Distribution License, Version 1.0 only 685Scth * (the "License"). You may not use this file except in compliance 785Scth * with the License. 885Scth * 985Scth * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1085Scth * or http://www.opensolaris.org/os/licensing. 1185Scth * See the License for the specific language governing permissions 1285Scth * and limitations under the License. 1385Scth * 1485Scth * When distributing Covered Code, include this CDDL HEADER in each 1585Scth * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1685Scth * If applicable, add the following below this CDDL HEADER, with the 1785Scth * fields enclosed by brackets "[]" replaced with your own identifying 1885Scth * information: Portions Copyright [yyyy] [name of copyright owner] 1985Scth * 2085Scth * CDDL HEADER END 2185Scth */ 2285Scth /* 2385Scth * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 2485Scth * Use is subject to license terms. 2585Scth */ 2685Scth 2785Scth #ifndef _SYS_SCSI_ADAPTERS_EMUL64_H 2885Scth #define _SYS_SCSI_ADAPTERS_EMUL64_H 2985Scth 3085Scth #pragma ident "%Z%%M% %I% %E% SMI" 3185Scth 3285Scth /* 3385Scth * This file defines the commands and structures for three emul64 ioctls, 3485Scth * that may be useful in speeding up tests involving large devices. The 3585Scth * ioctls are documented at 3685Scth * http://lvm.central.sun.com/projects/lagavulin/emul64_design.html#ioctl. 3785Scth * Briefly, there are three ioctls: 3885Scth * 3985Scth * EMUL64_WRITE_OFF - ignore all write operations to a specified block 4085Scth * range. 4185Scth * EMUL64_WRITE_ON - enable writes to a specified block range. 4285Scth * EMUL64_ZERO_RANGE - zero all blocks in the specified range. 4385Scth * 4485Scth * The emul64_range structure is used to specify a block range for these 4585Scth * ioctls. 4685Scth */ 4785Scth 4885Scth #ifdef __cplusplus 4985Scth extern "C" { 5085Scth #endif 5185Scth 5285Scth #include <sys/inttypes.h> 5385Scth #include <sys/types.h> 54*1144Spd144616 #include <sys/scsi/scsi.h> 5585Scth 5685Scth /* 5785Scth * emul64 ioctl commands: 5885Scth */ 5985Scth 6085Scth #define EMUL64IOC ('e' << 8) 6185Scth 6285Scth #define EMUL64_WRITE_OFF (EMUL64IOC|37) 6385Scth #define EMUL64_WRITE_ON (EMUL64IOC|38) 6485Scth #define EMUL64_ZERO_RANGE (EMUL64IOC|39) 65*1144Spd144616 #define EMUL64_ERROR_INJECT (EMUL64IOC|40) 6685Scth 6785Scth struct emul64_range { 6885Scth diskaddr_t emul64_sb; /* starting block # of range */ 6985Scth uint64_t emul64_blkcnt; /* # of blocks in range */ 7085Scth }; 7185Scth 7285Scth typedef struct emul64_range emul64_range_t; 7385Scth 7485Scth /* 7585Scth * Structure to use when specifying an ioctl for a range of blocks on a 7685Scth * specific target. 7785Scth */ 7885Scth struct emul64_tgt_range { 7985Scth emul64_range_t emul64_blkrange; /* blocks affected by ioctl */ 8085Scth ushort_t emul64_target; /* target number of disk */ 8185Scth ushort_t emul64_lun; /* lun of disk */ 8285Scth }; 8385Scth 8485Scth typedef struct emul64_tgt_range emul64_tgt_range_t; 8585Scth 86*1144Spd144616 /* 87*1144Spd144616 * Structure to use for specifying error injection sense data 88*1144Spd144616 */ 89*1144Spd144616 #define ERR_INJ_DISABLE 0 90*1144Spd144616 #define ERR_INJ_ENABLE 1 91*1144Spd144616 #define ERR_INJ_ENABLE_NODATA 2 92*1144Spd144616 93*1144Spd144616 struct emul64_error_inj_data { 94*1144Spd144616 ushort_t eccd_target; 95*1144Spd144616 ushort_t eccd_lun; 96*1144Spd144616 ushort_t eccd_inj_state; /* ERR_INJ_DISABLE, ... */ 97*1144Spd144616 ushort_t eccd_sns_dlen; /* Number of bytes of sense data */ 98*1144Spd144616 struct scsi_status eccd_scsi_status; 99*1144Spd144616 uchar_t eccd_pkt_reason; 100*1144Spd144616 uint_t eccd_pkt_state; 101*1144Spd144616 }; 102*1144Spd144616 10385Scth #ifdef __cplusplus 10485Scth } 10585Scth #endif 10685Scth 10785Scth #endif /* _SYS_SCSI_ADAPTERS_EMUL64_H */ 108