1
/* Copyright (c) 1996-2004, Adaptec Corporation
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
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.
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.
33
//***************************************************************************
37
// This file contains data structure definitions for use in RAID
40
//Author: Doug Anderson
48
//***************************************************************************
51
//Definitions - Defines & Constants -----------------------------------------
53
// The maximum number of drive size entries supported in the engine
54
#define MAX_DRIVE_SIZE_ENTRIES 126
56
// Supported Logical Array Pages
61
// Supported Physical Array Pages
64
// Mode Page to Get/Set an array's DPT name
65
#define DPT_NAME_PAGE 0x3C
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
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
88
#define RAID_TABLE_SIZE 0x21
89
#define GEN5_RAID_TABLE_SIZE 0x11
92
//Definitions - Structure & Typedef -----------------------------------------
95
//-------------------------------------------------------------------
103
uLONG startLBA; // First LBA
104
uLONG stripeSize; // # blocks per stripe
105
uLONG numStripes; // total number of stripes
109
//---------- Portability Additions ----------- in sp_raid.cpp
111
uSHORT netInsert(dptBuffer_S *buffer);
112
uSHORT netExtract(dptBuffer_S *buffer);
113
#endif // DPT PORTABLE
114
//--------------------------------------------
123
//flags - bit definitions
124
// 1=This device is redundant
125
const uSHORT FLG_PAR_REDUNDANT = 0x0001;
127
struct raidParent_S : public raidRange_S
130
// Data...............................................
132
// Pointer to the parent RAID device
134
// Miscellaneous flags - see bit definitions above
137
// Constructor/Destructor.............................
141
// Other Functions....................................
145
//---------- Portability Additions ----------- in sp_raid.cpp
147
uSHORT netInsert(dptBuffer_S *buffer);
148
uSHORT netExtract(dptBuffer_S *buffer);
149
#endif // DPT PORTABLE
150
//--------------------------------------------
156
//-------------------------------------------------------------------
159
struct raidParentMap_S {
164
raidRange_S range; // Address range occupied
165
DPT_TAG_T tag; // Tag of parent device
169
//---------- Portability Additions ----------- in sp_raid.cpp
171
uSHORT netInsert(dptBuffer_S *buffer);
172
uSHORT netExtract(dptBuffer_S *buffer);
173
#endif // DPT PORTABLE
174
//--------------------------------------------
181
//-------------------------------------------------------------------
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
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
207
#define FLG_REQ_RESTRICT 0x4000
208
// 1=Force the RAID device to be suppressed after it is created
210
#define FLG_REQ_SUPPRESS 0x8000
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
233
struct raidDefinition_S {
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
255
//---------- Portability Additions ----------- in sp_raid.cpp
257
uSHORT netInsert(dptBuffer_S *buffer);
258
uSHORT netExtract(dptBuffer_S *buffer);
259
#endif // DPT PORTABLE
260
//--------------------------------------------
269
struct raidDef_S : public raidDefinition_S
272
// Constructor/Destructor.............................
274
raidDef_S::raidDef_S();
279
//-------------------------------------------------------------------
280
//-------------------------------------------------------------------
281
//-------------------------------------------------------------------