The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/hptmv/hptintf.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2004-2005 HighPoint Technologies, Inc.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  *
   28  * $FreeBSD$
   29  */
   30 
   31 #ifndef HPT_INTF_H
   32 #define HPT_INTF_H
   33 #pragma pack(1)
   34 
   35 /*
   36  * Version of this interface.
   37  * The user mode application must first issue a hpt_get_version() call to
   38  * check HPT_INTERFACE_VERSION. When an utility using newer version interface
   39  * is used with old version drivers, it must call only the functions that
   40  * driver supported.
   41  * A new version interface should only add ioctl functions; it should implement
   42  * all old version functions without change their definition.
   43  */
   44 #define __this_HPT_INTERFACE_VERSION 0x01010000
   45 
   46 #ifndef HPT_INTERFACE_VERSION
   47 #error "You must define HPT_INTERFACE_VERSION you implemented"
   48 #endif
   49 
   50 #if HPT_INTERFACE_VERSION > __this_HPT_INTERFACE_VERSION
   51 #error "HPT_INTERFACE_VERSION is invalid"
   52 #endif
   53 
   54 /*
   55  * DEFINITION
   56  *   Logical device  --- a device that can be accessed by OS.
   57  *   Physical device --- device attached to the controller.
   58  *  A logical device can be simply a physical device.
   59  *
   60  * Each logical and physical device has a 32bit ID. GUI will use this ID
   61  * to identify devices.
   62  *   1. The ID must be unique.
   63  *   2. The ID must be immutable. Once an ID is assigned to a device, it
   64  * must not change when system is running and the device exists.
   65  *   3. The ID of logical device must be NOT reusable. If a device is
   66  * removed, other newly created logical device must not use the same ID.
   67  *   4. The ID must not be zero or 0xFFFFFFFF.
   68  */
   69 typedef DWORD DEVICEID;
   70 
   71 /*
   72  * logical device type.
   73  * Identify array (logical device) and physical device.
   74  */
   75 #define LDT_ARRAY   1
   76 #define LDT_DEVICE  2
   77 
   78 /*
   79  * Array types
   80  * GUI will treat all array as 1-level RAID. No RAID0/1 or RAID1/0.
   81  * A RAID0/1 device is type AT_RAID1. A RAID1/0 device is type AT_RAID0.
   82  * Their members may be another array of type RAID0 or RAID1.
   83  */
   84 #define AT_UNKNOWN  0
   85 #define AT_RAID0    1
   86 #define AT_RAID1    2
   87 #define AT_RAID5    3
   88 #define AT_JBOD     7
   89 
   90 /*
   91  * physical device type
   92  */
   93 #define PDT_UNKNOWN     0
   94 #define PDT_HARDDISK    1
   95 #define PDT_CDROM       2
   96 #define PDT_TAPE        3
   97 
   98 /*
   99  * Some constants.
  100  */
  101 #define MAX_NAME_LENGTH     36
  102 #define MAX_ARRAYNAME_LEN   16
  103 
  104 #define MAX_ARRAY_MEMBERS_V1 8
  105 #define MAX_ARRAY_MEMBERS_V2 16
  106 /* keep definition for source code compatibility */
  107 #define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
  108 
  109 /*
  110  * io commands
  111  * GUI use these commands to do IO on logical/physical devices.
  112  */
  113 #define IO_COMMAND_READ     1
  114 #define IO_COMMAND_WRITE    2
  115 
  116 /*
  117  * array flags
  118  */
  119 #define ARRAY_FLAG_DISABLED         0x00000001 /* The array is disabled */
  120 #define ARRAY_FLAG_NEEDBUILDING     0x00000002 /* array need synchronizing */
  121 #define ARRAY_FLAG_REBUILDING       0x00000004 /* array is in rebuilding process */
  122 #define ARRAY_FLAG_BROKEN           0x00000008 /* broken but may still working */
  123 #define ARRAY_FLAG_BOOTDISK         0x00000010 /* array has a active partition */
  124 #define ARRAY_FLAG_NEWLY_CREATED    0x00000020 /* a newly created array */
  125 #define ARRAY_FLAG_BOOTMARK         0x00000040 /* array has boot mark set */
  126 #define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */
  127 #define ARRAY_FLAG_VERIFYING        0x00000100 /* is being verified */
  128 #define ARRAY_FLAG_INITIALIZING     0x00000200 /* is being initialized */
  129 #define ARRAY_FLAG_RAID15PLUS       0x80000000 /* display this RAID 1 as RAID 1.5 */
  130 
  131 /*
  132  * device flags
  133  */
  134 #define DEVICE_FLAG_DISABLED        0x00000001 /* device is disabled */
  135 #define DEVICE_FLAG_BOOTDISK        0x00000002 /* disk has a active partition */
  136 #define DEVICE_FLAG_BOOTMARK        0x00000004 /* disk has boot mark set */
  137 #define DEVICE_FLAG_WITH_601        0x00000008 /* has HPT601 connected */
  138 #define DEVICE_FLAG_SATA            0x00000010 /* S-ATA device */
  139 #define DEVICE_FLAG_IS_SPARE        0x80000000 /* is a spare disk */
  140 
  141 /*
  142  * array states used by hpt_set_array_state()
  143  */
  144 /* old defines */
  145 #define MIRROR_REBUILD_START    1
  146 #define MIRROR_REBUILD_ABORT    2
  147 #define MIRROR_REBUILD_COMPLETE 3
  148 /* new defines */
  149 #define AS_REBUILD_START 1
  150 #define AS_REBUILD_ABORT 2
  151 #define AS_REBUILD_PAUSE AS_REBUILD_ABORT
  152 #define AS_REBUILD_COMPLETE 3
  153 #define AS_VERIFY_START 4
  154 #define AS_VERIFY_ABORT 5
  155 #define AS_VERIFY_COMPLETE 6
  156 #define AS_INITIALIZE_START 7
  157 #define AS_INITIALIZE_ABORT 8
  158 #define AS_INITIALIZE_COMPLETE 9
  159 #define AS_VERIFY_FAILED 10
  160 #define AS_REBUILD_STOP 11
  161 #define AS_SAVE_STATE   12
  162 /************************************************************************
  163  * ioctl code
  164  * It would be better if ioctl code are the same on different platforms,
  165  * but we must not conflict with system defined ioctl code.
  166  ************************************************************************/
  167 #if defined(LINUX) || defined(__FreeBSD_version)
  168 #define HPT_CTL_CODE(x) (x+0xFF00)
  169 #elif defined(_MS_WIN32_) || defined(WIN32)
  170 
  171 #ifndef CTL_CODE
  172 #define CTL_CODE( DeviceType, Function, Method, Access ) \
  173                         (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
  174 #endif
  175 #define HPT_CTL_CODE(x) CTL_CODE(0x370, 0x900+(x), 0, 0)
  176 #define HPT_CTL_CODE_WIN32_TO_I960(x) ((((x) & 0xffff)>>2)-0x900)
  177 
  178 #else 
  179 #define HPT_CTL_CODE(x) (x)
  180 #endif
  181 
  182 #define HPT_IOCTL_GET_VERSION               HPT_CTL_CODE(0)
  183 #define HPT_IOCTL_GET_CONTROLLER_COUNT      HPT_CTL_CODE(1)
  184 #define HPT_IOCTL_GET_CONTROLLER_INFO       HPT_CTL_CODE(2)
  185 #define HPT_IOCTL_GET_CHANNEL_INFO          HPT_CTL_CODE(3)
  186 #define HPT_IOCTL_GET_LOGICAL_DEVICES       HPT_CTL_CODE(4)
  187 #define HPT_IOCTL_GET_DEVICE_INFO           HPT_CTL_CODE(5)
  188 #define HPT_IOCTL_CREATE_ARRAY              HPT_CTL_CODE(6)
  189 #define HPT_IOCTL_DELETE_ARRAY              HPT_CTL_CODE(7)
  190 #define HPT_IOCTL_ARRAY_IO                  HPT_CTL_CODE(8)
  191 #define HPT_IOCTL_DEVICE_IO                 HPT_CTL_CODE(9)
  192 #define HPT_IOCTL_GET_EVENT                 HPT_CTL_CODE(10)
  193 #define HPT_IOCTL_REBUILD_MIRROR            HPT_CTL_CODE(11)
  194 /* use HPT_IOCTL_REBUILD_DATA_BLOCK from now on */
  195 #define HPT_IOCTL_REBUILD_DATA_BLOCK HPT_IOCTL_REBUILD_MIRROR
  196 #define HPT_IOCTL_ADD_SPARE_DISK            HPT_CTL_CODE(12)
  197 #define HPT_IOCTL_REMOVE_SPARE_DISK         HPT_CTL_CODE(13)
  198 #define HPT_IOCTL_ADD_DISK_TO_ARRAY         HPT_CTL_CODE(14)
  199 #define HPT_IOCTL_SET_ARRAY_STATE           HPT_CTL_CODE(15)
  200 #define HPT_IOCTL_SET_ARRAY_INFO            HPT_CTL_CODE(16)
  201 #define HPT_IOCTL_SET_DEVICE_INFO           HPT_CTL_CODE(17)
  202 #define HPT_IOCTL_RESCAN_DEVICES            HPT_CTL_CODE(18)
  203 #define HPT_IOCTL_GET_DRIVER_CAPABILITIES   HPT_CTL_CODE(19)
  204 #define HPT_IOCTL_GET_601_INFO              HPT_CTL_CODE(20)
  205 #define HPT_IOCTL_SET_601_INFO              HPT_CTL_CODE(21)
  206 #define HPT_IOCTL_LOCK_DEVICE               HPT_CTL_CODE(22)
  207 #define HPT_IOCTL_UNLOCK_DEVICE             HPT_CTL_CODE(23)
  208 #define HPT_IOCTL_IDE_PASS_THROUGH          HPT_CTL_CODE(24)
  209 #define HPT_IOCTL_VERIFY_DATA_BLOCK         HPT_CTL_CODE(25)
  210 #define HPT_IOCTL_INITIALIZE_DATA_BLOCK     HPT_CTL_CODE(26)
  211 #define HPT_IOCTL_ADD_DEDICATED_SPARE       HPT_CTL_CODE(27)
  212 #define HPT_IOCTL_DEVICE_IO_EX              HPT_CTL_CODE(28)
  213 #define HPT_IOCTL_SET_BOOT_MARK             HPT_CTL_CODE(29)
  214 #define HPT_IOCTL_QUERY_REMOVE              HPT_CTL_CODE(30)
  215 #define HPT_IOCTL_REMOVE_DEVICES            HPT_CTL_CODE(31)
  216 #define HPT_IOCTL_CREATE_ARRAY_V2           HPT_CTL_CODE(32)
  217 #define HPT_IOCTL_GET_DEVICE_INFO_V2        HPT_CTL_CODE(33)
  218 #define HPT_IOCTL_SET_DEVICE_INFO_V2        HPT_CTL_CODE(34)
  219 #define HPT_IOCTL_REBUILD_DATA_BLOCK_V2     HPT_CTL_CODE(35)
  220 #define HPT_IOCTL_VERIFY_DATA_BLOCK_V2      HPT_CTL_CODE(36)
  221 #define HPT_IOCTL_INITIALIZE_DATA_BLOCK_V2  HPT_CTL_CODE(37)
  222 #define HPT_IOCTL_LOCK_DEVICE_V2            HPT_CTL_CODE(38)
  223 #define HPT_IOCTL_DEVICE_IO_V2              HPT_CTL_CODE(39)
  224 #define HPT_IOCTL_DEVICE_IO_EX_V2           HPT_CTL_CODE(40)
  225 
  226 #define HPT_IOCTL_I2C_TRANSACTION           HPT_CTL_CODE(48)
  227 #define HPT_IOCTL_GET_PARAMETER_LIST        HPT_CTL_CODE(49)
  228 #define HPT_IOCTL_GET_PARAMETER             HPT_CTL_CODE(50)
  229 #define HPT_IOCTL_SET_PARAMETER             HPT_CTL_CODE(51)
  230 
  231 /* Windows only */
  232 #define HPT_IOCTL_GET_CONTROLLER_IDS        HPT_CTL_CODE(100)
  233 #define HPT_IOCTL_GET_DCB                   HPT_CTL_CODE(101)
  234 #define HPT_IOCTL_EPROM_IO                  HPT_CTL_CODE(102)
  235 #define HPT_IOCTL_GET_CONTROLLER_VENID      HPT_CTL_CODE(103)
  236 
  237 /************************************************************************
  238  * shared data structures
  239  ************************************************************************/
  240 
  241 /*
  242  * Chip Type
  243  */
  244 #define CHIP_TYPE_HPT366      1
  245 #define CHIP_TYPE_HPT368      2
  246 #define CHIP_TYPE_HPT370      3
  247 #define CHIP_TYPE_HPT370A     4
  248 #define CHIP_TYPE_HPT370B     5
  249 #define CHIP_TYPE_HPT374      6
  250 #define CHIP_TYPE_HPT372      7
  251 #define CHIP_TYPE_HPT372A     8
  252 #define CHIP_TYPE_HPT302      9
  253 #define CHIP_TYPE_HPT371      10
  254 #define CHIP_TYPE_HPT372N     11
  255 #define CHIP_TYPE_HPT302N     12
  256 #define CHIP_TYPE_HPT371N     13
  257 #define CHIP_TYPE_SI3112A     14
  258 #define CHIP_TYPE_ICH5        15
  259 #define CHIP_TYPE_ICH5R       16
  260 
  261 /*
  262  * Chip Flags
  263  */
  264 #define CHIP_SUPPORT_ULTRA_66   0x20
  265 #define CHIP_SUPPORT_ULTRA_100  0x40
  266 #define CHIP_HPT3XX_DPLL_MODE   0x80
  267 #define CHIP_SUPPORT_ULTRA_133  0x01
  268 #define CHIP_SUPPORT_ULTRA_150  0x02
  269 
  270 typedef struct _DRIVER_CAPABILITIES {
  271         DWORD dwSize;
  272 
  273         UCHAR MaximumControllers;           /* maximum controllers the driver can support */
  274         UCHAR SupportCrossControllerRAID;   /* 1-support, 0-not support */
  275         UCHAR MinimumBlockSizeShift;        /* minimum block size shift */
  276         UCHAR MaximumBlockSizeShift;        /* maximum block size shift */
  277 
  278         UCHAR SupportDiskModeSetting;
  279         UCHAR SupportSparePool;
  280         UCHAR MaximumArrayNameLength;
  281         /* only one byte left here! */
  282 #ifdef __BIG_ENDIAN_BITFIELD
  283         UCHAR reserved: 4;
  284         UCHAR SupportHotSwap: 1;
  285         UCHAR HighPerformanceRAID1: 1;
  286         UCHAR RebuildProcessInDriver: 1;
  287         UCHAR SupportDedicatedSpare: 1;
  288 #else 
  289         UCHAR SupportDedicatedSpare: 1; /* call hpt_add_dedicated_spare() for dedicated spare. */
  290         UCHAR RebuildProcessInDriver: 1; /* Windows only. used by mid layer for rebuild control. */
  291         UCHAR HighPerformanceRAID1: 1; /* Support RAID1.5 */
  292         UCHAR SupportHotSwap: 1;
  293         UCHAR reserved: 4;
  294 #endif
  295 
  296         /* SupportedRAIDTypes is an array of bytes, one of each is an array type.
  297          * Only non-zero values is valid. Bit0-3 represents the lower(child) level RAID type;
  298          * bit4-7 represents the top level. i.e.
  299          *     RAID 0/1 is (AT_RAID1<<4) | AT_RAID0
  300          *     RAID 5/0 is (AT_RAID0<<4) | AT_RAID5
  301          */
  302         UCHAR SupportedRAIDTypes[16];
  303         /* maximum members in an array corresponding to SupportedRAIDTypes */
  304         UCHAR MaximumArrayMembers[16];
  305 }
  306 DRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES;
  307 
  308 /*
  309  * Controller information.
  310  */
  311 typedef struct _CONTROLLER_INFO {
  312         UCHAR ChipType;                     /* chip type */
  313         UCHAR InterruptLevel;               /* IRQ level */
  314         UCHAR NumBuses;                     /* bus count */
  315         UCHAR ChipFlags;
  316 
  317         UCHAR szProductID[MAX_NAME_LENGTH]; /* product name */
  318         UCHAR szVendorID[MAX_NAME_LENGTH];  /* vender name */
  319 
  320 } CONTROLLER_INFO, *PCONTROLLER_INFO;
  321 
  322 /*
  323  * Channel information.
  324  */
  325 typedef struct _CHANNEL_INFO {
  326         ULONG       IoPort;         /* IDE Base Port Address */
  327         ULONG       ControlPort;    /* IDE Control Port Address */
  328 
  329         DEVICEID    Devices[2];     /* device connected to this channel */
  330 
  331 } CHANNEL_INFO, *PCHANNEL_INFO;
  332 
  333 /*
  334  * time represented in DWORD format
  335  */
  336 #ifndef __KERNEL__
  337 typedef struct _TIME_RECORD {
  338    UINT        seconds:6;      /* 0 - 59 */
  339    UINT        minutes:6;      /* 0 - 59 */
  340    UINT        month:4;        /* 1 - 12 */
  341    UINT        hours:6;        /* 0 - 59 */
  342    UINT        day:5;          /* 1 - 31 */
  343    UINT        year:5;         /* 0=2000, 31=2031 */
  344 } TIME_RECORD;
  345 #endif
  346 
  347 /*
  348  * Array information.
  349  */
  350 typedef struct _HPT_ARRAY_INFO {
  351         UCHAR       Name[MAX_ARRAYNAME_LEN];/* array name */
  352         UCHAR       Description[64];        /* array description */
  353         UCHAR       CreateManager[16];      /* who created it */
  354         TIME_RECORD CreateTime;             /* when created it */
  355 
  356         UCHAR       ArrayType;              /* array type */
  357         UCHAR       BlockSizeShift;         /* stripe size */
  358         UCHAR       nDisk;                  /* member count: Number of ID in Members[] */
  359         UCHAR       reserved;
  360 
  361         DWORD       Flags;                  /* working flags, see ARRAY_FLAG_XXX */
  362         DWORD       Members[MAX_ARRAY_MEMBERS_V1];  /* member array/disks */
  363 
  364         /*
  365          * rebuilding progress, xx.xx% = sprintf(s, "%.2f%%", RebuildingProgress/100.0);
  366          * only valid if rebuilding is done by driver code.
  367          * Member Flags will have ARRAY_FLAG_REBUILDING set at this case.
  368          * Verify operation use same fields below, the only difference is
  369          * ARRAY_FLAG_VERIFYING is set.
  370          */
  371         DWORD       RebuildingProgress;
  372         DWORD       RebuiltSectors; /* rebuilding point (LBA) for single member */
  373 
  374 } HPT_ARRAY_INFO, *PHPT_ARRAY_INFO;  /*LDX modify ARRAY_INFO TO HPT_ARRAY_INFO to avoid compiling error in Windows*/
  375 
  376 #if HPT_INTERFACE_VERSION>=0x01010000
  377 typedef struct _LBA64 {
  378 #ifdef __BIG_ENDIAN_BITFIELD
  379         DWORD hi32;
  380         DWORD lo32;
  381 #else 
  382         DWORD lo32;
  383         DWORD hi32;
  384 #endif
  385 }
  386 LBA64;
  387 typedef struct _HPT_ARRAY_INFO_V2 {
  388         UCHAR       Name[MAX_ARRAYNAME_LEN];/* array name */
  389         UCHAR       Description[64];        /* array description */
  390         UCHAR       CreateManager[16];      /* who created it */
  391         TIME_RECORD CreateTime;             /* when created it */
  392 
  393         UCHAR       ArrayType;              /* array type */
  394         UCHAR       BlockSizeShift;         /* stripe size */
  395         UCHAR       nDisk;                  /* member count: Number of ID in Members[] */
  396         UCHAR       reserved;
  397 
  398         DWORD       Flags;                  /* working flags, see ARRAY_FLAG_XXX */
  399         DWORD       Members[MAX_ARRAY_MEMBERS_V2];  /* member array/disks */
  400 
  401         DWORD       RebuildingProgress;
  402         LBA64       RebuiltSectors; /* rebuilding point (LBA) for single member */
  403         
  404         DWORD       reserve4[4];
  405 
  406 } HPT_ARRAY_INFO_V2, *PHPT_ARRAY_INFO_V2;
  407 #endif
  408 
  409 /*
  410  * ATA/ATAPI Device identify data without the Reserved4.
  411  */
  412 #ifndef __KERNEL__
  413 typedef struct _IDENTIFY_DATA2 {
  414         USHORT GeneralConfiguration;            /* 00 00 */
  415         USHORT NumberOfCylinders;               /* 02  1 */
  416         USHORT Reserved1;                       /* 04  2 */
  417         USHORT NumberOfHeads;                   /* 06  3 */
  418         USHORT UnformattedBytesPerTrack;        /* 08  4 */
  419         USHORT UnformattedBytesPerSector;       /* 0A  5 */
  420         USHORT SectorsPerTrack;                 /* 0C  6 */
  421         USHORT VendorUnique1[3];                /* 0E  7-9 */
  422         USHORT SerialNumber[10];                /* 14  10-19 */
  423         USHORT BufferType;                      /* 28  20 */
  424         USHORT BufferSectorSize;                /* 2A  21 */
  425         USHORT NumberOfEccBytes;                /* 2C  22 */
  426         USHORT FirmwareRevision[4];             /* 2E  23-26 */
  427         USHORT ModelNumber[20];                 /* 36  27-46 */
  428         UCHAR  MaximumBlockTransfer;            /* 5E  47 */
  429         UCHAR  VendorUnique2;                   /* 5F */
  430         USHORT DoubleWordIo;                    /* 60  48 */
  431         USHORT Capabilities;                    /* 62  49 */
  432         USHORT Reserved2;                       /* 64  50 */
  433         UCHAR  VendorUnique3;                   /* 66  51 */
  434         UCHAR  PioCycleTimingMode;              /* 67 */
  435         UCHAR  VendorUnique4;                   /* 68  52 */
  436         UCHAR  DmaCycleTimingMode;              /* 69 */
  437         USHORT TranslationFieldsValid:1;        /* 6A  53 */
  438         USHORT Reserved3:15;
  439         USHORT NumberOfCurrentCylinders;        /* 6C  54 */
  440         USHORT NumberOfCurrentHeads;            /* 6E  55 */
  441         USHORT CurrentSectorsPerTrack;          /* 70  56 */
  442         ULONG  CurrentSectorCapacity;           /* 72  57-58 */
  443         USHORT CurrentMultiSectorSetting;       /*     59 */
  444         ULONG  UserAddressableSectors;          /*     60-61 */
  445         USHORT SingleWordDMASupport : 8;        /*     62 */
  446         USHORT SingleWordDMAActive : 8;
  447         USHORT MultiWordDMASupport : 8;         /*     63 */
  448         USHORT MultiWordDMAActive : 8;
  449         USHORT AdvancedPIOModes : 8;            /*     64 */
  450         USHORT Reserved4 : 8;
  451         USHORT MinimumMWXferCycleTime;          /*     65 */
  452         USHORT RecommendedMWXferCycleTime;      /*     66 */
  453         USHORT MinimumPIOCycleTime;             /*     67 */
  454         USHORT MinimumPIOCycleTimeIORDY;        /*     68 */
  455         USHORT Reserved5[2];                    /*     69-70 */
  456         USHORT ReleaseTimeOverlapped;           /*     71 */
  457         USHORT ReleaseTimeServiceCommand;       /*     72 */
  458         USHORT MajorRevision;                   /*     73 */
  459         USHORT MinorRevision;                   /*     74 */
  460 /*    USHORT Reserved6[14];                   //     75-88 */
  461 } IDENTIFY_DATA2, *PIDENTIFY_DATA2;
  462 #endif
  463 
  464 /*
  465  * physical device information.
  466  * IdentifyData.ModelNumber[] is byte-swapped from the original identify data.
  467  */
  468 typedef struct _DEVICE_INFO {
  469         UCHAR   ControllerId;           /* controller id */
  470         UCHAR   PathId;                 /* bus */
  471         UCHAR   TargetId;               /* id */
  472         UCHAR   DeviceModeSetting;      /* Current Data Transfer mode: 0-4 PIO 0-4 */
  473                                                                         /* 5-7 MW DMA0-2, 8-13 UDMA0-5             */
  474         UCHAR   DeviceType;             /* device type */
  475         UCHAR   UsableMode;             /* highest usable mode */
  476         
  477         UCHAR   ReadAheadSupported: 1;
  478         UCHAR   ReadAheadEnabled: 1;
  479         UCHAR   WriteCacheSupported: 1;
  480         UCHAR   WriteCacheEnabled: 1;
  481         UCHAR   TCQSupported: 1;
  482         UCHAR   TCQEnabled: 1;
  483         UCHAR   NCQSupported: 1;
  484         UCHAR   NCQEnabled: 1;
  485         UCHAR   reserved;
  486 
  487         DWORD   Flags;                  /* working flags, see DEVICE_FLAG_XXX */
  488 
  489         IDENTIFY_DATA2 IdentifyData;    /* Identify Data of this device */
  490 
  491 } DEVICE_INFO, *PDEVICE_INFO;
  492 
  493 /*
  494  * HPT601 information
  495  */
  496 #define HPT601_INFO_DEVICEID      1
  497 #define HPT601_INFO_TEMPERATURE   2
  498 #define HPT601_INFO_FANSTATUS     4
  499 #define HPT601_INFO_BEEPERCONTROL 8
  500 #define HPT601_INFO_LED1CONTROL   0x10
  501 #define HPT601_INFO_LED2CONTROL   0x20
  502 #define HPT601_INFO_POWERSTATUS   0x40
  503 
  504 typedef struct _HPT601_INFO {
  505         WORD ValidFields;       /* mark valid fields below */
  506         WORD DeviceId;          /* 0x5A3E */
  507         WORD Temperature;       /* Read: temperature sensor value. Write: temperature limit */
  508         WORD FanStatus;         /* Fan status */
  509         WORD BeeperControl;     /* bit4: beeper control bit. bit0-3: frequency bits */
  510         WORD LED1Control;       /* bit4: twinkling control bit. bit0-3: frequency bits */
  511         WORD LED2Control;       /* bit4: twinkling control bit. bit0-3: frequency bits */
  512         WORD PowerStatus;       /* 1: has power 2: no power */
  513 } HPT601_INFO, *PHPT601_INFO;
  514 
  515 /*
  516  * Logical device information.
  517  * Union of ArrayInfo and DeviceInfo.
  518  * Common properties will be put in logical device information.
  519  */
  520 typedef struct _LOGICAL_DEVICE_INFO {
  521         UCHAR       Type;                   /* LDT_ARRAY or LDT_DEVICE */
  522         UCHAR       reserved[3];
  523 
  524         DWORD       Capacity;               /* array capacity */
  525         DEVICEID    ParentArray;
  526 
  527         union {
  528                 HPT_ARRAY_INFO array;
  529                 DEVICE_INFO device;
  530         } u;
  531 
  532 } LOGICAL_DEVICE_INFO, *PLOGICAL_DEVICE_INFO;
  533 
  534 #if HPT_INTERFACE_VERSION>=0x01010000
  535 typedef struct _LOGICAL_DEVICE_INFO_V2 {
  536         UCHAR       Type;                   /* LDT_ARRAY or LDT_DEVICE */
  537         UCHAR       reserved[3];
  538 
  539         LBA64       Capacity;           /* array capacity */
  540         DEVICEID    ParentArray;
  541 
  542         union {
  543                 HPT_ARRAY_INFO_V2 array;
  544                 DEVICE_INFO device;
  545         } u;
  546 
  547 } LOGICAL_DEVICE_INFO_V2, *PLOGICAL_DEVICE_INFO_V2;
  548 #endif
  549 
  550 /*
  551  * ALTERABLE_ARRAY_INFO and ALTERABLE_DEVICE_INFO, used in set_array_info()
  552  * and set_device_info().
  553  * When set_xxx_info() is called, the ValidFields member indicates which
  554  * fields in the structure are valid.
  555  */
  556 /* field masks */
  557 #define AAIF_NAME           1
  558 #define AAIF_DESCRIPTION    2
  559 #define ADIF_MODE           1
  560 #define ADIF_TCQ            2
  561 #define ADIF_NCQ            4
  562 #define ADIF_WRITE_CACHE    8
  563 #define ADIF_READ_AHEAD     0x10
  564 
  565 typedef struct _ALTERABLE_ARRAY_INFO {
  566         DWORD   ValidFields;                /* mark valid fields below */
  567         UCHAR   Name[MAX_ARRAYNAME_LEN];    /* array name */
  568         UCHAR   Description[64];            /* array description */
  569 }
  570 ALTERABLE_ARRAY_INFO, *PALTERABLE_ARRAY_INFO;
  571 
  572 typedef struct _ALTERABLE_DEVICE_INFO {
  573         DWORD   ValidFields;                /* mark valid fields below */
  574         UCHAR   DeviceModeSetting;          /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
  575 }
  576 ALTERABLE_DEVICE_INFO, *PALTERABLE_DEVICE_INFO;
  577 
  578 typedef struct _ALTERABLE_DEVICE_INFO_V2 {
  579         DWORD   ValidFields;                /* mark valid fields below */
  580         UCHAR   DeviceModeSetting;          /* 0-4 PIO 0-4, 5-7 MW DMA0-2, 8-13 UDMA0-5 */
  581         UCHAR   TCQEnabled;
  582         UCHAR   NCQEnabled;
  583         UCHAR   WriteCacheEnabled;
  584         UCHAR   ReadAheadEnabled;
  585         UCHAR   reserve[3];
  586         ULONG   reserve2[13]; /* pad to 64 bytes */
  587 }
  588 ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2;
  589 
  590 /*
  591  * CREATE_ARRAY_PARAMS
  592  *  Param structure used to create an array.
  593  */
  594 typedef struct _CREATE_ARRAY_PARAMS {
  595         UCHAR ArrayType;                    /* 1-level array type */
  596         UCHAR nDisk;                        /* number of elements in Members[] array */
  597         UCHAR BlockSizeShift;               /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
  598         UCHAR CreateFlags;                  /* See CAF_xxx */
  599 
  600         UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */
  601         UCHAR       Description[64];        /* array description */
  602         UCHAR       CreateManager[16];      /* who created it */
  603         TIME_RECORD CreateTime;             /* when created it */
  604 
  605         DWORD Members[MAX_ARRAY_MEMBERS_V1];/* ID of array members, a member can be an array */
  606 
  607 } CREATE_ARRAY_PARAMS, *PCREATE_ARRAY_PARAMS;
  608 
  609 #if HPT_INTERFACE_VERSION>=0x01010000
  610 typedef struct _CREATE_ARRAY_PARAMS_V2 {
  611         UCHAR ArrayType;                    /* 1-level array type */
  612         UCHAR nDisk;                        /* number of elements in Members[] array */
  613         UCHAR BlockSizeShift;               /* Stripe size if ArrayType==AT_RAID0 / AT_RAID5 */
  614         UCHAR CreateFlags;                  /* See CAF_xxx */
  615 
  616         UCHAR ArrayName[MAX_ARRAYNAME_LEN]; /* Array name */
  617         UCHAR       Description[64];        /* array description */
  618         UCHAR       CreateManager[16];      /* who created it */
  619         TIME_RECORD CreateTime;             /* when created it */
  620         LBA64 Capacity;                     /* specify array capacity (0 for default) */
  621 
  622         DWORD Members[MAX_ARRAY_MEMBERS_V2];/* ID of array members, a member can be an array */
  623 
  624 } CREATE_ARRAY_PARAMS_V2, *PCREATE_ARRAY_PARAMS_V2;
  625 #endif
  626 
  627 /*
  628  * Flags used for creating an RAID 1 array
  629  *
  630  * CAF_CREATE_AND_DUPLICATE
  631  *    Copy source disk contents to target for RAID 1. If user choose "create and duplicate"
  632  *    to create an array, GUI will call CreateArray() with this flag set. Then GUI should
  633  *    call hpt_get_device_info() with the returned array ID and check returned flags to
  634  *    see if ARRAY_FLAG_REBUILDING is set. If not set, driver does not support rebuilding
  635  *    and GUI must do duplication itself.
  636  * CAF_DUPLICATE_MUST_DONE
  637  *    If the duplication is aborted or fails, do not create the array.
  638  */
  639 #define CAF_CREATE_AND_DUPLICATE 1
  640 #define CAF_DUPLICATE_MUST_DONE  2
  641 #define CAF_CREATE_AS_RAID15     4
  642 /*
  643  * Flags used for creating an RAID 5 array
  644  */
  645 #define CAF_CREATE_R5_NO_BUILD     1
  646 #define CAF_CREATE_R5_ZERO_INIT    2
  647 #define CAF_CREATE_R5_BUILD_PARITY 4
  648 
  649 /*
  650  * Flags used for deleting an array
  651  *
  652  * DAF_KEEP_DATA_IF_POSSIBLE
  653  *    If this flag is set, deleting a RAID 1 array will not destroy the data on both disks.
  654  *    Deleting a JBOD should keep partitions on first disk ( not implement now ).
  655  *    Deleting a RAID 0/1 should result as two RAID 0 array ( not implement now ).
  656  */
  657 #define DAF_KEEP_DATA_IF_POSSIBLE 1
  658 
  659 /*
  660  * event types
  661  */
  662 #define ET_DEVICE_REMOVED   1   /* device removed */
  663 #define ET_DEVICE_PLUGGED   2   /* device plugged */
  664 #define ET_DEVICE_ERROR     3   /* device I/O error */
  665 #define ET_REBUILD_STARTED  4
  666 #define ET_REBUILD_ABORTED  5
  667 #define ET_REBUILD_FINISHED 6
  668 #define ET_SPARE_TOOK_OVER  7
  669 #define ET_REBUILD_FAILED   8
  670 #define ET_VERIFY_STARTED   9
  671 #define ET_VERIFY_ABORTED   10
  672 #define ET_VERIFY_FAILED    11
  673 #define ET_VERIFY_FINISHED  12
  674 #define ET_INITIALIZE_STARTED   13
  675 #define ET_INITIALIZE_ABORTED   14
  676 #define ET_INITIALIZE_FAILED    15
  677 #define ET_INITIALIZE_FINISHED  16
  678 #define ET_VERIFY_DATA_ERROR    17
  679 
  680 /*
  681  * event structure
  682  */
  683 typedef struct _HPT_EVENT {
  684         TIME_RECORD Time;
  685         DEVICEID    DeviceID;
  686         UCHAR       EventType;
  687         UCHAR       reserved[3];
  688 
  689         UCHAR       Data[32]; /* various data depend on EventType */
  690 } HPT_EVENT, *PHPT_EVENT;
  691 
  692 /*
  693  * IDE pass-through command. Use it at your own risk!
  694  */
  695 #ifdef _MSC_VER
  696 #pragma warning(disable:4200)
  697 #endif
  698 typedef struct _IDE_PASS_THROUGH_HEADER {
  699         DEVICEID idDisk;           /* disk ID */
  700         BYTE     bFeaturesReg;     /* feature register */
  701         BYTE     bSectorCountReg;  /* IDE sector count register. */
  702         BYTE     bLbaLowReg; /* IDE sector number register. */
  703         BYTE     bLbaMidReg;       /* IDE low order cylinder value. */
  704         BYTE     bLbaHighReg;      /* IDE high order cylinder value. */
  705         BYTE     bDriveHeadReg;    /* IDE drive/head register. */
  706         BYTE     bCommandReg;      /* Actual IDE command. Checked for validity by driver. */
  707         BYTE     nSectors;              /* data sze in sectors, if the command has data transfer */
  708         BYTE     protocol;            /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */
  709         BYTE     reserve[3];
  710 #define IDE_PASS_THROUGH_buffer(p) ((unsigned char *)(p) + sizeof(IDE_PASS_THROUGH_HEADER))     
  711 }
  712 IDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER;
  713 
  714 /*
  715  * device io packet format
  716  */
  717 typedef struct _DEVICE_IO_EX_PARAMS {
  718         DEVICEID idDisk;
  719         ULONG    Lba;
  720         USHORT   nSectors;
  721         UCHAR    Command; /* IO_COMMAD_xxx */
  722         UCHAR    BufferType; /* BUFFER_TYPE_xxx, see below */
  723         ULONG    BufferPtr;
  724 }
  725 DEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS;
  726 
  727 #define BUFFER_TYPE_LOGICAL              1 /* logical pointer to buffer */
  728 #define BUFFER_TYPE_PHYSICAL             2 /* physical address of buffer */
  729 #define BUFFER_TYPE_LOGICAL_LOGICAL_SG   3 /* logical pointer to logical S/G table */
  730 #define BUFFER_TYPE_LOGICAL_PHYSICAL_SG  4 /* logical pointer to physical S/G table */
  731 #define BUFFER_TYPE_PHYSICAL_LOGICAL_SG  5 /* physical address to logical S/G table */
  732 #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG 6 /* physical address of physical S/G table */
  733 #define BUFFER_TYPE_PHYSICAL_PHYSICAL_SG_PIO 7 /* non DMA capable physical address of physical S/G table */
  734 
  735 /*
  736  * all ioctl functions should use far pointers. It's not a problem on
  737  * 32bit platforms, however, BIOS needs care.
  738  */
  739 
  740 /*
  741  * ioctl structure
  742  */
  743 #define HPT_IOCTL_MAGIC32 0x1A2B3C4D
  744 #define HPT_IOCTL_MAGIC   0xA1B2C3D4
  745 
  746 typedef struct _HPT_IOCTL_PARAM {
  747         DWORD   Magic;                 /* used to check if it's a valid ioctl packet */
  748         DWORD   dwIoControlCode;       /* operation control code */
  749         LPVOID  lpInBuffer;            /* input data buffer */
  750         DWORD   nInBufferSize;         /* size of input data buffer */
  751         LPVOID  lpOutBuffer;           /* output data buffer */
  752         DWORD   nOutBufferSize;        /* size of output data buffer */
  753         LPDWORD lpBytesReturned;       /* count of bytes returned */
  754 }
  755 HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM;
  756 
  757 /* for 32-bit app running on 64-bit system */
  758 typedef struct _HPT_IOCTL_PARAM32 {
  759         DWORD   Magic;
  760         DWORD   dwIoControlCode;
  761         DWORD   lpInBuffer;
  762         DWORD   nInBufferSize;
  763         DWORD   lpOutBuffer;
  764         DWORD   nOutBufferSize;
  765         DWORD   lpBytesReturned;
  766 }
  767 HPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32;
  768 
  769 /*
  770  * User-mode ioctl parameter passing conventions:
  771  *   The ioctl function implementation is platform specific, so we don't
  772  * have forced rules for it. However, it's suggested to use a parameter
  773  * passing method as below
  774  *   1) Put all input data continuously in an input buffer.
  775  *   2) Prepare an output buffer with enough size if needed.
  776  *   3) Fill a HPT_IOCTL_PARAM structure.
  777  *   4) Pass the structure to driver through a platform-specific method.
  778  * This is implemented in the mid-layer user-mode library. The UI
  779  * programmer needn't care about it.
  780  */
  781 
  782 /************************************************************************
  783  * User mode functions
  784  ************************************************************************/
  785 #ifndef __KERNEL__
  786 /*
  787  * hpt_get_version
  788  * Version compatibility: all versions
  789  * Parameters:
  790  *  None
  791  * Returns:
  792  *  interface version. 0 when fail.
  793  */
  794 DWORD hpt_get_version();
  795 
  796 /*-------------------------------------------------------------------------- */
  797 
  798 /*
  799  * hpt_get_driver_capabilities
  800  * Version compatibility: v1.0.0.2 or later
  801  * Parameters:
  802  *  Pointer to receive a DRIVE_CAPABILITIES structure. The caller must set
  803  *  dwSize member to sizeof(DRIVER_CAPABILITIES). The callee must check this
  804  *  member to see if it's correct.
  805  * Returns:
  806  *  0 - Success
  807  */
  808 int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap);
  809 
  810 /*-------------------------------------------------------------------------- */
  811 
  812 /*
  813  * hpt_get_controller_count
  814  * Version compatibility: v1.0.0.1 or later
  815  * Parameters:
  816  *  None
  817  * Returns:
  818  *  number of controllers
  819  */
  820 int hpt_get_controller_count();
  821 
  822 /*-------------------------------------------------------------------------- */
  823 
  824 /* hpt_get_controller_info
  825  * Version compatibility: v1.0.0.1 or later
  826  * Parameters:
  827  *  id      Controller id
  828  *  pInfo   pointer to CONTROLLER_INFO buffer
  829  * Returns:
  830  *  0       Success, controller info is put into (*pInfo ).
  831  */
  832 int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo);
  833 
  834 /*-------------------------------------------------------------------------- */
  835 
  836 /* hpt_get_channel_info
  837  * Version compatibility: v1.0.0.1 or later
  838  * Parameters:
  839  *  id      Controller id
  840  *  bus     bus number
  841  *  pInfo   pointer to CHANNEL_INFO buffer
  842  * Returns:
  843  *  0       Success, channel info is put into (*pInfo ).
  844  */
  845 int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo);
  846 
  847 /*-------------------------------------------------------------------------- */
  848 
  849 /* hpt_get_logical_devices
  850  * Version compatibility: v1.0.0.1 or later
  851  * Parameters:
  852  *  pIds        pointer to a DEVICEID array
  853  *  nMaxCount   array size
  854  * Returns:
  855  *  Number of ID returned. All logical device IDs are put into pIds array.
  856  *  Note: A spare disk is not a logical device.
  857  */
  858 int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount);
  859 
  860 /*-------------------------------------------------------------------------- */
  861 
  862 /* hpt_get_device_info
  863  * Version compatibility: v1.0.0.1 or later
  864  * Parameters:
  865  *  id      logical device id
  866  *  pInfo   pointer to HPT_ARRAY_INFO structure
  867  * Returns:
  868  *  0 - Success
  869  */
  870 int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo);
  871 
  872 #if HPT_INTERFACE_VERSION>=0x01010000
  873 int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo);
  874 #endif
  875 
  876 /*-------------------------------------------------------------------------- */
  877 
  878 /* hpt_create_array
  879  * Version compatibility: v1.0.0.1 or later
  880  * Parameters:
  881  *  pParam      pointer to CREATE_ARRAY_PARAMS structure
  882  * Returns:
  883  *  0   failed
  884  *  else return array id
  885  */
  886 DEVICEID hpt_create_array(PCREATE_ARRAY_PARAMS pParam);
  887 
  888 #if HPT_INTERFACE_VERSION>=0x01010000
  889 DEVICEID hpt_create_array_v2(PCREATE_ARRAY_PARAMS_V2 pParam);
  890 #endif
  891 
  892 /*-------------------------------------------------------------------------- */
  893 
  894 /* hpt_delete_array
  895  * Version compatibility: v1.0.0.1 or later
  896  * Parameters:
  897  *  id      array id
  898  * Returns:
  899  *  0   Success
  900  */
  901 int hpt_delete_array(DEVICEID id, DWORD options);
  902 
  903 /*-------------------------------------------------------------------------- */
  904 
  905 /* hpt_device_io
  906  *  Read/write data on array and physcal device.
  907  * Version compatibility: v1.0.0.1 or later
  908  * Parameters:
  909  *  id      device id. If it's an array ID, IO will be performed on the array.
  910  *          If it's a physical device ID, IO will be performed on the device.
  911  *  cmd     IO_COMMAND_READ or IO_COMMAND_WRITE
  912  *  buffer  data buffer
  913  *  length  data size
  914  * Returns:
  915  *  0   Success
  916  */
  917 int hpt_device_io(DEVICEID id, int cmd, ULONG lba, DWORD nSector, LPVOID buffer);
  918 
  919 #if HPT_INTERFACE_VERSION >= 0x01010000
  920 int hpt_device_io_v2(DEVICEID id, int cmd, LBA64 lba, DWORD nSector, LPVOID buffer);
  921 #endif
  922 
  923 /* hpt_add_disk_to_array
  924  *   Used to dynamicly add a disk to an RAID1, RAID0/1, RAID1/0 or RAID5 array.
  925  *   Auto-rebuild will start.
  926  * Version compatibility: v1.0.0.1 or later
  927  * Parameters:
  928  *  idArray     array id
  929  *  idDisk      disk id
  930  * Returns:
  931  *  0   Success
  932  */
  933 int hpt_add_disk_to_array(DEVICEID idArray, DEVICEID idDisk);
  934 /*-------------------------------------------------------------------------- */
  935 
  936 /* hpt_add_spare_disk
  937  * Version compatibility: v1.0.0.1 or later
  938  *   Add a disk to spare pool.
  939  * Parameters:
  940  *  idDisk      disk id
  941  * Returns:
  942  *  0   Success
  943  */
  944 int hpt_add_spare_disk(DEVICEID idDisk);
  945 /*-------------------------------------------------------------------------- */
  946 
  947 /* hpt_add_dedicated_spare
  948  * Version compatibility: v1.0.0.3 or later
  949  *   Add a spare disk to an array
  950  * Parameters:
  951  *  idDisk      disk id
  952  *  idArray     array id
  953  * Returns:
  954  *  0   Success
  955  */
  956 int hpt_add_dedicated_spare(DEVICEID idDisk, DEVICEID idArray);
  957 /*-------------------------------------------------------------------------- */
  958 
  959 /* hpt_remove_spare_disk
  960  *   remove a disk from spare pool.
  961  * Version compatibility: v1.0.0.1 or later
  962  * Parameters:
  963  *  idDisk      disk id
  964  * Returns:
  965  *  0   Success
  966  */
  967 int hpt_remove_spare_disk(DEVICEID idDisk);
  968 /*-------------------------------------------------------------------------- */
  969 
  970 /* hpt_get_event
  971  *   Used to poll events from driver.
  972  * Version compatibility: v1.0.0.1 or later
  973  * Parameters:
  974  *   pEvent    pointer to HPT_EVENT structure
  975  * Returns:
  976  *  0   Success, event info is filled in *pEvent
  977  */
  978 int hpt_get_event(PHPT_EVENT pEvent);
  979 /*-------------------------------------------------------------------------- */
  980 
  981 /* hpt_rebuild_data_block
  982  *   Used to copy data from source disk and mirror disk.
  983  * Version compatibility: v1.0.0.1 or later
  984  * Parameters:
  985  *   idArray        Array ID (RAID1, 0/1 or RAID5)
  986  *   Lba            Start LBA for each array member
  987  *   nSector        Number of sectors for each array member (RAID 5 will ignore this parameter)
  988  *
  989  * Returns:
  990  *  0   Success, event info is filled in *pEvent
  991  */
  992 int hpt_rebuild_data_block(DEVICEID idMirror, DWORD Lba, UCHAR nSector);
  993 #define hpt_rebuild_mirror(p1, p2, p3) hpt_rebuild_data_block(p1, p2, p3)
  994 
  995 #if HPT_INTERFACE_VERSION >= 0x01010000
  996 int hpt_rebuild_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSector);
  997 #endif
  998 /*-------------------------------------------------------------------------- */
  999 
 1000 /* hpt_set_array_state
 1001  *   set array state.
 1002  * Version compatibility: v1.0.0.1 or later
 1003  * Parameters:
 1004  *   idArray        Array ID
 1005  *   state          See above 'array states' constants, possible values are:
 1006  *     MIRROR_REBUILD_START
 1007  *        Indicate that GUI wants to rebuild a mirror array
 1008  *     MIRROR_REBUILD_ABORT
 1009  *        GUI wants to abort rebuilding an array
 1010  *     MIRROR_REBUILD_COMPLETE
 1011  *        GUI finished to rebuild an array. If rebuild is done by driver this
 1012  *        state has no use
 1013  *
 1014  * Returns:
 1015  *  0   Success
 1016  */
 1017 int hpt_set_array_state(DEVICEID idArray, DWORD state);
 1018 /*-------------------------------------------------------------------------- */
 1019 
 1020 /* hpt_set_array_info
 1021  *   set array info.
 1022  * Version compatibility: v1.0.0.1 or later
 1023  * Parameters:
 1024  *   idArray        Array ID
 1025  *   pInfo          pointer to new info
 1026  *
 1027  * Returns:
 1028  *  0   Success
 1029  */
 1030 int hpt_set_array_info(DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo);
 1031 /*-------------------------------------------------------------------------- */
 1032 
 1033 /* hpt_set_device_info
 1034  *   set device info.
 1035  * Version compatibility: v1.0.0.1 or later
 1036  * Parameters:
 1037  *   idDisk         device ID
 1038  *   pInfo          pointer to new info
 1039  *
 1040  * Returns:
 1041  *  0   Success
 1042  * Additional notes:
 1043  *  If idDisk==0, call to this function will stop buzzer on the adapter
 1044  *  (if supported by driver).
 1045  */
 1046 int hpt_set_device_info(DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo);
 1047 
 1048 #if HPT_INTERFACE_VERSION >= 0x01000004
 1049 int hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo);
 1050 #endif
 1051 
 1052 /*-------------------------------------------------------------------------- */
 1053 
 1054 /* hpt_rescan_devices
 1055  *   rescan devices
 1056  * Version compatibility: v1.0.0.1 or later
 1057  * Parameters:
 1058  *   None
 1059  * Returns:
 1060  *   0  Success
 1061  */
 1062 int hpt_rescan_devices();
 1063 /*-------------------------------------------------------------------------- */
 1064 
 1065 /* hpt_get_601_info
 1066  *   Get HPT601 status
 1067  * Version compatibiilty: v1.0.0.3 or later
 1068  * Parameters:
 1069  *   idDisk - Disk handle
 1070  *   PHPT601_INFO - pointer to HPT601 info buffer
 1071  * Returns:
 1072  *   0  Success
 1073  */
 1074 int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
 1075 /*-------------------------------------------------------------------------- */
 1076 
 1077 /* hpt_set_601_info
 1078  *   HPT601 function control
 1079  * Version compatibiilty: v1.0.0.3 or later
 1080  * Parameters:
 1081  *   idDisk - Disk handle
 1082  *   PHPT601_INFO - pointer to HPT601 info buffer
 1083  * Returns:
 1084  *   0  Success
 1085  */
 1086 int hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo);
 1087 /*-------------------------------------------------------------------------- */
 1088 
 1089 /* hpt_lock_device
 1090  *   Lock a block on a device (prevent OS accessing it)
 1091  * Version compatibiilty: v1.0.0.3 or later
 1092  * Parameters:
 1093  *   idDisk - Disk handle
 1094  *   Lba - Start LBA
 1095  *   nSectors - number of sectors
 1096  * Returns:
 1097  *   0  Success
 1098  */
 1099 int hpt_lock_device(DEVICEID idDisk, ULONG Lba, UCHAR nSectors);
 1100 
 1101 #if HPT_INTERFACE_VERSION >= 0x01010000
 1102 int hpt_lock_device_v2(DEVICEID idDisk, LBA64 Lba, USHORT nSectors);
 1103 #endif
 1104 /*-------------------------------------------------------------------------- */
 1105 
 1106 /* hpt_lock_device
 1107  *   Unlock a device
 1108  * Version compatibiilty: v1.0.0.3 or later
 1109  * Parameters:
 1110  *   idDisk - Disk handle
 1111  * Returns:
 1112  *   0  Success
 1113  */
 1114 int hpt_unlock_device(DEVICEID idDisk);
 1115 /*-------------------------------------------------------------------------- */
 1116 
 1117 /* hpt_ide_pass_through
 1118  *  directly access controller's command and control registers.
 1119  *  Can only call it on physical devices.
 1120  * Version compatibility: v1.0.0.3 or later
 1121  * Parameters:
 1122  *   p - IDE_PASS_THROUGH header pointer
 1123  * Returns:
 1124  *   0  Success
 1125  */
 1126 int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
 1127 /*-------------------------------------------------------------------------- */
 1128 
 1129 /* hpt_verify_data_block
 1130  *   verify data block on RAID1 or RAID5.
 1131  * Version compatibility: v1.0.0.3 or later
 1132  * Parameters:
 1133  *   idArray - Array ID
 1134  *   Lba - block number (on each array member, not logical block!)
 1135  *   nSectors - Sectors for each member (RAID 5 will ignore this parameter)
 1136  * Returns:
 1137  *   0  Success
 1138  *   1  Data compare error
 1139  *   2  I/O error
 1140  */
 1141 int hpt_verify_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors);
 1142 
 1143 #if HPT_INTERFACE_VERSION >= 0x01010000
 1144 int hpt_verify_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors);
 1145 #endif
 1146 /*-------------------------------------------------------------------------- */
 1147 
 1148 /* hpt_initialize_data_block
 1149  *   initialize data block (fill with zero) on RAID5
 1150  * Version compatibility: v1.0.0.3 or later
 1151  * Parameters:
 1152  *   idArray - Array ID
 1153  *   Lba - block number (on each array member, not logical block!)
 1154  *   nSectors - Sectors for each member (RAID 5 will ignore this parameter)
 1155  * Returns:
 1156  *   0  Success
 1157  */
 1158 int hpt_initialize_data_block(DEVICEID idArray, ULONG Lba, UCHAR nSectors);
 1159 
 1160 #if HPT_INTERFACE_VERSION >= 0x01010000
 1161 int hpt_initialize_data_block_v2(DEVICEID idArray, LBA64 Lba, USHORT nSectors);
 1162 #endif
 1163 /*-------------------------------------------------------------------------- */
 1164 
 1165 /* hpt_device_io_ex
 1166  *   extended device I/O function
 1167  * Version compatibility: v1.0.0.3 or later
 1168  * Parameters:
 1169  *   idArray - Array ID
 1170  *   Lba - block number (on each array member, not logical block!)
 1171  *   nSectors - Sectors for each member
 1172  *   buffer - I/O buffer or s/g address
 1173  * Returns:
 1174  *   0  Success
 1175  */
 1176 int hpt_device_io_ex(PDEVICE_IO_EX_PARAMS param);
 1177 #if HPT_INTERFACE_VERSION >= 0x01010000
 1178 int hpt_device_io_ex_v2(void * param); /* NOT IMPLEMENTED */
 1179 #endif
 1180 /*-------------------------------------------------------------------------- */
 1181 
 1182 /* hpt_set_boot_mark
 1183  *   select boot device
 1184  * Version compatibility: v1.0.0.3 or later
 1185  * Parameters:
 1186  *   id - logical device ID. If id is 0 the boot mark will be removed.
 1187  * Returns:
 1188  *   0  Success
 1189  */
 1190 int hpt_set_boot_mark(DEVICEID id);
 1191 /*-------------------------------------------------------------------------- */
 1192 
 1193 /* hpt_query_remove
 1194  *  check if device can be removed safely
 1195  * Version compatibility: v1.0.0.4 or later
 1196  * Parameters:
 1197  *  ndev - number of devices
 1198  *  pIds - device ID list
 1199  * Returns:
 1200  *  0  - Success
 1201  *  -1 - unknown error
 1202  *  n  - the n-th device that can't be removed
 1203  */
 1204 int hpt_query_remove(DWORD ndev, DEVICEID *pIds);
 1205 /*-------------------------------------------------------------------------- */
 1206 
 1207 /* hpt_remove_devices
 1208  *  remove a list of devices
 1209  * Version compatibility: v1.0.0.4 or later
 1210  * Parameters:
 1211  *  ndev - number of devices
 1212  *  pIds - device ID list
 1213  * Returns:
 1214  *  0  - Success
 1215  *  -1 - unknown error
 1216  *  n  - the n-th device that can't be removed
 1217  */
 1218 int hpt_remove_devices(DWORD ndev, DEVICEID *pIds);
 1219 /*-------------------------------------------------------------------------- */
 1220 
 1221 /* hpt_ide_pass_through
 1222  *  directly access controller's command and control registers.
 1223  *  Can only call it on physical devices.
 1224  * Version compatibility: v1.0.0.3 or later
 1225  * Parameters:
 1226  *   p - IDE_PASS_THROUGH header pointer
 1227  * Returns:
 1228  *   0  Success
 1229  */
 1230 int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
 1231 /*-------------------------------------------------------------------------- */
 1232 
 1233 #endif
 1234 
 1235 #pragma pack()
 1236 #endif

Cache object: 26ddb96fb062551b50179ac5278c44df


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.