ata_raidreg.h revision 1.1 1 1.1 thorpej /* $NetBSD: ata_raidreg.h,v 1.1 2003/01/27 18:21:28 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2000,2001,2002 Sren Schmidt <sos (at) FreeBSD.org>
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Redistribution and use in source and binary forms, with or without
8 1.1 thorpej * modification, are permitted provided that the following conditions
9 1.1 thorpej * are met:
10 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.1 thorpej * notice, this list of conditions and the following disclaimer,
12 1.1 thorpej * without modification, immediately at the beginning of the file.
13 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
15 1.1 thorpej * documentation and/or other materials provided with the distribution.
16 1.1 thorpej * 3. The name of the author may not be used to endorse or promote products
17 1.1 thorpej * derived from this software without specific prior written permission.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 1.1 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 1.1 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 1.1 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 1.1 thorpej * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 1.1 thorpej * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 1.1 thorpej * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 1.1 thorpej * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 1.1 thorpej * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 1.1 thorpej */
30 1.1 thorpej
31 1.1 thorpej #ifndef _DEV_PCI_PCIIDE_PROMISE_RAID_H_
32 1.1 thorpej #define _DEV_PCI_PCIIDE_PROMISE_RAID_H_
33 1.1 thorpej
34 1.1 thorpej /*
35 1.1 thorpej * Macro to compute the LBA of the Promise RAID configuration structure,
36 1.1 thorpej * using the disk's softc structure.
37 1.1 thorpej */
38 1.1 thorpej #define PR_LBA(wd) \
39 1.1 thorpej ((((wd)->sc_capacity / \
40 1.1 thorpej ((wd)->sc_params.atap_heads * (wd)->sc_params.atap_sectors)) * \
41 1.1 thorpej (wd)->sc_params.atap_heads * (wd)->sc_params.atap_sectors) - \
42 1.1 thorpej (wd)->sc_params.atap_sectors)
43 1.1 thorpej
44 1.1 thorpej struct promise_raid_conf {
45 1.1 thorpej char promise_id[24];
46 1.1 thorpej #define PR_MAGIC "Promise Technology, Inc."
47 1.1 thorpej
48 1.1 thorpej uint32_t dummy_0;
49 1.1 thorpej
50 1.1 thorpej uint64_t magic_0;
51 1.1 thorpej uint16_t magic_1;
52 1.1 thorpej uint32_t magic_2;
53 1.1 thorpej uint8_t filler1[470];
54 1.1 thorpej struct { /* 0x200 */
55 1.1 thorpej uint32_t integrity;
56 1.1 thorpej #define PR_I_VALID 0x00000080
57 1.1 thorpej
58 1.1 thorpej uint8_t flags;
59 1.1 thorpej #define PR_F_VALID 0x01
60 1.1 thorpej #define PR_F_ONLINE 0x02
61 1.1 thorpej #define PR_F_ASSIGNED 0x04
62 1.1 thorpej #define PR_F_SPARE 0x08
63 1.1 thorpej #define PR_F_DUPLICATE 0x10
64 1.1 thorpej #define PR_F_REDIR 0x20
65 1.1 thorpej #define PR_F_DOWN 0x40
66 1.1 thorpej #define PR_F_READY 0x80
67 1.1 thorpej
68 1.1 thorpej uint8_t disk_number;
69 1.1 thorpej uint8_t channel;
70 1.1 thorpej uint8_t device;
71 1.1 thorpej uint64_t magic_0 __attribute__((__packed__));
72 1.1 thorpej uint32_t disk_offset; /* 0x210 */
73 1.1 thorpej uint32_t disk_sectors;
74 1.1 thorpej uint32_t rebuild_lba;
75 1.1 thorpej uint16_t generation;
76 1.1 thorpej uint8_t status;
77 1.1 thorpej #define PR_S_VALID 0x01
78 1.1 thorpej #define PR_S_ONLINE 0x02
79 1.1 thorpej #define PR_S_INITED 0x04
80 1.1 thorpej #define PR_S_READY 0x08
81 1.1 thorpej #define PR_S_DEGRADED 0x10
82 1.1 thorpej #define PR_S_MARKED 0x20
83 1.1 thorpej #define PR_S_FUNCTIONAL 0x80
84 1.1 thorpej
85 1.1 thorpej uint8_t type;
86 1.1 thorpej #define PR_T_RAID0 0x00
87 1.1 thorpej #define PR_T_RAID1 0x01
88 1.1 thorpej #define PR_T_RAID3 0x02
89 1.1 thorpej #define PR_T_RAID5 0x04
90 1.1 thorpej #define PR_T_SPAN 0x08
91 1.1 thorpej
92 1.1 thorpej uint8_t total_disks; /* 0x220 */
93 1.1 thorpej uint8_t stripe_shift;
94 1.1 thorpej uint8_t array_width;
95 1.1 thorpej uint8_t array_number;
96 1.1 thorpej uint32_t total_sectors;
97 1.1 thorpej uint16_t cylinders;
98 1.1 thorpej uint8_t heads;
99 1.1 thorpej uint8_t sectors;
100 1.1 thorpej uint64_t magic_1 __attribute__((__packed__));
101 1.1 thorpej struct {
102 1.1 thorpej uint8_t flags;
103 1.1 thorpej uint8_t dummy_0;
104 1.1 thorpej uint8_t channel;
105 1.1 thorpej uint8_t device;
106 1.1 thorpej uint64_t magic_0 __attribute__((__packed__));
107 1.1 thorpej } disk[8];
108 1.1 thorpej } raid;
109 1.1 thorpej uint32_t filler2[346];
110 1.1 thorpej uint32_t checksum;
111 1.1 thorpej } __attribute__((__packed__));
112 1.1 thorpej
113 1.1 thorpej #endif /* _DEV_PCI_PCIIDE_PROMISE_RAID_H_ */
114