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