1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1991,1997-1998 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_HDIO_H 28*0Sstevel@tonic-gate #define _SYS_HDIO_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate /* 37*0Sstevel@tonic-gate * Used for generic commands 38*0Sstevel@tonic-gate */ 39*0Sstevel@tonic-gate struct hdk_cmd { 40*0Sstevel@tonic-gate ushort_t hdkc_cmd; /* command to be executed */ 41*0Sstevel@tonic-gate int hdkc_flags; /* execution flags */ 42*0Sstevel@tonic-gate daddr_t hdkc_blkno; /* disk address for command */ 43*0Sstevel@tonic-gate int hdkc_secnt; /* sector count for command */ 44*0Sstevel@tonic-gate caddr_t hdkc_bufaddr; /* user's buffer address */ 45*0Sstevel@tonic-gate uint_t hdkc_buflen; /* size of user's buffer */ 46*0Sstevel@tonic-gate }; 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate /* 49*0Sstevel@tonic-gate * Used for drive info 50*0Sstevel@tonic-gate */ 51*0Sstevel@tonic-gate struct hdk_type { 52*0Sstevel@tonic-gate ushort_t hdkt_hsect; /* hard sector count (read only) */ 53*0Sstevel@tonic-gate ushort_t hdkt_promrev; /* prom revision (read only) */ 54*0Sstevel@tonic-gate uchar_t hdkt_drtype; /* drive type (ctlr specific) */ 55*0Sstevel@tonic-gate uchar_t hdkt_drstat; /* drive status (ctlr specific, ro) */ 56*0Sstevel@tonic-gate }; 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate /* 59*0Sstevel@tonic-gate * Used for bad sector map 60*0Sstevel@tonic-gate */ 61*0Sstevel@tonic-gate struct hdk_badmap { 62*0Sstevel@tonic-gate caddr_t hdkb_bufaddr; /* address of user's map buffer */ 63*0Sstevel@tonic-gate }; 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate /* 66*0Sstevel@tonic-gate * Execution flags. 67*0Sstevel@tonic-gate */ 68*0Sstevel@tonic-gate #define HDK_SILENT 0x01 /* no error messages */ 69*0Sstevel@tonic-gate #define HDK_DIAGNOSE 0x02 /* fail if any error occurs */ 70*0Sstevel@tonic-gate #define HDK_ISOLATE 0x04 /* isolate from normal commands */ 71*0Sstevel@tonic-gate #define HDK_READ 0x08 /* read from device */ 72*0Sstevel@tonic-gate #define HDK_WRITE 0x10 /* write to device */ 73*0Sstevel@tonic-gate #define HDK_KBUF 0x20 /* write to device */ 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate /* 76*0Sstevel@tonic-gate * Used for disk diagnostics 77*0Sstevel@tonic-gate */ 78*0Sstevel@tonic-gate struct hdk_diag { 79*0Sstevel@tonic-gate ushort_t hdkd_errcmd; /* most recent command in error */ 80*0Sstevel@tonic-gate daddr_t hdkd_errsect; /* most recent sector in error */ 81*0Sstevel@tonic-gate uchar_t hdkd_errno; /* most recent error number */ 82*0Sstevel@tonic-gate uchar_t hdkd_severe; /* severity of most recent error */ 83*0Sstevel@tonic-gate }; 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * Used for getting disk error log. 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate struct hdk_loghdr { 89*0Sstevel@tonic-gate long hdkl_entries; /* number of dk_log entries */ 90*0Sstevel@tonic-gate long hdkl_max_size; /* max. size of dk_log table */ 91*0Sstevel@tonic-gate caddr_t hdkl_logbfr; /* pointer to dk_log table */ 92*0Sstevel@tonic-gate }; 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate /* 95*0Sstevel@tonic-gate * Disk error log table entry. 96*0Sstevel@tonic-gate */ 97*0Sstevel@tonic-gate struct hdk_log { 98*0Sstevel@tonic-gate daddr_t hdkl_block; /* location of block in error */ 99*0Sstevel@tonic-gate ulong_t hdkl_count; /* number of failures */ 100*0Sstevel@tonic-gate short hdkl_type; /* type of error (e.g. soft error) */ 101*0Sstevel@tonic-gate short hdkl_err1; /* primary error code (e.g sense key) */ 102*0Sstevel@tonic-gate short hdkl_err2; /* secondary error code */ 103*0Sstevel@tonic-gate }; 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate /* 106*0Sstevel@tonic-gate * Dk_log type flags. 107*0Sstevel@tonic-gate * 108*0Sstevel@tonic-gate * FIXME: Really should specify dkd_errno error codes. 109*0Sstevel@tonic-gate * For some reason they're specified in the drivers 110*0Sstevel@tonic-gate * instead of here?? Should also use those here for 111*0Sstevel@tonic-gate * dk_log.type too. 112*0Sstevel@tonic-gate */ 113*0Sstevel@tonic-gate #define HDKL_SOFT 0x01 /* recoverable erro */ 114*0Sstevel@tonic-gate #define HDKL_HARD 0x02 /* unrecoverable error */ 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate /* 117*0Sstevel@tonic-gate * Severity values 118*0Sstevel@tonic-gate */ 119*0Sstevel@tonic-gate #define HDK_NOERROR 0 120*0Sstevel@tonic-gate #define HDK_CORRECTED 1 121*0Sstevel@tonic-gate #define HDK_RECOVERED 2 122*0Sstevel@tonic-gate #define HDK_FATAL 3 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate /* 125*0Sstevel@tonic-gate * Error types 126*0Sstevel@tonic-gate */ 127*0Sstevel@tonic-gate #define HDK_NONMEDIA 0 /* not caused by a media defect */ 128*0Sstevel@tonic-gate #define HDK_ISMEDIA 1 /* caused by a media defect */ 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate #define HDIOC (0x04 << 8) 132*0Sstevel@tonic-gate #define HDKIOCSTYPE (HDIOC|101) /* Set drive info */ 133*0Sstevel@tonic-gate #define HDKIOCGTYPE (HDIOC|102) /* Get drive info */ 134*0Sstevel@tonic-gate #define HDKIOCSBAD (HDIOC|103) /* Set bad sector map */ 135*0Sstevel@tonic-gate #define HDKIOCGBAD (HDIOC|104) /* Get bad sector map */ 136*0Sstevel@tonic-gate #define HDKIOCSCMD (HDIOC|105) /* Set generic cmd */ 137*0Sstevel@tonic-gate #define HDKIOCGDIAG (HDIOC|106) /* Get diagnostics */ 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate #ifdef __cplusplus 140*0Sstevel@tonic-gate } 141*0Sstevel@tonic-gate #endif 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate #endif /* _SYS_HDIO_H */ 144