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 5bef6b7d2Swebaker * Common Development and Distribution License (the "License"). 6bef6b7d2Swebaker * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21342440ecSPrasad Singamsetty 227c478bd9Sstevel@tonic-gate /* 2365908c77Syu, larry liu - Sun Microsystems - Beijing China * Copyright 2009 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 #include <sys/dklabel.h> /* Needed for NDKMAP define */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * Structures and definitions for disk io control commands 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * Structures used as data by ioctl calls. 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #define DK_DEVLEN 16 /* device name max length, including */ 457c478bd9Sstevel@tonic-gate /* unit # & NULL (ie - "xyc1") */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * Used for controller info 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate struct dk_cinfo { 517c478bd9Sstevel@tonic-gate char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */ 527c478bd9Sstevel@tonic-gate ushort_t dki_ctype; /* controller type */ 537c478bd9Sstevel@tonic-gate ushort_t dki_flags; /* flags */ 547c478bd9Sstevel@tonic-gate ushort_t dki_cnum; /* controller number */ 557c478bd9Sstevel@tonic-gate uint_t dki_addr; /* controller address */ 567c478bd9Sstevel@tonic-gate uint_t dki_space; /* controller bus type */ 577c478bd9Sstevel@tonic-gate uint_t dki_prio; /* interrupt priority */ 587c478bd9Sstevel@tonic-gate uint_t dki_vec; /* interrupt vector */ 597c478bd9Sstevel@tonic-gate char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */ 607c478bd9Sstevel@tonic-gate uint_t dki_unit; /* unit number */ 617c478bd9Sstevel@tonic-gate uint_t dki_slave; /* slave number */ 627c478bd9Sstevel@tonic-gate ushort_t dki_partition; /* partition number */ 637c478bd9Sstevel@tonic-gate ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */ 647c478bd9Sstevel@tonic-gate }; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Controller types 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate #define DKC_UNKNOWN 0 707c478bd9Sstevel@tonic-gate #define DKC_CDROM 1 /* CD-ROM, SCSI or otherwise */ 717c478bd9Sstevel@tonic-gate #define DKC_WDC2880 2 727c478bd9Sstevel@tonic-gate #define DKC_XXX_0 3 /* unassigned */ 737c478bd9Sstevel@tonic-gate #define DKC_XXX_1 4 /* unassigned */ 747c478bd9Sstevel@tonic-gate #define DKC_DSD5215 5 757c478bd9Sstevel@tonic-gate #define DKC_ACB4000 7 767c478bd9Sstevel@tonic-gate #define DKC_MD21 8 777c478bd9Sstevel@tonic-gate #define DKC_XXX_2 9 /* unassigned */ 787c478bd9Sstevel@tonic-gate #define DKC_NCRFLOPPY 10 797c478bd9Sstevel@tonic-gate #define DKC_SMSFLOPPY 12 807c478bd9Sstevel@tonic-gate #define DKC_SCSI_CCS 13 /* SCSI CCS compatible */ 817c478bd9Sstevel@tonic-gate #define DKC_INTEL82072 14 /* native floppy chip */ 827c478bd9Sstevel@tonic-gate #define DKC_MD 16 /* meta-disk (virtual-disk) driver */ 837c478bd9Sstevel@tonic-gate #define DKC_INTEL82077 19 /* 82077 floppy disk controller */ 847c478bd9Sstevel@tonic-gate #define DKC_DIRECT 20 /* Intel direct attached device i.e. IDE */ 857c478bd9Sstevel@tonic-gate #define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type */ 867c478bd9Sstevel@tonic-gate #define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */ 87c5a873c4Sjhd #define DKC_VBD 23 /* virtual block device */ 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* 907c478bd9Sstevel@tonic-gate * Sun reserves up through 1023 917c478bd9Sstevel@tonic-gate */ 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #define DKC_CUSTOMER_BASE 1024 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * Flags 977c478bd9Sstevel@tonic-gate */ 987c478bd9Sstevel@tonic-gate #define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */ 997c478bd9Sstevel@tonic-gate #define DKI_MAPTRK 0x02 /* controller does track mapping */ 1007c478bd9Sstevel@tonic-gate #define DKI_FMTTRK 0x04 /* formats only full track at a time */ 1017c478bd9Sstevel@tonic-gate #define DKI_FMTVOL 0x08 /* formats only full volume at a time */ 1027c478bd9Sstevel@tonic-gate #define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */ 1037c478bd9Sstevel@tonic-gate #define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */ 1047c478bd9Sstevel@tonic-gate #define DKI_PCMCIA_PFD 0x40 /* PCMCIA pseudo-floppy memory card */ 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate /* 1077c478bd9Sstevel@tonic-gate * Used for all partitions 1087c478bd9Sstevel@tonic-gate */ 1097c478bd9Sstevel@tonic-gate struct dk_allmap { 1107c478bd9Sstevel@tonic-gate struct dk_map dka_map[NDKMAP]; 1117c478bd9Sstevel@tonic-gate }; 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1147c478bd9Sstevel@tonic-gate struct dk_allmap32 { 1157c478bd9Sstevel@tonic-gate struct dk_map32 dka_map[NDKMAP]; 1167c478bd9Sstevel@tonic-gate }; 1177c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* 1207c478bd9Sstevel@tonic-gate * Definition of a disk's geometry 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate struct dk_geom { 1237c478bd9Sstevel@tonic-gate unsigned short dkg_ncyl; /* # of data cylinders */ 1247c478bd9Sstevel@tonic-gate unsigned short dkg_acyl; /* # of alternate cylinders */ 1257c478bd9Sstevel@tonic-gate unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */ 1267c478bd9Sstevel@tonic-gate unsigned short dkg_nhead; /* # of heads */ 1277c478bd9Sstevel@tonic-gate unsigned short dkg_obs1; /* obsolete */ 1287c478bd9Sstevel@tonic-gate unsigned short dkg_nsect; /* # of data sectors per track */ 1297c478bd9Sstevel@tonic-gate unsigned short dkg_intrlv; /* interleave factor */ 1307c478bd9Sstevel@tonic-gate unsigned short dkg_obs2; /* obsolete */ 1317c478bd9Sstevel@tonic-gate unsigned short dkg_obs3; /* obsolete */ 1327c478bd9Sstevel@tonic-gate unsigned short dkg_apc; /* alternates per cyl (SCSI only) */ 1337c478bd9Sstevel@tonic-gate unsigned short dkg_rpm; /* revolutions per minute */ 1347c478bd9Sstevel@tonic-gate unsigned short dkg_pcyl; /* # of physical cylinders */ 1357c478bd9Sstevel@tonic-gate unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */ 1367c478bd9Sstevel@tonic-gate unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */ 1377c478bd9Sstevel@tonic-gate unsigned short dkg_extra[7]; /* for compatible expansion */ 1387c478bd9Sstevel@tonic-gate }; 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate /* 1417c478bd9Sstevel@tonic-gate * These defines are for historic compatibility with old drivers. 1427c478bd9Sstevel@tonic-gate */ 1437c478bd9Sstevel@tonic-gate #define dkg_bhead dkg_obs1 /* used to be head offset */ 1447c478bd9Sstevel@tonic-gate #define dkg_gap1 dkg_obs2 /* used to be gap1 */ 1457c478bd9Sstevel@tonic-gate #define dkg_gap2 dkg_obs3 /* used to be gap2 */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate /* 1487c478bd9Sstevel@tonic-gate * Disk io control commands 1497c478bd9Sstevel@tonic-gate * Warning: some other ioctls with the DIOC prefix exist elsewhere. 1507c478bd9Sstevel@tonic-gate * The Generic DKIOC numbers are from 0 - 50. 1517c478bd9Sstevel@tonic-gate * The Floppy Driver uses 51 - 100. 1527c478bd9Sstevel@tonic-gate * The Hard Disk (except SCSI) 101 - 106. (these are obsolete) 1537c478bd9Sstevel@tonic-gate * The CDROM Driver 151 - 200. 1547c478bd9Sstevel@tonic-gate * The USCSI ioctl 201 - 250. 1557c478bd9Sstevel@tonic-gate */ 1567c478bd9Sstevel@tonic-gate #define DKIOC (0x04 << 8) 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate /* 1597c478bd9Sstevel@tonic-gate * The following ioctls are generic in nature and need to be 1607c478bd9Sstevel@tonic-gate * suported as appropriate by all disk drivers 1617c478bd9Sstevel@tonic-gate */ 1627c478bd9Sstevel@tonic-gate #define DKIOCGGEOM (DKIOC|1) /* Get geometry */ 1637c478bd9Sstevel@tonic-gate #define DKIOCINFO (DKIOC|3) /* Get info */ 1647c478bd9Sstevel@tonic-gate #define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */ 1657c478bd9Sstevel@tonic-gate #define DKIOCGVTOC (DKIOC|11) /* Get VTOC */ 1667c478bd9Sstevel@tonic-gate #define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */ 1677c478bd9Sstevel@tonic-gate 168342440ecSPrasad Singamsetty #define DKIOCGEXTVTOC (DKIOC|23) /* Get extended VTOC */ 169342440ecSPrasad Singamsetty #define DKIOCSEXTVTOC (DKIOC|24) /* Set extended VTOC, Write to Disk */ 170342440ecSPrasad Singamsetty 1717c478bd9Sstevel@tonic-gate /* 172fa9e4066Sahrens * Disk Cache Controls. These ioctls should be supported by 173fa9e4066Sahrens * all disk drivers. 174fa9e4066Sahrens * 175fa9e4066Sahrens * DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl 176fa9e4066Sahrens * argument, but it should be passed as NULL to allow for future 177fa9e4066Sahrens * reinterpretation. From user-mode, this ioctl request is synchronous. 178fa9e4066Sahrens * 179fa9e4066Sahrens * When invoked from within the kernel, the arg can be NULL to indicate 180fa9e4066Sahrens * a synchronous request or can be the address of a struct dk_callback 181fa9e4066Sahrens * to request an asynchronous callback when the flush request is complete. 182fa9e4066Sahrens * In this case, the flag to the ioctl must include FKIOCTL and the 183fa9e4066Sahrens * dkc_callback field of the pointed to struct must be non-null or the 184fa9e4066Sahrens * request is made synchronously. 185fa9e4066Sahrens * 186fa9e4066Sahrens * In the callback case: if the ioctl returns 0, a callback WILL be performed. 187fa9e4066Sahrens * If the ioctl returns non-zero, a callback will NOT be performed. 188fa9e4066Sahrens * NOTE: In some cases, the callback may be done BEFORE the ioctl call 189fa9e4066Sahrens * returns. The caller's locking strategy should be prepared for this case. 190fa9e4066Sahrens */ 191fa9e4066Sahrens #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ 192fa9e4066Sahrens 193fa9e4066Sahrens struct dk_callback { 194fa9e4066Sahrens void (*dkc_callback)(void *dkc_cookie, int error); 195fa9e4066Sahrens void *dkc_cookie; 196a84224b3Sgz161490 int dkc_flag; 197fa9e4066Sahrens }; 198fa9e4066Sahrens 199a84224b3Sgz161490 /* bit flag definitions for dkc_flag */ 200a84224b3Sgz161490 #define FLUSH_VOLATILE 0x1 /* Bit 0: if set, only flush */ 201a84224b3Sgz161490 /* volatile cache; otherwise, flush */ 202a84224b3Sgz161490 /* volatile and non-volatile cache */ 203a84224b3Sgz161490 204bef6b7d2Swebaker #define DKIOCGETWCE (DKIOC|36) /* Get current write cache */ 205bef6b7d2Swebaker /* enablement status */ 206bef6b7d2Swebaker #define DKIOCSETWCE (DKIOC|37) /* Enable/Disable write cache */ 207bef6b7d2Swebaker 208fa9e4066Sahrens /* 2097c478bd9Sstevel@tonic-gate * The following ioctls are used by Sun drivers to communicate 2107c478bd9Sstevel@tonic-gate * with their associated format routines. Support of these ioctls 2117c478bd9Sstevel@tonic-gate * is not required of foreign drivers 2127c478bd9Sstevel@tonic-gate */ 2137c478bd9Sstevel@tonic-gate #define DKIOCSGEOM (DKIOC|2) /* Set geometry */ 2147c478bd9Sstevel@tonic-gate #define DKIOCSAPART (DKIOC|4) /* Set all partitions */ 2157c478bd9Sstevel@tonic-gate #define DKIOCGAPART (DKIOC|5) /* Get all partitions */ 2167c478bd9Sstevel@tonic-gate #define DKIOCG_PHYGEOM (DKIOC|32) /* get physical geometry */ 2177c478bd9Sstevel@tonic-gate #define DKIOCG_VIRTGEOM (DKIOC|33) /* get virtual geometry */ 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate /* 2207c478bd9Sstevel@tonic-gate * The following ioctl's are removable media support 2217c478bd9Sstevel@tonic-gate */ 2227c478bd9Sstevel@tonic-gate #define DKIOCLOCK (DKIOC|7) /* Generic 'lock' */ 2237c478bd9Sstevel@tonic-gate #define DKIOCUNLOCK (DKIOC|8) /* Generic 'unlock' */ 2247c478bd9Sstevel@tonic-gate #define DKIOCSTATE (DKIOC|13) /* Inquire insert/eject state */ 2257c478bd9Sstevel@tonic-gate #define DKIOCREMOVABLE (DKIOC|16) /* is media removable */ 2267c478bd9Sstevel@tonic-gate 2270167b58cScg149915 2280167b58cScg149915 /* 2290167b58cScg149915 * ioctl for hotpluggable devices 2300167b58cScg149915 */ 2310167b58cScg149915 #define DKIOCHOTPLUGGABLE (DKIOC|35) /* is hotpluggable */ 2320167b58cScg149915 233*aa1b14e7SSheshadri Vasudevan #if defined(__i386) || defined(__amd64) 234*aa1b14e7SSheshadri Vasudevan /* ioctl to write extended partition structure into the disk */ 235*aa1b14e7SSheshadri Vasudevan #define DKIOCSETEXTPART (DKIOC|46) 236*aa1b14e7SSheshadri Vasudevan #endif 237*aa1b14e7SSheshadri Vasudevan 2387c478bd9Sstevel@tonic-gate /* 2397c478bd9Sstevel@tonic-gate * Ioctl to force driver to re-read the alternate partition and rebuild 2407c478bd9Sstevel@tonic-gate * the internal defect map. 2417c478bd9Sstevel@tonic-gate */ 2427c478bd9Sstevel@tonic-gate #define DKIOCADDBAD (DKIOC|20) /* Re-read the alternate map (IDE) */ 2437c478bd9Sstevel@tonic-gate #define DKIOCGETDEF (DKIOC|21) /* read defect list (IDE) */ 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* 2467c478bd9Sstevel@tonic-gate * Used by applications to get disk defect information from IDE 2477c478bd9Sstevel@tonic-gate * drives. 2487c478bd9Sstevel@tonic-gate */ 2497c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2507c478bd9Sstevel@tonic-gate struct defect_header32 { 2517c478bd9Sstevel@tonic-gate int head; 2527c478bd9Sstevel@tonic-gate caddr32_t buffer; 2537c478bd9Sstevel@tonic-gate }; 2547c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate struct defect_header { 2577c478bd9Sstevel@tonic-gate int head; 2587c478bd9Sstevel@tonic-gate caddr_t buffer; 2597c478bd9Sstevel@tonic-gate }; 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate #define DKIOCPARTINFO (DKIOC|22) /* Get partition or slice parameters */ 262342440ecSPrasad Singamsetty #define DKIOCEXTPARTINFO (DKIOC|19) /* Get extended partition or slice */ 263342440ecSPrasad Singamsetty /* parameters */ 264342440ecSPrasad Singamsetty 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate /* 2677c478bd9Sstevel@tonic-gate * Used by applications to get partition or slice information 2687c478bd9Sstevel@tonic-gate */ 2697c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2707c478bd9Sstevel@tonic-gate struct part_info32 { 2717c478bd9Sstevel@tonic-gate daddr32_t p_start; 2727c478bd9Sstevel@tonic-gate int p_length; 2737c478bd9Sstevel@tonic-gate }; 2747c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate struct part_info { 2777c478bd9Sstevel@tonic-gate daddr_t p_start; 2787c478bd9Sstevel@tonic-gate int p_length; 2797c478bd9Sstevel@tonic-gate }; 2807c478bd9Sstevel@tonic-gate 281342440ecSPrasad Singamsetty struct extpart_info { 282342440ecSPrasad Singamsetty diskaddr_t p_start; 283342440ecSPrasad Singamsetty diskaddr_t p_length; 284342440ecSPrasad Singamsetty }; 285342440ecSPrasad Singamsetty 2867c478bd9Sstevel@tonic-gate /* The following ioctls are for Optical Memory Device */ 2877c478bd9Sstevel@tonic-gate #define DKIOC_EBP_ENABLE (DKIOC|40) /* enable by pass erase on write */ 2887c478bd9Sstevel@tonic-gate #define DKIOC_EBP_DISABLE (DKIOC|41) /* disable by pass erase on write */ 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate /* 2917c478bd9Sstevel@tonic-gate * This state enum is the argument passed to the DKIOCSTATE ioctl. 2927c478bd9Sstevel@tonic-gate */ 2937c478bd9Sstevel@tonic-gate enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE }; 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate #define DKIOCGMEDIAINFO (DKIOC|42) /* get information about the media */ 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate /* 2987c478bd9Sstevel@tonic-gate * ioctls to read/write mboot info. 2997c478bd9Sstevel@tonic-gate */ 3007c478bd9Sstevel@tonic-gate #define DKIOCGMBOOT (DKIOC|43) /* get mboot info */ 3017c478bd9Sstevel@tonic-gate #define DKIOCSMBOOT (DKIOC|44) /* set mboot info */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* 3047c478bd9Sstevel@tonic-gate * ioctl to get the device temperature. 3057c478bd9Sstevel@tonic-gate */ 3067c478bd9Sstevel@tonic-gate #define DKIOCGTEMPERATURE (DKIOC|45) /* get temperature */ 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate /* 30965908c77Syu, larry liu - Sun Microsystems - Beijing China * ioctl to get the media info including physical block size 31065908c77Syu, larry liu - Sun Microsystems - Beijing China */ 31165908c77Syu, larry liu - Sun Microsystems - Beijing China #define DKIOCGMEDIAINFOEXT (DKIOC|48) 31265908c77Syu, larry liu - Sun Microsystems - Beijing China 31365908c77Syu, larry liu - Sun Microsystems - Beijing China /* 3147c478bd9Sstevel@tonic-gate * Used for providing the temperature. 3157c478bd9Sstevel@tonic-gate */ 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate struct dk_temperature { 3187c478bd9Sstevel@tonic-gate uint_t dkt_flags; /* Flags */ 3197c478bd9Sstevel@tonic-gate short dkt_cur_temp; /* Current disk temperature */ 3207c478bd9Sstevel@tonic-gate short dkt_ref_temp; /* reference disk temperature */ 3217c478bd9Sstevel@tonic-gate }; 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate #define DKT_BYPASS_PM 0x1 3247c478bd9Sstevel@tonic-gate #define DKT_INVALID_TEMP 0xFFFF 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gate /* 3287c478bd9Sstevel@tonic-gate * Used for Media info or the current profile info 3297c478bd9Sstevel@tonic-gate */ 3307c478bd9Sstevel@tonic-gate struct dk_minfo { 3317c478bd9Sstevel@tonic-gate uint_t dki_media_type; /* Media type or profile info */ 3327c478bd9Sstevel@tonic-gate uint_t dki_lbsize; /* Logical blocksize of media */ 3337c478bd9Sstevel@tonic-gate diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */ 3347c478bd9Sstevel@tonic-gate }; 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate /* 33765908c77Syu, larry liu - Sun Microsystems - Beijing China * Used for Media info or the current profile info 33865908c77Syu, larry liu - Sun Microsystems - Beijing China * including physical block size if supported. 33965908c77Syu, larry liu - Sun Microsystems - Beijing China */ 34065908c77Syu, larry liu - Sun Microsystems - Beijing China struct dk_minfo_ext { 34165908c77Syu, larry liu - Sun Microsystems - Beijing China uint_t dki_media_type; /* Media type or profile info */ 34265908c77Syu, larry liu - Sun Microsystems - Beijing China uint_t dki_lbsize; /* Logical blocksize of media */ 34365908c77Syu, larry liu - Sun Microsystems - Beijing China diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */ 34465908c77Syu, larry liu - Sun Microsystems - Beijing China uint_t dki_pbsize; /* Physical blocksize of media */ 34565908c77Syu, larry liu - Sun Microsystems - Beijing China }; 34665908c77Syu, larry liu - Sun Microsystems - Beijing China 34765908c77Syu, larry liu - Sun Microsystems - Beijing China /* 3487c478bd9Sstevel@tonic-gate * Media types or profiles known 3497c478bd9Sstevel@tonic-gate */ 3507c478bd9Sstevel@tonic-gate #define DK_UNKNOWN 0x00 /* Media inserted - type unknown */ 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate /* 3547c478bd9Sstevel@tonic-gate * SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to 3557c478bd9Sstevel@tonic-gate * maintain compatibility with SFF8090. The following define the 3567c478bd9Sstevel@tonic-gate * optical media type. 3577c478bd9Sstevel@tonic-gate */ 358c7d4aa56Sphitran #define DK_REMOVABLE_DISK 0x02 /* Removable Disk */ 3597c478bd9Sstevel@tonic-gate #define DK_MO_ERASABLE 0x03 /* MO Erasable */ 3607c478bd9Sstevel@tonic-gate #define DK_MO_WRITEONCE 0x04 /* MO Write once */ 3617c478bd9Sstevel@tonic-gate #define DK_AS_MO 0x05 /* AS MO */ 3627c478bd9Sstevel@tonic-gate #define DK_CDROM 0x08 /* CDROM */ 3637c478bd9Sstevel@tonic-gate #define DK_CDR 0x09 /* CD-R */ 3647c478bd9Sstevel@tonic-gate #define DK_CDRW 0x0A /* CD-RW */ 3657c478bd9Sstevel@tonic-gate #define DK_DVDROM 0x10 /* DVD-ROM */ 3667c478bd9Sstevel@tonic-gate #define DK_DVDR 0x11 /* DVD-R */ 3677c478bd9Sstevel@tonic-gate #define DK_DVDRAM 0x12 /* DVD_RAM or DVD-RW */ 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate /* 3707c478bd9Sstevel@tonic-gate * Media types for other rewritable magnetic media 3717c478bd9Sstevel@tonic-gate */ 3727c478bd9Sstevel@tonic-gate #define DK_FIXED_DISK 0x10001 /* Fixed disk SCSI or otherwise */ 3737c478bd9Sstevel@tonic-gate #define DK_FLOPPY 0x10002 /* Floppy media */ 3747c478bd9Sstevel@tonic-gate #define DK_ZIP 0x10003 /* IOMEGA ZIP media */ 3757c478bd9Sstevel@tonic-gate #define DK_JAZ 0x10004 /* IOMEGA JAZ media */ 3767c478bd9Sstevel@tonic-gate 3777c478bd9Sstevel@tonic-gate #define DKIOCSETEFI (DKIOC|17) /* Set EFI info */ 3787c478bd9Sstevel@tonic-gate #define DKIOCGETEFI (DKIOC|18) /* Get EFI info */ 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate #define DKIOCPARTITION (DKIOC|9) /* Get partition info */ 3817c478bd9Sstevel@tonic-gate 3827c478bd9Sstevel@tonic-gate /* 3837c478bd9Sstevel@tonic-gate * Ioctls to get/set volume capabilities related to Logical Volume Managers. 3847c478bd9Sstevel@tonic-gate * They include the ability to get/set capabilities and to issue a read to a 3857c478bd9Sstevel@tonic-gate * specific underlying device of a replicated device. 3867c478bd9Sstevel@tonic-gate */ 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate #define DKIOCGETVOLCAP (DKIOC | 25) /* Get volume capabilities */ 3897c478bd9Sstevel@tonic-gate #define DKIOCSETVOLCAP (DKIOC | 26) /* Set volume capabilities */ 3907c478bd9Sstevel@tonic-gate #define DKIOCDMR (DKIOC | 27) /* Issue a directed read */ 3917c478bd9Sstevel@tonic-gate 392e7cbe64fSgw25295 #define DKIOCDUMPINIT (DKIOC | 28) /* Dumpify a zvol */ 393e7cbe64fSgw25295 #define DKIOCDUMPFINI (DKIOC | 29) /* Un-Dumpify a zvol */ 394e7cbe64fSgw25295 3957c478bd9Sstevel@tonic-gate typedef uint_t volcapinfo_t; 3967c478bd9Sstevel@tonic-gate 3977c478bd9Sstevel@tonic-gate typedef uint_t volcapset_t; 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate #define DKV_ABR_CAP 0x00000001 /* Support Appl.Based Recovery */ 4007c478bd9Sstevel@tonic-gate #define DKV_DMR_CAP 0x00000002 /* Support Directed Mirror Read */ 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate typedef struct volcap { 4037c478bd9Sstevel@tonic-gate volcapinfo_t vc_info; /* Capabilities available */ 4047c478bd9Sstevel@tonic-gate volcapset_t vc_set; /* Capabilities set */ 4057c478bd9Sstevel@tonic-gate } volcap_t; 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate #define VOL_SIDENAME 256 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd { 4107c478bd9Sstevel@tonic-gate int vdr_flags; 4117c478bd9Sstevel@tonic-gate offset_t vdr_offset; 4127c478bd9Sstevel@tonic-gate size_t vdr_nbytes; 4137c478bd9Sstevel@tonic-gate size_t vdr_bytesread; 4147c478bd9Sstevel@tonic-gate void *vdr_data; 4157c478bd9Sstevel@tonic-gate int vdr_side; 4167c478bd9Sstevel@tonic-gate char vdr_side_name[VOL_SIDENAME]; 4177c478bd9Sstevel@tonic-gate } vol_directed_rd_t; 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate #define DKV_SIDE_INIT (-1) 4207c478bd9Sstevel@tonic-gate #define DKV_DMR_NEXT_SIDE 0x00000001 4217c478bd9Sstevel@tonic-gate #define DKV_DMR_DONE 0x00000002 4227c478bd9Sstevel@tonic-gate #define DKV_DMR_ERROR 0x00000004 4237c478bd9Sstevel@tonic-gate #define DKV_DMR_SUCCESS 0x00000008 4247c478bd9Sstevel@tonic-gate #define DKV_DMR_SHORT 0x00000010 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate #ifdef _MULTI_DATAMODEL 4277c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 4287c478bd9Sstevel@tonic-gate #pragma pack(4) 4297c478bd9Sstevel@tonic-gate #endif 4307c478bd9Sstevel@tonic-gate typedef struct vol_directed_rd32 { 4317c478bd9Sstevel@tonic-gate int32_t vdr_flags; 4327c478bd9Sstevel@tonic-gate offset_t vdr_offset; /* 64-bit element on 32-bit alignment */ 4337c478bd9Sstevel@tonic-gate size32_t vdr_nbytes; 4347c478bd9Sstevel@tonic-gate size32_t vdr_bytesread; 4357c478bd9Sstevel@tonic-gate caddr32_t vdr_data; 4367c478bd9Sstevel@tonic-gate int32_t vdr_side; 4377c478bd9Sstevel@tonic-gate char vdr_side_name[VOL_SIDENAME]; 4387c478bd9Sstevel@tonic-gate } vol_directed_rd32_t; 4397c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 4407c478bd9Sstevel@tonic-gate #pragma pack() 4417c478bd9Sstevel@tonic-gate #endif 4427c478bd9Sstevel@tonic-gate #endif /* _MULTI_DATAMODEL */ 4437c478bd9Sstevel@tonic-gate 4440f2c99a4Syt160523 /* 4450f2c99a4Syt160523 * The ioctl is used to fetch disk's device type, vendor ID, 4460f2c99a4Syt160523 * model number/product ID, firmware revision and serial number together. 4470f2c99a4Syt160523 * 4480f2c99a4Syt160523 * Currently there are two device types - DKD_ATA_TYPE which means the 4490f2c99a4Syt160523 * disk is driven by cmdk/ata or dad/uata driver, and DKD_SCSI_TYPE 4500f2c99a4Syt160523 * which means the disk is driven by sd/scsi hba driver. 4510f2c99a4Syt160523 */ 4520f2c99a4Syt160523 #define DKIOC_GETDISKID (DKIOC|46) 4530f2c99a4Syt160523 4540f2c99a4Syt160523 /* These two labels are for dkd_dtype of dk_disk_id_t */ 4550f2c99a4Syt160523 #define DKD_ATA_TYPE 0x01 /* ATA disk or legacy mode SATA disk */ 4560f2c99a4Syt160523 #define DKD_SCSI_TYPE 0x02 /* SCSI disk or native mode SATA disk */ 4570f2c99a4Syt160523 4580f2c99a4Syt160523 #define DKD_ATA_MODEL 40 /* model number length */ 4590f2c99a4Syt160523 #define DKD_ATA_FWVER 8 /* firmware revision length */ 4600f2c99a4Syt160523 #define DKD_ATA_SERIAL 20 /* serial number length */ 4610f2c99a4Syt160523 4620f2c99a4Syt160523 #define DKD_SCSI_VENDOR 8 /* vendor ID length */ 4630f2c99a4Syt160523 #define DKD_SCSI_PRODUCT 16 /* product ID length */ 4640f2c99a4Syt160523 #define DKD_SCSI_REVLEVEL 4 /* revision level length */ 4650f2c99a4Syt160523 #define DKD_SCSI_SERIAL 12 /* serial number length */ 4660f2c99a4Syt160523 4670f2c99a4Syt160523 /* 4680f2c99a4Syt160523 * The argument type for DKIOC_GETDISKID ioctl. 4690f2c99a4Syt160523 */ 4700f2c99a4Syt160523 typedef struct dk_disk_id { 4710f2c99a4Syt160523 uint_t dkd_dtype; 4720f2c99a4Syt160523 union { 4730f2c99a4Syt160523 struct { 4740f2c99a4Syt160523 char dkd_amodel[DKD_ATA_MODEL]; /* 40 bytes */ 4750f2c99a4Syt160523 char dkd_afwver[DKD_ATA_FWVER]; /* 8 bytes */ 4760f2c99a4Syt160523 char dkd_aserial[DKD_ATA_SERIAL]; /* 20 bytes */ 4770f2c99a4Syt160523 } ata_disk_id; 4780f2c99a4Syt160523 struct { 4790f2c99a4Syt160523 char dkd_svendor[DKD_SCSI_VENDOR]; /* 8 bytes */ 4800f2c99a4Syt160523 char dkd_sproduct[DKD_SCSI_PRODUCT]; /* 16 bytes */ 4810f2c99a4Syt160523 char dkd_sfwver[DKD_SCSI_REVLEVEL]; /* 4 bytes */ 4820f2c99a4Syt160523 char dkd_sserial[DKD_SCSI_SERIAL]; /* 12 bytes */ 4830f2c99a4Syt160523 } scsi_disk_id; 4840f2c99a4Syt160523 } disk_id; 4850f2c99a4Syt160523 } dk_disk_id_t; 4860f2c99a4Syt160523 4870f2c99a4Syt160523 /* 4880f2c99a4Syt160523 * The ioctl is used to update the firmware of device. 4890f2c99a4Syt160523 */ 4900f2c99a4Syt160523 #define DKIOC_UPDATEFW (DKIOC|47) 4910f2c99a4Syt160523 4920f2c99a4Syt160523 /* The argument type for DKIOC_UPDATEFW ioctl */ 4930f2c99a4Syt160523 typedef struct dk_updatefw { 4940f2c99a4Syt160523 caddr_t dku_ptrbuf; /* pointer to firmware buf */ 4950f2c99a4Syt160523 uint_t dku_size; /* firmware buf length */ 4960f2c99a4Syt160523 uint8_t dku_type; /* firmware update type */ 4970f2c99a4Syt160523 } dk_updatefw_t; 4980f2c99a4Syt160523 4990f2c99a4Syt160523 #ifdef _SYSCALL32 5000f2c99a4Syt160523 typedef struct dk_updatefw_32 { 5010f2c99a4Syt160523 caddr32_t dku_ptrbuf; /* pointer to firmware buf */ 5020f2c99a4Syt160523 uint_t dku_size; /* firmware buf length */ 5030f2c99a4Syt160523 uint8_t dku_type; /* firmware update type */ 5040f2c99a4Syt160523 } dk_updatefw_32_t; 5050f2c99a4Syt160523 #endif /* _SYSCALL32 */ 5060f2c99a4Syt160523 5070f2c99a4Syt160523 /* 5080f2c99a4Syt160523 * firmware update type - temporary or permanent use 5090f2c99a4Syt160523 */ 5100f2c99a4Syt160523 #define FW_TYPE_TEMP 0x0 /* temporary use */ 5110f2c99a4Syt160523 #define FW_TYPE_PERM 0x1 /* permanent use */ 5120f2c99a4Syt160523 5130f2c99a4Syt160523 5147c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5157c478bd9Sstevel@tonic-gate } 5167c478bd9Sstevel@tonic-gate #endif 5177c478bd9Sstevel@tonic-gate 5187c478bd9Sstevel@tonic-gate #endif /* _SYS_DKIO_H */ 519