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