11fdeb165SXin LI /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 41fdeb165SXin LI * Copyright (c) 2011 HighPoint Technologies, Inc. 51fdeb165SXin LI * All rights reserved. 61fdeb165SXin LI * 71fdeb165SXin LI * Redistribution and use in source and binary forms, with or without 81fdeb165SXin LI * modification, are permitted provided that the following conditions 91fdeb165SXin LI * are met: 101fdeb165SXin LI * 1. Redistributions of source code must retain the above copyright 111fdeb165SXin LI * notice, this list of conditions and the following disclaimer. 121fdeb165SXin LI * 2. Redistributions in binary form must reproduce the above copyright 131fdeb165SXin LI * notice, this list of conditions and the following disclaimer in the 141fdeb165SXin LI * documentation and/or other materials provided with the distribution. 151fdeb165SXin LI * 161fdeb165SXin LI * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 171fdeb165SXin LI * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181fdeb165SXin LI * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191fdeb165SXin LI * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 201fdeb165SXin LI * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211fdeb165SXin LI * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221fdeb165SXin LI * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231fdeb165SXin LI * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241fdeb165SXin LI * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251fdeb165SXin LI * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261fdeb165SXin LI * SUCH DAMAGE. 271fdeb165SXin LI */ 281fdeb165SXin LI 291fdeb165SXin LI #include <dev/hptnr/hptnr_config.h> 301fdeb165SXin LI 311fdeb165SXin LI #ifndef HPT_INTF_H 321fdeb165SXin LI #define HPT_INTF_H 331fdeb165SXin LI 341fdeb165SXin LI #if defined(__BIG_ENDIAN__)&&!defined(__BIG_ENDIAN_BITFIELD) 351fdeb165SXin LI #define __BIG_ENDIAN_BITFIELD 361fdeb165SXin LI #endif 371fdeb165SXin LI 381fdeb165SXin LI #ifdef __cplusplus 391fdeb165SXin LI extern "C" { 401fdeb165SXin LI #endif 411fdeb165SXin LI 421fdeb165SXin LI #ifndef __GNUC__ 431fdeb165SXin LI #define __attribute__(x) 441fdeb165SXin LI #endif 451fdeb165SXin LI 461fdeb165SXin LI #pragma pack(1) 471fdeb165SXin LI 481fdeb165SXin LI /* 491fdeb165SXin LI * Version of this interface. 501fdeb165SXin LI * The user mode application must first issue a hpt_get_version() call to 511fdeb165SXin LI * check HPT_INTERFACE_VERSION. When an utility using newer version interface 521fdeb165SXin LI * is used with old version drivers, it must call only the functions that 531fdeb165SXin LI * driver supported. 541fdeb165SXin LI * A new version interface should only add ioctl functions; it should implement 551fdeb165SXin LI * all old version functions without change their definition. 561fdeb165SXin LI */ 571fdeb165SXin LI #define __this_HPT_INTERFACE_VERSION 0x02010000 581fdeb165SXin LI 591fdeb165SXin LI #ifndef HPT_INTERFACE_VERSION 601fdeb165SXin LI #error "You must define HPT_INTERFACE_VERSION you implemented" 611fdeb165SXin LI #endif 621fdeb165SXin LI 631fdeb165SXin LI #if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION 641fdeb165SXin LI #error "HPT_INTERFACE_VERSION is invalid" 651fdeb165SXin LI #endif 661fdeb165SXin LI 671fdeb165SXin LI /* 681fdeb165SXin LI * DEFINITION 691fdeb165SXin LI * Logical device --- a device that can be accessed by OS. 701fdeb165SXin LI * Physical device --- device attached to the controller. 711fdeb165SXin LI * A logical device can be simply a physical device. 721fdeb165SXin LI * 731fdeb165SXin LI * Each logical and physical device has a 32bit ID. GUI will use this ID 741fdeb165SXin LI * to identify devices. 751fdeb165SXin LI * 1. The ID must be unique. 761fdeb165SXin LI * 2. The ID must be immutable. Once an ID is assigned to a device, it 771fdeb165SXin LI * must not change when system is running and the device exists. 781fdeb165SXin LI * 3. The ID of logical device must be NOT reusable. If a device is 791fdeb165SXin LI * removed, other newly created logical device must not use the same ID. 801fdeb165SXin LI * 4. The ID must not be zero or 0xFFFFFFFF. 811fdeb165SXin LI */ 821fdeb165SXin LI typedef HPT_U32 DEVICEID; 831fdeb165SXin LI 841fdeb165SXin LI /* 851fdeb165SXin LI * logical device type. 861fdeb165SXin LI * Identify array (logical device) and physical device. 871fdeb165SXin LI */ 881fdeb165SXin LI #define LDT_ARRAY 1 891fdeb165SXin LI #define LDT_DEVICE 2 901fdeb165SXin LI 911fdeb165SXin LI /* 921fdeb165SXin LI * Array types 931fdeb165SXin LI * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0. 941fdeb165SXin LI * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0. 951fdeb165SXin LI * Their members may be another array of type RAID0 or RAID1. 961fdeb165SXin LI */ 971fdeb165SXin LI #define AT_UNKNOWN 0 981fdeb165SXin LI #define AT_RAID0 1 991fdeb165SXin LI #define AT_RAID1 2 1001fdeb165SXin LI #define AT_RAID5 3 1011fdeb165SXin LI #define AT_RAID6 4 1021fdeb165SXin LI #define AT_RAID3 5 1031fdeb165SXin LI #define AT_RAID4 6 1041fdeb165SXin LI #define AT_JBOD 7 1051fdeb165SXin LI #define AT_RAID1E 8 1061fdeb165SXin LI 1071fdeb165SXin LI /* 1081fdeb165SXin LI * physical device type 1091fdeb165SXin LI */ 1101fdeb165SXin LI #define PDT_UNKNOWN 0 1111fdeb165SXin LI #define PDT_HARDDISK 1 1121fdeb165SXin LI #define PDT_CDROM 2 1131fdeb165SXin LI #define PDT_TAPE 3 1141fdeb165SXin LI 1151fdeb165SXin LI /* 1161fdeb165SXin LI * Some constants. 1171fdeb165SXin LI */ 1181fdeb165SXin LI #define MAX_NAME_LENGTH 36 1191fdeb165SXin LI #define MAX_ARRAYNAME_LEN 16 1201fdeb165SXin LI 1211fdeb165SXin LI #define MAX_ARRAY_MEMBERS_V1 8 1221fdeb165SXin LI 1231fdeb165SXin LI #ifndef MAX_ARRAY_MEMBERS_V2 1241fdeb165SXin LI #define MAX_ARRAY_MEMBERS_V2 16 1251fdeb165SXin LI #endif 1261fdeb165SXin LI 1271fdeb165SXin LI #ifndef MAX_ARRAY_MEMBERS_V3 1281fdeb165SXin LI #define MAX_ARRAY_MEMBERS_V3 64 1291fdeb165SXin LI #endif 1301fdeb165SXin LI 131453130d9SPedro F. Giffuni /* keep definition for source code compatibility */ 1321fdeb165SXin LI #define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1 1331fdeb165SXin LI 1341fdeb165SXin LI /* 1351fdeb165SXin LI * io commands 1361fdeb165SXin LI * GUI use these commands to do IO on logical/physical devices. 1371fdeb165SXin LI */ 1381fdeb165SXin LI #define IO_COMMAND_READ 1 1391fdeb165SXin LI #define IO_COMMAND_WRITE 2 1401fdeb165SXin LI 1411fdeb165SXin LI 1421fdeb165SXin LI 1431fdeb165SXin LI /* 1441fdeb165SXin LI * array flags 1451fdeb165SXin LI */ 1461fdeb165SXin LI #define ARRAY_FLAG_DISABLED 0x00000001 /* The array is disabled */ 1471fdeb165SXin LI #define ARRAY_FLAG_NEEDBUILDING 0x00000002 /* array data need to be rebuilt */ 1481fdeb165SXin LI #define ARRAY_FLAG_REBUILDING 0x00000004 /* array is in rebuilding process */ 1491fdeb165SXin LI #define ARRAY_FLAG_BROKEN 0x00000008 /* broken but may still working */ 1501fdeb165SXin LI #define ARRAY_FLAG_BOOTDISK 0x00000010 /* array has a active partition */ 1511fdeb165SXin LI 1521fdeb165SXin LI #define ARRAY_FLAG_BOOTMARK 0x00000040 /* array has boot mark set */ 1531fdeb165SXin LI #define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */ 1541fdeb165SXin LI #define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */ 1551fdeb165SXin LI #define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */ 156453130d9SPedro F. Giffuni #define ARRAY_FLAG_TRANSFORMING 0x00000400 /* transform in progress */ 157453130d9SPedro F. Giffuni #define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need transform */ 1581fdeb165SXin LI #define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/ 1591fdeb165SXin LI #define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */ 1601fdeb165SXin LI #define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */ 1611fdeb165SXin LI 1621fdeb165SXin LI #define ARRAY_FLAG_ZERO_STARTING 0x40000000 /* start lba of all members of this array is 0 */ 1631fdeb165SXin LI 1641fdeb165SXin LI /* 1651fdeb165SXin LI * device flags 1661fdeb165SXin LI */ 1671fdeb165SXin LI #define DEVICE_FLAG_DISABLED 0x00000001 /* device is disabled */ 1681fdeb165SXin LI #define DEVICE_FLAG_BOOTDISK 0x00000002 /* disk has a active partition */ 1691fdeb165SXin LI #define DEVICE_FLAG_BOOTMARK 0x00000004 /* disk has boot mark set */ 1701fdeb165SXin LI #define DEVICE_FLAG_WITH_601 0x00000008 /* has HPT601 connected */ 1711fdeb165SXin LI #define DEVICE_FLAG_SATA 0x00000010 /* SATA or SAS device */ 1721fdeb165SXin LI #define DEVICE_FLAG_ON_PM_PORT 0x00000020 /* PM port */ 1731fdeb165SXin LI #define DEVICE_FLAG_SAS 0x00000040 /* SAS device */ 1741fdeb165SXin LI #define DEVICE_FLAG_IN_ENCLOSURE 0x00000080 /* PathId is enclosure# */ 1751fdeb165SXin LI #define DEVICE_FLAG_UNINITIALIZED 0x00010000 /* device is not initialized, can't be used to create array */ 1761fdeb165SXin LI #define DEVICE_FLAG_LEGACY 0x00020000 /* single disk & mbr contains at least one partition */ 1771fdeb165SXin LI #define DEVICE_FLAG_BAD_SECTOR_FOUND 0x00040000 /* found bad sector on target disk, set and clear by GUI */ 1781fdeb165SXin LI 1791fdeb165SXin LI #define DEVICE_FLAG_IS_SPARE 0x80000000 /* is a spare disk */ 1801fdeb165SXin LI 1811fdeb165SXin LI 1821fdeb165SXin LI #define DEVICE_FLAG_SSD 0x00000100 /* SSD device */ 1831fdeb165SXin LI #define DEVICE_FLAG_3G 0x10000000 1841fdeb165SXin LI #define DEVICE_FLAG_6G 0x20000000 1851fdeb165SXin LI 1861fdeb165SXin LI 1871fdeb165SXin LI /* 1881fdeb165SXin LI * array states used by hpt_set_array_state() 1891fdeb165SXin LI */ 1901fdeb165SXin LI /* old defines */ 1911fdeb165SXin LI #define MIRROR_REBUILD_START 1 1921fdeb165SXin LI #define MIRROR_REBUILD_ABORT 2 1931fdeb165SXin LI #define MIRROR_REBUILD_COMPLETE 3 1941fdeb165SXin LI /* new defines */ 1951fdeb165SXin LI #define AS_REBUILD_START 1 1961fdeb165SXin LI #define AS_REBUILD_ABORT 2 1971fdeb165SXin LI #define AS_REBUILD_PAUSE AS_REBUILD_ABORT 1981fdeb165SXin LI #define AS_REBUILD_COMPLETE 3 1991fdeb165SXin LI #define AS_VERIFY_START 4 2001fdeb165SXin LI #define AS_VERIFY_ABORT 5 2011fdeb165SXin LI #define AS_VERIFY_COMPLETE 6 2021fdeb165SXin LI #define AS_INITIALIZE_START 7 2031fdeb165SXin LI #define AS_INITIALIZE_ABORT 8 2041fdeb165SXin LI #define AS_INITIALIZE_COMPLETE 9 2051fdeb165SXin LI #define AS_VERIFY_FAILED 10 2061fdeb165SXin LI #define AS_REBUILD_STOP 11 2071fdeb165SXin LI #define AS_SAVE_STATE 12 2081fdeb165SXin LI #define AS_TRANSFORM_START 13 2091fdeb165SXin LI #define AS_TRANSFORM_ABORT 14 2101fdeb165SXin LI 2111fdeb165SXin LI /************************************************************************ 2121fdeb165SXin LI * ioctl code 2131fdeb165SXin LI * It would be better if ioctl code are the same on different platforms, 2141fdeb165SXin LI * but we must not conflict with system defined ioctl code. 2151fdeb165SXin LI ************************************************************************/ 2161fdeb165SXin LI #if defined(LINUX) || defined(__FreeBSD_version) || defined(linux) 2171fdeb165SXin LI #define HPT_CTL_CODE(x) (x+0xFF00) 2181fdeb165SXin LI #define HPT_CTL_CODE_LINUX_TO_IOP(x) ((x)-0xff00) 2191fdeb165SXin LI #elif defined(_MS_WIN32_) || defined(WIN32) 2201fdeb165SXin LI 2211fdeb165SXin LI #ifndef CTL_CODE 2221fdeb165SXin LI #define CTL_CODE( DeviceType, Function, Method, Access ) \ 2231fdeb165SXin LI (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) 2241fdeb165SXin LI #endif 2251fdeb165SXin LI #define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0) 2261fdeb165SXin LI #define HPT_CTL_CODE_WIN32_TO_IOP(x) ((((x) & 0xffff)>>2)-0x900) 2271fdeb165SXin LI 2281fdeb165SXin LI #else 2291fdeb165SXin LI #define HPT_CTL_CODE(x) (x) 2301fdeb165SXin LI #endif 2311fdeb165SXin LI 2321fdeb165SXin LI #define HPT_IOCTL_GET_VERSION HPT_CTL_CODE(0) 2331fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_COUNT HPT_CTL_CODE(1) 2341fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_INFO HPT_CTL_CODE(2) 2351fdeb165SXin LI #define HPT_IOCTL_GET_CHANNEL_INFO HPT_CTL_CODE(3) 2361fdeb165SXin LI #define HPT_IOCTL_GET_LOGICAL_DEVICES HPT_CTL_CODE(4) 2371fdeb165SXin LI #define HPT_IOCTL_GET_DEVICE_INFO HPT_CTL_CODE(5) 2381fdeb165SXin LI #define HPT_IOCTL_CREATE_ARRAY HPT_CTL_CODE(6) 2391fdeb165SXin LI #define HPT_IOCTL_DELETE_ARRAY HPT_CTL_CODE(7) 2401fdeb165SXin LI #define HPT_IOCTL_ARRAY_IO HPT_CTL_CODE(8) 2411fdeb165SXin LI #define HPT_IOCTL_DEVICE_IO HPT_CTL_CODE(9) 2421fdeb165SXin LI #define HPT_IOCTL_GET_EVENT HPT_CTL_CODE(10) 2431fdeb165SXin LI #define HPT_IOCTL_REBUILD_MIRROR HPT_CTL_CODE(11) 2441fdeb165SXin LI /* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */ 2451fdeb165SXin LI #define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR 2461fdeb165SXin LI #define HPT_IOCTL_ADD_SPARE_DISK HPT_CTL_CODE(12) 2471fdeb165SXin LI #define HPT_IOCTL_REMOVE_SPARE_DISK HPT_CTL_CODE(13) 2481fdeb165SXin LI #define HPT_IOCTL_ADD_DISK_TO_ARRAY HPT_CTL_CODE(14) 2491fdeb165SXin LI #define HPT_IOCTL_SET_ARRAY_STATE HPT_CTL_CODE(15) 2501fdeb165SXin LI #define HPT_IOCTL_SET_ARRAY_INFO HPT_CTL_CODE(16) 2511fdeb165SXin LI #define HPT_IOCTL_SET_DEVICE_INFO HPT_CTL_CODE(17) 2521fdeb165SXin LI #define HPT_IOCTL_RESCAN_DEVICES HPT_CTL_CODE(18) 2531fdeb165SXin LI #define HPT_IOCTL_GET_DRIVER_CAPABILITIES HPT_CTL_CODE(19) 2541fdeb165SXin LI #define HPT_IOCTL_GET_601_INFO HPT_CTL_CODE(20) 2551fdeb165SXin LI #define HPT_IOCTL_SET_601_INFO HPT_CTL_CODE(21) 2561fdeb165SXin LI #define HPT_IOCTL_LOCK_DEVICE HPT_CTL_CODE(22) 2571fdeb165SXin LI #define HPT_IOCTL_UNLOCK_DEVICE HPT_CTL_CODE(23) 2581fdeb165SXin LI #define HPT_IOCTL_IDE_PASS_THROUGH HPT_CTL_CODE(24) 2591fdeb165SXin LI #define HPT_IOCTL_VERIFY_DATA_BLOCK HPT_CTL_CODE(25) 2601fdeb165SXin LI #define HPT_IOCTL_INITIALIZE_DATA_BLOCK HPT_CTL_CODE(26) 2611fdeb165SXin LI #define HPT_IOCTL_ADD_DEDICATED_SPARE HPT_CTL_CODE(27) 2621fdeb165SXin LI #define HPT_IOCTL_DEVICE_IO_EX HPT_CTL_CODE(28) 2631fdeb165SXin LI #define HPT_IOCTL_SET_BOOT_MARK HPT_CTL_CODE(29) 2641fdeb165SXin LI #define HPT_IOCTL_QUERY_REMOVE HPT_CTL_CODE(30) 2651fdeb165SXin LI #define HPT_IOCTL_REMOVE_DEVICES HPT_CTL_CODE(31) 2661fdeb165SXin LI #define HPT_IOCTL_CREATE_ARRAY_V2 HPT_CTL_CODE(32) 2671fdeb165SXin LI #define HPT_IOCTL_GET_DEVICE_INFO_V2 HPT_CTL_CODE(33) 2681fdeb165SXin LI #define HPT_IOCTL_SET_DEVICE_INFO_V2 HPT_CTL_CODE(34) 2691fdeb165SXin LI #define HPT_IOCTL_REBUILD_DATA_BLOCK_V2 HPT_CTL_CODE(35) 2701fdeb165SXin LI #define HPT_IOCTL_VERIFY_DATA_BLOCK_V2 HPT_CTL_CODE(36) 2711fdeb165SXin LI #define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2 HPT_CTL_CODE(37) 2721fdeb165SXin LI #define HPT_IOCTL_LOCK_DEVICE_V2 HPT_CTL_CODE(38) 2731fdeb165SXin LI #define HPT_IOCTL_DEVICE_IO_V2 HPT_CTL_CODE(39) 2741fdeb165SXin LI #define HPT_IOCTL_DEVICE_IO_EX_V2 HPT_CTL_CODE(40) 2751fdeb165SXin LI #define HPT_IOCTL_CREATE_TRANSFORM HPT_CTL_CODE(41) 2761fdeb165SXin LI #define HPT_IOCTL_STEP_TRANSFORM HPT_CTL_CODE(42) 2771fdeb165SXin LI #define HPT_IOCTL_SET_VDEV_INFO HPT_CTL_CODE(43) 2781fdeb165SXin LI #define HPT_IOCTL_CALC_MAX_CAPACITY HPT_CTL_CODE(44) 2791fdeb165SXin LI #define HPT_IOCTL_INIT_DISKS HPT_CTL_CODE(45) 2801fdeb165SXin LI #define HPT_IOCTL_GET_DEVICE_INFO_V3 HPT_CTL_CODE(46) 2811fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_INFO_V2 HPT_CTL_CODE(47) 2821fdeb165SXin LI #define HPT_IOCTL_I2C_TRANSACTION HPT_CTL_CODE(48) 2831fdeb165SXin LI #define HPT_IOCTL_GET_PARAMETER_LIST HPT_CTL_CODE(49) 2841fdeb165SXin LI #define HPT_IOCTL_GET_PARAMETER HPT_CTL_CODE(50) 2851fdeb165SXin LI #define HPT_IOCTL_SET_PARAMETER HPT_CTL_CODE(51) 2861fdeb165SXin LI #define HPT_IOCTL_GET_DRIVER_CAPABILITIES_V2 HPT_CTL_CODE(52) 2871fdeb165SXin LI #define HPT_IOCTL_GET_CHANNEL_INFO_V2 HPT_CTL_CODE(53) 2881fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_INFO_V3 HPT_CTL_CODE(54) 2891fdeb165SXin LI #define HPT_IOCTL_GET_DEVICE_INFO_V4 HPT_CTL_CODE(55) 2901fdeb165SXin LI #define HPT_IOCTL_CREATE_ARRAY_V3 HPT_CTL_CODE(56) 2911fdeb165SXin LI #define HPT_IOCTL_CREATE_TRANSFORM_V2 HPT_CTL_CODE(57) 2921fdeb165SXin LI #define HPT_IOCTL_CALC_MAX_CAPACITY_V2 HPT_CTL_CODE(58) 2931fdeb165SXin LI #define HPT_IOCTL_SCSI_PASSTHROUGH HPT_CTL_CODE(59) 2941fdeb165SXin LI #define HPT_IOCTL_GET_PHYSICAL_DEVICES HPT_CTL_CODE(60) 2951fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_COUNT HPT_CTL_CODE(61) 2961fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_INFO HPT_CTL_CODE(62) 2971fdeb165SXin LI #define HPT_IOCTL_GET_PERFMON_STATUS HPT_CTL_CODE(63) 2981fdeb165SXin LI #define HPT_IOCTL_SET_PERFMON_STATUS HPT_CTL_CODE(64) 2991fdeb165SXin LI #define HPT_IOCTL_GET_PERFMON_DATA HPT_CTL_CODE(65) 3001fdeb165SXin LI #define HPT_IOCTL_IDE_PASS_THROUGH_V2 HPT_CTL_CODE(66) 3011fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_INFO_V2 HPT_CTL_CODE(67) 3021fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_INFO_V3 HPT_CTL_CODE(68) 3031fdeb165SXin LI #define HPT_IOCTL_ACCESS_CONFIG_REG HPT_CTL_CODE(69) 3041fdeb165SXin LI 3051fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_INFO_V4 HPT_CTL_CODE(70) 3061fdeb165SXin LI #define HPT_IOCTL_GET_ENCLOSURE_ELEMENT_INFO HPT_CTL_CODE(71) 3071fdeb165SXin LI #define HPT_IOCTL_DUMP_METADATA HPT_CTL_CODE(72) 3081fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_INFO_V2_EXT HPT_CTL_CODE(73) 3091fdeb165SXin LI 3101fdeb165SXin LI 3111fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100) 3121fdeb165SXin LI #define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101) 3131fdeb165SXin LI 3141fdeb165SXin LI #define HPT_IOCTL_EPROM_IO HPT_CTL_CODE(102) 3151fdeb165SXin LI #define HPT_IOCTL_GET_CONTROLLER_VENID HPT_CTL_CODE(103) 3161fdeb165SXin LI 3171fdeb165SXin LI 3181fdeb165SXin LI #define HPT_IOCTL_GET_DRIVER_CAPABILITIES_CC HPT_CTL_CODE(200) 3191fdeb165SXin LI #define HPT_IOCTL_GET_CCS_INFO HPT_CTL_CODE(201) 3201fdeb165SXin LI #define HPT_IOCTL_CREATE_CC HPT_CTL_CODE(202) 3211fdeb165SXin LI #define HPT_IOCTL_DELETE_CC HPT_CTL_CODE(203) 3221fdeb165SXin LI #define HPT_IOCTL_REENABLE_ARRAY HPT_CTL_CODE(204) 3231fdeb165SXin LI 3241fdeb165SXin LI /************************************************************************ 3251fdeb165SXin LI * shared data structures 3261fdeb165SXin LI ************************************************************************/ 3271fdeb165SXin LI 3281fdeb165SXin LI /* 3291fdeb165SXin LI * Chip Type 3301fdeb165SXin LI */ 3311fdeb165SXin LI #define CHIP_TYPE_HPT366 1 3321fdeb165SXin LI #define CHIP_TYPE_HPT368 2 3331fdeb165SXin LI #define CHIP_TYPE_HPT370 3 3341fdeb165SXin LI #define CHIP_TYPE_HPT370A 4 3351fdeb165SXin LI #define CHIP_TYPE_HPT370B 5 3361fdeb165SXin LI #define CHIP_TYPE_HPT374 6 3371fdeb165SXin LI #define CHIP_TYPE_HPT372 7 3381fdeb165SXin LI #define CHIP_TYPE_HPT372A 8 3391fdeb165SXin LI #define CHIP_TYPE_HPT302 9 3401fdeb165SXin LI #define CHIP_TYPE_HPT371 10 3411fdeb165SXin LI #define CHIP_TYPE_HPT372N 11 3421fdeb165SXin LI #define CHIP_TYPE_HPT302N 12 3431fdeb165SXin LI #define CHIP_TYPE_HPT371N 13 3441fdeb165SXin LI #define CHIP_TYPE_SI3112A 14 3451fdeb165SXin LI #define CHIP_TYPE_ICH5 15 3461fdeb165SXin LI #define CHIP_TYPE_ICH5R 16 3471fdeb165SXin LI #define CHIP_TYPE_MV50XX 20 3481fdeb165SXin LI #define CHIP_TYPE_MV60X1 21 3491fdeb165SXin LI #define CHIP_TYPE_MV60X2 22 3501fdeb165SXin LI #define CHIP_TYPE_MV70X2 23 3511fdeb165SXin LI #define CHIP_TYPE_MV5182 24 3521fdeb165SXin LI #define CHIP_TYPE_IOP331 31 3531fdeb165SXin LI #define CHIP_TYPE_IOP333 32 3541fdeb165SXin LI #define CHIP_TYPE_IOP341 33 3551fdeb165SXin LI #define CHIP_TYPE_IOP348 34 3561fdeb165SXin LI 3571fdeb165SXin LI /* 3581fdeb165SXin LI * Chip Flags 3591fdeb165SXin LI */ 3601fdeb165SXin LI #define CHIP_SUPPORT_ULTRA_66 0x20 3611fdeb165SXin LI #define CHIP_SUPPORT_ULTRA_100 0x40 3621fdeb165SXin LI #define CHIP_HPT3XX_DPLL_MODE 0x80 3631fdeb165SXin LI #define CHIP_SUPPORT_ULTRA_133 0x01 3641fdeb165SXin LI #define CHIP_SUPPORT_ULTRA_150 0x02 3651fdeb165SXin LI #define CHIP_MASTER 0x04 3661fdeb165SXin LI #define CHIP_SUPPORT_SATA_300 0x08 3671fdeb165SXin LI 3681fdeb165SXin LI #define HPT_SPIN_UP_MODE_NOSUPPORT 0 3691fdeb165SXin LI #define HPT_SPIN_UP_MODE_FULL 1 3701fdeb165SXin LI #define HPT_SPIN_UP_MODE_STANDBY 2 3711fdeb165SXin LI 3721fdeb165SXin LI #define HPT_CAP_DUMP_METADATA 0x1 3731fdeb165SXin LI #define HPT_CAP_DISK_CHECKING 0x2 374e157d597SXin LI #define HPT_CAP_REPORT_SECTOR_SIZE 0x10 3751fdeb165SXin LI 3761fdeb165SXin LI typedef struct _DRIVER_CAPABILITIES { 3771fdeb165SXin LI HPT_U32 dwSize; 3781fdeb165SXin LI 3791fdeb165SXin LI HPT_U8 MaximumControllers; /* maximum controllers the driver can support */ 3801fdeb165SXin LI HPT_U8 SupportCrossControllerRAID; /* 1-support, 0-not support */ 3811fdeb165SXin LI HPT_U8 MinimumBlockSizeShift; /* minimum block size shift */ 3821fdeb165SXin LI HPT_U8 MaximumBlockSizeShift; /* maximum block size shift */ 3831fdeb165SXin LI 3841fdeb165SXin LI HPT_U8 SupportDiskModeSetting; 3851fdeb165SXin LI HPT_U8 SupportSparePool; 3861fdeb165SXin LI HPT_U8 MaximumArrayNameLength; 3871fdeb165SXin LI /* only one HPT_U8 left here! */ 3881fdeb165SXin LI #ifdef __BIG_ENDIAN_BITFIELD 3891fdeb165SXin LI HPT_U8 reserved: 2; 3901fdeb165SXin LI HPT_U8 SupportPerformanceMonitor: 1; 3911fdeb165SXin LI HPT_U8 SupportVariableSectorSize: 1; 3921fdeb165SXin LI HPT_U8 SupportHotSwap: 1; 3931fdeb165SXin LI HPT_U8 HighPerformanceRAID1: 1; 3941fdeb165SXin LI HPT_U8 RebuildProcessInDriver: 1; 3951fdeb165SXin LI HPT_U8 SupportDedicatedSpare: 1; 3961fdeb165SXin LI #else 3971fdeb165SXin LI HPT_U8 SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */ 3981fdeb165SXin LI HPT_U8 RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */ 3991fdeb165SXin LI HPT_U8 HighPerformanceRAID1: 1; 4001fdeb165SXin LI HPT_U8 SupportHotSwap: 1; 4011fdeb165SXin LI HPT_U8 SupportVariableSectorSize: 1; 4021fdeb165SXin LI HPT_U8 SupportPerformanceMonitor: 1; 4031fdeb165SXin LI HPT_U8 reserved: 2; 4041fdeb165SXin LI #endif 4051fdeb165SXin LI 4061fdeb165SXin LI 4071fdeb165SXin LI HPT_U8 SupportedRAIDTypes[16]; 4081fdeb165SXin LI /* maximum members in an array corresponding to SupportedRAIDTypes */ 4091fdeb165SXin LI HPT_U8 MaximumArrayMembers[16]; 4101fdeb165SXin LI } 4111fdeb165SXin LI DRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES; 4121fdeb165SXin LI 4131fdeb165SXin LI typedef struct _DRIVER_CAPABILITIES_V2 { 4141fdeb165SXin LI DRIVER_CAPABILITIES v1; 4151fdeb165SXin LI HPT_U8 SupportedCachePolicies[16]; 4161fdeb165SXin LI HPT_U32 ConfigRegSize; /* max sectors */ 4171fdeb165SXin LI HPT_U32 SupportDiskCachePolicy; /* disable/enable disk cache policy */ 4181fdeb165SXin LI HPT_U32 Flags; 4191fdeb165SXin LI HPT_U32 reserved[14]; 4201fdeb165SXin LI } 4211fdeb165SXin LI DRIVER_CAPABILITIES_V2, *PDRIVER_CAPABILITIES_V2; 4221fdeb165SXin LI 4231fdeb165SXin LI /* 4241fdeb165SXin LI * Controller information. 4251fdeb165SXin LI */ 4261fdeb165SXin LI typedef struct _CONTROLLER_INFO { 4271fdeb165SXin LI HPT_U8 ChipType; /* chip type */ 4281fdeb165SXin LI HPT_U8 InterruptLevel; /* IRQ level */ 4291fdeb165SXin LI HPT_U8 NumBuses; /* bus count */ 4301fdeb165SXin LI HPT_U8 ChipFlags; 4311fdeb165SXin LI 4321fdeb165SXin LI HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */ 4331fdeb165SXin LI HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */ 4341fdeb165SXin LI 4351fdeb165SXin LI } CONTROLLER_INFO, *PCONTROLLER_INFO; 4361fdeb165SXin LI 4371fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 4381fdeb165SXin LI typedef struct _CONTROLLER_INFO_V2 { 4391fdeb165SXin LI HPT_U8 ChipType; /* chip type */ 4401fdeb165SXin LI HPT_U8 InterruptLevel; /* IRQ level */ 4411fdeb165SXin LI HPT_U8 NumBuses; /* bus count */ 4421fdeb165SXin LI HPT_U8 ChipFlags; 4431fdeb165SXin LI 4441fdeb165SXin LI HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */ 4451fdeb165SXin LI HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */ 4461fdeb165SXin LI 4471fdeb165SXin LI HPT_U32 GroupId; /* low 32bit of vbus pointer the controller belongs 4481fdeb165SXin LI * the master controller has CHIP_MASTER flag set*/ 4491fdeb165SXin LI HPT_U8 pci_tree; 4501fdeb165SXin LI HPT_U8 pci_bus; 4511fdeb165SXin LI HPT_U8 pci_device; 4521fdeb165SXin LI HPT_U8 pci_function; 4531fdeb165SXin LI 4541fdeb165SXin LI HPT_U32 ExFlags; 4551fdeb165SXin LI } CONTROLLER_INFO_V2, *PCONTROLLER_INFO_V2; 4561fdeb165SXin LI 4571fdeb165SXin LI typedef struct _CONTROLLER_INFO_V2_EXT { 4581fdeb165SXin LI HPT_U8 MaxWidth; 4591fdeb165SXin LI HPT_U8 CurrentWidth; 4601fdeb165SXin LI HPT_U8 MaxSpeed; 4611fdeb165SXin LI HPT_U8 CurrentSpeed; 4621fdeb165SXin LI HPT_U8 reserve[64]; 4631fdeb165SXin LI } CONTROLLER_INFO_V2_EXT, *PCONTROLLER_INFO_V2_EXT; 4641fdeb165SXin LI 4651fdeb165SXin LI 4661fdeb165SXin LI #define CEXF_IOPModel 1 4671fdeb165SXin LI #define CEXF_SDRAMSize 2 4681fdeb165SXin LI #define CEXF_BatteryInstalled 4 4691fdeb165SXin LI #define CEXF_BatteryStatus 8 4701fdeb165SXin LI #define CEXF_BatteryVoltage 0x10 4711fdeb165SXin LI #define CEXF_BatteryBackupTime 0x20 4721fdeb165SXin LI #define CEXF_FirmwareVersion 0x40 4731fdeb165SXin LI #define CEXF_SerialNumber 0x80 4741fdeb165SXin LI #define CEXF_BatteryTemperature 0x100 4751fdeb165SXin LI #define CEXF_Power12v 0x200 4761fdeb165SXin LI #define CEXF_Power5v 0x400 4771fdeb165SXin LI #define CEXF_Power3p3v 0x800 4781fdeb165SXin LI #define CEXF_Power2p5v 0x1000 4791fdeb165SXin LI #define CEXF_Power1p8v 0x2000 4801fdeb165SXin LI #define CEXF_Core1p8v 0x4000 4811fdeb165SXin LI #define CEXF_Core1p2v 0x8000 4821fdeb165SXin LI #define CEXF_DDR1p8v 0x10000 4831fdeb165SXin LI #define CEXF_DDR1p8vRef 0x20000 4841fdeb165SXin LI #define CEXF_CPUTemperature 0x40000 4851fdeb165SXin LI #define CEXF_BoardTemperature 0x80000 4861fdeb165SXin LI #define CEXF_FanSpeed 0x100000 4871fdeb165SXin LI #define CEXF_Core1p0v 0x200000 4881fdeb165SXin LI #define CEXF_Fan2Speed 0x400000 4891fdeb165SXin LI #define CEXF_Power1p0v 0x800000 4901fdeb165SXin LI #define CEXF_Power1p5v 0x1000000 4911fdeb165SXin LI #define CEXF_SASAddress 0x2000000 4921fdeb165SXin LI 4931fdeb165SXin LI typedef struct _CONTROLLER_INFO_V3 { 4941fdeb165SXin LI HPT_U8 ChipType; 4951fdeb165SXin LI HPT_U8 InterruptLevel; 4961fdeb165SXin LI HPT_U8 NumBuses; 4971fdeb165SXin LI HPT_U8 ChipFlags; 4981fdeb165SXin LI HPT_U8 szProductID[MAX_NAME_LENGTH]; 4991fdeb165SXin LI HPT_U8 szVendorID[MAX_NAME_LENGTH]; 5001fdeb165SXin LI HPT_U32 GroupId; 5011fdeb165SXin LI HPT_U8 pci_tree; 5021fdeb165SXin LI HPT_U8 pci_bus; 5031fdeb165SXin LI HPT_U8 pci_device; 5041fdeb165SXin LI HPT_U8 pci_function; 5051fdeb165SXin LI HPT_U32 ExFlags; 5061fdeb165SXin LI HPT_U8 IOPModel[32]; 5071fdeb165SXin LI HPT_U32 SDRAMSize; 5081fdeb165SXin LI HPT_U8 BatteryInstalled; 5091fdeb165SXin LI HPT_U8 BatteryStatus; 5101fdeb165SXin LI HPT_U16 BatteryVoltage; 5111fdeb165SXin LI HPT_U32 BatteryBackupTime; 5121fdeb165SXin LI HPT_U32 FirmwareVersion; 5131fdeb165SXin LI HPT_U8 SerialNumber[32]; 5141fdeb165SXin LI HPT_U8 BatteryMBInstalled; 5151fdeb165SXin LI HPT_U8 BatteryTemperature; 5161fdeb165SXin LI signed char CPUTemperature; 5171fdeb165SXin LI signed char BoardTemperature; 5181fdeb165SXin LI HPT_U16 FanSpeed; 5191fdeb165SXin LI HPT_U16 Power12v; 5201fdeb165SXin LI HPT_U16 Power5v; 5211fdeb165SXin LI HPT_U16 Power3p3v; 5221fdeb165SXin LI HPT_U16 Power2p5v; 5231fdeb165SXin LI HPT_U16 Power1p8v; 5241fdeb165SXin LI HPT_U16 Core1p8v; 5251fdeb165SXin LI HPT_U16 Core1p2v; 5261fdeb165SXin LI HPT_U16 DDR1p8v; 5271fdeb165SXin LI HPT_U16 DDR1p8vRef; 5281fdeb165SXin LI HPT_U16 Core1p0v; 5291fdeb165SXin LI HPT_U16 Fan2Speed; 5301fdeb165SXin LI HPT_U16 Power1p0v; 5311fdeb165SXin LI HPT_U16 Power1p5v; 5321fdeb165SXin LI HPT_U8 SASAddress[8]; 5331fdeb165SXin LI HPT_U8 reserve[48]; 5341fdeb165SXin LI } 5351fdeb165SXin LI CONTROLLER_INFO_V3, *PCONTROLLER_INFO_V3; 5361fdeb165SXin LI typedef char check_CONTROLLER_INFO_V3[sizeof(CONTROLLER_INFO_V3)==256? 1:-1]; 5371fdeb165SXin LI #endif 5381fdeb165SXin LI /* 5391fdeb165SXin LI * Channel information. 5401fdeb165SXin LI */ 5411fdeb165SXin LI typedef struct _CHANNEL_INFO { 5421fdeb165SXin LI HPT_U32 IoPort; /* IDE Base Port Address */ 5431fdeb165SXin LI HPT_U32 ControlPort; /* IDE Control Port Address */ 5441fdeb165SXin LI 5451fdeb165SXin LI DEVICEID Devices[2]; /* device connected to this channel */ 5461fdeb165SXin LI 5471fdeb165SXin LI } CHANNEL_INFO, *PCHANNEL_INFO; 5481fdeb165SXin LI 5491fdeb165SXin LI typedef struct _CHANNEL_INFO_V2 { 5501fdeb165SXin LI HPT_U32 IoPort; /* IDE Base Port Address */ 5511fdeb165SXin LI HPT_U32 ControlPort; /* IDE Control Port Address */ 5521fdeb165SXin LI 5531fdeb165SXin LI DEVICEID Devices[2+13]; /* device connected to this channel, PMPort max=15 */ 5541fdeb165SXin LI } CHANNEL_INFO_V2, *PCHANNEL_INFO_V2; 5551fdeb165SXin LI 5561fdeb165SXin LI typedef struct _ENCLOSURE_INFO { 5571fdeb165SXin LI HPT_U8 EnclosureType; 5581fdeb165SXin LI HPT_U8 NumberOfPhys; 5591fdeb165SXin LI HPT_U8 AttachedTo; 5601fdeb165SXin LI HPT_U8 Status; 5611fdeb165SXin LI HPT_U8 VendorId[8]; 5621fdeb165SXin LI HPT_U8 ProductId[16]; 5631fdeb165SXin LI HPT_U8 ProductRevisionLevel[4]; 5641fdeb165SXin LI HPT_U32 PortPhyMap; 5651fdeb165SXin LI HPT_U32 reserve[55]; 5661fdeb165SXin LI } ENCLOSURE_INFO, *PENCLOSURE_INFO; 5671fdeb165SXin LI 5681fdeb165SXin LI 5691fdeb165SXin LI typedef struct _SES_ELEMENT_STATUS { 5701fdeb165SXin LI HPT_U8 ElementType; 5711fdeb165SXin LI HPT_U8 ElementOverallIndex; 5721fdeb165SXin LI HPT_U8 ElementStatus; 5731fdeb165SXin LI HPT_U8 Reserved; 5741fdeb165SXin LI HPT_U32 ElementValue; 5751fdeb165SXin LI HPT_U8 ElementDescriptor[32]; 5761fdeb165SXin LI }SES_ELEMENT_STATUS,*PSES_ELEMENT_STATUS; 5771fdeb165SXin LI 5781fdeb165SXin LI #define MAX_ELEMENT_COUNT 80 5791fdeb165SXin LI /* Element Type */ 5801fdeb165SXin LI #define SES_TYPE_UNSPECIFIED 0x00 5811fdeb165SXin LI #define SES_TYPE_DEVICE 0x01 5821fdeb165SXin LI #define SES_TYPE_POWER_SUPPLY 0x02 5831fdeb165SXin LI #define SES_TYPE_FAN 0x03 5841fdeb165SXin LI #define SES_TYPE_TEMPERATURE_SENSOR 0x04 5851fdeb165SXin LI #define SES_TYPE_DOOR_LOCK 0x05 5861fdeb165SXin LI #define SES_TYPE_SPEAKER 0x06 5871fdeb165SXin LI #define SES_TYPE_ES_CONTROLLER 0x07 5881fdeb165SXin LI #define SES_TYPE_SCC_CONTROLLER 0x08 5891fdeb165SXin LI #define SES_TYPE_NONVOLATILE_CACHE 0x09 5901fdeb165SXin LI #define SES_TYPE_UPS 0x0B 5911fdeb165SXin LI #define SES_TYPE_DISPLAY 0x0C 5921fdeb165SXin LI #define SES_TYPE_KEYPAD 0x0D 5931fdeb165SXin LI #define SES_TYPE_ENCLOSURE 0x0E 5941fdeb165SXin LI #define SES_TYPE_SCSI_TRANSCEIVER 0x0F 5951fdeb165SXin LI #define SES_TYPE_LANGUAGE 0x10 5961fdeb165SXin LI #define SES_TYPE_COMM_PORT 0x11 5971fdeb165SXin LI #define SES_TYPE_VOLTAGE_SENSOR 0x12 5981fdeb165SXin LI #define SES_TYPE_CURRENT_SENSOR 0x13 5991fdeb165SXin LI #define SES_TYPE_SCSI_TARGET_PORT 0x14 6001fdeb165SXin LI #define SES_TYPE_SCSI_INITIATOR_PORT 0x15 6011fdeb165SXin LI #define SES_TYPE_SIMPLE_SUBENCLOSURE 0x16 6021fdeb165SXin LI #define SES_TYPE_ARRAY_DEVICE 0x17 6031fdeb165SXin LI #define SES_TYPE_VENDOR_SPECIFIC 0x80 6041fdeb165SXin LI 6051fdeb165SXin LI /* Element Status */ 6061fdeb165SXin LI 6071fdeb165SXin LI #define SES_STATUS_UNSUPPORTED 0x00 6081fdeb165SXin LI #define SES_STATUS_OK 0x01 6091fdeb165SXin LI #define SES_STATUS_CRITICAL 0x02 6101fdeb165SXin LI #define SES_STATUS_NONCRITICAL 0x03 6111fdeb165SXin LI #define SES_STATUS_UNRECOVERABLE 0x04 6121fdeb165SXin LI #define SES_STATUS_NOTINSTALLED 0x05 6131fdeb165SXin LI #define SES_STATUS_UNKNOWN 0x06 6141fdeb165SXin LI #define SES_STATUS_NOTAVAILABLE 0x07 6151fdeb165SXin LI #define SES_STATUS_RESERVED 0x08 6161fdeb165SXin LI 6171fdeb165SXin LI 6181fdeb165SXin LI typedef struct _ENCLOSURE_INFO_V2 { 6191fdeb165SXin LI HPT_U8 EnclosureType; 6201fdeb165SXin LI HPT_U8 NumberOfPhys; 6211fdeb165SXin LI HPT_U8 AttachedTo; 6221fdeb165SXin LI HPT_U8 Status; 6231fdeb165SXin LI HPT_U8 VendorId[8]; 6241fdeb165SXin LI HPT_U8 ProductId[16]; 6251fdeb165SXin LI HPT_U8 ProductRevisionLevel[4]; 6261fdeb165SXin LI HPT_U32 PortPhyMap; 6271fdeb165SXin LI SES_ELEMENT_STATUS ElementStatus[MAX_ELEMENT_COUNT]; 6281fdeb165SXin LI } ENCLOSURE_INFO_V2, *PENCLOSURE_INFO_V2; 6291fdeb165SXin LI 6301fdeb165SXin LI typedef struct _ENCLOSURE_INFO_V3 { 6311fdeb165SXin LI HPT_U8 EnclosureType; 6321fdeb165SXin LI HPT_U8 NumberOfPhys; 6331fdeb165SXin LI HPT_U8 AttachedTo; 6341fdeb165SXin LI HPT_U8 Status; 6351fdeb165SXin LI HPT_U8 VendorId[8]; 6361fdeb165SXin LI HPT_U8 ProductId[16]; 6371fdeb165SXin LI HPT_U8 ProductRevisionLevel[4]; 6381fdeb165SXin LI HPT_U32 PortPhyMap; 6391fdeb165SXin LI HPT_U32 UnitId; /*272x card has two Cores, unitId is used to distinguish them */ 6401fdeb165SXin LI HPT_U32 reserved[32]; 6411fdeb165SXin LI SES_ELEMENT_STATUS ElementStatus[MAX_ELEMENT_COUNT]; 6421fdeb165SXin LI } ENCLOSURE_INFO_V3, *PENCLOSURE_INFO_V3; 6431fdeb165SXin LI 6441fdeb165SXin LI typedef struct _ENCLOSURE_INFO_V4 { 6451fdeb165SXin LI HPT_U8 EnclosureType; 6461fdeb165SXin LI HPT_U8 NumberOfPhys; 6471fdeb165SXin LI HPT_U8 AttachedTo; 6481fdeb165SXin LI HPT_U8 Status; 6491fdeb165SXin LI HPT_U8 VendorId[8]; 6501fdeb165SXin LI HPT_U8 ProductId[16]; 6511fdeb165SXin LI HPT_U8 ProductRevisionLevel[4]; 6521fdeb165SXin LI HPT_U32 PortPhyMap; 6531fdeb165SXin LI HPT_U32 UnitId; /*272x card has two Cores, unitId is used to distinguish them */ 6541fdeb165SXin LI HPT_U32 ElementCount; 6551fdeb165SXin LI HPT_U32 reserved[32]; 6561fdeb165SXin LI } ENCLOSURE_INFO_V4, *PENCLOSURE_INFO_V4; 6571fdeb165SXin LI 6581fdeb165SXin LI #define ENCLOSURE_STATUS_OFFLINE 1 6591fdeb165SXin LI 6601fdeb165SXin LI #define ENCLOSURE_TYPE_INTERNAL 0 6611fdeb165SXin LI #define ENCLOSURE_TYPE_SMP 1 6621fdeb165SXin LI #define ENCLOSURE_TYPE_PM 2 6631fdeb165SXin LI 6641fdeb165SXin LI #ifndef __KERNEL__ 6651fdeb165SXin LI /* 6661fdeb165SXin LI * time represented in HPT_U32 format 6671fdeb165SXin LI */ 6681fdeb165SXin LI typedef struct _TIME_RECORD { 6691fdeb165SXin LI HPT_U32 seconds:6; /* 0 - 59 */ 6701fdeb165SXin LI HPT_U32 minutes:6; /* 0 - 59 */ 6711fdeb165SXin LI HPT_U32 month:4; /* 1 - 12 */ 6721fdeb165SXin LI HPT_U32 hours:6; /* 0 - 59 */ 6731fdeb165SXin LI HPT_U32 day:5; /* 1 - 31 */ 6741fdeb165SXin LI HPT_U32 year:5; /* 0=2000, 31=2031 */ 6751fdeb165SXin LI } TIME_RECORD; 6761fdeb165SXin LI #endif 6771fdeb165SXin LI 6781fdeb165SXin LI /* 6791fdeb165SXin LI * Array information. 6801fdeb165SXin LI */ 6811fdeb165SXin LI typedef struct _HPT_ARRAY_INFO { 6821fdeb165SXin LI HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 6831fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 6841fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 6851fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 6861fdeb165SXin LI 6871fdeb165SXin LI HPT_U8 ArrayType; /* array type */ 6881fdeb165SXin LI HPT_U8 BlockSizeShift; /* stripe size */ 6891fdeb165SXin LI HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 6901fdeb165SXin LI HPT_U8 SubArrayType; 6911fdeb165SXin LI 6921fdeb165SXin LI HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 6931fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V1]; /* member array/disks */ 6941fdeb165SXin LI 6951fdeb165SXin LI /* 6961fdeb165SXin LI * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0); 6971fdeb165SXin LI * only valid if rebuilding is done by driver code. 6981fdeb165SXin LI * Member Flags will have ARRAY_FLAG_REBUILDING set at this case. 6991fdeb165SXin LI * Verify operation use same fields below, the only difference is 7001fdeb165SXin LI * ARRAY_FLAG_VERIFYING is set. 7011fdeb165SXin LI */ 7021fdeb165SXin LI HPT_U32 RebuildingProgress; 7031fdeb165SXin LI HPT_U32 RebuiltSectors; /* rebuilding point (LBA) for single member */ 7041fdeb165SXin LI 7051fdeb165SXin LI } HPT_ARRAY_INFO, *PHPT_ARRAY_INFO; 7061fdeb165SXin LI 7071fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 7081fdeb165SXin LI typedef struct _HPT_ARRAY_INFO_V2 { 7091fdeb165SXin LI HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 7101fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 7111fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 7121fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 7131fdeb165SXin LI 7141fdeb165SXin LI HPT_U8 ArrayType; /* array type */ 7151fdeb165SXin LI HPT_U8 BlockSizeShift; /* stripe size */ 7161fdeb165SXin LI HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 7171fdeb165SXin LI HPT_U8 SubArrayType; 7181fdeb165SXin LI 7191fdeb165SXin LI HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 7201fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */ 7211fdeb165SXin LI 7221fdeb165SXin LI HPT_U32 RebuildingProgress; 7231fdeb165SXin LI HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 7241fdeb165SXin LI 7251fdeb165SXin LI HPT_U32 reserve4[4]; 7261fdeb165SXin LI } HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2; 7271fdeb165SXin LI #endif 7281fdeb165SXin LI 7291fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 7301fdeb165SXin LI typedef struct _HPT_ARRAY_INFO_V3 { 7311fdeb165SXin LI HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 7321fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 7331fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 7341fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 7351fdeb165SXin LI 7361fdeb165SXin LI HPT_U8 ArrayType; /* array type */ 7371fdeb165SXin LI HPT_U8 BlockSizeShift; /* stripe size */ 7381fdeb165SXin LI HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 7391fdeb165SXin LI HPT_U8 SubArrayType; 7401fdeb165SXin LI 7411fdeb165SXin LI HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 7421fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */ 7431fdeb165SXin LI 7441fdeb165SXin LI HPT_U32 RebuildingProgress; 7451fdeb165SXin LI HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 7461fdeb165SXin LI 7471fdeb165SXin LI DEVICEID TransformSource; 7481fdeb165SXin LI DEVICEID TransformTarget; /* destination device ID */ 7491fdeb165SXin LI HPT_U32 TransformingProgress; 7501fdeb165SXin LI HPT_U32 Signature; /* persistent identification*/ 7511fdeb165SXin LI #if MAX_ARRAY_MEMBERS_V2==16 7521fdeb165SXin LI HPT_U16 Critical_Members; /* bit mask of critical members */ 7531fdeb165SXin LI HPT_U16 reserve2; 7541fdeb165SXin LI HPT_U32 reserve; 7551fdeb165SXin LI #else 7561fdeb165SXin LI HPT_U32 Critical_Members; 7571fdeb165SXin LI HPT_U32 reserve; 7581fdeb165SXin LI #endif 7591fdeb165SXin LI } HPT_ARRAY_INFO_V3, *PHPT_ARRAY_INFO_V3; 7601fdeb165SXin LI #endif 7611fdeb165SXin LI 7621fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 7631fdeb165SXin LI typedef struct _HPT_ARRAY_INFO_V4 { 7641fdeb165SXin LI HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 7651fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 7661fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 7671fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 7681fdeb165SXin LI 7691fdeb165SXin LI HPT_U8 ArrayType; /* array type */ 7701fdeb165SXin LI HPT_U8 BlockSizeShift; /* stripe size */ 7711fdeb165SXin LI HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 7721fdeb165SXin LI HPT_U8 SubArrayType; 7731fdeb165SXin LI 7741fdeb165SXin LI HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 7751fdeb165SXin LI 7761fdeb165SXin LI HPT_U32 RebuildingProgress; 7771fdeb165SXin LI HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 7781fdeb165SXin LI 7791fdeb165SXin LI DEVICEID TransformSource; 7801fdeb165SXin LI DEVICEID TransformTarget; /* destination device ID */ 7811fdeb165SXin LI HPT_U32 TransformingProgress; 7821fdeb165SXin LI HPT_U32 Signature; /* persistent identification*/ 7831fdeb165SXin LI HPT_U8 SectorSizeShift; /*sector size = 512B<<SectorSizeShift*/ 7841fdeb165SXin LI HPT_U8 reserved2[7]; 7851fdeb165SXin LI HPT_U64 Critical_Members; 7861fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V3]; /* member array/disks */ 7871fdeb165SXin LI } HPT_ARRAY_INFO_V4, *PHPT_ARRAY_INFO_V4; 7881fdeb165SXin LI #endif 7891fdeb165SXin LI 7901fdeb165SXin LI 7911fdeb165SXin LI /* 7921fdeb165SXin LI * ATA/ATAPI Device identify data without the Reserved4. 7931fdeb165SXin LI */ 7941fdeb165SXin LI typedef struct _IDENTIFY_DATA2 { 7951fdeb165SXin LI HPT_U16 GeneralConfiguration; 7961fdeb165SXin LI HPT_U16 NumberOfCylinders; 7971fdeb165SXin LI HPT_U16 Reserved1; 7981fdeb165SXin LI HPT_U16 NumberOfHeads; 7991fdeb165SXin LI HPT_U16 UnformattedBytesPerTrack; 8001fdeb165SXin LI HPT_U16 UnformattedBytesPerSector; 8011fdeb165SXin LI HPT_U8 SasAddress[8]; 8021fdeb165SXin LI HPT_U16 SerialNumber[10]; 8031fdeb165SXin LI HPT_U16 BufferType; 8041fdeb165SXin LI HPT_U16 BufferSectorSize; 8051fdeb165SXin LI HPT_U16 NumberOfEccBytes; 8061fdeb165SXin LI HPT_U16 FirmwareRevision[4]; 8071fdeb165SXin LI HPT_U16 ModelNumber[20]; 8081fdeb165SXin LI HPT_U8 MaximumBlockTransfer; 8091fdeb165SXin LI HPT_U8 VendorUnique2; 8101fdeb165SXin LI HPT_U16 DoubleWordIo; 8111fdeb165SXin LI HPT_U16 Capabilities; 8121fdeb165SXin LI HPT_U16 Reserved2; 8131fdeb165SXin LI HPT_U8 VendorUnique3; 8141fdeb165SXin LI HPT_U8 PioCycleTimingMode; 8151fdeb165SXin LI HPT_U8 VendorUnique4; 8161fdeb165SXin LI HPT_U8 DmaCycleTimingMode; 8171fdeb165SXin LI HPT_U16 TranslationFieldsValid; 8181fdeb165SXin LI HPT_U16 NumberOfCurrentCylinders; 8191fdeb165SXin LI HPT_U16 NumberOfCurrentHeads; 8201fdeb165SXin LI HPT_U16 CurrentSectorsPerTrack; 8211fdeb165SXin LI HPT_U32 CurrentSectorCapacity; 8221fdeb165SXin LI HPT_U16 CurrentMultiSectorSetting; 8231fdeb165SXin LI HPT_U32 UserAddressableSectors; 8241fdeb165SXin LI HPT_U8 SingleWordDMASupport; 8251fdeb165SXin LI HPT_U8 SingleWordDMAActive; 8261fdeb165SXin LI HPT_U8 MultiWordDMASupport; 8271fdeb165SXin LI HPT_U8 MultiWordDMAActive; 8281fdeb165SXin LI HPT_U8 AdvancedPIOModes; 8291fdeb165SXin LI HPT_U8 Reserved4; 8301fdeb165SXin LI HPT_U16 MinimumMWXferCycleTime; 8311fdeb165SXin LI HPT_U16 RecommendedMWXferCycleTime; 8321fdeb165SXin LI HPT_U16 MinimumPIOCycleTime; 8331fdeb165SXin LI HPT_U16 MinimumPIOCycleTimeIORDY; 8341fdeb165SXin LI HPT_U16 Reserved5[2]; 8351fdeb165SXin LI HPT_U16 ReleaseTimeOverlapped; 8361fdeb165SXin LI HPT_U16 ReleaseTimeServiceCommand; 8371fdeb165SXin LI HPT_U16 MajorRevision; 8381fdeb165SXin LI HPT_U16 MinorRevision; 8391fdeb165SXin LI } __attribute__((packed)) IDENTIFY_DATA2, *PIDENTIFY_DATA2; 8401fdeb165SXin LI 8411fdeb165SXin LI /* 8421fdeb165SXin LI * physical device information. 8431fdeb165SXin LI * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data. 8441fdeb165SXin LI */ 8451fdeb165SXin LI typedef struct _DEVICE_INFO { 8461fdeb165SXin LI HPT_U8 ControllerId; /* controller id */ 8471fdeb165SXin LI HPT_U8 PathId; /* bus */ 8481fdeb165SXin LI HPT_U8 TargetId; /* id */ 8491fdeb165SXin LI HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 8501fdeb165SXin LI /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 8511fdeb165SXin LI HPT_U8 DeviceType; /* device type */ 8521fdeb165SXin LI HPT_U8 UsableMode; /* highest usable mode */ 8531fdeb165SXin LI 8541fdeb165SXin LI #ifdef __BIG_ENDIAN_BITFIELD 8551fdeb165SXin LI HPT_U8 NCQEnabled: 1; 8561fdeb165SXin LI HPT_U8 NCQSupported: 1; 8571fdeb165SXin LI HPT_U8 TCQEnabled: 1; 8581fdeb165SXin LI HPT_U8 TCQSupported: 1; 8591fdeb165SXin LI HPT_U8 WriteCacheEnabled: 1; 8601fdeb165SXin LI HPT_U8 WriteCacheSupported: 1; 8611fdeb165SXin LI HPT_U8 ReadAheadEnabled: 1; 8621fdeb165SXin LI HPT_U8 ReadAheadSupported: 1; 8631fdeb165SXin LI HPT_U8 reserved6: 6; 8641fdeb165SXin LI HPT_U8 SpinUpMode: 2; 8651fdeb165SXin LI #else 8661fdeb165SXin LI HPT_U8 ReadAheadSupported: 1; 8671fdeb165SXin LI HPT_U8 ReadAheadEnabled: 1; 8681fdeb165SXin LI HPT_U8 WriteCacheSupported: 1; 8691fdeb165SXin LI HPT_U8 WriteCacheEnabled: 1; 8701fdeb165SXin LI HPT_U8 TCQSupported: 1; 8711fdeb165SXin LI HPT_U8 TCQEnabled: 1; 8721fdeb165SXin LI HPT_U8 NCQSupported: 1; 8731fdeb165SXin LI HPT_U8 NCQEnabled: 1; 8741fdeb165SXin LI HPT_U8 SpinUpMode: 2; 8751fdeb165SXin LI HPT_U8 reserved6: 6; 8761fdeb165SXin LI #endif 8771fdeb165SXin LI 8781fdeb165SXin LI HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */ 8791fdeb165SXin LI 8801fdeb165SXin LI IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */ 8811fdeb165SXin LI 8821fdeb165SXin LI } 8831fdeb165SXin LI __attribute__((packed)) DEVICE_INFO, *PDEVICE_INFO; 8841fdeb165SXin LI 8851fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 8861fdeb165SXin LI #define MAX_PARENTS_PER_DISK 8 8871fdeb165SXin LI /* 8881fdeb165SXin LI * physical device information. 8891fdeb165SXin LI * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data. 8901fdeb165SXin LI */ 8911fdeb165SXin LI typedef struct _DEVICE_INFO_V2 { 8921fdeb165SXin LI HPT_U8 ControllerId; /* controller id */ 8931fdeb165SXin LI HPT_U8 PathId; /* bus */ 8941fdeb165SXin LI HPT_U8 TargetId; /* id */ 8951fdeb165SXin LI HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 8961fdeb165SXin LI /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 8971fdeb165SXin LI HPT_U8 DeviceType; /* device type */ 8981fdeb165SXin LI HPT_U8 UsableMode; /* highest usable mode */ 8991fdeb165SXin LI 9001fdeb165SXin LI #ifdef __BIG_ENDIAN_BITFIELD 9011fdeb165SXin LI HPT_U8 NCQEnabled: 1; 9021fdeb165SXin LI HPT_U8 NCQSupported: 1; 9031fdeb165SXin LI HPT_U8 TCQEnabled: 1; 9041fdeb165SXin LI HPT_U8 TCQSupported: 1; 9051fdeb165SXin LI HPT_U8 WriteCacheEnabled: 1; 9061fdeb165SXin LI HPT_U8 WriteCacheSupported: 1; 9071fdeb165SXin LI HPT_U8 ReadAheadEnabled: 1; 9081fdeb165SXin LI HPT_U8 ReadAheadSupported: 1; 9091fdeb165SXin LI HPT_U8 reserved6: 6; 9101fdeb165SXin LI HPT_U8 SpinUpMode: 2; 9111fdeb165SXin LI #else 9121fdeb165SXin LI HPT_U8 ReadAheadSupported: 1; 9131fdeb165SXin LI HPT_U8 ReadAheadEnabled: 1; 9141fdeb165SXin LI HPT_U8 WriteCacheSupported: 1; 9151fdeb165SXin LI HPT_U8 WriteCacheEnabled: 1; 9161fdeb165SXin LI HPT_U8 TCQSupported: 1; 9171fdeb165SXin LI HPT_U8 TCQEnabled: 1; 9181fdeb165SXin LI HPT_U8 NCQSupported: 1; 9191fdeb165SXin LI HPT_U8 NCQEnabled: 1; 9201fdeb165SXin LI HPT_U8 SpinUpMode: 2; 9211fdeb165SXin LI HPT_U8 reserved6: 6; 9221fdeb165SXin LI #endif 9231fdeb165SXin LI 9241fdeb165SXin LI HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */ 9251fdeb165SXin LI 9261fdeb165SXin LI IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */ 9271fdeb165SXin LI 9281fdeb165SXin LI HPT_U64 TotalFree; 9291fdeb165SXin LI HPT_U64 MaxFree; 9301fdeb165SXin LI HPT_U64 BadSectors; 9311fdeb165SXin LI DEVICEID ParentArrays[MAX_PARENTS_PER_DISK]; 9321fdeb165SXin LI 9331fdeb165SXin LI } 9341fdeb165SXin LI __attribute__((packed)) DEVICE_INFO_V2, *PDEVICE_INFO_V2, DEVICE_INFO_V3, *PDEVICE_INFO_V3; 9351fdeb165SXin LI 9361fdeb165SXin LI /* 9371fdeb165SXin LI * HPT601 information 9381fdeb165SXin LI */ 9391fdeb165SXin LI #endif 9401fdeb165SXin LI /* 9411fdeb165SXin LI * HPT601 information 9421fdeb165SXin LI */ 9431fdeb165SXin LI #define HPT601_INFO_DEVICEID 1 9441fdeb165SXin LI #define HPT601_INFO_TEMPERATURE 2 9451fdeb165SXin LI #define HPT601_INFO_FANSTATUS 4 9461fdeb165SXin LI #define HPT601_INFO_BEEPERCONTROL 8 9471fdeb165SXin LI #define HPT601_INFO_LED1CONTROL 0x10 9481fdeb165SXin LI #define HPT601_INFO_LED2CONTROL 0x20 9491fdeb165SXin LI #define HPT601_INFO_POWERSTATUS 0x40 9501fdeb165SXin LI 9511fdeb165SXin LI typedef struct _HPT601_INFO_ { 9521fdeb165SXin LI HPT_U16 ValidFields; /* mark valid fields below */ 9531fdeb165SXin LI HPT_U16 DeviceId; /* 0x5A3E */ 9541fdeb165SXin LI HPT_U16 Temperature; /* Read: temperature sensor value. Write: temperature limit */ 9551fdeb165SXin LI HPT_U16 FanStatus; /* Fan status */ 9561fdeb165SXin LI HPT_U16 BeeperControl; /* bit4: beeper control bit. bit0-3: frequency bits */ 9571fdeb165SXin LI HPT_U16 LED1Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 9581fdeb165SXin LI HPT_U16 LED2Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 9591fdeb165SXin LI HPT_U16 PowerStatus; /* 1: has power 2: no power */ 9601fdeb165SXin LI } HPT601_INFO, *PHPT601_INFO; 9611fdeb165SXin LI 9621fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 9631fdeb165SXin LI #ifndef __KERNEL__ 9641fdeb165SXin LI /* cache policy for each vdev, copied from ldm.h */ 9651fdeb165SXin LI #define CACHE_POLICY_NONE 0 9661fdeb165SXin LI #define CACHE_POLICY_WRITE_THROUGH 1 9671fdeb165SXin LI #define CACHE_POLICY_WRITE_BACK 2 9681fdeb165SXin LI 9691fdeb165SXin LI #endif 9701fdeb165SXin LI #endif 9711fdeb165SXin LI /* 9721fdeb165SXin LI * Logical device information. 9731fdeb165SXin LI * Union of ArrayInfo and DeviceInfo. 9741fdeb165SXin LI * Common properties will be put in logical device information. 9751fdeb165SXin LI */ 9761fdeb165SXin LI typedef struct _LOGICAL_DEVICE_INFO { 9771fdeb165SXin LI HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 9781fdeb165SXin LI HPT_U8 reserved[3]; 9791fdeb165SXin LI 9801fdeb165SXin LI HPT_U32 Capacity; /* array capacity */ 9811fdeb165SXin LI DEVICEID ParentArray; 9821fdeb165SXin LI 9831fdeb165SXin LI union { 9841fdeb165SXin LI HPT_ARRAY_INFO array; 9851fdeb165SXin LI DEVICE_INFO device; 9861fdeb165SXin LI } __attribute__((packed)) u; 9871fdeb165SXin LI 9881fdeb165SXin LI } __attribute__((packed)) LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO; 9891fdeb165SXin LI 9901fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 9911fdeb165SXin LI typedef struct _LOGICAL_DEVICE_INFO_V2 { 9921fdeb165SXin LI HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 9931fdeb165SXin LI HPT_U8 reserved[3]; 9941fdeb165SXin LI 9951fdeb165SXin LI HPT_U64 Capacity; /* array capacity */ 9961fdeb165SXin LI DEVICEID ParentArray; /* for physical device, Please don't use this field. 9971fdeb165SXin LI * use ParentArrays field in DEVICE_INFO_V2 9981fdeb165SXin LI */ 9991fdeb165SXin LI 10001fdeb165SXin LI union { 10011fdeb165SXin LI HPT_ARRAY_INFO_V2 array; 10021fdeb165SXin LI DEVICE_INFO device; 10031fdeb165SXin LI } __attribute__((packed)) u; 10041fdeb165SXin LI 10051fdeb165SXin LI } __attribute__((packed)) LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2; 10061fdeb165SXin LI #endif 10071fdeb165SXin LI 10081fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 10091fdeb165SXin LI #define INVALID_TARGET_ID 0xFF 10101fdeb165SXin LI #define INVALID_BUS_ID 0xFF 10111fdeb165SXin LI typedef struct _LOGICAL_DEVICE_INFO_V3 { 10121fdeb165SXin LI HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 10131fdeb165SXin LI HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */ 10141fdeb165SXin LI HPT_U8 VBusId; /* vbus sequence in vbus_list */ 10151fdeb165SXin LI HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */ 10161fdeb165SXin LI /* OS disk name: HPT DISK $VBusId_$TargetId */ 10171fdeb165SXin LI HPT_U64 Capacity; /* array capacity */ 10181fdeb165SXin LI DEVICEID ParentArray; /* for physical device, don't use this field. 10191fdeb165SXin LI * use ParentArrays field in DEVICE_INFO_V2 instead. 10201fdeb165SXin LI */ 10211fdeb165SXin LI HPT_U32 TotalIOs; 10221fdeb165SXin LI HPT_U32 TobalMBs; 10231fdeb165SXin LI HPT_U32 IOPerSec; 10241fdeb165SXin LI HPT_U32 MBPerSec; 10251fdeb165SXin LI 10261fdeb165SXin LI union { 10271fdeb165SXin LI HPT_ARRAY_INFO_V3 array; 10281fdeb165SXin LI DEVICE_INFO_V2 device; 10291fdeb165SXin LI } __attribute__((packed)) u; 10301fdeb165SXin LI 10311fdeb165SXin LI } 10321fdeb165SXin LI __attribute__((packed)) LOGICAL_DEVICE_INFO_V3, *PLOGICAL_DEVICE_INFO_V3; 10331fdeb165SXin LI #endif 10341fdeb165SXin LI 10351fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 10361fdeb165SXin LI typedef struct _LOGICAL_DEVICE_INFO_V4 { 10371fdeb165SXin LI HPT_U32 dwSize; 10381fdeb165SXin LI HPT_U8 revision; 10391fdeb165SXin LI HPT_U8 reserved[7]; 10401fdeb165SXin LI 10411fdeb165SXin LI HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 10421fdeb165SXin LI HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */ 10431fdeb165SXin LI HPT_U8 VBusId; /* vbus sequence in vbus_list */ 10441fdeb165SXin LI HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */ 10451fdeb165SXin LI /* OS disk name: HPT DISK $VBusId_$TargetId */ 10461fdeb165SXin LI HPT_U64 Capacity; /* array capacity */ 10471fdeb165SXin LI DEVICEID ParentArray; /* for physical device, don't use this field. 10481fdeb165SXin LI * use ParentArrays field in DEVICE_INFO_V2 instead. 10491fdeb165SXin LI */ 10501fdeb165SXin LI HPT_U32 TotalIOs; 10511fdeb165SXin LI HPT_U32 TobalMBs; 10521fdeb165SXin LI HPT_U32 IOPerSec; 10531fdeb165SXin LI HPT_U32 MBPerSec; 10541fdeb165SXin LI 10551fdeb165SXin LI union { 10561fdeb165SXin LI HPT_ARRAY_INFO_V4 array; 10571fdeb165SXin LI DEVICE_INFO_V3 device; 10581fdeb165SXin LI } __attribute__((packed)) u; 10591fdeb165SXin LI } 10601fdeb165SXin LI __attribute__((packed)) LOGICAL_DEVICE_INFO_V4, *PLOGICAL_DEVICE_INFO_V4; 10611fdeb165SXin LI 10621fdeb165SXin LI /*LOGICAL_DEVICE_INFO_V4 max revision number*/ 10631fdeb165SXin LI #define LOGICAL_DEVICE_INFO_V4_REVISION 0 10641fdeb165SXin LI /*If new revision was defined please check evey revision size*/ 10651fdeb165SXin LI #define LOGICAL_DEVICE_INFO_V4_R0_SIZE (sizeof(LOGICAL_DEVICE_INFO_V4)) 10661fdeb165SXin LI #endif 10671fdeb165SXin LI 10681fdeb165SXin LI /* 10691fdeb165SXin LI * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info() 10701fdeb165SXin LI * and set_device_info(). 10711fdeb165SXin LI * When set_xxx_info() is called, the ValidFields member indicates which 10721fdeb165SXin LI * fields in the structure are valid. 10731fdeb165SXin LI */ 10741fdeb165SXin LI /* field masks */ 10751fdeb165SXin LI #define AAIF_NAME 1 10761fdeb165SXin LI #define AAIF_DESCRIPTION 2 10771fdeb165SXin LI 10781fdeb165SXin LI #define ADIF_MODE 1 10791fdeb165SXin LI #define ADIF_TCQ 2 10801fdeb165SXin LI #define ADIF_NCQ 4 10811fdeb165SXin LI #define ADIF_WRITE_CACHE 8 10821fdeb165SXin LI #define ADIF_READ_AHEAD 0x10 10831fdeb165SXin LI #define ADIF_SPIN_UP_MODE 0x20 10841fdeb165SXin LI #define ADIF_SET_BAD 0x40 10851fdeb165SXin LI 10861fdeb165SXin LI typedef struct _ALTERABLE_ARRAY_INFO { 10871fdeb165SXin LI HPT_U32 ValidFields; /* mark valid fields below */ 10881fdeb165SXin LI HPT_U8 Name[MAX_ARRAYNAME_LEN]; /* array name */ 10891fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 10901fdeb165SXin LI }__attribute__((packed))ALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO; 10911fdeb165SXin LI 10921fdeb165SXin LI typedef struct _ALTERABLE_DEVICE_INFO { 10931fdeb165SXin LI HPT_U32 ValidFields; /* mark valid fields below */ 10941fdeb165SXin LI HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 10951fdeb165SXin LI }__attribute__((packed))ALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO; 10961fdeb165SXin LI 10971fdeb165SXin LI typedef struct _ALTERABLE_DEVICE_INFO_V2 { 10981fdeb165SXin LI HPT_U32 ValidFields; /* mark valid fields below */ 10991fdeb165SXin LI HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 11001fdeb165SXin LI HPT_U8 TCQEnabled; 11011fdeb165SXin LI HPT_U8 NCQEnabled; 11021fdeb165SXin LI HPT_U8 WriteCacheEnabled; 11031fdeb165SXin LI HPT_U8 ReadAheadEnabled; 11041fdeb165SXin LI HPT_U8 SpinUpMode; 11051fdeb165SXin LI HPT_U8 SetBadSector; 11061fdeb165SXin LI HPT_U8 reserve[1]; 11071fdeb165SXin LI HPT_U32 reserve2[13]; /* pad to 64 bytes */ 11081fdeb165SXin LI }__attribute__((packed))ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2; 11091fdeb165SXin LI 11101fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 11111fdeb165SXin LI 11121fdeb165SXin LI #define TARGET_TYPE_DEVICE 0 11131fdeb165SXin LI #define TARGET_TYPE_ARRAY 1 11141fdeb165SXin LI 11151fdeb165SXin LI 11161fdeb165SXin LI #define AIT_NAME 0 11171fdeb165SXin LI #define AIT_DESCRIPTION 1 11181fdeb165SXin LI #define AIT_CACHE_POLICY 2 11191fdeb165SXin LI 11201fdeb165SXin LI 11211fdeb165SXin LI #define DIT_MODE 0 11221fdeb165SXin LI #define DIT_READ_AHEAD 1 11231fdeb165SXin LI #define DIT_WRITE_CACHE 2 11241fdeb165SXin LI #define DIT_TCQ 3 11251fdeb165SXin LI #define DIT_NCQ 4 11261fdeb165SXin LI #define DIT_IDENTIFY 5 11271fdeb165SXin LI 11281fdeb165SXin LI #define DISK_CACHE_POLICY_UNCHANGE 0 11291fdeb165SXin LI #define DISK_CACHE_POLICY_ENABLE 1 11301fdeb165SXin LI #define DISK_CACHE_POLICY_DISABLE 2 11311fdeb165SXin LI 11321fdeb165SXin LI /* param type is determined by target_type and info_type*/ 11331fdeb165SXin LI typedef struct _SET_DEV_INFO 11341fdeb165SXin LI { 11351fdeb165SXin LI HPT_U8 target_type; 11361fdeb165SXin LI HPT_U8 infor_type; 11371fdeb165SXin LI HPT_U16 param_length; 11381fdeb165SXin LI #define SET_VDEV_INFO_param(p) ((HPT_U8 *)(p)+sizeof(SET_VDEV_INFO)) 11391fdeb165SXin LI /* HPT_U8 param[0]; */ 11401fdeb165SXin LI } SET_VDEV_INFO, * PSET_VDEV_INFO; 11411fdeb165SXin LI 11421fdeb165SXin LI typedef HPT_U8 PARAM_ARRAY_NAME[MAX_ARRAYNAME_LEN] ; 11431fdeb165SXin LI typedef HPT_U8 PARAM_ARRAY_DES[64]; 11441fdeb165SXin LI typedef HPT_U8 PARAM_DEVICE_MODE, PARAM_TCQ, PARAM_NCQ, PARAM_READ_AHEAD, PARAM_WRITE_CACHE, PARAM_CACHE_POLICY; 11451fdeb165SXin LI 11461fdeb165SXin LI #endif 11471fdeb165SXin LI 11481fdeb165SXin LI /* 11491fdeb165SXin LI * CREATE_ARRAY_PARAMS 11501fdeb165SXin LI * Param structure used to create an array. 11511fdeb165SXin LI */ 11521fdeb165SXin LI typedef struct _CREATE_ARRAY_PARAMS { 11531fdeb165SXin LI HPT_U8 ArrayType; /* 1-level array type */ 11541fdeb165SXin LI HPT_U8 nDisk; /* number of elements in Members[] array */ 11551fdeb165SXin LI HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 11561fdeb165SXin LI HPT_U8 CreateFlags; /* See CAF_xxx */ 11571fdeb165SXin LI 11581fdeb165SXin LI HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 11591fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 11601fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 11611fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 11621fdeb165SXin LI 11631fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */ 11641fdeb165SXin LI 11651fdeb165SXin LI } CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS; 11661fdeb165SXin LI 11671fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 11681fdeb165SXin LI typedef struct _CREATE_ARRAY_PARAMS_V2 { 11691fdeb165SXin LI HPT_U8 ArrayType; /* 1-level array type */ 11701fdeb165SXin LI HPT_U8 nDisk; /* number of elements in Members[] array */ 11711fdeb165SXin LI HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 11721fdeb165SXin LI HPT_U8 CreateFlags; /* See CAF_xxx */ 11731fdeb165SXin LI 11741fdeb165SXin LI HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 11751fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 11761fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 11771fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 11781fdeb165SXin LI HPT_U64 Capacity; 11791fdeb165SXin LI 11801fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */ 11811fdeb165SXin LI 11821fdeb165SXin LI } CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2; 11831fdeb165SXin LI #endif 11841fdeb165SXin LI 11851fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 11861fdeb165SXin LI typedef struct _CREATE_ARRAY_PARAMS_V3 { 11871fdeb165SXin LI HPT_U32 dwSize; 11881fdeb165SXin LI HPT_U8 revision; /*CREATE_ARRAY_PARAMS_V3_REVISION*/ 11891fdeb165SXin LI HPT_U8 diskCachePolicy; /*unchange:0 enable:1 disable:2*/ 11901fdeb165SXin LI HPT_U8 reserved[4]; 11911fdeb165SXin LI HPT_U8 subDisks; /* RAIDn0 sub array */ 11921fdeb165SXin LI HPT_U8 SectorSizeShift; /*sector size = 512B<<SectorSizeShift*/ 11931fdeb165SXin LI HPT_U8 ArrayType; /* 1-level array type */ 11941fdeb165SXin LI HPT_U8 nDisk; /* number of elements in Members[] array */ 11951fdeb165SXin LI HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 11961fdeb165SXin LI HPT_U8 CreateFlags; /* See CAF_xxx */ 11971fdeb165SXin LI 11981fdeb165SXin LI HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 11991fdeb165SXin LI HPT_U8 Description[64]; /* array description */ 12001fdeb165SXin LI HPT_U8 CreateManager[16]; /* who created it */ 12011fdeb165SXin LI TIME_RECORD CreateTime; /* when created it */ 12021fdeb165SXin LI HPT_U64 Capacity; 12031fdeb165SXin LI 12041fdeb165SXin LI HPT_U32 Members[MAX_ARRAY_MEMBERS_V3];/* ID of array members, a member can be an array */ 12051fdeb165SXin LI } CREATE_ARRAY_PARAMS_V3, *PCREATE_ARRAY_PARAMS_V3; 12061fdeb165SXin LI 12071fdeb165SXin LI /*CREATE_ARRAY_PARAMS_V3 current max revision*/ 12081fdeb165SXin LI #define CREATE_ARRAY_PARAMS_V3_REVISION 0 12091fdeb165SXin LI /*If new revision defined please check evey revision size*/ 12101fdeb165SXin LI #define CREATE_ARRAY_PARAMS_V3_R0_SIZE (sizeof(CREATE_ARRAY_PARAMS_V3)) 12111fdeb165SXin LI #endif 12121fdeb165SXin LI 12131fdeb165SXin LI #if HPT_INTERFACE_VERSION < 0x01020000 12141fdeb165SXin LI /* 12151fdeb165SXin LI * Flags used for creating an RAID 1 array 12161fdeb165SXin LI * 12171fdeb165SXin LI * CAF_CREATE_AND_DUPLICATE 12181fdeb165SXin LI * Copy source disk contents to target for RAID 1. If user choose "create and duplicate" 12191fdeb165SXin LI * to create an array, GUI will call CreateArray() with this flag set. Then GUI should 12201fdeb165SXin LI * call hpt_get_device_info() with the returned array ID and check returned flags to 12211fdeb165SXin LI * see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding 12221fdeb165SXin LI * and GUI must do duplication itself. 12231fdeb165SXin LI * CAF_DUPLICATE_MUST_DONE 12241fdeb165SXin LI * If the duplication is aborted or fails, do not create the array. 12251fdeb165SXin LI */ 12261fdeb165SXin LI #define CAF_CREATE_AND_DUPLICATE 1 12271fdeb165SXin LI #define CAF_DUPLICATE_MUST_DONE 2 12281fdeb165SXin LI #define CAF_CREATE_AS_RAID15 4 12291fdeb165SXin LI /* 12301fdeb165SXin LI * Flags used for creating an RAID 5 array 12311fdeb165SXin LI */ 12321fdeb165SXin LI #define CAF_CREATE_R5_NO_BUILD 1 12331fdeb165SXin LI #define CAF_CREATE_R5_ZERO_INIT 2 12341fdeb165SXin LI #define CAF_CREATE_R5_BUILD_PARITY 4 12351fdeb165SXin LI 12361fdeb165SXin LI #else 12371fdeb165SXin LI /* 12381fdeb165SXin LI * Flags used for creating 12391fdeb165SXin LI */ 12401fdeb165SXin LI #define CAF_FOREGROUND_INITIALIZE 1 12411fdeb165SXin LI #define CAF_BACKGROUND_INITIALIZE 2 12421fdeb165SXin LI #define CAF_CREATE_R5_WRITE_BACK (CACHE_POLICY_WRITE_BACK<<CAF_CACHE_POLICY_SHIFT) 12431fdeb165SXin LI 12441fdeb165SXin LI 12451fdeb165SXin LI #define CAF_CACHE_POLICY_MASK 0x1C 12461fdeb165SXin LI #define CAF_CACHE_POLICY_SHIFT 2 12471fdeb165SXin LI 12481fdeb165SXin LI #endif 12491fdeb165SXin LI 12501fdeb165SXin LI #define CAF_KEEP_DATA_ALWAYS 0x80 12511fdeb165SXin LI 12521fdeb165SXin LI /* Flags used for deleting an array 12531fdeb165SXin LI * 12541fdeb165SXin LI * DAF_KEEP_DATA_IF_POSSIBLE 12551fdeb165SXin LI * If this flag is set, deleting a RAID 1 array will not destroy the data on both disks. 12561fdeb165SXin LI * Deleting a JBOD should keep partitions on first disk ( not implement now ). 12571fdeb165SXin LI * Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ). 12581fdeb165SXin LI */ 12591fdeb165SXin LI #define DAF_KEEP_DATA_IF_POSSIBLE 1 12601fdeb165SXin LI #define DAF_KEEP_DATA_ALWAYS 2 12611fdeb165SXin LI 12621fdeb165SXin LI /* 12631fdeb165SXin LI * event types 12641fdeb165SXin LI */ 12651fdeb165SXin LI #define ET_DEVICE_REMOVED 1 /* device removed */ 12661fdeb165SXin LI #define ET_DEVICE_PLUGGED 2 /* device plugged */ 12671fdeb165SXin LI #define ET_DEVICE_ERROR 3 /* device I/O error */ 12681fdeb165SXin LI #define ET_REBUILD_STARTED 4 12691fdeb165SXin LI #define ET_REBUILD_ABORTED 5 12701fdeb165SXin LI #define ET_REBUILD_FINISHED 6 12711fdeb165SXin LI #define ET_SPARE_TOOK_OVER 7 12721fdeb165SXin LI #define ET_REBUILD_FAILED 8 12731fdeb165SXin LI #define ET_VERIFY_STARTED 9 12741fdeb165SXin LI #define ET_VERIFY_ABORTED 10 12751fdeb165SXin LI #define ET_VERIFY_FAILED 11 12761fdeb165SXin LI #define ET_VERIFY_FINISHED 12 12771fdeb165SXin LI #define ET_INITIALIZE_STARTED 13 12781fdeb165SXin LI #define ET_INITIALIZE_ABORTED 14 12791fdeb165SXin LI #define ET_INITIALIZE_FAILED 15 12801fdeb165SXin LI #define ET_INITIALIZE_FINISHED 16 12811fdeb165SXin LI #define ET_VERIFY_DATA_ERROR 17 12821fdeb165SXin LI #define ET_TRANSFORM_STARTED 18 12831fdeb165SXin LI #define ET_TRANSFORM_ABORTED 19 12841fdeb165SXin LI #define ET_TRANSFORM_FAILED 20 12851fdeb165SXin LI #define ET_TRANSFORM_FINISHED 21 12861fdeb165SXin LI #define ET_SMART_FAILED 22 12871fdeb165SXin LI #define ET_SMART_PASSED 23 12881fdeb165SXin LI #define ET_SECTOR_REPAIR_FAIL 24 12891fdeb165SXin LI #define ET_SECTOR_REPAIR_SUCCESS 25 12901fdeb165SXin LI #define ET_ERASE_FAIL 26 12911fdeb165SXin LI #define ET_ERASE_SUCCESS 27 12921fdeb165SXin LI #define ET_CONTINUE_REBUILD_ON_ERROR 28 12931fdeb165SXin LI 12941fdeb165SXin LI 12951fdeb165SXin LI /* 12961fdeb165SXin LI * event structure 12971fdeb165SXin LI */ 12981fdeb165SXin LI typedef struct _HPT_EVENT { 12991fdeb165SXin LI TIME_RECORD Time; 13001fdeb165SXin LI DEVICEID DeviceID; 13011fdeb165SXin LI HPT_U8 EventType; 13021fdeb165SXin LI HPT_U8 reserved[3]; 13031fdeb165SXin LI 13041fdeb165SXin LI HPT_U8 Data[32]; /* various data depend on EventType */ 13051fdeb165SXin LI } HPT_EVENT, *PHPT_EVENT; 13061fdeb165SXin LI 13071fdeb165SXin LI /* 13081fdeb165SXin LI * IDE pass-through command. Use it at your own risk! 13091fdeb165SXin LI */ 13101fdeb165SXin LI typedef struct _IDE_PASS_THROUGH_HEADER { 13111fdeb165SXin LI DEVICEID idDisk; /* disk ID */ 13121fdeb165SXin LI HPT_U8 bFeaturesReg; /* feature register */ 13131fdeb165SXin LI HPT_U8 bSectorCountReg; /* IDE sector count register. */ 13141fdeb165SXin LI HPT_U8 bLbaLowReg; /* IDE LBA low value. */ 13151fdeb165SXin LI HPT_U8 bLbaMidReg; /* IDE LBA mid register. */ 13161fdeb165SXin LI HPT_U8 bLbaHighReg; /* IDE LBA high value. */ 13171fdeb165SXin LI HPT_U8 bDriveHeadReg; /* IDE drive/head register. */ 13181fdeb165SXin LI HPT_U8 bCommandReg; /* Actual IDE command. Checked for validity by driver. */ 13191fdeb165SXin LI HPT_U8 nSectors; /* data size in sectors, if the command has data transfer */ 13201fdeb165SXin LI HPT_U8 protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */ 13211fdeb165SXin LI HPT_U8 reserve[3]; 13221fdeb165SXin LI #define IDE_PASS_THROUGH_buffer(p) ((HPT_U8 *)(p) + sizeof(IDE_PASS_THROUGH_HEADER)) 13231fdeb165SXin LI /* HPT_U8 DataBuffer[0]; */ 13241fdeb165SXin LI } 13251fdeb165SXin LI IDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER; 13261fdeb165SXin LI 13271fdeb165SXin LI typedef struct _IDE_PASS_THROUGH_HEADER_V2 { 13281fdeb165SXin LI DEVICEID idDisk; /* disk ID */ 13291fdeb165SXin LI HPT_U16 bFeaturesReg; /* feature register */ 13301fdeb165SXin LI HPT_U16 bSectorCountReg; /* IDE sector count register. */ 13311fdeb165SXin LI HPT_U16 bLbaLowReg; /* IDE LBA low value. */ 13321fdeb165SXin LI HPT_U16 bLbaMidReg; /* IDE LBA mid register. */ 13331fdeb165SXin LI HPT_U16 bLbaHighReg; /* IDE LBA high value. */ 13341fdeb165SXin LI HPT_U8 bDriveHeadReg; /* IDE drive/head register. */ 13351fdeb165SXin LI HPT_U8 bCommandReg; /* Actual IDE command. Checked for validity by driver. */ 13361fdeb165SXin LI HPT_U16 nSectors; /* data size in sectors, if the command has data transfer */ 13371fdeb165SXin LI HPT_U8 protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */ 13381fdeb165SXin LI HPT_U8 reserve; 13391fdeb165SXin LI #define IDE_PASS_THROUGH_V2_buffer(p) ((HPT_U8 *)(p) + sizeof(IDE_PASS_THROUGH_HEADER_V2)) 13401fdeb165SXin LI /* HPT_U8 DataBuffer[0]; */ 13411fdeb165SXin LI } 13421fdeb165SXin LI IDE_PASS_THROUGH_HEADER_V2, *PIDE_PASS_THROUGH_HEADER_V2; 13431fdeb165SXin LI 13441fdeb165SXin LI typedef struct _HPT_SCSI_PASSTHROUGH_IN { 13451fdeb165SXin LI DEVICEID idDisk; 13461fdeb165SXin LI HPT_U8 protocol; 13471fdeb165SXin LI HPT_U8 reserve1; 13481fdeb165SXin LI HPT_U8 reserve2; 13491fdeb165SXin LI HPT_U8 cdbLength; 13501fdeb165SXin LI HPT_U8 cdb[16]; 13511fdeb165SXin LI HPT_U32 dataLength; 13521fdeb165SXin LI /* data follows, if any */ 13531fdeb165SXin LI } 13541fdeb165SXin LI HPT_SCSI_PASSTHROUGH_IN, *PHPT_SCSI_PASSTHROUGH_IN; 13551fdeb165SXin LI 13561fdeb165SXin LI typedef struct _HPT_SCSI_PASSTHROUGH_OUT { 13571fdeb165SXin LI HPT_U8 scsiStatus; 13581fdeb165SXin LI HPT_U8 reserve1; 13591fdeb165SXin LI HPT_U8 reserve2; 13601fdeb165SXin LI HPT_U8 reserve3; 13611fdeb165SXin LI HPT_U32 dataLength; 13621fdeb165SXin LI /* data/sense follows if any */ 13631fdeb165SXin LI } 13641fdeb165SXin LI HPT_SCSI_PASSTHROUGH_OUT, *PHPT_SCSI_PASSTHROUGH_OUT; 13651fdeb165SXin LI 13661fdeb165SXin LI /* 13671fdeb165SXin LI * device io packet format 13681fdeb165SXin LI */ 13691fdeb165SXin LI typedef struct _DEVICE_IO_EX_PARAMS { 13701fdeb165SXin LI DEVICEID idDisk; 13711fdeb165SXin LI HPT_U32 Lba; 13721fdeb165SXin LI HPT_U16 nSectors; 13731fdeb165SXin LI HPT_U8 Command; /* IO_COMMAD_xxx */ 13741fdeb165SXin LI HPT_U8 BufferType; /* BUFFER_TYPE_xxx, see below */ 13751fdeb165SXin LI HPT_U32 BufferPtr; 13761fdeb165SXin LI } 13771fdeb165SXin LI DEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS; 13781fdeb165SXin LI 13791fdeb165SXin LI #define BUFFER_TYPE_LOGICAL 1 /* logical pointer to buffer */ 13801fdeb165SXin LI #define BUFFER_TYPE_PHYSICAL 2 /* physical address of buffer */ 13811fdeb165SXin LI #define BUFFER_TYPE_LOGICAL_LOGICAL_SG 3 /* logical pointer to logical S/G table */ 13821fdeb165SXin LI #define BUFFER_TYPE_LOGICAL_PHYSICAL_SG 4 /* logical pointer to physical S/G table */ 13831fdeb165SXin LI #define BUFFER_TYPE_PHYSICAL_LOGICAL_SG 5 /* physical address to logical S/G table */ 13841fdeb165SXin LI #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */ 13851fdeb165SXin LI #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */ 13861fdeb165SXin LI 13871fdeb165SXin LI typedef struct _HPT_DRIVER_PARAMETER { 13881fdeb165SXin LI char name[32]; 13891fdeb165SXin LI HPT_U8 value[32]; 13901fdeb165SXin LI HPT_U8 type; /* HPT_DRIVER_PARAMETER_TYPE_* */ 13911fdeb165SXin LI HPT_U8 persistent; 13921fdeb165SXin LI HPT_U8 reserve2[2]; 13931fdeb165SXin LI HPT_U8 location; /* 0 - system */ 13941fdeb165SXin LI HPT_U8 controller; 13951fdeb165SXin LI HPT_U8 bus; 13961fdeb165SXin LI HPT_U8 reserve1; 13971fdeb165SXin LI char desc[128]; 13981fdeb165SXin LI } 13991fdeb165SXin LI HPT_DRIVER_PARAMETER, *PHPT_DRIVER_PARAMETER; 14001fdeb165SXin LI 14011fdeb165SXin LI #define HPT_DRIVER_PARAMETER_TYPE_INT 1 14021fdeb165SXin LI #define HPT_DRIVER_PARAMETER_TYPE_BOOL 2 14031fdeb165SXin LI 14041fdeb165SXin LI typedef struct _HPT_PM_CMDSTAT { 14051fdeb165SXin LI HPT_U64 timeStamp; 14061fdeb165SXin LI HPT_U64 lba; 14071fdeb165SXin LI HPT_U16 sectors; 14081fdeb165SXin LI HPT_U16 reserved; 14091fdeb165SXin LI HPT_U32 rspTime; 14101fdeb165SXin LI } 14111fdeb165SXin LI HPT_PM_CMDSTAT, *PHPT_PM_CMDSTAT; 14121fdeb165SXin LI 14131fdeb165SXin LI #define HIGHEST_RSPTIME_CMD_SAVE 10 14141fdeb165SXin LI #define RSPTIME_HISTOGRAM_SEGMENT_COUNT 38 14151fdeb165SXin LI 14161fdeb165SXin LI typedef struct _HPT_PM_IOSTAT { 14171fdeb165SXin LI HPT_PM_CMDSTAT highestRspCmdStatData[HIGHEST_RSPTIME_CMD_SAVE]; 14181fdeb165SXin LI HPT_U32 rspTimeHistogram[RSPTIME_HISTOGRAM_SEGMENT_COUNT]; 14191fdeb165SXin LI HPT_U16 pendingIo; 14201fdeb165SXin LI HPT_U16 activeIo; 14211fdeb165SXin LI HPT_U32 instantKBPs; 14221fdeb165SXin LI HPT_U32 averageKBPs; 14231fdeb165SXin LI HPT_U32 instantIOPs; 14241fdeb165SXin LI HPT_U32 averageIOPs; 14251fdeb165SXin LI } 14261fdeb165SXin LI HPT_PM_IOSTAT, *PHPT_PM_IOSTAT; 14271fdeb165SXin LI 14281fdeb165SXin LI /* 14291fdeb165SXin LI * disk config region 14301fdeb165SXin LI */ 14311fdeb165SXin LI typedef struct _ACCESS_CONFIG_REG { 14321fdeb165SXin LI DEVICEID id; 14331fdeb165SXin LI HPT_U16 start; 14341fdeb165SXin LI HPT_U8 sectors; 14351fdeb165SXin LI HPT_U8 read; 14361fdeb165SXin LI HPT_U32 Reserved; 14371fdeb165SXin LI #define ACCESS_CONFIG_REG_buffer(p) ((HPT_U8 *)(p) + sizeof(ACCESS_CONFIG_REG_PARAMS)) 14381fdeb165SXin LI } __attribute__((packed))ACCESS_CONFIG_REG_PARAMS, *PACCESS_CONFIG_REG_PARAMS; 14391fdeb165SXin LI 14401fdeb165SXin LI /* 14411fdeb165SXin LI * dump meta data 14421fdeb165SXin LI */ 14431fdeb165SXin LI typedef struct _DUMP_METADATA { 14441fdeb165SXin LI DEVICEID id; 14451fdeb165SXin LI HPT_U8 sectors; 14461fdeb165SXin LI HPT_U8 backsectors; 14471fdeb165SXin LI HPT_U8 offset; 14481fdeb165SXin LI HPT_U8 backoffset; 14491fdeb165SXin LI } __attribute__((packed))DUMP_METADATA_PARAMS, *PDUMP_METADATA_PARAMS; 14501fdeb165SXin LI 14511fdeb165SXin LI 14521fdeb165SXin LI 14531fdeb165SXin LI /* 14541fdeb165SXin LI * ioctl structure 14551fdeb165SXin LI */ 14561fdeb165SXin LI #define HPT_IOCTL_MAGIC32 0x1A2B3C4D 14571fdeb165SXin LI #define HPT_IOCTL_MAGIC 0xA1B2C3D4 14581fdeb165SXin LI 14591fdeb165SXin LI typedef struct _HPT_IOCTL_PARAM { 14601fdeb165SXin LI HPT_U32 Magic; /* used to check if it's a valid ioctl packet */ 14611fdeb165SXin LI HPT_U32 dwIoControlCode; /* operation control code */ 14621fdeb165SXin LI HPT_PTR lpInBuffer; /* input data buffer */ 14631fdeb165SXin LI HPT_U32 nInBufferSize; /* size of input data buffer */ 14641fdeb165SXin LI HPT_PTR lpOutBuffer; /* output data buffer */ 14651fdeb165SXin LI HPT_U32 nOutBufferSize; /* size of output data buffer */ 14661fdeb165SXin LI HPT_PTR lpBytesReturned; /* count of HPT_U8s returned */ 14671fdeb165SXin LI } 14681fdeb165SXin LI HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM; 14691fdeb165SXin LI 14701fdeb165SXin LI /* for 32-bit app running on 64-bit system */ 14711fdeb165SXin LI typedef struct _HPT_IOCTL_PARAM32 { 14721fdeb165SXin LI HPT_U32 Magic; 14731fdeb165SXin LI HPT_U32 dwIoControlCode; 14741fdeb165SXin LI HPT_U32 lpInBuffer; 14751fdeb165SXin LI HPT_U32 nInBufferSize; 14761fdeb165SXin LI HPT_U32 lpOutBuffer; 14771fdeb165SXin LI HPT_U32 nOutBufferSize; 14781fdeb165SXin LI HPT_U32 lpBytesReturned; 14791fdeb165SXin LI } 14801fdeb165SXin LI HPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32; 14811fdeb165SXin LI 14821fdeb165SXin LI #if !defined(__KERNEL__) || defined(SIMULATE) 14831fdeb165SXin LI /* 14841fdeb165SXin LI * User-mode ioctl parameter passing conventions: 14851fdeb165SXin LI * The ioctl function implementation is platform specific, so we don't 14861fdeb165SXin LI * have forced rules for it. However, it's suggested to use a parameter 14871fdeb165SXin LI * passing method as below 14881fdeb165SXin LI * 1) Put all input data continuously in an input buffer. 14891fdeb165SXin LI * 2) Prepare an output buffer with enough size if needed. 14901fdeb165SXin LI * 3) Fill a HPT_IOCTL_PARAM structure. 14911fdeb165SXin LI * 4) Pass the structure to driver through a platform-specific method. 14921fdeb165SXin LI * This is implemented in the mid-layer user-mode library. The UI 14931fdeb165SXin LI * programmer needn't care about it. 14941fdeb165SXin LI */ 14951fdeb165SXin LI 14961fdeb165SXin LI /************************************************************************ 14971fdeb165SXin LI * User mode functions 14981fdeb165SXin LI ************************************************************************/ 14991fdeb165SXin LI /* 15001fdeb165SXin LI * hpt_get_version 15011fdeb165SXin LI * Version compatibility: all versions 15021fdeb165SXin LI * Parameters: 15031fdeb165SXin LI * None 15041fdeb165SXin LI * Returns: 15051fdeb165SXin LI * interface version. 0 when fail. 15061fdeb165SXin LI */ 15071fdeb165SXin LI HPT_U32 hpt_get_version(void); 15081fdeb165SXin LI 15091fdeb165SXin LI /* 15101fdeb165SXin LI * hpt_get_driver_capabilities 15111fdeb165SXin LI * Version compatibility: v1.0.0.2 or later 15121fdeb165SXin LI * Parameters: 15131fdeb165SXin LI * Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set 15141fdeb165SXin LI * dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this 15151fdeb165SXin LI * member to see if it's correct. 15161fdeb165SXin LI * Returns: 15171fdeb165SXin LI * 0 - Success 15181fdeb165SXin LI */ 15191fdeb165SXin LI int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap); 15201fdeb165SXin LI int hpt_get_driver_capabilities_v2(PDRIVER_CAPABILITIES_V2 cap); 15211fdeb165SXin LI 15221fdeb165SXin LI /* 15231fdeb165SXin LI * hpt_get_controller_count 15241fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 15251fdeb165SXin LI * Parameters: 15261fdeb165SXin LI * None 15271fdeb165SXin LI * Returns: 15281fdeb165SXin LI * number of controllers 15291fdeb165SXin LI */ 15301fdeb165SXin LI int hpt_get_controller_count(void); 15311fdeb165SXin LI 15321fdeb165SXin LI /* hpt_get_controller_info 15331fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 15341fdeb165SXin LI * Parameters: 15351fdeb165SXin LI * id Controller id 15361fdeb165SXin LI * pInfo pointer to CONTROLLER_INFO buffer 15371fdeb165SXin LI * Returns: 15381fdeb165SXin LI * 0 Success, controller info is put into (*pInfo ). 15391fdeb165SXin LI */ 15401fdeb165SXin LI int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo); 15411fdeb165SXin LI 15421fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 15431fdeb165SXin LI /* hpt_get_controller_info_v2 15441fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 15451fdeb165SXin LI * Parameters: 15461fdeb165SXin LI * id Controller id 15471fdeb165SXin LI * pInfo pointer to CONTROLLER_INFO_V2 buffer 15481fdeb165SXin LI * Returns: 15491fdeb165SXin LI * 0 Success, controller info is put into (*pInfo ). 15501fdeb165SXin LI */ 15511fdeb165SXin LI int hpt_get_controller_info_v2(int id, PCONTROLLER_INFO_V2 pInfo); 15521fdeb165SXin LI 15531fdeb165SXin LI /* hpt_get_controller_info_v2_ext 15541fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 15551fdeb165SXin LI * Parameters: 15561fdeb165SXin LI * id Controller id 15571fdeb165SXin LI * pInfo pointer to CONTROLLER_INFO_V2_EXT buffer 15581fdeb165SXin LI * Returns: 15591fdeb165SXin LI * 0 Success, controller info is put into (*pInfo ). 15601fdeb165SXin LI */ 15611fdeb165SXin LI int hpt_get_controller_info_v2_ext(int id, PCONTROLLER_INFO_V2_EXT pInfo); 15621fdeb165SXin LI 15631fdeb165SXin LI /* hpt_get_controller_info_v3 15641fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 15651fdeb165SXin LI * Parameters: 15661fdeb165SXin LI * id Controller id 15671fdeb165SXin LI * pInfo pointer to CONTROLLER_INFO_V3 buffer 15681fdeb165SXin LI * Returns: 15691fdeb165SXin LI * 0 Success, controller info is put into (*pInfo ). 15701fdeb165SXin LI */ 15711fdeb165SXin LI int hpt_get_controller_info_v3(int id, PCONTROLLER_INFO_V3 pInfo); 15721fdeb165SXin LI #endif 15731fdeb165SXin LI 15741fdeb165SXin LI /* hpt_get_channel_info 15751fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 15761fdeb165SXin LI * Parameters: 15771fdeb165SXin LI * id Controller id 15781fdeb165SXin LI * bus bus number 15791fdeb165SXin LI * pInfo pointer to CHANNEL_INFO buffer 15801fdeb165SXin LI * Returns: 15811fdeb165SXin LI * 0 Success, channel info is put into (*pInfo ). 15821fdeb165SXin LI */ 15831fdeb165SXin LI int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo); 15841fdeb165SXin LI 15851fdeb165SXin LI /* hpt_get_channel_info_v2 15861fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 15871fdeb165SXin LI * Parameters: 15881fdeb165SXin LI * id Controller id 15891fdeb165SXin LI * bus bus number 15901fdeb165SXin LI * pInfo pointer to CHANNEL_INFO buffer 15911fdeb165SXin LI * Returns: 15921fdeb165SXin LI * 0 Success, channel info is put into (*pInfo ). 15931fdeb165SXin LI */ 15941fdeb165SXin LI int hpt_get_channel_info_v2(int id, int bus, PCHANNEL_INFO_V2 pInfo); 15951fdeb165SXin LI 15961fdeb165SXin LI /* hpt_get_logical_devices 15971fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 15981fdeb165SXin LI * Parameters: 15991fdeb165SXin LI * pIds pointer to a DEVICEID array 16001fdeb165SXin LI * nMaxCount array size 16011fdeb165SXin LI * Returns: 16021fdeb165SXin LI * Number of ID returned. All logical device IDs are put into pIds array. 16031fdeb165SXin LI * Note: A spare disk is not a logical device. 16041fdeb165SXin LI */ 16051fdeb165SXin LI int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount); 16061fdeb165SXin LI 16071fdeb165SXin LI /* hpt_get_physical_devices 16081fdeb165SXin LI * Version compatibility: v2.1.0.0 or later 16091fdeb165SXin LI * Parameters: 16101fdeb165SXin LI * pIds pointer to a DEVICEID array 16111fdeb165SXin LI * nMaxCount array size 16121fdeb165SXin LI * Returns: 16131fdeb165SXin LI * Number of ID returned. All physical device IDs are put into pIds array. 16141fdeb165SXin LI */ 16151fdeb165SXin LI int hpt_get_physical_devices(DEVICEID * pIds, int nMaxCount); 16161fdeb165SXin LI 16171fdeb165SXin LI /* hpt_get_device_info 16181fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16191fdeb165SXin LI * Parameters: 16201fdeb165SXin LI * id logical device id 16211fdeb165SXin LI * pInfo pointer to LOGICAL_DEVICE_INFO structure 16221fdeb165SXin LI * Returns: 16231fdeb165SXin LI * 0 - Success 16241fdeb165SXin LI */ 16251fdeb165SXin LI int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo); 16261fdeb165SXin LI 16271fdeb165SXin LI /* hpt_create_array 16281fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16291fdeb165SXin LI * Parameters: 16301fdeb165SXin LI * pParam pointer to CREATE_ARRAY_PARAMS structure 16311fdeb165SXin LI * Returns: 16321fdeb165SXin LI * 0 failed 16331fdeb165SXin LI * else return array id 16341fdeb165SXin LI */ 16351fdeb165SXin LI DEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam); 16361fdeb165SXin LI 16371fdeb165SXin LI /* hpt_delete_array 16381fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16391fdeb165SXin LI * Parameters: 16401fdeb165SXin LI * id array id 16411fdeb165SXin LI * Returns: 16421fdeb165SXin LI * 0 Success 16431fdeb165SXin LI */ 16441fdeb165SXin LI int hpt_delete_array(DEVICEID id, HPT_U32 options); 16451fdeb165SXin LI 16461fdeb165SXin LI /* hpt_device_io 16471fdeb165SXin LI * Read/write data on array and physcal device. 16481fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16491fdeb165SXin LI * Parameters: 16501fdeb165SXin LI * id device id. If it's an array ID, IO will be performed on the array. 16511fdeb165SXin LI * If it's a physical device ID, IO will be performed on the device. 16521fdeb165SXin LI * cmd IO_COMMAND_READ or IO_COMMAND_WRITE 16531fdeb165SXin LI * buffer data buffer 16541fdeb165SXin LI * length data size 16551fdeb165SXin LI * Returns: 16561fdeb165SXin LI * 0 Success 16571fdeb165SXin LI */ 16581fdeb165SXin LI int hpt_device_io(DEVICEID id, int cmd, HPT_U32 lba, HPT_U32 nSector, void * buffer); 16591fdeb165SXin LI 16601fdeb165SXin LI /* hpt_add_disk_to_array 16611fdeb165SXin LI * Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array. 16621fdeb165SXin LI * Auto-rebuild will start. 16631fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16641fdeb165SXin LI * Parameters: 16651fdeb165SXin LI * idArray array id 16661fdeb165SXin LI * idDisk disk id 16671fdeb165SXin LI * Returns: 16681fdeb165SXin LI * 0 Success 16691fdeb165SXin LI */ 16701fdeb165SXin LI int hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk); 16711fdeb165SXin LI 16721fdeb165SXin LI /* hpt_add_spare_disk 16731fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16741fdeb165SXin LI * Add a disk to spare pool. 16751fdeb165SXin LI * Parameters: 16761fdeb165SXin LI * idDisk disk id 16771fdeb165SXin LI * Returns: 16781fdeb165SXin LI * 0 Success 16791fdeb165SXin LI */ 16801fdeb165SXin LI int hpt_add_spare_disk(DEVICEID idDisk); 16811fdeb165SXin LI 16821fdeb165SXin LI /* hpt_add_dedicated_spare 16831fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 16841fdeb165SXin LI * Add a spare disk to an array 16851fdeb165SXin LI * Parameters: 16861fdeb165SXin LI * idDisk disk id 16871fdeb165SXin LI * idArray array id 16881fdeb165SXin LI * Returns: 16891fdeb165SXin LI * 0 Success 16901fdeb165SXin LI */ 16911fdeb165SXin LI int hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray); 16921fdeb165SXin LI 16931fdeb165SXin LI /* hpt_remove_spare_disk 16941fdeb165SXin LI * remove a disk from spare pool. 16951fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 16961fdeb165SXin LI * Parameters: 16971fdeb165SXin LI * idDisk disk id 16981fdeb165SXin LI * Returns: 16991fdeb165SXin LI * 0 Success 17001fdeb165SXin LI */ 17011fdeb165SXin LI int hpt_remove_spare_disk(DEVICEID idDisk); 17021fdeb165SXin LI 17031fdeb165SXin LI /* hpt_get_event 17041fdeb165SXin LI * Used to poll events from driver. 17051fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17061fdeb165SXin LI * Parameters: 17071fdeb165SXin LI * pEvent pointer to HPT_EVENT structure 17081fdeb165SXin LI * Returns: 17091fdeb165SXin LI * 0 Success, event info is filled in *pEvent 17101fdeb165SXin LI */ 17111fdeb165SXin LI int hpt_get_event(PHPT_EVENT pEvent); 17121fdeb165SXin LI 17131fdeb165SXin LI /* hpt_rebuild_data_block 17141fdeb165SXin LI * Used to copy data from source disk and mirror disk. 17151fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17161fdeb165SXin LI * Parameters: 17171fdeb165SXin LI * idArray Array ID (RAID1, 0/1 or RAID5) 17181fdeb165SXin LI * Lba Start LBA for each array member 17191fdeb165SXin LI * nSector Number of sectors for each array member (RAID 5 will ignore this parameter) 17201fdeb165SXin LI * 17211fdeb165SXin LI * Returns: 17221fdeb165SXin LI * 0 Success, event info is filled in *pEvent 17231fdeb165SXin LI */ 17241fdeb165SXin LI int hpt_rebuild_data_block(DEVICEID idMirror, HPT_U32 Lba, HPT_U8 nSector); 17251fdeb165SXin LI #define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3) 17261fdeb165SXin LI 17271fdeb165SXin LI /* hpt_set_array_state 17281fdeb165SXin LI * set array state. 17291fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17301fdeb165SXin LI * Parameters: 17311fdeb165SXin LI * idArray Array ID 17321fdeb165SXin LI * state See above 'array states' constants, possible values are: 17331fdeb165SXin LI * MIRROR_REBUILD_START 17341fdeb165SXin LI * Indicate that GUI wants to rebuild a mirror array 17351fdeb165SXin LI * MIRROR_REBUILD_ABORT 17361fdeb165SXin LI * GUI wants to abort rebuilding an array 17371fdeb165SXin LI * MIRROR_REBUILD_COMPLETE 17381fdeb165SXin LI * GUI finished to rebuild an array. If rebuild is done by driver this 17391fdeb165SXin LI * state has no use 17401fdeb165SXin LI * 17411fdeb165SXin LI * Returns: 17421fdeb165SXin LI * 0 Success 17431fdeb165SXin LI */ 17441fdeb165SXin LI int hpt_set_array_state(DEVICEID idArray, HPT_U32 state); 17451fdeb165SXin LI 17461fdeb165SXin LI /* hpt_set_array_info 17471fdeb165SXin LI * set array info. 17481fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17491fdeb165SXin LI * Parameters: 17501fdeb165SXin LI * idArray Array ID 17511fdeb165SXin LI * pInfo pointer to new info 17521fdeb165SXin LI * 17531fdeb165SXin LI * Returns: 17541fdeb165SXin LI * 0 Success 17551fdeb165SXin LI */ 17561fdeb165SXin LI int hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo); 17571fdeb165SXin LI 17581fdeb165SXin LI /* hpt_set_device_info 17591fdeb165SXin LI * set device info. 17601fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17611fdeb165SXin LI * Parameters: 17621fdeb165SXin LI * idDisk device ID 17631fdeb165SXin LI * pInfo pointer to new info 17641fdeb165SXin LI * 17651fdeb165SXin LI * Returns: 17661fdeb165SXin LI * 0 Success 17671fdeb165SXin LI * Additional notes: 17681fdeb165SXin LI * If idDisk==0, call to this function will stop buzzer on the adapter 17691fdeb165SXin LI * (if supported by driver). 17701fdeb165SXin LI */ 17711fdeb165SXin LI int hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo); 17721fdeb165SXin LI 17731fdeb165SXin LI #if HPT_INTERFACE_VERSION >= 0x01000004 17741fdeb165SXin LI int hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo); 17751fdeb165SXin LI #endif 17761fdeb165SXin LI 17771fdeb165SXin LI /* hpt_rescan_devices 17781fdeb165SXin LI * rescan devices 17791fdeb165SXin LI * Version compatibility: v1.0.0.1 or later 17801fdeb165SXin LI * Parameters: 17811fdeb165SXin LI * None 17821fdeb165SXin LI * Returns: 17831fdeb165SXin LI * 0 Success 17841fdeb165SXin LI */ 17851fdeb165SXin LI int hpt_rescan_devices(void); 17861fdeb165SXin LI 17871fdeb165SXin LI /* hpt_get_601_info 17881fdeb165SXin LI * Get HPT601 status 17891fdeb165SXin LI * Version compatibiilty: v1.0.0.3 or later 17901fdeb165SXin LI * Parameters: 17911fdeb165SXin LI * idDisk - Disk handle 17921fdeb165SXin LI * PHPT601_INFO - pointer to HPT601 info buffer 17931fdeb165SXin LI * Returns: 17941fdeb165SXin LI * 0 Success 17951fdeb165SXin LI */ 17961fdeb165SXin LI int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 17971fdeb165SXin LI 17981fdeb165SXin LI /* hpt_set_601_info 17991fdeb165SXin LI * HPT601 function control 18001fdeb165SXin LI * Version compatibiilty: v1.0.0.3 or later 18011fdeb165SXin LI * Parameters: 18021fdeb165SXin LI * idDisk - Disk handle 18031fdeb165SXin LI * PHPT601_INFO - pointer to HPT601 info buffer 18041fdeb165SXin LI * Returns: 18051fdeb165SXin LI * 0 Success 18061fdeb165SXin LI */ 18071fdeb165SXin LI int hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 18081fdeb165SXin LI 18091fdeb165SXin LI /* hpt_lock_device 18101fdeb165SXin LI * Lock a block on a device (prevent OS accessing it) 18111fdeb165SXin LI * Version compatibiilty: v1.0.0.3 or later 18121fdeb165SXin LI * Parameters: 18131fdeb165SXin LI * idDisk - Disk handle 18141fdeb165SXin LI * Lba - Start LBA 18151fdeb165SXin LI * nSectors - number of sectors 18161fdeb165SXin LI * Returns: 18171fdeb165SXin LI * 0 Success 18181fdeb165SXin LI */ 18191fdeb165SXin LI int hpt_lock_device(DEVICEID idDisk, HPT_U32 Lba, HPT_U8 nSectors); 18201fdeb165SXin LI 18211fdeb165SXin LI /* hpt_lock_device 18221fdeb165SXin LI * Unlock a device 18231fdeb165SXin LI * Version compatibiilty: v1.0.0.3 or later 18241fdeb165SXin LI * Parameters: 18251fdeb165SXin LI * idDisk - Disk handle 18261fdeb165SXin LI * Returns: 18271fdeb165SXin LI * 0 Success 18281fdeb165SXin LI */ 18291fdeb165SXin LI int hpt_unlock_device(DEVICEID idDisk); 18301fdeb165SXin LI 18311fdeb165SXin LI /* hpt_ide_pass_through 18321fdeb165SXin LI * send a ATA passthrough command to a device. 18331fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 18341fdeb165SXin LI * Parameters: 18351fdeb165SXin LI * p - IDE_PASS_THROUGH header pointer 18361fdeb165SXin LI * Returns: 18371fdeb165SXin LI * 0 Success 18381fdeb165SXin LI */ 18391fdeb165SXin LI int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p); 18401fdeb165SXin LI int hpt_ide_pass_through_v2(PIDE_PASS_THROUGH_HEADER_V2 p); 18411fdeb165SXin LI 18421fdeb165SXin LI /* hpt_scsi_passthrough 18431fdeb165SXin LI * send a SCSI passthrough command to a device. 18441fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 18451fdeb165SXin LI * Parameters: 18461fdeb165SXin LI * in - HPT_SCSI_PASSTHROUGH_IN header pointer 18471fdeb165SXin LI * out - PHPT_SCSI_PASSTHROUGH_OUT header pointer 18481fdeb165SXin LI * insize, outsize - in/out buffer size 18491fdeb165SXin LI * Returns: 18501fdeb165SXin LI * 0 Success 18511fdeb165SXin LI */ 18521fdeb165SXin LI int hpt_scsi_passthrough(PHPT_SCSI_PASSTHROUGH_IN in, HPT_U32 insize, 18531fdeb165SXin LI PHPT_SCSI_PASSTHROUGH_OUT out, HPT_U32 outsize); 18541fdeb165SXin LI 18551fdeb165SXin LI /* hpt_verify_data_block 18561fdeb165SXin LI * verify data block on RAID1 or RAID5. 18571fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 18581fdeb165SXin LI * Parameters: 18591fdeb165SXin LI * idArray - Array ID 18601fdeb165SXin LI * Lba - block number (on each array member, not logical block!) 18611fdeb165SXin LI * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 18621fdeb165SXin LI * Returns: 18631fdeb165SXin LI * 0 Success 18641fdeb165SXin LI * 1 Data compare error 18651fdeb165SXin LI * 2 I/O error 18661fdeb165SXin LI */ 18671fdeb165SXin LI int hpt_verify_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors); 18681fdeb165SXin LI 18691fdeb165SXin LI /* hpt_initialize_data_block 18701fdeb165SXin LI * initialize data block (fill with zero) on RAID5 18711fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 18721fdeb165SXin LI * Parameters: 18731fdeb165SXin LI * idArray - Array ID 18741fdeb165SXin LI * Lba - block number (on each array member, not logical block!) 18751fdeb165SXin LI * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 18761fdeb165SXin LI * Returns: 18771fdeb165SXin LI * 0 Success 18781fdeb165SXin LI */ 18791fdeb165SXin LI int hpt_initialize_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors); 18801fdeb165SXin LI 18811fdeb165SXin LI /* hpt_device_io_ex 18821fdeb165SXin LI * extended device I/O function 18831fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 18841fdeb165SXin LI * Parameters: 18851fdeb165SXin LI * idArray - Array ID 18861fdeb165SXin LI * Lba - block number (on each array member, not logical block!) 18871fdeb165SXin LI * nSectors - Sectors for each member 18881fdeb165SXin LI * buffer - I/O buffer or s/g address 18891fdeb165SXin LI * Returns: 18901fdeb165SXin LI * 0 Success 18911fdeb165SXin LI */ 18921fdeb165SXin LI int hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param); 18931fdeb165SXin LI 18941fdeb165SXin LI /* hpt_set_boot_mark 18951fdeb165SXin LI * select boot device 18961fdeb165SXin LI * Version compatibility: v1.0.0.3 or later 18971fdeb165SXin LI * Parameters: 18981fdeb165SXin LI * id - logical device ID. If id is 0 the boot mark will be removed. 18991fdeb165SXin LI * Returns: 19001fdeb165SXin LI * 0 Success 19011fdeb165SXin LI */ 19021fdeb165SXin LI int hpt_set_boot_mark(DEVICEID id); 19031fdeb165SXin LI 19041fdeb165SXin LI /* hpt_query_remove 19051fdeb165SXin LI * check if device can be removed safely 19061fdeb165SXin LI * Version compatibility: v1.0.0.4 or later 19071fdeb165SXin LI * Parameters: 19081fdeb165SXin LI * ndev - number of devices 19091fdeb165SXin LI * pIds - device ID list 19101fdeb165SXin LI * Returns: 19111fdeb165SXin LI * 0 - Success 19121fdeb165SXin LI * -1 - unknown error 19131fdeb165SXin LI * n - the n-th device that can't be removed 19141fdeb165SXin LI */ 19151fdeb165SXin LI int hpt_query_remove(HPT_U32 ndev, DEVICEID *pIds); 19161fdeb165SXin LI 19171fdeb165SXin LI /* hpt_remove_devices 19181fdeb165SXin LI * remove a list of devices 19191fdeb165SXin LI * Version compatibility: v1.0.0.4 or later 19201fdeb165SXin LI * Parameters: 19211fdeb165SXin LI * ndev - number of devices 19221fdeb165SXin LI * pIds - device ID list 19231fdeb165SXin LI * Returns: 19241fdeb165SXin LI * 0 - Success 19251fdeb165SXin LI * -1 - unknown error 19261fdeb165SXin LI * n - the n-th device that can't be removed 19271fdeb165SXin LI */ 19281fdeb165SXin LI int hpt_remove_devices(HPT_U32 ndev, DEVICEID *pIds); 19291fdeb165SXin LI 19301fdeb165SXin LI /* hpt_create_array_v2 19311fdeb165SXin LI * Version compatibility: v1.1.0.0 or later 19321fdeb165SXin LI * Parameters: 19331fdeb165SXin LI * pParam pointer to CREATE_ARRAY_PARAMS_V2 structure 19341fdeb165SXin LI * Returns: 19351fdeb165SXin LI * 0 failed 19361fdeb165SXin LI * else return array id 19371fdeb165SXin LI */ 19381fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 19391fdeb165SXin LI DEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam); 19401fdeb165SXin LI #endif 19411fdeb165SXin LI 19421fdeb165SXin LI /* hpt_create_array_v3 19431fdeb165SXin LI * Version compatibility: v2.0.0.1 or later 19441fdeb165SXin LI * Parameters: 19451fdeb165SXin LI * pParam pointer to CREATE_ARRAY_PARAMS_V3 structure 19461fdeb165SXin LI * Returns: 19471fdeb165SXin LI * 0 failed 19481fdeb165SXin LI * else return array id 19491fdeb165SXin LI */ 19501fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 19511fdeb165SXin LI DEVICEID hpt_create_array_v3(PCREATE_ARRAY_PARAMS_V3 pParam); 19521fdeb165SXin LI #endif 19531fdeb165SXin LI 19541fdeb165SXin LI /* hpt_get_device_info_v2 19551fdeb165SXin LI * Version compatibility: v1.1.0.0 or later 19561fdeb165SXin LI * Parameters: 19571fdeb165SXin LI * id logical device id 19581fdeb165SXin LI * pInfo pointer to LOGICAL_DEVICE_INFO_V2 structure 19591fdeb165SXin LI * Returns: 19601fdeb165SXin LI * 0 - Success 19611fdeb165SXin LI */ 19621fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 19631fdeb165SXin LI int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo); 19641fdeb165SXin LI #endif 19651fdeb165SXin LI 19661fdeb165SXin LI /* hpt_get_device_info_v3 19671fdeb165SXin LI * Version compatibility: v1.2.0.0 or later 19681fdeb165SXin LI * Parameters: 19691fdeb165SXin LI * id logical device id 19701fdeb165SXin LI * pInfo pointer to LOGICAL_DEVICE_INFO_V3 structure 19711fdeb165SXin LI * Returns: 19721fdeb165SXin LI * 0 - Success 19731fdeb165SXin LI */ 19741fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 19751fdeb165SXin LI int hpt_get_device_info_v3(DEVICEID id, PLOGICAL_DEVICE_INFO_V3 pInfo); 19761fdeb165SXin LI #endif 19771fdeb165SXin LI 19781fdeb165SXin LI /* hpt_get_device_info_v4 19791fdeb165SXin LI * Version compatibility: v2.0.0.1 or later 19801fdeb165SXin LI * Parameters: 19811fdeb165SXin LI * id logical device id 19821fdeb165SXin LI * pInfo pointer to LOGICAL_DEVICE_INFO_V4 structure 19831fdeb165SXin LI * Returns: 19841fdeb165SXin LI * 0 - Success 19851fdeb165SXin LI */ 19861fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 19871fdeb165SXin LI int hpt_get_device_info_v4(DEVICEID id, PLOGICAL_DEVICE_INFO_V4 pInfo); 19881fdeb165SXin LI #endif 19891fdeb165SXin LI 19901fdeb165SXin LI /* hpt_create_transform 19911fdeb165SXin LI * create a transform instance. 19921fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 19931fdeb165SXin LI * Parameters: 19941fdeb165SXin LI * idArray - source array 19951fdeb165SXin LI * destInfo - destination array info 19961fdeb165SXin LI * Returns: 19971fdeb165SXin LI * destination array id 19981fdeb165SXin LI */ 19991fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000000 20001fdeb165SXin LI DEVICEID hpt_create_transform(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V2 destInfo); 20011fdeb165SXin LI #endif 20021fdeb165SXin LI 20031fdeb165SXin LI /* hpt_create_transform_v2 20041fdeb165SXin LI * create a transform instance. 20051fdeb165SXin LI * Version compatibility: v2.0.0.1 or later 20061fdeb165SXin LI * Parameters: 20071fdeb165SXin LI * idArray - source array 20081fdeb165SXin LI * destInfo - destination array info 20091fdeb165SXin LI * Returns: 20101fdeb165SXin LI * destination array id 20111fdeb165SXin LI */ 20121fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 20131fdeb165SXin LI DEVICEID hpt_create_transform_v2(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V3 destInfo); 20141fdeb165SXin LI #endif 20151fdeb165SXin LI 20161fdeb165SXin LI /* hpt_step_transform 2017453130d9SPedro F. Giffuni * move a block in a transform progress. 20181fdeb165SXin LI * This function is called by mid-layer, not GUI (which uses set_array_state instead). 20191fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 20201fdeb165SXin LI * Parameters: 20211fdeb165SXin LI * idArray - destination array ID 20221fdeb165SXin LI * the source ID will be invalid when transform complete. 20231fdeb165SXin LI * Returns: 20241fdeb165SXin LI * 0 - Success 20251fdeb165SXin LI */ 20261fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000000 20271fdeb165SXin LI int hpt_step_transform(DEVICEID idArray); 20281fdeb165SXin LI #endif 20291fdeb165SXin LI 20301fdeb165SXin LI /* hpt_set_vdev_info 20311fdeb165SXin LI * set information for disk or array 20321fdeb165SXin LI * Version compatibility: v1.2.0.0 or later 20331fdeb165SXin LI * Parameters: 20341fdeb165SXin LI * dev - destination device 20351fdeb165SXin LI * 20361fdeb165SXin LI * Returns: 20371fdeb165SXin LI * 0 - Success 20381fdeb165SXin LI */ 20391fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 20401fdeb165SXin LI int hpt_set_vdev_info(DEVICEID dev, PSET_VDEV_INFO pInfo); 20411fdeb165SXin LI #endif 20421fdeb165SXin LI 20431fdeb165SXin LI /* hpt_init_disks 20441fdeb165SXin LI * initialize disks for use 20451fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 20461fdeb165SXin LI * Parameters: 20471fdeb165SXin LI * ndev - number of disks to initialize 20481fdeb165SXin LI * pIds - array of DEVICEID 20491fdeb165SXin LI * 20501fdeb165SXin LI * Returns: 20511fdeb165SXin LI * 0 - Success 20521fdeb165SXin LI */ 20531fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000000 20541fdeb165SXin LI int hpt_init_disks(HPT_U32 ndev, DEVICEID * pIds); 20551fdeb165SXin LI #endif 20561fdeb165SXin LI 20571fdeb165SXin LI /* hpt_calc_max_array_capacity 20581fdeb165SXin LI * cap max capacity of the array user want to create or transform 20591fdeb165SXin LI * Version compatibility: v1.2.0.0 or later 20601fdeb165SXin LI * Parameters: 20611fdeb165SXin LI * source - if transform, this is the source array, otherwise, it should be zero 20621fdeb165SXin LI * destInfo - target array params 20631fdeb165SXin LI * Returns: 20641fdeb165SXin LI * 0 - Success 20651fdeb165SXin LI * cap - max capacity of the target array 20661fdeb165SXin LI */ 20671fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 20681fdeb165SXin LI int hpt_calc_max_array_capacity(DEVICEID source, PCREATE_ARRAY_PARAMS_V2 destInfo, HPT_U64 * cap); 20691fdeb165SXin LI #endif 20701fdeb165SXin LI 20711fdeb165SXin LI /* hpt_calc_max_array_capacity_v2 20721fdeb165SXin LI * cap max capacity of the array user want to create or transform 20731fdeb165SXin LI * Version compatibility: v2.0.0.1 or later 20741fdeb165SXin LI * Parameters: 20751fdeb165SXin LI * source - if transform, this is the source array, otherwise, it should be zero 20761fdeb165SXin LI * destInfo - target array params 20771fdeb165SXin LI * Returns: 20781fdeb165SXin LI * 0 - Success 20791fdeb165SXin LI * cap - max capacity of the target array 20801fdeb165SXin LI */ 20811fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x02000001 20821fdeb165SXin LI int hpt_calc_max_array_capacity_v2(DEVICEID source, PCREATE_ARRAY_PARAMS_V3 destInfo, HPT_U64 * cap); 20831fdeb165SXin LI #endif 20841fdeb165SXin LI 20851fdeb165SXin LI /* hpt_rebuild_data_block2 20861fdeb165SXin LI * Used to copy data from source disk and mirror disk. 20871fdeb165SXin LI * Version compatibility: v1.1.0.0 or later 20881fdeb165SXin LI * Parameters: 20891fdeb165SXin LI * idArray Array ID (RAID1, 0/1 or RAID5) 20901fdeb165SXin LI * Lba Start LBA for each array member 20911fdeb165SXin LI * nSector Number of sectors for each array member (RAID 5 will ignore this parameter) 20921fdeb165SXin LI * 20931fdeb165SXin LI * Returns: 20941fdeb165SXin LI * 0 Success, event info is filled in *pEvent 20951fdeb165SXin LI */ 20961fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 20971fdeb165SXin LI int hpt_rebuild_data_block_v2(DEVICEID idMirror, HPT_U64 Lba, HPT_U16 nSector); 20981fdeb165SXin LI #endif 20991fdeb165SXin LI 21001fdeb165SXin LI /* hpt_verify_data_block2 21011fdeb165SXin LI * verify data block on RAID1 or RAID5. 21021fdeb165SXin LI * Version compatibility: v1.1.0.0 or later 21031fdeb165SXin LI * Parameters: 21041fdeb165SXin LI * idArray - Array ID 21051fdeb165SXin LI * Lba - block number (on each array member, not logical block!) 21061fdeb165SXin LI * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 21071fdeb165SXin LI * Returns: 21081fdeb165SXin LI * 0 Success 21091fdeb165SXin LI * 1 Data compare error 21101fdeb165SXin LI * 2 I/O error 21111fdeb165SXin LI */ 21121fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 21131fdeb165SXin LI int hpt_verify_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors); 21141fdeb165SXin LI #endif 21151fdeb165SXin LI 21161fdeb165SXin LI /* hpt_initialize_data_block2 21171fdeb165SXin LI * initialize data block (fill with zero) on RAID5 21181fdeb165SXin LI * Version compatibility: v1.1.0.0 or later 21191fdeb165SXin LI * Parameters: 21201fdeb165SXin LI * idArray - Array ID 21211fdeb165SXin LI * Lba - block number (on each array member, not logical block!) 21221fdeb165SXin LI * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 21231fdeb165SXin LI * Returns: 21241fdeb165SXin LI * 0 Success 21251fdeb165SXin LI */ 21261fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01010000 21271fdeb165SXin LI int hpt_initialize_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors); 21281fdeb165SXin LI #endif 21291fdeb165SXin LI 21301fdeb165SXin LI /* hpt_i2c_transaction 21311fdeb165SXin LI * perform an transaction on i2c bus 21321fdeb165SXin LI * Version compatibility: v2.0.0.0 or later 21331fdeb165SXin LI * Parameters: 21341fdeb165SXin LI * indata[0] - controller ID 21351fdeb165SXin LI * Returns: 21361fdeb165SXin LI * 0 Success 21371fdeb165SXin LI */ 21381fdeb165SXin LI #if HPT_INTERFACE_VERSION>=0x01020000 21391fdeb165SXin LI int hpt_i2c_transaction(HPT_U8 *indata, HPT_U32 inlen, HPT_U8 *outdata, HPT_U32 outlen, HPT_U32 *poutlen); 21401fdeb165SXin LI #endif 21411fdeb165SXin LI 21421fdeb165SXin LI /* hpt_get_parameter_list 21431fdeb165SXin LI * get a list of driver parameters. 21441fdeb165SXin LI * Version compatibility: v1.0.0.0 or later 21451fdeb165SXin LI * Parameters: 21461fdeb165SXin LI * location - parameter location 21471fdeb165SXin LI * outBuffer - a buffer to hold the output 21481fdeb165SXin LI * outBufferSize - size of outBuffer 21491fdeb165SXin LI * Returns: 21501fdeb165SXin LI * 0 Success 21511fdeb165SXin LI * put in outBuffer a list of zero terminated parameter names. the whole list 21521fdeb165SXin LI * is terminated with an additional zero byte. 21531fdeb165SXin LI */ 21541fdeb165SXin LI int hpt_get_parameter_list(HPT_U32 location, char *outBuffer, HPT_U32 outBufferSize); 21551fdeb165SXin LI 21561fdeb165SXin LI /* hpt_{get,set}_parameter 21571fdeb165SXin LI * get/set a parameter value. 21581fdeb165SXin LI * Version compatibility: v1.0.0.0 or later 21591fdeb165SXin LI * Parameters: 21601fdeb165SXin LI * pParam - a pointer to HPT_DRIVER_PARAMETER. 21611fdeb165SXin LI * Returns: 21621fdeb165SXin LI * 0 Success 21631fdeb165SXin LI */ 21641fdeb165SXin LI int hpt_get_parameter(PHPT_DRIVER_PARAMETER pParam); 21651fdeb165SXin LI int hpt_set_parameter(PHPT_DRIVER_PARAMETER pParam); 21661fdeb165SXin LI int hpt_reenumerate_device(DEVICEID id); 21671fdeb165SXin LI 21681fdeb165SXin LI /* 21691fdeb165SXin LI * hpt_get_enclosure_count 21701fdeb165SXin LI * Version compatibility: v2.1.0.0 or later 21711fdeb165SXin LI * Parameters: 21721fdeb165SXin LI * controller_id 21731fdeb165SXin LI * Returns: 21741fdeb165SXin LI * number of enclosurers 21751fdeb165SXin LI */ 21761fdeb165SXin LI int hpt_get_enclosure_count(int ctlr_id); 21771fdeb165SXin LI 21781fdeb165SXin LI /* hpt_get_enclosure_info 21791fdeb165SXin LI * Version compatibility: v2.1.0.0 or later 21801fdeb165SXin LI * Parameters: 21811fdeb165SXin LI * id enclosure id 21821fdeb165SXin LI * pInfo pointer to ENCLOSURE_INFO buffer 21831fdeb165SXin LI * Returns: 21841fdeb165SXin LI * 0 Success, enclosure info is put into (*pInfo ). 21851fdeb165SXin LI */ 21861fdeb165SXin LI int hpt_get_enclosure_info(int ctlr_id, int enc_id, PENCLOSURE_INFO pInfo); 21871fdeb165SXin LI 21881fdeb165SXin LI int hpt_get_enclosure_info_v2(int ctlr_id, int enc_id, PENCLOSURE_INFO_V2 pInfo); 21891fdeb165SXin LI 21901fdeb165SXin LI int hpt_get_enclosure_info_v3(int ctlr_id, int enc_id, PENCLOSURE_INFO_V3 pInfo); 21911fdeb165SXin LI 21921fdeb165SXin LI int hpt_get_enclosure_info_v4(int ctlr_id, int enc_id, PENCLOSURE_INFO_V4 pInfo); 21931fdeb165SXin LI int hpt_get_enclosure_element_info(int ctlr_id, int enc_id, int ele_id, PSES_ELEMENT_STATUS pInfo); 21941fdeb165SXin LI 21951fdeb165SXin LI /* performance monitor interface 21961fdeb165SXin LI * Version compatibility: v2.1.0.0 or later 21971fdeb165SXin LI */ 21981fdeb165SXin LI int hpt_get_perfmon_status(int ctlr_id, int *p_status); 21991fdeb165SXin LI int hpt_set_perfmon_status(int ctlr_id, int enable); 22001fdeb165SXin LI int hpt_get_perfmon_data(DEVICEID id, PHPT_PM_IOSTAT iostat); 22011fdeb165SXin LI 22021fdeb165SXin LI /* hpt_get_controller_venid 22031fdeb165SXin LI * Version compatibility: v1.0.0.0 or later 22041fdeb165SXin LI */ 22051fdeb165SXin LI int hpt_get_controller_venid(int ctlr_id, HPT_U32 *venid); 22061fdeb165SXin LI 22071fdeb165SXin LI /* hpt_access_config_reg 22081fdeb165SXin LI * access the reserved config space on disk 22091fdeb165SXin LI * Parameters: 22101fdeb165SXin LI * p - ACCESS_CONFIG_REG_PARAMS header pointer 22111fdeb165SXin LI * Returns: 22121fdeb165SXin LI * 0 Success 22131fdeb165SXin LI */ 22141fdeb165SXin LI int hpt_access_config_reg(PACCESS_CONFIG_REG_PARAMS p); 22151fdeb165SXin LI 22161fdeb165SXin LI /* hpt_dump_metadata 22171fdeb165SXin LI * dump internal metadata 22181fdeb165SXin LI * Parameters: 22191fdeb165SXin LI * p - PDUMP_METADATA_PARAMS header pointer 22201fdeb165SXin LI * Returns: 22211fdeb165SXin LI * 0 Success 22221fdeb165SXin LI */ 22231fdeb165SXin LI int hpt_dump_metadata(PDUMP_METADATA_PARAMS p); 22241fdeb165SXin LI 22251fdeb165SXin LI #endif 22261fdeb165SXin LI 22271fdeb165SXin LI #pragma pack() 22281fdeb165SXin LI 22291fdeb165SXin LI #ifdef __cplusplus 22301fdeb165SXin LI } 22311fdeb165SXin LI #endif 22321fdeb165SXin LI #endif 2233