4 * All Rights Reserved 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer, 11 * without modification, immediately at the beginning of the file. 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 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31 32/* 33 * 34 * iir.h: Definitions/Constants used by the Intel Integrated RAID driver 35 * 36 * Written by: Achim Leubner <achim.leubner@intel.com> 37 * Fixes/Additions: Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com> 38 * 39 * credits: Niklas Hallqvist; OpenBSD driver for the ICP Controllers. 40 * FreeBSD.ORG; Great O/S to work on and for. 41 */ 42 43
| 4 * All Rights Reserved 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer, 11 * without modification, immediately at the beginning of the file. 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 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 */ 31 32/* 33 * 34 * iir.h: Definitions/Constants used by the Intel Integrated RAID driver 35 * 36 * Written by: Achim Leubner <achim.leubner@intel.com> 37 * Fixes/Additions: Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com> 38 * 39 * credits: Niklas Hallqvist; OpenBSD driver for the ICP Controllers. 40 * FreeBSD.ORG; Great O/S to work on and for. 41 */ 42 43
|
145#define GDT_HOST_GET 0x10001 /* get host drive list */ 146#define GDT_IO_CHANNEL 0x20000 /* default IO channel */ 147#define GDT_INVALID_CHANNEL 0xffff /* invalid channel */ 148 149/* IOCTLs */ 150#define GDT_IOCTL_GENERAL _IOWR('J', 0, gdt_ucmd_t) /* general IOCTL */ 151#define GDT_IOCTL_DRVERS _IOWR('J', 1, int) /* get driver version */ 152#define GDT_IOCTL_CTRTYPE _IOR('J', 2, gdt_ctrt_t) /* get ctr. type */ 153#define GDT_IOCTL_OSVERS _IOR('J', 3, gdt_osv_t) /* get OS version */ 154#define GDT_IOCTL_CTRCNT _IOR('J', 5, int) /* get ctr. count */ 155#define GDT_IOCTL_EVENT _IOWR('J', 8, gdt_event_t) /* get event */ 156#define GDT_IOCTL_STATIST _IOR('J', 9, gdt_statist_t) /* get statistics */ 157 158/* Service errors */ 159#define GDT_S_OK 1 /* no error */ 160#define GDT_S_BSY 7 /* controller busy */ 161#define GDT_S_RAW_SCSI 12 /* raw service: target error */ 162#define GDT_S_RAW_ILL 0xff /* raw service: illegal */ 163#define GDT_S_NO_STATUS 0x1000 /* got no status (driver-generated) */ 164 165/* Controller services */ 166#define GDT_SCSIRAWSERVICE 3 167#define GDT_CACHESERVICE 9 168#define GDT_SCREENSERVICE 11 169 170/* Scatter/gather element */ 171#define GDT_SG_PTR 0x00 /* u_int32_t, address */ 172#define GDT_SG_LEN 0x04 /* u_int32_t, length */ 173#define GDT_SG_SZ 0x08 174 175/* Cache service command */ 176#define GDT_CACHE_DEVICENO 0x00 /* u_int16_t, number of cache drive */ 177#define GDT_CACHE_BLOCKNO 0x02 /* u_int32_t, block number */ 178#define GDT_CACHE_BLOCKCNT 0x06 /* u_int32_t, block count */ 179#define GDT_CACHE_DESTADDR 0x0a /* u_int32_t, dest. addr. (-1: s/g) */ 180#define GDT_CACHE_SG_CANZ 0x0e /* u_int32_t, s/g element count */ 181#define GDT_CACHE_SG_LST 0x12 /* [GDT_MAXSG], s/g list */ 182#define GDT_CACHE_SZ (0x12 + GDT_MAXSG * GDT_SG_SZ) 183 184/* Ioctl command */ 185#define GDT_IOCTL_PARAM_SIZE 0x00 /* u_int16_t, size of buffer */ 186#define GDT_IOCTL_SUBFUNC 0x02 /* u_int32_t, ioctl function */ 187#define GDT_IOCTL_CHANNEL 0x06 /* u_int32_t, device */ 188#define GDT_IOCTL_P_PARAM 0x0a /* u_int32_t, buffer */ 189#define GDT_IOCTL_SZ 0x0e 190 191/* Screen service defines */ 192#define GDT_MSG_INV_HANDLE -1 /* special message handle */ 193#define GDT_MSGLEN 16 /* size of message text */ 194#define GDT_MSG_SIZE 34 /* size of message structure */ 195#define GDT_MSG_REQUEST 0 /* async. event. message */ 196 197/* Screen service command */ 198#define GDT_SCREEN_MSG_HANDLE 0x02 /* u_int32_t, message handle */ 199#define GDT_SCREEN_MSG_ADDR 0x06 /* u_int32_t, message buffer address */ 200#define GDT_SCREEN_SZ 0x0a 201 202/* Screen service message */ 203#define GDT_SCR_MSG_HANDLE 0x00 /* u_int32_t, message handle */ 204#define GDT_SCR_MSG_LEN 0x04 /* u_int32_t, size of message */ 205#define GDT_SCR_MSG_ALEN 0x08 /* u_int32_t, answer length */ 206#define GDT_SCR_MSG_ANSWER 0x0c /* u_int8_t, answer flag */ 207#define GDT_SCR_MSG_EXT 0x0d /* u_int8_t, more messages? */ 208#define GDT_SCR_MSG_RES 0x0e /* u_int16_t, reserved */ 209#define GDT_SCR_MSG_TEXT 0x10 /* GDT_MSGLEN+2, message text */ 210#define GDT_SCR_MSG_SZ (0x12 + GDT_MSGLEN) 211 212/* Raw service command */ 213#define GDT_RAW_DIRECTION 0x02 /* u_int32_t, data direction */ 214#define GDT_RAW_MDISC_TIME 0x06 /* u_int32_t, disc. time (0: none) */ 215#define GDT_RAW_MCON_TIME 0x0a /* u_int32_t, conn. time (0: none) */ 216#define GDT_RAW_SDATA 0x0e /* u_int32_t, dest. addr. (-1: s/g) */ 217#define GDT_RAW_SDLEN 0x12 /* u_int32_t, data length */ 218#define GDT_RAW_CLEN 0x16 /* u_int32_t, SCSI cmd len (6/10/12) */ 219#define GDT_RAW_CMD 0x1a /* u_int8_t [12], SCSI command */ 220#define GDT_RAW_TARGET 0x26 /* u_int8_t, target ID */ 221#define GDT_RAW_LUN 0x27 /* u_int8_t, LUN */ 222#define GDT_RAW_BUS 0x28 /* u_int8_t, SCSI bus number */ 223#define GDT_RAW_PRIORITY 0x29 /* u_int8_t, only 0 used */ 224#define GDT_RAW_SENSE_LEN 0x2a /* u_int32_t, sense data length */ 225#define GDT_RAW_SENSE_DATA 0x2e /* u_int32_t, sense data address */ 226#define GDT_RAW_SG_RANZ 0x36 /* u_int32_t, s/g element count */ 227#define GDT_RAW_SG_LST 0x3a /* [GDT_MAXSG], s/g list */ 228#define GDT_RAW_SZ (0x3a + GDT_MAXSG * GDT_SG_SZ) 229 230/* Command structure */ 231#define GDT_CMD_BOARDNODE 0x00 /* u_int32_t, board node (always 0) */ 232#define GDT_CMD_COMMANDINDEX 0x04 /* u_int32_t, command number */ 233#define GDT_CMD_OPCODE 0x08 /* u_int16_t, opcode (READ, ...) */ 234#define GDT_CMD_UNION 0x0a /* cache/screen/raw service command */ 235#define GDT_CMD_UNION_SZ GDT_RAW_SZ 236#define GDT_CMD_SZ (0x0a + GDT_CMD_UNION_SZ) 237 238/* Command queue entries */ 239#define GDT_OFFSET 0x00 /* u_int16_t, command offset in the DP RAM */ 240#define GDT_SERV_ID 0x02 /* u_int16_t, service */ 241#define GDT_COMM_Q_SZ 0x04 242 243/* Interface area */ 244#define GDT_S_CMD_INDX 0x00 /* u_int8_t, special command */ 245#define GDT_S_STATUS 0x01 /* volatile u_int8_t, status special command */ 246#define GDT_S_INFO 0x04 /* u_int32_t [4], add. info special command */ 247#define GDT_SEMA0 0x14 /* volatile u_int8_t, command semaphore */ 248#define GDT_CMD_INDEX 0x18 /* u_int8_t, command number */ 249#define GDT_STATUS 0x1c /* volatile u_int16_t, command status */ 250#define GDT_SERVICE 0x1e /* u_int16_t, service (for asynch. events) */ 251#define GDT_DPR_INFO 0x20 /* u_int32_t [2], additional info */ 252#define GDT_COMM_QUEUE 0x28 /* command queue */ 253#define GDT_DPR_CMD (0x30 + GDT_MAXOFFSETS * GDT_COMM_Q_SZ) 254 /* u_int8_t [], commands */ 255 256/* I/O channel header */ 257#define GDT_IOC_VERSION 0x00 /* u_int32_t, version (~0: newest) */ 258#define GDT_IOC_LIST_ENTRIES 0x04 /* u_int8_t, list entry count */ 259#define GDT_IOC_FIRST_CHAN 0x05 /* u_int8_t, first channel number */ 260#define GDT_IOC_LAST_CHAN 0x06 /* u_int8_t, last channel number */ 261#define GDT_IOC_CHAN_COUNT 0x07 /* u_int8_t, (R) channel count */ 262#define GDT_IOC_LIST_OFFSET 0x08 /* u_int32_t, offset of list[0] */ 263#define GDT_IOC_HDR_SZ 0x0c 264 265#define GDT_IOC_NEWEST 0xffffffff /* goes into GDT_IOC_VERSION */ 266 267/* Get I/O channel description */ 268#define GDT_IOC_ADDRESS 0x00 /* u_int32_t, channel address */ 269#define GDT_IOC_TYPE 0x04 /* u_int8_t, type (SCSI/FCSL) */ 270#define GDT_IOC_LOCAL_NO 0x05 /* u_int8_t, local number */ 271#define GDT_IOC_FEATURES 0x06 /* u_int16_t, channel features */ 272#define GDT_IOC_SZ 0x08 273 274/* Get raw I/O channel description */ 275#define GDT_RAWIOC_PROC_ID 0x00 /* u_int8_t, processor id */ 276#define GDT_RAWIOC_PROC_DEFECT 0x01 /* u_int8_t, defect? */ 277#define GDT_RAWIOC_SZ 0x04 278 279/* Get SCSI channel count */ 280#define GDT_GETCH_CHANNEL_NO 0x00 /* u_int32_t, channel number */ 281#define GDT_GETCH_DRIVE_CNT 0x04 /* u_int32_t, drive count */ 282#define GDT_GETCH_SIOP_ID 0x08 /* u_int8_t, SCSI processor ID */ 283#define GDT_GETCH_SIOP_STATE 0x09 /* u_int8_t, SCSI processor state */ 284#define GDT_GETCH_SZ 0x0a 285 286/* Cache info/config IOCTL structures */ 287#define GDT_CPAR_VERSION 0x00 /* u_int32_t, firmware version */ 288#define GDT_CPAR_STATE 0x04 /* u_int16_t, cache state (on/off) */ 289#define GDT_CPAR_STRATEGY 0x06 /* u_int16_t, cache strategy */ 290#define GDT_CPAR_WRITE_BACK 0x08 /* u_int16_t, write back (on/off) */ 291#define GDT_CPAR_BLOCK_SIZE 0x0a /* u_int16_t, cache block size */ 292#define GDT_CPAR_SZ 0x0c 293 294#define GDT_CSTAT_CSIZE 0x00 /* u_int32_t, cache size */ 295#define GDT_CSTAT_READ_CNT 0x04 /* u_int32_t, read counter */ 296#define GDT_CSTAT_WRITE_CNT 0x08 /* u_int32_t, write counter */ 297#define GDT_CSTAT_TR_HITS 0x0c /* u_int32_t, track hits */ 298#define GDT_CSTAT_SEC_HITS 0x10 /* u_int32_t, sector hits */ 299#define GDT_CSTAT_SEC_MISS 0x14 /* u_int32_t, sector misses */ 300#define GDT_CSTAT_SZ 0x18 301 302/* Get cache info */ 303#define GDT_CINFO_CPAR 0x00 304#define GDT_CINFO_CSTAT GDT_CPAR_SZ 305#define GDT_CINFO_SZ (GDT_CPAR_SZ + GDT_CSTAT_SZ) 306 307/* Get board info */ 308#define GDT_BINFO_SER_NO 0x00 /* u_int32_t, serial number */ 309#define GDT_BINFO_OEM_ID 0x04 /* u_int8_t [2], OEM ID */ 310#define GDT_BINFO_EP_FLAGS 0x06 /* u_int16_t, eprom flags */ 311#define GDT_BINFO_PROC_ID 0x08 /* u_int32_t, processor ID */ 312#define GDT_BINFO_MEMSIZE 0x0c /* u_int32_t, memory size (bytes) */ 313#define GDT_BINFO_MEM_BANKS 0x10 /* u_int8_t, memory banks */ 314#define GDT_BINFO_CHAN_TYPE 0x11 /* u_int8_t, channel type */ 315#define GDT_BINFO_CHAN_COUNT 0x12 /* u_int8_t, channel count */ 316#define GDT_BINFO_RDONGLE_PRES 0x13 /* u_int8_t, dongle present */ 317#define GDT_BINFO_EPR_FW_VER 0x14 /* u_int32_t, (eprom) firmware ver */ 318#define GDT_BINFO_UPD_FW_VER 0x18 /* u_int32_t, (update) firmware ver */ 319#define GDT_BINFO_UPD_REVISION 0x1c /* u_int32_t, update revision */ 320#define GDT_BINFO_TYPE_STRING 0x20 /* char [16], controller name */ 321#define GDT_BINFO_RAID_STRING 0x30 /* char [16], RAID firmware name */ 322#define GDT_BINFO_UPDATE_PRES 0x40 /* u_int8_t, update present? */ 323#define GDT_BINFO_XOR_PRES 0x41 /* u_int8_t, XOR engine present */ 324#define GDT_BINFO_PROM_TYPE 0x42 /* u_int8_t, ROM type (eprom/flash) */ 325#define GDT_BINFO_PROM_COUNT 0x43 /* u_int8_t, number of ROM devices */ 326#define GDT_BINFO_DUP_PRES 0x44 /* u_int32_t, duplexing module pres? */ 327#define GDT_BINFO_CHAN_PRES 0x48 /* u_int32_t, # of exp. channels */ 328#define GDT_BINFO_MEM_PRES 0x4c /* u_int32_t, memory expansion inst? */ 329#define GDT_BINFO_FT_BUS_SYSTEM 0x50 /* u_int8_t, fault bus supported? */ 330#define GDT_BINFO_SUBTYPE_VALID 0x51 /* u_int8_t, board_subtype valid */ 331#define GDT_BINFO_BOARD_SUBTYPE 0x52 /* u_int8_t, subtype/hardware level */ 332#define GDT_BINFO_RAMPAR_PRES 0x53 /* u_int8_t, RAM parity check hw? */ 333#define GDT_BINFO_SZ 0x54 334 335/* Get board features */ 336#define GDT_BFEAT_CHAINING 0x00 /* u_int8_t, chaining supported */ 337#define GDT_BFEAT_STRIPING 0x01 /* u_int8_t, striping (RAID-0) supp. */ 338#define GDT_BFEAT_MIRRORING 0x02 /* u_int8_t, mirroring (RAID-1) supp */ 339#define GDT_BFEAT_RAID 0x03 /* u_int8_t, RAID-4/5/10 supported */ 340#define GDT_BFEAT_SZ 0x04 341 342/* Other defines */ 343#define GDT_ASYNCINDEX 0 /* command index asynchronous event */ 344#define GDT_SPEZINDEX 1 /* command index unknown service */ 345 346/* Debugging */ 347#ifdef GDT_DEBUG 348#define GDT_D_INTR 0x01 349#define GDT_D_MISC 0x02 350#define GDT_D_CMD 0x04 351#define GDT_D_QUEUE 0x08 352#define GDT_D_TIMEOUT 0x10 353#define GDT_D_INIT 0x20 354#define GDT_D_INVALID 0x40 355#define GDT_D_DEBUG 0x80 356extern int gdt_debug; 357#ifdef __SERIAL__ 358extern int ser_printf(const char *fmt, ...); 359#define GDT_DPRINTF(mask, args) if (gdt_debug & (mask)) ser_printf args 360#else 361#define GDT_DPRINTF(mask, args) if (gdt_debug & (mask)) printf args 362#endif 363#else 364#define GDT_DPRINTF(mask, args) 365#endif 366 367/* Miscellaneous constants */ 368#define GDT_RETRIES 100000000 /* 100000 * 1us = 100s */ 369#define GDT_TIMEOUT 100000000 /* 100000 * 1us = 100s */ 370#define GDT_POLL_TIMEOUT 10000000 /* 10000 * 1us = 10s */ 371#define GDT_WATCH_TIMEOUT 10000000 /* 10000 * 1us = 10s */ 372#define GDT_SCRATCH_SZ 3072 /* 3KB scratch buffer */ 373
| 146#define GDT_HOST_GET 0x10001 /* get host drive list */ 147#define GDT_IO_CHANNEL 0x20000 /* default IO channel */ 148#define GDT_INVALID_CHANNEL 0xffff /* invalid channel */ 149 150/* IOCTLs */ 151#define GDT_IOCTL_GENERAL _IOWR('J', 0, gdt_ucmd_t) /* general IOCTL */ 152#define GDT_IOCTL_DRVERS _IOWR('J', 1, int) /* get driver version */ 153#define GDT_IOCTL_CTRTYPE _IOR('J', 2, gdt_ctrt_t) /* get ctr. type */ 154#define GDT_IOCTL_OSVERS _IOR('J', 3, gdt_osv_t) /* get OS version */ 155#define GDT_IOCTL_CTRCNT _IOR('J', 5, int) /* get ctr. count */ 156#define GDT_IOCTL_EVENT _IOWR('J', 8, gdt_event_t) /* get event */ 157#define GDT_IOCTL_STATIST _IOR('J', 9, gdt_statist_t) /* get statistics */ 158 159/* Service errors */ 160#define GDT_S_OK 1 /* no error */ 161#define GDT_S_BSY 7 /* controller busy */ 162#define GDT_S_RAW_SCSI 12 /* raw service: target error */ 163#define GDT_S_RAW_ILL 0xff /* raw service: illegal */ 164#define GDT_S_NO_STATUS 0x1000 /* got no status (driver-generated) */ 165 166/* Controller services */ 167#define GDT_SCSIRAWSERVICE 3 168#define GDT_CACHESERVICE 9 169#define GDT_SCREENSERVICE 11 170 171/* Scatter/gather element */ 172#define GDT_SG_PTR 0x00 /* u_int32_t, address */ 173#define GDT_SG_LEN 0x04 /* u_int32_t, length */ 174#define GDT_SG_SZ 0x08 175 176/* Cache service command */ 177#define GDT_CACHE_DEVICENO 0x00 /* u_int16_t, number of cache drive */ 178#define GDT_CACHE_BLOCKNO 0x02 /* u_int32_t, block number */ 179#define GDT_CACHE_BLOCKCNT 0x06 /* u_int32_t, block count */ 180#define GDT_CACHE_DESTADDR 0x0a /* u_int32_t, dest. addr. (-1: s/g) */ 181#define GDT_CACHE_SG_CANZ 0x0e /* u_int32_t, s/g element count */ 182#define GDT_CACHE_SG_LST 0x12 /* [GDT_MAXSG], s/g list */ 183#define GDT_CACHE_SZ (0x12 + GDT_MAXSG * GDT_SG_SZ) 184 185/* Ioctl command */ 186#define GDT_IOCTL_PARAM_SIZE 0x00 /* u_int16_t, size of buffer */ 187#define GDT_IOCTL_SUBFUNC 0x02 /* u_int32_t, ioctl function */ 188#define GDT_IOCTL_CHANNEL 0x06 /* u_int32_t, device */ 189#define GDT_IOCTL_P_PARAM 0x0a /* u_int32_t, buffer */ 190#define GDT_IOCTL_SZ 0x0e 191 192/* Screen service defines */ 193#define GDT_MSG_INV_HANDLE -1 /* special message handle */ 194#define GDT_MSGLEN 16 /* size of message text */ 195#define GDT_MSG_SIZE 34 /* size of message structure */ 196#define GDT_MSG_REQUEST 0 /* async. event. message */ 197 198/* Screen service command */ 199#define GDT_SCREEN_MSG_HANDLE 0x02 /* u_int32_t, message handle */ 200#define GDT_SCREEN_MSG_ADDR 0x06 /* u_int32_t, message buffer address */ 201#define GDT_SCREEN_SZ 0x0a 202 203/* Screen service message */ 204#define GDT_SCR_MSG_HANDLE 0x00 /* u_int32_t, message handle */ 205#define GDT_SCR_MSG_LEN 0x04 /* u_int32_t, size of message */ 206#define GDT_SCR_MSG_ALEN 0x08 /* u_int32_t, answer length */ 207#define GDT_SCR_MSG_ANSWER 0x0c /* u_int8_t, answer flag */ 208#define GDT_SCR_MSG_EXT 0x0d /* u_int8_t, more messages? */ 209#define GDT_SCR_MSG_RES 0x0e /* u_int16_t, reserved */ 210#define GDT_SCR_MSG_TEXT 0x10 /* GDT_MSGLEN+2, message text */ 211#define GDT_SCR_MSG_SZ (0x12 + GDT_MSGLEN) 212 213/* Raw service command */ 214#define GDT_RAW_DIRECTION 0x02 /* u_int32_t, data direction */ 215#define GDT_RAW_MDISC_TIME 0x06 /* u_int32_t, disc. time (0: none) */ 216#define GDT_RAW_MCON_TIME 0x0a /* u_int32_t, conn. time (0: none) */ 217#define GDT_RAW_SDATA 0x0e /* u_int32_t, dest. addr. (-1: s/g) */ 218#define GDT_RAW_SDLEN 0x12 /* u_int32_t, data length */ 219#define GDT_RAW_CLEN 0x16 /* u_int32_t, SCSI cmd len (6/10/12) */ 220#define GDT_RAW_CMD 0x1a /* u_int8_t [12], SCSI command */ 221#define GDT_RAW_TARGET 0x26 /* u_int8_t, target ID */ 222#define GDT_RAW_LUN 0x27 /* u_int8_t, LUN */ 223#define GDT_RAW_BUS 0x28 /* u_int8_t, SCSI bus number */ 224#define GDT_RAW_PRIORITY 0x29 /* u_int8_t, only 0 used */ 225#define GDT_RAW_SENSE_LEN 0x2a /* u_int32_t, sense data length */ 226#define GDT_RAW_SENSE_DATA 0x2e /* u_int32_t, sense data address */ 227#define GDT_RAW_SG_RANZ 0x36 /* u_int32_t, s/g element count */ 228#define GDT_RAW_SG_LST 0x3a /* [GDT_MAXSG], s/g list */ 229#define GDT_RAW_SZ (0x3a + GDT_MAXSG * GDT_SG_SZ) 230 231/* Command structure */ 232#define GDT_CMD_BOARDNODE 0x00 /* u_int32_t, board node (always 0) */ 233#define GDT_CMD_COMMANDINDEX 0x04 /* u_int32_t, command number */ 234#define GDT_CMD_OPCODE 0x08 /* u_int16_t, opcode (READ, ...) */ 235#define GDT_CMD_UNION 0x0a /* cache/screen/raw service command */ 236#define GDT_CMD_UNION_SZ GDT_RAW_SZ 237#define GDT_CMD_SZ (0x0a + GDT_CMD_UNION_SZ) 238 239/* Command queue entries */ 240#define GDT_OFFSET 0x00 /* u_int16_t, command offset in the DP RAM */ 241#define GDT_SERV_ID 0x02 /* u_int16_t, service */ 242#define GDT_COMM_Q_SZ 0x04 243 244/* Interface area */ 245#define GDT_S_CMD_INDX 0x00 /* u_int8_t, special command */ 246#define GDT_S_STATUS 0x01 /* volatile u_int8_t, status special command */ 247#define GDT_S_INFO 0x04 /* u_int32_t [4], add. info special command */ 248#define GDT_SEMA0 0x14 /* volatile u_int8_t, command semaphore */ 249#define GDT_CMD_INDEX 0x18 /* u_int8_t, command number */ 250#define GDT_STATUS 0x1c /* volatile u_int16_t, command status */ 251#define GDT_SERVICE 0x1e /* u_int16_t, service (for asynch. events) */ 252#define GDT_DPR_INFO 0x20 /* u_int32_t [2], additional info */ 253#define GDT_COMM_QUEUE 0x28 /* command queue */ 254#define GDT_DPR_CMD (0x30 + GDT_MAXOFFSETS * GDT_COMM_Q_SZ) 255 /* u_int8_t [], commands */ 256 257/* I/O channel header */ 258#define GDT_IOC_VERSION 0x00 /* u_int32_t, version (~0: newest) */ 259#define GDT_IOC_LIST_ENTRIES 0x04 /* u_int8_t, list entry count */ 260#define GDT_IOC_FIRST_CHAN 0x05 /* u_int8_t, first channel number */ 261#define GDT_IOC_LAST_CHAN 0x06 /* u_int8_t, last channel number */ 262#define GDT_IOC_CHAN_COUNT 0x07 /* u_int8_t, (R) channel count */ 263#define GDT_IOC_LIST_OFFSET 0x08 /* u_int32_t, offset of list[0] */ 264#define GDT_IOC_HDR_SZ 0x0c 265 266#define GDT_IOC_NEWEST 0xffffffff /* goes into GDT_IOC_VERSION */ 267 268/* Get I/O channel description */ 269#define GDT_IOC_ADDRESS 0x00 /* u_int32_t, channel address */ 270#define GDT_IOC_TYPE 0x04 /* u_int8_t, type (SCSI/FCSL) */ 271#define GDT_IOC_LOCAL_NO 0x05 /* u_int8_t, local number */ 272#define GDT_IOC_FEATURES 0x06 /* u_int16_t, channel features */ 273#define GDT_IOC_SZ 0x08 274 275/* Get raw I/O channel description */ 276#define GDT_RAWIOC_PROC_ID 0x00 /* u_int8_t, processor id */ 277#define GDT_RAWIOC_PROC_DEFECT 0x01 /* u_int8_t, defect? */ 278#define GDT_RAWIOC_SZ 0x04 279 280/* Get SCSI channel count */ 281#define GDT_GETCH_CHANNEL_NO 0x00 /* u_int32_t, channel number */ 282#define GDT_GETCH_DRIVE_CNT 0x04 /* u_int32_t, drive count */ 283#define GDT_GETCH_SIOP_ID 0x08 /* u_int8_t, SCSI processor ID */ 284#define GDT_GETCH_SIOP_STATE 0x09 /* u_int8_t, SCSI processor state */ 285#define GDT_GETCH_SZ 0x0a 286 287/* Cache info/config IOCTL structures */ 288#define GDT_CPAR_VERSION 0x00 /* u_int32_t, firmware version */ 289#define GDT_CPAR_STATE 0x04 /* u_int16_t, cache state (on/off) */ 290#define GDT_CPAR_STRATEGY 0x06 /* u_int16_t, cache strategy */ 291#define GDT_CPAR_WRITE_BACK 0x08 /* u_int16_t, write back (on/off) */ 292#define GDT_CPAR_BLOCK_SIZE 0x0a /* u_int16_t, cache block size */ 293#define GDT_CPAR_SZ 0x0c 294 295#define GDT_CSTAT_CSIZE 0x00 /* u_int32_t, cache size */ 296#define GDT_CSTAT_READ_CNT 0x04 /* u_int32_t, read counter */ 297#define GDT_CSTAT_WRITE_CNT 0x08 /* u_int32_t, write counter */ 298#define GDT_CSTAT_TR_HITS 0x0c /* u_int32_t, track hits */ 299#define GDT_CSTAT_SEC_HITS 0x10 /* u_int32_t, sector hits */ 300#define GDT_CSTAT_SEC_MISS 0x14 /* u_int32_t, sector misses */ 301#define GDT_CSTAT_SZ 0x18 302 303/* Get cache info */ 304#define GDT_CINFO_CPAR 0x00 305#define GDT_CINFO_CSTAT GDT_CPAR_SZ 306#define GDT_CINFO_SZ (GDT_CPAR_SZ + GDT_CSTAT_SZ) 307 308/* Get board info */ 309#define GDT_BINFO_SER_NO 0x00 /* u_int32_t, serial number */ 310#define GDT_BINFO_OEM_ID 0x04 /* u_int8_t [2], OEM ID */ 311#define GDT_BINFO_EP_FLAGS 0x06 /* u_int16_t, eprom flags */ 312#define GDT_BINFO_PROC_ID 0x08 /* u_int32_t, processor ID */ 313#define GDT_BINFO_MEMSIZE 0x0c /* u_int32_t, memory size (bytes) */ 314#define GDT_BINFO_MEM_BANKS 0x10 /* u_int8_t, memory banks */ 315#define GDT_BINFO_CHAN_TYPE 0x11 /* u_int8_t, channel type */ 316#define GDT_BINFO_CHAN_COUNT 0x12 /* u_int8_t, channel count */ 317#define GDT_BINFO_RDONGLE_PRES 0x13 /* u_int8_t, dongle present */ 318#define GDT_BINFO_EPR_FW_VER 0x14 /* u_int32_t, (eprom) firmware ver */ 319#define GDT_BINFO_UPD_FW_VER 0x18 /* u_int32_t, (update) firmware ver */ 320#define GDT_BINFO_UPD_REVISION 0x1c /* u_int32_t, update revision */ 321#define GDT_BINFO_TYPE_STRING 0x20 /* char [16], controller name */ 322#define GDT_BINFO_RAID_STRING 0x30 /* char [16], RAID firmware name */ 323#define GDT_BINFO_UPDATE_PRES 0x40 /* u_int8_t, update present? */ 324#define GDT_BINFO_XOR_PRES 0x41 /* u_int8_t, XOR engine present */ 325#define GDT_BINFO_PROM_TYPE 0x42 /* u_int8_t, ROM type (eprom/flash) */ 326#define GDT_BINFO_PROM_COUNT 0x43 /* u_int8_t, number of ROM devices */ 327#define GDT_BINFO_DUP_PRES 0x44 /* u_int32_t, duplexing module pres? */ 328#define GDT_BINFO_CHAN_PRES 0x48 /* u_int32_t, # of exp. channels */ 329#define GDT_BINFO_MEM_PRES 0x4c /* u_int32_t, memory expansion inst? */ 330#define GDT_BINFO_FT_BUS_SYSTEM 0x50 /* u_int8_t, fault bus supported? */ 331#define GDT_BINFO_SUBTYPE_VALID 0x51 /* u_int8_t, board_subtype valid */ 332#define GDT_BINFO_BOARD_SUBTYPE 0x52 /* u_int8_t, subtype/hardware level */ 333#define GDT_BINFO_RAMPAR_PRES 0x53 /* u_int8_t, RAM parity check hw? */ 334#define GDT_BINFO_SZ 0x54 335 336/* Get board features */ 337#define GDT_BFEAT_CHAINING 0x00 /* u_int8_t, chaining supported */ 338#define GDT_BFEAT_STRIPING 0x01 /* u_int8_t, striping (RAID-0) supp. */ 339#define GDT_BFEAT_MIRRORING 0x02 /* u_int8_t, mirroring (RAID-1) supp */ 340#define GDT_BFEAT_RAID 0x03 /* u_int8_t, RAID-4/5/10 supported */ 341#define GDT_BFEAT_SZ 0x04 342 343/* Other defines */ 344#define GDT_ASYNCINDEX 0 /* command index asynchronous event */ 345#define GDT_SPEZINDEX 1 /* command index unknown service */ 346 347/* Debugging */ 348#ifdef GDT_DEBUG 349#define GDT_D_INTR 0x01 350#define GDT_D_MISC 0x02 351#define GDT_D_CMD 0x04 352#define GDT_D_QUEUE 0x08 353#define GDT_D_TIMEOUT 0x10 354#define GDT_D_INIT 0x20 355#define GDT_D_INVALID 0x40 356#define GDT_D_DEBUG 0x80 357extern int gdt_debug; 358#ifdef __SERIAL__ 359extern int ser_printf(const char *fmt, ...); 360#define GDT_DPRINTF(mask, args) if (gdt_debug & (mask)) ser_printf args 361#else 362#define GDT_DPRINTF(mask, args) if (gdt_debug & (mask)) printf args 363#endif 364#else 365#define GDT_DPRINTF(mask, args) 366#endif 367 368/* Miscellaneous constants */ 369#define GDT_RETRIES 100000000 /* 100000 * 1us = 100s */ 370#define GDT_TIMEOUT 100000000 /* 100000 * 1us = 100s */ 371#define GDT_POLL_TIMEOUT 10000000 /* 10000 * 1us = 10s */ 372#define GDT_WATCH_TIMEOUT 10000000 /* 10000 * 1us = 10s */ 373#define GDT_SCRATCH_SZ 3072 /* 3KB scratch buffer */ 374
|