~ubuntu-branches/ubuntu/intrepid/raidutils/intrepid

« back to all changes in this revision

Viewing changes to raideng/raid.h

  • Committer: Bazaar Package Importer
  • Author(s): Barak Pearlmutter
  • Date: 2004-05-18 11:33:42 UTC
  • Revision ID: james.westby@ubuntu.com-20040518113342-tyqavmso5q351xi2
Tags: upstream-0.0.4
ImportĀ upstreamĀ versionĀ 0.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 1996-2004, Adaptec Corporation
 
2
 * All rights reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions are met:
 
6
 *
 
7
 * - Redistributions of source code must retain the above copyright notice, this
 
8
 *   list of conditions and the following disclaimer.
 
9
 * - Redistributions in binary form must reproduce the above copyright notice,
 
10
 *   this list of conditions and the following disclaimer in the documentation
 
11
 *   and/or other materials provided with the distribution.
 
12
 * - Neither the name of the Adaptec Corporation nor the names of its
 
13
 *   contributors may be used to endorse or promote products derived from this
 
14
 *   software without specific prior written permission.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
17
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
18
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
19
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 
20
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
21
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
22
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
23
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
24
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
25
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
26
 * POSSIBILITY OF SUCH DAMAGE.
 
27
 */
 
28
 
 
29
#ifndef         __RAID_H
 
30
#define         __RAID_H
 
31
 
 
32
//File - RAID.H
 
33
//***************************************************************************
 
34
//
 
35
//Description:
 
36
//
 
37
//    This file contains data structure definitions for use in RAID
 
38
//systems.
 
39
//
 
40
//Author:       Doug Anderson
 
41
//Date:         3/25/93
 
42
//
 
43
//Editors:
 
44
//
 
45
//Remarks:
 
46
//
 
47
//
 
48
//***************************************************************************
 
49
 
 
50
 
 
51
//Definitions - Defines & Constants -----------------------------------------
 
52
 
 
53
  // The maximum number of drive size entries supported in the engine
 
54
#define         MAX_DRIVE_SIZE_ENTRIES  126
 
55
 
 
56
  // Supported Logical Array Pages
 
57
#define         LAP_NCR1                0x2b
 
58
#define         LAP_DPT1                0x3B
 
59
#define         LAP_DPT2                0x30
 
60
 
 
61
  // Supported Physical Array Pages
 
62
#define         PAP_NCR1                0x2a
 
63
 
 
64
  // Mode Page to Get/Set an array's DPT name
 
65
#define         DPT_NAME_PAGE           0x3C
 
66
 
 
67
  // Logical Array Page Commands
 
68
#define         LAP_CMD_ADD             0x80
 
69
#define         LAP_CMD_DELETE          0x81
 
70
#define         LAP_CMD_MODIFY          0x82
 
71
#define         LAP_CMD_REPLACE         0x83
 
72
#define         LAP_CMD_ABORT           0x84
 
73
#define         LAP_CMD_SEGMENT         0x85
 
74
#define         LAP_CMD_BUILD           0x88
 
75
#define         LAP_CMD_REBUILD         0x89
 
76
#define         LAP_CMD_VERIFY          0x8a
 
77
#define         LAP_CMD_VERIFY_FIX      0x8b
 
78
#define         LAP_CMD_VERIFY_ABORT    0x8c
 
79
#define     LAP_CMD_ASSIGN_MAGIC 0x8c
 
80
 
 
81
  // Physical Array Page Commands
 
82
#define         PAP_CMD_OPTIMAL         0x00
 
83
#define         PAP_CMD_FAIL            0x03
 
84
#define         PAP_CMD_WARN            0x05
 
85
#define         PAP_CMD_REPLACED        0x24
 
86
 
 
87
  // Reserve
 
88
#define         RAID_TABLE_SIZE                 0x21
 
89
#define         GEN5_RAID_TABLE_SIZE    0x11
 
90
 
 
91
 
 
92
//Definitions - Structure & Typedef -----------------------------------------
 
93
 
 
94
 
 
95
//-------------------------------------------------------------------
 
96
 
 
97
#ifdef  __cplusplus
 
98
   struct raidRange_S {
 
99
#else
 
100
   typedef struct {
 
101
#endif
 
102
 
 
103
   uLONG        startLBA;       // First LBA
 
104
   uLONG        stripeSize;     // # blocks per stripe
 
105
   uLONG        numStripes;     // total number of stripes
 
106
 
 
107
#ifdef  __cplusplus
 
108
 
 
109
//---------- Portability Additions ----------- in sp_raid.cpp
 
110
#ifdef DPT_PORTABLE
 
111
        uSHORT          netInsert(dptBuffer_S *buffer);
 
112
        uSHORT          netExtract(dptBuffer_S *buffer);
 
113
#endif // DPT PORTABLE
 
114
//--------------------------------------------
 
115
 
 
116
   };
 
117
#else
 
118
   } raidRange_S;
 
119
#endif  // c++
 
120
 
 
121
 
 
122
#ifdef  __cplusplus
 
123
//flags - bit definitions
 
124
  // 1=This device is redundant
 
125
const uSHORT    FLG_PAR_REDUNDANT       = 0x0001;
 
126
 
 
127
struct raidParent_S : public raidRange_S
 
128
{
 
129
 
 
130
// Data...............................................
 
131
 
 
132
     // Pointer to the parent RAID device
 
133
   dptRAIDdev_C         *dev_P;
 
134
     // Miscellaneous flags - see bit definitions above
 
135
   uSHORT               flags;
 
136
 
 
137
// Constructor/Destructor.............................
 
138
 
 
139
                        raidParent_S();
 
140
 
 
141
// Other Functions....................................
 
142
 
 
143
   void                 reset();
 
144
 
 
145
//---------- Portability Additions ----------- in sp_raid.cpp
 
146
#ifdef DPT_PORTABLE
 
147
        uSHORT          netInsert(dptBuffer_S *buffer);
 
148
        uSHORT          netExtract(dptBuffer_S *buffer);
 
149
#endif // DPT PORTABLE
 
150
//--------------------------------------------
 
151
 
 
152
};
 
153
#endif  // c++
 
154
 
 
155
 
 
156
//-------------------------------------------------------------------
 
157
 
 
158
#ifdef  __cplusplus
 
159
   struct raidParentMap_S {
 
160
#else
 
161
   typedef struct {
 
162
#endif
 
163
 
 
164
   raidRange_S  range;          // Address range occupied
 
165
   DPT_TAG_T    tag;            // Tag of parent device
 
166
 
 
167
#ifdef  __cplusplus
 
168
 
 
169
//---------- Portability Additions ----------- in sp_raid.cpp
 
170
#ifdef DPT_PORTABLE
 
171
        uSHORT          netInsert(dptBuffer_S *buffer);
 
172
        uSHORT          netExtract(dptBuffer_S *buffer);
 
173
#endif // DPT PORTABLE
 
174
//--------------------------------------------
 
175
 
 
176
   };
 
177
#else
 
178
   } raidParentMap_S;
 
179
#endif  // c++
 
180
 
 
181
//-------------------------------------------------------------------
 
182
 
 
183
//require - bit definitions
 
184
  // An even # of drives are required
 
185
#define FLG_REQ_EVEN_DRIVES     0x0001
 
186
  // An odd # of drives are required
 
187
#define FLG_REQ_ODD_DRIVES      0x0002
 
188
  // The number of drives must be a power of 2 plus the number
 
189
  // of parity drives.
 
190
#define FLG_REQ_POWER_2_PLUS    0x0004
 
191
  // 1=Use the channel count field
 
192
  // (Allows for unique channel requirement...)
 
193
#define FLG_REQ_CHAN_COUNT      0x0020
 
194
  // The first component in the list must be located on the first channel
 
195
#define FLG_REQ_MIN_CHAN        0x0040
 
196
  // The component devices must be located on sequential channels
 
197
#define FLG_REQ_SEQ_CHAN        0x0080
 
198
  // The components must have the same stripe size
 
199
#define FLG_REQ_SAME_STRIPE_SZ  0x0100
 
200
  // The components must have the same number of stripes
 
201
#define FLG_REQ_SAME_NUM_STRIPE 0x0200
 
202
  // The component devices must have a stripe size that is an even
 
203
  // multiple of the underlying stripe size
 
204
#define FLG_REQ_UNDER_MULTIPLE  0x0400
 
205
  // 1=Prevent the RAID device from being a component device
 
206
  //   (ex.- Hot Spares)
 
207
#define FLG_REQ_RESTRICT        0x4000
 
208
  // 1=Force the RAID device to be suppressed after it is created
 
209
  //   (ex.- Hot Spares)
 
210
#define FLG_REQ_SUPPRESS        0x8000
 
211
 
 
212
//permit - bit definitions
 
213
  // 1=Components can have removeable media
 
214
#define FLG_COMP_REMOVEABLE     0x0001
 
215
  // 1=Components can be emulated drives
 
216
#define FLG_COMP_EMULATED       0x0002
 
217
  // 1=Components must be from the same vendor
 
218
#define FLG_COMP_SAME_VENDOR    0x0008
 
219
  // 1=Components must be the same product
 
220
#define FLG_COMP_SAME_PRODUCT   0x0010
 
221
  // 1=Components must have the same revision level
 
222
#define FLG_COMP_SAME_REVISION  0x0020
 
223
  // 1=Don't use devType field, 0=Only devType devices permitted
 
224
#define FLG_COMP_ANY_TYPE       0x0040
 
225
  // 1=Components can have non-512 byte block sizes
 
226
#define FLG_COMP_NON_512        0x0100
 
227
  // 1=Components can have varying block sizes
 
228
#define FLG_COMP_DIFF_BLOCKS    0x0200
 
229
  // 1=Components must all have the same capacity
 
230
#define FLG_COMP_SAME_CAPACITY  0x0400
 
231
 
 
232
#ifdef  __cplusplus
 
233
   struct raidDefinition_S {
 
234
#else
 
235
   typedef struct {
 
236
#endif
 
237
 
 
238
   uSHORT       refNum;         // RAID reference #
 
239
   uSHORT       type;           // RAID Type (Level) (0,1,3,5...)
 
240
   uSHORT       minDrives;      // Minimum # of drives required
 
241
   uSHORT       maxDrives;      // Maximum # of drives required
 
242
   uSHORT       redundants;     // Number of redundant drives
 
243
                                // (0x82 = 1/2 drives redundant)
 
244
   uLONG        minStripe;      // Minimum stripe size (blocks)
 
245
   uLONG        maxStripe;      // Maximum stripe size (blocks)
 
246
   uSHORT       chanCount;      // Determine the # of times a channel
 
247
                                // can appear in the component list
 
248
   uSHORT       required;       // Additional requirements
 
249
                                // (see bit definitions above)
 
250
   uSHORT       devType;        // Device type supported
 
251
   uSHORT       permit;         // Component flags
 
252
 
 
253
#ifdef  __cplusplus
 
254
 
 
255
//---------- Portability Additions ----------- in sp_raid.cpp
 
256
#ifdef DPT_PORTABLE
 
257
        uSHORT          netInsert(dptBuffer_S *buffer);
 
258
        uSHORT          netExtract(dptBuffer_S *buffer);
 
259
#endif // DPT PORTABLE
 
260
//--------------------------------------------
 
261
 
 
262
   };
 
263
#else
 
264
   } raidDefinition_S;
 
265
#endif  // c++
 
266
 
 
267
 
 
268
#ifdef  __cplusplus
 
269
struct raidDef_S : public raidDefinition_S
 
270
{
 
271
 
 
272
// Constructor/Destructor.............................
 
273
 
 
274
                        raidDef_S::raidDef_S();
 
275
 
 
276
};
 
277
#endif  // c++
 
278
 
 
279
//-------------------------------------------------------------------
 
280
//-------------------------------------------------------------------
 
281
//-------------------------------------------------------------------
 
282
 
 
283
 
 
284
#endif  // __RAID_H
 
285