smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
os_freebsd.h
Go to the documentation of this file.
00001 /*
00002  * os_freebsd.h
00003  *
00004  * Home page of code is: http://smartmontools.sourceforge.net
00005  *
00006  * Copyright (C) 2003-8 Eduard Martinescu <smartmontools-support@lists.sourceforge.net>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2, or (at your option)
00011  * any later version.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * (for example COPYING); if not, write to the Free Software Foundation,
00015  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  *
00017  * This code was originally developed as a Senior Thesis by Michael Cornwell
00018  * at the Concurrent Systems Laboratory (now part of the Storage Systems
00019  * Research Center), Jack Baskin School of Engineering, University of
00020  * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
00021  *
00022  */
00023 
00024 /*-
00025  * Copyright (c) 2000 Michael Smith
00026  * Copyright (c) 2003 Paul Saab
00027  * Copyright (c) 2003 Vinod Kashyap
00028  * Copyright (c) 2000 BSDi
00029  * All rights reserved.
00030  *
00031  * Redistribution and use in source and binary forms, with or without
00032  * modification, are permitted provided that the following conditions
00033  * are met:
00034  * 1. Redistributions of source code must retain the above copyright
00035  *    notice, this list of conditions and the following disclaimer.
00036  * 2. Redistributions in binary form must reproduce the above copyright
00037  *    notice, this list of conditions and the following disclaimer in the
00038  *    documentation and/or other materials provided with the distribution.
00039  *
00040  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00041  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00042  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00043  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00044  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00045  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00046  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00047  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00048  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00049  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00050  * SUCH DAMAGE.
00051  *
00052  */
00053 
00054 /*
00055  * Copyright (c) 2004-05 Applied Micro Circuits Corporation.
00056  * Copyright (c) 2004-05 Vinod Kashyap
00057  * All rights reserved.
00058  *
00059  * Redistribution and use in source and binary forms, with or without
00060  * modification, are permitted provided that the following conditions
00061  * are met:
00062  * 1. Redistributions of source code must retain the above copyright
00063  *    notice, this list of conditions and the following disclaimer.
00064  * 2. Redistributions in binary form must reproduce the above copyright
00065  *    notice, this list of conditions and the following disclaimer in the
00066  *    documentation and/or other materials provided with the distribution.
00067  *
00068  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00069  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00070  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00071  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00072  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00073  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00074  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00075  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00076  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00077  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00078  * SUCH DAMAGE.
00079  *
00080  */
00081 
00082 #ifndef OS_FREEBSD_H_
00083 #define OS_FREEBSD_H_
00084 
00085 #define OS_FREEBSD_H_CVSID "$Id: os_freebsd.h 3727 2012-12-13 17:23:06Z samm2 $"
00086 
00087 #define MAX_NUM_DEV 26
00088 
00089 #ifdef  HAVE_SYS_TWEREG_H
00090 #include <sys/twereg.h>
00091 #else
00092 /**
00093  *  The following cut out of twereg.h
00094  *
00095  */
00096 #if __FreeBSD_version < 500040
00097 #define __packed __attribute__((__packed__))
00098 #endif
00099 
00100 #define TWE_MAX_SGL_LENGTH              62
00101 #define TWE_MAX_ATA_SGL_LENGTH          60
00102 #define TWE_OP_ATA_PASSTHROUGH          0x11
00103 
00104 /* scatter/gather list entry */
00105 typedef struct
00106 {
00107     u_int32_t   address;
00108     u_int32_t   length;
00109 } __packed TWE_SG_Entry;
00110 
00111 typedef struct {
00112     u_int8_t    opcode:5;               /* TWE_OP_INITCONNECTION */
00113     u_int8_t    res1:3;         
00114     u_int8_t    size;
00115     u_int8_t    request_id;
00116     u_int8_t    res2:4;
00117     u_int8_t    host_id:4;
00118     u_int8_t    status;
00119     u_int8_t    flags;
00120     u_int16_t   message_credits;
00121     u_int32_t   response_queue_pointer;
00122 } __packed TWE_Command_INITCONNECTION;
00123 
00124 typedef struct
00125 {
00126     u_int8_t    opcode:5;               /* TWE_OP_READ/TWE_OP_WRITE */
00127     u_int8_t    res1:3;
00128     u_int8_t    size;
00129     u_int8_t    request_id;
00130     u_int8_t    unit:4;
00131     u_int8_t    host_id:4;
00132     u_int8_t    status;
00133     u_int8_t    flags;
00134     u_int16_t   block_count;
00135     u_int32_t   lba;
00136     TWE_SG_Entry sgl[TWE_MAX_SGL_LENGTH];
00137 } __packed TWE_Command_IO;
00138 
00139 typedef struct
00140 {
00141     u_int8_t    opcode:5;               /* TWE_OP_HOTSWAP */
00142     u_int8_t    res1:3;
00143     u_int8_t    size;
00144     u_int8_t    request_id;
00145     u_int8_t    unit:4;
00146     u_int8_t    host_id:4;
00147     u_int8_t    status;
00148     u_int8_t    flags;
00149     u_int8_t    action;
00150 #define TWE_OP_HOTSWAP_REMOVE           0x00    /* remove assumed-degraded unit */
00151 #define TWE_OP_HOTSWAP_ADD_CBOD         0x01    /* add CBOD to empty port */
00152 #define TWE_OP_HOTSWAP_ADD_SPARE        0x02    /* add spare to empty port */
00153     u_int8_t    aport;
00154 } __packed TWE_Command_HOTSWAP;
00155 
00156 typedef struct
00157 {
00158     u_int8_t    opcode:5;               /* TWE_OP_SETATAFEATURE */
00159     u_int8_t    res1:3;
00160     u_int8_t    size;
00161     u_int8_t    request_id;
00162     u_int8_t    unit:4;
00163     u_int8_t    host_id:4;
00164     u_int8_t    status;
00165     u_int8_t    flags;
00166     u_int8_t    feature;
00167 #define TWE_OP_SETATAFEATURE_WCE        0x02
00168 #define TWE_OP_SETATAFEATURE_DIS_WCE    0x82
00169     u_int8_t    feature_mode;
00170     u_int16_t   all_units;
00171     u_int16_t   persistence;
00172 } __packed TWE_Command_SETATAFEATURE;
00173 
00174 typedef struct
00175 {
00176     u_int8_t    opcode:5;               /* TWE_OP_CHECKSTATUS */
00177     u_int8_t    res1:3;
00178     u_int8_t    size;
00179     u_int8_t    request_id;
00180     u_int8_t    unit:4;
00181     u_int8_t    res2:4;
00182     u_int8_t    status;
00183     u_int8_t    flags;
00184     u_int16_t   target_status;          /* set low byte to target request's ID */
00185 } __packed TWE_Command_CHECKSTATUS;
00186 
00187 typedef struct
00188 {
00189     u_int8_t    opcode:5;               /* TWE_OP_GETPARAM, TWE_OP_SETPARAM */
00190     u_int8_t    res1:3;
00191     u_int8_t    size;
00192     u_int8_t    request_id;
00193     u_int8_t    unit:4;
00194     u_int8_t    host_id:4;
00195     u_int8_t    status;
00196     u_int8_t    flags;
00197     u_int16_t   param_count;
00198     TWE_SG_Entry sgl[TWE_MAX_SGL_LENGTH];
00199 } __packed TWE_Command_PARAM;
00200 
00201 typedef struct
00202 {
00203     u_int8_t    opcode:5;               /* TWE_OP_REBUILDUNIT */
00204     u_int8_t    res1:3;
00205     u_int8_t    size;
00206     u_int8_t    request_id;
00207     u_int8_t    src_unit:4;
00208     u_int8_t    host_id:4;
00209     u_int8_t    status;
00210     u_int8_t    flags;
00211     u_int8_t    action:7;
00212 #define TWE_OP_REBUILDUNIT_NOP          0
00213 #define TWE_OP_REBUILDUNIT_STOP         2       /* stop all rebuilds */
00214 #define TWE_OP_REBUILDUNIT_START        4       /* start rebuild with lowest unit */
00215 #define TWE_OP_REBUILDUNIT_STARTUNIT    5       /* rebuild src_unit (not supported) */
00216     u_int8_t    cs:1;                           /* request state change on src_unit */
00217     u_int8_t    logical_subunit;                /* for RAID10 rebuild of logical subunit */
00218 } __packed TWE_Command_REBUILDUNIT;
00219 
00220 typedef struct
00221 {
00222     u_int8_t    opcode:5;
00223     u_int8_t    sgl_offset:3;
00224     u_int8_t    size;
00225     u_int8_t    request_id;
00226     u_int8_t    unit;
00227     u_int8_t    status;
00228     u_int8_t    flags;
00229     u_int16_t   param;
00230     u_int16_t   features;
00231     u_int16_t   sector_count;
00232     u_int16_t   sector_num;
00233     u_int16_t   cylinder_lo;
00234     u_int16_t   cylinder_hi;
00235     u_int8_t    drive_head;
00236     u_int8_t    command;
00237     TWE_SG_Entry sgl[TWE_MAX_ATA_SGL_LENGTH];
00238 } __packed TWE_Command_ATA;
00239 
00240 typedef struct
00241 {
00242     u_int8_t    opcode:5;
00243     u_int8_t    sgl_offset:3;
00244     u_int8_t    size;
00245     u_int8_t    request_id;
00246     u_int8_t    unit:4;
00247     u_int8_t    host_id:4;
00248     u_int8_t    status;
00249     u_int8_t    flags;
00250 #define TWE_FLAGS_SUCCESS       0x00
00251 #define TWE_FLAGS_INFORMATIONAL 0x01
00252 #define TWE_FLAGS_WARNING       0x02
00253 #define TWE_FLAGS_FATAL         0x03
00254 #define TWE_FLAGS_PERCENTAGE    (1<<8)  /* bits 0-6 indicate completion percentage */
00255     u_int16_t   count;                  /* block count, parameter count, message credits */
00256 } __packed TWE_Command_Generic;
00257 
00258 /* command packet - must be TWE_ALIGNMENT aligned */
00259 typedef union
00260 {
00261     TWE_Command_INITCONNECTION  initconnection;
00262     TWE_Command_IO              io;
00263     TWE_Command_PARAM           param;
00264     TWE_Command_CHECKSTATUS     checkstatus;
00265     TWE_Command_REBUILDUNIT     rebuildunit;
00266     TWE_Command_SETATAFEATURE   setatafeature;
00267     TWE_Command_ATA             ata;
00268     TWE_Command_Generic         generic;
00269     u_int8_t                    pad[512];
00270 } TWE_Command;
00271 
00272 /* response queue entry */
00273 typedef union
00274 {
00275     struct 
00276     {
00277         u_int32_t       undefined_1:4;
00278         u_int32_t       response_id:8;
00279         u_int32_t       undefined_2:20;
00280     } u;
00281     u_int32_t   value;
00282 } TWE_Response_Queue;
00283 
00284 #endif
00285 
00286 #ifdef  HAVE_SYS_TWEIO_H
00287 #include <sys/tweio.h>
00288 #else
00289 /*
00290  * Following cut out of tweio.h
00291  *
00292  */
00293 /*
00294  * User-space command
00295  *
00296  * Note that the command's scatter/gather list will be computed by the
00297  * driver, and cannot be filled in by the consumer.
00298  */
00299 struct twe_usercommand {
00300     TWE_Command tu_command;     /* command ready for the controller */
00301     void        *tu_data;       /* pointer to data in userspace */
00302     size_t      tu_size;        /* userspace data length */
00303 };
00304 
00305 #define TWEIO_COMMAND           _IOWR('T', 100, struct twe_usercommand)
00306 
00307 #endif
00308 
00309 #ifdef  HAVE_SYS_TW_OSL_IOCTL_H
00310 #include <sys/tw_osl_ioctl.h>
00311 #else
00312 /*
00313  * Following cut out of tw_osl_types.h
00314  *
00315  */
00316 
00317 typedef void                    TW_VOID;
00318 typedef char                    TW_INT8;
00319 typedef unsigned char           TW_UINT8;
00320 typedef short                   TW_INT16;
00321 typedef unsigned short          TW_UINT16;
00322 typedef int                     TW_INT32;
00323 typedef unsigned int            TW_UINT32;
00324 typedef long long               TW_INT64;
00325 typedef unsigned long long      TW_UINT64;
00326 
00327 /*
00328  * Following cut out of tw_cl_share.h
00329  *
00330  */
00331 
00332 #pragma pack(1)
00333 
00334 struct tw_cl_event_packet {
00335         TW_UINT32       sequence_id;
00336         TW_UINT32       time_stamp_sec;
00337         TW_UINT16       aen_code;
00338         TW_UINT8        severity;
00339         TW_UINT8        retrieved;
00340         TW_UINT8        repeat_count;
00341         TW_UINT8        parameter_len;
00342         TW_UINT8        parameter_data[98];
00343         TW_UINT32       event_src;
00344         TW_UINT8        severity_str[20];
00345 };
00346 
00347 #pragma pack()
00348 
00349 /*
00350  * Following cut out of tw_cl_fwif.h
00351  *
00352  */
00353 
00354 #define TWA_FW_CMD_ATA_PASSTHROUGH              0x11
00355 
00356 #define TWA_SENSE_DATA_LENGTH           18
00357 
00358 #pragma pack(1)
00359 /* 7000 structures. */
00360 struct tw_cl_command_init_connect {
00361         TW_UINT8        res1__opcode;   /* 3:5 */
00362         TW_UINT8        size;
00363         TW_UINT8        request_id;
00364         TW_UINT8        res2;
00365         TW_UINT8        status;
00366         TW_UINT8        flags;
00367         TW_UINT16       message_credits;
00368         TW_UINT32       features;
00369         TW_UINT16       fw_srl;
00370         TW_UINT16       fw_arch_id;
00371         TW_UINT16       fw_branch;
00372         TW_UINT16       fw_build;
00373         TW_UINT32       result;
00374 };
00375 
00376 
00377 /* Structure for downloading firmware onto the controller. */
00378 struct tw_cl_command_download_firmware {
00379         TW_UINT8        sgl_off__opcode;/* 3:5 */
00380         TW_UINT8        size;
00381         TW_UINT8        request_id;
00382         TW_UINT8        unit;
00383         TW_UINT8        status;
00384         TW_UINT8        flags;
00385         TW_UINT16       param;
00386         TW_UINT8        sgl[1];
00387 };
00388 
00389 
00390 /* Structure for hard resetting the controller. */
00391 struct tw_cl_command_reset_firmware {
00392         TW_UINT8        res1__opcode;   /* 3:5 */
00393         TW_UINT8        size;
00394         TW_UINT8        request_id;
00395         TW_UINT8        unit;
00396         TW_UINT8        status;
00397         TW_UINT8        flags;
00398         TW_UINT8        res2;
00399         TW_UINT8        param;
00400 };
00401 
00402 
00403 /* Structure for sending get/set param commands. */
00404 struct tw_cl_command_param {
00405         TW_UINT8        sgl_off__opcode;/* 3:5 */
00406         TW_UINT8        size;
00407         TW_UINT8        request_id;
00408         TW_UINT8        host_id__unit;  /* 4:4 */
00409         TW_UINT8        status;
00410         TW_UINT8        flags;
00411         TW_UINT16       param_count;
00412         TW_UINT8        sgl[1];
00413 };
00414 
00415 
00416 /* Generic command packet. */
00417 struct tw_cl_command_generic {
00418         TW_UINT8        sgl_off__opcode;/* 3:5 */
00419         TW_UINT8        size;
00420         TW_UINT8        request_id;
00421         TW_UINT8        host_id__unit;  /* 4:4 */
00422         TW_UINT8        status;
00423         TW_UINT8        flags;
00424         TW_UINT16       count;  /* block cnt, parameter cnt, message credits */
00425 };
00426 
00427 
00428 /* Command packet header. */
00429 struct tw_cl_command_header {
00430         TW_UINT8        sense_data[TWA_SENSE_DATA_LENGTH];
00431         struct {
00432                 TW_INT8         reserved[4];
00433                 TW_UINT16       error;
00434                 TW_UINT8        padding;
00435                 TW_UINT8        res__severity;  /* 5:3 */
00436         } status_block;
00437         TW_UINT8        err_specific_desc[98];
00438         struct {
00439                 TW_UINT8        size_header;
00440                 TW_UINT16       reserved;
00441                 TW_UINT8        size_sense;
00442         } header_desc;
00443 };
00444 
00445 
00446 /* 7000 Command packet. */
00447 union tw_cl_command_7k {
00448         struct tw_cl_command_init_connect       init_connect;
00449         struct tw_cl_command_download_firmware  download_fw;
00450         struct tw_cl_command_reset_firmware     reset_fw;
00451         struct tw_cl_command_param              param;
00452         struct tw_cl_command_generic            generic;
00453         TW_UINT8        padding[1024 - sizeof(struct tw_cl_command_header)];
00454 };
00455 
00456 
00457 /* 9000 Command Packet. */
00458 struct tw_cl_command_9k {
00459         TW_UINT8        res__opcode;    /* 3:5 */
00460         TW_UINT8        unit;
00461         TW_UINT16       lun_l4__req_id; /* 4:12 */
00462         TW_UINT8        status;
00463         TW_UINT8        sgl_offset; /* offset (in bytes) to sg_list, from the
00464                                         end of sgl_entries */
00465         TW_UINT16       lun_h4__sgl_entries;
00466         TW_UINT8        cdb[16];
00467         TW_UINT8        sg_list[872];/* total struct size =
00468                                         1024-sizeof(cmd_hdr) */
00469 };
00470 
00471 
00472 /* Full command packet. */
00473 struct tw_cl_command_packet {
00474         struct tw_cl_command_header     cmd_hdr;
00475         union {
00476                 union tw_cl_command_7k  cmd_pkt_7k;
00477                 struct tw_cl_command_9k cmd_pkt_9k;
00478         } command;
00479 };
00480 
00481 #pragma pack()
00482 
00483 /*
00484  * Following cut out of tw_cl_ioctl.h
00485  *
00486  */
00487 
00488 #pragma pack(1)
00489 
00490 /* Structure used to handle GET/RELEASE LOCK ioctls. */
00491 struct tw_cl_lock_packet {
00492         TW_UINT32       timeout_msec;
00493         TW_UINT32       time_remaining_msec;
00494         TW_UINT32       force_flag;
00495 };
00496 
00497 
00498 /* Structure used to handle GET COMPATIBILITY INFO ioctl. */
00499 struct tw_cl_compatibility_packet {
00500         TW_UINT8        driver_version[32];/* driver version */
00501         TW_UINT16       working_srl;    /* driver & firmware negotiated srl */
00502         TW_UINT16       working_branch; /* branch # of the firmware that the
00503                                         driver is compatible with */
00504         TW_UINT16       working_build;  /* build # of the firmware that the
00505                                         driver is compatible with */
00506 };
00507 
00508 
00509 /* Driver understandable part of the ioctl packet built by the API. */
00510 struct tw_cl_driver_packet {
00511         TW_UINT32       control_code;
00512         TW_UINT32       status;
00513         TW_UINT32       unique_id;
00514         TW_UINT32       sequence_id;
00515         TW_UINT32       os_status;
00516         TW_UINT32       buffer_length;
00517 };
00518 
00519 #pragma pack()
00520 
00521 /*
00522  * Following cut out of tw_osl_ioctl.h
00523  *
00524  */
00525 
00526 #pragma pack(1)
00527 /*
00528  * We need the structure below to ensure that the first byte of
00529  * data_buf is not overwritten by the kernel, after we return
00530  * from the ioctl call.  Note that cmd_pkt has been reduced
00531  * to an array of 1024 bytes even though it's actually 2048 bytes
00532  * in size.  This is because, we don't expect requests from user
00533  * land requiring 2048 (273 sg elements) byte cmd pkts.
00534  */
00535 typedef struct tw_osli_ioctl_no_data_buf {
00536         struct tw_cl_driver_packet      driver_pkt;
00537         TW_VOID                         *pdata; /* points to data_buf */
00538         TW_INT8                         padding[488 - sizeof(TW_VOID *)];
00539         struct tw_cl_command_packet     cmd_pkt;
00540 } TW_OSLI_IOCTL_NO_DATA_BUF;
00541 
00542 #pragma pack()
00543 
00544 #define TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH              \
00545         _IOWR('T', 202, TW_OSLI_IOCTL_NO_DATA_BUF)
00546 
00547 #pragma pack(1)
00548 
00549 typedef struct tw_osli_ioctl_with_payload {
00550         struct tw_cl_driver_packet      driver_pkt;
00551         TW_INT8                         padding[488];
00552         struct tw_cl_command_packet     cmd_pkt;
00553         union {
00554                 struct tw_cl_event_packet               event_pkt;
00555                 struct tw_cl_lock_packet                lock_pkt;
00556                 struct tw_cl_compatibility_packet       compat_pkt;
00557                 TW_INT8                                 data_buf[1];
00558         } payload;
00559 } TW_OSLI_IOCTL_WITH_PAYLOAD;
00560 
00561 #pragma pack()
00562 
00563 #endif
00564 
00565 #define HPT_CTL_CODE(x) (x+0xFF00)
00566 #define HPT_IOCTL_GET_CHANNEL_INFO          HPT_CTL_CODE(3)
00567 #define HPT_IOCTL_GET_CHANNEL_INFO_V2       HPT_CTL_CODE(53)
00568 #define HPT_IOCTL_IDE_PASS_THROUGH          HPT_CTL_CODE(24)
00569 
00570 #define HPT_READ 1
00571 #define HPT_WRITE 2
00572 
00573 #define HPT_IOCTL_MAGIC   0xA1B2C3D4
00574 
00575 #define MAXDEV_PER_CHANNEL 2
00576 #define PMPORT_PER_CHANNEL 15 /* max devices connected to this channel via pmport */
00577 
00578 #pragma pack(1)
00579 typedef struct _HPT_CHANNEL_INFO {
00580   unsigned int reserve1;
00581   unsigned int reserve2;
00582   unsigned int devices[MAXDEV_PER_CHANNEL];
00583 } HPT_CHANNEL_INFO, *PHPT_CHANNEL_INFO;
00584 
00585 typedef struct _HPT_CHANNEL_INFO_V2 {
00586   unsigned int reserve1;
00587   unsigned int reserve2;
00588   unsigned int devices[PMPORT_PER_CHANNEL];
00589 } HPT_CHANNEL_INFO_V2, *PHPT_CHANNEL_INFO_V2;
00590 
00591 typedef struct _HPT_IOCTL_PARAM {
00592   unsigned int magic;     /* used to check if it's a valid ioctl packet */
00593   unsigned int ctrl_code; /* operation control code */
00594   void* in;               /* input data buffer */
00595   unsigned int in_size;   /* size of input data buffer */
00596   void* out;              /* output data buffer */
00597   unsigned int out_size;  /* size of output data buffer */
00598   void* returned_size;    /* count of chars returned */
00599 } HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM;
00600 #define HPT_DO_IOCONTROL        _IOW('H', 0, HPT_IOCTL_PARAM)
00601 
00602 typedef struct _HPT_PASS_THROUGH_HEADER {
00603   unsigned int id;          /* disk ID */
00604   unsigned char feature;
00605   unsigned char sectorcount;
00606   unsigned char lbalow;
00607   unsigned char lbamid;
00608   unsigned char lbahigh;
00609   unsigned char driverhead;
00610   unsigned char command;
00611   unsigned char sectors;    /* data size in sectors, if the command has data transfer */
00612   unsigned char protocol;   /* HPT_(READ,WRITE) or zero for non-DATA */
00613   unsigned char reserve[3];
00614 }
00615 HPT_PASS_THROUGH_HEADER, *PHPT_PASS_THROUGH_HEADER;
00616 #pragma pack()
00617 
00618 #ifndef __unused
00619 #define __unused __attribute__ ((__unused__))
00620 #endif
00621 
00622 #endif /* OS_FREEBSD_H_ */