1149871Sscottl/*
2149871Sscottl * Copyright (c) 2004-2005 HighPoint Technologies, Inc.
3136849Sscottl * All rights reserved.
4136849Sscottl *
5136849Sscottl * Redistribution and use in source and binary forms, with or without
6136849Sscottl * modification, are permitted provided that the following conditions
7136849Sscottl * are met:
8136849Sscottl * 1. Redistributions of source code must retain the above copyright
9136849Sscottl *    notice, this list of conditions and the following disclaimer.
10136849Sscottl * 2. Redistributions in binary form must reproduce the above copyright
11136849Sscottl *    notice, this list of conditions and the following disclaimer in the
12136849Sscottl *    documentation and/or other materials provided with the distribution.
13136849Sscottl *
14136849Sscottl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15136849Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16136849Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17136849Sscottl * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18136849Sscottl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19136849Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20136849Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21136849Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22136849Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23136849Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24136849Sscottl * SUCH DAMAGE.
25136849Sscottl *
26136849Sscottl * $FreeBSD$
27136849Sscottl */
28136849Sscottl
29136849Sscottl#ifndef HPT_INTF_H
30136849Sscottl#define HPT_INTF_H
31136849Sscottl#pragma pack(1)
32136849Sscottl
33136849Sscottl/*
34136849Sscottl * Version of this interface.
35136849Sscottl * The user mode application must first issue a hpt_get_version() call to
36136849Sscottl * check HPT_INTERFACE_VERSION. When an utility using newer version interface
37136849Sscottl * is used with old version drivers, it must call only the functions that
38136849Sscottl * driver supported.
39136849Sscottl * A new version interface should only add ioctl functions; it should implement
40136849Sscottl * all old version functions without change their definition.
41136849Sscottl */
42136849Sscottl#define __this_HPT_INTERFACE_VERSION 0x01010000
43136849Sscottl
44136849Sscottl#ifndef HPT_INTERFACE_VERSION
45136849Sscottl#error "You must define HPT_INTERFACE_VERSION you implemented"
46136849Sscottl#endif
47136849Sscottl
48136849Sscottl#if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION
49136849Sscottl#error "HPT_INTERFACE_VERSION is invalid"
50136849Sscottl#endif
51136849Sscottl
52136849Sscottl/*
53136849Sscottl * DEFINITION
54136849Sscottl *   Logical device  --- a device that can be accessed by OS.
55136849Sscottl *   Physical device --- device attached to the controller.
56136849Sscottl *  A logical device can be simply a physical device.
57136849Sscottl *
58136849Sscottl * Each logical and physical device has a 32bit ID. GUI will use this ID
59136849Sscottl * to identify devices.
60136849Sscottl *   1. The ID must be unique.
61136849Sscottl *   2. The ID must be immutable. Once an ID is assigned to a device, it
62136849Sscottl * must not change when system is running and the device exists.
63136849Sscottl *   3. The ID of logical device must be NOT reusable. If a device is
64136849Sscottl * removed, other newly created logical device must not use the same ID.
65136849Sscottl *   4. The ID must not be zero or 0xFFFFFFFF.
66136849Sscottl */
67136849Sscottltypedef DWORD DEVICEID;
68136849Sscottl
69136849Sscottl/*
70136849Sscottl * logical device type.
71136849Sscottl * Identify array (logical device) and physical device.
72136849Sscottl */
73136849Sscottl#define LDT_ARRAY   1
74136849Sscottl#define LDT_DEVICE  2
75136849Sscottl
76136849Sscottl/*
77136849Sscottl * Array types
78136849Sscottl * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0.
79136849Sscottl * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0.
80136849Sscottl * Their members may be another array of type RAID0 or RAID1.
81136849Sscottl */
82136849Sscottl#define AT_UNKNOWN  0
83136849Sscottl#define AT_RAID0    1
84136849Sscottl#define AT_RAID1    2
85136849Sscottl#define AT_RAID5    3
86136849Sscottl#define AT_JBOD     7
87136849Sscottl
88136849Sscottl/*
89136849Sscottl * physical device type
90136849Sscottl */
91136849Sscottl#define PDT_UNKNOWN     0
92136849Sscottl#define PDT_HARDDISK    1
93136849Sscottl#define PDT_CDROM       2
94136849Sscottl#define PDT_TAPE        3
95136849Sscottl
96136849Sscottl/*
97136849Sscottl * Some constants.
98136849Sscottl */
99136849Sscottl#define MAX_NAME_LENGTH     36
100136849Sscottl#define MAX_ARRAYNAME_LEN   16
101136849Sscottl
102136849Sscottl#define MAX_ARRAY_MEMBERS_V1 8
103136849Sscottl#define MAX_ARRAY_MEMBERS_V2 16
104136849Sscottl/* keep definition for source code compatiblity */
105136849Sscottl#define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
106136849Sscottl
107136849Sscottl/*
108136849Sscottl * io commands
109136849Sscottl * GUI use these commands to do IO on logical/physical devices.
110136849Sscottl */
111136849Sscottl#define IO_COMMAND_READ     1
112136849Sscottl#define IO_COMMAND_WRITE    2
113136849Sscottl
114136849Sscottl/*
115136849Sscottl * array flags
116136849Sscottl */
117136849Sscottl#define ARRAY_FLAG_DISABLED         0x00000001 /* The array is disabled */
118136849Sscottl#define ARRAY_FLAG_NEEDBUILDING     0x00000002 /* array need synchronizing */
119136849Sscottl#define ARRAY_FLAG_REBUILDING       0x00000004 /* array is in rebuilding process */
120136849Sscottl#define ARRAY_FLAG_BROKEN           0x00000008 /* broken but may still working */
121136849Sscottl#define ARRAY_FLAG_BOOTDISK         0x00000010 /* array has a active partition */
122136849Sscottl#define ARRAY_FLAG_NEWLY_CREATED    0x00000020 /* a newly created array */
123136849Sscottl#define ARRAY_FLAG_BOOTMARK         0x00000040 /* array has boot mark set */
124136849Sscottl#define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */
125136849Sscottl#define ARRAY_FLAG_VERIFYING        0x00000100 /* is being verified */
126136849Sscottl#define ARRAY_FLAG_INITIALIZING     0x00000200 /* is being initialized */
127136849Sscottl#define ARRAY_FLAG_RAID15PLUS       0x80000000 /* display this RAID 1 as RAID 1.5 */
128136849Sscottl
129136849Sscottl/*
130136849Sscottl * device flags
131136849Sscottl */
132136849Sscottl#define DEVICE_FLAG_DISABLED        0x00000001 /* device is disabled */
133136849Sscottl#define DEVICE_FLAG_BOOTDISK        0x00000002 /* disk has a active partition */
134136849Sscottl#define DEVICE_FLAG_BOOTMARK        0x00000004 /* disk has boot mark set */
135136849Sscottl#define DEVICE_FLAG_WITH_601        0x00000008 /* has HPT601 connected */
136136849Sscottl#define DEVICE_FLAG_SATA            0x00000010 /* S-ATA device */
137136849Sscottl#define DEVICE_FLAG_IS_SPARE        0x80000000 /* is a spare disk */
138136849Sscottl
139136849Sscottl/*
140136849Sscottl * array states used by hpt_set_array_state()
141136849Sscottl */
142136849Sscottl/* old defines */
143136849Sscottl#define MIRROR_REBUILD_START    1
144136849Sscottl#define MIRROR_REBUILD_ABORT    2
145136849Sscottl#define MIRROR_REBUILD_COMPLETE 3
146136849Sscottl/* new defines */
147136849Sscottl#define AS_REBUILD_START 1
148136849Sscottl#define AS_REBUILD_ABORT 2
149136849Sscottl#define AS_REBUILD_PAUSE AS_REBUILD_ABORT
150136849Sscottl#define AS_REBUILD_COMPLETE 3
151136849Sscottl#define AS_VERIFY_START 4
152136849Sscottl#define AS_VERIFY_ABORT 5
153136849Sscottl#define AS_VERIFY_COMPLETE 6
154136849Sscottl#define AS_INITIALIZE_START 7
155136849Sscottl#define AS_INITIALIZE_ABORT 8
156136849Sscottl#define AS_INITIALIZE_COMPLETE 9
157136849Sscottl#define AS_VERIFY_FAILED 10
158136849Sscottl#define AS_REBUILD_STOP 11
159136849Sscottl#define AS_SAVE_STATE	12
160136849Sscottl/************************************************************************
161136849Sscottl * ioctl code
162136849Sscottl * It would be better if ioctl code are the same on different platforms,
163136849Sscottl * but we must not conflict with system defined ioctl code.
164136849Sscottl ************************************************************************/
165190809Sdelphij#if defined(LINUX) || defined(__FreeBSD_version)
166136849Sscottl#define HPT_CTL_CODE(x) (x+0xFF00)
167136849Sscottl#elif defined(_MS_WIN32_) || defined(WIN32)
168136849Sscottl
169136849Sscottl#ifndef CTL_CODE
170136849Sscottl#define CTL_CODE( DeviceType, Function, Method, Access ) \
171136849Sscottl			(((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
172136849Sscottl#endif
173136849Sscottl#define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0)
174136849Sscottl#define HPT_CTL_CODE_WIN32_TO_I960(x) ((((x) & 0xffff)>>2)-0x900)
175136849Sscottl
176136849Sscottl#else
177136849Sscottl#define HPT_CTL_CODE(x) (x)
178136849Sscottl#endif
179136849Sscottl
180136849Sscottl#define HPT_IOCTL_GET_VERSION               HPT_CTL_CODE(0)
181136849Sscottl#define HPT_IOCTL_GET_CONTROLLER_COUNT      HPT_CTL_CODE(1)
182136849Sscottl#define HPT_IOCTL_GET_CONTROLLER_INFO       HPT_CTL_CODE(2)
183136849Sscottl#define HPT_IOCTL_GET_CHANNEL_INFO          HPT_CTL_CODE(3)
184136849Sscottl#define HPT_IOCTL_GET_LOGICAL_DEVICES       HPT_CTL_CODE(4)
185136849Sscottl#define HPT_IOCTL_GET_DEVICE_INFO           HPT_CTL_CODE(5)
186136849Sscottl#define HPT_IOCTL_CREATE_ARRAY              HPT_CTL_CODE(6)
187136849Sscottl#define HPT_IOCTL_DELETE_ARRAY              HPT_CTL_CODE(7)
188136849Sscottl#define HPT_IOCTL_ARRAY_IO                  HPT_CTL_CODE(8)
189136849Sscottl#define HPT_IOCTL_DEVICE_IO                 HPT_CTL_CODE(9)
190136849Sscottl#define HPT_IOCTL_GET_EVENT                 HPT_CTL_CODE(10)
191136849Sscottl#define HPT_IOCTL_REBUILD_MIRROR            HPT_CTL_CODE(11)
192136849Sscottl/* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */
193136849Sscottl#define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR
194136849Sscottl#define HPT_IOCTL_ADD_SPARE_DISK            HPT_CTL_CODE(12)
195136849Sscottl#define HPT_IOCTL_REMOVE_SPARE_DISK         HPT_CTL_CODE(13)
196136849Sscottl#define HPT_IOCTL_ADD_DISK_TO_ARRAY         HPT_CTL_CODE(14)
197136849Sscottl#define HPT_IOCTL_SET_ARRAY_STATE           HPT_CTL_CODE(15)
198136849Sscottl#define HPT_IOCTL_SET_ARRAY_INFO            HPT_CTL_CODE(16)
199136849Sscottl#define HPT_IOCTL_SET_DEVICE_INFO           HPT_CTL_CODE(17)
200136849Sscottl#define HPT_IOCTL_RESCAN_DEVICES            HPT_CTL_CODE(18)
201136849Sscottl#define HPT_IOCTL_GET_DRIVER_CAPABILITIES   HPT_CTL_CODE(19)
202136849Sscottl#define HPT_IOCTL_GET_601_INFO              HPT_CTL_CODE(20)
203136849Sscottl#define HPT_IOCTL_SET_601_INFO              HPT_CTL_CODE(21)
204136849Sscottl#define HPT_IOCTL_LOCK_DEVICE               HPT_CTL_CODE(22)
205136849Sscottl#define HPT_IOCTL_UNLOCK_DEVICE             HPT_CTL_CODE(23)
206136849Sscottl#define HPT_IOCTL_IDE_PASS_THROUGH          HPT_CTL_CODE(24)
207136849Sscottl#define HPT_IOCTL_VERIFY_DATA_BLOCK         HPT_CTL_CODE(25)
208136849Sscottl#define HPT_IOCTL_INITIALIZE_DATA_BLOCK     HPT_CTL_CODE(26)
209136849Sscottl#define HPT_IOCTL_ADD_DEDICATED_SPARE       HPT_CTL_CODE(27)
210136849Sscottl#define HPT_IOCTL_DEVICE_IO_EX              HPT_CTL_CODE(28)
211136849Sscottl#define HPT_IOCTL_SET_BOOT_MARK             HPT_CTL_CODE(29)
212136849Sscottl#define HPT_IOCTL_QUERY_REMOVE              HPT_CTL_CODE(30)
213136849Sscottl#define HPT_IOCTL_REMOVE_DEVICES            HPT_CTL_CODE(31)
214136849Sscottl#define HPT_IOCTL_CREATE_ARRAY_V2           HPT_CTL_CODE(32)
215136849Sscottl#define HPT_IOCTL_GET_DEVICE_INFO_V2        HPT_CTL_CODE(33)
216136849Sscottl#define HPT_IOCTL_SET_DEVICE_INFO_V2        HPT_CTL_CODE(34)
217136849Sscottl#define HPT_IOCTL_REBUILD_DATA_BLOCK_V2     HPT_CTL_CODE(35)
218136849Sscottl#define HPT_IOCTL_VERIFY_DATA_BLOCK_V2      HPT_CTL_CODE(36)
219136849Sscottl#define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2  HPT_CTL_CODE(37)
220136849Sscottl#define HPT_IOCTL_LOCK_DEVICE_V2            HPT_CTL_CODE(38)
221136849Sscottl#define HPT_IOCTL_DEVICE_IO_V2              HPT_CTL_CODE(39)
222136849Sscottl#define HPT_IOCTL_DEVICE_IO_EX_V2           HPT_CTL_CODE(40)
223136849Sscottl
224190809Sdelphij#define HPT_IOCTL_I2C_TRANSACTION           HPT_CTL_CODE(48)
225190809Sdelphij#define HPT_IOCTL_GET_PARAMETER_LIST        HPT_CTL_CODE(49)
226190809Sdelphij#define HPT_IOCTL_GET_PARAMETER             HPT_CTL_CODE(50)
227190809Sdelphij#define HPT_IOCTL_SET_PARAMETER             HPT_CTL_CODE(51)
228190809Sdelphij
229136849Sscottl/* Windows only */
230136849Sscottl#define HPT_IOCTL_GET_CONTROLLER_IDS        HPT_CTL_CODE(100)
231136849Sscottl#define HPT_IOCTL_GET_DCB                   HPT_CTL_CODE(101)
232136849Sscottl#define	HPT_IOCTL_EPROM_IO                  HPT_CTL_CODE(102)
233136849Sscottl#define	HPT_IOCTL_GET_CONTROLLER_VENID      HPT_CTL_CODE(103)
234136849Sscottl
235136849Sscottl/************************************************************************
236136849Sscottl * shared data structures
237136849Sscottl ************************************************************************/
238136849Sscottl
239136849Sscottl/*
240136849Sscottl * Chip Type
241136849Sscottl */
242136849Sscottl#define CHIP_TYPE_HPT366      1
243136849Sscottl#define CHIP_TYPE_HPT368      2
244136849Sscottl#define CHIP_TYPE_HPT370      3
245136849Sscottl#define CHIP_TYPE_HPT370A     4
246136849Sscottl#define CHIP_TYPE_HPT370B     5
247136849Sscottl#define CHIP_TYPE_HPT374      6
248136849Sscottl#define CHIP_TYPE_HPT372      7
249136849Sscottl#define CHIP_TYPE_HPT372A     8
250136849Sscottl#define CHIP_TYPE_HPT302      9
251136849Sscottl#define CHIP_TYPE_HPT371      10
252136849Sscottl#define CHIP_TYPE_HPT372N     11
253136849Sscottl#define CHIP_TYPE_HPT302N     12
254136849Sscottl#define CHIP_TYPE_HPT371N     13
255136849Sscottl#define CHIP_TYPE_SI3112A     14
256136849Sscottl#define CHIP_TYPE_ICH5        15
257136849Sscottl#define CHIP_TYPE_ICH5R       16
258136849Sscottl
259136849Sscottl/*
260136849Sscottl * Chip Flags
261136849Sscottl */
262136849Sscottl#define CHIP_SUPPORT_ULTRA_66   0x20
263136849Sscottl#define CHIP_SUPPORT_ULTRA_100  0x40
264136849Sscottl#define CHIP_HPT3XX_DPLL_MODE   0x80
265136849Sscottl#define CHIP_SUPPORT_ULTRA_133  0x01
266136849Sscottl#define CHIP_SUPPORT_ULTRA_150  0x02
267136849Sscottl
268136849Sscottltypedef struct _DRIVER_CAPABILITIES {
269136849Sscottl	DWORD dwSize;
270136849Sscottl
271136849Sscottl	UCHAR MaximumControllers;           /* maximum controllers the driver can support */
272136849Sscottl	UCHAR SupportCrossControllerRAID;   /* 1-support, 0-not support */
273136849Sscottl	UCHAR MinimumBlockSizeShift;        /* minimum block size shift */
274136849Sscottl	UCHAR MaximumBlockSizeShift;        /* maximum block size shift */
275136849Sscottl
276136849Sscottl	UCHAR SupportDiskModeSetting;
277136849Sscottl	UCHAR SupportSparePool;
278136849Sscottl	UCHAR MaximumArrayNameLength;
279136849Sscottl	/* only one byte left here! */
280136849Sscottl#ifdef __BIG_ENDIAN_BITFIELD
281136849Sscottl	UCHAR reserved: 4;
282136849Sscottl	UCHAR SupportHotSwap: 1;
283136849Sscottl	UCHAR HighPerformanceRAID1: 1;
284136849Sscottl	UCHAR RebuildProcessInDriver: 1;
285136849Sscottl	UCHAR SupportDedicatedSpare: 1;
286136849Sscottl#else
287136849Sscottl	UCHAR SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */
288136849Sscottl	UCHAR RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */
289136849Sscottl	UCHAR HighPerformanceRAID1: 1; /* Support RAID1.5 */
290136849Sscottl	UCHAR SupportHotSwap: 1;
291136849Sscottl	UCHAR reserved: 4;
292136849Sscottl#endif
293136849Sscottl
294136849Sscottl	/* SupportedRAIDTypes is an array of bytes, one of each is an array type.
295136849Sscottl	 * Only non-zero values is valid. Bit0-3 represents the lower(child) level RAID type;
296136849Sscottl	 * bit4-7 represents the top level. i.e.
297136849Sscottl	 *     RAID 0/1 is (AT_RAID1<<4) | AT_RAID0
298136849Sscottl	 *     RAID 5/0 is (AT_RAID0<<4) | AT_RAID5
299136849Sscottl	 */
300136849Sscottl	UCHAR SupportedRAIDTypes[16];
301136849Sscottl	/* maximum members in an array corresponding to SupportedRAIDTypes */
302136849Sscottl	UCHAR MaximumArrayMembers[16];
303136849Sscottl}
304136849SscottlDRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES;
305136849Sscottl
306136849Sscottl/*
307136849Sscottl * Controller information.
308136849Sscottl */
309136849Sscottltypedef struct _CONTROLLER_INFO {
310136849Sscottl	UCHAR ChipType;                     /* chip type */
311136849Sscottl	UCHAR InterruptLevel;               /* IRQ level */
312136849Sscottl	UCHAR NumBuses;                     /* bus count */
313136849Sscottl	UCHAR ChipFlags;
314136849Sscottl
315136849Sscottl	UCHAR szProductID[MAX_NAME_LENGTH]; /* product name */
316136849Sscottl	UCHAR szVendorID[MAX_NAME_LENGTH];  /* vender name */
317136849Sscottl
318136849Sscottl} CONTROLLER_INFO, *PCONTROLLER_INFO;
319136849Sscottl
320136849Sscottl/*
321136849Sscottl * Channel information.
322136849Sscottl */
323136849Sscottltypedef struct _CHANNEL_INFO {
324136849Sscottl	ULONG       IoPort;         /* IDE Base Port Address */
325136849Sscottl	ULONG       ControlPort;    /* IDE Control Port Address */
326136849Sscottl
327136849Sscottl	DEVICEID    Devices[2];     /* device connected to this channel */
328136849Sscottl
329136849Sscottl} CHANNEL_INFO, *PCHANNEL_INFO;
330136849Sscottl
331136849Sscottl/*
332136849Sscottl * time represented in DWORD format
333136849Sscottl */
334136849Sscottl#ifndef __KERNEL__
335136849Sscottltypedef struct _TIME_RECORD {
336136849Sscottl   UINT        seconds:6;      /* 0 - 59 */
337136849Sscottl   UINT        minutes:6;      /* 0 - 59 */
338136849Sscottl   UINT        month:4;        /* 1 - 12 */
339136849Sscottl   UINT        hours:6;        /* 0 - 59 */
340136849Sscottl   UINT        day:5;          /* 1 - 31 */
341136849Sscottl   UINT        year:5;         /* 0=2000, 31=2031 */
342136849Sscottl} TIME_RECORD;
343136849Sscottl#endif
344136849Sscottl
345136849Sscottl/*
346136849Sscottl * Array information.
347136849Sscottl */
348136849Sscottltypedef struct _HPT_ARRAY_INFO {
349136849Sscottl	UCHAR       Name[MAX_ARRAYNAME_LEN];/* array name */
350136849Sscottl	UCHAR       Description[64];        /* array description */
351136849Sscottl	UCHAR       CreateManager[16];      /* who created it */
352136849Sscottl	TIME_RECORD CreateTime;             /* when created it */
353136849Sscottl
354136849Sscottl	UCHAR       ArrayType;              /* array type */
355136849Sscottl	UCHAR       BlockSizeShift;         /* stripe size */
356136849Sscottl	UCHAR       nDisk;                  /* member count: Number of ID in Members[] */
357136849Sscottl	UCHAR       reserved;
358136849Sscottl
359136849Sscottl	DWORD       Flags;                  /* working flags, see ARRAY_FLAG_XXX */
360136849Sscottl	DWORD       Members[MAX_ARRAY_MEMBERS_V1];  /* member array/disks */
361136849Sscottl
362136849Sscottl	/*
363136849Sscottl	 * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0);
364136849Sscottl	 * only valid if rebuilding is done by driver code.
365136849Sscottl	 * Member Flags will have ARRAY_FLAG_REBUILDING set at this case.
366136849Sscottl	 * Verify operation use same fields below, the only difference is
367136849Sscottl	 * ARRAY_FLAG_VERIFYING is set.
368136849Sscottl	 */
369136849Sscottl	DWORD       RebuildingProgress;
370136849Sscottl	DWORD       RebuiltSectors; /* rebuilding point (LBA) for single member */
371136849Sscottl
372136849Sscottl} HPT_ARRAY_INFO, *PHPT_ARRAY_INFO;  /*LDX modify ARRAY_INFO TO HPT_ARRAY_INFO to avoid compiling error in Windows*/
373136849Sscottl
374136849Sscottl#if HPT_INTERFACE_VERSION>=0x01010000
375136849Sscottltypedef struct _LBA64 {
376190809Sdelphij#ifdef __BIG_ENDIAN_BITFIELD
377190809Sdelphij	DWORD hi32;
378136849Sscottl	DWORD lo32;
379190809Sdelphij#else
380190809Sdelphij	DWORD lo32;
381136849Sscottl	DWORD hi32;
382190809Sdelphij#endif
383136849Sscottl}
384136849SscottlLBA64;
385136849Sscottltypedef struct _HPT_ARRAY_INFO_V2 {
386136849Sscottl	UCHAR       Name[MAX_ARRAYNAME_LEN];/* array name */
387136849Sscottl	UCHAR       Description[64];        /* array description */
388136849Sscottl	UCHAR       CreateManager[16];      /* who created it */
389136849Sscottl	TIME_RECORD CreateTime;             /* when created it */
390136849Sscottl
391136849Sscottl	UCHAR       ArrayType;              /* array type */
392136849Sscottl	UCHAR       BlockSizeShift;         /* stripe size */
393136849Sscottl	UCHAR       nDisk;                  /* member count: Number of ID in Members[] */
394136849Sscottl	UCHAR       reserved;
395136849Sscottl
396136849Sscottl	DWORD       Flags;                  /* working flags, see ARRAY_FLAG_XXX */
397136849Sscottl	DWORD       Members[MAX_ARRAY_MEMBERS_V2];  /* member array/disks */
398136849Sscottl
399136849Sscottl	DWORD       RebuildingProgress;
400136849Sscottl	LBA64       RebuiltSectors; /* rebuilding point (LBA) for single member */
401136849Sscottl
402136849Sscottl	DWORD       reserve4[4];
403136849Sscottl
404136849Sscottl} HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2;
405136849Sscottl#endif
406136849Sscottl
407136849Sscottl/*
408136849Sscottl * ATA/ATAPI Device identify data without the Reserved4.
409136849Sscottl */
410136849Sscottl#ifndef __KERNEL__
411136849Sscottltypedef struct _IDENTIFY_DATA2 {
412136849Sscottl	USHORT GeneralConfiguration;            /* 00 00 */
413136849Sscottl	USHORT NumberOfCylinders;               /* 02  1 */
414136849Sscottl	USHORT Reserved1;                       /* 04  2 */
415136849Sscottl	USHORT NumberOfHeads;                   /* 06  3 */
416136849Sscottl	USHORT UnformattedBytesPerTrack;        /* 08  4 */
417136849Sscottl	USHORT UnformattedBytesPerSector;       /* 0A  5 */
418136849Sscottl	USHORT SectorsPerTrack;                 /* 0C  6 */
419136849Sscottl	USHORT VendorUnique1[3];                /* 0E  7-9 */
420136849Sscottl	USHORT SerialNumber[10];                /* 14  10-19 */
421136849Sscottl	USHORT BufferType;                      /* 28  20 */
422136849Sscottl	USHORT BufferSectorSize;                /* 2A  21 */
423136849Sscottl	USHORT NumberOfEccBytes;                /* 2C  22 */
424136849Sscottl	USHORT FirmwareRevision[4];             /* 2E  23-26 */
425136849Sscottl	USHORT ModelNumber[20];                 /* 36  27-46 */
426136849Sscottl	UCHAR  MaximumBlockTransfer;            /* 5E  47 */
427136849Sscottl	UCHAR  VendorUnique2;                   /* 5F */
428136849Sscottl	USHORT DoubleWordIo;                    /* 60  48 */
429136849Sscottl	USHORT Capabilities;                    /* 62  49 */
430136849Sscottl	USHORT Reserved2;                       /* 64  50 */
431136849Sscottl	UCHAR  VendorUnique3;                   /* 66  51 */
432136849Sscottl	UCHAR  PioCycleTimingMode;              /* 67 */
433136849Sscottl	UCHAR  VendorUnique4;                   /* 68  52 */
434136849Sscottl	UCHAR  DmaCycleTimingMode;              /* 69 */
435136849Sscottl	USHORT TranslationFieldsValid:1;        /* 6A  53 */
436136849Sscottl	USHORT Reserved3:15;
437136849Sscottl	USHORT NumberOfCurrentCylinders;        /* 6C  54 */
438136849Sscottl	USHORT NumberOfCurrentHeads;            /* 6E  55 */
439136849Sscottl	USHORT CurrentSectorsPerTrack;          /* 70  56 */
440136849Sscottl	ULONG  CurrentSectorCapacity;           /* 72  57-58 */
441136849Sscottl	USHORT CurrentMultiSectorSetting;       /*     59 */
442136849Sscottl	ULONG  UserAddressableSectors;          /*     60-61 */
443136849Sscottl	USHORT SingleWordDMASupport : 8;        /*     62 */
444136849Sscottl	USHORT SingleWordDMAActive : 8;
445136849Sscottl	USHORT MultiWordDMASupport : 8;         /*     63 */
446136849Sscottl	USHORT MultiWordDMAActive : 8;
447136849Sscottl	USHORT AdvancedPIOModes : 8;            /*     64 */
448136849Sscottl	USHORT Reserved4 : 8;
449136849Sscottl	USHORT MinimumMWXferCycleTime;          /*     65 */
450136849Sscottl	USHORT RecommendedMWXferCycleTime;      /*     66 */
451136849Sscottl	USHORT MinimumPIOCycleTime;             /*     67 */
452136849Sscottl	USHORT MinimumPIOCycleTimeIORDY;        /*     68 */
453136849Sscottl	USHORT Reserved5[2];                    /*     69-70 */
454136849Sscottl	USHORT ReleaseTimeOverlapped;           /*     71 */
455136849Sscottl	USHORT ReleaseTimeServiceCommand;       /*     72 */
456136849Sscottl	USHORT MajorRevision;                   /*     73 */
457136849Sscottl	USHORT MinorRevision;                   /*     74 */
458136849Sscottl/*    USHORT Reserved6[14];                   //     75-88 */
459136849Sscottl} IDENTIFY_DATA2, *PIDENTIFY_DATA2;
460136849Sscottl#endif
461136849Sscottl
462136849Sscottl/*
463136849Sscottl * physical device information.
464136849Sscottl * IdentifyData.ModelNumber[] is byte-swapped from the original identify data.
465136849Sscottl */
466136849Sscottltypedef struct _DEVICE_INFO {
467136849Sscottl	UCHAR   ControllerId;           /* controller id */
468136849Sscottl	UCHAR   PathId;                 /* bus */
469136849Sscottl	UCHAR   TargetId;               /* id */
470136849Sscottl	UCHAR   DeviceModeSetting;      /* Current Data Transfer mode: 0-4 PIO 0-4 */
471136849Sscottl									/* 5-7 MW DMA0-2, 8-13 UDMA0-5             */
472136849Sscottl	UCHAR   DeviceType;             /* device type */
473136849Sscottl	UCHAR   UsableMode;             /* highest usable mode */
474136849Sscottl
475136849Sscottl	UCHAR   ReadAheadSupported: 1;
476136849Sscottl	UCHAR   ReadAheadEnabled: 1;
477136849Sscottl	UCHAR   WriteCacheSupported: 1;
478136849Sscottl	UCHAR   WriteCacheEnabled: 1;
479136849Sscottl	UCHAR   TCQSupported: 1;
480136849Sscottl	UCHAR   TCQEnabled: 1;
481136849Sscottl	UCHAR   NCQSupported: 1;
482136849Sscottl	UCHAR   NCQEnabled: 1;
483136849Sscottl	UCHAR   reserved;
484136849Sscottl
485136849Sscottl	DWORD   Flags;                  /* working flags, see DEVICE_FLAG_XXX */
486136849Sscottl
487136849Sscottl	IDENTIFY_DATA2 IdentifyData;    /* Identify Data of this device */
488136849Sscottl
489136849Sscottl} DEVICE_INFO, *PDEVICE_INFO;
490136849Sscottl
491136849Sscottl/*
492136849Sscottl * HPT601 information
493136849Sscottl */
494136849Sscottl#define HPT601_INFO_DEVICEID      1
495136849Sscottl#define HPT601_INFO_TEMPERATURE   2
496136849Sscottl#define HPT601_INFO_FANSTATUS     4
497136849Sscottl#define HPT601_INFO_BEEPERCONTROL 8
498136849Sscottl#define HPT601_INFO_LED1CONTROL   0x10
499136849Sscottl#define HPT601_INFO_LED2CONTROL   0x20
500136849Sscottl#define HPT601_INFO_POWERSTATUS   0x40
501136849Sscottl
502136849Sscottltypedef struct _HPT601_INFO {
503136849Sscottl	WORD ValidFields;       /* mark valid fields below */
504136849Sscottl	WORD DeviceId;          /* 0x5A3E */
505136849Sscottl	WORD Temperature;       /* Read: temperature sensor value. Write: temperature limit */
506136849Sscottl	WORD FanStatus;         /* Fan status */
507136849Sscottl	WORD BeeperControl;     /* bit4: beeper control bit. bit0-3: frequency bits */
508136849Sscottl	WORD LED1Control;       /* bit4: twinkling control bit. bit0-3: frequency bits */
509136849Sscottl	WORD LED2Control;       /* bit4: twinkling control bit. bit0-3: frequency bits */
510136849Sscottl	WORD PowerStatus;       /* 1: has power 2: no power */
511136849Sscottl} HPT601_INFO, *PHPT601_INFO;
512136849Sscottl
513136849Sscottl/*
514136849Sscottl * Logical device information.
515136849Sscottl * Union of ArrayInfo and DeviceInfo.
516136849Sscottl * Common properties will be put in logical device information.
517136849Sscottl */
518136849Sscottltypedef struct _LOGICAL_DEVICE_INFO {
519136849Sscottl	UCHAR       Type;                   /* LDT_ARRAY or LDT_DEVICE */
520136849Sscottl	UCHAR       reserved[3];
521136849Sscottl
522136849Sscottl	DWORD       Capacity;               /* array capacity */
523136849Sscottl	DEVICEID    ParentArray;
524136849Sscottl
525136849Sscottl	union {
526136849Sscottl		HPT_ARRAY_INFO array;
527136849Sscottl		DEVICE_INFO device;
528136849Sscottl	} u;
529136849Sscottl
530136849Sscottl} LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO;
531136849Sscottl
532136849Sscottl#if HPT_INTERFACE_VERSION>=0x01010000
533136849Sscottltypedef struct _LOGICAL_DEVICE_INFO_V2 {
534136849Sscottl	UCHAR       Type;                   /* LDT_ARRAY or LDT_DEVICE */
535136849Sscottl	UCHAR       reserved[3];
536136849Sscottl
537136849Sscottl	LBA64       Capacity;           /* array capacity */
538136849Sscottl	DEVICEID    ParentArray;
539136849Sscottl
540136849Sscottl	union {
541136849Sscottl		HPT_ARRAY_INFO_V2 array;
542136849Sscottl		DEVICE_INFO device;
543136849Sscottl	} u;
544136849Sscottl
545136849Sscottl} LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2;
546136849Sscottl#endif
547136849Sscottl
548136849Sscottl/*
549136849Sscottl * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info()
550136849Sscottl * and set_device_info().
551136849Sscottl * When set_xxx_info() is called, the ValidFields member indicates which
552136849Sscottl * fields in the structure are valid.
553136849Sscottl */
554136849Sscottl/* field masks */
555136849Sscottl#define AAIF_NAME           1
556136849Sscottl#define AAIF_DESCRIPTION    2
557136849Sscottl#define ADIF_MODE           1
558136849Sscottl#define ADIF_TCQ            2
559136849Sscottl#define ADIF_NCQ            4
560136849Sscottl#define ADIF_WRITE_CACHE    8
561136849Sscottl#define ADIF_READ_AHEAD     0x10
562136849Sscottl
563136849Sscottltypedef struct _ALTERABLE_ARRAY_INFO {
564136849Sscottl	DWORD   ValidFields;                /* mark valid fields below */
565136849Sscottl	UCHAR   Name[MAX_ARRAYNAME_LEN];    /* array name */
566136849Sscottl	UCHAR   Description[64];            /* array description */
567136849Sscottl}
568136849SscottlALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO;
569136849Sscottl
570136849Sscottltypedef struct _ALTERABLE_DEVICE_INFO {
571136849Sscottl	DWORD   ValidFields;                /* mark valid fields below */
572136849Sscottl	UCHAR   DeviceModeSetting;          /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
573136849Sscottl}
574136849SscottlALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO;
575136849Sscottl
576136849Sscottltypedef struct _ALTERABLE_DEVICE_INFO_V2 {
577136849Sscottl	DWORD   ValidFields;                /* mark valid fields below */
578136849Sscottl	UCHAR   DeviceModeSetting;          /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
579136849Sscottl	UCHAR   TCQEnabled;
580136849Sscottl	UCHAR   NCQEnabled;
581136849Sscottl	UCHAR   WriteCacheEnabled;
582136849Sscottl	UCHAR   ReadAheadEnabled;
583136849Sscottl	UCHAR   reserve[3];
584136849Sscottl	ULONG   reserve2[13]; /* pad to 64 bytes */
585136849Sscottl}
586136849SscottlALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2;
587136849Sscottl
588136849Sscottl/*
589136849Sscottl * CREATE_ARRAY_PARAMS
590136849Sscottl *  Param structure used to create an array.
591136849Sscottl */
592136849Sscottltypedef struct _CREATE_ARRAY_PARAMS {
593136849Sscottl	UCHAR ArrayType;                    /* 1-level array type */
594136849Sscottl	UCHAR nDisk;                        /* number of elements in Members[] array */
595136849Sscottl	UCHAR BlockSizeShift;               /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
596136849Sscottl	UCHAR CreateFlags;                  /* See CAF_xxx */
597136849Sscottl
598136849Sscottl	UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */
599136849Sscottl	UCHAR       Description[64];        /* array description */
600136849Sscottl	UCHAR       CreateManager[16];      /* who created it */
601136849Sscottl	TIME_RECORD CreateTime;             /* when created it */
602136849Sscottl
603136849Sscottl	DWORD Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */
604136849Sscottl
605136849Sscottl} CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS;
606136849Sscottl
607136849Sscottl#if HPT_INTERFACE_VERSION>=0x01010000
608136849Sscottltypedef struct _CREATE_ARRAY_PARAMS_V2 {
609136849Sscottl	UCHAR ArrayType;                    /* 1-level array type */
610136849Sscottl	UCHAR nDisk;                        /* number of elements in Members[] array */
611136849Sscottl	UCHAR BlockSizeShift;               /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
612136849Sscottl	UCHAR CreateFlags;                  /* See CAF_xxx */
613136849Sscottl
614136849Sscottl	UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */
615136849Sscottl	UCHAR       Description[64];        /* array description */
616136849Sscottl	UCHAR       CreateManager[16];      /* who created it */
617136849Sscottl	TIME_RECORD CreateTime;             /* when created it */
618136849Sscottl	LBA64 Capacity;                     /* specify array capacity (0 for default) */
619136849Sscottl
620136849Sscottl	DWORD Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */
621136849Sscottl
622136849Sscottl} CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2;
623136849Sscottl#endif
624136849Sscottl
625136849Sscottl/*
626136849Sscottl * Flags used for creating an RAID 1 array
627136849Sscottl *
628136849Sscottl * CAF_CREATE_AND_DUPLICATE
629136849Sscottl *    Copy source disk contents to target for RAID 1. If user choose "create and duplicate"
630136849Sscottl *    to create an array, GUI will call CreateArray() with this flag set. Then GUI should
631136849Sscottl *    call hpt_get_device_info() with the returned array ID and check returned flags to
632136849Sscottl *    see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding
633136849Sscottl *    and GUI must do duplication itself.
634136849Sscottl * CAF_DUPLICATE_MUST_DONE
635136849Sscottl *    If the duplication is aborted or fails, do not create the array.
636136849Sscottl */
637136849Sscottl#define CAF_CREATE_AND_DUPLICATE 1
638136849Sscottl#define CAF_DUPLICATE_MUST_DONE  2
639136849Sscottl#define CAF_CREATE_AS_RAID15     4
640136849Sscottl/*
641136849Sscottl * Flags used for creating an RAID 5 array
642136849Sscottl */
643136849Sscottl#define CAF_CREATE_R5_NO_BUILD     1
644136849Sscottl#define CAF_CREATE_R5_ZERO_INIT    2
645136849Sscottl#define CAF_CREATE_R5_BUILD_PARITY 4
646136849Sscottl
647136849Sscottl/*
648136849Sscottl * Flags used for deleting an array
649136849Sscottl *
650136849Sscottl * DAF_KEEP_DATA_IF_POSSIBLE
651136849Sscottl *    If this flag is set, deleting a RAID 1 array will not destroy the data on both disks.
652136849Sscottl *    Deleting a JBOD should keep partitions on first disk ( not implement now ).
653136849Sscottl *    Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ).
654136849Sscottl */
655136849Sscottl#define DAF_KEEP_DATA_IF_POSSIBLE 1
656136849Sscottl
657136849Sscottl/*
658136849Sscottl * event types
659136849Sscottl */
660136849Sscottl#define ET_DEVICE_REMOVED   1   /* device removed */
661136849Sscottl#define ET_DEVICE_PLUGGED   2   /* device plugged */
662136849Sscottl#define ET_DEVICE_ERROR     3   /* device I/O error */
663136849Sscottl#define ET_REBUILD_STARTED  4
664136849Sscottl#define ET_REBUILD_ABORTED  5
665136849Sscottl#define ET_REBUILD_FINISHED 6
666136849Sscottl#define ET_SPARE_TOOK_OVER  7
667136849Sscottl#define ET_REBUILD_FAILED   8
668136849Sscottl#define ET_VERIFY_STARTED   9
669136849Sscottl#define ET_VERIFY_ABORTED   10
670136849Sscottl#define ET_VERIFY_FAILED    11
671136849Sscottl#define ET_VERIFY_FINISHED  12
672136849Sscottl#define ET_INITIALIZE_STARTED   13
673136849Sscottl#define ET_INITIALIZE_ABORTED   14
674136849Sscottl#define ET_INITIALIZE_FAILED    15
675136849Sscottl#define ET_INITIALIZE_FINISHED  16
676136849Sscottl#define ET_VERIFY_DATA_ERROR    17
677136849Sscottl
678136849Sscottl/*
679136849Sscottl * event structure
680136849Sscottl */
681136849Sscottltypedef struct _HPT_EVENT {
682136849Sscottl	TIME_RECORD Time;
683136849Sscottl	DEVICEID    DeviceID;
684136849Sscottl	UCHAR       EventType;
685136849Sscottl	UCHAR       reserved[3];
686136849Sscottl
687136849Sscottl	UCHAR       Data[32]; /* various data depend on EventType */
688136849Sscottl} HPT_EVENT, *PHPT_EVENT;
689136849Sscottl
690136849Sscottl/*
691136849Sscottl * IDE pass-through command. Use it at your own risk!
692136849Sscottl */
693136849Sscottl#ifdef _MSC_VER
694136849Sscottl#pragma warning(disable:4200)
695136849Sscottl#endif
696136849Sscottltypedef struct _IDE_PASS_THROUGH_HEADER {
697136849Sscottl	DEVICEID idDisk;           /* disk ID */
698136849Sscottl	BYTE     bFeaturesReg;     /* feature register */
699136849Sscottl	BYTE     bSectorCountReg;  /* IDE sector count register. */
700190809Sdelphij	BYTE     bLbaLowReg; /* IDE sector number register. */
701190809Sdelphij	BYTE     bLbaMidReg;       /* IDE low order cylinder value. */
702190809Sdelphij	BYTE     bLbaHighReg;      /* IDE high order cylinder value. */
703136849Sscottl	BYTE     bDriveHeadReg;    /* IDE drive/head register. */
704136849Sscottl	BYTE     bCommandReg;      /* Actual IDE command. Checked for validity by driver. */
705190809Sdelphij	BYTE     nSectors;		/* data sze in sectors, if the command has data transfer */
706190809Sdelphij	BYTE     protocol;            /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */
707190809Sdelphij	BYTE     reserve[3];
708190809Sdelphij#define IDE_PASS_THROUGH_buffer(p) ((unsigned char *)(p) + sizeof(IDE_PASS_THROUGH_HEADER))
709136849Sscottl}
710136849SscottlIDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER;
711136849Sscottl
712136849Sscottl/*
713136849Sscottl * device io packet format
714136849Sscottl */
715136849Sscottltypedef struct _DEVICE_IO_EX_PARAMS {
716136849Sscottl	DEVICEID idDisk;
717136849Sscottl	ULONG    Lba;
718136849Sscottl	USHORT   nSectors;
719136849Sscottl	UCHAR    Command; /* IO_COMMAD_xxx */
720136849Sscottl	UCHAR    BufferType; /* BUFFER_TYPE_xxx, see below */
721136849Sscottl	ULONG    BufferPtr;
722136849Sscottl}
723136849SscottlDEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS;
724136849Sscottl
725136849Sscottl#define BUFFER_TYPE_LOGICAL              1 /* logical pointer to buffer */
726136849Sscottl#define BUFFER_TYPE_PHYSICAL             2 /* physical address of buffer */
727136849Sscottl#define BUFFER_TYPE_LOGICAL_LOGICAL_SG   3 /* logical pointer to logical S/G table */
728136849Sscottl#define BUFFER_TYPE_LOGICAL_PHYSICAL_SG  4 /* logical pointer to physical S/G table */
729136849Sscottl#define BUFFER_TYPE_PHYSICAL_LOGICAL_SG  5 /* physical address to logical S/G table */
730136849Sscottl#define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */
731136849Sscottl#define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */
732136849Sscottl
733136849Sscottl/*
734136849Sscottl * all ioctl functions should use far pointers. It's not a problem on
735136849Sscottl * 32bit platforms, however, BIOS needs care.
736136849Sscottl */
737136849Sscottl
738136849Sscottl/*
739136849Sscottl * ioctl structure
740136849Sscottl */
741190809Sdelphij#define HPT_IOCTL_MAGIC32 0x1A2B3C4D
742190809Sdelphij#define HPT_IOCTL_MAGIC   0xA1B2C3D4
743136849Sscottl
744136849Sscottltypedef struct _HPT_IOCTL_PARAM {
745136849Sscottl	DWORD   Magic;                 /* used to check if it's a valid ioctl packet */
746136849Sscottl	DWORD   dwIoControlCode;       /* operation control code */
747136849Sscottl	LPVOID  lpInBuffer;            /* input data buffer */
748136849Sscottl	DWORD   nInBufferSize;         /* size of input data buffer */
749136849Sscottl	LPVOID  lpOutBuffer;           /* output data buffer */
750136849Sscottl	DWORD   nOutBufferSize;        /* size of output data buffer */
751136849Sscottl	LPDWORD lpBytesReturned;       /* count of bytes returned */
752136849Sscottl}
753136849SscottlHPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM;
754136849Sscottl
755190809Sdelphij/* for 32-bit app running on 64-bit system */
756136849Sscottltypedef struct _HPT_IOCTL_PARAM32 {
757136849Sscottl	DWORD   Magic;
758136849Sscottl	DWORD   dwIoControlCode;
759136849Sscottl	DWORD   lpInBuffer;
760136849Sscottl	DWORD   nInBufferSize;
761136849Sscottl	DWORD   lpOutBuffer;
762136849Sscottl	DWORD   nOutBufferSize;
763136849Sscottl	DWORD   lpBytesReturned;
764136849Sscottl}
765136849SscottlHPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32;
766136849Sscottl
767136849Sscottl/*
768136849Sscottl * User-mode ioctl parameter passing conventions:
769136849Sscottl *   The ioctl function implementation is platform specific, so we don't
770136849Sscottl * have forced rules for it. However, it's suggested to use a parameter
771136849Sscottl * passing method as below
772136849Sscottl *   1) Put all input data continuously in an input buffer.
773136849Sscottl *   2) Prepare an output buffer with enough size if needed.
774136849Sscottl *   3) Fill a HPT_IOCTL_PARAM structure.
775136849Sscottl *   4) Pass the structure to driver through a platform-specific method.
776136849Sscottl * This is implemented in the mid-layer user-mode library. The UI
777136849Sscottl * programmer needn't care about it.
778136849Sscottl */
779136849Sscottl
780136849Sscottl/************************************************************************
781136849Sscottl * User mode functions
782136849Sscottl ************************************************************************/
783136849Sscottl#ifndef __KERNEL__
784136849Sscottl/*
785136849Sscottl * hpt_get_version
786136849Sscottl * Version compatibility: all versions
787136849Sscottl * Parameters:
788136849Sscottl *  None
789136849Sscottl * Returns:
790136849Sscottl *  interface version. 0 when fail.
791136849Sscottl */
792149871SscottlDWORD hpt_get_version();
793136849Sscottl
794136849Sscottl/*-------------------------------------------------------------------------- */
795136849Sscottl
796136849Sscottl/*
797136849Sscottl * hpt_get_driver_capabilities
798136849Sscottl * Version compatibility: v1.0.0.2 or later
799136849Sscottl * Parameters:
800136849Sscottl *  Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set
801136849Sscottl *  dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this
802136849Sscottl *  member to see if it's correct.
803136849Sscottl * Returns:
804136849Sscottl *  0 - Success
805136849Sscottl */
806136849Sscottlint hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap);
807136849Sscottl
808136849Sscottl/*-------------------------------------------------------------------------- */
809136849Sscottl
810136849Sscottl/*
811136849Sscottl * hpt_get_controller_count
812136849Sscottl * Version compatibility: v1.0.0.1 or later
813136849Sscottl * Parameters:
814136849Sscottl *  None
815136849Sscottl * Returns:
816136849Sscottl *  number of controllers
817136849Sscottl */
818149871Sscottlint hpt_get_controller_count();
819136849Sscottl
820136849Sscottl/*-------------------------------------------------------------------------- */
821136849Sscottl
822136849Sscottl/* hpt_get_controller_info
823136849Sscottl * Version compatibility: v1.0.0.1 or later
824136849Sscottl * Parameters:
825136849Sscottl *  id      Controller id
826136849Sscottl *  pInfo   pointer to CONTROLLER_INFO buffer
827136849Sscottl * Returns:
828136849Sscottl *  0       Success, controller info is put into (*pInfo ).
829136849Sscottl */
830136849Sscottlint hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo);
831136849Sscottl
832136849Sscottl/*-------------------------------------------------------------------------- */
833136849Sscottl
834136849Sscottl/* hpt_get_channel_info
835136849Sscottl * Version compatibility: v1.0.0.1 or later
836136849Sscottl * Parameters:
837136849Sscottl *  id      Controller id
838136849Sscottl *  bus     bus number
839136849Sscottl *  pInfo   pointer to CHANNEL_INFO buffer
840136849Sscottl * Returns:
841136849Sscottl *  0       Success, channel info is put into (*pInfo ).
842136849Sscottl */
843136849Sscottlint hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo);
844136849Sscottl
845136849Sscottl/*-------------------------------------------------------------------------- */
846136849Sscottl
847136849Sscottl/* hpt_get_logical_devices
848136849Sscottl * Version compatibility: v1.0.0.1 or later
849136849Sscottl * Parameters:
850136849Sscottl *  pIds        pointer to a DEVICEID array
851136849Sscottl *  nMaxCount   array size
852136849Sscottl * Returns:
853136849Sscottl *  Number of ID returned. All logical device IDs are put into pIds array.
854136849Sscottl *  Note: A spare disk is not a logical device.
855136849Sscottl */
856136849Sscottlint hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount);
857136849Sscottl
858136849Sscottl/*-------------------------------------------------------------------------- */
859136849Sscottl
860136849Sscottl/* hpt_get_device_info
861136849Sscottl * Version compatibility: v1.0.0.1 or later
862136849Sscottl * Parameters:
863136849Sscottl *  id      logical device id
864136849Sscottl *  pInfo   pointer to HPT_ARRAY_INFO structure
865136849Sscottl * Returns:
866136849Sscottl *  0 - Success
867136849Sscottl */
868136849Sscottlint hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo);
869136849Sscottl
870136849Sscottl#if HPT_INTERFACE_VERSION>=0x01010000
871136849Sscottlint hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo);
872136849Sscottl#endif
873136849Sscottl
874136849Sscottl/*-------------------------------------------------------------------------- */
875136849Sscottl
876136849Sscottl/* hpt_create_array
877136849Sscottl * Version compatibility: v1.0.0.1 or later
878136849Sscottl * Parameters:
879136849Sscottl *  pParam      pointer to CREATE_ARRAY_PARAMS structure
880136849Sscottl * Returns:
881136849Sscottl *  0   failed
882136849Sscottl *  else return array id
883136849Sscottl */
884136849SscottlDEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam);
885136849Sscottl
886136849Sscottl#if HPT_INTERFACE_VERSION>=0x01010000
887136849SscottlDEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam);
888136849Sscottl#endif
889136849Sscottl
890136849Sscottl/*-------------------------------------------------------------------------- */
891136849Sscottl
892136849Sscottl/* hpt_delete_array
893136849Sscottl * Version compatibility: v1.0.0.1 or later
894136849Sscottl * Parameters:
895136849Sscottl *  id      array id
896136849Sscottl * Returns:
897136849Sscottl *  0   Success
898136849Sscottl */
899136849Sscottlint hpt_delete_array(DEVICEID id, DWORD options);
900136849Sscottl
901136849Sscottl/*-------------------------------------------------------------------------- */
902136849Sscottl
903136849Sscottl/* hpt_device_io
904136849Sscottl *  Read/write data on array and physcal device.
905136849Sscottl * Version compatibility: v1.0.0.1 or later
906136849Sscottl * Parameters:
907136849Sscottl *  id      device id. If it's an array ID, IO will be performed on the array.
908136849Sscottl *          If it's a physical device ID, IO will be performed on the device.
909136849Sscottl *  cmd     IO_COMMAND_READ or IO_COMMAND_WRITE
910136849Sscottl *  buffer  data buffer
911136849Sscottl *  length  data size
912136849Sscottl * Returns:
913136849Sscottl *  0   Success
914136849Sscottl */
915136849Sscottlint hpt_device_io(DEVICEID id, int cmd, ULONG lba, DWORD nSector, LPVOID buffer);
916136849Sscottl
917136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
918136849Sscottlint hpt_device_io_v2(DEVICEID id, int cmd, LBA64 lba, DWORD nSector, LPVOID buffer);
919136849Sscottl#endif
920136849Sscottl
921136849Sscottl/* hpt_add_disk_to_array
922136849Sscottl *   Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array.
923136849Sscottl *   Auto-rebuild will start.
924136849Sscottl * Version compatibility: v1.0.0.1 or later
925136849Sscottl * Parameters:
926136849Sscottl *  idArray     array id
927136849Sscottl *  idDisk      disk id
928136849Sscottl * Returns:
929136849Sscottl *  0   Success
930136849Sscottl */
931136849Sscottlint hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk);
932136849Sscottl/*-------------------------------------------------------------------------- */
933136849Sscottl
934136849Sscottl/* hpt_add_spare_disk
935136849Sscottl * Version compatibility: v1.0.0.1 or later
936136849Sscottl *   Add a disk to spare pool.
937136849Sscottl * Parameters:
938136849Sscottl *  idDisk      disk id
939136849Sscottl * Returns:
940136849Sscottl *  0   Success
941136849Sscottl */
942136849Sscottlint hpt_add_spare_disk(DEVICEID idDisk);
943136849Sscottl/*-------------------------------------------------------------------------- */
944136849Sscottl
945136849Sscottl/* hpt_add_dedicated_spare
946136849Sscottl * Version compatibility: v1.0.0.3 or later
947136849Sscottl *   Add a spare disk to an array
948136849Sscottl * Parameters:
949136849Sscottl *  idDisk      disk id
950136849Sscottl *  idArray     array id
951136849Sscottl * Returns:
952136849Sscottl *  0   Success
953136849Sscottl */
954136849Sscottlint hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray);
955136849Sscottl/*-------------------------------------------------------------------------- */
956136849Sscottl
957136849Sscottl/* hpt_remove_spare_disk
958136849Sscottl *   remove a disk from spare pool.
959136849Sscottl * Version compatibility: v1.0.0.1 or later
960136849Sscottl * Parameters:
961136849Sscottl *  idDisk      disk id
962136849Sscottl * Returns:
963136849Sscottl *  0   Success
964136849Sscottl */
965136849Sscottlint hpt_remove_spare_disk(DEVICEID idDisk);
966136849Sscottl/*-------------------------------------------------------------------------- */
967136849Sscottl
968136849Sscottl/* hpt_get_event
969136849Sscottl *   Used to poll events from driver.
970136849Sscottl * Version compatibility: v1.0.0.1 or later
971136849Sscottl * Parameters:
972136849Sscottl *   pEvent    pointer to HPT_EVENT structure
973136849Sscottl * Returns:
974136849Sscottl *  0   Success, event info is filled in *pEvent
975136849Sscottl */
976136849Sscottlint hpt_get_event(PHPT_EVENT pEvent);
977136849Sscottl/*-------------------------------------------------------------------------- */
978136849Sscottl
979136849Sscottl/* hpt_rebuild_data_block
980136849Sscottl *   Used to copy data from source disk and mirror disk.
981136849Sscottl * Version compatibility: v1.0.0.1 or later
982136849Sscottl * Parameters:
983136849Sscottl *   idArray        Array ID (RAID1, 0/1 or RAID5)
984136849Sscottl *   Lba            Start LBA for each array member
985136849Sscottl *   nSector        Number of sectors for each array member (RAID 5 will ignore this parameter)
986136849Sscottl *
987136849Sscottl * Returns:
988136849Sscottl *  0   Success, event info is filled in *pEvent
989136849Sscottl */
990136849Sscottlint hpt_rebuild_data_block(DEVICEID idMirror, DWORD Lba, UCHAR nSector);
991136849Sscottl#define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3)
992136849Sscottl
993136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
994136849Sscottlint hpt_rebuild_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSector);
995136849Sscottl#endif
996136849Sscottl/*-------------------------------------------------------------------------- */
997136849Sscottl
998136849Sscottl/* hpt_set_array_state
999136849Sscottl *   set array state.
1000136849Sscottl * Version compatibility: v1.0.0.1 or later
1001136849Sscottl * Parameters:
1002136849Sscottl *   idArray        Array ID
1003136849Sscottl *   state          See above 'array states' constants, possible values are:
1004136849Sscottl *     MIRROR_REBUILD_START
1005136849Sscottl *        Indicate that GUI wants to rebuild a mirror array
1006136849Sscottl *     MIRROR_REBUILD_ABORT
1007136849Sscottl *        GUI wants to abort rebuilding an array
1008136849Sscottl *     MIRROR_REBUILD_COMPLETE
1009136849Sscottl *        GUI finished to rebuild an array. If rebuild is done by driver this
1010136849Sscottl *        state has no use
1011136849Sscottl *
1012136849Sscottl * Returns:
1013136849Sscottl *  0   Success
1014136849Sscottl */
1015136849Sscottlint hpt_set_array_state(DEVICEID idArray, DWORD state);
1016136849Sscottl/*-------------------------------------------------------------------------- */
1017136849Sscottl
1018136849Sscottl/* hpt_set_array_info
1019136849Sscottl *   set array info.
1020136849Sscottl * Version compatibility: v1.0.0.1 or later
1021136849Sscottl * Parameters:
1022136849Sscottl *   idArray        Array ID
1023136849Sscottl *   pInfo          pointer to new info
1024136849Sscottl *
1025136849Sscottl * Returns:
1026136849Sscottl *  0   Success
1027136849Sscottl */
1028136849Sscottlint hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo);
1029136849Sscottl/*-------------------------------------------------------------------------- */
1030136849Sscottl
1031136849Sscottl/* hpt_set_device_info
1032136849Sscottl *   set device info.
1033136849Sscottl * Version compatibility: v1.0.0.1 or later
1034136849Sscottl * Parameters:
1035136849Sscottl *   idDisk         device ID
1036136849Sscottl *   pInfo          pointer to new info
1037136849Sscottl *
1038136849Sscottl * Returns:
1039136849Sscottl *  0   Success
1040136849Sscottl * Additional notes:
1041136849Sscottl *  If idDisk==0, call to this function will stop buzzer on the adapter
1042136849Sscottl *  (if supported by driver).
1043136849Sscottl */
1044136849Sscottlint hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo);
1045136849Sscottl
1046136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01000004
1047136849Sscottlint hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo);
1048136849Sscottl#endif
1049136849Sscottl
1050136849Sscottl/*-------------------------------------------------------------------------- */
1051136849Sscottl
1052136849Sscottl/* hpt_rescan_devices
1053136849Sscottl *   rescan devices
1054136849Sscottl * Version compatibility: v1.0.0.1 or later
1055136849Sscottl * Parameters:
1056136849Sscottl *   None
1057136849Sscottl * Returns:
1058136849Sscottl *   0  Success
1059136849Sscottl */
1060149871Sscottlint hpt_rescan_devices();
1061136849Sscottl/*-------------------------------------------------------------------------- */
1062136849Sscottl
1063136849Sscottl/* hpt_get_601_info
1064136849Sscottl *   Get HPT601 status
1065136849Sscottl * Version compatibiilty: v1.0.0.3 or later
1066136849Sscottl * Parameters:
1067136849Sscottl *   idDisk - Disk handle
1068136849Sscottl *   PHPT601_INFO - pointer to HPT601 info buffer
1069136849Sscottl * Returns:
1070136849Sscottl *   0  Success
1071136849Sscottl */
1072136849Sscottlint hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
1073136849Sscottl/*-------------------------------------------------------------------------- */
1074136849Sscottl
1075136849Sscottl/* hpt_set_601_info
1076136849Sscottl *   HPT601 function control
1077136849Sscottl * Version compatibiilty: v1.0.0.3 or later
1078136849Sscottl * Parameters:
1079136849Sscottl *   idDisk - Disk handle
1080136849Sscottl *   PHPT601_INFO - pointer to HPT601 info buffer
1081136849Sscottl * Returns:
1082136849Sscottl *   0  Success
1083136849Sscottl */
1084136849Sscottlint hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
1085136849Sscottl/*-------------------------------------------------------------------------- */
1086136849Sscottl
1087136849Sscottl/* hpt_lock_device
1088136849Sscottl *   Lock a block on a device (prevent OS accessing it)
1089136849Sscottl * Version compatibiilty: v1.0.0.3 or later
1090136849Sscottl * Parameters:
1091136849Sscottl *   idDisk - Disk handle
1092136849Sscottl *   Lba - Start LBA
1093136849Sscottl *   nSectors - number of sectors
1094136849Sscottl * Returns:
1095136849Sscottl *   0  Success
1096136849Sscottl */
1097136849Sscottlint hpt_lock_device(DEVICEID idDisk, ULONG Lba, UCHAR nSectors);
1098136849Sscottl
1099136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
1100136849Sscottlint hpt_lock_device_v2(DEVICEID idDisk, LBA64 Lba, USHORT nSectors);
1101136849Sscottl#endif
1102136849Sscottl/*-------------------------------------------------------------------------- */
1103136849Sscottl
1104136849Sscottl/* hpt_lock_device
1105136849Sscottl *   Unlock a device
1106136849Sscottl * Version compatibiilty: v1.0.0.3 or later
1107136849Sscottl * Parameters:
1108136849Sscottl *   idDisk - Disk handle
1109136849Sscottl * Returns:
1110136849Sscottl *   0  Success
1111136849Sscottl */
1112136849Sscottlint hpt_unlock_device(DEVICEID idDisk);
1113136849Sscottl/*-------------------------------------------------------------------------- */
1114136849Sscottl
1115136849Sscottl/* hpt_ide_pass_through
1116136849Sscottl *  directly access controller's command and control registers.
1117136849Sscottl *  Can only call it on physical devices.
1118136849Sscottl * Version compatibility: v1.0.0.3 or later
1119136849Sscottl * Parameters:
1120136849Sscottl *   p - IDE_PASS_THROUGH header pointer
1121136849Sscottl * Returns:
1122136849Sscottl *   0  Success
1123136849Sscottl */
1124136849Sscottlint hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
1125136849Sscottl/*-------------------------------------------------------------------------- */
1126136849Sscottl
1127136849Sscottl/* hpt_verify_data_block
1128136849Sscottl *   verify data block on RAID1 or RAID5.
1129136849Sscottl * Version compatibility: v1.0.0.3 or later
1130136849Sscottl * Parameters:
1131136849Sscottl *   idArray - Array ID
1132136849Sscottl *   Lba - block number (on each array member, not logical block!)
1133136849Sscottl *   nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1134136849Sscottl * Returns:
1135136849Sscottl *   0  Success
1136136849Sscottl *   1  Data compare error
1137136849Sscottl *   2  I/O error
1138136849Sscottl */
1139136849Sscottlint hpt_verify_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors);
1140136849Sscottl
1141136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
1142136849Sscottlint hpt_verify_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors);
1143136849Sscottl#endif
1144136849Sscottl/*-------------------------------------------------------------------------- */
1145136849Sscottl
1146136849Sscottl/* hpt_initialize_data_block
1147136849Sscottl *   initialize data block (fill with zero) on RAID5
1148136849Sscottl * Version compatibility: v1.0.0.3 or later
1149136849Sscottl * Parameters:
1150136849Sscottl *   idArray - Array ID
1151136849Sscottl *   Lba - block number (on each array member, not logical block!)
1152136849Sscottl *   nSectors - Sectors for each member (RAID 5 will ignore this parameter)
1153136849Sscottl * Returns:
1154136849Sscottl *   0  Success
1155136849Sscottl */
1156136849Sscottlint hpt_initialize_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors);
1157136849Sscottl
1158136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
1159136849Sscottlint hpt_initialize_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors);
1160136849Sscottl#endif
1161136849Sscottl/*-------------------------------------------------------------------------- */
1162136849Sscottl
1163136849Sscottl/* hpt_device_io_ex
1164136849Sscottl *   extended device I/O function
1165136849Sscottl * Version compatibility: v1.0.0.3 or later
1166136849Sscottl * Parameters:
1167136849Sscottl *   idArray - Array ID
1168136849Sscottl *   Lba - block number (on each array member, not logical block!)
1169136849Sscottl *   nSectors - Sectors for each member
1170136849Sscottl *   buffer - I/O buffer or s/g address
1171136849Sscottl * Returns:
1172136849Sscottl *   0  Success
1173136849Sscottl */
1174136849Sscottlint hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param);
1175136849Sscottl#if HPT_INTERFACE_VERSION >= 0x01010000
1176136849Sscottlint hpt_device_io_ex_v2(void * param); /* NOT IMPLEMENTED */
1177136849Sscottl#endif
1178136849Sscottl/*-------------------------------------------------------------------------- */
1179136849Sscottl
1180136849Sscottl/* hpt_set_boot_mark
1181136849Sscottl *   select boot device
1182136849Sscottl * Version compatibility: v1.0.0.3 or later
1183136849Sscottl * Parameters:
1184136849Sscottl *   id - logical device ID. If id is 0 the boot mark will be removed.
1185136849Sscottl * Returns:
1186136849Sscottl *   0  Success
1187136849Sscottl */
1188136849Sscottlint hpt_set_boot_mark(DEVICEID id);
1189136849Sscottl/*-------------------------------------------------------------------------- */
1190136849Sscottl
1191136849Sscottl/* hpt_query_remove
1192136849Sscottl *  check if device can be removed safely
1193136849Sscottl * Version compatibility: v1.0.0.4 or later
1194136849Sscottl * Parameters:
1195136849Sscottl *  ndev - number of devices
1196136849Sscottl *  pIds - device ID list
1197136849Sscottl * Returns:
1198136849Sscottl *  0  - Success
1199136849Sscottl *  -1 - unknown error
1200136849Sscottl *  n  - the n-th device that can't be removed
1201136849Sscottl */
1202136849Sscottlint hpt_query_remove(DWORD ndev, DEVICEID *pIds);
1203136849Sscottl/*-------------------------------------------------------------------------- */
1204136849Sscottl
1205136849Sscottl/* hpt_remove_devices
1206136849Sscottl *  remove a list of devices
1207136849Sscottl * Version compatibility: v1.0.0.4 or later
1208136849Sscottl * Parameters:
1209136849Sscottl *  ndev - number of devices
1210136849Sscottl *  pIds - device ID list
1211136849Sscottl * Returns:
1212136849Sscottl *  0  - Success
1213136849Sscottl *  -1 - unknown error
1214136849Sscottl *  n  - the n-th device that can't be removed
1215136849Sscottl */
1216136849Sscottlint hpt_remove_devices(DWORD ndev, DEVICEID *pIds);
1217136849Sscottl/*-------------------------------------------------------------------------- */
1218136849Sscottl
1219190809Sdelphij/* hpt_ide_pass_through
1220190809Sdelphij *  directly access controller's command and control registers.
1221190809Sdelphij *  Can only call it on physical devices.
1222190809Sdelphij * Version compatibility: v1.0.0.3 or later
1223190809Sdelphij * Parameters:
1224190809Sdelphij *   p - IDE_PASS_THROUGH header pointer
1225190809Sdelphij * Returns:
1226190809Sdelphij *   0  Success
1227190809Sdelphij */
1228190809Sdelphijint hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
1229190809Sdelphij/*-------------------------------------------------------------------------- */
1230190809Sdelphij
1231136849Sscottl#endif
1232136849Sscottl
1233136849Sscottl#pragma pack()
1234136849Sscottl#endif
1235