FreeBSD/Linux Kernel Cross Reference
sys/dev/ata/ata-raid.h
1 /*-
2 * Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: releng/8.4/sys/dev/ata/ata-raid.h 188840 2009-02-20 06:10:12Z scottl $
27 */
28
29 /* misc defines */
30 #define MAX_ARRAYS 16
31 #define MAX_VOLUMES 4
32 #define MAX_DISKS 16
33 #define AR_PROXIMITY 2048 /* how many sectors is "close" */
34
35 #define ATA_MAGIC "FreeBSD ATA driver RAID "
36
37 struct ata_raid_subdisk {
38 struct ar_softc *raid[MAX_VOLUMES];
39 int disk_number[MAX_VOLUMES];
40 };
41
42 /* ATA PseudoRAID Metadata */
43 struct ar_softc {
44 int lun;
45 u_int8_t name[32];
46 int volume;
47 u_int64_t magic_0;
48 u_int64_t magic_1;
49 int type;
50 #define AR_T_JBOD 0x0001
51 #define AR_T_SPAN 0x0002
52 #define AR_T_RAID0 0x0004
53 #define AR_T_RAID1 0x0008
54 #define AR_T_RAID01 0x0010
55 #define AR_T_RAID3 0x0020
56 #define AR_T_RAID4 0x0040
57 #define AR_T_RAID5 0x0080
58
59 int status;
60 #define AR_S_READY 0x0001
61 #define AR_S_DEGRADED 0x0002
62 #define AR_S_REBUILDING 0x0004
63
64 int format;
65 #define AR_F_FREEBSD_RAID 0x0001
66 #define AR_F_ADAPTEC_RAID 0x0002
67 #define AR_F_HPTV2_RAID 0x0004
68 #define AR_F_HPTV3_RAID 0x0008
69 #define AR_F_INTEL_RAID 0x0010
70 #define AR_F_ITE_RAID 0x0020
71 #define AR_F_JMICRON_RAID 0x0040
72 #define AR_F_LSIV2_RAID 0x0080
73 #define AR_F_LSIV3_RAID 0x0100
74 #define AR_F_NVIDIA_RAID 0x0200
75 #define AR_F_PROMISE_RAID 0x0400
76 #define AR_F_SII_RAID 0x0800
77 #define AR_F_SIS_RAID 0x1000
78 #define AR_F_VIA_RAID 0x2000
79 #define AR_F_DDF_RAID 0x4000
80 #define AR_F_FORMAT_MASK 0x7fff
81
82 u_int generation;
83 u_int64_t total_sectors;
84 u_int64_t offset_sectors; /* offset from start of disk */
85 u_int16_t heads;
86 u_int16_t sectors;
87 u_int32_t cylinders;
88 u_int width; /* array width in disks */
89 u_int interleave; /* interleave in sectors */
90 u_int total_disks; /* number of disks in this array */
91 struct ar_disk {
92 device_t dev;
93 u_int8_t serial[16]; /* serial # of physical disk */
94 u_int64_t sectors; /* useable sectors on this disk */
95 off_t last_lba; /* last lba used (for performance) */
96 u_int flags;
97 #define AR_DF_PRESENT 0x0001 /* this HW pos has a disk present */
98 #define AR_DF_ASSIGNED 0x0002 /* this HW pos assigned to an array */
99 #define AR_DF_SPARE 0x0004 /* this HW pos is a spare */
100 #define AR_DF_ONLINE 0x0008 /* this HW pos is online and in use */
101
102 } disks[MAX_DISKS];
103 int toggle; /* performance hack for RAID1's */
104 u_int64_t rebuild_lba; /* rebuild progress indicator */
105 struct mtx lock; /* metadata lock */
106 struct disk *disk; /* disklabel/slice stuff */
107 struct proc *pid; /* rebuilder process id */
108 };
109
110 /* Adaptec HostRAID Metadata */
111 #define ADP_LBA(dev) \
112 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 17)
113
114 /* note all entries are big endian */
115 struct adaptec_raid_conf {
116 u_int32_t magic_0;
117 #define ADP_MAGIC_0 0xc4650790
118
119 u_int32_t generation;
120 u_int16_t dummy_0;
121 u_int16_t total_configs;
122 u_int16_t dummy_1;
123 u_int16_t checksum;
124 u_int32_t dummy_2;
125 u_int32_t dummy_3;
126 u_int32_t flags;
127 u_int32_t timestamp;
128 u_int32_t dummy_4[4];
129 u_int32_t dummy_5[4];
130 struct {
131 u_int16_t total_disks;
132 u_int16_t generation;
133 u_int32_t magic_0;
134 u_int8_t dummy_0;
135 u_int8_t type;
136 #define ADP_T_RAID0 0x00
137 #define ADP_T_RAID1 0x01
138 u_int8_t dummy_1;
139 u_int8_t flags;
140
141 u_int8_t dummy_2;
142 u_int8_t dummy_3;
143 u_int8_t dummy_4;
144 u_int8_t dummy_5;
145
146 u_int32_t disk_number;
147 u_int32_t dummy_6;
148 u_int32_t sectors;
149 u_int16_t stripe_shift;
150 u_int16_t dummy_7;
151
152 u_int32_t dummy_8[4];
153 u_int8_t name[16];
154 } configs[127];
155 u_int32_t dummy_6[13];
156 u_int32_t magic_1;
157 #define ADP_MAGIC_1 0x9ff85009
158 u_int32_t dummy_7[3];
159 u_int32_t magic_2;
160 u_int32_t dummy_8[46];
161 u_int32_t magic_3;
162 #define ADP_MAGIC_3 0x4d545044
163 u_int32_t magic_4;
164 #define ADP_MAGIC_4 0x9ff85009
165 u_int32_t dummy_9[62];
166 } __packed;
167
168 /* DDF Information. Metadata definitions are in another file */
169 #define DDF_LBA(dev) \
170 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1)
171
172 /* Highpoint V2 RocketRAID Metadata */
173 #define HPTV2_LBA(dev) 9
174
175 struct hptv2_raid_conf {
176 int8_t filler1[32];
177 u_int32_t magic;
178 #define HPTV2_MAGIC_OK 0x5a7816f0
179 #define HPTV2_MAGIC_BAD 0x5a7816fd
180
181 u_int32_t magic_0;
182 u_int32_t magic_1;
183 u_int32_t order;
184 #define HPTV2_O_RAID0 0x01
185 #define HPTV2_O_RAID1 0x02
186 #define HPTV2_O_OK 0x04
187
188 u_int8_t array_width;
189 u_int8_t stripe_shift;
190 u_int8_t type;
191 #define HPTV2_T_RAID0 0x00
192 #define HPTV2_T_RAID1 0x01
193 #define HPTV2_T_RAID01_RAID0 0x02
194 #define HPTV2_T_SPAN 0x03
195 #define HPTV2_T_RAID_3 0x04
196 #define HPTV2_T_RAID_5 0x05
197 #define HPTV2_T_JBOD 0x06
198 #define HPTV2_T_RAID01_RAID1 0x07
199
200 u_int8_t disk_number;
201 u_int32_t total_sectors;
202 u_int32_t disk_mode;
203 u_int32_t boot_mode;
204 u_int8_t boot_disk;
205 u_int8_t boot_protect;
206 u_int8_t error_log_entries;
207 u_int8_t error_log_index;
208 struct {
209 u_int32_t timestamp;
210 u_int8_t reason;
211 #define HPTV2_R_REMOVED 0xfe
212 #define HPTV2_R_BROKEN 0xff
213
214 u_int8_t disk;
215 u_int8_t status;
216 u_int8_t sectors;
217 u_int32_t lba;
218 } errorlog[32];
219 int8_t filler2[16];
220 u_int32_t rebuild_lba;
221 u_int8_t dummy_1;
222 u_int8_t name_1[15];
223 u_int8_t dummy_2;
224 u_int8_t name_2[15];
225 int8_t filler3[8];
226 } __packed;
227
228
229 /* Highpoint V3 RocketRAID Metadata */
230 #define HPTV3_LBA(dev) \
231 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 11)
232
233 struct hptv3_raid_conf {
234 u_int32_t magic;
235 #define HPTV3_MAGIC 0x5a7816f3
236
237 u_int32_t magic_0;
238 u_int8_t checksum_0;
239 u_int8_t mode;
240 #define HPTV3_BOOT_MARK 0x01
241 #define HPTV3_USER_MODE 0x02
242
243 u_int8_t user_mode;
244 u_int8_t config_entries;
245 struct {
246 u_int32_t total_sectors;
247 u_int8_t type;
248 #define HPTV3_T_SPARE 0x00
249 #define HPTV3_T_JBOD 0x03
250 #define HPTV3_T_SPAN 0x04
251 #define HPTV3_T_RAID0 0x05
252 #define HPTV3_T_RAID1 0x06
253 #define HPTV3_T_RAID3 0x07
254 #define HPTV3_T_RAID5 0x08
255
256 u_int8_t total_disks;
257 u_int8_t disk_number;
258 u_int8_t stripe_shift;
259 u_int16_t status;
260 #define HPTV3_T_NEED_REBUILD 0x01
261 #define HPTV3_T_RAID5_FLAG 0x02
262
263 u_int16_t critical_disks;
264 u_int32_t rebuild_lba;
265 } __packed configs[2];
266 u_int8_t name[16];
267 u_int32_t timestamp;
268 u_int8_t description[64];
269 u_int8_t creator[16];
270 u_int8_t checksum_1;
271 u_int8_t dummy_0;
272 u_int8_t dummy_1;
273 u_int8_t flags;
274 #define HPTV3_T_ENABLE_TCQ 0x01
275 #define HPTV3_T_ENABLE_NCQ 0x02
276 #define HPTV3_T_ENABLE_WCACHE 0x04
277 #define HPTV3_T_ENABLE_RCACHE 0x08
278
279 struct {
280 u_int32_t total_sectors;
281 u_int32_t rebuild_lba;
282 } __packed configs_high[2];
283 u_int32_t filler[87];
284 } __packed;
285
286
287 /* Intel MatrixRAID Metadata */
288 #define INTEL_LBA(dev) \
289 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 3)
290
291 struct intel_raid_conf {
292 u_int8_t intel_id[24];
293 #define INTEL_MAGIC "Intel Raid ISM Cfg Sig. "
294
295 u_int8_t version[6];
296 #define INTEL_VERSION_1100 "1.1.00"
297 #define INTEL_VERSION_1201 "1.2.01"
298 #define INTEL_VERSION_1202 "1.2.02"
299
300 u_int8_t dummy_0[2];
301 u_int32_t checksum;
302 u_int32_t config_size;
303 u_int32_t config_id;
304 u_int32_t generation;
305 u_int32_t dummy_1[2];
306 u_int8_t total_disks;
307 u_int8_t total_volumes;
308 u_int8_t dummy_2[2];
309 u_int32_t filler_0[39];
310 struct {
311 u_int8_t serial[16];
312 u_int32_t sectors;
313 u_int32_t id;
314 u_int32_t flags;
315 #define INTEL_F_SPARE 0x01
316 #define INTEL_F_ASSIGNED 0x02
317 #define INTEL_F_DOWN 0x04
318 #define INTEL_F_ONLINE 0x08
319
320 u_int32_t filler[5];
321 } __packed disk[1];
322 u_int32_t filler_1[62];
323 } __packed;
324
325 struct intel_raid_mapping {
326 u_int8_t name[16];
327 u_int64_t total_sectors __packed;
328 u_int32_t state;
329 u_int32_t reserved;
330 u_int32_t filler_0[20];
331 u_int32_t offset;
332 u_int32_t disk_sectors;
333 u_int32_t stripe_count;
334 u_int16_t stripe_sectors;
335 u_int8_t status;
336 #define INTEL_S_READY 0x00
337 #define INTEL_S_DISABLED 0x01
338 #define INTEL_S_DEGRADED 0x02
339 #define INTEL_S_FAILURE 0x03
340
341 u_int8_t type;
342 #define INTEL_T_RAID0 0x00
343 #define INTEL_T_RAID1 0x01
344 #define INTEL_T_RAID5 0x05
345
346 u_int8_t total_disks;
347 u_int8_t magic[3];
348 u_int32_t filler_1[7];
349 u_int32_t disk_idx[1];
350 } __packed;
351
352
353 /* Integrated Technology Express Metadata */
354 #define ITE_LBA(dev) \
355 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 2)
356
357 struct ite_raid_conf {
358 u_int32_t filler_1[5];
359 u_int8_t timestamp_0[8];
360 u_int32_t dummy_1;
361 u_int32_t filler_2[5];
362 u_int16_t filler_3;
363 u_int8_t ite_id[40];
364 #define ITE_MAGIC "Integrated Technology Express Inc "
365
366 u_int16_t filler_4;
367 u_int32_t filler_5[6];
368 u_int32_t dummy_2;
369 u_int32_t dummy_3;
370 u_int32_t filler_6[12];
371 u_int32_t dummy_4;
372 u_int32_t filler_7[5];
373 u_int64_t total_sectors __packed;
374 u_int32_t filler_8[12];
375
376 u_int16_t filler_9;
377 u_int8_t type;
378 #define ITE_T_RAID0 0x00
379 #define ITE_T_RAID1 0x01
380 #define ITE_T_RAID01 0x02
381 #define ITE_T_SPAN 0x03
382
383 u_int8_t filler_10;
384 u_int32_t dummy_5[8];
385 u_int8_t stripe_1kblocks;
386 u_int8_t filler_11[3];
387 u_int32_t filler_12[54];
388
389 u_int32_t dummy_6[4];
390 u_int8_t timestamp_1[8];
391 u_int32_t filler_13[9];
392 u_int8_t stripe_sectors;
393 u_int8_t filler_14[3];
394 u_int8_t array_width;
395 u_int8_t filler_15[3];
396 u_int32_t filler_16;
397 u_int8_t filler_17;
398 u_int8_t disk_number;
399 u_int32_t disk_sectors;
400 u_int16_t filler_18;
401 u_int32_t dummy_7[4];
402 u_int32_t filler_20[104];
403 } __packed;
404
405
406 /* JMicron Technology Corp Metadata */
407 #define JMICRON_LBA(dev) \
408 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1)
409 #define JM_MAX_DISKS 8
410
411 struct jmicron_raid_conf {
412 u_int8_t signature[2];
413 #define JMICRON_MAGIC "JM"
414
415 u_int16_t version;
416 #define JMICRON_VERSION 0x0001
417
418 u_int16_t checksum;
419 u_int8_t filler_1[10];
420 u_int32_t disk_id;
421 u_int32_t offset;
422 u_int32_t disk_sectors_high;
423 u_int16_t disk_sectors_low;
424 u_int8_t filler_2[2];
425 u_int8_t name[16];
426 u_int8_t type;
427 #define JM_T_RAID0 0
428 #define JM_T_RAID1 1
429 #define JM_T_RAID01 2
430 #define JM_T_JBOD 3
431 #define JM_T_RAID5 5
432
433 u_int8_t stripe_shift;
434 u_int16_t flags;
435 #define JM_F_READY 0x0001
436 #define JM_F_BOOTABLE 0x0002
437 #define JM_F_BAD 0x0004
438 #define JM_F_ACTIVE 0c0010
439 #define JM_F_UNSYNC 0c0020
440 #define JM_F_NEWEST 0c0040
441
442 u_int8_t filler_3[4];
443 u_int32_t spare[2];
444 u_int32_t disks[JM_MAX_DISKS];
445 u_int8_t filler_4[32];
446 u_int8_t filler_5[384];
447 };
448
449
450 /* LSILogic V2 MegaRAID Metadata */
451 #define LSIV2_LBA(dev) \
452 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 1)
453
454 struct lsiv2_raid_conf {
455 u_int8_t lsi_id[6];
456 #define LSIV2_MAGIC "$XIDE$"
457
458 u_int8_t dummy_0;
459 u_int8_t flags;
460 u_int16_t version;
461 u_int8_t config_entries;
462 u_int8_t raid_count;
463 u_int8_t total_disks;
464 u_int8_t dummy_1;
465 u_int16_t dummy_2;
466
467 union {
468 struct {
469 u_int8_t type;
470 #define LSIV2_T_RAID0 0x01
471 #define LSIV2_T_RAID1 0x02
472 #define LSIV2_T_SPARE 0x08
473
474 u_int8_t dummy_0;
475 u_int16_t stripe_sectors;
476 u_int8_t array_width;
477 u_int8_t disk_count;
478 u_int8_t config_offset;
479 u_int8_t dummy_1;
480 u_int8_t flags;
481 #define LSIV2_R_DEGRADED 0x02
482
483 u_int32_t total_sectors;
484 u_int8_t filler[3];
485 } __packed raid;
486 struct {
487 u_int8_t device;
488 #define LSIV2_D_MASTER 0x00
489 #define LSIV2_D_SLAVE 0x01
490 #define LSIV2_D_CHANNEL0 0x00
491 #define LSIV2_D_CHANNEL1 0x10
492 #define LSIV2_D_NONE 0xff
493
494 u_int8_t dummy_0;
495 u_int32_t disk_sectors;
496 u_int8_t disk_number;
497 u_int8_t raid_number;
498 u_int8_t flags;
499 #define LSIV2_D_GONE 0x02
500
501 u_int8_t filler[7];
502 } __packed disk;
503 } configs[30];
504 u_int8_t disk_number;
505 u_int8_t raid_number;
506 u_int32_t timestamp;
507 u_int8_t filler[10];
508 } __packed;
509
510
511 /* LSILogic V3 MegaRAID Metadata */
512 #define LSIV3_LBA(dev) \
513 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 4)
514
515 struct lsiv3_raid_conf {
516 u_int32_t magic_0; /* 0xa0203200 */
517 u_int32_t filler_0[3];
518 u_int8_t magic_1[4]; /* "SATA" */
519 u_int32_t filler_1[40];
520 u_int32_t dummy_0; /* 0x0d000003 */
521 u_int32_t filler_2[7];
522 u_int32_t dummy_1; /* 0x0d000003 */
523 u_int32_t filler_3[70];
524 u_int8_t magic_2[8]; /* "$_ENQ$31" */
525 u_int8_t filler_4[7];
526 u_int8_t checksum_0;
527 u_int8_t filler_5[512*2];
528 u_int8_t lsi_id[6];
529 #define LSIV3_MAGIC "$_IDE$"
530
531 u_int16_t dummy_2; /* 0x33de for OK disk */
532 u_int16_t version; /* 0x0131 for this version */
533 u_int16_t dummy_3; /* 0x0440 always */
534 u_int32_t filler_6;
535
536 struct {
537 u_int16_t stripe_pages;
538 u_int8_t type;
539 #define LSIV3_T_RAID0 0x00
540 #define LSIV3_T_RAID1 0x01
541
542 u_int8_t dummy_0;
543 u_int8_t total_disks;
544 u_int8_t array_width;
545 u_int8_t filler_0[10];
546
547 u_int32_t sectors;
548 u_int16_t dummy_1;
549 u_int32_t offset;
550 u_int16_t dummy_2;
551 u_int8_t device;
552 #define LSIV3_D_DEVICE 0x01
553 #define LSIV3_D_CHANNEL 0x10
554
555 u_int8_t dummy_3;
556 u_int8_t dummy_4;
557 u_int8_t dummy_5;
558 u_int8_t filler_1[16];
559 } __packed raid[8];
560 struct {
561 u_int32_t disk_sectors;
562 u_int32_t dummy_0;
563 u_int32_t dummy_1;
564 u_int8_t dummy_2;
565 u_int8_t dummy_3;
566 u_int8_t flags;
567 #define LSIV3_D_MIRROR 0x00
568 #define LSIV3_D_STRIPE 0xff
569 u_int8_t dummy_4;
570 } __packed disk[6];
571 u_int8_t filler_7[7];
572 u_int8_t device;
573 u_int32_t timestamp;
574 u_int8_t filler_8[3];
575 u_int8_t checksum_1;
576 } __packed;
577
578
579 /* nVidia MediaShield Metadata */
580 #define NVIDIA_LBA(dev) \
581 (((struct ad_softc *)device_get_ivars(dev))->total_secs - 2)
582
583 struct nvidia_raid_conf {
584 u_int8_t nvidia_id[8];
585 #define NV_MAGIC "NVIDIA "
586
587 u_int32_t config_size;
588 u_int32_t checksum;
589 u_int16_t version;
590 u_int8_t disk_number;
591 u_int8_t dummy_0;
592 u_int32_t total_sectors;
593 u_int32_t sector_size;
594 u_int8_t serial[16];
595 u_int8_t revision[4];
596 u_int32_t dummy_1;
597
598 u_int32_t magic_0;
599 #define NV_MAGIC0 0x00640044
600
601 u_int64_t magic_1;
602 u_int64_t magic_2;
603 u_int8_t flags;
604 u_int8_t array_width;
605 u_int8_t total_disks;
606 u_int8_t dummy_2;
607 u_int16_t type;
608 #define NV_T_RAID0 0x00000080
609 #define NV_T_RAID1 0x00000081
610 #define NV_T_RAID3 0x00000083
611 #define NV_T_RAID5 0x00000085
612 #define NV_T_RAID01 0x00008180
613 #define NV_T_SPAN 0x000000ff
614
615 u_int16_t dummy_3;
616 u_int32_t stripe_sectors;
617 u_int32_t stripe_bytes;
618 u_int32_t stripe_shift;
619 u_int32_t stripe_mask;
620 u_int32_t stripe_sizesectors;
621 u_int32_t stripe_sizebytes;
622 u_int32_t rebuild_lba;
623 u_int32_t dummy_4;
624 u_int32_t dummy_5;
625 u_int32_t status;
626 #define NV_S_BOOTABLE 0x00000001
627 #define NV_S_DEGRADED 0x00000002
628
629 u_int32_t filler[98];
630 } __packed;
631
632
633 /* Promise FastTrak Metadata */
634 #define PROMISE_LBA(dev) \
635 (((((struct ad_softc *)device_get_ivars(dev))->total_secs / (((struct ad_softc *)device_get_ivars(dev))->heads * ((struct ad_softc *)device_get_ivars(dev))->sectors)) * ((struct ad_softc *)device_get_ivars(dev))->heads * ((struct ad_softc *)device_get_ivars(dev))->sectors) - ((struct ad_softc *)device_get_ivars(dev))->sectors)
636
637 struct promise_raid_conf {
638 char promise_id[24];
639 #define PR_MAGIC "Promise Technology, Inc."
640
641 u_int32_t dummy_0;
642 u_int64_t magic_0;
643 #define PR_MAGIC0(x) (((u_int64_t)(x.channel) << 48) | \
644 ((u_int64_t)(x.device != 0) << 56))
645 u_int16_t magic_1;
646 u_int32_t magic_2;
647 u_int8_t filler1[470];
648 struct {
649 u_int32_t integrity;
650 #define PR_I_VALID 0x00000080
651
652 u_int8_t flags;
653 #define PR_F_VALID 0x00000001
654 #define PR_F_ONLINE 0x00000002
655 #define PR_F_ASSIGNED 0x00000004
656 #define PR_F_SPARE 0x00000008
657 #define PR_F_DUPLICATE 0x00000010
658 #define PR_F_REDIR 0x00000020
659 #define PR_F_DOWN 0x00000040
660 #define PR_F_READY 0x00000080
661
662 u_int8_t disk_number;
663 u_int8_t channel;
664 u_int8_t device;
665 u_int64_t magic_0 __packed;
666 u_int32_t disk_offset;
667 u_int32_t disk_sectors;
668 u_int32_t rebuild_lba;
669 u_int16_t generation;
670 u_int8_t status;
671 #define PR_S_VALID 0x01
672 #define PR_S_ONLINE 0x02
673 #define PR_S_INITED 0x04
674 #define PR_S_READY 0x08
675 #define PR_S_DEGRADED 0x10
676 #define PR_S_MARKED 0x20
677 #define PR_S_FUNCTIONAL 0x80
678
679 u_int8_t type;
680 #define PR_T_RAID0 0x00
681 #define PR_T_RAID1 0x01
682 #define PR_T_RAID3 0x02
683 #define PR_T_RAID5 0x04
684 #define PR_T_SPAN 0x08
685 #define PR_T_JBOD 0x10
686
687 u_int8_t total_disks;
688 u_int8_t stripe_shift;
689 u_int8_t array_width;
690 u_int8_t array_number;
691 u_int32_t total_sectors;
692 u_int16_t cylinders;
693 u_int8_t heads;
694 u_int8_t sectors;
695 u_int64_t magic_1 __packed;
696 struct {
697 u_int8_t flags;
698 u_int8_t dummy_0;
699 u_int8_t channel;
700 u_int8_t device;
701 u_int64_t magic_0 __packed;
702 } disk[8];
703 } raid;
704 int32_t filler2[346];
705 u_int32_t checksum;
706 } __packed;
707
708
709 /* Silicon Image Medley Metadata */
710 #define SII_LBA(dev) \
711 ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 1)
712
713 struct sii_raid_conf {
714 u_int16_t ata_params_00_53[54];
715 u_int64_t total_sectors;
716 u_int16_t ata_params_58_79[70];
717 u_int16_t dummy_0;
718 u_int16_t dummy_1;
719 u_int32_t controller_pci_id;
720 u_int16_t version_minor;
721 u_int16_t version_major;
722 u_int8_t timestamp[6];
723 u_int16_t stripe_sectors;
724 u_int16_t dummy_2;
725 u_int8_t disk_number;
726 u_int8_t type;
727 #define SII_T_RAID0 0x00
728 #define SII_T_RAID1 0x01
729 #define SII_T_RAID01 0x02
730 #define SII_T_SPARE 0x03
731
732 u_int8_t raid0_disks;
733 u_int8_t raid0_ident;
734 u_int8_t raid1_disks;
735 u_int8_t raid1_ident;
736 u_int64_t rebuild_lba;
737 u_int32_t generation;
738 u_int8_t status;
739 #define SII_S_READY 0x01
740
741 u_int8_t base_raid1_position;
742 u_int8_t base_raid0_position;
743 u_int8_t position;
744 u_int16_t dummy_3;
745 u_int8_t name[16];
746 u_int16_t checksum_0;
747 int8_t filler1[190];
748 u_int16_t checksum_1;
749 } __packed;
750
751
752 /* Silicon Integrated Systems RAID Metadata */
753 #define SIS_LBA(dev) \
754 ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 16)
755
756 struct sis_raid_conf {
757 u_int16_t magic;
758 #define SIS_MAGIC 0x0010
759
760 u_int8_t disks;
761 #define SIS_D_MASTER 0xf0
762 #define SIS_D_MIRROR 0x0f
763
764 u_int8_t type_total_disks;
765 #define SIS_D_MASK 0x0f
766 #define SIS_T_MASK 0xf0
767 #define SIS_T_JBOD 0x10
768 #define SIS_T_RAID0 0x20
769 #define SIS_T_RAID1 0x30
770
771 u_int32_t dummy_0;
772 u_int32_t controller_pci_id;
773 u_int16_t stripe_sectors;
774 u_int16_t dummy_1;
775 u_int32_t timestamp;
776 u_int8_t model[40];
777 u_int8_t disk_number;
778 u_int8_t dummy_2[3];
779 int8_t filler1[448];
780 } __packed;
781
782
783 /* VIA Tech V-RAID Metadata */
784 #define VIA_LBA(dev) \
785 ( ((struct ad_softc *)device_get_ivars(dev))->total_secs - 1)
786
787 struct via_raid_conf {
788 u_int16_t magic;
789 #define VIA_MAGIC 0xaa55
790
791 u_int8_t dummy_0;
792 u_int8_t type;
793 #define VIA_T_MASK 0x7e
794 #define VIA_T_BOOTABLE 0x01
795 #define VIA_T_RAID0 0x04
796 #define VIA_T_RAID1 0x0c
797 #define VIA_T_RAID01 0x4c
798 #define VIA_T_RAID5 0x2c
799 #define VIA_T_SPAN 0x44
800 #define VIA_T_UNKNOWN 0x80
801
802 u_int8_t disk_index;
803 #define VIA_D_MASK 0x0f
804 #define VIA_D_DEGRADED 0x10
805 #define VIA_D_HIGH_IDX 0x20
806
807 u_int8_t stripe_layout;
808 #define VIA_L_DISKS 0x07
809 #define VIA_L_MASK 0xf0
810 #define VIA_L_SHIFT 4
811
812 u_int64_t disk_sectors;
813 u_int32_t disk_id;
814 u_int32_t disks[8];
815 u_int8_t checksum;
816 u_int8_t filler_1[461];
817 } __packed;
Cache object: cc02c2749faf69eb5aa278cd59b8c592
|