|
smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
|
00001 /*- 00002 * Copyright (c) 2001 Michael Smith 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 00015 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00016 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00017 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00018 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00019 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00020 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00021 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00022 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00023 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00024 * SUCH DAMAGE. 00025 * 00026 * $FreeBSD: src/sys/dev/ciss/cissio.h,v 1.6.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $ 00027 */ 00028 00029 /* 00030 * Driver ioctl interface. 00031 * 00032 * Note that this interface is API-compatible with the Linux implementation 00033 * except as noted, and thus this header bears a striking resemblance to 00034 * the Linux driver's cciss_ioctl.h. 00035 * 00036 */ 00037 00038 #include <sys/ioccom.h> 00039 00040 #pragma pack(1) 00041 00042 typedef struct 00043 { 00044 u_int8_t bus; 00045 u_int8_t dev_fn; 00046 u_int32_t board_id; 00047 } cciss_pci_info_struct; 00048 00049 typedef struct 00050 { 00051 u_int32_t delay; 00052 u_int32_t count; 00053 } cciss_coalint_struct; 00054 00055 typedef char NodeName_type[16]; 00056 typedef u_int32_t Heartbeat_type; 00057 00058 #define CISS_PARSCSIU2 0x0001 00059 #define CISS_PARCSCIU3 0x0002 00060 #define CISS_FIBRE1G 0x0100 00061 #define CISS_FIBRE2G 0x0200 00062 typedef u_int32_t BusTypes_type; 00063 00064 typedef char FirmwareVer_type[4]; 00065 typedef u_int32_t DriverVer_type; 00066 00067 /* passthrough command definitions */ 00068 #define SENSEINFOBYTES 32 00069 #define CISS_MAX_LUN 16 00070 #define LEVEL2LUN 1 00071 #define LEVEL3LUN 0 00072 00073 /* command status value */ 00074 #define CMD_SUCCESS 0x0000 00075 #define CMD_TARGET_STATUS 0x0001 00076 #define CMD_DATA_UNDERRUN 0x0002 00077 #define CMD_DATA_OVERRUN 0x0003 00078 #define CMD_INVALID 0x0004 00079 #define CMD_PROTOCOL_ERR 0x0005 00080 #define CMD_HARDWARE_ERR 0x0006 00081 #define CMD_CONNECTION_LOST 0x0007 00082 #define CMD_ABORTED 0x0008 00083 #define CMD_ABORT_FAILED 0x0009 00084 #define CMD_UNSOLICITED_ABORT 0x000A 00085 #define CMD_TIMEOUT 0x000B 00086 #define CMD_UNABORTABLE 0x000C 00087 00088 /* transfer direction */ 00089 #define XFER_NONE 0x00 00090 #define XFER_WRITE 0x01 00091 #define XFER_READ 0x02 00092 #define XFER_RSVD 0x03 00093 00094 /* task attribute */ 00095 #define ATTR_UNTAGGED 0x00 00096 #define ATTR_SIMPLE 0x04 00097 #define ATTR_HEADOFQUEUE 0x05 00098 #define ATTR_ORDERED 0x06 00099 #define ATTR_ACA 0x07 00100 00101 /* CDB type */ 00102 #define TYPE_CMD 0x00 00103 #define TYPE_MSG 0x01 00104 00105 /* command list structure */ 00106 typedef union { 00107 struct { 00108 u_int8_t Dev; 00109 u_int8_t Bus:6; 00110 u_int8_t Mode:2; 00111 } __packed PeripDev; 00112 struct { 00113 u_int8_t DevLSB; 00114 u_int8_t DevMSB:6; 00115 u_int8_t Mode:2; 00116 } __packed LogDev; 00117 struct { 00118 u_int8_t Dev:5; 00119 u_int8_t Bus:3; 00120 u_int8_t Targ:6; 00121 u_int8_t Mode:2; 00122 } __packed LogUnit; 00123 } SCSI3Addr_struct; 00124 00125 typedef struct { 00126 u_int32_t TargetId:24; 00127 u_int32_t Bus:6; 00128 u_int32_t Mode:2; 00129 SCSI3Addr_struct Target[2]; 00130 } __packed PhysDevAddr_struct; 00131 00132 typedef struct { 00133 u_int32_t VolId:30; 00134 u_int32_t Mode:2; 00135 u_int8_t reserved[4]; 00136 } __packed LogDevAddr_struct; 00137 00138 typedef union { 00139 u_int8_t LunAddrBytes[8]; 00140 SCSI3Addr_struct SCSI3Lun[4]; 00141 PhysDevAddr_struct PhysDev; 00142 LogDevAddr_struct LogDev; 00143 } __packed LUNAddr_struct; 00144 00145 typedef struct { 00146 u_int8_t CDBLen; 00147 struct { 00148 u_int8_t Type:3; 00149 u_int8_t Attribute:3; 00150 u_int8_t Direction:2; 00151 } __packed Type; 00152 u_int16_t Timeout; 00153 u_int8_t CDB[16]; 00154 } __packed RequestBlock_struct; 00155 00156 typedef union { 00157 struct { 00158 u_int8_t Reserved[3]; 00159 u_int8_t Type; 00160 u_int32_t ErrorInfo; 00161 } __packed Common_Info; 00162 struct { 00163 u_int8_t Reserved[2]; 00164 u_int8_t offense_size; 00165 u_int8_t offense_num; 00166 u_int32_t offense_value; 00167 } __packed Invalid_Cmd; 00168 } __packed MoreErrInfo_struct; 00169 00170 typedef struct { 00171 u_int8_t ScsiStatus; 00172 u_int8_t SenseLen; 00173 u_int16_t CommandStatus; 00174 u_int32_t ResidualCnt; 00175 MoreErrInfo_struct MoreErrInfo; 00176 u_int8_t SenseInfo[SENSEINFOBYTES]; 00177 } __packed ErrorInfo_struct; 00178 00179 typedef struct { 00180 LUNAddr_struct LUN_info; /* 8 */ 00181 RequestBlock_struct Request; /* 20 */ 00182 ErrorInfo_struct error_info; /* 48 */ 00183 u_int16_t buf_size; /* 2 */ 00184 u_int8_t *buf; /* 4 */ 00185 } __packed IOCTL_Command_struct; 00186 00187 #ifdef __amd64__ 00188 typedef struct { 00189 LUNAddr_struct LUN_info; /* 8 */ 00190 RequestBlock_struct Request; /* 20 */ 00191 ErrorInfo_struct error_info; /* 48 */ 00192 u_int16_t buf_size; /* 2 */ 00193 u_int32_t buf; /* 4 */ 00194 } __packed IOCTL_Command_struct32; 00195 #endif 00196 00197 /************************************************************************ 00198 * Command queue statistics 00199 */ 00200 00201 #define CISSQ_FREE 0 00202 #define CISSQ_NOTIFY 1 00203 #define CISSQ_COUNT 2 00204 00205 struct ciss_qstat { 00206 uint32_t q_length; 00207 uint32_t q_max; 00208 }; 00209 00210 union ciss_statrequest { 00211 uint32_t cs_item; 00212 struct ciss_qstat cs_qstat; 00213 }; 00214 00215 /* 00216 * Note that we'd normally pass the struct in directly, but 00217 * this code is trying to be compatible with other drivers. 00218 */ 00219 #define CCISS_GETPCIINFO _IOR ('C', 200, cciss_pci_info_struct) 00220 #define CCISS_GETINTINFO _IOR ('C', 201, cciss_coalint_struct) 00221 #define CCISS_SETINTINFO _IOW ('C', 202, cciss_coalint_struct) 00222 #define CCISS_GETNODENAME _IOR ('C', 203, NodeName_type) 00223 #define CCISS_SETNODENAME _IOW ('C', 204, NodeName_type) 00224 #define CCISS_GETHEARTBEAT _IOR ('C', 205, Heartbeat_type) 00225 #define CCISS_GETBUSTYPES _IOR ('C', 206, BusTypes_type) 00226 #define CCISS_GETFIRMVER _IOR ('C', 207, FirmwareVer_type) 00227 #define CCISS_GETDRIVERVER _IOR ('C', 208, DriverVer_type) 00228 #define CCISS_REVALIDVOLS _IO ('C', 209) 00229 #define CCISS_PASSTHRU _IOWR ('C', 210, IOCTL_Command_struct) 00230 #ifdef __amd64 00231 #define CCISS_PASSTHRU32 _IOWR ('C', 210, IOCTL_Command_struct32) 00232 #endif 00233 #define CCISS_GETQSTATS _IOWR ('C', 211, union ciss_statrequest) 00234 00235 #pragma pack()
1.7.4