biovar.h revision 1.1.18.6 1 1.1.18.6 yamt /* $NetBSD: biovar.h,v 1.1.18.6 2008/03/17 09:14:37 yamt Exp $ */
2 1.1.18.2 yamt /* $OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $ */
3 1.1.18.2 yamt
4 1.1.18.2 yamt /*
5 1.1.18.2 yamt * Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
6 1.1.18.2 yamt * Copyright (c) 2005 Marco Peereboom. All rights reserved.
7 1.1.18.2 yamt *
8 1.1.18.2 yamt * Redistribution and use in source and binary forms, with or without
9 1.1.18.2 yamt * modification, are permitted provided that the following conditions
10 1.1.18.2 yamt * are met:
11 1.1.18.2 yamt * 1. Redistributions of source code must retain the above copyright
12 1.1.18.2 yamt * notice, this list of conditions and the following disclaimer.
13 1.1.18.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
14 1.1.18.2 yamt * notice, this list of conditions and the following disclaimer in the
15 1.1.18.2 yamt * documentation and/or other materials provided with the distribution.
16 1.1.18.2 yamt *
17 1.1.18.2 yamt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.1.18.2 yamt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.1.18.2 yamt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.1.18.2 yamt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.1.18.2 yamt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.1.18.2 yamt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.1.18.2 yamt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.1.18.2 yamt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.1.18.2 yamt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.1.18.2 yamt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1.18.2 yamt */
28 1.1.18.2 yamt
29 1.1.18.2 yamt /*
30 1.1.18.2 yamt * Devices getting ioctls through this interface should use ioctl class 'B'
31 1.1.18.2 yamt * and command numbers starting from 32, lower ones are reserved for generic
32 1.1.18.2 yamt * ioctls. All ioctl data must be structures which start with a void *
33 1.1.18.2 yamt * cookie.
34 1.1.18.2 yamt */
35 1.1.18.2 yamt
36 1.1.18.5 yamt #ifndef _DEV_BIOVAR_H_
37 1.1.18.5 yamt #define _DEV_BIOVAR_H_
38 1.1.18.5 yamt
39 1.1.18.2 yamt #include <sys/types.h>
40 1.1.18.2 yamt
41 1.1.18.5 yamt #ifndef _KERNEL
42 1.1.18.5 yamt #include <stdbool.h>
43 1.1.18.5 yamt #endif
44 1.1.18.5 yamt
45 1.1.18.2 yamt struct bio_common {
46 1.1.18.2 yamt void *bc_cookie;
47 1.1.18.2 yamt };
48 1.1.18.2 yamt
49 1.1.18.2 yamt /* convert name to a cookie */
50 1.1.18.2 yamt #define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
51 1.1.18.2 yamt struct bio_locate {
52 1.1.18.2 yamt void *bl_cookie;
53 1.1.18.2 yamt char *bl_name;
54 1.1.18.2 yamt };
55 1.1.18.2 yamt
56 1.1.18.2 yamt #ifdef _KERNEL
57 1.1.18.3 yamt int bio_register(struct device *, int (*)(struct device *, u_long, void *));
58 1.1.18.2 yamt void bio_unregister(struct device *);
59 1.1.18.2 yamt #endif
60 1.1.18.2 yamt
61 1.1.18.2 yamt #define BIOCINQ _IOWR('B', 32, struct bioc_inq)
62 1.1.18.2 yamt struct bioc_inq {
63 1.1.18.2 yamt void *bi_cookie;
64 1.1.18.2 yamt
65 1.1.18.2 yamt char bi_dev[16]; /* controller device */
66 1.1.18.2 yamt int bi_novol; /* nr of volumes */
67 1.1.18.2 yamt int bi_nodisk; /* nr of total disks */
68 1.1.18.2 yamt };
69 1.1.18.2 yamt
70 1.1.18.5 yamt #define BIOCDISK_NOVOL _IOWR('b', 38, struct bioc_disk)
71 1.1.18.5 yamt #define BIOCDISK _IOWR('B', 33, struct bioc_disk)
72 1.1.18.2 yamt /* structure that represents a disk in a RAID volume */
73 1.1.18.2 yamt struct bioc_disk {
74 1.1.18.2 yamt void *bd_cookie;
75 1.1.18.2 yamt
76 1.1.18.3 yamt uint16_t bd_channel;
77 1.1.18.3 yamt uint16_t bd_target;
78 1.1.18.3 yamt uint16_t bd_lun;
79 1.1.18.3 yamt uint16_t bd_other_id; /* unused for now */
80 1.1.18.2 yamt
81 1.1.18.2 yamt int bd_volid; /* associate with volume */
82 1.1.18.2 yamt int bd_diskid; /* virtual disk */
83 1.1.18.2 yamt int bd_status; /* current status */
84 1.1.18.2 yamt #define BIOC_SDONLINE 0x00
85 1.1.18.2 yamt #define BIOC_SDONLINE_S "Online"
86 1.1.18.2 yamt #define BIOC_SDOFFLINE 0x01
87 1.1.18.2 yamt #define BIOC_SDOFFLINE_S "Offline"
88 1.1.18.2 yamt #define BIOC_SDFAILED 0x02
89 1.1.18.2 yamt #define BIOC_SDFAILED_S "Failed"
90 1.1.18.2 yamt #define BIOC_SDREBUILD 0x03
91 1.1.18.2 yamt #define BIOC_SDREBUILD_S "Rebuild"
92 1.1.18.2 yamt #define BIOC_SDHOTSPARE 0x04
93 1.1.18.2 yamt #define BIOC_SDHOTSPARE_S "Hot spare"
94 1.1.18.2 yamt #define BIOC_SDUNUSED 0x05
95 1.1.18.2 yamt #define BIOC_SDUNUSED_S "Unused"
96 1.1.18.2 yamt #define BIOC_SDSCRUB 0x06
97 1.1.18.2 yamt #define BIOC_SDSCRUB_S "Scrubbing"
98 1.1.18.5 yamt #define BIOC_SDPASSTHRU 0x07
99 1.1.18.5 yamt #define BIOC_SDPASSTHRU_S "Pass through"
100 1.1.18.2 yamt #define BIOC_SDINVALID 0xff
101 1.1.18.2 yamt #define BIOC_SDINVALID_S "Invalid"
102 1.1.18.3 yamt uint64_t bd_size; /* size of the disk */
103 1.1.18.2 yamt
104 1.1.18.2 yamt char bd_vendor[32]; /* scsi string */
105 1.1.18.2 yamt char bd_serial[32]; /* serial number */
106 1.1.18.2 yamt char bd_procdev[16]; /* processor device */
107 1.1.18.5 yamt
108 1.1.18.5 yamt bool bd_disknovol; /* disk not associated with volumes */
109 1.1.18.5 yamt };
110 1.1.18.5 yamt
111 1.1.18.5 yamt /* COMPATIBILITY */
112 1.1.18.5 yamt #ifdef _KERNEL
113 1.1.18.5 yamt #define OBIOCDISK _IOWR('B', 33, struct obioc_disk)
114 1.1.18.5 yamt /* structure that represents a disk in a RAID volume (compat) */
115 1.1.18.5 yamt struct obioc_disk {
116 1.1.18.5 yamt void *bd_cookie;
117 1.1.18.5 yamt uint16_t bd_channel;
118 1.1.18.5 yamt uint16_t bd_target;
119 1.1.18.5 yamt uint16_t bd_lun;
120 1.1.18.5 yamt uint16_t bd_other_id;
121 1.1.18.5 yamt int bd_volid;
122 1.1.18.5 yamt int bd_diskid;
123 1.1.18.5 yamt int bd_status;
124 1.1.18.5 yamt uint64_t bd_size;
125 1.1.18.5 yamt char bd_vendor[32];
126 1.1.18.5 yamt char bd_serial[32];
127 1.1.18.5 yamt char bd_procdev[16];
128 1.1.18.2 yamt };
129 1.1.18.5 yamt #endif
130 1.1.18.2 yamt
131 1.1.18.2 yamt #define BIOCVOL _IOWR('B', 34, struct bioc_vol)
132 1.1.18.2 yamt /* structure that represents a RAID volume */
133 1.1.18.2 yamt struct bioc_vol {
134 1.1.18.2 yamt void *bv_cookie;
135 1.1.18.2 yamt int bv_volid; /* volume id */
136 1.1.18.2 yamt
137 1.1.18.2 yamt int16_t bv_percent; /* percent done operation */
138 1.1.18.3 yamt uint16_t bv_seconds; /* seconds of progress so far */
139 1.1.18.2 yamt
140 1.1.18.2 yamt int bv_status; /* current status */
141 1.1.18.2 yamt #define BIOC_SVONLINE 0x00
142 1.1.18.2 yamt #define BIOC_SVONLINE_S "Online"
143 1.1.18.2 yamt #define BIOC_SVOFFLINE 0x01
144 1.1.18.2 yamt #define BIOC_SVOFFLINE_S "Offline"
145 1.1.18.2 yamt #define BIOC_SVDEGRADED 0x02
146 1.1.18.2 yamt #define BIOC_SVDEGRADED_S "Degraded"
147 1.1.18.2 yamt #define BIOC_SVBUILDING 0x03
148 1.1.18.2 yamt #define BIOC_SVBUILDING_S "Building"
149 1.1.18.2 yamt #define BIOC_SVSCRUB 0x04
150 1.1.18.2 yamt #define BIOC_SVSCRUB_S "Scrubbing"
151 1.1.18.2 yamt #define BIOC_SVREBUILD 0x05
152 1.1.18.2 yamt #define BIOC_SVREBUILD_S "Rebuild"
153 1.1.18.4 yamt #define BIOC_SVMIGRATING 0x06
154 1.1.18.4 yamt #define BIOC_SVMIGRATING_S "Migrating"
155 1.1.18.5 yamt #define BIOC_SVCHECKING 0x07
156 1.1.18.5 yamt #define BIOC_SVCHECKING_S "Checking"
157 1.1.18.2 yamt #define BIOC_SVINVALID 0xff
158 1.1.18.2 yamt #define BIOC_SVINVALID_S "Invalid"
159 1.1.18.3 yamt uint64_t bv_size; /* size of the disk */
160 1.1.18.2 yamt int bv_level; /* raid level */
161 1.1.18.6 yamt #define BIOC_SVOL_RAID01 0x0e
162 1.1.18.6 yamt #define BIOC_SVOL_RAID10 0x1e
163 1.1.18.5 yamt #define BIOC_SVOL_UNUSED 0xaa
164 1.1.18.5 yamt #define BIOC_SVOL_HOTSPARE 0xbb
165 1.1.18.5 yamt #define BIOC_SVOL_PASSTHRU 0xcc
166 1.1.18.5 yamt
167 1.1.18.2 yamt int bv_nodisk; /* nr of drives */
168 1.1.18.2 yamt
169 1.1.18.2 yamt char bv_dev[16]; /* device */
170 1.1.18.2 yamt char bv_vendor[32]; /* scsi string */
171 1.1.18.5 yamt
172 1.1.18.5 yamt uint16_t bv_stripe_size; /* stripe size */
173 1.1.18.5 yamt };
174 1.1.18.5 yamt
175 1.1.18.5 yamt /* COMPATIBILITY */
176 1.1.18.5 yamt #ifdef _KERNEL
177 1.1.18.5 yamt #define OBIOCVOL _IOWR('B', 34, struct obioc_vol)
178 1.1.18.5 yamt /* structure that represents a RAID volume */
179 1.1.18.5 yamt struct obioc_vol {
180 1.1.18.5 yamt void *bv_cookie;
181 1.1.18.5 yamt int bv_volid;
182 1.1.18.5 yamt int16_t bv_percent;
183 1.1.18.5 yamt uint16_t bv_seconds;
184 1.1.18.5 yamt int bv_status;
185 1.1.18.5 yamt uint64_t bv_size;
186 1.1.18.5 yamt int bv_level;
187 1.1.18.5 yamt int bv_nodisk;
188 1.1.18.5 yamt char bv_dev[16];
189 1.1.18.5 yamt char bv_vendor[32];
190 1.1.18.2 yamt };
191 1.1.18.5 yamt #endif
192 1.1.18.2 yamt
193 1.1.18.2 yamt #define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
194 1.1.18.2 yamt struct bioc_alarm {
195 1.1.18.2 yamt void *ba_cookie;
196 1.1.18.2 yamt int ba_opcode;
197 1.1.18.2 yamt
198 1.1.18.2 yamt int ba_status; /* only used with get state */
199 1.1.18.2 yamt #define BIOC_SADISABLE 0x00 /* disable alarm */
200 1.1.18.2 yamt #define BIOC_SAENABLE 0x01 /* enable alarm */
201 1.1.18.2 yamt #define BIOC_SASILENCE 0x02 /* silence alarm */
202 1.1.18.2 yamt #define BIOC_GASTATUS 0x03 /* get status */
203 1.1.18.2 yamt #define BIOC_SATEST 0x04 /* test alarm */
204 1.1.18.2 yamt };
205 1.1.18.2 yamt
206 1.1.18.2 yamt #define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
207 1.1.18.2 yamt struct bioc_blink {
208 1.1.18.2 yamt void *bb_cookie;
209 1.1.18.3 yamt uint16_t bb_channel;
210 1.1.18.3 yamt uint16_t bb_target;
211 1.1.18.2 yamt
212 1.1.18.2 yamt int bb_status; /* current status */
213 1.1.18.2 yamt #define BIOC_SBUNBLINK 0x00 /* disable blinking */
214 1.1.18.2 yamt #define BIOC_SBBLINK 0x01 /* enable blink */
215 1.1.18.2 yamt #define BIOC_SBALARM 0x02 /* enable alarm blink */
216 1.1.18.2 yamt };
217 1.1.18.2 yamt
218 1.1.18.2 yamt #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
219 1.1.18.2 yamt struct bioc_setstate {
220 1.1.18.2 yamt void *bs_cookie;
221 1.1.18.3 yamt uint16_t bs_channel;
222 1.1.18.3 yamt uint16_t bs_target;
223 1.1.18.3 yamt uint16_t bs_lun;
224 1.1.18.3 yamt uint16_t bs_other_id; /* unused for now */
225 1.1.18.2 yamt
226 1.1.18.2 yamt int bs_status; /* change to this status */
227 1.1.18.2 yamt #define BIOC_SSONLINE 0x00 /* online disk */
228 1.1.18.2 yamt #define BIOC_SSOFFLINE 0x01 /* offline disk */
229 1.1.18.2 yamt #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */
230 1.1.18.2 yamt #define BIOC_SSREBUILD 0x03 /* rebuild on this disk */
231 1.1.18.5 yamt #define BIOC_SSDELHOTSPARE 0x04 /* unmark as hotspare */
232 1.1.18.5 yamt #define BIOC_SSPASSTHRU 0x05 /* mark as pass-through */
233 1.1.18.5 yamt #define BIOC_SSDELPASSTHRU 0x06 /* unmark as pass-through */
234 1.1.18.5 yamt #define BIOC_SSCHECKSTART_VOL 0x07 /* start consistency check in vol# */
235 1.1.18.5 yamt #define BIOC_SSCHECKSTOP_VOL 0x08 /* stop consistency check in vol# */
236 1.1.18.2 yamt int bs_volid; /* volume id for rebuild */
237 1.1.18.2 yamt };
238 1.1.18.2 yamt
239 1.1.18.5 yamt #define BIOCVOLOPS _IOWR('B', 39, struct bioc_volops)
240 1.1.18.5 yamt struct bioc_volops {
241 1.1.18.2 yamt void *bc_cookie;
242 1.1.18.5 yamt uint64_t bc_size; /* size of the volume set */
243 1.1.18.5 yamt uint64_t bc_other_id; /* unused for now */
244 1.1.18.5 yamt uint32_t bc_devmask; /* device mask for the volume set */
245 1.1.18.5 yamt
246 1.1.18.5 yamt uint16_t bc_channel;
247 1.1.18.5 yamt uint16_t bc_target;
248 1.1.18.5 yamt uint16_t bc_lun;
249 1.1.18.5 yamt uint16_t bc_stripe; /* stripe size */
250 1.1.18.5 yamt uint16_t bc_level; /* RAID level requested */
251 1.1.18.5 yamt
252 1.1.18.5 yamt int bc_opcode;
253 1.1.18.5 yamt #define BIOC_VCREATE_VOLUME 0x00 /* create new volume */
254 1.1.18.5 yamt #define BIOC_VREMOVE_VOLUME 0x01 /* remove volume */
255 1.1.18.5 yamt int bc_volid; /* volume id to be created/removed */
256 1.1.18.5 yamt };
257 1.1.18.2 yamt
258 1.1.18.5 yamt #endif /* ! _DEV_BIOVAR_H_ */
259