xref: /titanic_52/usr/src/uts/common/sys/dkio.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_DKIO_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_DKIO_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS-4.0 5.19 */
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/dklabel.h>	/* Needed for NDKMAP define */
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
35*7c478bd9Sstevel@tonic-gate extern "C" {
36*7c478bd9Sstevel@tonic-gate #endif
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /*
39*7c478bd9Sstevel@tonic-gate  * Structures and definitions for disk io control commands
40*7c478bd9Sstevel@tonic-gate  */
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Structures used as data by ioctl calls.
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define	DK_DEVLEN	16		/* device name max length, including */
47*7c478bd9Sstevel@tonic-gate 					/* unit # & NULL (ie - "xyc1") */
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate /*
50*7c478bd9Sstevel@tonic-gate  * Used for controller info
51*7c478bd9Sstevel@tonic-gate  */
52*7c478bd9Sstevel@tonic-gate struct dk_cinfo {
53*7c478bd9Sstevel@tonic-gate 	char	dki_cname[DK_DEVLEN];	/* controller name (no unit #) */
54*7c478bd9Sstevel@tonic-gate 	ushort_t dki_ctype;		/* controller type */
55*7c478bd9Sstevel@tonic-gate 	ushort_t dki_flags;		/* flags */
56*7c478bd9Sstevel@tonic-gate 	ushort_t dki_cnum;		/* controller number */
57*7c478bd9Sstevel@tonic-gate 	uint_t	dki_addr;		/* controller address */
58*7c478bd9Sstevel@tonic-gate 	uint_t	dki_space;		/* controller bus type */
59*7c478bd9Sstevel@tonic-gate 	uint_t	dki_prio;		/* interrupt priority */
60*7c478bd9Sstevel@tonic-gate 	uint_t	dki_vec;		/* interrupt vector */
61*7c478bd9Sstevel@tonic-gate 	char	dki_dname[DK_DEVLEN];	/* drive name (no unit #) */
62*7c478bd9Sstevel@tonic-gate 	uint_t	dki_unit;		/* unit number */
63*7c478bd9Sstevel@tonic-gate 	uint_t	dki_slave;		/* slave number */
64*7c478bd9Sstevel@tonic-gate 	ushort_t dki_partition;		/* partition number */
65*7c478bd9Sstevel@tonic-gate 	ushort_t dki_maxtransfer;	/* max. transfer size in DEV_BSIZE */
66*7c478bd9Sstevel@tonic-gate };
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate /*
69*7c478bd9Sstevel@tonic-gate  * Controller types
70*7c478bd9Sstevel@tonic-gate  */
71*7c478bd9Sstevel@tonic-gate #define	DKC_UNKNOWN	0
72*7c478bd9Sstevel@tonic-gate #define	DKC_CDROM	1	/* CD-ROM, SCSI or otherwise */
73*7c478bd9Sstevel@tonic-gate #define	DKC_WDC2880	2
74*7c478bd9Sstevel@tonic-gate #define	DKC_XXX_0	3	/* unassigned */
75*7c478bd9Sstevel@tonic-gate #define	DKC_XXX_1	4	/* unassigned */
76*7c478bd9Sstevel@tonic-gate #define	DKC_DSD5215	5
77*7c478bd9Sstevel@tonic-gate #define	DKC_ACB4000	7
78*7c478bd9Sstevel@tonic-gate #define	DKC_MD21	8
79*7c478bd9Sstevel@tonic-gate #define	DKC_XXX_2	9	/* unassigned */
80*7c478bd9Sstevel@tonic-gate #define	DKC_NCRFLOPPY	10
81*7c478bd9Sstevel@tonic-gate #define	DKC_SMSFLOPPY	12
82*7c478bd9Sstevel@tonic-gate #define	DKC_SCSI_CCS	13	/* SCSI CCS compatible */
83*7c478bd9Sstevel@tonic-gate #define	DKC_INTEL82072	14	/* native floppy chip */
84*7c478bd9Sstevel@tonic-gate #define	DKC_MD		16	/* meta-disk (virtual-disk) driver */
85*7c478bd9Sstevel@tonic-gate #define	DKC_INTEL82077	19	/* 82077 floppy disk controller */
86*7c478bd9Sstevel@tonic-gate #define	DKC_DIRECT	20	/* Intel direct attached device i.e. IDE */
87*7c478bd9Sstevel@tonic-gate #define	DKC_PCMCIA_MEM	21	/* PCMCIA memory disk-like type */
88*7c478bd9Sstevel@tonic-gate #define	DKC_PCMCIA_ATA	22	/* PCMCIA AT Attached type */
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate /*
91*7c478bd9Sstevel@tonic-gate  * Sun reserves up through 1023
92*7c478bd9Sstevel@tonic-gate  */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate #define	DKC_CUSTOMER_BASE	1024
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /*
97*7c478bd9Sstevel@tonic-gate  * Flags
98*7c478bd9Sstevel@tonic-gate  */
99*7c478bd9Sstevel@tonic-gate #define	DKI_BAD144	0x01	/* use DEC std 144 bad sector fwding */
100*7c478bd9Sstevel@tonic-gate #define	DKI_MAPTRK	0x02	/* controller does track mapping */
101*7c478bd9Sstevel@tonic-gate #define	DKI_FMTTRK	0x04	/* formats only full track at a time */
102*7c478bd9Sstevel@tonic-gate #define	DKI_FMTVOL	0x08	/* formats only full volume at a time */
103*7c478bd9Sstevel@tonic-gate #define	DKI_FMTCYL	0x10	/* formats only full cylinders at a time */
104*7c478bd9Sstevel@tonic-gate #define	DKI_HEXUNIT	0x20	/* unit number is printed as 3 hex digits */
105*7c478bd9Sstevel@tonic-gate #define	DKI_PCMCIA_PFD	0x40	/* PCMCIA pseudo-floppy memory card */
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate /*
108*7c478bd9Sstevel@tonic-gate  * Used for all partitions
109*7c478bd9Sstevel@tonic-gate  */
110*7c478bd9Sstevel@tonic-gate struct dk_allmap {
111*7c478bd9Sstevel@tonic-gate 	struct dk_map	dka_map[NDKMAP];
112*7c478bd9Sstevel@tonic-gate };
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
115*7c478bd9Sstevel@tonic-gate struct dk_allmap32 {
116*7c478bd9Sstevel@tonic-gate 	struct dk_map32	dka_map[NDKMAP];
117*7c478bd9Sstevel@tonic-gate };
118*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate /*
121*7c478bd9Sstevel@tonic-gate  * Definition of a disk's geometry
122*7c478bd9Sstevel@tonic-gate  */
123*7c478bd9Sstevel@tonic-gate struct dk_geom {
124*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_ncyl;	/* # of data cylinders */
125*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_acyl;	/* # of alternate cylinders */
126*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_bcyl;	/* cyl offset (for fixed head area) */
127*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_nhead;	/* # of heads */
128*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs1;	/* obsolete */
129*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_nsect;	/* # of data sectors per track */
130*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_intrlv;	/* interleave factor */
131*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs2;	/* obsolete */
132*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs3;	/* obsolete */
133*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_apc;	/* alternates per cyl (SCSI only) */
134*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_rpm;	/* revolutions per minute */
135*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_pcyl;	/* # of physical cylinders */
136*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_write_reinstruct;	/* # sectors to skip, writes */
137*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_read_reinstruct;	/* # sectors to skip, reads */
138*7c478bd9Sstevel@tonic-gate 	unsigned short	dkg_extra[7];	/* for compatible expansion */
139*7c478bd9Sstevel@tonic-gate };
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate /*
142*7c478bd9Sstevel@tonic-gate  * These defines are for historic compatibility with old drivers.
143*7c478bd9Sstevel@tonic-gate  */
144*7c478bd9Sstevel@tonic-gate #define	dkg_bhead	dkg_obs1	/* used to be head offset */
145*7c478bd9Sstevel@tonic-gate #define	dkg_gap1	dkg_obs2	/* used to be gap1 */
146*7c478bd9Sstevel@tonic-gate #define	dkg_gap2	dkg_obs3	/* used to be gap2 */
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate /*
149*7c478bd9Sstevel@tonic-gate  * Disk io control commands
150*7c478bd9Sstevel@tonic-gate  * Warning: some other ioctls with the DIOC prefix exist elsewhere.
151*7c478bd9Sstevel@tonic-gate  * The Generic DKIOC numbers are from	0   -  50.
152*7c478bd9Sstevel@tonic-gate  *	The Floppy Driver uses		51  - 100.
153*7c478bd9Sstevel@tonic-gate  *	The Hard Disk (except SCSI)	101 - 106.	(these are obsolete)
154*7c478bd9Sstevel@tonic-gate  *	The CDROM Driver		151 - 200.
155*7c478bd9Sstevel@tonic-gate  *	The USCSI ioctl			201 - 250.
156*7c478bd9Sstevel@tonic-gate  */
157*7c478bd9Sstevel@tonic-gate #define	DKIOC		(0x04 << 8)
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * The following ioctls are generic in nature and need to be
161*7c478bd9Sstevel@tonic-gate  * suported as appropriate by all disk drivers
162*7c478bd9Sstevel@tonic-gate  */
163*7c478bd9Sstevel@tonic-gate #define	DKIOCGGEOM	(DKIOC|1)		/* Get geometry */
164*7c478bd9Sstevel@tonic-gate #define	DKIOCINFO	(DKIOC|3)		/* Get info */
165*7c478bd9Sstevel@tonic-gate #define	DKIOCEJECT	(DKIOC|6)		/* Generic 'eject' */
166*7c478bd9Sstevel@tonic-gate #define	DKIOCGVTOC	(DKIOC|11)		/* Get VTOC */
167*7c478bd9Sstevel@tonic-gate #define	DKIOCSVTOC	(DKIOC|12)		/* Set VTOC & Write to Disk */
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate /*
170*7c478bd9Sstevel@tonic-gate  * The following ioctls are used by Sun drivers to communicate
171*7c478bd9Sstevel@tonic-gate  * with their associated format routines. Support of these ioctls
172*7c478bd9Sstevel@tonic-gate  * is not required of foreign drivers
173*7c478bd9Sstevel@tonic-gate  */
174*7c478bd9Sstevel@tonic-gate #define	DKIOCSGEOM	(DKIOC|2)		/* Set geometry */
175*7c478bd9Sstevel@tonic-gate #define	DKIOCSAPART	(DKIOC|4)		/* Set all partitions */
176*7c478bd9Sstevel@tonic-gate #define	DKIOCGAPART	(DKIOC|5)		/* Get all partitions */
177*7c478bd9Sstevel@tonic-gate #define	DKIOCG_PHYGEOM	(DKIOC|32)		/* get physical geometry */
178*7c478bd9Sstevel@tonic-gate #define	DKIOCG_VIRTGEOM	(DKIOC|33)		/* get virtual geometry */
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate /*
181*7c478bd9Sstevel@tonic-gate  * The following ioctl's are removable media support
182*7c478bd9Sstevel@tonic-gate  */
183*7c478bd9Sstevel@tonic-gate #define	DKIOCLOCK	(DKIOC|7)	/* Generic 'lock' */
184*7c478bd9Sstevel@tonic-gate #define	DKIOCUNLOCK	(DKIOC|8)	/* Generic 'unlock' */
185*7c478bd9Sstevel@tonic-gate #define	DKIOCSTATE	(DKIOC|13)	/* Inquire insert/eject state */
186*7c478bd9Sstevel@tonic-gate #define	DKIOCREMOVABLE	(DKIOC|16)	/* is media removable */
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate /*
189*7c478bd9Sstevel@tonic-gate  * Ioctl to force driver to re-read the alternate partition and rebuild
190*7c478bd9Sstevel@tonic-gate  * the internal defect map.
191*7c478bd9Sstevel@tonic-gate  */
192*7c478bd9Sstevel@tonic-gate #define	DKIOCADDBAD	(DKIOC|20)	/* Re-read the alternate map (IDE) */
193*7c478bd9Sstevel@tonic-gate #define	DKIOCGETDEF	(DKIOC|21)	/* read defect list (IDE)	   */
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate /*
196*7c478bd9Sstevel@tonic-gate  * Used by applications to get disk defect information from IDE
197*7c478bd9Sstevel@tonic-gate  * drives.
198*7c478bd9Sstevel@tonic-gate  */
199*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
200*7c478bd9Sstevel@tonic-gate struct defect_header32 {
201*7c478bd9Sstevel@tonic-gate 	int		head;
202*7c478bd9Sstevel@tonic-gate 	caddr32_t	buffer;
203*7c478bd9Sstevel@tonic-gate };
204*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate struct defect_header {
207*7c478bd9Sstevel@tonic-gate 	int		head;
208*7c478bd9Sstevel@tonic-gate 	caddr_t		buffer;
209*7c478bd9Sstevel@tonic-gate };
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate #define	DKIOCPARTINFO	(DKIOC|22)	/* Get partition or slice parameters */
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate /*
214*7c478bd9Sstevel@tonic-gate  * Used by applications to get partition or slice information
215*7c478bd9Sstevel@tonic-gate  */
216*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
217*7c478bd9Sstevel@tonic-gate struct part_info32 {
218*7c478bd9Sstevel@tonic-gate 	daddr32_t	p_start;
219*7c478bd9Sstevel@tonic-gate 	int		p_length;
220*7c478bd9Sstevel@tonic-gate };
221*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate struct part_info {
224*7c478bd9Sstevel@tonic-gate 	daddr_t		p_start;
225*7c478bd9Sstevel@tonic-gate 	int		p_length;
226*7c478bd9Sstevel@tonic-gate };
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate /* The following ioctls are for Optical Memory Device */
229*7c478bd9Sstevel@tonic-gate #define	DKIOC_EBP_ENABLE  (DKIOC|40)	/* enable by pass erase on write */
230*7c478bd9Sstevel@tonic-gate #define	DKIOC_EBP_DISABLE (DKIOC|41)	/* disable by pass erase on write */
231*7c478bd9Sstevel@tonic-gate 
232*7c478bd9Sstevel@tonic-gate /*
233*7c478bd9Sstevel@tonic-gate  * This state enum is the argument passed to the DKIOCSTATE ioctl.
234*7c478bd9Sstevel@tonic-gate  */
235*7c478bd9Sstevel@tonic-gate enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE };
236*7c478bd9Sstevel@tonic-gate 
237*7c478bd9Sstevel@tonic-gate #define	DKIOCGMEDIAINFO	(DKIOC|42)	/* get information about the media */
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate /*
240*7c478bd9Sstevel@tonic-gate  * ioctls to read/write mboot info.
241*7c478bd9Sstevel@tonic-gate  */
242*7c478bd9Sstevel@tonic-gate #define	DKIOCGMBOOT	(DKIOC|43)	/* get mboot info */
243*7c478bd9Sstevel@tonic-gate #define	DKIOCSMBOOT	(DKIOC|44)	/* set mboot info */
244*7c478bd9Sstevel@tonic-gate 
245*7c478bd9Sstevel@tonic-gate /*
246*7c478bd9Sstevel@tonic-gate  * ioctl to get the device temperature.
247*7c478bd9Sstevel@tonic-gate  */
248*7c478bd9Sstevel@tonic-gate #define	DKIOCGTEMPERATURE	(DKIOC|45)	/* get temperature */
249*7c478bd9Sstevel@tonic-gate 
250*7c478bd9Sstevel@tonic-gate /*
251*7c478bd9Sstevel@tonic-gate  * Used for providing the temperature.
252*7c478bd9Sstevel@tonic-gate  */
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate struct	dk_temperature	{
255*7c478bd9Sstevel@tonic-gate 	uint_t		dkt_flags;	/* Flags */
256*7c478bd9Sstevel@tonic-gate 	short		dkt_cur_temp;	/* Current disk temperature */
257*7c478bd9Sstevel@tonic-gate 	short		dkt_ref_temp;	/* reference disk temperature */
258*7c478bd9Sstevel@tonic-gate };
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate #define	DKT_BYPASS_PM		0x1
261*7c478bd9Sstevel@tonic-gate #define	DKT_INVALID_TEMP	0xFFFF
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate /*
265*7c478bd9Sstevel@tonic-gate  * Used for Media info or the current profile info
266*7c478bd9Sstevel@tonic-gate  */
267*7c478bd9Sstevel@tonic-gate struct dk_minfo {
268*7c478bd9Sstevel@tonic-gate 	uint_t		dki_media_type;	/* Media type or profile info */
269*7c478bd9Sstevel@tonic-gate 	uint_t		dki_lbsize;	/* Logical blocksize of media */
270*7c478bd9Sstevel@tonic-gate 	diskaddr_t	dki_capacity;	/* Capacity as # of dki_lbsize blks */
271*7c478bd9Sstevel@tonic-gate };
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate /*
274*7c478bd9Sstevel@tonic-gate  * Media types or profiles known
275*7c478bd9Sstevel@tonic-gate  */
276*7c478bd9Sstevel@tonic-gate #define	DK_UNKNOWN		0x00	/* Media inserted - type unknown */
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate /*
280*7c478bd9Sstevel@tonic-gate  * SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
281*7c478bd9Sstevel@tonic-gate  * maintain compatibility with SFF8090.  The following define the
282*7c478bd9Sstevel@tonic-gate  * optical media type.
283*7c478bd9Sstevel@tonic-gate  */
284*7c478bd9Sstevel@tonic-gate #define	DK_MO_ERASABLE		0x03 /* MO Erasable */
285*7c478bd9Sstevel@tonic-gate #define	DK_MO_WRITEONCE		0x04 /* MO Write once */
286*7c478bd9Sstevel@tonic-gate #define	DK_AS_MO		0x05 /* AS MO */
287*7c478bd9Sstevel@tonic-gate #define	DK_CDROM		0x08 /* CDROM */
288*7c478bd9Sstevel@tonic-gate #define	DK_CDR			0x09 /* CD-R */
289*7c478bd9Sstevel@tonic-gate #define	DK_CDRW			0x0A /* CD-RW */
290*7c478bd9Sstevel@tonic-gate #define	DK_DVDROM		0x10 /* DVD-ROM */
291*7c478bd9Sstevel@tonic-gate #define	DK_DVDR			0x11 /* DVD-R */
292*7c478bd9Sstevel@tonic-gate #define	DK_DVDRAM		0x12 /* DVD_RAM or DVD-RW */
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate /*
295*7c478bd9Sstevel@tonic-gate  * Media types for other rewritable magnetic media
296*7c478bd9Sstevel@tonic-gate  */
297*7c478bd9Sstevel@tonic-gate #define	DK_FIXED_DISK		0x10001	/* Fixed disk SCSI or otherwise */
298*7c478bd9Sstevel@tonic-gate #define	DK_FLOPPY		0x10002 /* Floppy media */
299*7c478bd9Sstevel@tonic-gate #define	DK_ZIP			0x10003 /* IOMEGA ZIP media */
300*7c478bd9Sstevel@tonic-gate #define	DK_JAZ			0x10004 /* IOMEGA JAZ media */
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate #define	DKIOCSETEFI	(DKIOC|17)		/* Set EFI info */
303*7c478bd9Sstevel@tonic-gate #define	DKIOCGETEFI	(DKIOC|18)		/* Get EFI info */
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate #define	DKIOCPARTITION	(DKIOC|9)		/* Get partition info */
306*7c478bd9Sstevel@tonic-gate 
307*7c478bd9Sstevel@tonic-gate /*
308*7c478bd9Sstevel@tonic-gate  * Ioctls to get/set volume capabilities related to Logical Volume Managers.
309*7c478bd9Sstevel@tonic-gate  * They include the ability to get/set capabilities and to issue a read to a
310*7c478bd9Sstevel@tonic-gate  * specific underlying device of a replicated device.
311*7c478bd9Sstevel@tonic-gate  */
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate #define	DKIOCGETVOLCAP	(DKIOC | 25)	/* Get volume capabilities */
314*7c478bd9Sstevel@tonic-gate #define	DKIOCSETVOLCAP	(DKIOC | 26)	/* Set volume capabilities */
315*7c478bd9Sstevel@tonic-gate #define	DKIOCDMR	(DKIOC | 27)	/* Issue a directed read */
316*7c478bd9Sstevel@tonic-gate 
317*7c478bd9Sstevel@tonic-gate typedef uint_t volcapinfo_t;
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate typedef uint_t volcapset_t;
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate #define	DKV_ABR_CAP 0x00000001		/* Support Appl.Based Recovery */
322*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_CAP 0x00000002		/* Support Directed  Mirror Read */
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate typedef struct volcap {
325*7c478bd9Sstevel@tonic-gate 	volcapinfo_t vc_info;	/* Capabilities available */
326*7c478bd9Sstevel@tonic-gate 	volcapset_t vc_set;	/* Capabilities set */
327*7c478bd9Sstevel@tonic-gate } volcap_t;
328*7c478bd9Sstevel@tonic-gate 
329*7c478bd9Sstevel@tonic-gate #define	VOL_SIDENAME 256
330*7c478bd9Sstevel@tonic-gate 
331*7c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd {
332*7c478bd9Sstevel@tonic-gate 	int		vdr_flags;
333*7c478bd9Sstevel@tonic-gate 	offset_t	vdr_offset;
334*7c478bd9Sstevel@tonic-gate 	size_t		vdr_nbytes;
335*7c478bd9Sstevel@tonic-gate 	size_t		vdr_bytesread;
336*7c478bd9Sstevel@tonic-gate 	void		*vdr_data;
337*7c478bd9Sstevel@tonic-gate 	int		vdr_side;
338*7c478bd9Sstevel@tonic-gate 	char		vdr_side_name[VOL_SIDENAME];
339*7c478bd9Sstevel@tonic-gate } vol_directed_rd_t;
340*7c478bd9Sstevel@tonic-gate 
341*7c478bd9Sstevel@tonic-gate #define	DKV_SIDE_INIT		(-1)
342*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_NEXT_SIDE	0x00000001
343*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_DONE		0x00000002
344*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_ERROR		0x00000004
345*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_SUCCESS		0x00000008
346*7c478bd9Sstevel@tonic-gate #define	DKV_DMR_SHORT		0x00000010
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate #ifdef _MULTI_DATAMODEL
349*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
350*7c478bd9Sstevel@tonic-gate #pragma pack(4)
351*7c478bd9Sstevel@tonic-gate #endif
352*7c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd32 {
353*7c478bd9Sstevel@tonic-gate 	int32_t		vdr_flags;
354*7c478bd9Sstevel@tonic-gate 	offset_t	vdr_offset;	/* 64-bit element on 32-bit alignment */
355*7c478bd9Sstevel@tonic-gate 	size32_t	vdr_nbytes;
356*7c478bd9Sstevel@tonic-gate 	size32_t	vdr_bytesread;
357*7c478bd9Sstevel@tonic-gate 	caddr32_t	vdr_data;
358*7c478bd9Sstevel@tonic-gate 	int32_t		vdr_side;
359*7c478bd9Sstevel@tonic-gate 	char		vdr_side_name[VOL_SIDENAME];
360*7c478bd9Sstevel@tonic-gate } vol_directed_rd32_t;
361*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
362*7c478bd9Sstevel@tonic-gate #pragma pack()
363*7c478bd9Sstevel@tonic-gate #endif
364*7c478bd9Sstevel@tonic-gate #endif	/* _MULTI_DATAMODEL */
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367*7c478bd9Sstevel@tonic-gate }
368*7c478bd9Sstevel@tonic-gate #endif
369*7c478bd9Sstevel@tonic-gate 
370*7c478bd9Sstevel@tonic-gate #endif /* _SYS_DKIO_H */
371