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 (c) 1991,1997-1998 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_HDIO_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_HDIO_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 31*7c478bd9Sstevel@tonic-gate extern "C" { 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate /* 35*7c478bd9Sstevel@tonic-gate * Used for generic commands 36*7c478bd9Sstevel@tonic-gate */ 37*7c478bd9Sstevel@tonic-gate struct hdk_cmd { 38*7c478bd9Sstevel@tonic-gate ushort_t hdkc_cmd; /* command to be executed */ 39*7c478bd9Sstevel@tonic-gate int hdkc_flags; /* execution flags */ 40*7c478bd9Sstevel@tonic-gate daddr_t hdkc_blkno; /* disk address for command */ 41*7c478bd9Sstevel@tonic-gate int hdkc_secnt; /* sector count for command */ 42*7c478bd9Sstevel@tonic-gate caddr_t hdkc_bufaddr; /* user's buffer address */ 43*7c478bd9Sstevel@tonic-gate uint_t hdkc_buflen; /* size of user's buffer */ 44*7c478bd9Sstevel@tonic-gate }; 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Used for drive info 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate struct hdk_type { 50*7c478bd9Sstevel@tonic-gate ushort_t hdkt_hsect; /* hard sector count (read only) */ 51*7c478bd9Sstevel@tonic-gate ushort_t hdkt_promrev; /* prom revision (read only) */ 52*7c478bd9Sstevel@tonic-gate uchar_t hdkt_drtype; /* drive type (ctlr specific) */ 53*7c478bd9Sstevel@tonic-gate uchar_t hdkt_drstat; /* drive status (ctlr specific, ro) */ 54*7c478bd9Sstevel@tonic-gate }; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate /* 57*7c478bd9Sstevel@tonic-gate * Used for bad sector map 58*7c478bd9Sstevel@tonic-gate */ 59*7c478bd9Sstevel@tonic-gate struct hdk_badmap { 60*7c478bd9Sstevel@tonic-gate caddr_t hdkb_bufaddr; /* address of user's map buffer */ 61*7c478bd9Sstevel@tonic-gate }; 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate /* 64*7c478bd9Sstevel@tonic-gate * Execution flags. 65*7c478bd9Sstevel@tonic-gate */ 66*7c478bd9Sstevel@tonic-gate #define HDK_SILENT 0x01 /* no error messages */ 67*7c478bd9Sstevel@tonic-gate #define HDK_DIAGNOSE 0x02 /* fail if any error occurs */ 68*7c478bd9Sstevel@tonic-gate #define HDK_ISOLATE 0x04 /* isolate from normal commands */ 69*7c478bd9Sstevel@tonic-gate #define HDK_READ 0x08 /* read from device */ 70*7c478bd9Sstevel@tonic-gate #define HDK_WRITE 0x10 /* write to device */ 71*7c478bd9Sstevel@tonic-gate #define HDK_KBUF 0x20 /* write to device */ 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate /* 74*7c478bd9Sstevel@tonic-gate * Used for disk diagnostics 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate struct hdk_diag { 77*7c478bd9Sstevel@tonic-gate ushort_t hdkd_errcmd; /* most recent command in error */ 78*7c478bd9Sstevel@tonic-gate daddr_t hdkd_errsect; /* most recent sector in error */ 79*7c478bd9Sstevel@tonic-gate uchar_t hdkd_errno; /* most recent error number */ 80*7c478bd9Sstevel@tonic-gate uchar_t hdkd_severe; /* severity of most recent error */ 81*7c478bd9Sstevel@tonic-gate }; 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* 84*7c478bd9Sstevel@tonic-gate * Used for getting disk error log. 85*7c478bd9Sstevel@tonic-gate */ 86*7c478bd9Sstevel@tonic-gate struct hdk_loghdr { 87*7c478bd9Sstevel@tonic-gate long hdkl_entries; /* number of dk_log entries */ 88*7c478bd9Sstevel@tonic-gate long hdkl_max_size; /* max. size of dk_log table */ 89*7c478bd9Sstevel@tonic-gate caddr_t hdkl_logbfr; /* pointer to dk_log table */ 90*7c478bd9Sstevel@tonic-gate }; 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate /* 93*7c478bd9Sstevel@tonic-gate * Disk error log table entry. 94*7c478bd9Sstevel@tonic-gate */ 95*7c478bd9Sstevel@tonic-gate struct hdk_log { 96*7c478bd9Sstevel@tonic-gate daddr_t hdkl_block; /* location of block in error */ 97*7c478bd9Sstevel@tonic-gate ulong_t hdkl_count; /* number of failures */ 98*7c478bd9Sstevel@tonic-gate short hdkl_type; /* type of error (e.g. soft error) */ 99*7c478bd9Sstevel@tonic-gate short hdkl_err1; /* primary error code (e.g sense key) */ 100*7c478bd9Sstevel@tonic-gate short hdkl_err2; /* secondary error code */ 101*7c478bd9Sstevel@tonic-gate }; 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* 104*7c478bd9Sstevel@tonic-gate * Dk_log type flags. 105*7c478bd9Sstevel@tonic-gate * 106*7c478bd9Sstevel@tonic-gate * FIXME: Really should specify dkd_errno error codes. 107*7c478bd9Sstevel@tonic-gate * For some reason they're specified in the drivers 108*7c478bd9Sstevel@tonic-gate * instead of here?? Should also use those here for 109*7c478bd9Sstevel@tonic-gate * dk_log.type too. 110*7c478bd9Sstevel@tonic-gate */ 111*7c478bd9Sstevel@tonic-gate #define HDKL_SOFT 0x01 /* recoverable erro */ 112*7c478bd9Sstevel@tonic-gate #define HDKL_HARD 0x02 /* unrecoverable error */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * Severity values 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate #define HDK_NOERROR 0 118*7c478bd9Sstevel@tonic-gate #define HDK_CORRECTED 1 119*7c478bd9Sstevel@tonic-gate #define HDK_RECOVERED 2 120*7c478bd9Sstevel@tonic-gate #define HDK_FATAL 3 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate /* 123*7c478bd9Sstevel@tonic-gate * Error types 124*7c478bd9Sstevel@tonic-gate */ 125*7c478bd9Sstevel@tonic-gate #define HDK_NONMEDIA 0 /* not caused by a media defect */ 126*7c478bd9Sstevel@tonic-gate #define HDK_ISMEDIA 1 /* caused by a media defect */ 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate #define HDIOC (0x04 << 8) 130*7c478bd9Sstevel@tonic-gate #define HDKIOCSTYPE (HDIOC|101) /* Set drive info */ 131*7c478bd9Sstevel@tonic-gate #define HDKIOCGTYPE (HDIOC|102) /* Get drive info */ 132*7c478bd9Sstevel@tonic-gate #define HDKIOCSBAD (HDIOC|103) /* Set bad sector map */ 133*7c478bd9Sstevel@tonic-gate #define HDKIOCGBAD (HDIOC|104) /* Get bad sector map */ 134*7c478bd9Sstevel@tonic-gate #define HDKIOCSCMD (HDIOC|105) /* Set generic cmd */ 135*7c478bd9Sstevel@tonic-gate #define HDKIOCGDIAG (HDIOC|106) /* Get diagnostics */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 138*7c478bd9Sstevel@tonic-gate } 139*7c478bd9Sstevel@tonic-gate #endif 140*7c478bd9Sstevel@tonic-gate 141*7c478bd9Sstevel@tonic-gate #endif /* _SYS_HDIO_H */ 142