1 /*
2 * Copyright (c) HighPoint Technologies, Inc.
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 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: releng/6.3/sys/dev/hptrr/hptintf.h 174616 2007-12-15 06:32:34Z scottl $
27 */
28 #include <dev/hptrr/hptrr_config.h>
29
30
31 #ifndef HPT_INTF_H
32 #define HPT_INTF_H
33
34 #if defined(__BIG_ENDIAN__)&&!defined(__BIG_ENDIAN_BITFIELD)
35 #define __BIG_ENDIAN_BITFIELD
36 #endif
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #ifndef __GNUC__
43 #define __attribute__(x)
44 #endif
45
46 #pragma pack(1)
47
48 /*
49 * Version of this interface.
50 * The user mode application must first issue a hpt_get_version() call to
51 * check HPT_INTERFACE_VERSION. When an utility using newer version interface
52 * is used with old version drivers, it must call only the functions that
53 * driver supported.
54 * A new version interface should only add ioctl functions; it should implement
55 * all old version functions without change their definition.
56 */
57 #define __this_HPT_INTERFACE_VERSION 0x02000001
58
59 #ifndef HPT_INTERFACE_VERSION
60 #error "You must define HPT_INTERFACE_VERSION you implemented"
61 #endif
62
63 #if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION
64 #error "HPT_INTERFACE_VERSION is invalid"
65 #endif
66
67 /*
68 * DEFINITION
69 * Logical device --- a device that can be accessed by OS.
70 * Physical device --- device attached to the controller.
71 * A logical device can be simply a physical device.
72 *
73 * Each logical and physical device has a 32bit ID. GUI will use this ID
74 * to identify devices.
75 * 1. The ID must be unique.
76 * 2. The ID must be immutable. Once an ID is assigned to a device, it
77 * must not change when system is running and the device exists.
78 * 3. The ID of logical device must be NOT reusable. If a device is
79 * removed, other newly created logical device must not use the same ID.
80 * 4. The ID must not be zero or 0xFFFFFFFF.
81 */
82 typedef HPT_U32 DEVICEID;
83
84 /*
85 * logical device type.
86 * Identify array (logical device) and physical device.
87 */
88 #define LDT_ARRAY 1
89 #define LDT_DEVICE 2
90
91 /*
92 * Array types
93 * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0.
94 * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0.
95 * Their members may be another array of type RAID0 or RAID1.
96 */
97 #define AT_UNKNOWN 0
98 #define AT_RAID0 1
99 #define AT_RAID1 2
100 #define AT_RAID5 3
101 #define AT_RAID6 4
102 #define AT_JBOD 7
103
104 /*
105 * physical device type
106 */
107 #define PDT_UNKNOWN 0
108 #define PDT_HARDDISK 1
109 #define PDT_CDROM 2
110 #define PDT_TAPE 3
111
112 /*
113 * Some constants.
114 */
115 #define MAX_NAME_LENGTH 36
116 #define MAX_ARRAYNAME_LEN 16
117
118 #define MAX_ARRAY_MEMBERS_V1 8
119
120 #ifndef MAX_ARRAY_MEMBERS_V2
121 #define MAX_ARRAY_MEMBERS_V2 16
122 #endif
123
124 #ifndef MAX_ARRAY_MEMBERS_V3
125 #define MAX_ARRAY_MEMBERS_V3 64
126 #endif
127
128 /* keep definition for source code compatiblity */
129 #define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
130
131 /*
132 * io commands
133 * GUI use these commands to do IO on logical/physical devices.
134 */
135 #define IO_COMMAND_READ 1
136 #define IO_COMMAND_WRITE 2
137
138
139
140 /*
141 * array flags
142 */
143 #define ARRAY_FLAG_DISABLED 0x00000001 /* The array is disabled */
144 #define ARRAY_FLAG_NEEDBUILDING 0x00000002 /* array data need to be rebuilt */
145 #define ARRAY_FLAG_REBUILDING 0x00000004 /* array is in rebuilding process */
146 #define ARRAY_FLAG_BROKEN 0x00000008 /* broken but may still working */
147 #define ARRAY_FLAG_BOOTDISK 0x00000010 /* array has a active partition */
148
149 #define ARRAY_FLAG_BOOTMARK 0x00000040 /* array has boot mark set */
150 #define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */
151 #define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */
152 #define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */
153 #define ARRAY_FLAG_TRANSFORMING 0x00000400 /* tranform in progress */
154 #define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need tranform */
155 #define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/
156 #define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */
157 #define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */
158 /*
159 * device flags
160 */
161 #define DEVICE_FLAG_DISABLED 0x00000001 /* device is disabled */
162 #define DEVICE_FLAG_BOOTDISK 0x00000002 /* disk has a active partition */
163 #define DEVICE_FLAG_BOOTMARK 0x00000004 /* disk has boot mark set */
164 #define DEVICE_FLAG_WITH_601 0x00000008 /* has HPT601 connected */
165 #define DEVICE_FLAG_SATA 0x00000010 /* S-ATA device */
166 #define DEVICE_FLAG_ON_PM_PORT 0x00000020 /* PM port */
167
168 #define DEVICE_FLAG_UNINITIALIZED 0x00010000 /* device is not initialized, can't be used to create array */
169 #define DEVICE_FLAG_LEGACY 0x00020000 /* single disk & mbr contains at least one partition */
170
171 #define DEVICE_FLAG_IS_SPARE 0x80000000 /* is a spare disk */
172
173 /*
174 * array states used by hpt_set_array_state()
175 */
176 /* old defines */
177 #define MIRROR_REBUILD_START 1
178 #define MIRROR_REBUILD_ABORT 2
179 #define MIRROR_REBUILD_COMPLETE 3
180 /* new defines */
181 #define AS_REBUILD_START 1
182 #define AS_REBUILD_ABORT 2
183 #define AS_REBUILD_PAUSE AS_REBUILD_ABORT
184 #define AS_REBUILD_COMPLETE 3
185 #define AS_VERIFY_START 4
186 #define AS_VERIFY_ABORT 5
187 #define AS_VERIFY_COMPLETE 6
188 #define AS_INITIALIZE_START 7
189 #define AS_INITIALIZE_ABORT 8
190 #define AS_INITIALIZE_COMPLETE 9
191 #define AS_VERIFY_FAILED 10
192 #define AS_REBUILD_STOP 11
193 #define AS_SAVE_STATE 12
194 #define AS_TRANSFORM_START 13
195 #define AS_TRANSFORM_ABORT 14
196
197 /************************************************************************
198 * ioctl code
199 * It would be better if ioctl code are the same on different platforms,
200 * but we must not conflict with system defined ioctl code.
201 ************************************************************************/
202 #if defined(LINUX) || defined(__FreeBSD_version) || defined(linux)
203 #define HPT_CTL_CODE(x) (x+0xFF00)
204 #define HPT_CTL_CODE_LINUX_TO_IOP(x) ((x)-0xff00)
205 #elif defined(_MS_WIN32_) || defined(WIN32)
206
207 #ifndef CTL_CODE
208 #define CTL_CODE( DeviceType, Function, Method, Access ) \
209 (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
210 #endif
211 #define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0)
212 #define HPT_CTL_CODE_WIN32_TO_IOP(x) ((((x) & 0xffff)>>2)-0x900)
213
214 #else
215 #define HPT_CTL_CODE(x) (x)
216 #endif
217
218 #define HPT_IOCTL_GET_VERSION HPT_CTL_CODE(0)
219 #define HPT_IOCTL_GET_CONTROLLER_COUNT HPT_CTL_CODE(1)
220 #define HPT_IOCTL_GET_CONTROLLER_INFO HPT_CTL_CODE(2)
221 #define HPT_IOCTL_GET_CHANNEL_INFO HPT_CTL_CODE(3)
222 #define HPT_IOCTL_GET_LOGICAL_DEVICES HPT_CTL_CODE(4)
223 #define HPT_IOCTL_GET_DEVICE_INFO HPT_CTL_CODE(5)
224 #define HPT_IOCTL_CREATE_ARRAY HPT_CTL_CODE(6)
225 #define HPT_IOCTL_DELETE_ARRAY HPT_CTL_CODE(7)
226 #define HPT_IOCTL_ARRAY_IO HPT_CTL_CODE(8)
227 #define HPT_IOCTL_DEVICE_IO HPT_CTL_CODE(9)
228 #define HPT_IOCTL_GET_EVENT HPT_CTL_CODE(10)
229 #define HPT_IOCTL_REBUILD_MIRROR HPT_CTL_CODE(11)
230 /* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */
231 #define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR
232 #define HPT_IOCTL_ADD_SPARE_DISK HPT_CTL_CODE(12)
233 #define HPT_IOCTL_REMOVE_SPARE_DISK HPT_CTL_CODE(13)
234 #define HPT_IOCTL_ADD_DISK_TO_ARRAY HPT_CTL_CODE(14)
235 #define HPT_IOCTL_SET_ARRAY_STATE HPT_CTL_CODE(15)
236 #define HPT_IOCTL_SET_ARRAY_INFO HPT_CTL_CODE(16)
237 #define HPT_IOCTL_SET_DEVICE_INFO HPT_CTL_CODE(17)
238 #define HPT_IOCTL_RESCAN_DEVICES HPT_CTL_CODE(18)
239 #define HPT_IOCTL_GET_DRIVER_CAPABILITIES HPT_CTL_CODE(19)
240 #define HPT_IOCTL_GET_601_INFO HPT_CTL_CODE(20)
241 #define HPT_IOCTL_SET_601_INFO HPT_CTL_CODE(21)
242 #define HPT_IOCTL_LOCK_DEVICE HPT_CTL_CODE(22)
243 #define HPT_IOCTL_UNLOCK_DEVICE HPT_CTL_CODE(23)
244 #define HPT_IOCTL_IDE_PASS_THROUGH HPT_CTL_CODE(24)
245 #define HPT_IOCTL_VERIFY_DATA_BLOCK HPT_CTL_CODE(25)
246 #define HPT_IOCTL_INITIALIZE_DATA_BLOCK HPT_CTL_CODE(26)
247 #define HPT_IOCTL_ADD_DEDICATED_SPARE HPT_CTL_CODE(27)
248 #define HPT_IOCTL_DEVICE_IO_EX HPT_CTL_CODE(28)
249 #define HPT_IOCTL_SET_BOOT_MARK HPT_CTL_CODE(29)
250 #define HPT_IOCTL_QUERY_REMOVE HPT_CTL_CODE(30)
251 #define HPT_IOCTL_REMOVE_DEVICES HPT_CTL_CODE(31)
252 #define HPT_IOCTL_CREATE_ARRAY_V2 HPT_CTL_CODE(32)
253 #define HPT_IOCTL_GET_DEVICE_INFO_V2 HPT_CTL_CODE(33)
254 #define HPT_IOCTL_SET_DEVICE_INFO_V2 HPT_CTL_CODE(34)
255 #define HPT_IOCTL_REBUILD_DATA_BLOCK_V2 HPT_CTL_CODE(35)
256 #define HPT_IOCTL_VERIFY_DATA_BLOCK_V2 HPT_CTL_CODE(36)
257 #define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2 HPT_CTL_CODE(37)
258 #define HPT_IOCTL_LOCK_DEVICE_V2 HPT_CTL_CODE(38)
259 #define HPT_IOCTL_DEVICE_IO_V2 HPT_CTL_CODE(39)
260 #define HPT_IOCTL_DEVICE_IO_EX_V2 HPT_CTL_CODE(40)
261 #define HPT_IOCTL_CREATE_TRANSFORM HPT_CTL_CODE(41)
262 #define HPT_IOCTL_STEP_TRANSFORM HPT_CTL_CODE(42)
263 #define HPT_IOCTL_SET_VDEV_INFO HPT_CTL_CODE(43)
264 #define HPT_IOCTL_CALC_MAX_CAPACITY HPT_CTL_CODE(44)
265 #define HPT_IOCTL_INIT_DISKS HPT_CTL_CODE(45)
266 #define HPT_IOCTL_GET_DEVICE_INFO_V3 HPT_CTL_CODE(46)
267 #define HPT_IOCTL_GET_CONTROLLER_INFO_V2 HPT_CTL_CODE(47)
268 #define HPT_IOCTL_I2C_TRANSACTION HPT_CTL_CODE(48)
269 #define HPT_IOCTL_GET_PARAMETER_LIST HPT_CTL_CODE(49)
270 #define HPT_IOCTL_GET_PARAMETER HPT_CTL_CODE(50)
271 #define HPT_IOCTL_SET_PARAMETER HPT_CTL_CODE(51)
272 #define HPT_IOCTL_GET_DRIVER_CAPABILITIES_V2 HPT_CTL_CODE(52)
273 #define HPT_IOCTL_GET_CHANNEL_INFO_V2 HPT_CTL_CODE(53)
274 #define HPT_IOCTL_GET_CONTROLLER_INFO_V3 HPT_CTL_CODE(54)
275 #define HPT_IOCTL_GET_DEVICE_INFO_V4 HPT_CTL_CODE(55)
276 #define HPT_IOCTL_CREATE_ARRAY_V3 HPT_CTL_CODE(56)
277 #define HPT_IOCTL_CREATE_TRANSFORM_V2 HPT_CTL_CODE(57)
278 #define HPT_IOCTL_CALC_MAX_CAPACITY_V2 HPT_CTL_CODE(58)
279
280
281 #define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100)
282 #define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101)
283
284 #define HPT_IOCTL_EPROM_IO HPT_CTL_CODE(102)
285 #define HPT_IOCTL_GET_CONTROLLER_VENID HPT_CTL_CODE(103)
286
287 /************************************************************************
288 * shared data structures
289 ************************************************************************/
290
291 /*
292 * Chip Type
293 */
294 #define CHIP_TYPE_HPT366 1
295 #define CHIP_TYPE_HPT368 2
296 #define CHIP_TYPE_HPT370 3
297 #define CHIP_TYPE_HPT370A 4
298 #define CHIP_TYPE_HPT370B 5
299 #define CHIP_TYPE_HPT374 6
300 #define CHIP_TYPE_HPT372 7
301 #define CHIP_TYPE_HPT372A 8
302 #define CHIP_TYPE_HPT302 9
303 #define CHIP_TYPE_HPT371 10
304 #define CHIP_TYPE_HPT372N 11
305 #define CHIP_TYPE_HPT302N 12
306 #define CHIP_TYPE_HPT371N 13
307 #define CHIP_TYPE_SI3112A 14
308 #define CHIP_TYPE_ICH5 15
309 #define CHIP_TYPE_ICH5R 16
310
311 /*
312 * Chip Flags
313 */
314 #define CHIP_SUPPORT_ULTRA_66 0x20
315 #define CHIP_SUPPORT_ULTRA_100 0x40
316 #define CHIP_HPT3XX_DPLL_MODE 0x80
317 #define CHIP_SUPPORT_ULTRA_133 0x01
318 #define CHIP_SUPPORT_ULTRA_150 0x02
319 #define CHIP_MASTER 0x04
320 #define CHIP_SUPPORT_SATA_300 0x08
321
322 #define HPT_SPIN_UP_MODE_NOSUPPORT 0
323 #define HPT_SPIN_UP_MODE_FULL 1
324 #define HPT_SPIN_UP_MODE_STANDBY 2
325
326 typedef struct _DRIVER_CAPABILITIES {
327 HPT_U32 dwSize;
328
329 HPT_U8 MaximumControllers; /* maximum controllers the driver can support */
330 HPT_U8 SupportCrossControllerRAID; /* 1-support, 0-not support */
331 HPT_U8 MinimumBlockSizeShift; /* minimum block size shift */
332 HPT_U8 MaximumBlockSizeShift; /* maximum block size shift */
333
334 HPT_U8 SupportDiskModeSetting;
335 HPT_U8 SupportSparePool;
336 HPT_U8 MaximumArrayNameLength;
337 /* only one HPT_U8 left here! */
338 #ifdef __BIG_ENDIAN_BITFIELD
339 HPT_U8 reserved: 4;
340 HPT_U8 SupportHotSwap: 1;
341 HPT_U8 HighPerformanceRAID1: 1;
342 HPT_U8 RebuildProcessInDriver: 1;
343 HPT_U8 SupportDedicatedSpare: 1;
344 #else
345 HPT_U8 SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */
346 HPT_U8 RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */
347 HPT_U8 HighPerformanceRAID1: 1;
348 HPT_U8 SupportHotSwap: 1;
349 HPT_U8 reserved: 4;
350 #endif
351
352
353 HPT_U8 SupportedRAIDTypes[16];
354 /* maximum members in an array corresponding to SupportedRAIDTypes */
355 HPT_U8 MaximumArrayMembers[16];
356 }
357 DRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES;
358
359 typedef struct _DRIVER_CAPABILITIES_V2 {
360 DRIVER_CAPABILITIES v1;
361 HPT_U8 SupportedCachePolicies[16];
362 HPT_U32 reserved[17];
363 }
364 DRIVER_CAPABILITIES_V2, *PDRIVER_CAPABILITIES_V2;
365
366 /*
367 * Controller information.
368 */
369 typedef struct _CONTROLLER_INFO {
370 HPT_U8 ChipType; /* chip type */
371 HPT_U8 InterruptLevel; /* IRQ level */
372 HPT_U8 NumBuses; /* bus count */
373 HPT_U8 ChipFlags;
374
375 HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */
376 HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */
377
378 } CONTROLLER_INFO, *PCONTROLLER_INFO;
379
380 #if HPT_INTERFACE_VERSION>=0x01020000
381 typedef struct _CONTROLLER_INFO_V2 {
382 HPT_U8 ChipType; /* chip type */
383 HPT_U8 InterruptLevel; /* IRQ level */
384 HPT_U8 NumBuses; /* bus count */
385 HPT_U8 ChipFlags;
386
387 HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */
388 HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */
389
390 HPT_U32 GroupId; /* low 32bit of vbus pointer the controller belongs
391 * the master controller has CHIP_MASTER flag set*/
392 HPT_U8 pci_tree;
393 HPT_U8 pci_bus;
394 HPT_U8 pci_device;
395 HPT_U8 pci_function;
396
397 HPT_U32 ExFlags;
398 } CONTROLLER_INFO_V2, *PCONTROLLER_INFO_V2;
399
400
401 #define CEXF_IOPModel 1
402 #define CEXF_SDRAMSize 2
403 #define CEXF_BatteryInstalled 4
404 #define CEXF_BatteryStatus 8
405 #define CEXF_BatteryVoltage 0x10
406 #define CEXF_BatteryBackupTime 0x20
407 #define CEXF_FirmwareVersion 0x40
408 #define CEXF_SerialNumber 0x80
409
410 typedef struct _CONTROLLER_INFO_V3 {
411 HPT_U8 ChipType;
412 HPT_U8 InterruptLevel;
413 HPT_U8 NumBuses;
414 HPT_U8 ChipFlags;
415 HPT_U8 szProductID[MAX_NAME_LENGTH];
416 HPT_U8 szVendorID[MAX_NAME_LENGTH];
417 HPT_U32 GroupId;
418 HPT_U8 pci_tree;
419 HPT_U8 pci_bus;
420 HPT_U8 pci_device;
421 HPT_U8 pci_function;
422 HPT_U32 ExFlags;
423 HPT_U8 IOPModel[32];
424 HPT_U32 SDRAMSize;
425 HPT_U8 BatteryInstalled;
426 HPT_U8 BatteryStatus;
427 HPT_U16 BatteryVoltage;
428 HPT_U32 BatteryBackupTime;
429 HPT_U32 FirmwareVersion;
430 HPT_U8 SerialNumber[32];
431 HPT_U8 reserve[88];
432 }
433 CONTROLLER_INFO_V3, *PCONTROLLER_INFO_V3;
434 typedef char check_CONTROLLER_INFO_V3[sizeof(CONTROLLER_INFO_V3)==256? 1:-1];
435 #endif
436 /*
437 * Channel information.
438 */
439 typedef struct _CHANNEL_INFO {
440 HPT_U32 IoPort; /* IDE Base Port Address */
441 HPT_U32 ControlPort; /* IDE Control Port Address */
442
443 DEVICEID Devices[2]; /* device connected to this channel */
444
445 } CHANNEL_INFO, *PCHANNEL_INFO;
446
447 typedef struct _CHANNEL_INFO_V2 {
448 HPT_U32 IoPort; /* IDE Base Port Address */
449 HPT_U32 ControlPort; /* IDE Control Port Address */
450
451 DEVICEID Devices[2+13]; /* device connected to this channel, PMPort max=15 */
452 } CHANNEL_INFO_V2, *PCHANNEL_INFO_V2;
453
454 #ifndef __KERNEL__
455 /*
456 * time represented in HPT_U32 format
457 */
458 typedef struct _TIME_RECORD {
459 HPT_U32 seconds:6; /* 0 - 59 */
460 HPT_U32 minutes:6; /* 0 - 59 */
461 HPT_U32 month:4; /* 1 - 12 */
462 HPT_U32 hours:6; /* 0 - 59 */
463 HPT_U32 day:5; /* 1 - 31 */
464 HPT_U32 year:5; /* 0=2000, 31=2031 */
465 } TIME_RECORD;
466 #endif
467
468 /*
469 * Array information.
470 */
471 typedef struct _HPT_ARRAY_INFO {
472 HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */
473 HPT_U8 Description[64]; /* array description */
474 HPT_U8 CreateManager[16]; /* who created it */
475 TIME_RECORD CreateTime; /* when created it */
476
477 HPT_U8 ArrayType; /* array type */
478 HPT_U8 BlockSizeShift; /* stripe size */
479 HPT_U8 nDisk; /* member count: Number of ID in Members[] */
480 HPT_U8 reserved;
481
482 HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */
483 HPT_U32 Members[MAX_ARRAY_MEMBERS_V1]; /* member array/disks */
484
485 /*
486 * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0);
487 * only valid if rebuilding is done by driver code.
488 * Member Flags will have ARRAY_FLAG_REBUILDING set at this case.
489 * Verify operation use same fields below, the only difference is
490 * ARRAY_FLAG_VERIFYING is set.
491 */
492 HPT_U32 RebuildingProgress;
493 HPT_U32 RebuiltSectors; /* rebuilding point (LBA) for single member */
494
495 } HPT_ARRAY_INFO, *PHPT_ARRAY_INFO;
496
497 #if HPT_INTERFACE_VERSION>=0x01010000
498 typedef struct _HPT_ARRAY_INFO_V2 {
499 HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */
500 HPT_U8 Description[64]; /* array description */
501 HPT_U8 CreateManager[16]; /* who created it */
502 TIME_RECORD CreateTime; /* when created it */
503
504 HPT_U8 ArrayType; /* array type */
505 HPT_U8 BlockSizeShift; /* stripe size */
506 HPT_U8 nDisk; /* member count: Number of ID in Members[] */
507 HPT_U8 reserved;
508
509 HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */
510 HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */
511
512 HPT_U32 RebuildingProgress;
513 HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */
514
515 HPT_U32 reserve4[4];
516 } HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2;
517 #endif
518
519 #if HPT_INTERFACE_VERSION>=0x01020000
520 typedef struct _HPT_ARRAY_INFO_V3 {
521 HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */
522 HPT_U8 Description[64]; /* array description */
523 HPT_U8 CreateManager[16]; /* who created it */
524 TIME_RECORD CreateTime; /* when created it */
525
526 HPT_U8 ArrayType; /* array type */
527 HPT_U8 BlockSizeShift; /* stripe size */
528 HPT_U8 nDisk; /* member count: Number of ID in Members[] */
529 HPT_U8 reserved;
530
531 HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */
532 HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */
533
534 HPT_U32 RebuildingProgress;
535 HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */
536
537 DEVICEID TransformSource;
538 DEVICEID TransformTarget; /* destination device ID */
539 HPT_U32 TransformingProgress;
540 HPT_U32 Signature; /* persistent identification*/
541 #if MAX_ARRAY_MEMBERS_V2==16
542 HPT_U16 Critical_Members; /* bit mask of critical members */
543 HPT_U16 reserve2;
544 HPT_U32 reserve;
545 #else
546 HPT_U32 Critical_Members;
547 HPT_U32 reserve;
548 #endif
549 } HPT_ARRAY_INFO_V3, *PHPT_ARRAY_INFO_V3;
550 #endif
551
552 #if HPT_INTERFACE_VERSION>=0x02000001
553 typedef struct _HPT_ARRAY_INFO_V4 {
554 HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */
555 HPT_U8 Description[64]; /* array description */
556 HPT_U8 CreateManager[16]; /* who created it */
557 TIME_RECORD CreateTime; /* when created it */
558
559 HPT_U8 ArrayType; /* array type */
560 HPT_U8 BlockSizeShift; /* stripe size */
561 HPT_U8 nDisk; /* member count: Number of ID in Members[] */
562 HPT_U8 reserved;
563
564 HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */
565
566 HPT_U32 RebuildingProgress;
567 HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */
568
569 DEVICEID TransformSource;
570 DEVICEID TransformTarget; /* destination device ID */
571 HPT_U32 TransformingProgress;
572 HPT_U32 Signature; /* persistent identification*/
573 HPT_U32 reserved2[2];
574 HPT_U64 Critical_Members;
575 HPT_U32 Members[MAX_ARRAY_MEMBERS_V3]; /* member array/disks */
576 } HPT_ARRAY_INFO_V4, *PHPT_ARRAY_INFO_V4;
577 #endif
578
579
580 #ifndef __KERNEL__
581 /*
582 * ATA/ATAPI Device identify data without the Reserved4.
583 */
584 typedef struct _IDENTIFY_DATA2 {
585 HPT_U16 GeneralConfiguration;
586 HPT_U16 NumberOfCylinders;
587 HPT_U16 Reserved1;
588 HPT_U16 NumberOfHeads;
589 HPT_U16 UnformattedBytesPerTrack;
590 HPT_U16 UnformattedBytesPerSector;
591 HPT_U16 SectorsPerTrack;
592 HPT_U16 VendorUnique1[3];
593 HPT_U16 SerialNumber[10];
594 HPT_U16 BufferType;
595 HPT_U16 BufferSectorSize;
596 HPT_U16 NumberOfEccBytes;
597 HPT_U16 FirmwareRevision[4];
598 HPT_U16 ModelNumber[20];
599 HPT_U8 MaximumBlockTransfer;
600 HPT_U8 VendorUnique2;
601 HPT_U16 DoubleWordIo;
602 HPT_U16 Capabilities;
603 HPT_U16 Reserved2;
604 HPT_U8 VendorUnique3;
605 HPT_U8 PioCycleTimingMode;
606 HPT_U8 VendorUnique4;
607 HPT_U8 DmaCycleTimingMode;
608 HPT_U16 TranslationFieldsValid;
609 HPT_U16 NumberOfCurrentCylinders;
610 HPT_U16 NumberOfCurrentHeads;
611 HPT_U16 CurrentSectorsPerTrack;
612 HPT_U32 CurrentSectorCapacity;
613 HPT_U16 CurrentMultiSectorSetting;
614 HPT_U32 UserAddressableSectors;
615 HPT_U8 SingleWordDMASupport;
616 HPT_U8 SingleWordDMAActive;
617 HPT_U8 MultiWordDMASupport;
618 HPT_U8 MultiWordDMAActive;
619 HPT_U8 AdvancedPIOModes;
620 HPT_U8 Reserved4;
621 HPT_U16 MinimumMWXferCycleTime;
622 HPT_U16 RecommendedMWXferCycleTime;
623 HPT_U16 MinimumPIOCycleTime;
624 HPT_U16 MinimumPIOCycleTimeIORDY;
625 HPT_U16 Reserved5[2];
626 HPT_U16 ReleaseTimeOverlapped;
627 HPT_U16 ReleaseTimeServiceCommand;
628 HPT_U16 MajorRevision;
629 HPT_U16 MinorRevision;
630 } IDENTIFY_DATA2, *PIDENTIFY_DATA2;
631 #endif
632
633 /*
634 * physical device information.
635 * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data.
636 */
637 typedef struct _DEVICE_INFO {
638 HPT_U8 ControllerId; /* controller id */
639 HPT_U8 PathId; /* bus */
640 HPT_U8 TargetId; /* id */
641 HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */
642 /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */
643 HPT_U8 DeviceType; /* device type */
644 HPT_U8 UsableMode; /* highest usable mode */
645
646 #ifdef __BIG_ENDIAN_BITFIELD
647 HPT_U8 NCQEnabled: 1;
648 HPT_U8 NCQSupported: 1;
649 HPT_U8 TCQEnabled: 1;
650 HPT_U8 TCQSupported: 1;
651 HPT_U8 WriteCacheEnabled: 1;
652 HPT_U8 WriteCacheSupported: 1;
653 HPT_U8 ReadAheadEnabled: 1;
654 HPT_U8 ReadAheadSupported: 1;
655 HPT_U8 reserved6: 6;
656 HPT_U8 SpinUpMode: 2;
657 #else
658 HPT_U8 ReadAheadSupported: 1;
659 HPT_U8 ReadAheadEnabled: 1;
660 HPT_U8 WriteCacheSupported: 1;
661 HPT_U8 WriteCacheEnabled: 1;
662 HPT_U8 TCQSupported: 1;
663 HPT_U8 TCQEnabled: 1;
664 HPT_U8 NCQSupported: 1;
665 HPT_U8 NCQEnabled: 1;
666 HPT_U8 SpinUpMode: 2;
667 HPT_U8 reserved6: 6;
668 #endif
669
670 HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */
671
672 IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */
673
674 }
675 __attribute__((packed)) DEVICE_INFO, *PDEVICE_INFO;
676
677 #if HPT_INTERFACE_VERSION>=0x01020000
678 #define MAX_PARENTS_PER_DISK 8
679 /*
680 * physical device information.
681 * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data.
682 */
683 typedef struct _DEVICE_INFO_V2 {
684 HPT_U8 ControllerId; /* controller id */
685 HPT_U8 PathId; /* bus */
686 HPT_U8 TargetId; /* id */
687 HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */
688 /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */
689 HPT_U8 DeviceType; /* device type */
690 HPT_U8 UsableMode; /* highest usable mode */
691
692 #ifdef __BIG_ENDIAN_BITFIELD
693 HPT_U8 NCQEnabled: 1;
694 HPT_U8 NCQSupported: 1;
695 HPT_U8 TCQEnabled: 1;
696 HPT_U8 TCQSupported: 1;
697 HPT_U8 WriteCacheEnabled: 1;
698 HPT_U8 WriteCacheSupported: 1;
699 HPT_U8 ReadAheadEnabled: 1;
700 HPT_U8 ReadAheadSupported: 1;
701 HPT_U8 reserved6: 6;
702 HPT_U8 SpinUpMode: 2;
703 #else
704 HPT_U8 ReadAheadSupported: 1;
705 HPT_U8 ReadAheadEnabled: 1;
706 HPT_U8 WriteCacheSupported: 1;
707 HPT_U8 WriteCacheEnabled: 1;
708 HPT_U8 TCQSupported: 1;
709 HPT_U8 TCQEnabled: 1;
710 HPT_U8 NCQSupported: 1;
711 HPT_U8 NCQEnabled: 1;
712 HPT_U8 SpinUpMode: 2;
713 HPT_U8 reserved6: 6;
714 #endif
715
716 HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */
717
718 IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */
719
720 HPT_U64 TotalFree;
721 HPT_U64 MaxFree;
722 HPT_U64 BadSectors;
723 DEVICEID ParentArrays[MAX_PARENTS_PER_DISK];
724
725 }
726 __attribute__((packed)) DEVICE_INFO_V2, *PDEVICE_INFO_V2, DEVICE_INFO_V3, *PDEVICE_INFO_V3;
727
728 /*
729 * HPT601 information
730 */
731 #endif
732 /*
733 * HPT601 information
734 */
735 #define HPT601_INFO_DEVICEID 1
736 #define HPT601_INFO_TEMPERATURE 2
737 #define HPT601_INFO_FANSTATUS 4
738 #define HPT601_INFO_BEEPERCONTROL 8
739 #define HPT601_INFO_LED1CONTROL 0x10
740 #define HPT601_INFO_LED2CONTROL 0x20
741 #define HPT601_INFO_POWERSTATUS 0x40
742
743 typedef struct _HPT601_INFO_ {
744 HPT_U16 ValidFields; /* mark valid fields below */
745 HPT_U16 DeviceId; /* 0x5A3E */
746 HPT_U16 Temperature; /* Read: temperature sensor value. Write: temperature limit */
747 HPT_U16 FanStatus; /* Fan status */
748 HPT_U16 BeeperControl; /* bit4: beeper control bit. bit0-3: frequency bits */
749 HPT_U16 LED1Control; /* bit4: twinkling control bit. bit0-3: frequency bits */
750 HPT_U16 LED2Control; /* bit4: twinkling control bit. bit0-3: frequency bits */
751 HPT_U16 PowerStatus; /* 1: has power 2: no power */
752 } HPT601_INFO, *PHPT601_INFO;
753
754 #if HPT_INTERFACE_VERSION>=0x01010000
755 #ifndef __KERNEL__
756 /* cache policy for each vdev, copied from ldm.h */
757 #define CACHE_POLICY_NONE 0
758 #define CACHE_POLICY_WRITE_THROUGH 1
759 #define CACHE_POLICY_WRITE_BACK 2
760
761 #endif
762 #endif
763 /*
764 * Logical device information.
765 * Union of ArrayInfo and DeviceInfo.
766 * Common properties will be put in logical device information.
767 */
768 typedef struct _LOGICAL_DEVICE_INFO {
769 HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */
770 HPT_U8 reserved[3];
771
772 HPT_U32 Capacity; /* array capacity */
773 DEVICEID ParentArray;
774
775 union {
776 HPT_ARRAY_INFO array;
777 DEVICE_INFO device;
778 } __attribute__((packed)) u;
779
780 } __attribute__((packed)) LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO;
781
782 #if HPT_INTERFACE_VERSION>=0x01010000
783 typedef struct _LOGICAL_DEVICE_INFO_V2 {
784 HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */
785 HPT_U8 reserved[3];
786
787 HPT_U64 Capacity; /* array capacity */
788 DEVICEID ParentArray; /* for physical device, Please don't use this field.
789 * use ParentArrays field in DEVICE_INFO_V2
790 */
791
792 union {
793 HPT_ARRAY_INFO_V2 array;
794 DEVICE_INFO device;
795 } __attribute__((packed)) u;
796
797 } __attribute__((packed)) LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2;
798 #endif
799
800 #if HPT_INTERFACE_VERSION>=0x01020000
801 #define INVALID_TARGET_ID 0xFF
802 #define INVALID_BUS_ID 0xFF
803 typedef struct _LOGICAL_DEVICE_INFO_V3 {
804 HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */
805 HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */
806 HPT_U8 VBusId; /* vbus sequence in vbus_list */
807 HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */
808 /* OS disk name: HPT DISK $VBusId_$TargetId */
809 HPT_U64 Capacity; /* array capacity */
810 DEVICEID ParentArray; /* for physical device, don't use this field.
811 * use ParentArrays field in DEVICE_INFO_V2 instead.
812 */
813 HPT_U32 TotalIOs;
814 HPT_U32 TobalMBs;
815 HPT_U32 IOPerSec;
816 HPT_U32 MBPerSec;
817
818 union {
819 HPT_ARRAY_INFO_V3 array;
820 DEVICE_INFO_V2 device;
821 } __attribute__((packed)) u;
822
823 }
824 __attribute__((packed)) LOGICAL_DEVICE_INFO_V3, *PLOGICAL_DEVICE_INFO_V3;
825 #endif
826
827 #if HPT_INTERFACE_VERSION>=0x02000001
828 typedef struct _LOGICAL_DEVICE_INFO_V4 {
829 HPT_U32 dwSize;
830 HPT_U8 revision;
831 HPT_U8 reserved[7];
832
833 HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */
834 HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */
835 HPT_U8 VBusId; /* vbus sequence in vbus_list */
836 HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */
837 /* OS disk name: HPT DISK $VBusId_$TargetId */
838 HPT_U64 Capacity; /* array capacity */
839 DEVICEID ParentArray; /* for physical device, don't use this field.
840 * use ParentArrays field in DEVICE_INFO_V2 instead.
841 */
842 HPT_U32 TotalIOs;
843 HPT_U32 TobalMBs;
844 HPT_U32 IOPerSec;
845 HPT_U32 MBPerSec;
846
847 union {
848 HPT_ARRAY_INFO_V4 array;
849 DEVICE_INFO_V3 device;
850 } __attribute__((packed)) u;
851 }
852 __attribute__((packed)) LOGICAL_DEVICE_INFO_V4, *PLOGICAL_DEVICE_INFO_V4;
853
854 /*LOGICAL_DEVICE_INFO_V4 max revision number*/
855 #define LOGICAL_DEVICE_INFO_V4_REVISION 0
856 /*If new revision was defined please check evey revision size*/
857 #define LOGICAL_DEVICE_INFO_V4_R0_SIZE (sizeof(LOGICAL_DEVICE_INFO_V4))
858 #endif
859
860 /*
861 * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info()
862 * and set_device_info().
863 * When set_xxx_info() is called, the ValidFields member indicates which
864 * fields in the structure are valid.
865 */
866 /* field masks */
867 #define AAIF_NAME 1
868 #define AAIF_DESCRIPTION 2
869
870 #define ADIF_MODE 1
871 #define ADIF_TCQ 2
872 #define ADIF_NCQ 4
873 #define ADIF_WRITE_CACHE 8
874 #define ADIF_READ_AHEAD 0x10
875 #define ADIF_SPIN_UP_MODE 0x20
876
877 typedef struct _ALTERABLE_ARRAY_INFO {
878 HPT_U32 ValidFields; /* mark valid fields below */
879 HPT_U8 Name[MAX_ARRAYNAME_LEN]; /* array name */
880 HPT_U8 Description[64]; /* array description */
881 }
882 ALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO;
883
884 typedef struct _ALTERABLE_DEVICE_INFO {
885 HPT_U32 ValidFields; /* mark valid fields below */
886 HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
887 }
888 ALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO;
889
890 typedef struct _ALTERABLE_DEVICE_INFO_V2 {
891 HPT_U32 ValidFields; /* mark valid fields below */
892 HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
893 HPT_U8 TCQEnabled;
894 HPT_U8 NCQEnabled;
895 HPT_U8 WriteCacheEnabled;
896 HPT_U8 ReadAheadEnabled;
897 HPT_U8 SpinUpMode;
898 HPT_U8 reserve[2];
899 HPT_U32 reserve2[13]; /* pad to 64 bytes */
900 }
901 ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2;
902
903 #if HPT_INTERFACE_VERSION>=0x01020000
904
905 #define TARGET_TYPE_DEVICE 0
906 #define TARGET_TYPE_ARRAY 1
907
908
909 #define AIT_NAME 0
910 #define AIT_DESCRIPTION 1
911 #define AIT_CACHE_POLICY 2
912
913
914 #define DIT_MODE 0
915 #define DIT_READ_AHEAD 1
916 #define DIT_WRITE_CACHE 2
917 #define DIT_TCQ 3
918 #define DIT_NCQ 4
919
920 /* param type is determined by target_type and info_type*/
921 typedef struct _SET_DEV_INFO
922 {
923 HPT_U8 target_type;
924 HPT_U8 infor_type;
925 HPT_U16 param_length;
926 #define SET_VDEV_INFO_param(p) ((HPT_U8 *)(p)+sizeof(SET_VDEV_INFO))
927 /* HPT_U8 param[0]; */
928 } SET_VDEV_INFO, * PSET_VDEV_INFO;
929
930 typedef HPT_U8 PARAM_ARRAY_NAME[MAX_ARRAYNAME_LEN] ;
931 typedef HPT_U8 PARAM_ARRAY_DES[64];
932 typedef HPT_U8 PARAM_DEVICE_MODE, PARAM_TCQ, PARAM_NCQ, PARAM_READ_AHEAD, PARAM_WRITE_CACHE, PARAM_CACHE_POLICY;
933
934 #endif
935
936 /*
937 * CREATE_ARRAY_PARAMS
938 * Param structure used to create an array.
939 */
940 typedef struct _CREATE_ARRAY_PARAMS {
941 HPT_U8 ArrayType; /* 1-level array type */
942 HPT_U8 nDisk; /* number of elements in Members[] array */
943 HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
944 HPT_U8 CreateFlags; /* See CAF_xxx */
945
946 HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */
947 HPT_U8 Description[64]; /* array description */
948 HPT_U8 CreateManager[16]; /* who created it */
949 TIME_RECORD CreateTime; /* when created it */
950
951 HPT_U32 Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */
952
953 } CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS;
954
955 #if HPT_INTERFACE_VERSION>=0x01010000
956 typedef struct _CREATE_ARRAY_PARAMS_V2 {
957 HPT_U8 ArrayType; /* 1-level array type */
958 HPT_U8 nDisk; /* number of elements in Members[] array */
959 HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
960 HPT_U8 CreateFlags; /* See CAF_xxx */
961
962 HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */
963 HPT_U8 Description[64]; /* array description */
964 HPT_U8 CreateManager[16]; /* who created it */
965 TIME_RECORD CreateTime; /* when created it */
966 HPT_U64 Capacity;
967
968 HPT_U32 Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */
969
970 } CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2;
971 #endif
972
973 #if HPT_INTERFACE_VERSION>=0x02000001
974 typedef struct _CREATE_ARRAY_PARAMS_V3 {
975 HPT_U32 dwSize;
976 HPT_U8 revision; /*CREATE_ARRAY_PARAMS_V3_REVISION*/
977 HPT_U8 reserved[7];
978 HPT_U8 ArrayType; /* 1-level array type */
979 HPT_U8 nDisk; /* number of elements in Members[] array */
980 HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
981 HPT_U8 CreateFlags; /* See CAF_xxx */
982
983 HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */
984 HPT_U8 Description[64]; /* array description */
985 HPT_U8 CreateManager[16]; /* who created it */
986 TIME_RECORD CreateTime; /* when created it */
987 HPT_U64 Capacity;
988
989 HPT_U32 Members[MAX_ARRAY_MEMBERS_V3];/* ID of array members, a member can be an array */
990 } CREATE_ARRAY_PARAMS_V3, *PCREATE_ARRAY_PARAMS_V3;
991
992 /*CREATE_ARRAY_PARAMS_V3 current max revision*/
993 #define CREATE_ARRAY_PARAMS_V3_REVISION 0
994 /*If new revision defined please check evey revision size*/
995 #define CREATE_ARRAY_PARAMS_V3_R0_SIZE (sizeof(CREATE_ARRAY_PARAMS_V3))
996 #endif
997
998 #if HPT_INTERFACE_VERSION < 0x01020000
999 /*
1000 * Flags used for creating an RAID 1 array
1001 *
1002 * CAF_CREATE_AND_DUPLICATE
1003 * Copy source disk contents to target for RAID 1. If user choose "create and duplicate"
1004 * to create an array, GUI will call CreateArray() with this flag set. Then GUI should
1005 * call hpt_get_device_info() with the returned array ID and check returned flags to
1006 * see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding
1007 * and GUI must do duplication itself.
1008 * CAF_DUPLICATE_MUST_DONE
1009 * If the duplication is aborted or fails, do not create the array.
1010 */
1011 #define CAF_CREATE_AND_DUPLICATE 1
1012 #define CAF_DUPLICATE_MUST_DONE 2
1013 #define CAF_CREATE_AS_RAID15 4
1014 /*
1015 * Flags used for creating an RAID 5 array
1016 */
1017 #define CAF_CREATE_R5_NO_BUILD 1
1018 #define CAF_CREATE_R5_ZERO_INIT 2
1019 #define CAF_CREATE_R5_BUILD_PARITY 4
1020
1021 #else
1022 /*
1023 * Flags used for creating
1024 */
1025 #define CAF_FOREGROUND_INITIALIZE 1
1026 #define CAF_BACKGROUND_INITIALIZE 2
1027 #define CAF_CREATE_R5_WRITE_BACK (CACHE_POLICY_WRITE_BACK<<CAF_CACHE_POLICY_SHIFT)
1028
1029
1030 #define CAF_CACHE_POLICY_MASK 0x1C
1031 #define CAF_CACHE_POLICY_SHIFT 2
1032
1033 #endif
1034
1035 #define CAF_KEEP_DATA_ALWAYS 0x80
1036
1037 /* Flags used for deleting an array
1038 *
1039 * DAF_KEEP_DATA_IF_POSSIBLE
1040 * If this flag is set, deleting a RAID 1 array will not destroy the data on both disks.
1041 * Deleting a JBOD should keep partitions on first disk ( not implement now ).
1042 * Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ).
1043 */
1044 #define DAF_KEEP_DATA_IF_POSSIBLE 1
1045 #define DAF_KEEP_DATA_ALWAYS 2
1046
1047 /*
1048 * event types
1049 */
1050 #define ET_DEVICE_REMOVED 1 /* device removed */
1051 #define ET_DEVICE_PLUGGED 2 /* device plugged */
1052 #define ET_DEVICE_ERROR 3 /* device I/O error */
1053 #define ET_REBUILD_STARTED 4
1054 #define ET_REBUILD_ABORTED 5
1055 #define ET_REBUILD_FINISHED 6
1056 #define ET_SPARE_TOOK_OVER 7
1057 #define ET_REBUILD_FAILED 8
1058 #define ET_VERIFY_STARTED 9
1059 #define ET_VERIFY_ABORTED 10
1060 #define ET_VERIFY_FAILED 11
1061 #define ET_VERIFY_FINISHED 12
1062 #define ET_INITIALIZE_STARTED 13
1063 #define ET_INITIALIZE_ABORTED 14
1064 #define ET_INITIALIZE_FAILED 15
1065 #define ET_INITIALIZE_FINISHED 16
1066 #define ET_VERIFY_DATA_ERROR 17
1067 #define ET_TRANSFORM_STARTED 18
1068 #define ET_TRANSFORM_ABORTED 19
1069 #define ET_TRANSFORM_FAILED 20
1070 #define ET_TRANSFORM_FINISHED 21
1071 #define ET_SMART_FAILED 22
1072 #define ET_SMART_PASSED 23
1073 #define ET_SECTOR_REPAIR_FAIL 24
1074 #define ET_SECTOR_REPAIR_SUCCESS 25
1075
1076 /*
1077 * event structure
1078 */
1079 typedef struct _HPT_EVENT {
1080 TIME_RECORD Time;
1081 DEVICEID DeviceID;
1082 HPT_U8 EventType;
1083 HPT_U8 reserved[3];
1084
1085 HPT_U8 Data[32]; /* various data depend on EventType */
1086 } HPT_EVENT, *PHPT_EVENT;
1087
1088 /*
1089 * IDE pass-through command. Use it at your own risk!
1090 */
1091 #ifdef _MSC_VER
1092 #pragma warning(disable:4200)
1093 #endif
1094 typedef struct _IDE_PASS_THROUGH_HEADER {
1095 DEVICEID idDisk; /* disk ID */
1096 HPT_U8 bFeaturesReg; /* feature register */
1097 HPT_U8 bSectorCountReg; /* IDE sector count register. */
1098 HPT_U8 bLbaLowReg; /* IDE LBA low value. */
1099 HPT_U8 bLbaMidReg; /* IDE LBA mid register. */
1100 HPT_U8 bLbaHighReg; /* IDE LBA high value. */
1101 HPT_U8 bDriveHeadReg; /* IDE drive/head register. */
1102 HPT_U8 bCommandReg; /* Actual IDE command. Checked for validity by driver. */
1103 HPT_U8 nSectors; /* data size in sectors, if the command has data transfer */
1104 HPT_U8 protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */
1105 HPT_U8 reserve[3];
1106 #define IDE_PASS_THROUGH_buffer(p) ((HPT_U8 *)(p) + sizeof(IDE_PASS_THROUGH_HEADER))
1107 /* HPT_U8 DataBuffer[0]; */
1108 }
1109 IDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER;
1110
1111 /*
1112 * device io packet format
1113 */
1114 typedef struct _DEVICE_IO_EX_PARAMS {
1115 DEVICEID idDisk;
1116 HPT_U32 Lba;
1117 HPT_U16 nSectors;
1118 HPT_U8 Command; /* IO_COMMAD_xxx */
1119 HPT_U8 BufferType; /* BUFFER_TYPE_xxx, see below */
1120 HPT_U32 BufferPtr;
1121 }
1122 DEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS;
1123
1124 #define BUFFER_TYPE_LOGICAL 1 /* logical pointer to buffer */
1125 #define BUFFER_TYPE_PHYSICAL 2 /* physical address of buffer */
1126 #define BUFFER_TYPE_LOGICAL_LOGICAL_SG 3 /* logical pointer to logical S/G table */
1127 #define BUFFER_TYPE_LOGICAL_PHYSICAL_SG 4 /* logical pointer to physical S/G table */
1128 #define BUFFER_TYPE_PHYSICAL_LOGICAL_SG 5 /* physical address to logical S/G table */
1129 #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */
1130 #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */
1131
1132 typedef struct _HPT_DRIVER_PARAMETER {
1133 char name[32];
1134 HPT_U8 value[32];
1135 HPT_U8 type; /* HPT_DRIVER_PARAMETER_TYPE_* */
1136 HPT_U8 persistent;
1137 HPT_U8 reserve2[2];
1138 HPT_U8 location; /* 0 - system */
1139 HPT_U8 controller;
1140 HPT_U8 bus;
1141 HPT_U8 reserve1;
1142 char desc[128];
1143 }
1144 HPT_DRIVER_PARAMETER, *PHPT_DRIVER_PARAMETER;
1145
1146 #define HPT_DRIVER_PARAMETER_TYPE_INT 1
1147 #define HPT_DRIVER_PARAMETER_TYPE_BOOL 2
1148
1149
1150
1151 /*
1152 * ioctl structure
1153 */
1154 #define HPT_IOCTL_MAGIC32 0x1A2B3C4D
1155 #define HPT_IOCTL_MAGIC 0xA1B2C3D4
1156
1157 typedef struct _HPT_IOCTL_PARAM {
1158 HPT_U32 Magic; /* used to check if it's a valid ioctl packet */
1159 HPT_U32 dwIoControlCode; /* operation control code */
1160 HPT_PTR lpInBuffer; /* input data buffer */
1161 HPT_U32 nInBufferSize; /* size of input data buffer */
1162 HPT_PTR lpOutBuffer; /* output data buffer */
1163 HPT_U32 nOutBufferSize; /* size of output data buffer */
1164 HPT_PTR lpBytesReturned; /* count of HPT_U8s returned */
1165 }
1166 HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM;
1167
1168 /* for 32-bit app running on 64-bit system */
1169 typedef struct _HPT_IOCTL_PARAM32 {
1170 HPT_U32 Magic;
1171 HPT_U32 dwIoControlCode;
1172 HPT_U32 lpInBuffer;
1173 HPT_U32 nInBufferSize;
1174 HPT_U32 lpOutBuffer;
1175 HPT_U32 nOutBufferSize;
1176 HPT_U32 lpBytesReturned;
1177 }
1178 HPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32;
1179
1180 #if !defined(__KERNEL__) || defined(SIMULATE)
1181 /*
1182 * User-mode ioctl parameter passing conventions:
1183 * The ioctl function implementation is platform specific, so we don't
1184 * have forced rules for it. However, it's suggested to use a parameter
1185 * passing method as below
1186 * 1) Put all input data continuously in an input buffer.
1187 * 2) Prepare an output buffer with enough size if needed.
1188 * 3) Fill a HPT_IOCTL_PARAM structure.
1189 * 4) Pass the structure to driver through a platform-specific method.
1190 * This is implemented in the mid-layer user-mode library. The UI
1191 * programmer needn't care about it.
1192 */
1193
1194 /************************************************************************
1195 * User mode functions
1196 ************************************************************************/
1197 /*
1198 * hpt_get_version
1199 * Version compatibility: all versions
1200 * Parameters:
1201 * None
1202 * Returns:
1203 * interface version. 0 when fail.
1204 */
1205 HPT_U32 hpt_get_version(void);
1206
1207 /*
1208 * hpt_get_driver_capabilities
1209 * Version compatibility: v1.0.0.2 or later
1210 * Parameters:
1211 * Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set
1212 * dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this
1213 * member to see if it's correct.
1214 * Returns:
1215 * 0 - Success
1216 */
1217 int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap);
1218 int hpt_get_driver_capabilities_v2(PDRIVER_CAPABILITIES_V2 cap);
1219
1220 /*
1221 * hpt_get_controller_count
1222 * Version compatibility: v1.0.0.1 or later
1223 * Parameters:
1224 * None
1225 * Returns:
1226 * number of controllers
1227 */
1228 int hpt_get_controller_count(void);
1229
1230 /* hpt_get_controller_info
1231 * Version compatibility: v1.0.0.1 or later
1232 * Parameters:
1233 * id Controller id
1234 * pInfo pointer to CONTROLLER_INFO buffer
1235 * Returns:
1236 * 0 Success, controller info is put into (*pInfo ).
1237 */
1238 int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo);
1239
1240 #if HPT_INTERFACE_VERSION>=0x01020000
1241 /* hpt_get_controller_info_v2
1242 * Version compatibility: v2.0.0.0 or later
1243 * Parameters:
1244 * id Controller id
1245 * pInfo pointer to CONTROLLER_INFO_V2 buffer
1246 * Returns:
1247 * 0 Success, controller info is put into (*pInfo ).
1248 */
1249 int hpt_get_controller_info_v2(int id, PCONTROLLER_INFO_V2 pInfo);
1250
1251 /* hpt_get_controller_info_v3
1252 * Version compatibility: v2.0.0.0 or later
1253 * Parameters:
1254 * id Controller id
1255 * pInfo pointer to CONTROLLER_INFO_V3 buffer
1256 * Returns:
1257 * 0 Success, controller info is put into (*pInfo ).
1258 */
1259 int hpt_get_controller_info_v3(int id, PCONTROLLER_INFO_V3 pInfo);
1260 #endif
1261
1262 /* hpt_get_channel_info
1263 * Version compatibility: v1.0.0.1 or later
1264 * Parameters:
1265 * id Controller id
1266 * bus bus number
1267 * pInfo pointer to CHANNEL_INFO buffer
1268 * Returns:
1269 * 0 Success, channel info is put into (*pInfo ).
1270 */
1271 int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo);
1272
1273 /* hpt_get_channel_info_v2
1274 * Version compatibility: v1.0.0.1 or later
1275 * Parameters:
1276 * id Controller id
1277 * bus bus number
1278 * pInfo pointer to CHANNEL_INFO buffer
1279 * Returns:
1280 * 0 Success, channel info is put into (*pInfo ).
1281 */
1282 int hpt_get_channel_info_v2(int id, int bus, PCHANNEL_INFO_V2 pInfo);
1283
1284 /* hpt_get_logical_devices
1285 * Version compatibility: v1.0.0.1 or later
1286 * Parameters:
1287 * pIds pointer to a DEVICEID array
1288 * nMaxCount array size
1289 * Returns:
1290 * Number of ID returned. All logical device IDs are put into pIds array.
1291 * Note: A spare disk is not a logical device.
1292 */
1293 int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount);
1294
1295 /* hpt_get_device_info
1296 * Version compatibility: v1.0.0.1 or later
1297 * Parameters:
1298 * id logical device id
1299 * pInfo pointer to LOGICAL_DEVICE_INFO structure
1300 * Returns:
1301 * 0 - Success
1302 */
1303 int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo);
1304
1305 /* hpt_create_array
1306 * Version compatibility: v1.0.0.1 or later
1307 * Parameters:
1308 * pParam pointer to CREATE_ARRAY_PARAMS structure
1309 * Returns:
1310 * 0 failed
1311 * else return array id
1312 */
1313 DEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam);
1314
1315 /* hpt_delete_array
1316 * Version compatibility: v1.0.0.1 or later
1317 * Parameters:
1318 * id array id
1319 * Returns:
1320 * 0 Success
1321 */
1322 int hpt_delete_array(DEVICEID id, HPT_U32 options);
1323
1324 /* hpt_device_io
1325 * Read/write data on array and physcal device.
1326 * Version compatibility: v1.0.0.1 or later
1327 * Parameters:
1328 * id device id. If it's an array ID, IO will be performed on the array.
1329 * If it's a physical device ID, IO will be performed on the device.
1330 * cmd IO_COMMAND_READ or IO_COMMAND_WRITE
1331 * buffer data buffer
1332 * length data size
1333 * Returns:
1334 * 0 Success
1335 */
1336 int hpt_device_io(DEVICEID id, int cmd, HPT_U32 lba, HPT_U32 nSector, void * buffer);
1337
1338 /* hpt_add_disk_to_array
1339 * Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array.
1340 * Auto-rebuild will start.
1341 * Version compatibility: v1.0.0.1 or later
1342 * Parameters:
1343 * idArray array id
1344 * idDisk disk id
1345 * Returns:
1346 * 0 Success
1347 */
1348 int hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk);
1349
1350 /* hpt_add_spare_disk
1351 * Version compatibility: v1.0.0.1 or later
1352 * Add a disk to spare pool.
1353 * Parameters:
1354 * idDisk disk id
1355 * Returns:
1356 * 0 Success
1357 */
1358 int hpt_add_spare_disk(DEVICEID idDisk);
1359
1360 /* hpt_add_dedicated_spare
1361 * Version compatibility: v1.0.0.3 or later
1362 * Add a spare disk to an array
1363 * Parameters:
1364 * idDisk disk id
1365 * idArray array id
1366 * Returns:
1367 * 0 Success
1368 */
1369 int hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray);
1370
1371 /* hpt_remove_spare_disk
1372 * remove a disk from spare pool.
1373 * Version compatibility: v1.0.0.1 or later
1374 * Parameters:
1375 * idDisk disk id
1376 * Returns:
1377 * 0 Success
1378 */
1379 int hpt_remove_spare_disk(DEVICEID idDisk);
1380
1381 /* hpt_get_event
1382 * Used to poll events from driver.
1383 * Version compatibility: v1.0.0.1 or later
1384 * Parameters:
1385 * pEvent pointer to HPT_EVENT structure
1386 * Returns:
1387 * 0 Success, event info is filled in *pEvent
1388 */
1389 int hpt_get_event(PHPT_EVENT pEvent);
1390
1391 /* hpt_rebuild_data_block
1392 * Used to copy data from source disk and mirror disk.
1393 * Version compatibility: v1.0.0.1 or later
1394 * Parameters:
1395 * idArray Array ID (RAID1, 0/1 or RAID5)
1396 * Lba Start LBA for each array member
1397 * nSector Number of sectors for each array member (RAID 5 will ignore this parameter)
1398 *
1399 * Returns:
1400 * 0 Success, event info is filled in *pEvent
1401 */
1402 int hpt_rebuild_data_block(DEVICEID idMirror, HPT_U32 Lba, HPT_U8 nSector);
1403 #define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3)
1404
1405 /* hpt_set_array_state
1406 * set array state.
1407 * Version compatibility: v1.0.0.1 or later
1408 * Parameters:
1409 * idArray Array ID
1410 * state See above 'array states' constants, possible values are:
1411 * MIRROR_REBUILD_START
1412 * Indicate that GUI wants to rebuild a mirror array
1413 * MIRROR_REBUILD_ABORT
1414 * GUI wants to abort rebuilding an array
1415 * MIRROR_REBUILD_COMPLETE
1416 * GUI finished to rebuild an array. If rebuild is done by driver this
1417 * state has no use
1418 *
1419 * Returns:
1420 * 0 Success
1421 */
1422 int hpt_set_array_state(DEVICEID idArray, HPT_U32 state);
1423
1424 /* hpt_set_array_info
1425 * set array info.
1426 * Version compatibility: v1.0.0.1 or later
1427 * Parameters:
1428 * idArray Array ID
1429 * pInfo pointer to new info
1430 *
1431 * Returns:
1432 * 0 Success
1433 */
1434 int hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo);
1435
1436 /* hpt_set_device_info
1437 * set device info.
1438 * Version compatibility: v1.0.0.1 or later
1439 * Parameters:
1440 * idDisk device ID
1441 * pInfo pointer to new info
1442 *
1443 * Returns:
1444 * 0 Success
1445 * Additional notes:
1446 * If idDisk==0, call to this function will stop buzzer on the adapter
1447 * (if supported by driver).
1448 */
1449 int hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo);
1450
1451 #if HPT_INTERFACE_VERSION >= 0x01000004
1452 int hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo);
1453 #endif
1454
1455 /* hpt_rescan_devices
1456 * rescan devices
1457 * Version compatibility: v1.0.0.1 or later
1458 * Parameters:
1459 * None
1460 * Returns:
1461 * 0 Success
1462 */
1463 int hpt_rescan_devices(void);
1464
1465 /* hpt_get_601_info
1466 * Get HPT601 status
1467 * Version compatibiilty: v1.0.0.3 or later
1468 * Parameters:
1469 * idDisk - Disk handle
1470 * PHPT601_INFO - pointer to HPT601 info buffer
1471 * Returns:
1472 * 0 Success
1473 */
1474 int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
1475
1476 /* hpt_set_601_info
1477 * HPT601 function control
1478 * Version compatibiilty: v1.0.0.3 or later
1479 * Parameters:
1480 * idDisk - Disk handle
1481 * PHPT601_INFO - pointer to HPT601 info buffer
1482 * Returns:
1483 * 0 Success
1484 */
1485 int hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
1486
1487 /* hpt_lock_device
1488 * Lock a block on a device (prevent OS accessing it)
1489 * Version compatibiilty: v1.0.0.3 or later
1490 * Parameters:
1491 * idDisk - Disk handle
1492 * Lba - Start LBA
1493 * nSectors - number of sectors
1494 * Returns:
1495 * 0 Success
1496 */
1497 int hpt_lock_device(DEVICEID idDisk, HPT_U32 Lba, HPT_U8 nSectors);
1498
1499 /* hpt_lock_device
1500 * Unlock a device
1501 * Version compatibiilty: v1.0.0.3 or later
1502 * Parameters:
1503 * idDisk - Disk handle
1504 * Returns:
1505 * 0 Success
1506 */
1507 int hpt_unlock_device(DEVICEID idDisk);
1508
1509 /* hpt_ide_pass_through
1510 * directly access controller's command and control registers.
1511 * Can only call it on physical devices.
1512 * Version compatibility: v1.0.0.3 or later
1513 * Parameters:
1514 * p - IDE_PASS_THROUGH header pointer
1515 * Returns:
1516 * 0 Success
1517 */
1518 int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
1519
1520 /* hpt_verify_data_block
1521 * verify data block on RAID1 or RAID5.
1522 * Version compatibility: v1.0.0.3 or later
1523 * Parameters:
1524 * idArray - Array ID
1525 * Lba - block number (on each array member, not logical block!)
1526 * nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1527 * Returns:
1528 * 0 Success
1529 * 1 Data compare error
1530 * 2 I/O error
1531 */
1532 int hpt_verify_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors);
1533
1534 /* hpt_initialize_data_block
1535 * initialize data block (fill with zero) on RAID5
1536 * Version compatibility: v1.0.0.3 or later
1537 * Parameters:
1538 * idArray - Array ID
1539 * Lba - block number (on each array member, not logical block!)
1540 * nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1541 * Returns:
1542 * 0 Success
1543 */
1544 int hpt_initialize_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors);
1545
1546 /* hpt_device_io_ex
1547 * extended device I/O function
1548 * Version compatibility: v1.0.0.3 or later
1549 * Parameters:
1550 * idArray - Array ID
1551 * Lba - block number (on each array member, not logical block!)
1552 * nSectors - Sectors for each member
1553 * buffer - I/O buffer or s/g address
1554 * Returns:
1555 * 0 Success
1556 */
1557 int hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param);
1558
1559 /* hpt_set_boot_mark
1560 * select boot device
1561 * Version compatibility: v1.0.0.3 or later
1562 * Parameters:
1563 * id - logical device ID. If id is 0 the boot mark will be removed.
1564 * Returns:
1565 * 0 Success
1566 */
1567 int hpt_set_boot_mark(DEVICEID id);
1568
1569 /* hpt_query_remove
1570 * check if device can be removed safely
1571 * Version compatibility: v1.0.0.4 or later
1572 * Parameters:
1573 * ndev - number of devices
1574 * pIds - device ID list
1575 * Returns:
1576 * 0 - Success
1577 * -1 - unknown error
1578 * n - the n-th device that can't be removed
1579 */
1580 int hpt_query_remove(HPT_U32 ndev, DEVICEID *pIds);
1581
1582 /* hpt_remove_devices
1583 * remove a list of devices
1584 * Version compatibility: v1.0.0.4 or later
1585 * Parameters:
1586 * ndev - number of devices
1587 * pIds - device ID list
1588 * Returns:
1589 * 0 - Success
1590 * -1 - unknown error
1591 * n - the n-th device that can't be removed
1592 */
1593 int hpt_remove_devices(HPT_U32 ndev, DEVICEID *pIds);
1594
1595 /* hpt_create_array_v2
1596 * Version compatibility: v1.1.0.0 or later
1597 * Parameters:
1598 * pParam pointer to CREATE_ARRAY_PARAMS_V2 structure
1599 * Returns:
1600 * 0 failed
1601 * else return array id
1602 */
1603 #if HPT_INTERFACE_VERSION>=0x01010000
1604 DEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam);
1605 #endif
1606
1607 /* hpt_create_array_v3
1608 * Version compatibility: v2.0.0.1 or later
1609 * Parameters:
1610 * pParam pointer to CREATE_ARRAY_PARAMS_V3 structure
1611 * Returns:
1612 * 0 failed
1613 * else return array id
1614 */
1615 #if HPT_INTERFACE_VERSION>=0x02000001
1616 DEVICEID hpt_create_array_v3(PCREATE_ARRAY_PARAMS_V3 pParam);
1617 #endif
1618
1619 /* hpt_get_device_info_v2
1620 * Version compatibility: v1.1.0.0 or later
1621 * Parameters:
1622 * id logical device id
1623 * pInfo pointer to LOGICAL_DEVICE_INFO_V2 structure
1624 * Returns:
1625 * 0 - Success
1626 */
1627 #if HPT_INTERFACE_VERSION>=0x01010000
1628 int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo);
1629 #endif
1630
1631 /* hpt_get_device_info_v3
1632 * Version compatibility: v1.2.0.0 or later
1633 * Parameters:
1634 * id logical device id
1635 * pInfo pointer to LOGICAL_DEVICE_INFO_V3 structure
1636 * Returns:
1637 * 0 - Success
1638 */
1639 #if HPT_INTERFACE_VERSION>=0x01020000
1640 int hpt_get_device_info_v3(DEVICEID id, PLOGICAL_DEVICE_INFO_V3 pInfo);
1641 #endif
1642
1643 /* hpt_get_device_info_v4
1644 * Version compatibility: v2.0.0.1 or later
1645 * Parameters:
1646 * id logical device id
1647 * pInfo pointer to LOGICAL_DEVICE_INFO_V4 structure
1648 * Returns:
1649 * 0 - Success
1650 */
1651 #if HPT_INTERFACE_VERSION>=0x02000001
1652 int hpt_get_device_info_v4(DEVICEID id, PLOGICAL_DEVICE_INFO_V4 pInfo);
1653 #endif
1654
1655 /* hpt_create_transform
1656 * create a transform instance.
1657 * Version compatibility: v2.0.0.0 or later
1658 * Parameters:
1659 * idArray - source array
1660 * destInfo - destination array info
1661 * Returns:
1662 * destination array id
1663 */
1664 #if HPT_INTERFACE_VERSION>=0x02000000
1665 DEVICEID hpt_create_transform(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V2 destInfo);
1666 #endif
1667
1668 /* hpt_create_transform_v2
1669 * create a transform instance.
1670 * Version compatibility: v2.0.0.1 or later
1671 * Parameters:
1672 * idArray - source array
1673 * destInfo - destination array info
1674 * Returns:
1675 * destination array id
1676 */
1677 #if HPT_INTERFACE_VERSION>=0x02000001
1678 DEVICEID hpt_create_transform_v2(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V3 destInfo);
1679 #endif
1680
1681 /* hpt_step_transform
1682 * move a block in a tranform progress.
1683 * This function is called by mid-layer, not GUI (which uses set_array_state instead).
1684 * Version compatibility: v2.0.0.0 or later
1685 * Parameters:
1686 * idArray - destination array ID
1687 * the source ID will be invalid when transform complete.
1688 * Returns:
1689 * 0 - Success
1690 */
1691 #if HPT_INTERFACE_VERSION>=0x02000000
1692 int hpt_step_transform(DEVICEID idArray);
1693 #endif
1694
1695 /* hpt_set_vdev_info
1696 * set information for disk or array
1697 * Version compatibility: v1.2.0.0 or later
1698 * Parameters:
1699 * dev - destination device
1700 *
1701 * Returns:
1702 * 0 - Success
1703 */
1704 #if HPT_INTERFACE_VERSION>=0x01020000
1705 int hpt_set_vdev_info(DEVICEID dev, PSET_VDEV_INFO pInfo);
1706 #endif
1707
1708 /* hpt_init_disks
1709 * initialize disks for use
1710 * Version compatibility: v2.0.0.0 or later
1711 * Parameters:
1712 * ndev - number of disks to initialize
1713 * pIds - array of DEVICEID
1714 *
1715 * Returns:
1716 * 0 - Success
1717 */
1718 #if HPT_INTERFACE_VERSION>=0x02000000
1719 int hpt_init_disks(HPT_U32 ndev, DEVICEID * pIds);
1720 #endif
1721
1722 /* hpt_calc_max_array_capacity
1723 * cap max capacity of the array user want to create or transform
1724 * Version compatibility: v1.2.0.0 or later
1725 * Parameters:
1726 * source - if transform, this is the source array, otherwise, it should be zero
1727 * destInfo - target array params
1728 * Returns:
1729 * 0 - Success
1730 * cap - max capacity of the target array
1731 */
1732 #if HPT_INTERFACE_VERSION>=0x01020000
1733 int hpt_calc_max_array_capacity(DEVICEID source, PCREATE_ARRAY_PARAMS_V2 destInfo, HPT_U64 * cap);
1734 #endif
1735
1736 /* hpt_calc_max_array_capacity_v2
1737 * cap max capacity of the array user want to create or transform
1738 * Version compatibility: v2.0.0.1 or later
1739 * Parameters:
1740 * source - if transform, this is the source array, otherwise, it should be zero
1741 * destInfo - target array params
1742 * Returns:
1743 * 0 - Success
1744 * cap - max capacity of the target array
1745 */
1746 #if HPT_INTERFACE_VERSION>=0x02000001
1747 int hpt_calc_max_array_capacity_v2(DEVICEID source, PCREATE_ARRAY_PARAMS_V3 destInfo, HPT_U64 * cap);
1748 #endif
1749
1750 /* hpt_rebuild_data_block2
1751 * Used to copy data from source disk and mirror disk.
1752 * Version compatibility: v1.1.0.0 or later
1753 * Parameters:
1754 * idArray Array ID (RAID1, 0/1 or RAID5)
1755 * Lba Start LBA for each array member
1756 * nSector Number of sectors for each array member (RAID 5 will ignore this parameter)
1757 *
1758 * Returns:
1759 * 0 Success, event info is filled in *pEvent
1760 */
1761 #if HPT_INTERFACE_VERSION>=0x01010000
1762 int hpt_rebuild_data_block_v2(DEVICEID idMirror, HPT_U64 Lba, HPT_U16 nSector);
1763 #endif
1764
1765 /* hpt_verify_data_block2
1766 * verify data block on RAID1 or RAID5.
1767 * Version compatibility: v1.1.0.0 or later
1768 * Parameters:
1769 * idArray - Array ID
1770 * Lba - block number (on each array member, not logical block!)
1771 * nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1772 * Returns:
1773 * 0 Success
1774 * 1 Data compare error
1775 * 2 I/O error
1776 */
1777 #if HPT_INTERFACE_VERSION>=0x01010000
1778 int hpt_verify_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors);
1779 #endif
1780
1781 /* hpt_initialize_data_block2
1782 * initialize data block (fill with zero) on RAID5
1783 * Version compatibility: v1.1.0.0 or later
1784 * Parameters:
1785 * idArray - Array ID
1786 * Lba - block number (on each array member, not logical block!)
1787 * nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1788 * Returns:
1789 * 0 Success
1790 */
1791 #if HPT_INTERFACE_VERSION>=0x01010000
1792 int hpt_initialize_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors);
1793 #endif
1794
1795 /* hpt_i2c_transaction
1796 * perform an transaction on i2c bus
1797 * Version compatibility: v2.0.0.0 or later
1798 * Parameters:
1799 * indata[0] - controller ID
1800 * Returns:
1801 * 0 Success
1802 */
1803 #if HPT_INTERFACE_VERSION>=0x01020000
1804 int hpt_i2c_transaction(HPT_U8 *indata, HPT_U32 inlen, HPT_U8 *outdata, HPT_U32 outlen, HPT_U32 *poutlen);
1805 #endif
1806
1807 /* hpt_get_parameter_list
1808 * get a list of driver parameters.
1809 * Version compatibility: v1.0.0.0 or later
1810 * Parameters:
1811 * location - parameter location
1812 * outBuffer - a buffer to hold the output
1813 * outBufferSize - size of outBuffer
1814 * Returns:
1815 * 0 Success
1816 * put in outBuffer a list of zero terminated parameter names. the whole list
1817 * is terminated with an additional zero byte.
1818 */
1819 int hpt_get_parameter_list(HPT_U32 location, char *outBuffer, HPT_U32 outBufferSize);
1820
1821 /* hpt_{get,set}_parameter
1822 * get/set a parameter value.
1823 * Version compatibility: v1.0.0.0 or later
1824 * Parameters:
1825 * pParam - a pointer to HPT_DRIVER_PARAMETER.
1826 * Returns:
1827 * 0 Success
1828 */
1829 int hpt_get_parameter(PHPT_DRIVER_PARAMETER pParam);
1830 int hpt_set_parameter(PHPT_DRIVER_PARAMETER pParam);
1831 int hpt_reenumerate_device(DEVICEID id);
1832
1833 #endif
1834
1835 #pragma pack()
1836
1837 #ifdef __cplusplus
1838 }
1839 #endif
1840 #endif
Cache object: ebbd8180e7b4a75df0b4f18753eb10da
|