1174604Sscottl/* 2174604Sscottl * Copyright (c) HighPoint Technologies, Inc. 3174604Sscottl * All rights reserved. 4174604Sscottl * 5174604Sscottl * Redistribution and use in source and binary forms, with or without 6174604Sscottl * modification, are permitted provided that the following conditions 7174604Sscottl * are met: 8174604Sscottl * 1. Redistributions of source code must retain the above copyright 9174604Sscottl * notice, this list of conditions and the following disclaimer. 10174604Sscottl * 2. Redistributions in binary form must reproduce the above copyright 11174604Sscottl * notice, this list of conditions and the following disclaimer in the 12174604Sscottl * documentation and/or other materials provided with the distribution. 13174604Sscottl * 14174604Sscottl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15174604Sscottl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16174604Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17174604Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18174604Sscottl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19174604Sscottl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20174604Sscottl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21174604Sscottl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22174604Sscottl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23174604Sscottl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24174604Sscottl * SUCH DAMAGE. 25174604Sscottl * 26174604Sscottl * $FreeBSD$ 27174604Sscottl */ 28174604Sscottl#include <dev/hptrr/hptrr_config.h> 29174604Sscottl 30174604Sscottl 31174604Sscottl#ifndef HPT_INTF_H 32174604Sscottl#define HPT_INTF_H 33174604Sscottl 34174604Sscottl#if defined(__BIG_ENDIAN__)&&!defined(__BIG_ENDIAN_BITFIELD) 35174604Sscottl#define __BIG_ENDIAN_BITFIELD 36174604Sscottl#endif 37174604Sscottl 38174604Sscottl#ifdef __cplusplus 39174604Sscottlextern "C" { 40174604Sscottl#endif 41174604Sscottl 42174604Sscottl#ifndef __GNUC__ 43174604Sscottl#define __attribute__(x) 44174604Sscottl#endif 45174604Sscottl 46174604Sscottl#pragma pack(1) 47174604Sscottl 48174604Sscottl/* 49174604Sscottl * Version of this interface. 50174604Sscottl * The user mode application must first issue a hpt_get_version() call to 51174604Sscottl * check HPT_INTERFACE_VERSION. When an utility using newer version interface 52174604Sscottl * is used with old version drivers, it must call only the functions that 53174604Sscottl * driver supported. 54174604Sscottl * A new version interface should only add ioctl functions; it should implement 55174604Sscottl * all old version functions without change their definition. 56174604Sscottl */ 57174604Sscottl#define __this_HPT_INTERFACE_VERSION 0x02000001 58174604Sscottl 59174604Sscottl#ifndef HPT_INTERFACE_VERSION 60174604Sscottl#error "You must define HPT_INTERFACE_VERSION you implemented" 61174604Sscottl#endif 62174604Sscottl 63174604Sscottl#if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION 64174604Sscottl#error "HPT_INTERFACE_VERSION is invalid" 65174604Sscottl#endif 66174604Sscottl 67174604Sscottl/* 68174604Sscottl * DEFINITION 69174604Sscottl * Logical device --- a device that can be accessed by OS. 70174604Sscottl * Physical device --- device attached to the controller. 71174604Sscottl * A logical device can be simply a physical device. 72174604Sscottl * 73174604Sscottl * Each logical and physical device has a 32bit ID. GUI will use this ID 74174604Sscottl * to identify devices. 75174604Sscottl * 1. The ID must be unique. 76174604Sscottl * 2. The ID must be immutable. Once an ID is assigned to a device, it 77174604Sscottl * must not change when system is running and the device exists. 78174604Sscottl * 3. The ID of logical device must be NOT reusable. If a device is 79174604Sscottl * removed, other newly created logical device must not use the same ID. 80174604Sscottl * 4. The ID must not be zero or 0xFFFFFFFF. 81174604Sscottl */ 82174604Sscottltypedef HPT_U32 DEVICEID; 83174604Sscottl 84174604Sscottl/* 85174604Sscottl * logical device type. 86174604Sscottl * Identify array (logical device) and physical device. 87174604Sscottl */ 88174604Sscottl#define LDT_ARRAY 1 89174604Sscottl#define LDT_DEVICE 2 90174604Sscottl 91174604Sscottl/* 92174604Sscottl * Array types 93174604Sscottl * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0. 94174604Sscottl * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0. 95174604Sscottl * Their members may be another array of type RAID0 or RAID1. 96174604Sscottl */ 97174604Sscottl#define AT_UNKNOWN 0 98174604Sscottl#define AT_RAID0 1 99174604Sscottl#define AT_RAID1 2 100174604Sscottl#define AT_RAID5 3 101174604Sscottl#define AT_RAID6 4 102176018Sscottl#define AT_RAID3 5 103176018Sscottl#define AT_RAID4 6 104174604Sscottl#define AT_JBOD 7 105176018Sscottl#define AT_RAID1E 8 106174604Sscottl 107174604Sscottl/* 108174604Sscottl * physical device type 109174604Sscottl */ 110174604Sscottl#define PDT_UNKNOWN 0 111174604Sscottl#define PDT_HARDDISK 1 112174604Sscottl#define PDT_CDROM 2 113174604Sscottl#define PDT_TAPE 3 114174604Sscottl 115174604Sscottl/* 116174604Sscottl * Some constants. 117174604Sscottl */ 118174604Sscottl#define MAX_NAME_LENGTH 36 119174604Sscottl#define MAX_ARRAYNAME_LEN 16 120174604Sscottl 121174604Sscottl#define MAX_ARRAY_MEMBERS_V1 8 122174604Sscottl 123174604Sscottl#ifndef MAX_ARRAY_MEMBERS_V2 124174604Sscottl#define MAX_ARRAY_MEMBERS_V2 16 125174604Sscottl#endif 126174604Sscottl 127174604Sscottl#ifndef MAX_ARRAY_MEMBERS_V3 128174604Sscottl#define MAX_ARRAY_MEMBERS_V3 64 129174604Sscottl#endif 130174604Sscottl 131174604Sscottl/* keep definition for source code compatiblity */ 132174604Sscottl#define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1 133174604Sscottl 134174604Sscottl/* 135174604Sscottl * io commands 136174604Sscottl * GUI use these commands to do IO on logical/physical devices. 137174604Sscottl */ 138174604Sscottl#define IO_COMMAND_READ 1 139174604Sscottl#define IO_COMMAND_WRITE 2 140174604Sscottl 141174604Sscottl 142174604Sscottl 143174604Sscottl/* 144174604Sscottl * array flags 145174604Sscottl */ 146174604Sscottl#define ARRAY_FLAG_DISABLED 0x00000001 /* The array is disabled */ 147174604Sscottl#define ARRAY_FLAG_NEEDBUILDING 0x00000002 /* array data need to be rebuilt */ 148174604Sscottl#define ARRAY_FLAG_REBUILDING 0x00000004 /* array is in rebuilding process */ 149174604Sscottl#define ARRAY_FLAG_BROKEN 0x00000008 /* broken but may still working */ 150174604Sscottl#define ARRAY_FLAG_BOOTDISK 0x00000010 /* array has a active partition */ 151174604Sscottl 152174604Sscottl#define ARRAY_FLAG_BOOTMARK 0x00000040 /* array has boot mark set */ 153174604Sscottl#define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */ 154174604Sscottl#define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */ 155174604Sscottl#define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */ 156174604Sscottl#define ARRAY_FLAG_TRANSFORMING 0x00000400 /* tranform in progress */ 157174604Sscottl#define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need tranform */ 158174604Sscottl#define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/ 159174604Sscottl#define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */ 160174604Sscottl#define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */ 161174604Sscottl/* 162174604Sscottl * device flags 163174604Sscottl */ 164174604Sscottl#define DEVICE_FLAG_DISABLED 0x00000001 /* device is disabled */ 165174604Sscottl#define DEVICE_FLAG_BOOTDISK 0x00000002 /* disk has a active partition */ 166174604Sscottl#define DEVICE_FLAG_BOOTMARK 0x00000004 /* disk has boot mark set */ 167174604Sscottl#define DEVICE_FLAG_WITH_601 0x00000008 /* has HPT601 connected */ 168176018Sscottl#define DEVICE_FLAG_SATA 0x00000010 /* SATA or SAS device */ 169174604Sscottl#define DEVICE_FLAG_ON_PM_PORT 0x00000020 /* PM port */ 170176018Sscottl#define DEVICE_FLAG_SAS 0x00000040 /* SAS device */ 171174604Sscottl 172174604Sscottl#define DEVICE_FLAG_UNINITIALIZED 0x00010000 /* device is not initialized, can't be used to create array */ 173174604Sscottl#define DEVICE_FLAG_LEGACY 0x00020000 /* single disk & mbr contains at least one partition */ 174174604Sscottl 175174604Sscottl#define DEVICE_FLAG_IS_SPARE 0x80000000 /* is a spare disk */ 176174604Sscottl 177174604Sscottl/* 178174604Sscottl * array states used by hpt_set_array_state() 179174604Sscottl */ 180174604Sscottl/* old defines */ 181174604Sscottl#define MIRROR_REBUILD_START 1 182174604Sscottl#define MIRROR_REBUILD_ABORT 2 183174604Sscottl#define MIRROR_REBUILD_COMPLETE 3 184174604Sscottl/* new defines */ 185174604Sscottl#define AS_REBUILD_START 1 186174604Sscottl#define AS_REBUILD_ABORT 2 187174604Sscottl#define AS_REBUILD_PAUSE AS_REBUILD_ABORT 188174604Sscottl#define AS_REBUILD_COMPLETE 3 189174604Sscottl#define AS_VERIFY_START 4 190174604Sscottl#define AS_VERIFY_ABORT 5 191174604Sscottl#define AS_VERIFY_COMPLETE 6 192174604Sscottl#define AS_INITIALIZE_START 7 193174604Sscottl#define AS_INITIALIZE_ABORT 8 194174604Sscottl#define AS_INITIALIZE_COMPLETE 9 195174604Sscottl#define AS_VERIFY_FAILED 10 196174604Sscottl#define AS_REBUILD_STOP 11 197174604Sscottl#define AS_SAVE_STATE 12 198174604Sscottl#define AS_TRANSFORM_START 13 199174604Sscottl#define AS_TRANSFORM_ABORT 14 200174604Sscottl 201174604Sscottl/************************************************************************ 202174604Sscottl * ioctl code 203174604Sscottl * It would be better if ioctl code are the same on different platforms, 204174604Sscottl * but we must not conflict with system defined ioctl code. 205174604Sscottl ************************************************************************/ 206174604Sscottl#if defined(LINUX) || defined(__FreeBSD_version) || defined(linux) 207174604Sscottl#define HPT_CTL_CODE(x) (x+0xFF00) 208174604Sscottl#define HPT_CTL_CODE_LINUX_TO_IOP(x) ((x)-0xff00) 209174604Sscottl#elif defined(_MS_WIN32_) || defined(WIN32) 210174604Sscottl 211174604Sscottl#ifndef CTL_CODE 212174604Sscottl#define CTL_CODE( DeviceType, Function, Method, Access ) \ 213174604Sscottl (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) 214174604Sscottl#endif 215174604Sscottl#define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0) 216174604Sscottl#define HPT_CTL_CODE_WIN32_TO_IOP(x) ((((x) & 0xffff)>>2)-0x900) 217174604Sscottl 218174604Sscottl#else 219174604Sscottl#define HPT_CTL_CODE(x) (x) 220174604Sscottl#endif 221174604Sscottl 222174604Sscottl#define HPT_IOCTL_GET_VERSION HPT_CTL_CODE(0) 223174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_COUNT HPT_CTL_CODE(1) 224174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_INFO HPT_CTL_CODE(2) 225174604Sscottl#define HPT_IOCTL_GET_CHANNEL_INFO HPT_CTL_CODE(3) 226174604Sscottl#define HPT_IOCTL_GET_LOGICAL_DEVICES HPT_CTL_CODE(4) 227174604Sscottl#define HPT_IOCTL_GET_DEVICE_INFO HPT_CTL_CODE(5) 228174604Sscottl#define HPT_IOCTL_CREATE_ARRAY HPT_CTL_CODE(6) 229174604Sscottl#define HPT_IOCTL_DELETE_ARRAY HPT_CTL_CODE(7) 230174604Sscottl#define HPT_IOCTL_ARRAY_IO HPT_CTL_CODE(8) 231174604Sscottl#define HPT_IOCTL_DEVICE_IO HPT_CTL_CODE(9) 232174604Sscottl#define HPT_IOCTL_GET_EVENT HPT_CTL_CODE(10) 233174604Sscottl#define HPT_IOCTL_REBUILD_MIRROR HPT_CTL_CODE(11) 234174604Sscottl/* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */ 235174604Sscottl#define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR 236174604Sscottl#define HPT_IOCTL_ADD_SPARE_DISK HPT_CTL_CODE(12) 237174604Sscottl#define HPT_IOCTL_REMOVE_SPARE_DISK HPT_CTL_CODE(13) 238174604Sscottl#define HPT_IOCTL_ADD_DISK_TO_ARRAY HPT_CTL_CODE(14) 239174604Sscottl#define HPT_IOCTL_SET_ARRAY_STATE HPT_CTL_CODE(15) 240174604Sscottl#define HPT_IOCTL_SET_ARRAY_INFO HPT_CTL_CODE(16) 241174604Sscottl#define HPT_IOCTL_SET_DEVICE_INFO HPT_CTL_CODE(17) 242174604Sscottl#define HPT_IOCTL_RESCAN_DEVICES HPT_CTL_CODE(18) 243174604Sscottl#define HPT_IOCTL_GET_DRIVER_CAPABILITIES HPT_CTL_CODE(19) 244174604Sscottl#define HPT_IOCTL_GET_601_INFO HPT_CTL_CODE(20) 245174604Sscottl#define HPT_IOCTL_SET_601_INFO HPT_CTL_CODE(21) 246174604Sscottl#define HPT_IOCTL_LOCK_DEVICE HPT_CTL_CODE(22) 247174604Sscottl#define HPT_IOCTL_UNLOCK_DEVICE HPT_CTL_CODE(23) 248174604Sscottl#define HPT_IOCTL_IDE_PASS_THROUGH HPT_CTL_CODE(24) 249174604Sscottl#define HPT_IOCTL_VERIFY_DATA_BLOCK HPT_CTL_CODE(25) 250174604Sscottl#define HPT_IOCTL_INITIALIZE_DATA_BLOCK HPT_CTL_CODE(26) 251174604Sscottl#define HPT_IOCTL_ADD_DEDICATED_SPARE HPT_CTL_CODE(27) 252174604Sscottl#define HPT_IOCTL_DEVICE_IO_EX HPT_CTL_CODE(28) 253174604Sscottl#define HPT_IOCTL_SET_BOOT_MARK HPT_CTL_CODE(29) 254174604Sscottl#define HPT_IOCTL_QUERY_REMOVE HPT_CTL_CODE(30) 255174604Sscottl#define HPT_IOCTL_REMOVE_DEVICES HPT_CTL_CODE(31) 256174604Sscottl#define HPT_IOCTL_CREATE_ARRAY_V2 HPT_CTL_CODE(32) 257174604Sscottl#define HPT_IOCTL_GET_DEVICE_INFO_V2 HPT_CTL_CODE(33) 258174604Sscottl#define HPT_IOCTL_SET_DEVICE_INFO_V2 HPT_CTL_CODE(34) 259174604Sscottl#define HPT_IOCTL_REBUILD_DATA_BLOCK_V2 HPT_CTL_CODE(35) 260174604Sscottl#define HPT_IOCTL_VERIFY_DATA_BLOCK_V2 HPT_CTL_CODE(36) 261174604Sscottl#define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2 HPT_CTL_CODE(37) 262174604Sscottl#define HPT_IOCTL_LOCK_DEVICE_V2 HPT_CTL_CODE(38) 263174604Sscottl#define HPT_IOCTL_DEVICE_IO_V2 HPT_CTL_CODE(39) 264174604Sscottl#define HPT_IOCTL_DEVICE_IO_EX_V2 HPT_CTL_CODE(40) 265174604Sscottl#define HPT_IOCTL_CREATE_TRANSFORM HPT_CTL_CODE(41) 266174604Sscottl#define HPT_IOCTL_STEP_TRANSFORM HPT_CTL_CODE(42) 267174604Sscottl#define HPT_IOCTL_SET_VDEV_INFO HPT_CTL_CODE(43) 268174604Sscottl#define HPT_IOCTL_CALC_MAX_CAPACITY HPT_CTL_CODE(44) 269174604Sscottl#define HPT_IOCTL_INIT_DISKS HPT_CTL_CODE(45) 270174604Sscottl#define HPT_IOCTL_GET_DEVICE_INFO_V3 HPT_CTL_CODE(46) 271174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_INFO_V2 HPT_CTL_CODE(47) 272174604Sscottl#define HPT_IOCTL_I2C_TRANSACTION HPT_CTL_CODE(48) 273174604Sscottl#define HPT_IOCTL_GET_PARAMETER_LIST HPT_CTL_CODE(49) 274174604Sscottl#define HPT_IOCTL_GET_PARAMETER HPT_CTL_CODE(50) 275174604Sscottl#define HPT_IOCTL_SET_PARAMETER HPT_CTL_CODE(51) 276174604Sscottl#define HPT_IOCTL_GET_DRIVER_CAPABILITIES_V2 HPT_CTL_CODE(52) 277174604Sscottl#define HPT_IOCTL_GET_CHANNEL_INFO_V2 HPT_CTL_CODE(53) 278174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_INFO_V3 HPT_CTL_CODE(54) 279174604Sscottl#define HPT_IOCTL_GET_DEVICE_INFO_V4 HPT_CTL_CODE(55) 280174604Sscottl#define HPT_IOCTL_CREATE_ARRAY_V3 HPT_CTL_CODE(56) 281174604Sscottl#define HPT_IOCTL_CREATE_TRANSFORM_V2 HPT_CTL_CODE(57) 282174604Sscottl#define HPT_IOCTL_CALC_MAX_CAPACITY_V2 HPT_CTL_CODE(58) 283176018Sscottl#define HPT_IOCTL_SCSI_PASSTHROUGH HPT_CTL_CODE(59) 284174604Sscottl 285174604Sscottl 286174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100) 287174604Sscottl#define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101) 288174604Sscottl 289174604Sscottl#define HPT_IOCTL_EPROM_IO HPT_CTL_CODE(102) 290174604Sscottl#define HPT_IOCTL_GET_CONTROLLER_VENID HPT_CTL_CODE(103) 291174604Sscottl 292174604Sscottl/************************************************************************ 293174604Sscottl * shared data structures 294174604Sscottl ************************************************************************/ 295174604Sscottl 296174604Sscottl/* 297174604Sscottl * Chip Type 298174604Sscottl */ 299174604Sscottl#define CHIP_TYPE_HPT366 1 300174604Sscottl#define CHIP_TYPE_HPT368 2 301174604Sscottl#define CHIP_TYPE_HPT370 3 302174604Sscottl#define CHIP_TYPE_HPT370A 4 303174604Sscottl#define CHIP_TYPE_HPT370B 5 304174604Sscottl#define CHIP_TYPE_HPT374 6 305174604Sscottl#define CHIP_TYPE_HPT372 7 306174604Sscottl#define CHIP_TYPE_HPT372A 8 307174604Sscottl#define CHIP_TYPE_HPT302 9 308174604Sscottl#define CHIP_TYPE_HPT371 10 309174604Sscottl#define CHIP_TYPE_HPT372N 11 310174604Sscottl#define CHIP_TYPE_HPT302N 12 311174604Sscottl#define CHIP_TYPE_HPT371N 13 312174604Sscottl#define CHIP_TYPE_SI3112A 14 313174604Sscottl#define CHIP_TYPE_ICH5 15 314174604Sscottl#define CHIP_TYPE_ICH5R 16 315176018Sscottl#define CHIP_TYPE_MV50XX 20 316176018Sscottl#define CHIP_TYPE_MV60X1 21 317176018Sscottl#define CHIP_TYPE_MV60X2 22 318176018Sscottl#define CHIP_TYPE_MV70X2 23 319176018Sscottl#define CHIP_TYPE_MV5182 24 320176018Sscottl#define CHIP_TYPE_IOP331 31 321176018Sscottl#define CHIP_TYPE_IOP333 32 322176018Sscottl#define CHIP_TYPE_IOP341 33 323176018Sscottl#define CHIP_TYPE_IOP348 34 324174604Sscottl 325174604Sscottl/* 326174604Sscottl * Chip Flags 327174604Sscottl */ 328174604Sscottl#define CHIP_SUPPORT_ULTRA_66 0x20 329174604Sscottl#define CHIP_SUPPORT_ULTRA_100 0x40 330174604Sscottl#define CHIP_HPT3XX_DPLL_MODE 0x80 331174604Sscottl#define CHIP_SUPPORT_ULTRA_133 0x01 332174604Sscottl#define CHIP_SUPPORT_ULTRA_150 0x02 333174604Sscottl#define CHIP_MASTER 0x04 334174604Sscottl#define CHIP_SUPPORT_SATA_300 0x08 335174604Sscottl 336174604Sscottl#define HPT_SPIN_UP_MODE_NOSUPPORT 0 337174604Sscottl#define HPT_SPIN_UP_MODE_FULL 1 338174604Sscottl#define HPT_SPIN_UP_MODE_STANDBY 2 339174604Sscottl 340174604Sscottltypedef struct _DRIVER_CAPABILITIES { 341174604Sscottl HPT_U32 dwSize; 342174604Sscottl 343174604Sscottl HPT_U8 MaximumControllers; /* maximum controllers the driver can support */ 344174604Sscottl HPT_U8 SupportCrossControllerRAID; /* 1-support, 0-not support */ 345174604Sscottl HPT_U8 MinimumBlockSizeShift; /* minimum block size shift */ 346174604Sscottl HPT_U8 MaximumBlockSizeShift; /* maximum block size shift */ 347174604Sscottl 348174604Sscottl HPT_U8 SupportDiskModeSetting; 349174604Sscottl HPT_U8 SupportSparePool; 350174604Sscottl HPT_U8 MaximumArrayNameLength; 351174604Sscottl /* only one HPT_U8 left here! */ 352174604Sscottl#ifdef __BIG_ENDIAN_BITFIELD 353176018Sscottl HPT_U8 reserved: 3; 354176018Sscottl HPT_U8 SupportVariableSectorSize: 1; 355174604Sscottl HPT_U8 SupportHotSwap: 1; 356174604Sscottl HPT_U8 HighPerformanceRAID1: 1; 357174604Sscottl HPT_U8 RebuildProcessInDriver: 1; 358174604Sscottl HPT_U8 SupportDedicatedSpare: 1; 359174604Sscottl#else 360174604Sscottl HPT_U8 SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */ 361174604Sscottl HPT_U8 RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */ 362174604Sscottl HPT_U8 HighPerformanceRAID1: 1; 363174604Sscottl HPT_U8 SupportHotSwap: 1; 364176018Sscottl HPT_U8 SupportVariableSectorSize: 1; 365176018Sscottl HPT_U8 reserved: 3; 366174604Sscottl#endif 367174604Sscottl 368174604Sscottl 369174604Sscottl HPT_U8 SupportedRAIDTypes[16]; 370174604Sscottl /* maximum members in an array corresponding to SupportedRAIDTypes */ 371174604Sscottl HPT_U8 MaximumArrayMembers[16]; 372174604Sscottl} 373174604SscottlDRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES; 374174604Sscottl 375174604Sscottltypedef struct _DRIVER_CAPABILITIES_V2 { 376174604Sscottl DRIVER_CAPABILITIES v1; 377174604Sscottl HPT_U8 SupportedCachePolicies[16]; 378174604Sscottl HPT_U32 reserved[17]; 379174604Sscottl} 380174604SscottlDRIVER_CAPABILITIES_V2, *PDRIVER_CAPABILITIES_V2; 381174604Sscottl 382174604Sscottl/* 383174604Sscottl * Controller information. 384174604Sscottl */ 385174604Sscottltypedef struct _CONTROLLER_INFO { 386174604Sscottl HPT_U8 ChipType; /* chip type */ 387174604Sscottl HPT_U8 InterruptLevel; /* IRQ level */ 388174604Sscottl HPT_U8 NumBuses; /* bus count */ 389174604Sscottl HPT_U8 ChipFlags; 390174604Sscottl 391174604Sscottl HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */ 392174604Sscottl HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */ 393174604Sscottl 394174604Sscottl} CONTROLLER_INFO, *PCONTROLLER_INFO; 395174604Sscottl 396174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 397174604Sscottltypedef struct _CONTROLLER_INFO_V2 { 398174604Sscottl HPT_U8 ChipType; /* chip type */ 399174604Sscottl HPT_U8 InterruptLevel; /* IRQ level */ 400174604Sscottl HPT_U8 NumBuses; /* bus count */ 401174604Sscottl HPT_U8 ChipFlags; 402174604Sscottl 403174604Sscottl HPT_U8 szProductID[MAX_NAME_LENGTH];/* product name */ 404174604Sscottl HPT_U8 szVendorID[MAX_NAME_LENGTH]; /* vender name */ 405174604Sscottl 406174604Sscottl HPT_U32 GroupId; /* low 32bit of vbus pointer the controller belongs 407174604Sscottl * the master controller has CHIP_MASTER flag set*/ 408174604Sscottl HPT_U8 pci_tree; 409174604Sscottl HPT_U8 pci_bus; 410174604Sscottl HPT_U8 pci_device; 411174604Sscottl HPT_U8 pci_function; 412174604Sscottl 413174604Sscottl HPT_U32 ExFlags; 414174604Sscottl} CONTROLLER_INFO_V2, *PCONTROLLER_INFO_V2; 415174604Sscottl 416174604Sscottl 417174604Sscottl#define CEXF_IOPModel 1 418174604Sscottl#define CEXF_SDRAMSize 2 419174604Sscottl#define CEXF_BatteryInstalled 4 420174604Sscottl#define CEXF_BatteryStatus 8 421174604Sscottl#define CEXF_BatteryVoltage 0x10 422174604Sscottl#define CEXF_BatteryBackupTime 0x20 423174604Sscottl#define CEXF_FirmwareVersion 0x40 424174604Sscottl#define CEXF_SerialNumber 0x80 425176018Sscottl#define CEXF_BatteryTemperature 0x100 426174604Sscottl 427174604Sscottltypedef struct _CONTROLLER_INFO_V3 { 428174604Sscottl HPT_U8 ChipType; 429174604Sscottl HPT_U8 InterruptLevel; 430174604Sscottl HPT_U8 NumBuses; 431174604Sscottl HPT_U8 ChipFlags; 432174604Sscottl HPT_U8 szProductID[MAX_NAME_LENGTH]; 433174604Sscottl HPT_U8 szVendorID[MAX_NAME_LENGTH]; 434174604Sscottl HPT_U32 GroupId; 435174604Sscottl HPT_U8 pci_tree; 436174604Sscottl HPT_U8 pci_bus; 437174604Sscottl HPT_U8 pci_device; 438174604Sscottl HPT_U8 pci_function; 439174604Sscottl HPT_U32 ExFlags; 440174604Sscottl HPT_U8 IOPModel[32]; 441174604Sscottl HPT_U32 SDRAMSize; 442176018Sscottl HPT_U8 BatteryInstalled; 443174604Sscottl HPT_U8 BatteryStatus; 444174604Sscottl HPT_U16 BatteryVoltage; 445174604Sscottl HPT_U32 BatteryBackupTime; 446174604Sscottl HPT_U32 FirmwareVersion; 447174604Sscottl HPT_U8 SerialNumber[32]; 448176018Sscottl HPT_U8 BatteryMBInstalled; 449176018Sscottl HPT_U8 BatteryTemperature; 450176018Sscottl HPT_U8 reserve[86]; 451174604Sscottl} 452174604SscottlCONTROLLER_INFO_V3, *PCONTROLLER_INFO_V3; 453174604Sscottltypedef char check_CONTROLLER_INFO_V3[sizeof(CONTROLLER_INFO_V3)==256? 1:-1]; 454174604Sscottl#endif 455174604Sscottl/* 456174604Sscottl * Channel information. 457174604Sscottl */ 458174604Sscottltypedef struct _CHANNEL_INFO { 459174604Sscottl HPT_U32 IoPort; /* IDE Base Port Address */ 460174604Sscottl HPT_U32 ControlPort; /* IDE Control Port Address */ 461174604Sscottl 462174604Sscottl DEVICEID Devices[2]; /* device connected to this channel */ 463174604Sscottl 464174604Sscottl} CHANNEL_INFO, *PCHANNEL_INFO; 465174604Sscottl 466174604Sscottltypedef struct _CHANNEL_INFO_V2 { 467174604Sscottl HPT_U32 IoPort; /* IDE Base Port Address */ 468174604Sscottl HPT_U32 ControlPort; /* IDE Control Port Address */ 469174604Sscottl 470174604Sscottl DEVICEID Devices[2+13]; /* device connected to this channel, PMPort max=15 */ 471174604Sscottl} CHANNEL_INFO_V2, *PCHANNEL_INFO_V2; 472174604Sscottl 473174604Sscottl#ifndef __KERNEL__ 474174604Sscottl/* 475174604Sscottl * time represented in HPT_U32 format 476174604Sscottl */ 477174604Sscottltypedef struct _TIME_RECORD { 478174604Sscottl HPT_U32 seconds:6; /* 0 - 59 */ 479174604Sscottl HPT_U32 minutes:6; /* 0 - 59 */ 480174604Sscottl HPT_U32 month:4; /* 1 - 12 */ 481174604Sscottl HPT_U32 hours:6; /* 0 - 59 */ 482174604Sscottl HPT_U32 day:5; /* 1 - 31 */ 483174604Sscottl HPT_U32 year:5; /* 0=2000, 31=2031 */ 484174604Sscottl} TIME_RECORD; 485174604Sscottl#endif 486174604Sscottl 487174604Sscottl/* 488174604Sscottl * Array information. 489174604Sscottl */ 490174604Sscottltypedef struct _HPT_ARRAY_INFO { 491174604Sscottl HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 492174604Sscottl HPT_U8 Description[64]; /* array description */ 493174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 494174604Sscottl TIME_RECORD CreateTime; /* when created it */ 495174604Sscottl 496174604Sscottl HPT_U8 ArrayType; /* array type */ 497174604Sscottl HPT_U8 BlockSizeShift; /* stripe size */ 498174604Sscottl HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 499176018Sscottl HPT_U8 SubArrayType; 500174604Sscottl 501174604Sscottl HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 502174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V1]; /* member array/disks */ 503174604Sscottl 504174604Sscottl /* 505174604Sscottl * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0); 506174604Sscottl * only valid if rebuilding is done by driver code. 507174604Sscottl * Member Flags will have ARRAY_FLAG_REBUILDING set at this case. 508174604Sscottl * Verify operation use same fields below, the only difference is 509174604Sscottl * ARRAY_FLAG_VERIFYING is set. 510174604Sscottl */ 511174604Sscottl HPT_U32 RebuildingProgress; 512174604Sscottl HPT_U32 RebuiltSectors; /* rebuilding point (LBA) for single member */ 513174604Sscottl 514174604Sscottl} HPT_ARRAY_INFO, *PHPT_ARRAY_INFO; 515174604Sscottl 516174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 517174604Sscottltypedef struct _HPT_ARRAY_INFO_V2 { 518174604Sscottl HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 519174604Sscottl HPT_U8 Description[64]; /* array description */ 520174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 521174604Sscottl TIME_RECORD CreateTime; /* when created it */ 522174604Sscottl 523174604Sscottl HPT_U8 ArrayType; /* array type */ 524174604Sscottl HPT_U8 BlockSizeShift; /* stripe size */ 525174604Sscottl HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 526176018Sscottl HPT_U8 SubArrayType; 527174604Sscottl 528174604Sscottl HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 529174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */ 530174604Sscottl 531174604Sscottl HPT_U32 RebuildingProgress; 532174604Sscottl HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 533174604Sscottl 534174604Sscottl HPT_U32 reserve4[4]; 535174604Sscottl} HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2; 536174604Sscottl#endif 537174604Sscottl 538174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 539174604Sscottltypedef struct _HPT_ARRAY_INFO_V3 { 540174604Sscottl HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 541174604Sscottl HPT_U8 Description[64]; /* array description */ 542174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 543174604Sscottl TIME_RECORD CreateTime; /* when created it */ 544174604Sscottl 545174604Sscottl HPT_U8 ArrayType; /* array type */ 546174604Sscottl HPT_U8 BlockSizeShift; /* stripe size */ 547174604Sscottl HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 548176018Sscottl HPT_U8 SubArrayType; 549174604Sscottl 550174604Sscottl HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 551174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V2]; /* member array/disks */ 552174604Sscottl 553174604Sscottl HPT_U32 RebuildingProgress; 554174604Sscottl HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 555174604Sscottl 556174604Sscottl DEVICEID TransformSource; 557174604Sscottl DEVICEID TransformTarget; /* destination device ID */ 558174604Sscottl HPT_U32 TransformingProgress; 559174604Sscottl HPT_U32 Signature; /* persistent identification*/ 560174604Sscottl#if MAX_ARRAY_MEMBERS_V2==16 561174604Sscottl HPT_U16 Critical_Members; /* bit mask of critical members */ 562174604Sscottl HPT_U16 reserve2; 563174604Sscottl HPT_U32 reserve; 564174604Sscottl#else 565174604Sscottl HPT_U32 Critical_Members; 566174604Sscottl HPT_U32 reserve; 567174604Sscottl#endif 568174604Sscottl} HPT_ARRAY_INFO_V3, *PHPT_ARRAY_INFO_V3; 569174604Sscottl#endif 570174604Sscottl 571174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 572174604Sscottltypedef struct _HPT_ARRAY_INFO_V4 { 573174604Sscottl HPT_U8 Name[MAX_ARRAYNAME_LEN];/* array name */ 574174604Sscottl HPT_U8 Description[64]; /* array description */ 575174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 576174604Sscottl TIME_RECORD CreateTime; /* when created it */ 577174604Sscottl 578174604Sscottl HPT_U8 ArrayType; /* array type */ 579174604Sscottl HPT_U8 BlockSizeShift; /* stripe size */ 580174604Sscottl HPT_U8 nDisk; /* member count: Number of ID in Members[] */ 581176018Sscottl HPT_U8 SubArrayType; 582174604Sscottl 583174604Sscottl HPT_U32 Flags; /* working flags, see ARRAY_FLAG_XXX */ 584174604Sscottl 585174604Sscottl HPT_U32 RebuildingProgress; 586174604Sscottl HPT_U64 RebuiltSectors; /* rebuilding point (LBA) for single member */ 587174604Sscottl 588174604Sscottl DEVICEID TransformSource; 589174604Sscottl DEVICEID TransformTarget; /* destination device ID */ 590174604Sscottl HPT_U32 TransformingProgress; 591174604Sscottl HPT_U32 Signature; /* persistent identification*/ 592176018Sscottl HPT_U8 SectorSizeShift; /*sector size = 512B<<SectorSizeShift*/ 593176018Sscottl HPT_U8 reserved2[7]; 594174604Sscottl HPT_U64 Critical_Members; 595174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V3]; /* member array/disks */ 596174604Sscottl} HPT_ARRAY_INFO_V4, *PHPT_ARRAY_INFO_V4; 597174604Sscottl#endif 598174604Sscottl 599174604Sscottl 600174604Sscottl#ifndef __KERNEL__ 601174604Sscottl/* 602174604Sscottl * ATA/ATAPI Device identify data without the Reserved4. 603174604Sscottl */ 604174604Sscottltypedef struct _IDENTIFY_DATA2 { 605174604Sscottl HPT_U16 GeneralConfiguration; 606174604Sscottl HPT_U16 NumberOfCylinders; 607174604Sscottl HPT_U16 Reserved1; 608174604Sscottl HPT_U16 NumberOfHeads; 609174604Sscottl HPT_U16 UnformattedBytesPerTrack; 610174604Sscottl HPT_U16 UnformattedBytesPerSector; 611174604Sscottl HPT_U16 SectorsPerTrack; 612174604Sscottl HPT_U16 VendorUnique1[3]; 613174604Sscottl HPT_U16 SerialNumber[10]; 614174604Sscottl HPT_U16 BufferType; 615174604Sscottl HPT_U16 BufferSectorSize; 616174604Sscottl HPT_U16 NumberOfEccBytes; 617174604Sscottl HPT_U16 FirmwareRevision[4]; 618174604Sscottl HPT_U16 ModelNumber[20]; 619174604Sscottl HPT_U8 MaximumBlockTransfer; 620174604Sscottl HPT_U8 VendorUnique2; 621174604Sscottl HPT_U16 DoubleWordIo; 622174604Sscottl HPT_U16 Capabilities; 623174604Sscottl HPT_U16 Reserved2; 624174604Sscottl HPT_U8 VendorUnique3; 625174604Sscottl HPT_U8 PioCycleTimingMode; 626174604Sscottl HPT_U8 VendorUnique4; 627174604Sscottl HPT_U8 DmaCycleTimingMode; 628174604Sscottl HPT_U16 TranslationFieldsValid; 629174604Sscottl HPT_U16 NumberOfCurrentCylinders; 630174604Sscottl HPT_U16 NumberOfCurrentHeads; 631174604Sscottl HPT_U16 CurrentSectorsPerTrack; 632174604Sscottl HPT_U32 CurrentSectorCapacity; 633174604Sscottl HPT_U16 CurrentMultiSectorSetting; 634174604Sscottl HPT_U32 UserAddressableSectors; 635174604Sscottl HPT_U8 SingleWordDMASupport; 636174604Sscottl HPT_U8 SingleWordDMAActive; 637174604Sscottl HPT_U8 MultiWordDMASupport; 638174604Sscottl HPT_U8 MultiWordDMAActive; 639174604Sscottl HPT_U8 AdvancedPIOModes; 640174604Sscottl HPT_U8 Reserved4; 641174604Sscottl HPT_U16 MinimumMWXferCycleTime; 642174604Sscottl HPT_U16 RecommendedMWXferCycleTime; 643174604Sscottl HPT_U16 MinimumPIOCycleTime; 644174604Sscottl HPT_U16 MinimumPIOCycleTimeIORDY; 645174604Sscottl HPT_U16 Reserved5[2]; 646174604Sscottl HPT_U16 ReleaseTimeOverlapped; 647174604Sscottl HPT_U16 ReleaseTimeServiceCommand; 648174604Sscottl HPT_U16 MajorRevision; 649174604Sscottl HPT_U16 MinorRevision; 650176018Sscottl} __attribute__((packed)) IDENTIFY_DATA2, *PIDENTIFY_DATA2; 651174604Sscottl#endif 652174604Sscottl 653174604Sscottl/* 654174604Sscottl * physical device information. 655174604Sscottl * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data. 656174604Sscottl */ 657174604Sscottltypedef struct _DEVICE_INFO { 658174604Sscottl HPT_U8 ControllerId; /* controller id */ 659174604Sscottl HPT_U8 PathId; /* bus */ 660174604Sscottl HPT_U8 TargetId; /* id */ 661174604Sscottl HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 662174604Sscottl /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 663174604Sscottl HPT_U8 DeviceType; /* device type */ 664174604Sscottl HPT_U8 UsableMode; /* highest usable mode */ 665174604Sscottl 666174604Sscottl#ifdef __BIG_ENDIAN_BITFIELD 667174604Sscottl HPT_U8 NCQEnabled: 1; 668174604Sscottl HPT_U8 NCQSupported: 1; 669174604Sscottl HPT_U8 TCQEnabled: 1; 670174604Sscottl HPT_U8 TCQSupported: 1; 671174604Sscottl HPT_U8 WriteCacheEnabled: 1; 672174604Sscottl HPT_U8 WriteCacheSupported: 1; 673174604Sscottl HPT_U8 ReadAheadEnabled: 1; 674174604Sscottl HPT_U8 ReadAheadSupported: 1; 675174604Sscottl HPT_U8 reserved6: 6; 676174604Sscottl HPT_U8 SpinUpMode: 2; 677174604Sscottl#else 678174604Sscottl HPT_U8 ReadAheadSupported: 1; 679174604Sscottl HPT_U8 ReadAheadEnabled: 1; 680174604Sscottl HPT_U8 WriteCacheSupported: 1; 681174604Sscottl HPT_U8 WriteCacheEnabled: 1; 682174604Sscottl HPT_U8 TCQSupported: 1; 683174604Sscottl HPT_U8 TCQEnabled: 1; 684174604Sscottl HPT_U8 NCQSupported: 1; 685174604Sscottl HPT_U8 NCQEnabled: 1; 686174604Sscottl HPT_U8 SpinUpMode: 2; 687174604Sscottl HPT_U8 reserved6: 6; 688174604Sscottl#endif 689174604Sscottl 690174604Sscottl HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */ 691174604Sscottl 692174604Sscottl IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */ 693174604Sscottl 694174604Sscottl} 695174604Sscottl__attribute__((packed)) DEVICE_INFO, *PDEVICE_INFO; 696174604Sscottl 697174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 698174604Sscottl#define MAX_PARENTS_PER_DISK 8 699174604Sscottl/* 700174604Sscottl * physical device information. 701174604Sscottl * IdentifyData.ModelNumber[] is HPT_U8-swapped from the original identify data. 702174604Sscottl */ 703174604Sscottltypedef struct _DEVICE_INFO_V2 { 704174604Sscottl HPT_U8 ControllerId; /* controller id */ 705174604Sscottl HPT_U8 PathId; /* bus */ 706174604Sscottl HPT_U8 TargetId; /* id */ 707174604Sscottl HPT_U8 DeviceModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 708174604Sscottl /* 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 709174604Sscottl HPT_U8 DeviceType; /* device type */ 710174604Sscottl HPT_U8 UsableMode; /* highest usable mode */ 711174604Sscottl 712174604Sscottl#ifdef __BIG_ENDIAN_BITFIELD 713174604Sscottl HPT_U8 NCQEnabled: 1; 714174604Sscottl HPT_U8 NCQSupported: 1; 715174604Sscottl HPT_U8 TCQEnabled: 1; 716174604Sscottl HPT_U8 TCQSupported: 1; 717174604Sscottl HPT_U8 WriteCacheEnabled: 1; 718174604Sscottl HPT_U8 WriteCacheSupported: 1; 719174604Sscottl HPT_U8 ReadAheadEnabled: 1; 720174604Sscottl HPT_U8 ReadAheadSupported: 1; 721174604Sscottl HPT_U8 reserved6: 6; 722174604Sscottl HPT_U8 SpinUpMode: 2; 723174604Sscottl#else 724174604Sscottl HPT_U8 ReadAheadSupported: 1; 725174604Sscottl HPT_U8 ReadAheadEnabled: 1; 726174604Sscottl HPT_U8 WriteCacheSupported: 1; 727174604Sscottl HPT_U8 WriteCacheEnabled: 1; 728174604Sscottl HPT_U8 TCQSupported: 1; 729174604Sscottl HPT_U8 TCQEnabled: 1; 730174604Sscottl HPT_U8 NCQSupported: 1; 731174604Sscottl HPT_U8 NCQEnabled: 1; 732174604Sscottl HPT_U8 SpinUpMode: 2; 733174604Sscottl HPT_U8 reserved6: 6; 734174604Sscottl#endif 735174604Sscottl 736174604Sscottl HPT_U32 Flags; /* working flags, see DEVICE_FLAG_XXX */ 737174604Sscottl 738174604Sscottl IDENTIFY_DATA2 IdentifyData; /* Identify Data of this device */ 739174604Sscottl 740174604Sscottl HPT_U64 TotalFree; 741174604Sscottl HPT_U64 MaxFree; 742174604Sscottl HPT_U64 BadSectors; 743174604Sscottl DEVICEID ParentArrays[MAX_PARENTS_PER_DISK]; 744174604Sscottl 745174604Sscottl} 746174604Sscottl__attribute__((packed)) DEVICE_INFO_V2, *PDEVICE_INFO_V2, DEVICE_INFO_V3, *PDEVICE_INFO_V3; 747174604Sscottl 748174604Sscottl/* 749174604Sscottl * HPT601 information 750174604Sscottl */ 751174604Sscottl#endif 752174604Sscottl/* 753174604Sscottl * HPT601 information 754174604Sscottl */ 755174604Sscottl#define HPT601_INFO_DEVICEID 1 756174604Sscottl#define HPT601_INFO_TEMPERATURE 2 757174604Sscottl#define HPT601_INFO_FANSTATUS 4 758174604Sscottl#define HPT601_INFO_BEEPERCONTROL 8 759174604Sscottl#define HPT601_INFO_LED1CONTROL 0x10 760174604Sscottl#define HPT601_INFO_LED2CONTROL 0x20 761174604Sscottl#define HPT601_INFO_POWERSTATUS 0x40 762174604Sscottl 763174604Sscottltypedef struct _HPT601_INFO_ { 764174604Sscottl HPT_U16 ValidFields; /* mark valid fields below */ 765174604Sscottl HPT_U16 DeviceId; /* 0x5A3E */ 766174604Sscottl HPT_U16 Temperature; /* Read: temperature sensor value. Write: temperature limit */ 767174604Sscottl HPT_U16 FanStatus; /* Fan status */ 768174604Sscottl HPT_U16 BeeperControl; /* bit4: beeper control bit. bit0-3: frequency bits */ 769174604Sscottl HPT_U16 LED1Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 770174604Sscottl HPT_U16 LED2Control; /* bit4: twinkling control bit. bit0-3: frequency bits */ 771174604Sscottl HPT_U16 PowerStatus; /* 1: has power 2: no power */ 772174604Sscottl} HPT601_INFO, *PHPT601_INFO; 773174604Sscottl 774174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 775174604Sscottl#ifndef __KERNEL__ 776174604Sscottl/* cache policy for each vdev, copied from ldm.h */ 777174604Sscottl#define CACHE_POLICY_NONE 0 778174604Sscottl#define CACHE_POLICY_WRITE_THROUGH 1 779174604Sscottl#define CACHE_POLICY_WRITE_BACK 2 780174604Sscottl 781174604Sscottl#endif 782174604Sscottl#endif 783174604Sscottl/* 784174604Sscottl * Logical device information. 785174604Sscottl * Union of ArrayInfo and DeviceInfo. 786174604Sscottl * Common properties will be put in logical device information. 787174604Sscottl */ 788174604Sscottltypedef struct _LOGICAL_DEVICE_INFO { 789174604Sscottl HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 790174604Sscottl HPT_U8 reserved[3]; 791174604Sscottl 792174604Sscottl HPT_U32 Capacity; /* array capacity */ 793174604Sscottl DEVICEID ParentArray; 794174604Sscottl 795174604Sscottl union { 796174604Sscottl HPT_ARRAY_INFO array; 797174604Sscottl DEVICE_INFO device; 798174604Sscottl } __attribute__((packed)) u; 799174604Sscottl 800174604Sscottl} __attribute__((packed)) LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO; 801174604Sscottl 802174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 803174604Sscottltypedef struct _LOGICAL_DEVICE_INFO_V2 { 804174604Sscottl HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 805174604Sscottl HPT_U8 reserved[3]; 806174604Sscottl 807174604Sscottl HPT_U64 Capacity; /* array capacity */ 808174604Sscottl DEVICEID ParentArray; /* for physical device, Please don't use this field. 809174604Sscottl * use ParentArrays field in DEVICE_INFO_V2 810174604Sscottl */ 811174604Sscottl 812174604Sscottl union { 813174604Sscottl HPT_ARRAY_INFO_V2 array; 814174604Sscottl DEVICE_INFO device; 815174604Sscottl } __attribute__((packed)) u; 816174604Sscottl 817174604Sscottl} __attribute__((packed)) LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2; 818174604Sscottl#endif 819174604Sscottl 820174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 821174604Sscottl#define INVALID_TARGET_ID 0xFF 822174604Sscottl#define INVALID_BUS_ID 0xFF 823174604Sscottltypedef struct _LOGICAL_DEVICE_INFO_V3 { 824174604Sscottl HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 825174604Sscottl HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */ 826174604Sscottl HPT_U8 VBusId; /* vbus sequence in vbus_list */ 827174604Sscottl HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */ 828174604Sscottl /* OS disk name: HPT DISK $VBusId_$TargetId */ 829174604Sscottl HPT_U64 Capacity; /* array capacity */ 830174604Sscottl DEVICEID ParentArray; /* for physical device, don't use this field. 831174604Sscottl * use ParentArrays field in DEVICE_INFO_V2 instead. 832174604Sscottl */ 833174604Sscottl HPT_U32 TotalIOs; 834174604Sscottl HPT_U32 TobalMBs; 835174604Sscottl HPT_U32 IOPerSec; 836174604Sscottl HPT_U32 MBPerSec; 837174604Sscottl 838174604Sscottl union { 839174604Sscottl HPT_ARRAY_INFO_V3 array; 840174604Sscottl DEVICE_INFO_V2 device; 841174604Sscottl } __attribute__((packed)) u; 842174604Sscottl 843174604Sscottl} 844174604Sscottl__attribute__((packed)) LOGICAL_DEVICE_INFO_V3, *PLOGICAL_DEVICE_INFO_V3; 845174604Sscottl#endif 846174604Sscottl 847174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 848174604Sscottltypedef struct _LOGICAL_DEVICE_INFO_V4 { 849174604Sscottl HPT_U32 dwSize; 850174604Sscottl HPT_U8 revision; 851174604Sscottl HPT_U8 reserved[7]; 852174604Sscottl 853174604Sscottl HPT_U8 Type; /* LDT_ARRAY or LDT_DEVICE */ 854174604Sscottl HPT_U8 CachePolicy; /* refer to CACHE_POLICY_xxx */ 855174604Sscottl HPT_U8 VBusId; /* vbus sequence in vbus_list */ 856174604Sscottl HPT_U8 TargetId; /* OS target id. Value 0xFF is invalid */ 857174604Sscottl /* OS disk name: HPT DISK $VBusId_$TargetId */ 858174604Sscottl HPT_U64 Capacity; /* array capacity */ 859174604Sscottl DEVICEID ParentArray; /* for physical device, don't use this field. 860174604Sscottl * use ParentArrays field in DEVICE_INFO_V2 instead. 861174604Sscottl */ 862174604Sscottl HPT_U32 TotalIOs; 863174604Sscottl HPT_U32 TobalMBs; 864174604Sscottl HPT_U32 IOPerSec; 865174604Sscottl HPT_U32 MBPerSec; 866174604Sscottl 867174604Sscottl union { 868174604Sscottl HPT_ARRAY_INFO_V4 array; 869174604Sscottl DEVICE_INFO_V3 device; 870174604Sscottl } __attribute__((packed)) u; 871174604Sscottl} 872174604Sscottl__attribute__((packed)) LOGICAL_DEVICE_INFO_V4, *PLOGICAL_DEVICE_INFO_V4; 873174604Sscottl 874174604Sscottl/*LOGICAL_DEVICE_INFO_V4 max revision number*/ 875174604Sscottl#define LOGICAL_DEVICE_INFO_V4_REVISION 0 876174604Sscottl/*If new revision was defined please check evey revision size*/ 877174604Sscottl#define LOGICAL_DEVICE_INFO_V4_R0_SIZE (sizeof(LOGICAL_DEVICE_INFO_V4)) 878174604Sscottl#endif 879174604Sscottl 880174604Sscottl/* 881174604Sscottl * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info() 882174604Sscottl * and set_device_info(). 883174604Sscottl * When set_xxx_info() is called, the ValidFields member indicates which 884174604Sscottl * fields in the structure are valid. 885174604Sscottl */ 886174604Sscottl/* field masks */ 887174604Sscottl#define AAIF_NAME 1 888174604Sscottl#define AAIF_DESCRIPTION 2 889174604Sscottl 890174604Sscottl#define ADIF_MODE 1 891174604Sscottl#define ADIF_TCQ 2 892174604Sscottl#define ADIF_NCQ 4 893174604Sscottl#define ADIF_WRITE_CACHE 8 894174604Sscottl#define ADIF_READ_AHEAD 0x10 895174604Sscottl#define ADIF_SPIN_UP_MODE 0x20 896174604Sscottl 897174604Sscottltypedef struct _ALTERABLE_ARRAY_INFO { 898174604Sscottl HPT_U32 ValidFields; /* mark valid fields below */ 899174604Sscottl HPT_U8 Name[MAX_ARRAYNAME_LEN]; /* array name */ 900174604Sscottl HPT_U8 Description[64]; /* array description */ 901176018Sscottl}__attribute__((packed))ALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO; 902174604Sscottl 903174604Sscottltypedef struct _ALTERABLE_DEVICE_INFO { 904174604Sscottl HPT_U32 ValidFields; /* mark valid fields below */ 905174604Sscottl HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 906176018Sscottl}__attribute__((packed))ALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO; 907174604Sscottl 908174604Sscottltypedef struct _ALTERABLE_DEVICE_INFO_V2 { 909174604Sscottl HPT_U32 ValidFields; /* mark valid fields below */ 910174604Sscottl HPT_U8 DeviceModeSetting; /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */ 911174604Sscottl HPT_U8 TCQEnabled; 912174604Sscottl HPT_U8 NCQEnabled; 913174604Sscottl HPT_U8 WriteCacheEnabled; 914174604Sscottl HPT_U8 ReadAheadEnabled; 915174604Sscottl HPT_U8 SpinUpMode; 916174604Sscottl HPT_U8 reserve[2]; 917174604Sscottl HPT_U32 reserve2[13]; /* pad to 64 bytes */ 918176018Sscottl}__attribute__((packed))ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2; 919174604Sscottl 920174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 921174604Sscottl 922174604Sscottl#define TARGET_TYPE_DEVICE 0 923174604Sscottl#define TARGET_TYPE_ARRAY 1 924174604Sscottl 925174604Sscottl 926174604Sscottl#define AIT_NAME 0 927174604Sscottl#define AIT_DESCRIPTION 1 928174604Sscottl#define AIT_CACHE_POLICY 2 929174604Sscottl 930174604Sscottl 931174604Sscottl#define DIT_MODE 0 932174604Sscottl#define DIT_READ_AHEAD 1 933174604Sscottl#define DIT_WRITE_CACHE 2 934174604Sscottl#define DIT_TCQ 3 935174604Sscottl#define DIT_NCQ 4 936174604Sscottl 937174604Sscottl/* param type is determined by target_type and info_type*/ 938174604Sscottltypedef struct _SET_DEV_INFO 939174604Sscottl{ 940174604Sscottl HPT_U8 target_type; 941174604Sscottl HPT_U8 infor_type; 942174604Sscottl HPT_U16 param_length; 943174604Sscottl #define SET_VDEV_INFO_param(p) ((HPT_U8 *)(p)+sizeof(SET_VDEV_INFO)) 944174604Sscottl /* HPT_U8 param[0]; */ 945174604Sscottl} SET_VDEV_INFO, * PSET_VDEV_INFO; 946174604Sscottl 947174604Sscottltypedef HPT_U8 PARAM_ARRAY_NAME[MAX_ARRAYNAME_LEN] ; 948174604Sscottltypedef HPT_U8 PARAM_ARRAY_DES[64]; 949174604Sscottltypedef HPT_U8 PARAM_DEVICE_MODE, PARAM_TCQ, PARAM_NCQ, PARAM_READ_AHEAD, PARAM_WRITE_CACHE, PARAM_CACHE_POLICY; 950174604Sscottl 951174604Sscottl#endif 952174604Sscottl 953174604Sscottl/* 954174604Sscottl * CREATE_ARRAY_PARAMS 955174604Sscottl * Param structure used to create an array. 956174604Sscottl */ 957174604Sscottltypedef struct _CREATE_ARRAY_PARAMS { 958174604Sscottl HPT_U8 ArrayType; /* 1-level array type */ 959174604Sscottl HPT_U8 nDisk; /* number of elements in Members[] array */ 960174604Sscottl HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 961174604Sscottl HPT_U8 CreateFlags; /* See CAF_xxx */ 962174604Sscottl 963174604Sscottl HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 964174604Sscottl HPT_U8 Description[64]; /* array description */ 965174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 966174604Sscottl TIME_RECORD CreateTime; /* when created it */ 967174604Sscottl 968174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */ 969174604Sscottl 970174604Sscottl} CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS; 971174604Sscottl 972174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 973174604Sscottltypedef struct _CREATE_ARRAY_PARAMS_V2 { 974174604Sscottl HPT_U8 ArrayType; /* 1-level array type */ 975174604Sscottl HPT_U8 nDisk; /* number of elements in Members[] array */ 976174604Sscottl HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 977174604Sscottl HPT_U8 CreateFlags; /* See CAF_xxx */ 978174604Sscottl 979174604Sscottl HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 980174604Sscottl HPT_U8 Description[64]; /* array description */ 981174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 982174604Sscottl TIME_RECORD CreateTime; /* when created it */ 983174604Sscottl HPT_U64 Capacity; 984174604Sscottl 985174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */ 986174604Sscottl 987174604Sscottl} CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2; 988174604Sscottl#endif 989174604Sscottl 990174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 991174604Sscottltypedef struct _CREATE_ARRAY_PARAMS_V3 { 992174604Sscottl HPT_U32 dwSize; 993174604Sscottl HPT_U8 revision; /*CREATE_ARRAY_PARAMS_V3_REVISION*/ 994176018Sscottl HPT_U8 reserved[6]; 995176018Sscottl HPT_U8 SectorSizeShift; /*sector size = 512B<<SectorSizeShift*/ 996174604Sscottl HPT_U8 ArrayType; /* 1-level array type */ 997174604Sscottl HPT_U8 nDisk; /* number of elements in Members[] array */ 998174604Sscottl HPT_U8 BlockSizeShift; /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */ 999174604Sscottl HPT_U8 CreateFlags; /* See CAF_xxx */ 1000174604Sscottl 1001174604Sscottl HPT_U8 ArrayName[MAX_ARRAYNAME_LEN];/* Array name */ 1002174604Sscottl HPT_U8 Description[64]; /* array description */ 1003174604Sscottl HPT_U8 CreateManager[16]; /* who created it */ 1004174604Sscottl TIME_RECORD CreateTime; /* when created it */ 1005174604Sscottl HPT_U64 Capacity; 1006174604Sscottl 1007174604Sscottl HPT_U32 Members[MAX_ARRAY_MEMBERS_V3];/* ID of array members, a member can be an array */ 1008174604Sscottl} CREATE_ARRAY_PARAMS_V3, *PCREATE_ARRAY_PARAMS_V3; 1009174604Sscottl 1010174604Sscottl/*CREATE_ARRAY_PARAMS_V3 current max revision*/ 1011174604Sscottl#define CREATE_ARRAY_PARAMS_V3_REVISION 0 1012174604Sscottl/*If new revision defined please check evey revision size*/ 1013174604Sscottl#define CREATE_ARRAY_PARAMS_V3_R0_SIZE (sizeof(CREATE_ARRAY_PARAMS_V3)) 1014174604Sscottl#endif 1015174604Sscottl 1016174604Sscottl#if HPT_INTERFACE_VERSION < 0x01020000 1017174604Sscottl/* 1018174604Sscottl * Flags used for creating an RAID 1 array 1019174604Sscottl * 1020174604Sscottl * CAF_CREATE_AND_DUPLICATE 1021174604Sscottl * Copy source disk contents to target for RAID 1. If user choose "create and duplicate" 1022174604Sscottl * to create an array, GUI will call CreateArray() with this flag set. Then GUI should 1023174604Sscottl * call hpt_get_device_info() with the returned array ID and check returned flags to 1024174604Sscottl * see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding 1025174604Sscottl * and GUI must do duplication itself. 1026174604Sscottl * CAF_DUPLICATE_MUST_DONE 1027174604Sscottl * If the duplication is aborted or fails, do not create the array. 1028174604Sscottl */ 1029174604Sscottl#define CAF_CREATE_AND_DUPLICATE 1 1030174604Sscottl#define CAF_DUPLICATE_MUST_DONE 2 1031174604Sscottl#define CAF_CREATE_AS_RAID15 4 1032174604Sscottl/* 1033174604Sscottl * Flags used for creating an RAID 5 array 1034174604Sscottl */ 1035174604Sscottl#define CAF_CREATE_R5_NO_BUILD 1 1036174604Sscottl#define CAF_CREATE_R5_ZERO_INIT 2 1037174604Sscottl#define CAF_CREATE_R5_BUILD_PARITY 4 1038174604Sscottl 1039174604Sscottl#else 1040174604Sscottl/* 1041174604Sscottl * Flags used for creating 1042174604Sscottl */ 1043174604Sscottl#define CAF_FOREGROUND_INITIALIZE 1 1044174604Sscottl#define CAF_BACKGROUND_INITIALIZE 2 1045174604Sscottl#define CAF_CREATE_R5_WRITE_BACK (CACHE_POLICY_WRITE_BACK<<CAF_CACHE_POLICY_SHIFT) 1046174604Sscottl 1047174604Sscottl 1048174604Sscottl#define CAF_CACHE_POLICY_MASK 0x1C 1049174604Sscottl#define CAF_CACHE_POLICY_SHIFT 2 1050174604Sscottl 1051174604Sscottl#endif 1052174604Sscottl 1053174604Sscottl#define CAF_KEEP_DATA_ALWAYS 0x80 1054174604Sscottl 1055174604Sscottl/* Flags used for deleting an array 1056174604Sscottl * 1057174604Sscottl * DAF_KEEP_DATA_IF_POSSIBLE 1058174604Sscottl * If this flag is set, deleting a RAID 1 array will not destroy the data on both disks. 1059174604Sscottl * Deleting a JBOD should keep partitions on first disk ( not implement now ). 1060174604Sscottl * Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ). 1061174604Sscottl */ 1062174604Sscottl#define DAF_KEEP_DATA_IF_POSSIBLE 1 1063174604Sscottl#define DAF_KEEP_DATA_ALWAYS 2 1064174604Sscottl 1065174604Sscottl/* 1066174604Sscottl * event types 1067174604Sscottl */ 1068174604Sscottl#define ET_DEVICE_REMOVED 1 /* device removed */ 1069174604Sscottl#define ET_DEVICE_PLUGGED 2 /* device plugged */ 1070174604Sscottl#define ET_DEVICE_ERROR 3 /* device I/O error */ 1071174604Sscottl#define ET_REBUILD_STARTED 4 1072174604Sscottl#define ET_REBUILD_ABORTED 5 1073174604Sscottl#define ET_REBUILD_FINISHED 6 1074174604Sscottl#define ET_SPARE_TOOK_OVER 7 1075174604Sscottl#define ET_REBUILD_FAILED 8 1076174604Sscottl#define ET_VERIFY_STARTED 9 1077174604Sscottl#define ET_VERIFY_ABORTED 10 1078174604Sscottl#define ET_VERIFY_FAILED 11 1079174604Sscottl#define ET_VERIFY_FINISHED 12 1080174604Sscottl#define ET_INITIALIZE_STARTED 13 1081174604Sscottl#define ET_INITIALIZE_ABORTED 14 1082174604Sscottl#define ET_INITIALIZE_FAILED 15 1083174604Sscottl#define ET_INITIALIZE_FINISHED 16 1084174604Sscottl#define ET_VERIFY_DATA_ERROR 17 1085174604Sscottl#define ET_TRANSFORM_STARTED 18 1086174604Sscottl#define ET_TRANSFORM_ABORTED 19 1087174604Sscottl#define ET_TRANSFORM_FAILED 20 1088174604Sscottl#define ET_TRANSFORM_FINISHED 21 1089174604Sscottl#define ET_SMART_FAILED 22 1090174604Sscottl#define ET_SMART_PASSED 23 1091174604Sscottl#define ET_SECTOR_REPAIR_FAIL 24 1092174604Sscottl#define ET_SECTOR_REPAIR_SUCCESS 25 1093176018Sscottl#define ET_ERASE_FAIL 26 1094176018Sscottl#define ET_ERASE_SUCCESS 27 1095176018Sscottl#define ET_CONTINUE_REBUILD_ON_ERROR 28 1096174604Sscottl 1097176018Sscottl 1098174604Sscottl/* 1099174604Sscottl * event structure 1100174604Sscottl */ 1101174604Sscottltypedef struct _HPT_EVENT { 1102174604Sscottl TIME_RECORD Time; 1103174604Sscottl DEVICEID DeviceID; 1104174604Sscottl HPT_U8 EventType; 1105174604Sscottl HPT_U8 reserved[3]; 1106174604Sscottl 1107174604Sscottl HPT_U8 Data[32]; /* various data depend on EventType */ 1108174604Sscottl} HPT_EVENT, *PHPT_EVENT; 1109174604Sscottl 1110174604Sscottl/* 1111174604Sscottl * IDE pass-through command. Use it at your own risk! 1112174604Sscottl */ 1113174604Sscottl#ifdef _MSC_VER 1114174604Sscottl#pragma warning(disable:4200) 1115174604Sscottl#endif 1116174604Sscottltypedef struct _IDE_PASS_THROUGH_HEADER { 1117174604Sscottl DEVICEID idDisk; /* disk ID */ 1118174604Sscottl HPT_U8 bFeaturesReg; /* feature register */ 1119174604Sscottl HPT_U8 bSectorCountReg; /* IDE sector count register. */ 1120174604Sscottl HPT_U8 bLbaLowReg; /* IDE LBA low value. */ 1121174604Sscottl HPT_U8 bLbaMidReg; /* IDE LBA mid register. */ 1122174604Sscottl HPT_U8 bLbaHighReg; /* IDE LBA high value. */ 1123174604Sscottl HPT_U8 bDriveHeadReg; /* IDE drive/head register. */ 1124174604Sscottl HPT_U8 bCommandReg; /* Actual IDE command. Checked for validity by driver. */ 1125174604Sscottl HPT_U8 nSectors; /* data size in sectors, if the command has data transfer */ 1126174604Sscottl HPT_U8 protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */ 1127174604Sscottl HPT_U8 reserve[3]; 1128174604Sscottl #define IDE_PASS_THROUGH_buffer(p) ((HPT_U8 *)(p) + sizeof(IDE_PASS_THROUGH_HEADER)) 1129174604Sscottl /* HPT_U8 DataBuffer[0]; */ 1130174604Sscottl} 1131174604SscottlIDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER; 1132174604Sscottl 1133176018Sscottltypedef struct _HPT_SCSI_PASSTHROUGH_IN { 1134176018Sscottl DEVICEID idDisk; 1135176018Sscottl HPT_U8 protocol; 1136176018Sscottl HPT_U8 reserve1; 1137176018Sscottl HPT_U8 reserve2; 1138176018Sscottl HPT_U8 cdbLength; 1139176018Sscottl HPT_U8 cdb[16]; 1140176018Sscottl HPT_U32 dataLength; 1141176018Sscottl /* data follows, if any */ 1142176018Sscottl} 1143176018SscottlHPT_SCSI_PASSTHROUGH_IN, *PHPT_SCSI_PASSTHROUGH_IN; 1144176018Sscottl 1145176018Sscottltypedef struct _HPT_SCSI_PASSTHROUGH_OUT { 1146176018Sscottl HPT_U8 scsiStatus; 1147176018Sscottl HPT_U8 reserve1; 1148176018Sscottl HPT_U8 reserve2; 1149176018Sscottl HPT_U8 reserve3; 1150176018Sscottl HPT_U32 dataLength; 1151176018Sscottl /* data/sense follows if any */ 1152176018Sscottl} 1153176018SscottlHPT_SCSI_PASSTHROUGH_OUT, *PHPT_SCSI_PASSTHROUGH_OUT; 1154176018Sscottl 1155174604Sscottl/* 1156174604Sscottl * device io packet format 1157174604Sscottl */ 1158174604Sscottltypedef struct _DEVICE_IO_EX_PARAMS { 1159174604Sscottl DEVICEID idDisk; 1160174604Sscottl HPT_U32 Lba; 1161174604Sscottl HPT_U16 nSectors; 1162174604Sscottl HPT_U8 Command; /* IO_COMMAD_xxx */ 1163174604Sscottl HPT_U8 BufferType; /* BUFFER_TYPE_xxx, see below */ 1164174604Sscottl HPT_U32 BufferPtr; 1165174604Sscottl} 1166174604SscottlDEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS; 1167174604Sscottl 1168174604Sscottl#define BUFFER_TYPE_LOGICAL 1 /* logical pointer to buffer */ 1169174604Sscottl#define BUFFER_TYPE_PHYSICAL 2 /* physical address of buffer */ 1170174604Sscottl#define BUFFER_TYPE_LOGICAL_LOGICAL_SG 3 /* logical pointer to logical S/G table */ 1171174604Sscottl#define BUFFER_TYPE_LOGICAL_PHYSICAL_SG 4 /* logical pointer to physical S/G table */ 1172174604Sscottl#define BUFFER_TYPE_PHYSICAL_LOGICAL_SG 5 /* physical address to logical S/G table */ 1173174604Sscottl#define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */ 1174174604Sscottl#define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */ 1175174604Sscottl 1176174604Sscottltypedef struct _HPT_DRIVER_PARAMETER { 1177174604Sscottl char name[32]; 1178174604Sscottl HPT_U8 value[32]; 1179174604Sscottl HPT_U8 type; /* HPT_DRIVER_PARAMETER_TYPE_* */ 1180174604Sscottl HPT_U8 persistent; 1181174604Sscottl HPT_U8 reserve2[2]; 1182174604Sscottl HPT_U8 location; /* 0 - system */ 1183174604Sscottl HPT_U8 controller; 1184174604Sscottl HPT_U8 bus; 1185174604Sscottl HPT_U8 reserve1; 1186174604Sscottl char desc[128]; 1187174604Sscottl} 1188174604SscottlHPT_DRIVER_PARAMETER, *PHPT_DRIVER_PARAMETER; 1189174604Sscottl 1190174604Sscottl#define HPT_DRIVER_PARAMETER_TYPE_INT 1 1191174604Sscottl#define HPT_DRIVER_PARAMETER_TYPE_BOOL 2 1192174604Sscottl 1193174604Sscottl 1194174604Sscottl 1195174604Sscottl/* 1196174604Sscottl * ioctl structure 1197174604Sscottl */ 1198174604Sscottl#define HPT_IOCTL_MAGIC32 0x1A2B3C4D 1199174604Sscottl#define HPT_IOCTL_MAGIC 0xA1B2C3D4 1200174604Sscottl 1201174604Sscottltypedef struct _HPT_IOCTL_PARAM { 1202174604Sscottl HPT_U32 Magic; /* used to check if it's a valid ioctl packet */ 1203174604Sscottl HPT_U32 dwIoControlCode; /* operation control code */ 1204174604Sscottl HPT_PTR lpInBuffer; /* input data buffer */ 1205174604Sscottl HPT_U32 nInBufferSize; /* size of input data buffer */ 1206174604Sscottl HPT_PTR lpOutBuffer; /* output data buffer */ 1207174604Sscottl HPT_U32 nOutBufferSize; /* size of output data buffer */ 1208174604Sscottl HPT_PTR lpBytesReturned; /* count of HPT_U8s returned */ 1209174604Sscottl} 1210174604SscottlHPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM; 1211174604Sscottl 1212174604Sscottl/* for 32-bit app running on 64-bit system */ 1213174604Sscottltypedef struct _HPT_IOCTL_PARAM32 { 1214174604Sscottl HPT_U32 Magic; 1215174604Sscottl HPT_U32 dwIoControlCode; 1216174604Sscottl HPT_U32 lpInBuffer; 1217174604Sscottl HPT_U32 nInBufferSize; 1218174604Sscottl HPT_U32 lpOutBuffer; 1219174604Sscottl HPT_U32 nOutBufferSize; 1220174604Sscottl HPT_U32 lpBytesReturned; 1221174604Sscottl} 1222174604SscottlHPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32; 1223174604Sscottl 1224174604Sscottl#if !defined(__KERNEL__) || defined(SIMULATE) 1225174604Sscottl/* 1226174604Sscottl * User-mode ioctl parameter passing conventions: 1227174604Sscottl * The ioctl function implementation is platform specific, so we don't 1228174604Sscottl * have forced rules for it. However, it's suggested to use a parameter 1229174604Sscottl * passing method as below 1230174604Sscottl * 1) Put all input data continuously in an input buffer. 1231174604Sscottl * 2) Prepare an output buffer with enough size if needed. 1232174604Sscottl * 3) Fill a HPT_IOCTL_PARAM structure. 1233174604Sscottl * 4) Pass the structure to driver through a platform-specific method. 1234174604Sscottl * This is implemented in the mid-layer user-mode library. The UI 1235174604Sscottl * programmer needn't care about it. 1236174604Sscottl */ 1237174604Sscottl 1238174604Sscottl/************************************************************************ 1239174604Sscottl * User mode functions 1240174604Sscottl ************************************************************************/ 1241174604Sscottl/* 1242174604Sscottl * hpt_get_version 1243174604Sscottl * Version compatibility: all versions 1244174604Sscottl * Parameters: 1245174604Sscottl * None 1246174604Sscottl * Returns: 1247174604Sscottl * interface version. 0 when fail. 1248174604Sscottl */ 1249174604SscottlHPT_U32 hpt_get_version(void); 1250174604Sscottl 1251174604Sscottl/* 1252174604Sscottl * hpt_get_driver_capabilities 1253174604Sscottl * Version compatibility: v1.0.0.2 or later 1254174604Sscottl * Parameters: 1255174604Sscottl * Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set 1256174604Sscottl * dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this 1257174604Sscottl * member to see if it's correct. 1258174604Sscottl * Returns: 1259174604Sscottl * 0 - Success 1260174604Sscottl */ 1261174604Sscottlint hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap); 1262174604Sscottlint hpt_get_driver_capabilities_v2(PDRIVER_CAPABILITIES_V2 cap); 1263174604Sscottl 1264174604Sscottl/* 1265174604Sscottl * hpt_get_controller_count 1266174604Sscottl * Version compatibility: v1.0.0.1 or later 1267174604Sscottl * Parameters: 1268174604Sscottl * None 1269174604Sscottl * Returns: 1270174604Sscottl * number of controllers 1271174604Sscottl */ 1272174604Sscottlint hpt_get_controller_count(void); 1273174604Sscottl 1274174604Sscottl/* hpt_get_controller_info 1275174604Sscottl * Version compatibility: v1.0.0.1 or later 1276174604Sscottl * Parameters: 1277174604Sscottl * id Controller id 1278174604Sscottl * pInfo pointer to CONTROLLER_INFO buffer 1279174604Sscottl * Returns: 1280174604Sscottl * 0 Success, controller info is put into (*pInfo ). 1281174604Sscottl */ 1282174604Sscottlint hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo); 1283174604Sscottl 1284174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 1285174604Sscottl/* hpt_get_controller_info_v2 1286174604Sscottl * Version compatibility: v2.0.0.0 or later 1287174604Sscottl * Parameters: 1288174604Sscottl * id Controller id 1289174604Sscottl * pInfo pointer to CONTROLLER_INFO_V2 buffer 1290174604Sscottl * Returns: 1291174604Sscottl * 0 Success, controller info is put into (*pInfo ). 1292174604Sscottl */ 1293174604Sscottlint hpt_get_controller_info_v2(int id, PCONTROLLER_INFO_V2 pInfo); 1294174604Sscottl 1295174604Sscottl/* hpt_get_controller_info_v3 1296174604Sscottl * Version compatibility: v2.0.0.0 or later 1297174604Sscottl * Parameters: 1298174604Sscottl * id Controller id 1299174604Sscottl * pInfo pointer to CONTROLLER_INFO_V3 buffer 1300174604Sscottl * Returns: 1301174604Sscottl * 0 Success, controller info is put into (*pInfo ). 1302174604Sscottl */ 1303174604Sscottlint hpt_get_controller_info_v3(int id, PCONTROLLER_INFO_V3 pInfo); 1304174604Sscottl#endif 1305174604Sscottl 1306174604Sscottl/* hpt_get_channel_info 1307174604Sscottl * Version compatibility: v1.0.0.1 or later 1308174604Sscottl * Parameters: 1309174604Sscottl * id Controller id 1310174604Sscottl * bus bus number 1311174604Sscottl * pInfo pointer to CHANNEL_INFO buffer 1312174604Sscottl * Returns: 1313174604Sscottl * 0 Success, channel info is put into (*pInfo ). 1314174604Sscottl */ 1315174604Sscottlint hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo); 1316174604Sscottl 1317174604Sscottl/* hpt_get_channel_info_v2 1318174604Sscottl * Version compatibility: v1.0.0.1 or later 1319174604Sscottl * Parameters: 1320174604Sscottl * id Controller id 1321174604Sscottl * bus bus number 1322174604Sscottl * pInfo pointer to CHANNEL_INFO buffer 1323174604Sscottl * Returns: 1324174604Sscottl * 0 Success, channel info is put into (*pInfo ). 1325174604Sscottl */ 1326174604Sscottlint hpt_get_channel_info_v2(int id, int bus, PCHANNEL_INFO_V2 pInfo); 1327174604Sscottl 1328174604Sscottl/* hpt_get_logical_devices 1329174604Sscottl * Version compatibility: v1.0.0.1 or later 1330174604Sscottl * Parameters: 1331174604Sscottl * pIds pointer to a DEVICEID array 1332174604Sscottl * nMaxCount array size 1333174604Sscottl * Returns: 1334174604Sscottl * Number of ID returned. All logical device IDs are put into pIds array. 1335174604Sscottl * Note: A spare disk is not a logical device. 1336174604Sscottl */ 1337174604Sscottlint hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount); 1338174604Sscottl 1339174604Sscottl/* hpt_get_device_info 1340174604Sscottl * Version compatibility: v1.0.0.1 or later 1341174604Sscottl * Parameters: 1342174604Sscottl * id logical device id 1343174604Sscottl * pInfo pointer to LOGICAL_DEVICE_INFO structure 1344174604Sscottl * Returns: 1345174604Sscottl * 0 - Success 1346174604Sscottl */ 1347174604Sscottlint hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo); 1348174604Sscottl 1349174604Sscottl/* hpt_create_array 1350174604Sscottl * Version compatibility: v1.0.0.1 or later 1351174604Sscottl * Parameters: 1352174604Sscottl * pParam pointer to CREATE_ARRAY_PARAMS structure 1353174604Sscottl * Returns: 1354174604Sscottl * 0 failed 1355174604Sscottl * else return array id 1356174604Sscottl */ 1357174604SscottlDEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam); 1358174604Sscottl 1359174604Sscottl/* hpt_delete_array 1360174604Sscottl * Version compatibility: v1.0.0.1 or later 1361174604Sscottl * Parameters: 1362174604Sscottl * id array id 1363174604Sscottl * Returns: 1364174604Sscottl * 0 Success 1365174604Sscottl */ 1366174604Sscottlint hpt_delete_array(DEVICEID id, HPT_U32 options); 1367174604Sscottl 1368174604Sscottl/* hpt_device_io 1369174604Sscottl * Read/write data on array and physcal device. 1370174604Sscottl * Version compatibility: v1.0.0.1 or later 1371174604Sscottl * Parameters: 1372174604Sscottl * id device id. If it's an array ID, IO will be performed on the array. 1373174604Sscottl * If it's a physical device ID, IO will be performed on the device. 1374174604Sscottl * cmd IO_COMMAND_READ or IO_COMMAND_WRITE 1375174604Sscottl * buffer data buffer 1376174604Sscottl * length data size 1377174604Sscottl * Returns: 1378174604Sscottl * 0 Success 1379174604Sscottl */ 1380174604Sscottlint hpt_device_io(DEVICEID id, int cmd, HPT_U32 lba, HPT_U32 nSector, void * buffer); 1381174604Sscottl 1382174604Sscottl/* hpt_add_disk_to_array 1383174604Sscottl * Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array. 1384174604Sscottl * Auto-rebuild will start. 1385174604Sscottl * Version compatibility: v1.0.0.1 or later 1386174604Sscottl * Parameters: 1387174604Sscottl * idArray array id 1388174604Sscottl * idDisk disk id 1389174604Sscottl * Returns: 1390174604Sscottl * 0 Success 1391174604Sscottl */ 1392174604Sscottlint hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk); 1393174604Sscottl 1394174604Sscottl/* hpt_add_spare_disk 1395174604Sscottl * Version compatibility: v1.0.0.1 or later 1396174604Sscottl * Add a disk to spare pool. 1397174604Sscottl * Parameters: 1398174604Sscottl * idDisk disk id 1399174604Sscottl * Returns: 1400174604Sscottl * 0 Success 1401174604Sscottl */ 1402174604Sscottlint hpt_add_spare_disk(DEVICEID idDisk); 1403174604Sscottl 1404174604Sscottl/* hpt_add_dedicated_spare 1405174604Sscottl * Version compatibility: v1.0.0.3 or later 1406174604Sscottl * Add a spare disk to an array 1407174604Sscottl * Parameters: 1408174604Sscottl * idDisk disk id 1409174604Sscottl * idArray array id 1410174604Sscottl * Returns: 1411174604Sscottl * 0 Success 1412174604Sscottl */ 1413174604Sscottlint hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray); 1414174604Sscottl 1415174604Sscottl/* hpt_remove_spare_disk 1416174604Sscottl * remove a disk from spare pool. 1417174604Sscottl * Version compatibility: v1.0.0.1 or later 1418174604Sscottl * Parameters: 1419174604Sscottl * idDisk disk id 1420174604Sscottl * Returns: 1421174604Sscottl * 0 Success 1422174604Sscottl */ 1423174604Sscottlint hpt_remove_spare_disk(DEVICEID idDisk); 1424174604Sscottl 1425174604Sscottl/* hpt_get_event 1426174604Sscottl * Used to poll events from driver. 1427174604Sscottl * Version compatibility: v1.0.0.1 or later 1428174604Sscottl * Parameters: 1429174604Sscottl * pEvent pointer to HPT_EVENT structure 1430174604Sscottl * Returns: 1431174604Sscottl * 0 Success, event info is filled in *pEvent 1432174604Sscottl */ 1433174604Sscottlint hpt_get_event(PHPT_EVENT pEvent); 1434174604Sscottl 1435174604Sscottl/* hpt_rebuild_data_block 1436174604Sscottl * Used to copy data from source disk and mirror disk. 1437174604Sscottl * Version compatibility: v1.0.0.1 or later 1438174604Sscottl * Parameters: 1439174604Sscottl * idArray Array ID (RAID1, 0/1 or RAID5) 1440174604Sscottl * Lba Start LBA for each array member 1441174604Sscottl * nSector Number of sectors for each array member (RAID 5 will ignore this parameter) 1442174604Sscottl * 1443174604Sscottl * Returns: 1444174604Sscottl * 0 Success, event info is filled in *pEvent 1445174604Sscottl */ 1446174604Sscottlint hpt_rebuild_data_block(DEVICEID idMirror, HPT_U32 Lba, HPT_U8 nSector); 1447174604Sscottl#define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3) 1448174604Sscottl 1449174604Sscottl/* hpt_set_array_state 1450174604Sscottl * set array state. 1451174604Sscottl * Version compatibility: v1.0.0.1 or later 1452174604Sscottl * Parameters: 1453174604Sscottl * idArray Array ID 1454174604Sscottl * state See above 'array states' constants, possible values are: 1455174604Sscottl * MIRROR_REBUILD_START 1456174604Sscottl * Indicate that GUI wants to rebuild a mirror array 1457174604Sscottl * MIRROR_REBUILD_ABORT 1458174604Sscottl * GUI wants to abort rebuilding an array 1459174604Sscottl * MIRROR_REBUILD_COMPLETE 1460174604Sscottl * GUI finished to rebuild an array. If rebuild is done by driver this 1461174604Sscottl * state has no use 1462174604Sscottl * 1463174604Sscottl * Returns: 1464174604Sscottl * 0 Success 1465174604Sscottl */ 1466174604Sscottlint hpt_set_array_state(DEVICEID idArray, HPT_U32 state); 1467174604Sscottl 1468174604Sscottl/* hpt_set_array_info 1469174604Sscottl * set array info. 1470174604Sscottl * Version compatibility: v1.0.0.1 or later 1471174604Sscottl * Parameters: 1472174604Sscottl * idArray Array ID 1473174604Sscottl * pInfo pointer to new info 1474174604Sscottl * 1475174604Sscottl * Returns: 1476174604Sscottl * 0 Success 1477174604Sscottl */ 1478174604Sscottlint hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo); 1479174604Sscottl 1480174604Sscottl/* hpt_set_device_info 1481174604Sscottl * set device info. 1482174604Sscottl * Version compatibility: v1.0.0.1 or later 1483174604Sscottl * Parameters: 1484174604Sscottl * idDisk device ID 1485174604Sscottl * pInfo pointer to new info 1486174604Sscottl * 1487174604Sscottl * Returns: 1488174604Sscottl * 0 Success 1489174604Sscottl * Additional notes: 1490174604Sscottl * If idDisk==0, call to this function will stop buzzer on the adapter 1491174604Sscottl * (if supported by driver). 1492174604Sscottl */ 1493174604Sscottlint hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo); 1494174604Sscottl 1495174604Sscottl#if HPT_INTERFACE_VERSION >= 0x01000004 1496174604Sscottlint hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo); 1497174604Sscottl#endif 1498174604Sscottl 1499174604Sscottl/* hpt_rescan_devices 1500174604Sscottl * rescan devices 1501174604Sscottl * Version compatibility: v1.0.0.1 or later 1502174604Sscottl * Parameters: 1503174604Sscottl * None 1504174604Sscottl * Returns: 1505174604Sscottl * 0 Success 1506174604Sscottl */ 1507174604Sscottlint hpt_rescan_devices(void); 1508174604Sscottl 1509174604Sscottl/* hpt_get_601_info 1510174604Sscottl * Get HPT601 status 1511174604Sscottl * Version compatibiilty: v1.0.0.3 or later 1512174604Sscottl * Parameters: 1513174604Sscottl * idDisk - Disk handle 1514174604Sscottl * PHPT601_INFO - pointer to HPT601 info buffer 1515174604Sscottl * Returns: 1516174604Sscottl * 0 Success 1517174604Sscottl */ 1518174604Sscottlint hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 1519174604Sscottl 1520174604Sscottl/* hpt_set_601_info 1521174604Sscottl * HPT601 function control 1522174604Sscottl * Version compatibiilty: v1.0.0.3 or later 1523174604Sscottl * Parameters: 1524174604Sscottl * idDisk - Disk handle 1525174604Sscottl * PHPT601_INFO - pointer to HPT601 info buffer 1526174604Sscottl * Returns: 1527174604Sscottl * 0 Success 1528174604Sscottl */ 1529174604Sscottlint hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo); 1530174604Sscottl 1531174604Sscottl/* hpt_lock_device 1532174604Sscottl * Lock a block on a device (prevent OS accessing it) 1533174604Sscottl * Version compatibiilty: v1.0.0.3 or later 1534174604Sscottl * Parameters: 1535174604Sscottl * idDisk - Disk handle 1536174604Sscottl * Lba - Start LBA 1537174604Sscottl * nSectors - number of sectors 1538174604Sscottl * Returns: 1539174604Sscottl * 0 Success 1540174604Sscottl */ 1541174604Sscottlint hpt_lock_device(DEVICEID idDisk, HPT_U32 Lba, HPT_U8 nSectors); 1542174604Sscottl 1543174604Sscottl/* hpt_lock_device 1544174604Sscottl * Unlock a device 1545174604Sscottl * Version compatibiilty: v1.0.0.3 or later 1546174604Sscottl * Parameters: 1547174604Sscottl * idDisk - Disk handle 1548174604Sscottl * Returns: 1549174604Sscottl * 0 Success 1550174604Sscottl */ 1551174604Sscottlint hpt_unlock_device(DEVICEID idDisk); 1552174604Sscottl 1553174604Sscottl/* hpt_ide_pass_through 1554176018Sscottl * send a ATA passthrough command to a device. 1555174604Sscottl * Version compatibility: v1.0.0.3 or later 1556174604Sscottl * Parameters: 1557174604Sscottl * p - IDE_PASS_THROUGH header pointer 1558174604Sscottl * Returns: 1559174604Sscottl * 0 Success 1560174604Sscottl */ 1561174604Sscottlint hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p); 1562174604Sscottl 1563176018Sscottl/* hpt_scsi_passthrough 1564176018Sscottl * send a SCSI passthrough command to a device. 1565176018Sscottl * Version compatibility: v2.0.0.0 or later 1566176018Sscottl * Parameters: 1567176018Sscottl * in - HPT_SCSI_PASSTHROUGH_IN header pointer 1568176018Sscottl * out - PHPT_SCSI_PASSTHROUGH_OUT header pointer 1569176018Sscottl * insize, outsize - in/out buffer size 1570176018Sscottl * Returns: 1571176018Sscottl * 0 Success 1572176018Sscottl */ 1573176018Sscottlint hpt_scsi_passthrough(PHPT_SCSI_PASSTHROUGH_IN in, HPT_U32 insize, 1574176018Sscottl PHPT_SCSI_PASSTHROUGH_OUT out, HPT_U32 outsize); 1575176018Sscottl 1576174604Sscottl/* hpt_verify_data_block 1577174604Sscottl * verify data block on RAID1 or RAID5. 1578174604Sscottl * Version compatibility: v1.0.0.3 or later 1579174604Sscottl * Parameters: 1580174604Sscottl * idArray - Array ID 1581174604Sscottl * Lba - block number (on each array member, not logical block!) 1582174604Sscottl * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 1583174604Sscottl * Returns: 1584174604Sscottl * 0 Success 1585174604Sscottl * 1 Data compare error 1586174604Sscottl * 2 I/O error 1587174604Sscottl */ 1588174604Sscottlint hpt_verify_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors); 1589174604Sscottl 1590174604Sscottl/* hpt_initialize_data_block 1591174604Sscottl * initialize data block (fill with zero) on RAID5 1592174604Sscottl * Version compatibility: v1.0.0.3 or later 1593174604Sscottl * Parameters: 1594174604Sscottl * idArray - Array ID 1595174604Sscottl * Lba - block number (on each array member, not logical block!) 1596174604Sscottl * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 1597174604Sscottl * Returns: 1598174604Sscottl * 0 Success 1599174604Sscottl */ 1600174604Sscottlint hpt_initialize_data_block(DEVICEID idArray, HPT_U32 Lba, HPT_U8 nSectors); 1601174604Sscottl 1602174604Sscottl/* hpt_device_io_ex 1603174604Sscottl * extended device I/O function 1604174604Sscottl * Version compatibility: v1.0.0.3 or later 1605174604Sscottl * Parameters: 1606174604Sscottl * idArray - Array ID 1607174604Sscottl * Lba - block number (on each array member, not logical block!) 1608174604Sscottl * nSectors - Sectors for each member 1609174604Sscottl * buffer - I/O buffer or s/g address 1610174604Sscottl * Returns: 1611174604Sscottl * 0 Success 1612174604Sscottl */ 1613174604Sscottlint hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param); 1614174604Sscottl 1615174604Sscottl/* hpt_set_boot_mark 1616174604Sscottl * select boot device 1617174604Sscottl * Version compatibility: v1.0.0.3 or later 1618174604Sscottl * Parameters: 1619174604Sscottl * id - logical device ID. If id is 0 the boot mark will be removed. 1620174604Sscottl * Returns: 1621174604Sscottl * 0 Success 1622174604Sscottl */ 1623174604Sscottlint hpt_set_boot_mark(DEVICEID id); 1624174604Sscottl 1625174604Sscottl/* hpt_query_remove 1626174604Sscottl * check if device can be removed safely 1627174604Sscottl * Version compatibility: v1.0.0.4 or later 1628174604Sscottl * Parameters: 1629174604Sscottl * ndev - number of devices 1630174604Sscottl * pIds - device ID list 1631174604Sscottl * Returns: 1632174604Sscottl * 0 - Success 1633174604Sscottl * -1 - unknown error 1634174604Sscottl * n - the n-th device that can't be removed 1635174604Sscottl */ 1636174604Sscottlint hpt_query_remove(HPT_U32 ndev, DEVICEID *pIds); 1637174604Sscottl 1638174604Sscottl/* hpt_remove_devices 1639174604Sscottl * remove a list of devices 1640174604Sscottl * Version compatibility: v1.0.0.4 or later 1641174604Sscottl * Parameters: 1642174604Sscottl * ndev - number of devices 1643174604Sscottl * pIds - device ID list 1644174604Sscottl * Returns: 1645174604Sscottl * 0 - Success 1646174604Sscottl * -1 - unknown error 1647174604Sscottl * n - the n-th device that can't be removed 1648174604Sscottl */ 1649174604Sscottlint hpt_remove_devices(HPT_U32 ndev, DEVICEID *pIds); 1650174604Sscottl 1651174604Sscottl/* hpt_create_array_v2 1652174604Sscottl * Version compatibility: v1.1.0.0 or later 1653174604Sscottl * Parameters: 1654174604Sscottl * pParam pointer to CREATE_ARRAY_PARAMS_V2 structure 1655174604Sscottl * Returns: 1656174604Sscottl * 0 failed 1657174604Sscottl * else return array id 1658174604Sscottl */ 1659174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 1660174604SscottlDEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam); 1661174604Sscottl#endif 1662174604Sscottl 1663174604Sscottl/* hpt_create_array_v3 1664174604Sscottl * Version compatibility: v2.0.0.1 or later 1665174604Sscottl * Parameters: 1666174604Sscottl * pParam pointer to CREATE_ARRAY_PARAMS_V3 structure 1667174604Sscottl * Returns: 1668174604Sscottl * 0 failed 1669174604Sscottl * else return array id 1670174604Sscottl */ 1671174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 1672174604SscottlDEVICEID hpt_create_array_v3(PCREATE_ARRAY_PARAMS_V3 pParam); 1673174604Sscottl#endif 1674174604Sscottl 1675174604Sscottl/* hpt_get_device_info_v2 1676174604Sscottl * Version compatibility: v1.1.0.0 or later 1677174604Sscottl * Parameters: 1678174604Sscottl * id logical device id 1679174604Sscottl * pInfo pointer to LOGICAL_DEVICE_INFO_V2 structure 1680174604Sscottl * Returns: 1681174604Sscottl * 0 - Success 1682174604Sscottl */ 1683174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 1684174604Sscottlint hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo); 1685174604Sscottl#endif 1686174604Sscottl 1687174604Sscottl/* hpt_get_device_info_v3 1688174604Sscottl * Version compatibility: v1.2.0.0 or later 1689174604Sscottl * Parameters: 1690174604Sscottl * id logical device id 1691174604Sscottl * pInfo pointer to LOGICAL_DEVICE_INFO_V3 structure 1692174604Sscottl * Returns: 1693174604Sscottl * 0 - Success 1694174604Sscottl */ 1695174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 1696174604Sscottlint hpt_get_device_info_v3(DEVICEID id, PLOGICAL_DEVICE_INFO_V3 pInfo); 1697174604Sscottl#endif 1698174604Sscottl 1699174604Sscottl/* hpt_get_device_info_v4 1700174604Sscottl * Version compatibility: v2.0.0.1 or later 1701174604Sscottl * Parameters: 1702174604Sscottl * id logical device id 1703174604Sscottl * pInfo pointer to LOGICAL_DEVICE_INFO_V4 structure 1704174604Sscottl * Returns: 1705174604Sscottl * 0 - Success 1706174604Sscottl */ 1707174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 1708174604Sscottlint hpt_get_device_info_v4(DEVICEID id, PLOGICAL_DEVICE_INFO_V4 pInfo); 1709174604Sscottl#endif 1710174604Sscottl 1711174604Sscottl/* hpt_create_transform 1712174604Sscottl * create a transform instance. 1713174604Sscottl * Version compatibility: v2.0.0.0 or later 1714174604Sscottl * Parameters: 1715174604Sscottl * idArray - source array 1716174604Sscottl * destInfo - destination array info 1717174604Sscottl * Returns: 1718174604Sscottl * destination array id 1719174604Sscottl */ 1720174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000000 1721174604SscottlDEVICEID hpt_create_transform(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V2 destInfo); 1722174604Sscottl#endif 1723174604Sscottl 1724174604Sscottl/* hpt_create_transform_v2 1725174604Sscottl * create a transform instance. 1726174604Sscottl * Version compatibility: v2.0.0.1 or later 1727174604Sscottl * Parameters: 1728174604Sscottl * idArray - source array 1729174604Sscottl * destInfo - destination array info 1730174604Sscottl * Returns: 1731174604Sscottl * destination array id 1732174604Sscottl */ 1733174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 1734174604SscottlDEVICEID hpt_create_transform_v2(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V3 destInfo); 1735174604Sscottl#endif 1736174604Sscottl 1737174604Sscottl/* hpt_step_transform 1738174604Sscottl * move a block in a tranform progress. 1739174604Sscottl * This function is called by mid-layer, not GUI (which uses set_array_state instead). 1740174604Sscottl * Version compatibility: v2.0.0.0 or later 1741174604Sscottl * Parameters: 1742174604Sscottl * idArray - destination array ID 1743174604Sscottl * the source ID will be invalid when transform complete. 1744174604Sscottl * Returns: 1745174604Sscottl * 0 - Success 1746174604Sscottl */ 1747174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000000 1748174604Sscottlint hpt_step_transform(DEVICEID idArray); 1749174604Sscottl#endif 1750174604Sscottl 1751174604Sscottl/* hpt_set_vdev_info 1752174604Sscottl * set information for disk or array 1753174604Sscottl * Version compatibility: v1.2.0.0 or later 1754174604Sscottl * Parameters: 1755174604Sscottl * dev - destination device 1756174604Sscottl * 1757174604Sscottl * Returns: 1758174604Sscottl * 0 - Success 1759174604Sscottl */ 1760174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 1761174604Sscottlint hpt_set_vdev_info(DEVICEID dev, PSET_VDEV_INFO pInfo); 1762174604Sscottl#endif 1763174604Sscottl 1764174604Sscottl/* hpt_init_disks 1765174604Sscottl * initialize disks for use 1766174604Sscottl * Version compatibility: v2.0.0.0 or later 1767174604Sscottl * Parameters: 1768174604Sscottl * ndev - number of disks to initialize 1769174604Sscottl * pIds - array of DEVICEID 1770174604Sscottl * 1771174604Sscottl * Returns: 1772174604Sscottl * 0 - Success 1773174604Sscottl */ 1774174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000000 1775174604Sscottlint hpt_init_disks(HPT_U32 ndev, DEVICEID * pIds); 1776174604Sscottl#endif 1777174604Sscottl 1778174604Sscottl/* hpt_calc_max_array_capacity 1779174604Sscottl * cap max capacity of the array user want to create or transform 1780174604Sscottl * Version compatibility: v1.2.0.0 or later 1781174604Sscottl * Parameters: 1782174604Sscottl * source - if transform, this is the source array, otherwise, it should be zero 1783174604Sscottl * destInfo - target array params 1784174604Sscottl * Returns: 1785174604Sscottl * 0 - Success 1786174604Sscottl * cap - max capacity of the target array 1787174604Sscottl */ 1788174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 1789174604Sscottlint hpt_calc_max_array_capacity(DEVICEID source, PCREATE_ARRAY_PARAMS_V2 destInfo, HPT_U64 * cap); 1790174604Sscottl#endif 1791174604Sscottl 1792174604Sscottl/* hpt_calc_max_array_capacity_v2 1793174604Sscottl * cap max capacity of the array user want to create or transform 1794174604Sscottl * Version compatibility: v2.0.0.1 or later 1795174604Sscottl * Parameters: 1796174604Sscottl * source - if transform, this is the source array, otherwise, it should be zero 1797174604Sscottl * destInfo - target array params 1798174604Sscottl * Returns: 1799174604Sscottl * 0 - Success 1800174604Sscottl * cap - max capacity of the target array 1801174604Sscottl */ 1802174604Sscottl#if HPT_INTERFACE_VERSION>=0x02000001 1803174604Sscottlint hpt_calc_max_array_capacity_v2(DEVICEID source, PCREATE_ARRAY_PARAMS_V3 destInfo, HPT_U64 * cap); 1804174604Sscottl#endif 1805174604Sscottl 1806174604Sscottl/* hpt_rebuild_data_block2 1807174604Sscottl * Used to copy data from source disk and mirror disk. 1808174604Sscottl * Version compatibility: v1.1.0.0 or later 1809174604Sscottl * Parameters: 1810174604Sscottl * idArray Array ID (RAID1, 0/1 or RAID5) 1811174604Sscottl * Lba Start LBA for each array member 1812174604Sscottl * nSector Number of sectors for each array member (RAID 5 will ignore this parameter) 1813174604Sscottl * 1814174604Sscottl * Returns: 1815174604Sscottl * 0 Success, event info is filled in *pEvent 1816174604Sscottl */ 1817174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 1818174604Sscottlint hpt_rebuild_data_block_v2(DEVICEID idMirror, HPT_U64 Lba, HPT_U16 nSector); 1819174604Sscottl#endif 1820174604Sscottl 1821174604Sscottl/* hpt_verify_data_block2 1822174604Sscottl * verify data block on RAID1 or RAID5. 1823174604Sscottl * Version compatibility: v1.1.0.0 or later 1824174604Sscottl * Parameters: 1825174604Sscottl * idArray - Array ID 1826174604Sscottl * Lba - block number (on each array member, not logical block!) 1827174604Sscottl * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 1828174604Sscottl * Returns: 1829174604Sscottl * 0 Success 1830174604Sscottl * 1 Data compare error 1831174604Sscottl * 2 I/O error 1832174604Sscottl */ 1833174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 1834174604Sscottlint hpt_verify_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors); 1835174604Sscottl#endif 1836174604Sscottl 1837174604Sscottl/* hpt_initialize_data_block2 1838174604Sscottl * initialize data block (fill with zero) on RAID5 1839174604Sscottl * Version compatibility: v1.1.0.0 or later 1840174604Sscottl * Parameters: 1841174604Sscottl * idArray - Array ID 1842174604Sscottl * Lba - block number (on each array member, not logical block!) 1843174604Sscottl * nSectors - Sectors for each member (RAID 5 will ignore this parameter) 1844174604Sscottl * Returns: 1845174604Sscottl * 0 Success 1846174604Sscottl */ 1847174604Sscottl#if HPT_INTERFACE_VERSION>=0x01010000 1848174604Sscottlint hpt_initialize_data_block_v2(DEVICEID idArray, HPT_U64 Lba, HPT_U16 nSectors); 1849174604Sscottl#endif 1850174604Sscottl 1851174604Sscottl/* hpt_i2c_transaction 1852174604Sscottl * perform an transaction on i2c bus 1853174604Sscottl * Version compatibility: v2.0.0.0 or later 1854174604Sscottl * Parameters: 1855174604Sscottl * indata[0] - controller ID 1856174604Sscottl * Returns: 1857174604Sscottl * 0 Success 1858174604Sscottl */ 1859174604Sscottl#if HPT_INTERFACE_VERSION>=0x01020000 1860174604Sscottlint hpt_i2c_transaction(HPT_U8 *indata, HPT_U32 inlen, HPT_U8 *outdata, HPT_U32 outlen, HPT_U32 *poutlen); 1861174604Sscottl#endif 1862174604Sscottl 1863174604Sscottl/* hpt_get_parameter_list 1864174604Sscottl * get a list of driver parameters. 1865174604Sscottl * Version compatibility: v1.0.0.0 or later 1866174604Sscottl * Parameters: 1867174604Sscottl * location - parameter location 1868174604Sscottl * outBuffer - a buffer to hold the output 1869174604Sscottl * outBufferSize - size of outBuffer 1870174604Sscottl * Returns: 1871174604Sscottl * 0 Success 1872174604Sscottl * put in outBuffer a list of zero terminated parameter names. the whole list 1873174604Sscottl * is terminated with an additional zero byte. 1874174604Sscottl */ 1875174604Sscottlint hpt_get_parameter_list(HPT_U32 location, char *outBuffer, HPT_U32 outBufferSize); 1876174604Sscottl 1877174604Sscottl/* hpt_{get,set}_parameter 1878174604Sscottl * get/set a parameter value. 1879174604Sscottl * Version compatibility: v1.0.0.0 or later 1880174604Sscottl * Parameters: 1881174604Sscottl * pParam - a pointer to HPT_DRIVER_PARAMETER. 1882174604Sscottl * Returns: 1883174604Sscottl * 0 Success 1884174604Sscottl */ 1885174604Sscottlint hpt_get_parameter(PHPT_DRIVER_PARAMETER pParam); 1886174604Sscottlint hpt_set_parameter(PHPT_DRIVER_PARAMETER pParam); 1887174604Sscottlint hpt_reenumerate_device(DEVICEID id); 1888174604Sscottl 1889174604Sscottl#endif 1890174604Sscottl 1891174604Sscottl#pragma pack() 1892174604Sscottl 1893174604Sscottl#ifdef __cplusplus 1894174604Sscottl} 1895174604Sscottl#endif 1896174604Sscottl#endif 1897