1 /* $NetBSD: ata_raidreg.h,v 1.7 2008/09/05 12:37:13 tron Exp $ */
4 * Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer,
12 * without modification, immediately at the beginning of the file.
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.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef _DEV_PCI_PCIIDE_PROMISE_RAID_H_
32 #define _DEV_PCI_PCIIDE_PROMISE_RAID_H_
35 * Macro to compute the LBA of the Promise RAID configuration structure,
36 * using the disk's softc structure.
39 ((((wd)->sc_capacity / \
40 ((wd)->sc_params.atap_heads * (wd)->sc_params.atap_sectors)) * \
41 (wd)->sc_params.atap_heads * (wd)->sc_params.atap_sectors) - \
42 (wd)->sc_params.atap_sectors)
44 struct promise_raid_conf
{
46 #define PR_MAGIC "Promise Technology, Inc."
56 #define PR_I_VALID 0x00000080
59 #define PR_F_VALID 0x01
60 #define PR_F_ONLINE 0x02
61 #define PR_F_ASSIGNED 0x04
62 #define PR_F_SPARE 0x08
63 #define PR_F_DUPLICATE 0x10
64 #define PR_F_REDIR 0x20
65 #define PR_F_DOWN 0x40
66 #define PR_F_READY 0x80
71 uint64_t magic_0 __packed
;
72 uint32_t disk_offset
; /* 0x210 */
73 uint32_t disk_sectors
;
77 #define PR_S_VALID 0x01
78 #define PR_S_ONLINE 0x02
79 #define PR_S_INITED 0x04
80 #define PR_S_READY 0x08
81 #define PR_S_DEGRADED 0x10
82 #define PR_S_MARKED 0x20
83 #define PR_S_FUNCTIONAL 0x80
86 #define PR_T_RAID0 0x00
87 #define PR_T_RAID1 0x01
88 #define PR_T_RAID3 0x02
89 #define PR_T_RAID5 0x04
90 #define PR_T_SPAN 0x08
92 uint8_t total_disks
; /* 0x220 */
96 uint32_t total_sectors
;
100 uint64_t magic_1 __packed
;
106 uint64_t magic_0 __packed
;
109 uint32_t filler2
[346];
114 * Macro to compute the LBA of the Adaptec HostRAID configuration structure,
115 * using the disk's softc structure.
117 #define ADP_LBA(wd) \
118 ((wd)->sc_capacity - 17)
120 struct adaptec_raid_conf
{
122 #define ADP_MAGIC_0 0x900765c4
126 uint16_t total_configs
;
136 uint16_t total_disks
;
141 #define ADP_T_RAID0 0x00
142 #define ADP_T_RAID1 0x01
151 uint32_t disk_number
;
154 uint16_t stripe_sectors
;
160 uint32_t dummy_6
[13];
162 #define ADP_MAGIC_1 0x0950f89f
165 uint32_t dummy_8
[46];
167 #define ADP_MAGIC_3 0x4450544d
169 #define ADP_MAGIC_4 0x0950f89f
170 uint32_t dummy_9
[62];
173 /* VIA Tech V-RAID Metadata */
174 /* Derrived from FreeBSD ata-raid.h 1.46 */
175 #define VIA_LBA(wd) ((wd)->sc_capacity - 1)
177 struct via_raid_conf
{
179 #define VIA_MAGIC 0xaa55
182 #define VIA_T_MASK 0x7e
183 #define VIA_T_BOOTABLE 0x01
184 #define VIA_T_RAID0 0x04
185 #define VIA_T_RAID1 0x0c
186 #define VIA_T_RAID01 0x4c
187 #define VIA_T_RAID5 0x2c
188 #define VIA_T_SPAN 0x44
189 #define VIA_T_UNKNOWN 0x80
191 #define VIA_D_MASK 0x0f
192 #define VIA_D_DEGRADED 0x10
193 #define VIA_D_HIGH_IDX 0x20
194 uint8_t stripe_layout
;
195 #define VIA_L_DISKS 0x07
196 #define VIA_L_MASK 0xf0
197 #define VIA_L_SHIFT 4
198 uint64_t disk_sectors
;
205 /* nVidia MediaShield Metadata */
206 /* taken from FreeBSD ata-raid.h 1.47 */
207 #define NVIDIA_LBA(wd) ((wd)->sc_capacity - 2)
209 struct nvidia_raid_conf
{
210 u_int8_t nvidia_id
[8];
211 #define NV_MAGIC "NVIDIA "
213 u_int32_t config_size
;
216 u_int8_t disk_number
;
218 u_int32_t total_sectors
;
219 u_int32_t sector_size
;
221 u_int8_t revision
[4];
225 #define NV_MAGIC0 0x00640044
230 u_int8_t array_width
;
231 u_int8_t total_disks
;
234 #define NV_T_RAID0 0x00000080
235 #define NV_T_RAID1 0x00000081
236 #define NV_T_RAID3 0x00000083
237 #define NV_T_RAID5 0x00000085
238 #define NV_T_RAID01 0x00008180
239 #define NV_T_SPAN 0x000000ff
242 u_int32_t stripe_sectors
;
243 u_int32_t stripe_bytes
;
244 u_int32_t stripe_shift
;
245 u_int32_t stripe_mask
;
246 u_int32_t stripe_sizesectors
;
247 u_int32_t stripe_sizebytes
;
248 u_int32_t rebuild_lba
;
252 #define NV_S_BOOTABLE 0x00000001
253 #define NV_S_DEGRADED 0x00000002
255 u_int32_t filler
[98];
258 /* JMicron Technology Corp Metadata */
259 #define JMICRON_LBA(wd) ((wd)->sc_capacity - 1)
260 #define JM_MAX_DISKS 8
262 struct jmicron_raid_conf
{
263 uint8_t signature
[2];
264 #define JMICRON_MAGIC "JM"
266 #define JMICRON_VERSION 0x0001
268 uint8_t filler_1
[10];
271 uint32_t disk_sectors_high
;
272 uint16_t disk_sectors_low
;
278 #define JM_T_RAID01 2
281 uint8_t stripe_shift
;
283 #define JM_F_READY 0x0001
284 #define JM_F_BOOTABLE 0x0002
285 #define JM_F_BAD 0x0004
286 #define JM_F_ACTIVE 0x0010
287 #define JM_F_UNSYNC 0x0020
288 #define JM_F_NEWEST 0x0040
291 uint32_t disks
[JM_MAX_DISKS
];
292 uint8_t filler_4
[32];
293 uint8_t filler_5
[384];
296 /* Intel MatrixRAID metadata */
297 #define INTEL_LBA(wd) ((wd)->sc_capacity - 3)
299 struct intel_raid_conf
{
300 uint8_t intel_id
[24];
301 #define INTEL_MAGIC "Intel Raid ISM Cfg Sig. "
304 #define INTEL_VERSION_1100 "1.1.00"
305 #define INTEL_VERSION_1201 "1.2.01"
306 #define INTEL_VERSION_1202 "1.2.02"
310 uint32_t config_size
;
315 uint8_t total_volumes
;
317 uint32_t filler_0
[39];
323 #define INTEL_F_SPARE 0x01
324 #define INTEL_F_ASSIGNED 0x02
325 #define INTEL_F_DOWN 0x04
326 #define INTEL_F_ONLINE 0x08
329 uint32_t filler_1
[62];
332 struct intel_raid_mapping
{
334 uint64_t total_sectors __packed
;
337 uint32_t filler_0
[20];
339 uint32_t disk_sectors
;
340 uint32_t stripe_count
;
341 uint16_t stripe_sectors
;
343 #define INTEL_S_READY 0x00
344 #define INTEL_S_DISABLED 0x01
345 #define INTEL_S_DEGRADED 0x02
346 #define INTEL_S_FAILURE 0x03
349 #define INTEL_T_RAID0 0x00
350 #define INTEL_T_RAID1 0x01
351 #define INTEL_T_RAID5 0x05
355 uint32_t filler_1
[7];
356 uint32_t disk_idx
[1];
359 #endif /* _DEV_PCI_PCIIDE_PROMISE_RAID_H_ */