xref: /titanic_53/usr/src/uts/common/sys/dkio.h (revision c7d4aa56cc495a059b9b260f23c1b720c3557d3a)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_DKIO_H
287c478bd9Sstevel@tonic-gate #define	_SYS_DKIO_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS-4.0 5.19 */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/dklabel.h>	/* Needed for NDKMAP define */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * Structures and definitions for disk io control commands
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Structures used as data by ioctl calls.
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define	DK_DEVLEN	16		/* device name max length, including */
477c478bd9Sstevel@tonic-gate 					/* unit # & NULL (ie - "xyc1") */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * Used for controller info
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate struct dk_cinfo {
537c478bd9Sstevel@tonic-gate 	char	dki_cname[DK_DEVLEN];	/* controller name (no unit #) */
547c478bd9Sstevel@tonic-gate 	ushort_t dki_ctype;		/* controller type */
557c478bd9Sstevel@tonic-gate 	ushort_t dki_flags;		/* flags */
567c478bd9Sstevel@tonic-gate 	ushort_t dki_cnum;		/* controller number */
577c478bd9Sstevel@tonic-gate 	uint_t	dki_addr;		/* controller address */
587c478bd9Sstevel@tonic-gate 	uint_t	dki_space;		/* controller bus type */
597c478bd9Sstevel@tonic-gate 	uint_t	dki_prio;		/* interrupt priority */
607c478bd9Sstevel@tonic-gate 	uint_t	dki_vec;		/* interrupt vector */
617c478bd9Sstevel@tonic-gate 	char	dki_dname[DK_DEVLEN];	/* drive name (no unit #) */
627c478bd9Sstevel@tonic-gate 	uint_t	dki_unit;		/* unit number */
637c478bd9Sstevel@tonic-gate 	uint_t	dki_slave;		/* slave number */
647c478bd9Sstevel@tonic-gate 	ushort_t dki_partition;		/* partition number */
657c478bd9Sstevel@tonic-gate 	ushort_t dki_maxtransfer;	/* max. transfer size in DEV_BSIZE */
667c478bd9Sstevel@tonic-gate };
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Controller types
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	DKC_UNKNOWN	0
727c478bd9Sstevel@tonic-gate #define	DKC_CDROM	1	/* CD-ROM, SCSI or otherwise */
737c478bd9Sstevel@tonic-gate #define	DKC_WDC2880	2
747c478bd9Sstevel@tonic-gate #define	DKC_XXX_0	3	/* unassigned */
757c478bd9Sstevel@tonic-gate #define	DKC_XXX_1	4	/* unassigned */
767c478bd9Sstevel@tonic-gate #define	DKC_DSD5215	5
777c478bd9Sstevel@tonic-gate #define	DKC_ACB4000	7
787c478bd9Sstevel@tonic-gate #define	DKC_MD21	8
797c478bd9Sstevel@tonic-gate #define	DKC_XXX_2	9	/* unassigned */
807c478bd9Sstevel@tonic-gate #define	DKC_NCRFLOPPY	10
817c478bd9Sstevel@tonic-gate #define	DKC_SMSFLOPPY	12
827c478bd9Sstevel@tonic-gate #define	DKC_SCSI_CCS	13	/* SCSI CCS compatible */
837c478bd9Sstevel@tonic-gate #define	DKC_INTEL82072	14	/* native floppy chip */
847c478bd9Sstevel@tonic-gate #define	DKC_MD		16	/* meta-disk (virtual-disk) driver */
857c478bd9Sstevel@tonic-gate #define	DKC_INTEL82077	19	/* 82077 floppy disk controller */
867c478bd9Sstevel@tonic-gate #define	DKC_DIRECT	20	/* Intel direct attached device i.e. IDE */
877c478bd9Sstevel@tonic-gate #define	DKC_PCMCIA_MEM	21	/* PCMCIA memory disk-like type */
887c478bd9Sstevel@tonic-gate #define	DKC_PCMCIA_ATA	22	/* PCMCIA AT Attached type */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * Sun reserves up through 1023
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	DKC_CUSTOMER_BASE	1024
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Flags
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate #define	DKI_BAD144	0x01	/* use DEC std 144 bad sector fwding */
1007c478bd9Sstevel@tonic-gate #define	DKI_MAPTRK	0x02	/* controller does track mapping */
1017c478bd9Sstevel@tonic-gate #define	DKI_FMTTRK	0x04	/* formats only full track at a time */
1027c478bd9Sstevel@tonic-gate #define	DKI_FMTVOL	0x08	/* formats only full volume at a time */
1037c478bd9Sstevel@tonic-gate #define	DKI_FMTCYL	0x10	/* formats only full cylinders at a time */
1047c478bd9Sstevel@tonic-gate #define	DKI_HEXUNIT	0x20	/* unit number is printed as 3 hex digits */
1057c478bd9Sstevel@tonic-gate #define	DKI_PCMCIA_PFD	0x40	/* PCMCIA pseudo-floppy memory card */
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * Used for all partitions
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate struct dk_allmap {
1117c478bd9Sstevel@tonic-gate 	struct dk_map	dka_map[NDKMAP];
1127c478bd9Sstevel@tonic-gate };
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1157c478bd9Sstevel@tonic-gate struct dk_allmap32 {
1167c478bd9Sstevel@tonic-gate 	struct dk_map32	dka_map[NDKMAP];
1177c478bd9Sstevel@tonic-gate };
1187c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * Definition of a disk's geometry
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate struct dk_geom {
1247c478bd9Sstevel@tonic-gate 	unsigned short	dkg_ncyl;	/* # of data cylinders */
1257c478bd9Sstevel@tonic-gate 	unsigned short	dkg_acyl;	/* # of alternate cylinders */
1267c478bd9Sstevel@tonic-gate 	unsigned short	dkg_bcyl;	/* cyl offset (for fixed head area) */
1277c478bd9Sstevel@tonic-gate 	unsigned short	dkg_nhead;	/* # of heads */
1287c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs1;	/* obsolete */
1297c478bd9Sstevel@tonic-gate 	unsigned short	dkg_nsect;	/* # of data sectors per track */
1307c478bd9Sstevel@tonic-gate 	unsigned short	dkg_intrlv;	/* interleave factor */
1317c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs2;	/* obsolete */
1327c478bd9Sstevel@tonic-gate 	unsigned short	dkg_obs3;	/* obsolete */
1337c478bd9Sstevel@tonic-gate 	unsigned short	dkg_apc;	/* alternates per cyl (SCSI only) */
1347c478bd9Sstevel@tonic-gate 	unsigned short	dkg_rpm;	/* revolutions per minute */
1357c478bd9Sstevel@tonic-gate 	unsigned short	dkg_pcyl;	/* # of physical cylinders */
1367c478bd9Sstevel@tonic-gate 	unsigned short	dkg_write_reinstruct;	/* # sectors to skip, writes */
1377c478bd9Sstevel@tonic-gate 	unsigned short	dkg_read_reinstruct;	/* # sectors to skip, reads */
1387c478bd9Sstevel@tonic-gate 	unsigned short	dkg_extra[7];	/* for compatible expansion */
1397c478bd9Sstevel@tonic-gate };
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * These defines are for historic compatibility with old drivers.
1437c478bd9Sstevel@tonic-gate  */
1447c478bd9Sstevel@tonic-gate #define	dkg_bhead	dkg_obs1	/* used to be head offset */
1457c478bd9Sstevel@tonic-gate #define	dkg_gap1	dkg_obs2	/* used to be gap1 */
1467c478bd9Sstevel@tonic-gate #define	dkg_gap2	dkg_obs3	/* used to be gap2 */
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /*
1497c478bd9Sstevel@tonic-gate  * Disk io control commands
1507c478bd9Sstevel@tonic-gate  * Warning: some other ioctls with the DIOC prefix exist elsewhere.
1517c478bd9Sstevel@tonic-gate  * The Generic DKIOC numbers are from	0   -  50.
1527c478bd9Sstevel@tonic-gate  *	The Floppy Driver uses		51  - 100.
1537c478bd9Sstevel@tonic-gate  *	The Hard Disk (except SCSI)	101 - 106.	(these are obsolete)
1547c478bd9Sstevel@tonic-gate  *	The CDROM Driver		151 - 200.
1557c478bd9Sstevel@tonic-gate  *	The USCSI ioctl			201 - 250.
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate #define	DKIOC		(0x04 << 8)
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate /*
1607c478bd9Sstevel@tonic-gate  * The following ioctls are generic in nature and need to be
1617c478bd9Sstevel@tonic-gate  * suported as appropriate by all disk drivers
1627c478bd9Sstevel@tonic-gate  */
1637c478bd9Sstevel@tonic-gate #define	DKIOCGGEOM	(DKIOC|1)		/* Get geometry */
1647c478bd9Sstevel@tonic-gate #define	DKIOCINFO	(DKIOC|3)		/* Get info */
1657c478bd9Sstevel@tonic-gate #define	DKIOCEJECT	(DKIOC|6)		/* Generic 'eject' */
1667c478bd9Sstevel@tonic-gate #define	DKIOCGVTOC	(DKIOC|11)		/* Get VTOC */
1677c478bd9Sstevel@tonic-gate #define	DKIOCSVTOC	(DKIOC|12)		/* Set VTOC & Write to Disk */
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate  * The following ioctls are used by Sun drivers to communicate
1717c478bd9Sstevel@tonic-gate  * with their associated format routines. Support of these ioctls
1727c478bd9Sstevel@tonic-gate  * is not required of foreign drivers
1737c478bd9Sstevel@tonic-gate  */
1747c478bd9Sstevel@tonic-gate #define	DKIOCSGEOM	(DKIOC|2)		/* Set geometry */
1757c478bd9Sstevel@tonic-gate #define	DKIOCSAPART	(DKIOC|4)		/* Set all partitions */
1767c478bd9Sstevel@tonic-gate #define	DKIOCGAPART	(DKIOC|5)		/* Get all partitions */
1777c478bd9Sstevel@tonic-gate #define	DKIOCG_PHYGEOM	(DKIOC|32)		/* get physical geometry */
1787c478bd9Sstevel@tonic-gate #define	DKIOCG_VIRTGEOM	(DKIOC|33)		/* get virtual geometry */
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * The following ioctl's are removable media support
1827c478bd9Sstevel@tonic-gate  */
1837c478bd9Sstevel@tonic-gate #define	DKIOCLOCK	(DKIOC|7)	/* Generic 'lock' */
1847c478bd9Sstevel@tonic-gate #define	DKIOCUNLOCK	(DKIOC|8)	/* Generic 'unlock' */
1857c478bd9Sstevel@tonic-gate #define	DKIOCSTATE	(DKIOC|13)	/* Inquire insert/eject state */
1867c478bd9Sstevel@tonic-gate #define	DKIOCREMOVABLE	(DKIOC|16)	/* is media removable */
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate /*
1897c478bd9Sstevel@tonic-gate  * Ioctl to force driver to re-read the alternate partition and rebuild
1907c478bd9Sstevel@tonic-gate  * the internal defect map.
1917c478bd9Sstevel@tonic-gate  */
1927c478bd9Sstevel@tonic-gate #define	DKIOCADDBAD	(DKIOC|20)	/* Re-read the alternate map (IDE) */
1937c478bd9Sstevel@tonic-gate #define	DKIOCGETDEF	(DKIOC|21)	/* read defect list (IDE)	   */
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate /*
1967c478bd9Sstevel@tonic-gate  * Used by applications to get disk defect information from IDE
1977c478bd9Sstevel@tonic-gate  * drives.
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
2007c478bd9Sstevel@tonic-gate struct defect_header32 {
2017c478bd9Sstevel@tonic-gate 	int		head;
2027c478bd9Sstevel@tonic-gate 	caddr32_t	buffer;
2037c478bd9Sstevel@tonic-gate };
2047c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate struct defect_header {
2077c478bd9Sstevel@tonic-gate 	int		head;
2087c478bd9Sstevel@tonic-gate 	caddr_t		buffer;
2097c478bd9Sstevel@tonic-gate };
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate #define	DKIOCPARTINFO	(DKIOC|22)	/* Get partition or slice parameters */
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate /*
2147c478bd9Sstevel@tonic-gate  * Used by applications to get partition or slice information
2157c478bd9Sstevel@tonic-gate  */
2167c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
2177c478bd9Sstevel@tonic-gate struct part_info32 {
2187c478bd9Sstevel@tonic-gate 	daddr32_t	p_start;
2197c478bd9Sstevel@tonic-gate 	int		p_length;
2207c478bd9Sstevel@tonic-gate };
2217c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate struct part_info {
2247c478bd9Sstevel@tonic-gate 	daddr_t		p_start;
2257c478bd9Sstevel@tonic-gate 	int		p_length;
2267c478bd9Sstevel@tonic-gate };
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate /* The following ioctls are for Optical Memory Device */
2297c478bd9Sstevel@tonic-gate #define	DKIOC_EBP_ENABLE  (DKIOC|40)	/* enable by pass erase on write */
2307c478bd9Sstevel@tonic-gate #define	DKIOC_EBP_DISABLE (DKIOC|41)	/* disable by pass erase on write */
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate /*
2337c478bd9Sstevel@tonic-gate  * This state enum is the argument passed to the DKIOCSTATE ioctl.
2347c478bd9Sstevel@tonic-gate  */
2357c478bd9Sstevel@tonic-gate enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE };
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate #define	DKIOCGMEDIAINFO	(DKIOC|42)	/* get information about the media */
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /*
2407c478bd9Sstevel@tonic-gate  * ioctls to read/write mboot info.
2417c478bd9Sstevel@tonic-gate  */
2427c478bd9Sstevel@tonic-gate #define	DKIOCGMBOOT	(DKIOC|43)	/* get mboot info */
2437c478bd9Sstevel@tonic-gate #define	DKIOCSMBOOT	(DKIOC|44)	/* set mboot info */
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate /*
2467c478bd9Sstevel@tonic-gate  * ioctl to get the device temperature.
2477c478bd9Sstevel@tonic-gate  */
2487c478bd9Sstevel@tonic-gate #define	DKIOCGTEMPERATURE	(DKIOC|45)	/* get temperature */
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate  * Used for providing the temperature.
2527c478bd9Sstevel@tonic-gate  */
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate struct	dk_temperature	{
2557c478bd9Sstevel@tonic-gate 	uint_t		dkt_flags;	/* Flags */
2567c478bd9Sstevel@tonic-gate 	short		dkt_cur_temp;	/* Current disk temperature */
2577c478bd9Sstevel@tonic-gate 	short		dkt_ref_temp;	/* reference disk temperature */
2587c478bd9Sstevel@tonic-gate };
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate #define	DKT_BYPASS_PM		0x1
2617c478bd9Sstevel@tonic-gate #define	DKT_INVALID_TEMP	0xFFFF
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate /*
2657c478bd9Sstevel@tonic-gate  * Used for Media info or the current profile info
2667c478bd9Sstevel@tonic-gate  */
2677c478bd9Sstevel@tonic-gate struct dk_minfo {
2687c478bd9Sstevel@tonic-gate 	uint_t		dki_media_type;	/* Media type or profile info */
2697c478bd9Sstevel@tonic-gate 	uint_t		dki_lbsize;	/* Logical blocksize of media */
2707c478bd9Sstevel@tonic-gate 	diskaddr_t	dki_capacity;	/* Capacity as # of dki_lbsize blks */
2717c478bd9Sstevel@tonic-gate };
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate  * Media types or profiles known
2757c478bd9Sstevel@tonic-gate  */
2767c478bd9Sstevel@tonic-gate #define	DK_UNKNOWN		0x00	/* Media inserted - type unknown */
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate /*
2807c478bd9Sstevel@tonic-gate  * SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
2817c478bd9Sstevel@tonic-gate  * maintain compatibility with SFF8090.  The following define the
2827c478bd9Sstevel@tonic-gate  * optical media type.
2837c478bd9Sstevel@tonic-gate  */
284*c7d4aa56Sphitran #define	DK_REMOVABLE_DISK	0x02 /* Removable Disk */
2857c478bd9Sstevel@tonic-gate #define	DK_MO_ERASABLE		0x03 /* MO Erasable */
2867c478bd9Sstevel@tonic-gate #define	DK_MO_WRITEONCE		0x04 /* MO Write once */
2877c478bd9Sstevel@tonic-gate #define	DK_AS_MO		0x05 /* AS MO */
2887c478bd9Sstevel@tonic-gate #define	DK_CDROM		0x08 /* CDROM */
2897c478bd9Sstevel@tonic-gate #define	DK_CDR			0x09 /* CD-R */
2907c478bd9Sstevel@tonic-gate #define	DK_CDRW			0x0A /* CD-RW */
2917c478bd9Sstevel@tonic-gate #define	DK_DVDROM		0x10 /* DVD-ROM */
2927c478bd9Sstevel@tonic-gate #define	DK_DVDR			0x11 /* DVD-R */
2937c478bd9Sstevel@tonic-gate #define	DK_DVDRAM		0x12 /* DVD_RAM or DVD-RW */
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate /*
2967c478bd9Sstevel@tonic-gate  * Media types for other rewritable magnetic media
2977c478bd9Sstevel@tonic-gate  */
2987c478bd9Sstevel@tonic-gate #define	DK_FIXED_DISK		0x10001	/* Fixed disk SCSI or otherwise */
2997c478bd9Sstevel@tonic-gate #define	DK_FLOPPY		0x10002 /* Floppy media */
3007c478bd9Sstevel@tonic-gate #define	DK_ZIP			0x10003 /* IOMEGA ZIP media */
3017c478bd9Sstevel@tonic-gate #define	DK_JAZ			0x10004 /* IOMEGA JAZ media */
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate #define	DKIOCSETEFI	(DKIOC|17)		/* Set EFI info */
3047c478bd9Sstevel@tonic-gate #define	DKIOCGETEFI	(DKIOC|18)		/* Get EFI info */
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate #define	DKIOCPARTITION	(DKIOC|9)		/* Get partition info */
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate /*
3097c478bd9Sstevel@tonic-gate  * Ioctls to get/set volume capabilities related to Logical Volume Managers.
3107c478bd9Sstevel@tonic-gate  * They include the ability to get/set capabilities and to issue a read to a
3117c478bd9Sstevel@tonic-gate  * specific underlying device of a replicated device.
3127c478bd9Sstevel@tonic-gate  */
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate #define	DKIOCGETVOLCAP	(DKIOC | 25)	/* Get volume capabilities */
3157c478bd9Sstevel@tonic-gate #define	DKIOCSETVOLCAP	(DKIOC | 26)	/* Set volume capabilities */
3167c478bd9Sstevel@tonic-gate #define	DKIOCDMR	(DKIOC | 27)	/* Issue a directed read */
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate typedef uint_t volcapinfo_t;
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate typedef uint_t volcapset_t;
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate #define	DKV_ABR_CAP 0x00000001		/* Support Appl.Based Recovery */
3237c478bd9Sstevel@tonic-gate #define	DKV_DMR_CAP 0x00000002		/* Support Directed  Mirror Read */
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate typedef struct volcap {
3267c478bd9Sstevel@tonic-gate 	volcapinfo_t vc_info;	/* Capabilities available */
3277c478bd9Sstevel@tonic-gate 	volcapset_t vc_set;	/* Capabilities set */
3287c478bd9Sstevel@tonic-gate } volcap_t;
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #define	VOL_SIDENAME 256
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd {
3337c478bd9Sstevel@tonic-gate 	int		vdr_flags;
3347c478bd9Sstevel@tonic-gate 	offset_t	vdr_offset;
3357c478bd9Sstevel@tonic-gate 	size_t		vdr_nbytes;
3367c478bd9Sstevel@tonic-gate 	size_t		vdr_bytesread;
3377c478bd9Sstevel@tonic-gate 	void		*vdr_data;
3387c478bd9Sstevel@tonic-gate 	int		vdr_side;
3397c478bd9Sstevel@tonic-gate 	char		vdr_side_name[VOL_SIDENAME];
3407c478bd9Sstevel@tonic-gate } vol_directed_rd_t;
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate #define	DKV_SIDE_INIT		(-1)
3437c478bd9Sstevel@tonic-gate #define	DKV_DMR_NEXT_SIDE	0x00000001
3447c478bd9Sstevel@tonic-gate #define	DKV_DMR_DONE		0x00000002
3457c478bd9Sstevel@tonic-gate #define	DKV_DMR_ERROR		0x00000004
3467c478bd9Sstevel@tonic-gate #define	DKV_DMR_SUCCESS		0x00000008
3477c478bd9Sstevel@tonic-gate #define	DKV_DMR_SHORT		0x00000010
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate #ifdef _MULTI_DATAMODEL
3507c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
3517c478bd9Sstevel@tonic-gate #pragma pack(4)
3527c478bd9Sstevel@tonic-gate #endif
3537c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd32 {
3547c478bd9Sstevel@tonic-gate 	int32_t		vdr_flags;
3557c478bd9Sstevel@tonic-gate 	offset_t	vdr_offset;	/* 64-bit element on 32-bit alignment */
3567c478bd9Sstevel@tonic-gate 	size32_t	vdr_nbytes;
3577c478bd9Sstevel@tonic-gate 	size32_t	vdr_bytesread;
3587c478bd9Sstevel@tonic-gate 	caddr32_t	vdr_data;
3597c478bd9Sstevel@tonic-gate 	int32_t		vdr_side;
3607c478bd9Sstevel@tonic-gate 	char		vdr_side_name[VOL_SIDENAME];
3617c478bd9Sstevel@tonic-gate } vol_directed_rd32_t;
3627c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
3637c478bd9Sstevel@tonic-gate #pragma pack()
3647c478bd9Sstevel@tonic-gate #endif
3657c478bd9Sstevel@tonic-gate #endif	/* _MULTI_DATAMODEL */
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3687c478bd9Sstevel@tonic-gate }
3697c478bd9Sstevel@tonic-gate #endif
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate #endif /* _SYS_DKIO_H */
372