1 /* $NetBSD: biovar.h,v 1.7 2008/03/03 13:43:19 xtraeme Exp $ */
2 /* $OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $ */
5 * Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
6 * Copyright (c) 2005 Marco Peereboom. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Devices getting ioctls through this interface should use ioctl class 'B'
31 * and command numbers starting from 32, lower ones are reserved for generic
32 * ioctls. All ioctl data must be structures which start with a void *
36 #ifndef _DEV_BIOVAR_H_
37 #define _DEV_BIOVAR_H_
39 #include <sys/types.h>
40 #include <sys/device.h>
50 /* convert name to a cookie */
51 #define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
58 int bio_register(device_t
, int (*)(device_t
, u_long
, void *));
59 void bio_unregister(device_t
);
62 #define BIOCINQ _IOWR('B', 32, struct bioc_inq)
66 char bi_dev
[16]; /* controller device */
67 int bi_novol
; /* nr of volumes */
68 int bi_nodisk
; /* nr of total disks */
71 #define BIOCDISK_NOVOL _IOWR('b', 38, struct bioc_disk)
72 #define BIOCDISK _IOWR('B', 33, struct bioc_disk)
73 /* structure that represents a disk in a RAID volume */
80 uint16_t bd_other_id
; /* unused for now */
82 int bd_volid
; /* associate with volume */
83 int bd_diskid
; /* virtual disk */
84 int bd_status
; /* current status */
85 #define BIOC_SDONLINE 0x00
86 #define BIOC_SDONLINE_S "Online"
87 #define BIOC_SDOFFLINE 0x01
88 #define BIOC_SDOFFLINE_S "Offline"
89 #define BIOC_SDFAILED 0x02
90 #define BIOC_SDFAILED_S "Failed"
91 #define BIOC_SDREBUILD 0x03
92 #define BIOC_SDREBUILD_S "Rebuild"
93 #define BIOC_SDHOTSPARE 0x04
94 #define BIOC_SDHOTSPARE_S "Hot spare"
95 #define BIOC_SDUNUSED 0x05
96 #define BIOC_SDUNUSED_S "Unused"
97 #define BIOC_SDSCRUB 0x06
98 #define BIOC_SDSCRUB_S "Scrubbing"
99 #define BIOC_SDPASSTHRU 0x07
100 #define BIOC_SDPASSTHRU_S "Pass through"
101 #define BIOC_SDINVALID 0xff
102 #define BIOC_SDINVALID_S "Invalid"
103 uint64_t bd_size
; /* size of the disk */
105 char bd_vendor
[32]; /* scsi string */
106 char bd_serial
[32]; /* serial number */
107 char bd_procdev
[16]; /* processor device */
109 bool bd_disknovol
; /* disk not associated with volumes */
114 #define OBIOCDISK _IOWR('B', 33, struct obioc_disk)
115 /* structure that represents a disk in a RAID volume (compat) */
121 uint16_t bd_other_id
;
132 #define BIOCVOL _IOWR('B', 34, struct bioc_vol)
133 /* structure that represents a RAID volume */
136 int bv_volid
; /* volume id */
138 int16_t bv_percent
; /* percent done operation */
139 uint16_t bv_seconds
; /* seconds of progress so far */
141 int bv_status
; /* current status */
142 #define BIOC_SVONLINE 0x00
143 #define BIOC_SVONLINE_S "Online"
144 #define BIOC_SVOFFLINE 0x01
145 #define BIOC_SVOFFLINE_S "Offline"
146 #define BIOC_SVDEGRADED 0x02
147 #define BIOC_SVDEGRADED_S "Degraded"
148 #define BIOC_SVBUILDING 0x03
149 #define BIOC_SVBUILDING_S "Building"
150 #define BIOC_SVSCRUB 0x04
151 #define BIOC_SVSCRUB_S "Scrubbing"
152 #define BIOC_SVREBUILD 0x05
153 #define BIOC_SVREBUILD_S "Rebuild"
154 #define BIOC_SVMIGRATING 0x06
155 #define BIOC_SVMIGRATING_S "Migrating"
156 #define BIOC_SVCHECKING 0x07
157 #define BIOC_SVCHECKING_S "Checking"
158 #define BIOC_SVINVALID 0xff
159 #define BIOC_SVINVALID_S "Invalid"
160 uint64_t bv_size
; /* size of the disk */
161 int bv_level
; /* raid level */
162 #define BIOC_SVOL_RAID01 0x0e
163 #define BIOC_SVOL_RAID10 0x1e
164 #define BIOC_SVOL_UNUSED 0xaa
165 #define BIOC_SVOL_HOTSPARE 0xbb
166 #define BIOC_SVOL_PASSTHRU 0xcc
168 int bv_nodisk
; /* nr of drives */
170 char bv_dev
[16]; /* device */
171 char bv_vendor
[32]; /* scsi string */
173 uint16_t bv_stripe_size
; /* stripe size */
178 #define OBIOCVOL _IOWR('B', 34, struct obioc_vol)
179 /* structure that represents a RAID volume */
194 #define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
199 int ba_status
; /* only used with get state */
200 #define BIOC_SADISABLE 0x00 /* disable alarm */
201 #define BIOC_SAENABLE 0x01 /* enable alarm */
202 #define BIOC_SASILENCE 0x02 /* silence alarm */
203 #define BIOC_GASTATUS 0x03 /* get status */
204 #define BIOC_SATEST 0x04 /* test alarm */
207 #define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
213 int bb_status
; /* current status */
214 #define BIOC_SBUNBLINK 0x00 /* disable blinking */
215 #define BIOC_SBBLINK 0x01 /* enable blink */
216 #define BIOC_SBALARM 0x02 /* enable alarm blink */
219 #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
220 struct bioc_setstate
{
225 uint16_t bs_other_id
; /* unused for now */
227 int bs_status
; /* change to this status */
228 #define BIOC_SSONLINE 0x00 /* online disk */
229 #define BIOC_SSOFFLINE 0x01 /* offline disk */
230 #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */
231 #define BIOC_SSREBUILD 0x03 /* rebuild on this disk */
232 #define BIOC_SSDELHOTSPARE 0x04 /* unmark as hotspare */
233 #define BIOC_SSPASSTHRU 0x05 /* mark as pass-through */
234 #define BIOC_SSDELPASSTHRU 0x06 /* unmark as pass-through */
235 #define BIOC_SSCHECKSTART_VOL 0x07 /* start consistency check in vol# */
236 #define BIOC_SSCHECKSTOP_VOL 0x08 /* stop consistency check in vol# */
237 int bs_volid
; /* volume id for rebuild */
240 #define BIOCVOLOPS _IOWR('B', 39, struct bioc_volops)
243 uint64_t bc_size
; /* size of the volume set */
244 uint64_t bc_other_id
; /* unused for now */
245 uint32_t bc_devmask
; /* device mask for the volume set */
250 uint16_t bc_stripe
; /* stripe size */
251 uint16_t bc_level
; /* RAID level requested */
254 #define BIOC_VCREATE_VOLUME 0x00 /* create new volume */
255 #define BIOC_VREMOVE_VOLUME 0x01 /* remove volume */
256 int bc_volid
; /* volume id to be created/removed */
259 #endif /* ! _DEV_BIOVAR_H_ */