10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51489Swebaker * Common Development and Distribution License (the "License"). 61489Swebaker * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 217563SPrasad.Singamsetty@Sun.COM 220Sstevel@tonic-gate /* 23*12426Sgdamore@opensolaris.org * Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_DKIO_H 270Sstevel@tonic-gate #define _SYS_DKIO_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/dklabel.h> /* Needed for NDKMAP define */ 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * Structures and definitions for disk io control commands 370Sstevel@tonic-gate */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * Structures used as data by ioctl calls. 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate 430Sstevel@tonic-gate #define DK_DEVLEN 16 /* device name max length, including */ 440Sstevel@tonic-gate /* unit # & NULL (ie - "xyc1") */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * Used for controller info 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate struct dk_cinfo { 500Sstevel@tonic-gate char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */ 510Sstevel@tonic-gate ushort_t dki_ctype; /* controller type */ 520Sstevel@tonic-gate ushort_t dki_flags; /* flags */ 530Sstevel@tonic-gate ushort_t dki_cnum; /* controller number */ 540Sstevel@tonic-gate uint_t dki_addr; /* controller address */ 550Sstevel@tonic-gate uint_t dki_space; /* controller bus type */ 560Sstevel@tonic-gate uint_t dki_prio; /* interrupt priority */ 570Sstevel@tonic-gate uint_t dki_vec; /* interrupt vector */ 580Sstevel@tonic-gate char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */ 590Sstevel@tonic-gate uint_t dki_unit; /* unit number */ 600Sstevel@tonic-gate uint_t dki_slave; /* slave number */ 610Sstevel@tonic-gate ushort_t dki_partition; /* partition number */ 620Sstevel@tonic-gate ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */ 630Sstevel@tonic-gate }; 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Controller types 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate #define DKC_UNKNOWN 0 690Sstevel@tonic-gate #define DKC_CDROM 1 /* CD-ROM, SCSI or otherwise */ 700Sstevel@tonic-gate #define DKC_WDC2880 2 710Sstevel@tonic-gate #define DKC_XXX_0 3 /* unassigned */ 720Sstevel@tonic-gate #define DKC_XXX_1 4 /* unassigned */ 730Sstevel@tonic-gate #define DKC_DSD5215 5 740Sstevel@tonic-gate #define DKC_ACB4000 7 750Sstevel@tonic-gate #define DKC_MD21 8 760Sstevel@tonic-gate #define DKC_XXX_2 9 /* unassigned */ 770Sstevel@tonic-gate #define DKC_NCRFLOPPY 10 780Sstevel@tonic-gate #define DKC_SMSFLOPPY 12 790Sstevel@tonic-gate #define DKC_SCSI_CCS 13 /* SCSI CCS compatible */ 800Sstevel@tonic-gate #define DKC_INTEL82072 14 /* native floppy chip */ 810Sstevel@tonic-gate #define DKC_MD 16 /* meta-disk (virtual-disk) driver */ 820Sstevel@tonic-gate #define DKC_INTEL82077 19 /* 82077 floppy disk controller */ 830Sstevel@tonic-gate #define DKC_DIRECT 20 /* Intel direct attached device i.e. IDE */ 8411215Sgdamore@opensolaris.org #define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type (Obsolete) */ 850Sstevel@tonic-gate #define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */ 864507Sjhd #define DKC_VBD 23 /* virtual block device */ 87*12426Sgdamore@opensolaris.org #define DKC_BLKDEV 24 /* generic block device (see blkdev(7d)) */ 880Sstevel@tonic-gate 890Sstevel@tonic-gate /* 900Sstevel@tonic-gate * Sun reserves up through 1023 910Sstevel@tonic-gate */ 920Sstevel@tonic-gate 930Sstevel@tonic-gate #define DKC_CUSTOMER_BASE 1024 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 960Sstevel@tonic-gate * Flags 970Sstevel@tonic-gate */ 980Sstevel@tonic-gate #define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */ 990Sstevel@tonic-gate #define DKI_MAPTRK 0x02 /* controller does track mapping */ 1000Sstevel@tonic-gate #define DKI_FMTTRK 0x04 /* formats only full track at a time */ 1010Sstevel@tonic-gate #define DKI_FMTVOL 0x08 /* formats only full volume at a time */ 1020Sstevel@tonic-gate #define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */ 1030Sstevel@tonic-gate #define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */ 1040Sstevel@tonic-gate #define DKI_PCMCIA_PFD 0x40 /* PCMCIA pseudo-floppy memory card */ 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate /* 1070Sstevel@tonic-gate * Used for all partitions 1080Sstevel@tonic-gate */ 1090Sstevel@tonic-gate struct dk_allmap { 1100Sstevel@tonic-gate struct dk_map dka_map[NDKMAP]; 1110Sstevel@tonic-gate }; 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #if defined(_SYSCALL32) 1140Sstevel@tonic-gate struct dk_allmap32 { 1150Sstevel@tonic-gate struct dk_map32 dka_map[NDKMAP]; 1160Sstevel@tonic-gate }; 1170Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* 1200Sstevel@tonic-gate * Definition of a disk's geometry 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate struct dk_geom { 1230Sstevel@tonic-gate unsigned short dkg_ncyl; /* # of data cylinders */ 1240Sstevel@tonic-gate unsigned short dkg_acyl; /* # of alternate cylinders */ 1250Sstevel@tonic-gate unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */ 1260Sstevel@tonic-gate unsigned short dkg_nhead; /* # of heads */ 1270Sstevel@tonic-gate unsigned short dkg_obs1; /* obsolete */ 1280Sstevel@tonic-gate unsigned short dkg_nsect; /* # of data sectors per track */ 1290Sstevel@tonic-gate unsigned short dkg_intrlv; /* interleave factor */ 1300Sstevel@tonic-gate unsigned short dkg_obs2; /* obsolete */ 1310Sstevel@tonic-gate unsigned short dkg_obs3; /* obsolete */ 1320Sstevel@tonic-gate unsigned short dkg_apc; /* alternates per cyl (SCSI only) */ 1330Sstevel@tonic-gate unsigned short dkg_rpm; /* revolutions per minute */ 1340Sstevel@tonic-gate unsigned short dkg_pcyl; /* # of physical cylinders */ 1350Sstevel@tonic-gate unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */ 1360Sstevel@tonic-gate unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */ 1370Sstevel@tonic-gate unsigned short dkg_extra[7]; /* for compatible expansion */ 1380Sstevel@tonic-gate }; 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 1410Sstevel@tonic-gate * These defines are for historic compatibility with old drivers. 1420Sstevel@tonic-gate */ 1430Sstevel@tonic-gate #define dkg_bhead dkg_obs1 /* used to be head offset */ 1440Sstevel@tonic-gate #define dkg_gap1 dkg_obs2 /* used to be gap1 */ 1450Sstevel@tonic-gate #define dkg_gap2 dkg_obs3 /* used to be gap2 */ 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate /* 1480Sstevel@tonic-gate * Disk io control commands 1490Sstevel@tonic-gate * Warning: some other ioctls with the DIOC prefix exist elsewhere. 1500Sstevel@tonic-gate * The Generic DKIOC numbers are from 0 - 50. 1510Sstevel@tonic-gate * The Floppy Driver uses 51 - 100. 1520Sstevel@tonic-gate * The Hard Disk (except SCSI) 101 - 106. (these are obsolete) 1530Sstevel@tonic-gate * The CDROM Driver 151 - 200. 1540Sstevel@tonic-gate * The USCSI ioctl 201 - 250. 1550Sstevel@tonic-gate */ 1560Sstevel@tonic-gate #define DKIOC (0x04 << 8) 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate /* 1590Sstevel@tonic-gate * The following ioctls are generic in nature and need to be 1600Sstevel@tonic-gate * suported as appropriate by all disk drivers 1610Sstevel@tonic-gate */ 1620Sstevel@tonic-gate #define DKIOCGGEOM (DKIOC|1) /* Get geometry */ 1630Sstevel@tonic-gate #define DKIOCINFO (DKIOC|3) /* Get info */ 1640Sstevel@tonic-gate #define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */ 1650Sstevel@tonic-gate #define DKIOCGVTOC (DKIOC|11) /* Get VTOC */ 1660Sstevel@tonic-gate #define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */ 1670Sstevel@tonic-gate 1687563SPrasad.Singamsetty@Sun.COM #define DKIOCGEXTVTOC (DKIOC|23) /* Get extended VTOC */ 1697563SPrasad.Singamsetty@Sun.COM #define DKIOCSEXTVTOC (DKIOC|24) /* Set extended VTOC, Write to Disk */ 1707563SPrasad.Singamsetty@Sun.COM 1710Sstevel@tonic-gate /* 172789Sahrens * Disk Cache Controls. These ioctls should be supported by 173789Sahrens * all disk drivers. 174789Sahrens * 175789Sahrens * DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl 176789Sahrens * argument, but it should be passed as NULL to allow for future 177789Sahrens * reinterpretation. From user-mode, this ioctl request is synchronous. 178789Sahrens * 179789Sahrens * When invoked from within the kernel, the arg can be NULL to indicate 180789Sahrens * a synchronous request or can be the address of a struct dk_callback 181789Sahrens * to request an asynchronous callback when the flush request is complete. 182789Sahrens * In this case, the flag to the ioctl must include FKIOCTL and the 183789Sahrens * dkc_callback field of the pointed to struct must be non-null or the 184789Sahrens * request is made synchronously. 185789Sahrens * 186789Sahrens * In the callback case: if the ioctl returns 0, a callback WILL be performed. 187789Sahrens * If the ioctl returns non-zero, a callback will NOT be performed. 188789Sahrens * NOTE: In some cases, the callback may be done BEFORE the ioctl call 189789Sahrens * returns. The caller's locking strategy should be prepared for this case. 190789Sahrens */ 191789Sahrens #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ 192789Sahrens 193789Sahrens struct dk_callback { 194789Sahrens void (*dkc_callback)(void *dkc_cookie, int error); 195789Sahrens void *dkc_cookie; 1965065Sgz161490 int dkc_flag; 197789Sahrens }; 198789Sahrens 1995065Sgz161490 /* bit flag definitions for dkc_flag */ 2005065Sgz161490 #define FLUSH_VOLATILE 0x1 /* Bit 0: if set, only flush */ 2015065Sgz161490 /* volatile cache; otherwise, flush */ 2025065Sgz161490 /* volatile and non-volatile cache */ 2035065Sgz161490 2041489Swebaker #define DKIOCGETWCE (DKIOC|36) /* Get current write cache */ 2051489Swebaker /* enablement status */ 2061489Swebaker #define DKIOCSETWCE (DKIOC|37) /* Enable/Disable write cache */ 2071489Swebaker 208789Sahrens /* 2090Sstevel@tonic-gate * The following ioctls are used by Sun drivers to communicate 2100Sstevel@tonic-gate * with their associated format routines. Support of these ioctls 2110Sstevel@tonic-gate * is not required of foreign drivers 2120Sstevel@tonic-gate */ 2130Sstevel@tonic-gate #define DKIOCSGEOM (DKIOC|2) /* Set geometry */ 2140Sstevel@tonic-gate #define DKIOCSAPART (DKIOC|4) /* Set all partitions */ 2150Sstevel@tonic-gate #define DKIOCGAPART (DKIOC|5) /* Get all partitions */ 2160Sstevel@tonic-gate #define DKIOCG_PHYGEOM (DKIOC|32) /* get physical geometry */ 2170Sstevel@tonic-gate #define DKIOCG_VIRTGEOM (DKIOC|33) /* get virtual geometry */ 2180Sstevel@tonic-gate 2190Sstevel@tonic-gate /* 2200Sstevel@tonic-gate * The following ioctl's are removable media support 2210Sstevel@tonic-gate */ 2220Sstevel@tonic-gate #define DKIOCLOCK (DKIOC|7) /* Generic 'lock' */ 2230Sstevel@tonic-gate #define DKIOCUNLOCK (DKIOC|8) /* Generic 'unlock' */ 2240Sstevel@tonic-gate #define DKIOCSTATE (DKIOC|13) /* Inquire insert/eject state */ 2250Sstevel@tonic-gate #define DKIOCREMOVABLE (DKIOC|16) /* is media removable */ 2260Sstevel@tonic-gate 2271415Scg149915 2281415Scg149915 /* 2291415Scg149915 * ioctl for hotpluggable devices 2301415Scg149915 */ 2311415Scg149915 #define DKIOCHOTPLUGGABLE (DKIOC|35) /* is hotpluggable */ 2321415Scg149915 23310021SSheshadri.Vasudevan@Sun.COM #if defined(__i386) || defined(__amd64) 23410021SSheshadri.Vasudevan@Sun.COM /* ioctl to write extended partition structure into the disk */ 23510021SSheshadri.Vasudevan@Sun.COM #define DKIOCSETEXTPART (DKIOC|46) 23610021SSheshadri.Vasudevan@Sun.COM #endif 23710021SSheshadri.Vasudevan@Sun.COM 2380Sstevel@tonic-gate /* 2390Sstevel@tonic-gate * Ioctl to force driver to re-read the alternate partition and rebuild 2400Sstevel@tonic-gate * the internal defect map. 2410Sstevel@tonic-gate */ 2420Sstevel@tonic-gate #define DKIOCADDBAD (DKIOC|20) /* Re-read the alternate map (IDE) */ 2430Sstevel@tonic-gate #define DKIOCGETDEF (DKIOC|21) /* read defect list (IDE) */ 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate /* 2460Sstevel@tonic-gate * Used by applications to get disk defect information from IDE 2470Sstevel@tonic-gate * drives. 2480Sstevel@tonic-gate */ 2490Sstevel@tonic-gate #ifdef _SYSCALL32 2500Sstevel@tonic-gate struct defect_header32 { 2510Sstevel@tonic-gate int head; 2520Sstevel@tonic-gate caddr32_t buffer; 2530Sstevel@tonic-gate }; 2540Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2550Sstevel@tonic-gate 2560Sstevel@tonic-gate struct defect_header { 2570Sstevel@tonic-gate int head; 2580Sstevel@tonic-gate caddr_t buffer; 2590Sstevel@tonic-gate }; 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate #define DKIOCPARTINFO (DKIOC|22) /* Get partition or slice parameters */ 2627563SPrasad.Singamsetty@Sun.COM #define DKIOCEXTPARTINFO (DKIOC|19) /* Get extended partition or slice */ 2637563SPrasad.Singamsetty@Sun.COM /* parameters */ 2647563SPrasad.Singamsetty@Sun.COM 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate /* 2670Sstevel@tonic-gate * Used by applications to get partition or slice information 2680Sstevel@tonic-gate */ 2690Sstevel@tonic-gate #ifdef _SYSCALL32 2700Sstevel@tonic-gate struct part_info32 { 2710Sstevel@tonic-gate daddr32_t p_start; 2720Sstevel@tonic-gate int p_length; 2730Sstevel@tonic-gate }; 2740Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2750Sstevel@tonic-gate 2760Sstevel@tonic-gate struct part_info { 2770Sstevel@tonic-gate daddr_t p_start; 2780Sstevel@tonic-gate int p_length; 2790Sstevel@tonic-gate }; 2800Sstevel@tonic-gate 2817563SPrasad.Singamsetty@Sun.COM struct extpart_info { 2827563SPrasad.Singamsetty@Sun.COM diskaddr_t p_start; 2837563SPrasad.Singamsetty@Sun.COM diskaddr_t p_length; 2847563SPrasad.Singamsetty@Sun.COM }; 2857563SPrasad.Singamsetty@Sun.COM 2860Sstevel@tonic-gate /* The following ioctls are for Optical Memory Device */ 2870Sstevel@tonic-gate #define DKIOC_EBP_ENABLE (DKIOC|40) /* enable by pass erase on write */ 2880Sstevel@tonic-gate #define DKIOC_EBP_DISABLE (DKIOC|41) /* disable by pass erase on write */ 2890Sstevel@tonic-gate 2900Sstevel@tonic-gate /* 2910Sstevel@tonic-gate * This state enum is the argument passed to the DKIOCSTATE ioctl. 2920Sstevel@tonic-gate */ 2930Sstevel@tonic-gate enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE }; 2940Sstevel@tonic-gate 2950Sstevel@tonic-gate #define DKIOCGMEDIAINFO (DKIOC|42) /* get information about the media */ 2960Sstevel@tonic-gate 2970Sstevel@tonic-gate /* 2980Sstevel@tonic-gate * ioctls to read/write mboot info. 2990Sstevel@tonic-gate */ 3000Sstevel@tonic-gate #define DKIOCGMBOOT (DKIOC|43) /* get mboot info */ 3010Sstevel@tonic-gate #define DKIOCSMBOOT (DKIOC|44) /* set mboot info */ 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate /* 3040Sstevel@tonic-gate * ioctl to get the device temperature. 3050Sstevel@tonic-gate */ 3060Sstevel@tonic-gate #define DKIOCGTEMPERATURE (DKIOC|45) /* get temperature */ 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate /* 3099889SLarry.Liu@Sun.COM * ioctl to get the media info including physical block size 3109889SLarry.Liu@Sun.COM */ 3119889SLarry.Liu@Sun.COM #define DKIOCGMEDIAINFOEXT (DKIOC|48) 3129889SLarry.Liu@Sun.COM 3139889SLarry.Liu@Sun.COM /* 31411329Sgdamore@opensolaris.org * ioctl to determine whether media is write-protected 31511329Sgdamore@opensolaris.org */ 31611329Sgdamore@opensolaris.org #define DKIOCREADONLY (DKIOC|49) 31711329Sgdamore@opensolaris.org 31811329Sgdamore@opensolaris.org /* 3190Sstevel@tonic-gate * Used for providing the temperature. 3200Sstevel@tonic-gate */ 3210Sstevel@tonic-gate 3220Sstevel@tonic-gate struct dk_temperature { 3230Sstevel@tonic-gate uint_t dkt_flags; /* Flags */ 3240Sstevel@tonic-gate short dkt_cur_temp; /* Current disk temperature */ 3250Sstevel@tonic-gate short dkt_ref_temp; /* reference disk temperature */ 3260Sstevel@tonic-gate }; 3270Sstevel@tonic-gate 3280Sstevel@tonic-gate #define DKT_BYPASS_PM 0x1 3290Sstevel@tonic-gate #define DKT_INVALID_TEMP 0xFFFF 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate /* 3330Sstevel@tonic-gate * Used for Media info or the current profile info 3340Sstevel@tonic-gate */ 3350Sstevel@tonic-gate struct dk_minfo { 3360Sstevel@tonic-gate uint_t dki_media_type; /* Media type or profile info */ 3370Sstevel@tonic-gate uint_t dki_lbsize; /* Logical blocksize of media */ 3380Sstevel@tonic-gate diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */ 3390Sstevel@tonic-gate }; 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate /* 3429889SLarry.Liu@Sun.COM * Used for Media info or the current profile info 3439889SLarry.Liu@Sun.COM * including physical block size if supported. 3449889SLarry.Liu@Sun.COM */ 3459889SLarry.Liu@Sun.COM struct dk_minfo_ext { 3469889SLarry.Liu@Sun.COM uint_t dki_media_type; /* Media type or profile info */ 3479889SLarry.Liu@Sun.COM uint_t dki_lbsize; /* Logical blocksize of media */ 3489889SLarry.Liu@Sun.COM diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */ 3499889SLarry.Liu@Sun.COM uint_t dki_pbsize; /* Physical blocksize of media */ 3509889SLarry.Liu@Sun.COM }; 3519889SLarry.Liu@Sun.COM 3529889SLarry.Liu@Sun.COM /* 3530Sstevel@tonic-gate * Media types or profiles known 3540Sstevel@tonic-gate */ 3550Sstevel@tonic-gate #define DK_UNKNOWN 0x00 /* Media inserted - type unknown */ 3560Sstevel@tonic-gate 3570Sstevel@tonic-gate 3580Sstevel@tonic-gate /* 3590Sstevel@tonic-gate * SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to 3600Sstevel@tonic-gate * maintain compatibility with SFF8090. The following define the 3610Sstevel@tonic-gate * optical media type. 3620Sstevel@tonic-gate */ 363768Sphitran #define DK_REMOVABLE_DISK 0x02 /* Removable Disk */ 3640Sstevel@tonic-gate #define DK_MO_ERASABLE 0x03 /* MO Erasable */ 3650Sstevel@tonic-gate #define DK_MO_WRITEONCE 0x04 /* MO Write once */ 3660Sstevel@tonic-gate #define DK_AS_MO 0x05 /* AS MO */ 3670Sstevel@tonic-gate #define DK_CDROM 0x08 /* CDROM */ 3680Sstevel@tonic-gate #define DK_CDR 0x09 /* CD-R */ 3690Sstevel@tonic-gate #define DK_CDRW 0x0A /* CD-RW */ 3700Sstevel@tonic-gate #define DK_DVDROM 0x10 /* DVD-ROM */ 3710Sstevel@tonic-gate #define DK_DVDR 0x11 /* DVD-R */ 3720Sstevel@tonic-gate #define DK_DVDRAM 0x12 /* DVD_RAM or DVD-RW */ 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* 3750Sstevel@tonic-gate * Media types for other rewritable magnetic media 3760Sstevel@tonic-gate */ 3770Sstevel@tonic-gate #define DK_FIXED_DISK 0x10001 /* Fixed disk SCSI or otherwise */ 3780Sstevel@tonic-gate #define DK_FLOPPY 0x10002 /* Floppy media */ 3790Sstevel@tonic-gate #define DK_ZIP 0x10003 /* IOMEGA ZIP media */ 3800Sstevel@tonic-gate #define DK_JAZ 0x10004 /* IOMEGA JAZ media */ 3810Sstevel@tonic-gate 3820Sstevel@tonic-gate #define DKIOCSETEFI (DKIOC|17) /* Set EFI info */ 3830Sstevel@tonic-gate #define DKIOCGETEFI (DKIOC|18) /* Get EFI info */ 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate #define DKIOCPARTITION (DKIOC|9) /* Get partition info */ 3860Sstevel@tonic-gate 3870Sstevel@tonic-gate /* 3880Sstevel@tonic-gate * Ioctls to get/set volume capabilities related to Logical Volume Managers. 3890Sstevel@tonic-gate * They include the ability to get/set capabilities and to issue a read to a 3900Sstevel@tonic-gate * specific underlying device of a replicated device. 3910Sstevel@tonic-gate */ 3920Sstevel@tonic-gate 3930Sstevel@tonic-gate #define DKIOCGETVOLCAP (DKIOC | 25) /* Get volume capabilities */ 3940Sstevel@tonic-gate #define DKIOCSETVOLCAP (DKIOC | 26) /* Set volume capabilities */ 3950Sstevel@tonic-gate #define DKIOCDMR (DKIOC | 27) /* Issue a directed read */ 3960Sstevel@tonic-gate 3976423Sgw25295 #define DKIOCDUMPINIT (DKIOC | 28) /* Dumpify a zvol */ 3986423Sgw25295 #define DKIOCDUMPFINI (DKIOC | 29) /* Un-Dumpify a zvol */ 3996423Sgw25295 4000Sstevel@tonic-gate typedef uint_t volcapinfo_t; 4010Sstevel@tonic-gate 4020Sstevel@tonic-gate typedef uint_t volcapset_t; 4030Sstevel@tonic-gate 4040Sstevel@tonic-gate #define DKV_ABR_CAP 0x00000001 /* Support Appl.Based Recovery */ 4050Sstevel@tonic-gate #define DKV_DMR_CAP 0x00000002 /* Support Directed Mirror Read */ 4060Sstevel@tonic-gate 4070Sstevel@tonic-gate typedef struct volcap { 4080Sstevel@tonic-gate volcapinfo_t vc_info; /* Capabilities available */ 4090Sstevel@tonic-gate volcapset_t vc_set; /* Capabilities set */ 4100Sstevel@tonic-gate } volcap_t; 4110Sstevel@tonic-gate 4120Sstevel@tonic-gate #define VOL_SIDENAME 256 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate typedef struct vol_directed_rd { 4150Sstevel@tonic-gate int vdr_flags; 4160Sstevel@tonic-gate offset_t vdr_offset; 4170Sstevel@tonic-gate size_t vdr_nbytes; 4180Sstevel@tonic-gate size_t vdr_bytesread; 4190Sstevel@tonic-gate void *vdr_data; 4200Sstevel@tonic-gate int vdr_side; 4210Sstevel@tonic-gate char vdr_side_name[VOL_SIDENAME]; 4220Sstevel@tonic-gate } vol_directed_rd_t; 4230Sstevel@tonic-gate 4240Sstevel@tonic-gate #define DKV_SIDE_INIT (-1) 4250Sstevel@tonic-gate #define DKV_DMR_NEXT_SIDE 0x00000001 4260Sstevel@tonic-gate #define DKV_DMR_DONE 0x00000002 4270Sstevel@tonic-gate #define DKV_DMR_ERROR 0x00000004 4280Sstevel@tonic-gate #define DKV_DMR_SUCCESS 0x00000008 4290Sstevel@tonic-gate #define DKV_DMR_SHORT 0x00000010 4300Sstevel@tonic-gate 4310Sstevel@tonic-gate #ifdef _MULTI_DATAMODEL 4320Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 4330Sstevel@tonic-gate #pragma pack(4) 4340Sstevel@tonic-gate #endif 4350Sstevel@tonic-gate typedef struct vol_directed_rd32 { 4360Sstevel@tonic-gate int32_t vdr_flags; 4370Sstevel@tonic-gate offset_t vdr_offset; /* 64-bit element on 32-bit alignment */ 4380Sstevel@tonic-gate size32_t vdr_nbytes; 4390Sstevel@tonic-gate size32_t vdr_bytesread; 4400Sstevel@tonic-gate caddr32_t vdr_data; 4410Sstevel@tonic-gate int32_t vdr_side; 4420Sstevel@tonic-gate char vdr_side_name[VOL_SIDENAME]; 4430Sstevel@tonic-gate } vol_directed_rd32_t; 4440Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 4450Sstevel@tonic-gate #pragma pack() 4460Sstevel@tonic-gate #endif 4470Sstevel@tonic-gate #endif /* _MULTI_DATAMODEL */ 4480Sstevel@tonic-gate 4493652Syt160523 /* 4503652Syt160523 * The ioctl is used to fetch disk's device type, vendor ID, 4513652Syt160523 * model number/product ID, firmware revision and serial number together. 4523652Syt160523 * 4533652Syt160523 * Currently there are two device types - DKD_ATA_TYPE which means the 4543652Syt160523 * disk is driven by cmdk/ata or dad/uata driver, and DKD_SCSI_TYPE 4553652Syt160523 * which means the disk is driven by sd/scsi hba driver. 4563652Syt160523 */ 4573652Syt160523 #define DKIOC_GETDISKID (DKIOC|46) 4583652Syt160523 4593652Syt160523 /* These two labels are for dkd_dtype of dk_disk_id_t */ 4603652Syt160523 #define DKD_ATA_TYPE 0x01 /* ATA disk or legacy mode SATA disk */ 4613652Syt160523 #define DKD_SCSI_TYPE 0x02 /* SCSI disk or native mode SATA disk */ 4623652Syt160523 4633652Syt160523 #define DKD_ATA_MODEL 40 /* model number length */ 4643652Syt160523 #define DKD_ATA_FWVER 8 /* firmware revision length */ 4653652Syt160523 #define DKD_ATA_SERIAL 20 /* serial number length */ 4663652Syt160523 4673652Syt160523 #define DKD_SCSI_VENDOR 8 /* vendor ID length */ 4683652Syt160523 #define DKD_SCSI_PRODUCT 16 /* product ID length */ 4693652Syt160523 #define DKD_SCSI_REVLEVEL 4 /* revision level length */ 4703652Syt160523 #define DKD_SCSI_SERIAL 12 /* serial number length */ 4713652Syt160523 4723652Syt160523 /* 4733652Syt160523 * The argument type for DKIOC_GETDISKID ioctl. 4743652Syt160523 */ 4753652Syt160523 typedef struct dk_disk_id { 4763652Syt160523 uint_t dkd_dtype; 4773652Syt160523 union { 4783652Syt160523 struct { 4793652Syt160523 char dkd_amodel[DKD_ATA_MODEL]; /* 40 bytes */ 4803652Syt160523 char dkd_afwver[DKD_ATA_FWVER]; /* 8 bytes */ 4813652Syt160523 char dkd_aserial[DKD_ATA_SERIAL]; /* 20 bytes */ 4823652Syt160523 } ata_disk_id; 4833652Syt160523 struct { 4843652Syt160523 char dkd_svendor[DKD_SCSI_VENDOR]; /* 8 bytes */ 4853652Syt160523 char dkd_sproduct[DKD_SCSI_PRODUCT]; /* 16 bytes */ 4863652Syt160523 char dkd_sfwver[DKD_SCSI_REVLEVEL]; /* 4 bytes */ 4873652Syt160523 char dkd_sserial[DKD_SCSI_SERIAL]; /* 12 bytes */ 4883652Syt160523 } scsi_disk_id; 4893652Syt160523 } disk_id; 4903652Syt160523 } dk_disk_id_t; 4913652Syt160523 4923652Syt160523 /* 4933652Syt160523 * The ioctl is used to update the firmware of device. 4943652Syt160523 */ 4953652Syt160523 #define DKIOC_UPDATEFW (DKIOC|47) 4963652Syt160523 4973652Syt160523 /* The argument type for DKIOC_UPDATEFW ioctl */ 4983652Syt160523 typedef struct dk_updatefw { 4993652Syt160523 caddr_t dku_ptrbuf; /* pointer to firmware buf */ 5003652Syt160523 uint_t dku_size; /* firmware buf length */ 5013652Syt160523 uint8_t dku_type; /* firmware update type */ 5023652Syt160523 } dk_updatefw_t; 5033652Syt160523 5043652Syt160523 #ifdef _SYSCALL32 5053652Syt160523 typedef struct dk_updatefw_32 { 5063652Syt160523 caddr32_t dku_ptrbuf; /* pointer to firmware buf */ 5073652Syt160523 uint_t dku_size; /* firmware buf length */ 5083652Syt160523 uint8_t dku_type; /* firmware update type */ 5093652Syt160523 } dk_updatefw_32_t; 5103652Syt160523 #endif /* _SYSCALL32 */ 5113652Syt160523 5123652Syt160523 /* 5133652Syt160523 * firmware update type - temporary or permanent use 5143652Syt160523 */ 5153652Syt160523 #define FW_TYPE_TEMP 0x0 /* temporary use */ 5163652Syt160523 #define FW_TYPE_PERM 0x1 /* permanent use */ 5173652Syt160523 5183652Syt160523 5190Sstevel@tonic-gate #ifdef __cplusplus 5200Sstevel@tonic-gate } 5210Sstevel@tonic-gate #endif 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate #endif /* _SYS_DKIO_H */ 524