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