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