1718cf2ccSPedro F. Giffuni /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 4d2bd3ab9SScott Long * Copyright (c) 2004-2005 HighPoint Technologies, Inc. 51713e81bSScott Long * All rights reserved. 61713e81bSScott Long * 71713e81bSScott Long * Redistribution and use in source and binary forms, with or without 81713e81bSScott Long * modification, are permitted provided that the following conditions 91713e81bSScott Long * are met: 101713e81bSScott Long * 1. Redistributions of source code must retain the above copyright 111713e81bSScott Long * notice, this list of conditions and the following disclaimer. 121713e81bSScott Long * 2. Redistributions in binary form must reproduce the above copyright 131713e81bSScott Long * notice, this list of conditions and the following disclaimer in the 141713e81bSScott Long * documentation and/or other materials provided with the distribution. 151713e81bSScott Long * 161713e81bSScott Long * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 171713e81bSScott Long * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181713e81bSScott Long * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191713e81bSScott Long * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 201713e81bSScott Long * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211713e81bSScott Long * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221713e81bSScott Long * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231713e81bSScott Long * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241713e81bSScott Long * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251713e81bSScott Long * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261713e81bSScott Long * SUCH DAMAGE. 271713e81bSScott Long * 281713e81bSScott Long * $FreeBSD$ 291713e81bSScott Long */ 301713e81bSScott Long 311713e81bSScott Long #ifndef HPT_INTF_H 321713e81bSScott Long #define HPT_INTF_H 331713e81bSScott Long #pragma pack(1) 341713e81bSScott Long 351713e81bSScott Long /* 361713e81bSScott Long * Version of this interface. 371713e81bSScott Long * The user mode application must first issue a hpt_get_version() call to 381713e81bSScott Long * check HPT_INTERFACE_VERSION. When an utility using newer version interface 391713e81bSScott Long * is used with old version drivers, it must call only the functions that 401713e81bSScott Long * driver supported. 411713e81bSScott Long * A new version interface should only add ioctl functions; it should implement 421713e81bSScott Long * all old version functions without change their definition. 431713e81bSScott Long */ 441713e81bSScott Long #define __this_HPT_INTERFACE_VERSION 0x01010000 451713e81bSScott Long 461713e81bSScott Long #ifndef HPT_INTERFACE_VERSION 471713e81bSScott Long #error "You must define HPT_INTERFACE_VERSION you implemented" 481713e81bSScott Long #endif 491713e81bSScott Long 501713e81bSScott Long #if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION 511713e81bSScott Long #error "HPT_INTERFACE_VERSION is invalid" 521713e81bSScott Long #endif 531713e81bSScott Long 541713e81bSScott Long /* 551713e81bSScott Long * DEFINITION 561713e81bSScott Long * Logical device --- a device that can be accessed by OS. 571713e81bSScott Long * Physical device --- device attached to the controller. 581713e81bSScott Long * A logical device can be simply a physical device. 591713e81bSScott Long * 601713e81bSScott Long * Each logical and physical device has a 32bit ID. GUI will use this ID 611713e81bSScott Long * to identify devices. 621713e81bSScott Long * 1. The ID must be unique. 631713e81bSScott Long * 2. The ID must be immutable. Once an ID is assigned to a device, it 641713e81bSScott Long * must not change when system is running and the device exists. 651713e81bSScott Long * 3. The ID of logical device must be NOT reusable. If a device is 661713e81bSScott Long * removed, other newly created logical device must not use the same ID. 671713e81bSScott Long * 4. The ID must not be zero or 0xFFFFFFFF. 681713e81bSScott Long */ 691713e81bSScott Long typedef DWORD DEVICEID; 701713e81bSScott Long 711713e81bSScott Long /* 721713e81bSScott Long * logical device type. 731713e81bSScott Long * Identify array (logical device) and physical device. 741713e81bSScott Long */ 751713e81bSScott Long #define LDT_ARRAY 1 761713e81bSScott Long #define LDT_DEVICE 2 771713e81bSScott Long 781713e81bSScott Long /* 791713e81bSScott Long * Array types 801713e81bSScott Long * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0. 811713e81bSScott Long * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0. 821713e81bSScott Long * Their members may be another array of type RAID0 or RAID1. 831713e81bSScott Long */ 841713e81bSScott Long #define AT_UNKNOWN 0 851713e81bSScott Long #define AT_RAID0 1 861713e81bSScott Long #define AT_RAID1 2 871713e81bSScott Long #define AT_RAID5 3 881713e81bSScott Long #define AT_JBOD 7 891713e81bSScott Long 901713e81bSScott Long /* 911713e81bSScott Long * physical device type 921713e81bSScott Long */ 931713e81bSScott Long #define PDT_UNKNOWN 0 941713e81bSScott Long #define PDT_HARDDISK 1 951713e81bSScott Long #define PDT_CDROM 2 961713e81bSScott Long #define PDT_TAPE 3 971713e81bSScott Long 981713e81bSScott Long /* 991713e81bSScott Long * Some constants. 1001713e81bSScott Long */ 1011713e81bSScott Long #define MAX_NAME_LENGTH 36 1021713e81bSScott Long #define MAX_ARRAYNAME_LEN 16 1031713e81bSScott Long 1041713e81bSScott Long #define MAX_ARRAY_MEMBERS_V1 8 1051713e81bSScott Long #define MAX_ARRAY_MEMBERS_V2 16 106453130d9SPedro F. Giffuni /* keep definition for source code compatibility */ 1071713e81bSScott Long #define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1 1081713e81bSScott Long 1091713e81bSScott Long /* 1101713e81bSScott Long * io commands 1111713e81bSScott Long * GUI use these commands to do IO on logical/physical devices. 1121713e81bSScott Long */ 1131713e81bSScott Long #define IO_COMMAND_READ 1 1141713e81bSScott Long #define IO_COMMAND_WRITE 2 1151713e81bSScott Long 1161713e81bSScott Long /* 1171713e81bSScott Long * array flags 1181713e81bSScott Long */ 1191713e81bSScott Long #define ARRAY_FLAG_DISABLED 0x00000001 /* The array is disabled */ 1201713e81bSScott Long #define ARRAY_FLAG_NEEDBUILDING 0x00000002 /* array need synchronizing */ 1211713e81bSScott Long #define ARRAY_FLAG_REBUILDING 0x00000004 /* array is in rebuilding process */ 1221713e81bSScott Long #define ARRAY_FLAG_BROKEN 0x00000008 /* broken but may still working */ 1231713e81bSScott Long #define ARRAY_FLAG_BOOTDISK 0x00000010 /* array has a active partition */ 1241713e81bSScott Long #define ARRAY_FLAG_NEWLY_CREATED 0x00000020 /* a newly created array */ 1251713e81bSScott Long #define ARRAY_FLAG_BOOTMARK 0x00000040 /* array has boot mark set */ 1261713e81bSScott Long #define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */ 1271713e81bSScott Long #define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */ 1281713e81bSScott Long #define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */ 1291713e81bSScott Long #define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */ 1301713e81bSScott Long 1311713e81bSScott Long /* 1321713e81bSScott Long * device flags 1331713e81bSScott Long */ 1341713e81bSScott Long #define DEVICE_FLAG_DISABLED 0x00000001 /* device is disabled */ 1351713e81bSScott Long #define DEVICE_FLAG_BOOTDISK 0x00000002 /* disk has a active partition */ 1361713e81bSScott Long #define DEVICE_FLAG_BOOTMARK 0x00000004 /* disk has boot mark set */ 1371713e81bSScott Long #define DEVICE_FLAG_WITH_601 0x00000008 /* has HPT601 connected */ 1381713e81bSScott Long #define DEVICE_FLAG_SATA 0x00000010 /* S-ATA device */ 1391713e81bSScott Long #define DEVICE_FLAG_IS_SPARE 0x80000000 /* is a spare disk */ 1401713e81bSScott Long 1411713e81bSScott Long /* 1421713e81bSScott Long * array states used by hpt_set_array_state() 1431713e81bSScott Long */ 1441713e81bSScott Long /* old defines */ 1451713e81bSScott Long #define MIRROR_REBUILD_START 1 1461713e81bSScott Long #define MIRROR_REBUILD_ABORT 2 1471713e81bSScott Long #define MIRROR_REBUILD_COMPLETE 3 1481713e81bSScott Long /* new defines */ 1491713e81bSScott Long #define AS_REBUILD_START 1 1501713e81bSScott Long #define AS_REBUILD_ABORT 2 1511713e81bSScott Long #define AS_REBUILD_PAUSE AS_REBUILD_ABORT 1521713e81bSScott Long #define AS_REBUILD_COMPLETE 3 1531713e81bSScott Long #define AS_VERIFY_START 4 1541713e81bSScott Long #define AS_VERIFY_ABORT 5 1551713e81bSScott Long #define AS_VERIFY_COMPLETE 6 1561713e81bSScott Long #define AS_INITIALIZE_START 7 1571713e81bSScott Long #define AS_INITIALIZE_ABORT 8 1581713e81bSScott Long #define AS_INITIALIZE_COMPLETE 9 1591713e81bSScott Long #define AS_VERIFY_FAILED 10 1601713e81bSScott Long #define AS_REBUILD_STOP 11 1611713e81bSScott Long #define AS_SAVE_STATE 12 1621713e81bSScott Long /************************************************************************ 1631713e81bSScott Long * ioctl code 1641713e81bSScott Long * It would be better if ioctl code are the same on different platforms, 1651713e81bSScott Long * but we must not conflict with system defined ioctl code. 1661713e81bSScott Long ************************************************************************/ 16764470755SXin LI #if defined(LINUX) || defined(__FreeBSD_version) 1681713e81bSScott Long #define HPT_CTL_CODE(x) (x+0xFF00) 1691713e81bSScott Long #elif defined(_MS_WIN32_) || defined(WIN32) 1701713e81bSScott Long 1711713e81bSScott Long #ifndef CTL_CODE 1721713e81bSScott Long #define CTL_CODE( DeviceType, Function, Method, Access ) \ 1731713e81bSScott Long (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) 1741713e81bSScott Long #endif 1751713e81bSScott Long #define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0) 1761713e81bSScott Long #define HPT_CTL_CODE_WIN32_TO_I960(x) ((((x) & 0xffff)>>2)-0x900) 1771713e81bSScott Long 1781713e81bSScott Long #else 1791713e81bSScott Long #define HPT_CTL_CODE(x) (x) 1801713e81bSScott Long #endif 1811713e81bSScott Long 1821713e81bSScott Long #define HPT_IOCTL_GET_VERSION HPT_CTL_CODE(0) 1831713e81bSScott Long #define HPT_IOCTL_GET_CONTROLLER_COUNT HPT_CTL_CODE(1) 1841713e81bSScott Long #define HPT_IOCTL_GET_CONTROLLER_INFO HPT_CTL_CODE(2) 1851713e81bSScott Long #define HPT_IOCTL_GET_CHANNEL_INFO HPT_CTL_CODE(3) 1861713e81bSScott Long #define HPT_IOCTL_GET_LOGICAL_DEVICES HPT_CTL_CODE(4) 1871713e81bSScott Long #define HPT_IOCTL_GET_DEVICE_INFO HPT_CTL_CODE(5) 1881713e81bSScott Long #define HPT_IOCTL_CREATE_ARRAY HPT_CTL_CODE(6) 1891713e81bSScott Long #define HPT_IOCTL_DELETE_ARRAY HPT_CTL_CODE(7) 1901713e81bSScott Long #define HPT_IOCTL_ARRAY_IO HPT_CTL_CODE(8) 1911713e81bSScott Long #define HPT_IOCTL_DEVICE_IO HPT_CTL_CODE(9) 1921713e81bSScott Long #define HPT_IOCTL_GET_EVENT HPT_CTL_CODE(10) 1931713e81bSScott Long #define HPT_IOCTL_REBUILD_MIRROR HPT_CTL_CODE(11) 1941713e81bSScott Long /* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */ 1951713e81bSScott Long #define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR 1961713e81bSScott Long #define HPT_IOCTL_ADD_SPARE_DISK HPT_CTL_CODE(12) 1971713e81bSScott Long #define HPT_IOCTL_REMOVE_SPARE_DISK HPT_CTL_CODE(13) 1981713e81bSScott Long #define HPT_IOCTL_ADD_DISK_TO_ARRAY HPT_CTL_CODE(14) 1991713e81bSScott Long #define HPT_IOCTL_SET_ARRAY_STATE HPT_CTL_CODE(15) 2001713e81bSScott Long #define HPT_IOCTL_SET_ARRAY_INFO HPT_CTL_CODE(16) 2011713e81bSScott Long #define HPT_IOCTL_SET_DEVICE_INFO HPT_CTL_CODE(17) 2021713e81bSScott Long #define HPT_IOCTL_RESCAN_DEVICES HPT_CTL_CODE(18) 2031713e81bSScott Long #define HPT_IOCTL_GET_DRIVER_CAPABILITIES HPT_CTL_CODE(19) 2041713e81bSScott Long #define HPT_IOCTL_GET_601_INFO HPT_CTL_CODE(20) 2051713e81bSScott Long #define HPT_IOCTL_SET_601_INFO HPT_CTL_CODE(21) 2061713e81bSScott Long #define HPT_IOCTL_LOCK_DEVICE HPT_CTL_CODE(22) 2071713e81bSScott Long #define HPT_IOCTL_UNLOCK_DEVICE HPT_CTL_CODE(23) 2081713e81bSScott Long #define HPT_IOCTL_IDE_PASS_THROUGH HPT_CTL_CODE(24) 2091713e81bSScott Long #define HPT_IOCTL_VERIFY_DATA_BLOCK HPT_CTL_CODE(25) 2101713e81bSScott Long #define HPT_IOCTL_INITIALIZE_DATA_BLOCK HPT_CTL_CODE(26) 2111713e81bSScott Long #define HPT_IOCTL_ADD_DEDICATED_SPARE HPT_CTL_CODE(27) 2121713e81bSScott Long #define HPT_IOCTL_DEVICE_IO_EX HPT_CTL_CODE(28) 2131713e81bSScott Long #define HPT_IOCTL_SET_BOOT_MARK HPT_CTL_CODE(29) 2141713e81bSScott Long #define HPT_IOCTL_QUERY_REMOVE HPT_CTL_CODE(30) 2151713e81bSScott Long #define HPT_IOCTL_REMOVE_DEVICES HPT_CTL_CODE(31) 2161713e81bSScott Long #define HPT_IOCTL_CREATE_ARRAY_V2 HPT_CTL_CODE(32) 2171713e81bSScott Long #define HPT_IOCTL_GET_DEVICE_INFO_V2 HPT_CTL_CODE(33) 2181713e81bSScott Long #define HPT_IOCTL_SET_DEVICE_INFO_V2 HPT_CTL_CODE(34) 2191713e81bSScott Long #define HPT_IOCTL_REBUILD_DATA_BLOCK_V2 HPT_CTL_CODE(35) 2201713e81bSScott Long #define HPT_IOCTL_VERIFY_DATA_BLOCK_V2 HPT_CTL_CODE(36) 2211713e81bSScott Long #define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2 HPT_CTL_CODE(37) 2221713e81bSScott Long #define HPT_IOCTL_LOCK_DEVICE_V2 HPT_CTL_CODE(38) 2231713e81bSScott Long #define HPT_IOCTL_DEVICE_IO_V2 HPT_CTL_CODE(39) 2241713e81bSScott Long #define HPT_IOCTL_DEVICE_IO_EX_V2 HPT_CTL_CODE(40) 2251713e81bSScott Long 22664470755SXin LI #define HPT_IOCTL_I2C_TRANSACTION HPT_CTL_CODE(48) 22764470755SXin LI #define HPT_IOCTL_GET_PARAMETER_LIST HPT_CTL_CODE(49) 22864470755SXin LI #define HPT_IOCTL_GET_PARAMETER HPT_CTL_CODE(50) 22964470755SXin LI #define HPT_IOCTL_SET_PARAMETER HPT_CTL_CODE(51) 23064470755SXin LI 2311713e81bSScott Long /* Windows only */ 2321713e81bSScott Long #define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100) 2331713e81bSScott Long #define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101) 2341713e81bSScott Long #define HPT_IOCTL_EPROM_IO HPT_CTL_CODE(102) 2351713e81bSScott Long #define HPT_IOCTL_GET_CONTROLLER_VENID HPT_CTL_CODE(103) 2361713e81bSScott Long 2371713e81bSScott Long /************************************************************************ 2381713e81bSScott Long * shared data structures 2391713e81bSScott Long ************************************************************************/ 2401713e81bSScott Long 2411713e81bSScott Long /* 2421713e81bSScott Long * Chip Type 2431713e81bSScott Long */ 2441713e81bSScott Long #define CHIP_TYPE_HPT366 1 2451713e81bSScott Long #define CHIP_TYPE_HPT368 2 2461713e81bSScott Long #define CHIP_TYPE_HPT370 3 2471713e81bSScott Long #define CHIP_TYPE_HPT370A 4 2481713e81bSScott Long #define CHIP_TYPE_HPT370B 5 2491713e81bSScott Long #define CHIP_TYPE_HPT374 6 2501713e81bSScott Long #define CHIP_TYPE_HPT372 7 2511713e81bSScott Long #define CHIP_TYPE_HPT372A 8 2521713e81bSScott Long #define CHIP_TYPE_HPT302 9 2531713e81bSScott Long #define CHIP_TYPE_HPT371 10 2541713e81bSScott Long #define CHIP_TYPE_HPT372N 11 2551713e81bSScott Long #define CHIP_TYPE_HPT302N 12 2561713e81bSScott Long #define CHIP_TYPE_HPT371N 13 2571713e81bSScott Long #define CHIP_TYPE_SI3112A 14 2581713e81bSScott Long #define CHIP_TYPE_ICH5 15 2591713e81bSScott Long #define CHIP_TYPE_ICH5R 16 2601713e81bSScott Long 2611713e81bSScott Long /* 2621713e81bSScott Long * Chip Flags 2631713e81bSScott Long */ 2641713e81bSScott Long #define CHIP_SUPPORT_ULTRA_66 0x20 2651713e81bSScott Long #define CHIP_SUPPORT_ULTRA_100 0x40 2661713e81bSScott Long #define CHIP_HPT3XX_DPLL_MODE 0x80 2671713e81bSScott Long #define CHIP_SUPPORT_ULTRA_133 0x01 2681713e81bSScott Long #define CHIP_SUPPORT_ULTRA_150 0x02 2691713e81bSScott Long 2701713e81bSScott Long typedef struct _DRIVER_CAPABILITIES { 2711713e81bSScott Long DWORD dwSize; 2721713e81bSScott Long 2731713e81bSScott Long UCHAR MaximumControllers; /* maximum controllers the driver can support */ 2741713e81bSScott Long UCHAR SupportCrossControllerRAID; /* 1-support, 0-not support */ 2751713e81bSScott Long UCHAR MinimumBlockSizeShift; /* minimum block size shift */ 2761713e81bSScott Long UCHAR MaximumBlockSizeShift; /* maximum block size shift */ 2771713e81bSScott Long 2781713e81bSScott Long UCHAR SupportDiskModeSetting; 2791713e81bSScott Long UCHAR SupportSparePool; 2801713e81bSScott Long UCHAR MaximumArrayNameLength; 2811713e81bSScott Long /* only one byte left here! */ 2821713e81bSScott Long #ifdef __BIG_ENDIAN_BITFIELD 2831713e81bSScott Long UCHAR reserved: 4; 2841713e81bSScott Long UCHAR SupportHotSwap: 1; 2851713e81bSScott Long UCHAR HighPerformanceRAID1: 1; 2861713e81bSScott Long UCHAR RebuildProcessInDriver: 1; 2871713e81bSScott Long UCHAR SupportDedicatedSpare: 1; 2881713e81bSScott Long #else 2891713e81bSScott Long UCHAR SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */ 2901713e81bSScott Long UCHAR RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */ 2911713e81bSScott Long UCHAR HighPerformanceRAID1: 1; /* Support RAID1.5 */ 2921713e81bSScott Long UCHAR SupportHotSwap: 1; 2931713e81bSScott Long UCHAR reserved: 4; 2941713e81bSScott Long #endif 2951713e81bSScott Long 2961713e81bSScott Long /* SupportedRAIDTypes is an array of bytes, one of each is an array type. 2971713e81bSScott Long * Only non-zero values is valid. Bit0-3 represents the lower(child) level RAID type; 2981713e81bSScott Long * bit4-7 represents the top level. i.e. 2991713e81bSScott Long * RAID 0/1 is (AT_RAID1<<4) | AT_RAID0 3001713e81bSScott Long * RAID 5/0 is (AT_RAID0<<4) | AT_RAID5 3011713e81bSScott Long */ 3021713e81bSScott Long UCHAR SupportedRAIDTypes[16]; 3031713e81bSScott Long /* maximum members in an array corresponding to SupportedRAIDTypes */ 3041713e81bSScott Long UCHAR MaximumArrayMembers[16]; 3051713e81bSScott Long } 3061713e81bSScott Long DRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES; 3071713e81bSScott Long 3081713e81bSScott Long /* 3091713e81bSScott Long * Controller information. 3101713e81bSScott Long */ 3111713e81bSScott Long typedef struct _CONTROLLER_INFO { 3121713e81bSScott Long UCHAR ChipType; /* chip type */ 3131713e81bSScott Long UCHAR InterruptLevel; /* IRQ level */ 3141713e81bSScott Long UCHAR NumBuses; /* bus count */ 3151713e81bSScott Long UCHAR ChipFlags; 3161713e81bSScott Long 3171713e81bSScott Long UCHAR szProductID[MAX_NAME_LENGTH]; /* product name */ 3181713e81bSScott Long UCHAR szVendorID[MAX_NAME_LENGTH]; /* vender name */ 3191713e81bSScott Long 3201713e81bSScott Long } CONTROLLER_INFO, *PCONTROLLER_INFO; 3211713e81bSScott Long 3221713e81bSScott Long /* 3231713e81bSScott Long * Channel information. 3241713e81bSScott Long */ 3251713e81bSScott Long typedef struct _CHANNEL_INFO { 3261713e81bSScott Long ULONG IoPort; /* IDE Base Port Address */ 3271713e81bSScott Long ULONG ControlPort; /* IDE Control Port Address */ 3281713e81bSScott Long 3291713e81bSScott Long DEVICEID Devices[2]; /* device connected to this channel */ 3301713e81bSScott Long 3311713e81bSScott Long } CHANNEL_INFO, *PCHANNEL_INFO; 3321713e81bSScott Long 3331713e81bSScott Long /* 3341713e81bSScott Long * time represented in DWORD format 3351713e81bSScott Long */ 3361713e81bSScott Long #ifndef __KERNEL__ 3371713e81bSScott Long typedef struct _TIME_RECORD { 3381713e81bSScott Long UINT seconds:6; /* 0 - 59 */ 3391713e81bSScott Long UINT minutes:6; /* 0 - 59 */ 3401713e81bSScott Long UINT month:4; /* 1 - 12 */ 3411713e81bSScott Long UINT hours:6; /* 0 - 59 */ 3421713e81bSScott Long UINT day:5; /* 1 - 31 */ 3431713e81bSScott Long UINT year:5; /* 0=2000, 31=2031 */ 3441713e81bSScott Long } TIME_RECORD; 3451713e81bSScott Long #endif 3461713e81bSScott Long 3471713e81bSScott Long /* 3481713e81bSScott Long * Array information. 3491713e81bSScott Long */ 3501713e81bSScott Long typedef struct _HPT_ARRAY_INFO { 3511713e81bSScott Long UCHAR Name[MAX_ARRAYNAME_LEN];/* array name */ 3521713e81bSScott Long UCHAR Description[64]; /* array description */ 3531713e81bSScott Long UCHAR CreateManager[16]; /* who created it */ 3541713e81bSScott Long TIME_RECORD CreateTime; /* when created it */ 3551713e81bSScott Long 3561713e81bSScott Long UCHAR ArrayType; /* array type */ 3571713e81bSScott Long UCHAR BlockSizeShift; /* stripe size */ 3581713e81bSScott Long UCHAR nDisk; /* member count: Number of ID in Members[] */ 3591713e81bSScott Long UCHAR reserved; 3601713e81bSScott Long 3611713e81bSScott Long DWORD Flags; /* working flags, see ARRAY_FLAG_XXX */ 3621713e81bSScott Long DWORD Members[MAX_ARRAY_MEMBERS_V1]; /* member array/disks */ 3631713e81bSScott Long 3641713e81bSScott Long /* 3651713e81bSScott Long * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0); 3661713e81bSScott Long * only valid if rebuilding is done by driver code. 3671713e81bSScott Long * Member Flags will have ARRAY_FLAG_REBUILDING set at this case. 3681713e81bSScott Long * Verify operation use same fields below, the only difference is 3691713e81bSScott Long * ARRAY_FLAG_VERIFYING is set. 3701713e81bSScott Long */ 3711713e81bSScott Long DWORD RebuildingProgress; 3721713e81bSScott Long DWORD RebuiltSectors; /* rebuilding point (LBA) for single member */ 3731713e81bSScott Long 3741713e81bSScott Long } HPT_ARRAY_INFO, *PHPT_ARRAY_INFO; /*LDX modify ARRAY_INFO TO HPT_ARRAY_INFO to avoid compiling error in Windows*/ 3751713e81bSScott Long 3761713e81bSScott Long #if HPT_INTERFACE_VERSION>=0x01010000 3771713e81bSScott Long typedef struct _LBA64 { 37864470755SXin LI #ifdef __BIG_ENDIAN_BITFIELD 37964470755SXin LI DWORD hi32; 38064470755SXin LI DWORD lo32; 38164470755SXin LI #else 3821713e81bSScott Long DWORD lo32; 3831713e81bSScott Long DWORD hi32; 38464470755SXin LI #endif 3851713e81bSScott Long } 3861713e81bSScott Long LBA64; 3871713e81bSScott Long typedef struct _HPT_ARRAY_INFO_V2 { 3881713e81bSScott Long UCHAR Name[MAX_ARRAYNAME_LEN];/* array name */ 3891713e81bSScott Long UCHAR Description[64]; /* array description */ 3901713e81bSScott Long UCHAR CreateManager[16]; /* who created it */ 3911713e81bSScott Long TIME_RECORD CreateTime; /* when created it */ 3921713e81bSScott Long 3931713e81bSScott Long UCHAR ArrayType; /* array type */ 3941713e81bSScott Long UCHAR BlockSizeShift; /* stripe size */ 3951713e81bSScott Long UCHAR nDisk; /* member count: Number of ID in Members[] */ 3961713e81bSScott Long UCHAR reserved; 3971713e81bSScott Long 3981713e81bSScott Long DWORD Flags; /* working flags, see ARRAY_FLAG_XXX */ 3991713e81bSScott Long DWORD Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */ 4001713e81bSScott Long 4011713e81bSScott Long DWORD RebuildingProgress; 4021713e81bSScott Long LBA64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 4031713e81bSScott Long 4041713e81bSScott Long DWORD reserve4[4]; 4051713e81bSScott Long 4061713e81bSScott Long } HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2; 4071713e81bSScott Long #endif 4081713e81bSScott Long 4091713e81bSScott Long /* 4101713e81bSScott Long * ATA/ATAPI Device identify data without the Reserved4. 4111713e81bSScott Long */ 4121713e81bSScott Long #ifndef __KERNEL__ 4131713e81bSScott Long typedef struct _IDENTIFY_DATA2 { 4141713e81bSScott Long USHORT GeneralConfiguration; /* 00 00 */ 4151713e81bSScott Long USHORT NumberOfCylinders; /* 02 1 */ 4161713e81bSScott Long USHORT Reserved1; /* 04 2 */ 4171713e81bSScott Long USHORT NumberOfHeads; /* 06 3 */ 4181713e81bSScott Long USHORT UnformattedBytesPerTrack; /* 08 4 */ 4191713e81bSScott Long USHORT UnformattedBytesPerSector; /* 0A 5 */ 4201713e81bSScott Long USHORT SectorsPerTrack; /* 0C 6 */ 4211713e81bSScott Long USHORT VendorUnique1[3]; /* 0E 7-9 */ 4221713e81bSScott Long USHORT SerialNumber[10]; /* 14 10-19 */ 4231713e81bSScott Long USHORT BufferType; /* 28 20 */ 4241713e81bSScott Long USHORT BufferSectorSize; /* 2A 21 */ 4251713e81bSScott Long USHORT NumberOfEccBytes; /* 2C 22 */ 4261713e81bSScott Long USHORT FirmwareRevision[4]; /* 2E 23-26 */ 4271713e81bSScott Long USHORT ModelNumber[20]; /* 36 27-46 */ 4281713e81bSScott Long UCHAR MaximumBlockTransfer; /* 5E 47 */ 4291713e81bSScott Long UCHAR VendorUnique2; /* 5F */ 4301713e81bSScott Long USHORT DoubleWordIo; /* 60 48 */ 4311713e81bSScott Long USHORT Capabilities; /* 62 49 */ 4321713e81bSScott Long USHORT Reserved2; /* 64 50 */ 4331713e81bSScott Long UCHAR VendorUnique3; /* 66 51 */ 4341713e81bSScott Long UCHAR PioCycleTimingMode; /* 67 */ 4351713e81bSScott Long UCHAR VendorUnique4; /* 68 52 */ 4361713e81bSScott Long UCHAR DmaCycleTimingMode; /* 69 */ 4371713e81bSScott Long USHORT TranslationFieldsValid:1; /* 6A 53 */ 4381713e81bSScott Long USHORT Reserved3:15; 4391713e81bSScott Long USHORT NumberOfCurrentCylinders; /* 6C 54 */ 4401713e81bSScott Long USHORT NumberOfCurrentHeads; /* 6E 55 */ 4411713e81bSScott Long USHORT CurrentSectorsPerTrack; /* 70 56 */ 4421713e81bSScott Long ULONG CurrentSectorCapacity; /* 72 57-58 */ 4431713e81bSScott Long USHORT CurrentMultiSectorSetting; /* 59 */ 4441713e81bSScott Long ULONG UserAddressableSectors; /* 60-61 */ 4451713e81bSScott Long USHORT SingleWordDMASupport : 8; /* 62 */ 4461713e81bSScott Long USHORT SingleWordDMAActive : 8; 4471713e81bSScott Long USHORT MultiWordDMASupport : 8; /* 63 */ 4481713e81bSScott Long USHORT MultiWordDMAActive : 8; 4491713e81bSScott Long USHORT AdvancedPIOModes : 8; /* 64 */ 4501713e81bSScott Long USHORT Reserved4 : 8; 4511713e81bSScott Long USHORT MinimumMWXferCycleTime; /* 65 */ 4521713e81bSScott Long USHORT RecommendedMWXferCycleTime; /* 66 */ 4531713e81bSScott Long USHORT MinimumPIOCycleTime; /* 67 */ 4541713e81bSScott Long USHORT MinimumPIOCycleTimeIORDY; /* 68 */ 4551713e81bSScott Long USHORT Reserved5[2]; /* 69-70 */ 4561713e81bSScott Long USHORT ReleaseTimeOverlapped; /* 71 */ 4571713e81bSScott Long USHORT ReleaseTimeServiceCommand; /* 72 */ 4581713e81bSScott Long USHORT MajorRevision; /* 73 */ 4591713e81bSScott Long USHORT MinorRevision; /* 74 */ 4601713e81bSScott Long /* USHORT Reserved6[14]; // 75-88 */ 4611713e81bSScott Long } IDENTIFY_DATA2, *PIDENTIFY_DATA2; 4621713e81bSScott Long #endif 4631713e81bSScott Long 4641713e81bSScott Long /* 4651713e81bSScott Long * physical device information. 4661713e81bSScott Long * IdentifyData.ModelNumber[] is byte-swapped from the original identify data. 4671713e81bSScott Long */ 4681713e81bSScott Long typedef struct _DEVICE_INFO { 4691713e81bSScott Long UCHAR ControllerId; /* controller id */ 4701713e81bSScott Long UCHAR PathId; /* bus */ 4711713e81bSScott Long UCHAR TargetId; /* id */ 4721713e81bSScott Long UCHAR DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 4731713e81bSScott Long /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 4741713e81bSScott Long UCHAR DeviceType; /* device type */ 4751713e81bSScott Long UCHAR UsableMode; /* highest usable mode */ 4761713e81bSScott Long 4771713e81bSScott Long UCHAR ReadAheadSupported: 1; 4781713e81bSScott Long UCHAR ReadAheadEnabled: 1; 4791713e81bSScott Long UCHAR WriteCacheSupported: 1; 4801713e81bSScott Long UCHAR WriteCacheEnabled: 1; 4811713e81bSScott Long UCHAR TCQSupported: 1; 4821713e81bSScott Long UCHAR TCQEnabled: 1; 4831713e81bSScott Long UCHAR NCQSupported: 1; 4841713e81bSScott Long UCHAR NCQEnabled: 1; 4851713e81bSScott Long UCHAR reserved; 4861713e81bSScott Long 4871713e81bSScott Long DWORD Flags; /* working flags, see DEVICE_FLAG_XXX */ 4881713e81bSScott Long 4891713e81bSScott Long IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */ 4901713e81bSScott Long 4911713e81bSScott Long } DEVICE_INFO, *PDEVICE_INFO; 4921713e81bSScott Long 4931713e81bSScott Long /* 4941713e81bSScott Long * HPT601 information 4951713e81bSScott Long */ 4961713e81bSScott Long #define HPT601_INFO_DEVICEID 1 4971713e81bSScott Long #define HPT601_INFO_TEMPERATURE 2 4981713e81bSScott Long #define HPT601_INFO_FANSTATUS 4 4991713e81bSScott Long #define HPT601_INFO_BEEPERCONTROL 8 5001713e81bSScott Long #define HPT601_INFO_LED1CONTROL 0x10 5011713e81bSScott Long #define HPT601_INFO_LED2CONTROL 0x20 5021713e81bSScott Long #define HPT601_INFO_POWERSTATUS 0x40 5031713e81bSScott Long 5041713e81bSScott Long typedef struct _HPT601_INFO { 5051713e81bSScott Long WORD ValidFields; /* mark valid fields below */ 5061713e81bSScott Long WORD DeviceId; /* 0x5A3E */ 5071713e81bSScott Long WORD Temperature; /* Read: temperature sensor value. Write: temperature limit */ 5081713e81bSScott Long WORD FanStatus; /* Fan status */ 5091713e81bSScott Long WORD BeeperControl; /* bit4: beeper control bit. bit0-3: frequency bits */ 5101713e81bSScott Long WORD LED1Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 5111713e81bSScott Long WORD LED2Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 5121713e81bSScott Long WORD PowerStatus; /* 1: has power 2: no power */ 5131713e81bSScott Long } HPT601_INFO, *PHPT601_INFO; 5141713e81bSScott Long 5151713e81bSScott Long /* 5161713e81bSScott Long * Logical device information. 5171713e81bSScott Long * Union of ArrayInfo and DeviceInfo. 5181713e81bSScott Long * Common properties will be put in logical device information. 5191713e81bSScott Long */ 5201713e81bSScott Long typedef struct _LOGICAL_DEVICE_INFO { 5211713e81bSScott Long UCHAR Type; /* LDT_ARRAY or LDT_DEVICE */ 5221713e81bSScott Long UCHAR reserved[3]; 5231713e81bSScott Long 5241713e81bSScott Long DWORD Capacity; /* array capacity */ 5251713e81bSScott Long DEVICEID ParentArray; 5261713e81bSScott Long 5271713e81bSScott Long union { 5281713e81bSScott Long HPT_ARRAY_INFO array; 5291713e81bSScott Long DEVICE_INFO device; 5301713e81bSScott Long } u; 5311713e81bSScott Long 5321713e81bSScott Long } LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO; 5331713e81bSScott Long 5341713e81bSScott Long #if HPT_INTERFACE_VERSION>=0x01010000 5351713e81bSScott Long typedef struct _LOGICAL_DEVICE_INFO_V2 { 5361713e81bSScott Long UCHAR Type; /* LDT_ARRAY or LDT_DEVICE */ 5371713e81bSScott Long UCHAR reserved[3]; 5381713e81bSScott Long 5391713e81bSScott Long LBA64 Capacity; /* array capacity */ 5401713e81bSScott Long DEVICEID ParentArray; 5411713e81bSScott Long 5421713e81bSScott Long union { 5431713e81bSScott Long HPT_ARRAY_INFO_V2 array; 5441713e81bSScott Long DEVICE_INFO device; 5451713e81bSScott Long } u; 5461713e81bSScott Long 5471713e81bSScott Long } LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2; 5481713e81bSScott Long #endif 5491713e81bSScott Long 5501713e81bSScott Long /* 5511713e81bSScott Long * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info() 5521713e81bSScott Long * and set_device_info(). 5531713e81bSScott Long * When set_xxx_info() is called, the ValidFields member indicates which 5541713e81bSScott Long * fields in the structure are valid. 5551713e81bSScott Long */ 5561713e81bSScott Long /* field masks */ 5571713e81bSScott Long #define AAIF_NAME 1 5581713e81bSScott Long #define AAIF_DESCRIPTION 2 5591713e81bSScott Long #define ADIF_MODE 1 5601713e81bSScott Long #define ADIF_TCQ 2 5611713e81bSScott Long #define ADIF_NCQ 4 5621713e81bSScott Long #define ADIF_WRITE_CACHE 8 5631713e81bSScott Long #define ADIF_READ_AHEAD 0x10 5641713e81bSScott Long 5651713e81bSScott Long typedef struct _ALTERABLE_ARRAY_INFO { 5661713e81bSScott Long DWORD ValidFields; /* mark valid fields below */ 5671713e81bSScott Long UCHAR Name[MAX_ARRAYNAME_LEN]; /* array name */ 5681713e81bSScott Long UCHAR Description[64]; /* array description */ 5691713e81bSScott Long } 5701713e81bSScott Long ALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO; 5711713e81bSScott Long 5721713e81bSScott Long typedef struct _ALTERABLE_DEVICE_INFO { 5731713e81bSScott Long DWORD ValidFields; /* mark valid fields below */ 5741713e81bSScott Long UCHAR DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 5751713e81bSScott Long } 5761713e81bSScott Long ALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO; 5771713e81bSScott Long 5781713e81bSScott Long typedef struct _ALTERABLE_DEVICE_INFO_V2 { 5791713e81bSScott Long DWORD ValidFields; /* mark valid fields below */ 5801713e81bSScott Long UCHAR DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 5811713e81bSScott Long UCHAR TCQEnabled; 5821713e81bSScott Long UCHAR NCQEnabled; 5831713e81bSScott Long UCHAR WriteCacheEnabled; 5841713e81bSScott Long UCHAR ReadAheadEnabled; 5851713e81bSScott Long UCHAR reserve[3]; 5861713e81bSScott Long ULONG reserve2[13]; /* pad to 64 bytes */ 5871713e81bSScott Long } 5881713e81bSScott Long ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2; 5891713e81bSScott Long 5901713e81bSScott Long /* 5911713e81bSScott Long * CREATE_ARRAY_PARAMS 5921713e81bSScott Long * Param structure used to create an array. 5931713e81bSScott Long */ 5941713e81bSScott Long typedef struct _CREATE_ARRAY_PARAMS { 5951713e81bSScott Long UCHAR ArrayType; /* 1-level array type */ 5961713e81bSScott Long UCHAR nDisk; /* number of elements in Members[] array */ 5971713e81bSScott Long UCHAR BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 5981713e81bSScott Long UCHAR CreateFlags; /* See CAF_xxx */ 5991713e81bSScott Long 6001713e81bSScott Long UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */ 6011713e81bSScott Long UCHAR Description[64]; /* array description */ 6021713e81bSScott Long UCHAR CreateManager[16]; /* who created it */ 6031713e81bSScott Long TIME_RECORD CreateTime; /* when created it */ 6041713e81bSScott Long 6051713e81bSScott Long DWORD Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */ 6061713e81bSScott Long 6071713e81bSScott Long } CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS; 6081713e81bSScott Long 6091713e81bSScott Long #if HPT_INTERFACE_VERSION>=0x01010000 6101713e81bSScott Long typedef struct _CREATE_ARRAY_PARAMS_V2 { 6111713e81bSScott Long UCHAR ArrayType; /* 1-level array type */ 6121713e81bSScott Long UCHAR nDisk; /* number of elements in Members[] array */ 6131713e81bSScott Long UCHAR BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 6141713e81bSScott Long UCHAR CreateFlags; /* See CAF_xxx */ 6151713e81bSScott Long 6161713e81bSScott Long UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */ 6171713e81bSScott Long UCHAR Description[64]; /* array description */ 6181713e81bSScott Long UCHAR CreateManager[16]; /* who created it */ 6191713e81bSScott Long TIME_RECORD CreateTime; /* when created it */ 6201713e81bSScott Long LBA64 Capacity; /* specify array capacity (0 for default) */ 6211713e81bSScott Long 6221713e81bSScott Long DWORD Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */ 6231713e81bSScott Long 6241713e81bSScott Long } CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2; 6251713e81bSScott Long #endif 6261713e81bSScott Long 6271713e81bSScott Long /* 6281713e81bSScott Long * Flags used for creating an RAID 1 array 6291713e81bSScott Long * 6301713e81bSScott Long * CAF_CREATE_AND_DUPLICATE 6311713e81bSScott Long * Copy source disk contents to target for RAID 1. If user choose "create and duplicate" 6321713e81bSScott Long * to create an array, GUI will call CreateArray() with this flag set. Then GUI should 6331713e81bSScott Long * call hpt_get_device_info() with the returned array ID and check returned flags to 6341713e81bSScott Long * see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding 6351713e81bSScott Long * and GUI must do duplication itself. 6361713e81bSScott Long * CAF_DUPLICATE_MUST_DONE 6371713e81bSScott Long * If the duplication is aborted or fails, do not create the array. 6381713e81bSScott Long */ 6391713e81bSScott Long #define CAF_CREATE_AND_DUPLICATE 1 6401713e81bSScott Long #define CAF_DUPLICATE_MUST_DONE 2 6411713e81bSScott Long #define CAF_CREATE_AS_RAID15 4 6421713e81bSScott Long /* 6431713e81bSScott Long * Flags used for creating an RAID 5 array 6441713e81bSScott Long */ 6451713e81bSScott Long #define CAF_CREATE_R5_NO_BUILD 1 6461713e81bSScott Long #define CAF_CREATE_R5_ZERO_INIT 2 6471713e81bSScott Long #define CAF_CREATE_R5_BUILD_PARITY 4 6481713e81bSScott Long 6491713e81bSScott Long /* 6501713e81bSScott Long * Flags used for deleting an array 6511713e81bSScott Long * 6521713e81bSScott Long * DAF_KEEP_DATA_IF_POSSIBLE 6531713e81bSScott Long * If this flag is set, deleting a RAID 1 array will not destroy the data on both disks. 6541713e81bSScott Long * Deleting a JBOD should keep partitions on first disk ( not implement now ). 6551713e81bSScott Long * Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ). 6561713e81bSScott Long */ 6571713e81bSScott Long #define DAF_KEEP_DATA_IF_POSSIBLE 1 6581713e81bSScott Long 6591713e81bSScott Long /* 6601713e81bSScott Long * event types 6611713e81bSScott Long */ 6621713e81bSScott Long #define ET_DEVICE_REMOVED 1 /* device removed */ 6631713e81bSScott Long #define ET_DEVICE_PLUGGED 2 /* device plugged */ 6641713e81bSScott Long #define ET_DEVICE_ERROR 3 /* device I/O error */ 6651713e81bSScott Long #define ET_REBUILD_STARTED 4 6661713e81bSScott Long #define ET_REBUILD_ABORTED 5 6671713e81bSScott Long #define ET_REBUILD_FINISHED 6 6681713e81bSScott Long #define ET_SPARE_TOOK_OVER 7 6691713e81bSScott Long #define ET_REBUILD_FAILED 8 6701713e81bSScott Long #define ET_VERIFY_STARTED 9 6711713e81bSScott Long #define ET_VERIFY_ABORTED 10 6721713e81bSScott Long #define ET_VERIFY_FAILED 11 6731713e81bSScott Long #define ET_VERIFY_FINISHED 12 6741713e81bSScott Long #define ET_INITIALIZE_STARTED 13 6751713e81bSScott Long #define ET_INITIALIZE_ABORTED 14 6761713e81bSScott Long #define ET_INITIALIZE_FAILED 15 6771713e81bSScott Long #define ET_INITIALIZE_FINISHED 16 6781713e81bSScott Long #define ET_VERIFY_DATA_ERROR 17 6791713e81bSScott Long 6801713e81bSScott Long /* 6811713e81bSScott Long * event structure 6821713e81bSScott Long */ 6831713e81bSScott Long typedef struct _HPT_EVENT { 6841713e81bSScott Long TIME_RECORD Time; 6851713e81bSScott Long DEVICEID DeviceID; 6861713e81bSScott Long UCHAR EventType; 6871713e81bSScott Long UCHAR reserved[3]; 6881713e81bSScott Long 6891713e81bSScott Long UCHAR Data[32]; /* various data depend on EventType */ 6901713e81bSScott Long } HPT_EVENT, *PHPT_EVENT; 6911713e81bSScott Long 6921713e81bSScott Long /* 6931713e81bSScott Long * IDE pass-through command. Use it at your own risk! 6941713e81bSScott Long */ 6951713e81bSScott Long #ifdef _MSC_VER 6961713e81bSScott Long #pragma warning(disable:4200) 6971713e81bSScott Long #endif 6981713e81bSScott Long typedef struct _IDE_PASS_THROUGH_HEADER { 6991713e81bSScott Long DEVICEID idDisk; /* disk ID */ 7001713e81bSScott Long BYTE bFeaturesReg; /* feature register */ 7011713e81bSScott Long BYTE bSectorCountReg; /* IDE sector count register. */ 70264470755SXin LI BYTE bLbaLowReg; /* IDE sector number register. */ 70364470755SXin LI BYTE bLbaMidReg; /* IDE low order cylinder value. */ 70464470755SXin LI BYTE bLbaHighReg; /* IDE high order cylinder value. */ 7051713e81bSScott Long BYTE bDriveHeadReg; /* IDE drive/head register. */ 7061713e81bSScott Long BYTE bCommandReg; /* Actual IDE command. Checked for validity by driver. */ 70764470755SXin LI BYTE nSectors; /* data sze in sectors, if the command has data transfer */ 70864470755SXin LI BYTE protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */ 70964470755SXin LI BYTE reserve[3]; 71064470755SXin LI #define IDE_PASS_THROUGH_buffer(p) ((unsigned char *)(p) + sizeof(IDE_PASS_THROUGH_HEADER)) 7111713e81bSScott Long } 7121713e81bSScott Long IDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER; 7131713e81bSScott Long 7141713e81bSScott Long /* 7151713e81bSScott Long * device io packet format 7161713e81bSScott Long */ 7171713e81bSScott Long typedef struct _DEVICE_IO_EX_PARAMS { 7181713e81bSScott Long DEVICEID idDisk; 7191713e81bSScott Long ULONG Lba; 7201713e81bSScott Long USHORT nSectors; 7211713e81bSScott Long UCHAR Command; /* IO_COMMAD_xxx */ 7221713e81bSScott Long UCHAR BufferType; /* BUFFER_TYPE_xxx, see below */ 7231713e81bSScott Long ULONG BufferPtr; 7241713e81bSScott Long } 7251713e81bSScott Long DEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS; 7261713e81bSScott Long 7271713e81bSScott Long #define BUFFER_TYPE_LOGICAL 1 /* logical pointer to buffer */ 7281713e81bSScott Long #define BUFFER_TYPE_PHYSICAL 2 /* physical address of buffer */ 7291713e81bSScott Long #define BUFFER_TYPE_LOGICAL_LOGICAL_SG 3 /* logical pointer to logical S/G table */ 7301713e81bSScott Long #define BUFFER_TYPE_LOGICAL_PHYSICAL_SG 4 /* logical pointer to physical S/G table */ 7311713e81bSScott Long #define BUFFER_TYPE_PHYSICAL_LOGICAL_SG 5 /* physical address to logical S/G table */ 7321713e81bSScott Long #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */ 7331713e81bSScott Long #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */ 7341713e81bSScott Long 7351713e81bSScott Long /* 7361713e81bSScott Long * all ioctl functions should use far pointers. It's not a problem on 7371713e81bSScott Long * 32bit platforms, however, BIOS needs care. 7381713e81bSScott Long */ 7391713e81bSScott Long 7401713e81bSScott Long /* 7411713e81bSScott Long * ioctl structure 7421713e81bSScott Long */ 74364470755SXin LI #define HPT_IOCTL_MAGIC32 0x1A2B3C4D 74464470755SXin LI #define HPT_IOCTL_MAGIC 0xA1B2C3D4 7451713e81bSScott Long 7461713e81bSScott Long typedef struct _HPT_IOCTL_PARAM { 7471713e81bSScott Long DWORD Magic; /* used to check if it's a valid ioctl packet */ 7481713e81bSScott Long DWORD dwIoControlCode; /* operation control code */ 7491713e81bSScott Long LPVOID lpInBuffer; /* input data buffer */ 7501713e81bSScott Long DWORD nInBufferSize; /* size of input data buffer */ 7511713e81bSScott Long LPVOID lpOutBuffer; /* output data buffer */ 7521713e81bSScott Long DWORD nOutBufferSize; /* size of output data buffer */ 7531713e81bSScott Long LPDWORD lpBytesReturned; /* count of bytes returned */ 7541713e81bSScott Long } 7551713e81bSScott Long HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM; 7561713e81bSScott Long 75764470755SXin LI /* for 32-bit app running on 64-bit system */ 7581713e81bSScott Long typedef struct _HPT_IOCTL_PARAM32 { 7591713e81bSScott Long DWORD Magic; 7601713e81bSScott Long DWORD dwIoControlCode; 7611713e81bSScott Long DWORD lpInBuffer; 7621713e81bSScott Long DWORD nInBufferSize; 7631713e81bSScott Long DWORD lpOutBuffer; 7641713e81bSScott Long DWORD nOutBufferSize; 7651713e81bSScott Long DWORD lpBytesReturned; 7661713e81bSScott Long } 7671713e81bSScott Long HPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32; 7681713e81bSScott Long 7691713e81bSScott Long /* 7701713e81bSScott Long * User-mode ioctl parameter passing conventions: 7711713e81bSScott Long * The ioctl function implementation is platform specific, so we don't 7721713e81bSScott Long * have forced rules for it. However, it's suggested to use a parameter 7731713e81bSScott Long * passing method as below 7741713e81bSScott Long * 1) Put all input data continuously in an input buffer. 7751713e81bSScott Long * 2) Prepare an output buffer with enough size if needed. 7761713e81bSScott Long * 3) Fill a HPT_IOCTL_PARAM structure. 7771713e81bSScott Long * 4) Pass the structure to driver through a platform-specific method. 7781713e81bSScott Long * This is implemented in the mid-layer user-mode library. The UI 7791713e81bSScott Long * programmer needn't care about it. 7801713e81bSScott Long */ 7811713e81bSScott Long 7821713e81bSScott Long /************************************************************************ 7831713e81bSScott Long * User mode functions 7841713e81bSScott Long ************************************************************************/ 7851713e81bSScott Long #ifndef __KERNEL__ 7861713e81bSScott Long /* 7871713e81bSScott Long * hpt_get_version 7881713e81bSScott Long * Version compatibility: all versions 7891713e81bSScott Long * Parameters: 7901713e81bSScott Long * None 7911713e81bSScott Long * Returns: 7921713e81bSScott Long * interface version. 0 when fail. 7931713e81bSScott Long */ 794d2bd3ab9SScott Long DWORD hpt_get_version(); 7951713e81bSScott Long 7961713e81bSScott Long /*-------------------------------------------------------------------------- */ 7971713e81bSScott Long 7981713e81bSScott Long /* 7991713e81bSScott Long * hpt_get_driver_capabilities 8001713e81bSScott Long * Version compatibility: v1.0.0.2 or later 8011713e81bSScott Long * Parameters: 8021713e81bSScott Long * Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set 8031713e81bSScott Long * dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this 8041713e81bSScott Long * member to see if it's correct. 8051713e81bSScott Long * Returns: 8061713e81bSScott Long * 0 - Success 8071713e81bSScott Long */ 8081713e81bSScott Long int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap); 8091713e81bSScott Long 8101713e81bSScott Long /*-------------------------------------------------------------------------- */ 8111713e81bSScott Long 8121713e81bSScott Long /* 8131713e81bSScott Long * hpt_get_controller_count 8141713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8151713e81bSScott Long * Parameters: 8161713e81bSScott Long * None 8171713e81bSScott Long * Returns: 8181713e81bSScott Long * number of controllers 8191713e81bSScott Long */ 820d2bd3ab9SScott Long int hpt_get_controller_count(); 8211713e81bSScott Long 8221713e81bSScott Long /*-------------------------------------------------------------------------- */ 8231713e81bSScott Long 8241713e81bSScott Long /* hpt_get_controller_info 8251713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8261713e81bSScott Long * Parameters: 8271713e81bSScott Long * id Controller id 8281713e81bSScott Long * pInfo pointer to CONTROLLER_INFO buffer 8291713e81bSScott Long * Returns: 8301713e81bSScott Long * 0 Success, controller info is put into (*pInfo ). 8311713e81bSScott Long */ 8321713e81bSScott Long int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo); 8331713e81bSScott Long 8341713e81bSScott Long /*-------------------------------------------------------------------------- */ 8351713e81bSScott Long 8361713e81bSScott Long /* hpt_get_channel_info 8371713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8381713e81bSScott Long * Parameters: 8391713e81bSScott Long * id Controller id 8401713e81bSScott Long * bus bus number 8411713e81bSScott Long * pInfo pointer to CHANNEL_INFO buffer 8421713e81bSScott Long * Returns: 8431713e81bSScott Long * 0 Success, channel info is put into (*pInfo ). 8441713e81bSScott Long */ 8451713e81bSScott Long int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo); 8461713e81bSScott Long 8471713e81bSScott Long /*-------------------------------------------------------------------------- */ 8481713e81bSScott Long 8491713e81bSScott Long /* hpt_get_logical_devices 8501713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8511713e81bSScott Long * Parameters: 8521713e81bSScott Long * pIds pointer to a DEVICEID array 8531713e81bSScott Long * nMaxCount array size 8541713e81bSScott Long * Returns: 8551713e81bSScott Long * Number of ID returned. All logical device IDs are put into pIds array. 8561713e81bSScott Long * Note: A spare disk is not a logical device. 8571713e81bSScott Long */ 8581713e81bSScott Long int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount); 8591713e81bSScott Long 8601713e81bSScott Long /*-------------------------------------------------------------------------- */ 8611713e81bSScott Long 8621713e81bSScott Long /* hpt_get_device_info 8631713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8641713e81bSScott Long * Parameters: 8651713e81bSScott Long * id logical device id 8661713e81bSScott Long * pInfo pointer to HPT_ARRAY_INFO structure 8671713e81bSScott Long * Returns: 8681713e81bSScott Long * 0 - Success 8691713e81bSScott Long */ 8701713e81bSScott Long int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo); 8711713e81bSScott Long 8721713e81bSScott Long #if HPT_INTERFACE_VERSION>=0x01010000 8731713e81bSScott Long int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo); 8741713e81bSScott Long #endif 8751713e81bSScott Long 8761713e81bSScott Long /*-------------------------------------------------------------------------- */ 8771713e81bSScott Long 8781713e81bSScott Long /* hpt_create_array 8791713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8801713e81bSScott Long * Parameters: 8811713e81bSScott Long * pParam pointer to CREATE_ARRAY_PARAMS structure 8821713e81bSScott Long * Returns: 8831713e81bSScott Long * 0 failed 8841713e81bSScott Long * else return array id 8851713e81bSScott Long */ 8861713e81bSScott Long DEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam); 8871713e81bSScott Long 8881713e81bSScott Long #if HPT_INTERFACE_VERSION>=0x01010000 8891713e81bSScott Long DEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam); 8901713e81bSScott Long #endif 8911713e81bSScott Long 8921713e81bSScott Long /*-------------------------------------------------------------------------- */ 8931713e81bSScott Long 8941713e81bSScott Long /* hpt_delete_array 8951713e81bSScott Long * Version compatibility: v1.0.0.1 or later 8961713e81bSScott Long * Parameters: 8971713e81bSScott Long * id array id 8981713e81bSScott Long * Returns: 8991713e81bSScott Long * 0 Success 9001713e81bSScott Long */ 9011713e81bSScott Long int hpt_delete_array(DEVICEID id, DWORD options); 9021713e81bSScott Long 9031713e81bSScott Long /*-------------------------------------------------------------------------- */ 9041713e81bSScott Long 9051713e81bSScott Long /* hpt_device_io 9061713e81bSScott Long * Read/write data on array and physcal device. 9071713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9081713e81bSScott Long * Parameters: 9091713e81bSScott Long * id device id. If it's an array ID, IO will be performed on the array. 9101713e81bSScott Long * If it's a physical device ID, IO will be performed on the device. 9111713e81bSScott Long * cmd IO_COMMAND_READ or IO_COMMAND_WRITE 9121713e81bSScott Long * buffer data buffer 9131713e81bSScott Long * length data size 9141713e81bSScott Long * Returns: 9151713e81bSScott Long * 0 Success 9161713e81bSScott Long */ 9171713e81bSScott Long int hpt_device_io(DEVICEID id, int cmd, ULONG lba, DWORD nSector, LPVOID buffer); 9181713e81bSScott Long 9191713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 9201713e81bSScott Long int hpt_device_io_v2(DEVICEID id, int cmd, LBA64 lba, DWORD nSector, LPVOID buffer); 9211713e81bSScott Long #endif 9221713e81bSScott Long 9231713e81bSScott Long /* hpt_add_disk_to_array 9241713e81bSScott Long * Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array. 9251713e81bSScott Long * Auto-rebuild will start. 9261713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9271713e81bSScott Long * Parameters: 9281713e81bSScott Long * idArray array id 9291713e81bSScott Long * idDisk disk id 9301713e81bSScott Long * Returns: 9311713e81bSScott Long * 0 Success 9321713e81bSScott Long */ 9331713e81bSScott Long int hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk); 9341713e81bSScott Long /*-------------------------------------------------------------------------- */ 9351713e81bSScott Long 9361713e81bSScott Long /* hpt_add_spare_disk 9371713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9381713e81bSScott Long * Add a disk to spare pool. 9391713e81bSScott Long * Parameters: 9401713e81bSScott Long * idDisk disk id 9411713e81bSScott Long * Returns: 9421713e81bSScott Long * 0 Success 9431713e81bSScott Long */ 9441713e81bSScott Long int hpt_add_spare_disk(DEVICEID idDisk); 9451713e81bSScott Long /*-------------------------------------------------------------------------- */ 9461713e81bSScott Long 9471713e81bSScott Long /* hpt_add_dedicated_spare 9481713e81bSScott Long * Version compatibility: v1.0.0.3 or later 9491713e81bSScott Long * Add a spare disk to an array 9501713e81bSScott Long * Parameters: 9511713e81bSScott Long * idDisk disk id 9521713e81bSScott Long * idArray array id 9531713e81bSScott Long * Returns: 9541713e81bSScott Long * 0 Success 9551713e81bSScott Long */ 9561713e81bSScott Long int hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray); 9571713e81bSScott Long /*-------------------------------------------------------------------------- */ 9581713e81bSScott Long 9591713e81bSScott Long /* hpt_remove_spare_disk 9601713e81bSScott Long * remove a disk from spare pool. 9611713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9621713e81bSScott Long * Parameters: 9631713e81bSScott Long * idDisk disk id 9641713e81bSScott Long * Returns: 9651713e81bSScott Long * 0 Success 9661713e81bSScott Long */ 9671713e81bSScott Long int hpt_remove_spare_disk(DEVICEID idDisk); 9681713e81bSScott Long /*-------------------------------------------------------------------------- */ 9691713e81bSScott Long 9701713e81bSScott Long /* hpt_get_event 9711713e81bSScott Long * Used to poll events from driver. 9721713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9731713e81bSScott Long * Parameters: 9741713e81bSScott Long * pEvent pointer to HPT_EVENT structure 9751713e81bSScott Long * Returns: 9761713e81bSScott Long * 0 Success, event info is filled in *pEvent 9771713e81bSScott Long */ 9781713e81bSScott Long int hpt_get_event(PHPT_EVENT pEvent); 9791713e81bSScott Long /*-------------------------------------------------------------------------- */ 9801713e81bSScott Long 9811713e81bSScott Long /* hpt_rebuild_data_block 9821713e81bSScott Long * Used to copy data from source disk and mirror disk. 9831713e81bSScott Long * Version compatibility: v1.0.0.1 or later 9841713e81bSScott Long * Parameters: 9851713e81bSScott Long * idArray Array ID (RAID1, 0/1 or RAID5) 9861713e81bSScott Long * Lba Start LBA for each array member 9871713e81bSScott Long * nSector Number of sectors for each array member (RAID 5 will ignore this parameter) 9881713e81bSScott Long * 9891713e81bSScott Long * Returns: 9901713e81bSScott Long * 0 Success, event info is filled in *pEvent 9911713e81bSScott Long */ 9921713e81bSScott Long int hpt_rebuild_data_block(DEVICEID idMirror, DWORD Lba, UCHAR nSector); 9931713e81bSScott Long #define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3) 9941713e81bSScott Long 9951713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 9961713e81bSScott Long int hpt_rebuild_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSector); 9971713e81bSScott Long #endif 9981713e81bSScott Long /*-------------------------------------------------------------------------- */ 9991713e81bSScott Long 10001713e81bSScott Long /* hpt_set_array_state 10011713e81bSScott Long * set array state. 10021713e81bSScott Long * Version compatibility: v1.0.0.1 or later 10031713e81bSScott Long * Parameters: 10041713e81bSScott Long * idArray Array ID 10051713e81bSScott Long * state See above 'array states' constants, possible values are: 10061713e81bSScott Long * MIRROR_REBUILD_START 10071713e81bSScott Long * Indicate that GUI wants to rebuild a mirror array 10081713e81bSScott Long * MIRROR_REBUILD_ABORT 10091713e81bSScott Long * GUI wants to abort rebuilding an array 10101713e81bSScott Long * MIRROR_REBUILD_COMPLETE 10111713e81bSScott Long * GUI finished to rebuild an array. If rebuild is done by driver this 10121713e81bSScott Long * state has no use 10131713e81bSScott Long * 10141713e81bSScott Long * Returns: 10151713e81bSScott Long * 0 Success 10161713e81bSScott Long */ 10171713e81bSScott Long int hpt_set_array_state(DEVICEID idArray, DWORD state); 10181713e81bSScott Long /*-------------------------------------------------------------------------- */ 10191713e81bSScott Long 10201713e81bSScott Long /* hpt_set_array_info 10211713e81bSScott Long * set array info. 10221713e81bSScott Long * Version compatibility: v1.0.0.1 or later 10231713e81bSScott Long * Parameters: 10241713e81bSScott Long * idArray Array ID 10251713e81bSScott Long * pInfo pointer to new info 10261713e81bSScott Long * 10271713e81bSScott Long * Returns: 10281713e81bSScott Long * 0 Success 10291713e81bSScott Long */ 10301713e81bSScott Long int hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo); 10311713e81bSScott Long /*-------------------------------------------------------------------------- */ 10321713e81bSScott Long 10331713e81bSScott Long /* hpt_set_device_info 10341713e81bSScott Long * set device info. 10351713e81bSScott Long * Version compatibility: v1.0.0.1 or later 10361713e81bSScott Long * Parameters: 10371713e81bSScott Long * idDisk device ID 10381713e81bSScott Long * pInfo pointer to new info 10391713e81bSScott Long * 10401713e81bSScott Long * Returns: 10411713e81bSScott Long * 0 Success 10421713e81bSScott Long * Additional notes: 10431713e81bSScott Long * If idDisk==0, call to this function will stop buzzer on the adapter 10441713e81bSScott Long * (if supported by driver). 10451713e81bSScott Long */ 10461713e81bSScott Long int hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo); 10471713e81bSScott Long 10481713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01000004 10491713e81bSScott Long int hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo); 10501713e81bSScott Long #endif 10511713e81bSScott Long 10521713e81bSScott Long /*-------------------------------------------------------------------------- */ 10531713e81bSScott Long 10541713e81bSScott Long /* hpt_rescan_devices 10551713e81bSScott Long * rescan devices 10561713e81bSScott Long * Version compatibility: v1.0.0.1 or later 10571713e81bSScott Long * Parameters: 10581713e81bSScott Long * None 10591713e81bSScott Long * Returns: 10601713e81bSScott Long * 0 Success 10611713e81bSScott Long */ 1062d2bd3ab9SScott Long int hpt_rescan_devices(); 10631713e81bSScott Long /*-------------------------------------------------------------------------- */ 10641713e81bSScott Long 10651713e81bSScott Long /* hpt_get_601_info 10661713e81bSScott Long * Get HPT601 status 10671713e81bSScott Long * Version compatibiilty: v1.0.0.3 or later 10681713e81bSScott Long * Parameters: 10691713e81bSScott Long * idDisk - Disk handle 10701713e81bSScott Long * PHPT601_INFO - pointer to HPT601 info buffer 10711713e81bSScott Long * Returns: 10721713e81bSScott Long * 0 Success 10731713e81bSScott Long */ 10741713e81bSScott Long int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 10751713e81bSScott Long /*-------------------------------------------------------------------------- */ 10761713e81bSScott Long 10771713e81bSScott Long /* hpt_set_601_info 10781713e81bSScott Long * HPT601 function control 10791713e81bSScott Long * Version compatibiilty: v1.0.0.3 or later 10801713e81bSScott Long * Parameters: 10811713e81bSScott Long * idDisk - Disk handle 10821713e81bSScott Long * PHPT601_INFO - pointer to HPT601 info buffer 10831713e81bSScott Long * Returns: 10841713e81bSScott Long * 0 Success 10851713e81bSScott Long */ 10861713e81bSScott Long int hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 10871713e81bSScott Long /*-------------------------------------------------------------------------- */ 10881713e81bSScott Long 10891713e81bSScott Long /* hpt_lock_device 10901713e81bSScott Long * Lock a block on a device (prevent OS accessing it) 10911713e81bSScott Long * Version compatibiilty: v1.0.0.3 or later 10921713e81bSScott Long * Parameters: 10931713e81bSScott Long * idDisk - Disk handle 10941713e81bSScott Long * Lba - Start LBA 10951713e81bSScott Long * nSectors - number of sectors 10961713e81bSScott Long * Returns: 10971713e81bSScott Long * 0 Success 10981713e81bSScott Long */ 10991713e81bSScott Long int hpt_lock_device(DEVICEID idDisk, ULONG Lba, UCHAR nSectors); 11001713e81bSScott Long 11011713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 11021713e81bSScott Long int hpt_lock_device_v2(DEVICEID idDisk, LBA64 Lba, USHORT nSectors); 11031713e81bSScott Long #endif 11041713e81bSScott Long /*-------------------------------------------------------------------------- */ 11051713e81bSScott Long 11061713e81bSScott Long /* hpt_lock_device 11071713e81bSScott Long * Unlock a device 11081713e81bSScott Long * Version compatibiilty: v1.0.0.3 or later 11091713e81bSScott Long * Parameters: 11101713e81bSScott Long * idDisk - Disk handle 11111713e81bSScott Long * Returns: 11121713e81bSScott Long * 0 Success 11131713e81bSScott Long */ 11141713e81bSScott Long int hpt_unlock_device(DEVICEID idDisk); 11151713e81bSScott Long /*-------------------------------------------------------------------------- */ 11161713e81bSScott Long 11171713e81bSScott Long /* hpt_ide_pass_through 11181713e81bSScott Long * directly access controller's command and control registers. 11191713e81bSScott Long * Can only call it on physical devices. 11201713e81bSScott Long * Version compatibility: v1.0.0.3 or later 11211713e81bSScott Long * Parameters: 11221713e81bSScott Long * p - IDE_PASS_THROUGH header pointer 11231713e81bSScott Long * Returns: 11241713e81bSScott Long * 0 Success 11251713e81bSScott Long */ 11261713e81bSScott Long int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p); 11271713e81bSScott Long /*-------------------------------------------------------------------------- */ 11281713e81bSScott Long 11291713e81bSScott Long /* hpt_verify_data_block 11301713e81bSScott Long * verify data block on RAID1 or RAID5. 11311713e81bSScott Long * Version compatibility: v1.0.0.3 or later 11321713e81bSScott Long * Parameters: 11331713e81bSScott Long * idArray - Array ID 11341713e81bSScott Long * Lba - block number (on each array member, not logical block!) 11351713e81bSScott Long * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 11361713e81bSScott Long * Returns: 11371713e81bSScott Long * 0 Success 11381713e81bSScott Long * 1 Data compare error 11391713e81bSScott Long * 2 I/O error 11401713e81bSScott Long */ 11411713e81bSScott Long int hpt_verify_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors); 11421713e81bSScott Long 11431713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 11441713e81bSScott Long int hpt_verify_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors); 11451713e81bSScott Long #endif 11461713e81bSScott Long /*-------------------------------------------------------------------------- */ 11471713e81bSScott Long 11481713e81bSScott Long /* hpt_initialize_data_block 11491713e81bSScott Long * initialize data block (fill with zero) on RAID5 11501713e81bSScott Long * Version compatibility: v1.0.0.3 or later 11511713e81bSScott Long * Parameters: 11521713e81bSScott Long * idArray - Array ID 11531713e81bSScott Long * Lba - block number (on each array member, not logical block!) 11541713e81bSScott Long * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 11551713e81bSScott Long * Returns: 11561713e81bSScott Long * 0 Success 11571713e81bSScott Long */ 11581713e81bSScott Long int hpt_initialize_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors); 11591713e81bSScott Long 11601713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 11611713e81bSScott Long int hpt_initialize_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors); 11621713e81bSScott Long #endif 11631713e81bSScott Long /*-------------------------------------------------------------------------- */ 11641713e81bSScott Long 11651713e81bSScott Long /* hpt_device_io_ex 11661713e81bSScott Long * extended device I/O function 11671713e81bSScott Long * Version compatibility: v1.0.0.3 or later 11681713e81bSScott Long * Parameters: 11691713e81bSScott Long * idArray - Array ID 11701713e81bSScott Long * Lba - block number (on each array member, not logical block!) 11711713e81bSScott Long * nSectors - Sectors for each member 11721713e81bSScott Long * buffer - I/O buffer or s/g address 11731713e81bSScott Long * Returns: 11741713e81bSScott Long * 0 Success 11751713e81bSScott Long */ 11761713e81bSScott Long int hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param); 11771713e81bSScott Long #if HPT_INTERFACE_VERSION >= 0x01010000 11781713e81bSScott Long int hpt_device_io_ex_v2(void * param); /* NOT IMPLEMENTED */ 11791713e81bSScott Long #endif 11801713e81bSScott Long /*-------------------------------------------------------------------------- */ 11811713e81bSScott Long 11821713e81bSScott Long /* hpt_set_boot_mark 11831713e81bSScott Long * select boot device 11841713e81bSScott Long * Version compatibility: v1.0.0.3 or later 11851713e81bSScott Long * Parameters: 11861713e81bSScott Long * id - logical device ID. If id is 0 the boot mark will be removed. 11871713e81bSScott Long * Returns: 11881713e81bSScott Long * 0 Success 11891713e81bSScott Long */ 11901713e81bSScott Long int hpt_set_boot_mark(DEVICEID id); 11911713e81bSScott Long /*-------------------------------------------------------------------------- */ 11921713e81bSScott Long 11931713e81bSScott Long /* hpt_query_remove 11941713e81bSScott Long * check if device can be removed safely 11951713e81bSScott Long * Version compatibility: v1.0.0.4 or later 11961713e81bSScott Long * Parameters: 11971713e81bSScott Long * ndev - number of devices 11981713e81bSScott Long * pIds - device ID list 11991713e81bSScott Long * Returns: 12001713e81bSScott Long * 0 - Success 12011713e81bSScott Long * -1 - unknown error 12021713e81bSScott Long * n - the n-th device that can't be removed 12031713e81bSScott Long */ 12041713e81bSScott Long int hpt_query_remove(DWORD ndev, DEVICEID *pIds); 12051713e81bSScott Long /*-------------------------------------------------------------------------- */ 12061713e81bSScott Long 12071713e81bSScott Long /* hpt_remove_devices 12081713e81bSScott Long * remove a list of devices 12091713e81bSScott Long * Version compatibility: v1.0.0.4 or later 12101713e81bSScott Long * Parameters: 12111713e81bSScott Long * ndev - number of devices 12121713e81bSScott Long * pIds - device ID list 12131713e81bSScott Long * Returns: 12141713e81bSScott Long * 0 - Success 12151713e81bSScott Long * -1 - unknown error 12161713e81bSScott Long * n - the n-th device that can't be removed 12171713e81bSScott Long */ 12181713e81bSScott Long int hpt_remove_devices(DWORD ndev, DEVICEID *pIds); 12191713e81bSScott Long /*-------------------------------------------------------------------------- */ 12201713e81bSScott Long 122164470755SXin LI /* hpt_ide_pass_through 122264470755SXin LI * directly access controller's command and control registers. 122364470755SXin LI * Can only call it on physical devices. 122464470755SXin LI * Version compatibility: v1.0.0.3 or later 122564470755SXin LI * Parameters: 122664470755SXin LI * p - IDE_PASS_THROUGH header pointer 122764470755SXin LI * Returns: 122864470755SXin LI * 0 Success 122964470755SXin LI */ 123064470755SXin LI int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p); 123164470755SXin LI /*-------------------------------------------------------------------------- */ 123264470755SXin LI 12331713e81bSScott Long #endif 12341713e81bSScott Long 12351713e81bSScott Long #pragma pack() 12361713e81bSScott Long #endif 1237