1 /* $OpenBSD: trm.h,v 1.3 2011/04/26 15:46:58 krw Exp $ 2 * ------------------------------------------------------------ 3 * O.S : OpenBSD 4 * File Name : trm.h 5 * Device Driver for Tekram DC395U/UW/F,DC315/U 6 * PCI SCSI Bus Master Host Adapter 7 * (SCSI chip set used Tekram ASIC TRM-S1040) 8 * 9 * (C)Copyright 1995-1999 Tekram Technology Co., Ltd. 10 * (C)Copyright 2001-2002 Ashley R. Martens and Kenneth R Westerback 11 * ------------------------------------------------------------ 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * ------------------------------------------------------------ 34 */ 35 36 #ifndef _TRM_H 37 #define _TRM_H 38 39 /* 40 * ------------------------------------------------------------ 41 * Segment Entry 42 * ------------------------------------------------------------ 43 */ 44 struct SGentry 45 { 46 u_int32_t address; 47 u_int32_t length; 48 }; 49 50 /* 51 * ----------------------------------------------------------------------- 52 * feature of chip set MAX value 53 * ----------------------------------------------------------------------- 54 */ 55 56 #define TRM_MAX_ADAPTER_NUM 4 57 #define TRM_MAX_TARGETS 16 58 #define TRM_MAX_LUNS 8 59 #define TRM_MAX_SG_LISTENTRY 32 60 #define TRM_MAX_CMD_PER_LUN 32 61 #define TRM_MAX_SRB_CNT TRM_MAX_CMD_PER_LUN*4 62 #define TRM_MAX_PHYSG_BYTE ((TRM_MAX_SG_LISTENTRY - 1) << PGSHIFT) 63 #define TRM_MAX_SYNC_OFFSET 15 64 #define TRM_SEL_TIMEOUT 153 /* 250 ms selection timeout (@40MHz) */ 65 66 /* 67 *----------------------------------------------------------------------- 68 * SCSI Request Block 69 *----------------------------------------------------------------------- 70 */ 71 struct trm_scsi_req_q 72 { 73 TAILQ_ENTRY(trm_scsi_req_q) link; 74 bus_dmamap_t dmamapxfer; 75 u_int32_t PhysSRB; 76 u_int32_t SRBTotalXferLength; 77 u_int32_t SRBSGPhyAddr; /* a segment starting address */ 78 79 u_int16_t SRBState; /* State machine */ 80 #define TRM_FREE 0x0000 81 #define TRM_WAIT 0x0001 82 #define TRM_READY 0x0002 83 #define TRM_MSGOUT 0x0004 /*arbitration+msg_out 1st byte */ 84 #define TRM_EXTEND_MSGIN 0x0010 85 #define TRM_COMMAND 0x0020 86 #define TRM_START 0x0040 /*arbitration+msg_out+command_out */ 87 #define TRM_DISCONNECTED 0x0080 88 #define TRM_DATA_XFER 0x0100 89 #define TRM_XFERPAD 0x0200 90 #define TRM_STATUS 0x0400 91 #define TRM_COMPLETED 0x0800 92 #define TRM_ABORT_SENT 0x1000 93 #define TRM_UNEXPECT_RESEL 0x8000 94 95 u_int8_t AdaptStatus; 96 #define TRM_STATUS_GOOD 0x00 97 #define TRM_SELECTION_TIMED_OUT 0x11 98 #define TRM_OVER_UNDER_RUN 0x12 99 #define TRM_UNEXP_BUS_FREE 0x13 100 #define TRM_TARGET_PHASE_F 0x14 101 #define TRM_INVALID_CCB_OP 0x16 102 #define TRM_LINK_CCB_BAD 0x17 103 #define TRM_BAD_TARGET_DIR 0x18 104 #define TRM_DUPLICATE_CCB 0x19 105 #define TRM_BAD_CCB_OR_SG 0x1A 106 #define TRM_ABORT 0xFF 107 108 u_int8_t CmdBlock[16]; 109 110 u_int8_t ScsiCmdLen; 111 u_int8_t ScsiPhase; 112 113 u_int8_t SRBFlag; 114 #define TRM_AUTO_REQSENSE 0x01 115 #define TRM_SCSI_TIMED_OUT 0x02 116 #define TRM_PARITY_ERROR 0x04 117 #define TRM_ON_GOING_SRB 0x08 118 #define TRM_ON_WAITING_SRB 0x10 119 120 u_int8_t SRBSGCount; 121 u_int8_t SRBSGIndex; 122 u_int8_t TagNumber; 123 #define TRM_NO_TAG 0x00 124 125 u_int8_t TargetStatus; /* SCSI status codes + Tekram: */ 126 #define TRM_SCSI_UNEXP_BUS_FREE 0xFD /* Unexpect Bus Free */ 127 #define TRM_SCSI_BUS_RST_DETECTED 0xFE /* Scsi Bus Reset detected */ 128 #define TRM_SCSI_SELECT_TIMEOUT 0xFF /* Selection Time out */ 129 130 struct trm_dcb *pSRBDCB; 131 132 struct SGentry SegmentX[TRM_MAX_SG_LISTENTRY]; 133 134 struct scsi_xfer *xs; 135 136 struct scsi_sense_data scsisense; 137 u_int32_t scsisensePhyAddr; 138 }; 139 140 TAILQ_HEAD(SRB_HEAD, trm_scsi_req_q); 141 142 /* 143 *----------------------------------------------------------------------- 144 * Device Control Block 145 *----------------------------------------------------------------------- 146 */ 147 struct trm_dcb 148 { 149 u_int32_t TagMask; 150 151 u_int16_t DCBFlag; 152 #define TRM_WIDE_NEGO_ENABLE 0x0001 153 #define TRM_DOING_WIDE_NEGO 0x0002 154 #define TRM_WIDE_NEGO_DONE 0x0004 155 #define TRM_SYNC_NEGO_ENABLE 0x0008 156 #define TRM_DOING_SYNC_NEGO 0x0010 157 #define TRM_USE_TAG_QUEUING 0x0020 158 #define TRM_QUEUE_FULL 0x0040 159 #define TRM_WIDE_NEGO_16BIT 0x0080 160 #define TRM_QUIRKS_VALID 0x0100 161 #define TRM_BAD_DCB 0x0200 162 163 u_int8_t DevMode; /* trm_target_nvram.NvmTarCfg0 */ 164 165 u_int8_t MaxNegoPeriod; /* Maximum allow sync period */ 166 u_int8_t SyncPeriod; /* Current sync period */ 167 u_int8_t SyncOffset; /* Current sync offset */ 168 169 u_int8_t target; /* SCSI Target ID */ 170 u_int8_t lun; /* SCSI Logical Unit Number */ 171 172 u_int8_t IdentifyMsg; 173 174 struct scsi_link *sc_link; 175 struct trm_scsi_req_q *pActiveSRB; 176 }; 177 178 /* 179 *----------------------------------------------------------------------- 180 * Adapter Control Block 181 *----------------------------------------------------------------------- 182 */ 183 struct trm_softc 184 { 185 struct device sc_device; 186 187 bus_space_handle_t sc_iohandle; 188 bus_space_tag_t sc_iotag; 189 bus_dma_tag_t sc_dmatag; 190 bus_dmamap_t sc_dmamap_control; /* map the control structures */ 191 192 u_int16_t sc_AdapterUnit; /* nth Adapter this driver */ 193 194 u_int8_t sc_AdaptSCSIID; /* Adapter SCSI Target ID */ 195 u_int8_t sc_TagMaxNum; 196 197 u_int8_t sc_config; 198 #define HCC_WIDE_CARD 0x20 199 #define HCC_SCSI_RESET 0x10 200 #define HCC_PARITY 0x08 201 #define HCC_AUTOTERM 0x04 202 #define HCC_LOW8TERM 0x02 203 #define HCC_UP8TERM 0x01 204 205 u_int8_t sc_Flag; 206 #define RESET_DEV 0x01 207 #define RESET_DETECT 0x02 208 #define RESET_DONE 0x04 209 210 u_int8_t MsgCnt; 211 u_int8_t MsgBuf[6]; 212 213 /* 214 *---------------------------------- 215 * Link to the generic SCSI driver 216 *---------------------------------- 217 */ 218 struct scsi_adapter sc_adapter; 219 struct scsi_link sc_link; 220 221 struct SRB_HEAD freeSRB; 222 struct SRB_HEAD goingSRB; 223 struct SRB_HEAD waitingSRB; 224 225 struct mutex sc_srb_mtx; 226 struct scsi_iopool sc_iopool; 227 228 struct trm_dcb *pActiveDCB; 229 struct trm_dcb *pDCB[TRM_MAX_TARGETS][TRM_MAX_LUNS]; 230 231 struct trm_scsi_req_q *SRB; 232 }; 233 234 /* 235 * The SEEPROM structure for TRM_S1040 236 */ 237 struct trm_target_nvram 238 { 239 u_int8_t NvmTarCfg0; /* Target configuration byte 0 */ 240 #define TRM_WIDE 0x20 /* Wide negotiate */ 241 #define TRM_TAG_QUEUING 0x10 /* Enable SCSI tag queuing */ 242 #define TRM_SEND_START 0x08 /* Send start command SPINUP */ 243 #define TRM_DISCONNECT 0x04 /* Enable SCSI disconnect */ 244 #define TRM_SYNC 0x02 /* Sync negotiation */ 245 #define TRM_PARITY 0x01 /* (it should be defined at NAC ) */ 246 247 u_int8_t NvmTarPeriod; /* Target period */ 248 u_int8_t NvmTarCfg2; /* Target configuration byte 2 */ 249 u_int8_t NvmTarCfg3; /* Target configuration byte 3 */ 250 }; 251 252 struct trm_adapter_nvram 253 { 254 u_int8_t NvramSubVendorID[2]; /*0,1 Sub Vendor ID */ 255 u_int8_t NvramSubSysID[2]; /*2,3 Sub System ID */ 256 u_int8_t NvramSubClass; /*4 Sub Class */ 257 u_int8_t NvramVendorID[2]; /*5,6 Vendor ID */ 258 u_int8_t NvramDeviceID[2]; /*7,8 Device ID */ 259 u_int8_t NvramReserved; /*9 Reserved */ 260 struct trm_target_nvram NvramTarget[TRM_MAX_TARGETS]; /* 10 */ 261 u_int8_t NvramScsiId; /*74 Host Adapter SCSI ID */ 262 u_int8_t NvramChannelCfg; /*75 Channel configuration */ 263 #define NAC_SCANLUN 0x20 /* Include LUN as BIOS device */ 264 #define NAC_POWERON_SCSI_RESET 0x04 /* Power on reset enable */ 265 #define NAC_GREATER_1G 0x02 /* > 1G support enable */ 266 #define NAC_GT2DRIVES 0x01 /* Support more than 2 drives */ 267 u_int8_t NvramDelayTime; /*76 Power on delay time */ 268 u_int8_t NvramMaxTag; /*77 Maximum tags */ 269 u_int8_t NvramReserved0; /*78 */ 270 u_int8_t NvramBootTarget; /*79 */ 271 u_int8_t NvramBootLun; /*80 */ 272 u_int8_t NvramReserved1; /*81 */ 273 u_int16_t Reserved[22]; /*82,..125 */ 274 u_int16_t NvramCheckSum; /*126,127 */ 275 }; 276 277 /* 278 * The PCI configuration register offsets for the TRM_S1040, and 279 * the associated bit definitions. 280 */ 281 282 #define TRM_S1040_ID 0x00 /* Vendor and Device ID */ 283 #define TRM_S1040_COMMAND 0x04 /* PCI command register */ 284 #define TRM_S1040_IOBASE 0x10 /* I/O Space base address */ 285 #define TRM_S1040_ROMBASE 0x30 /* Expansion ROM Base Address */ 286 #define TRM_S1040_INTLINE 0x3C /* Interrupt line */ 287 288 #define TRM_S1040_SCSI_STATUS 0x80 /* SCSI Status (R) */ 289 #define COMMANDPHASEDONE 0x2000 /* SCSI command phase done */ 290 #define SCSIXFERDONE 0x0800 /* SCSI SCSI transfer done */ 291 #define SCSIXFERCNT_2_ZERO 0x0100 /* SCSI SCSI transfer count to zero */ 292 #define SCSIINTERRUPT 0x0080 /* SCSI interrupt pending */ 293 #define COMMANDABORT 0x0040 /* SCSI command abort */ 294 #define SEQUENCERACTIVE 0x0020 /* SCSI sequencer active */ 295 #define PHASEMISMATCH 0x0010 /* SCSI phase mismatch */ 296 #define PARITYERROR 0x0008 /* SCSI parity error */ 297 #define PHASEMASK 0x0007 /* Phase MSG/CD/IO */ 298 #define PH_DATA_OUT 0x00 /* Data out phase */ 299 #define PH_DATA_IN 0x01 /* Data in phase */ 300 #define PH_COMMAND 0x02 /* Command phase */ 301 #define PH_STATUS 0x03 /* Status phase */ 302 #define PH_BUS_FREE 0x05 /* Invalid phase used as bus free */ 303 #define PH_MSG_OUT 0x06 /* Message out phase */ 304 #define PH_MSG_IN 0x07 /* Message in phase */ 305 #define TRM_S1040_SCSI_CONTROL 0x80 /* SCSI Control (W) */ 306 #define DO_CLRATN 0x0400 /* Clear ATN */ 307 #define DO_SETATN 0x0200 /* Set ATN */ 308 #define DO_CMDABORT 0x0100 /* Abort SCSI command */ 309 #define DO_RSTMODULE 0x0010 /* Reset SCSI chip */ 310 #define DO_RSTSCSI 0x0008 /* Reset SCSI bus */ 311 #define DO_CLRFIFO 0x0004 /* Clear SCSI transfer FIFO */ 312 #define DO_DATALATCH 0x0002 /* Enable SCSI bus data latch */ 313 #define DO_HWRESELECT 0x0001 /* Enable hardware reselection */ 314 #define TRM_S1040_SCSI_FIFOCNT 0x82 /* SCSI FIFO Counter 5bits(R) */ 315 #define TRM_S1040_SCSI_SIGNAL 0x83 /* SCSI low level signal (R/W) */ 316 #define TRM_S1040_SCSI_INTSTATUS 0x84 /* SCSI Interrupt Status (R) */ 317 #define INT_SCAM 0x80 /* SCAM selection interrupt */ 318 #define INT_SELECT 0x40 /* Selection interrupt */ 319 #define INT_SELTIMEOUT 0x20 /* Selection timeout interrupt */ 320 #define INT_DISCONNECT 0x10 /* Bus disconnected interrupt */ 321 #define INT_RESELECTED 0x08 /* Reselected interrupt */ 322 #define INT_SCSIRESET 0x04 /* SCSI reset detected interrupt */ 323 #define INT_BUSSERVICE 0x02 /* Bus service interrupt */ 324 #define INT_CMDDONE 0x01 /* SCSI command done interrupt */ 325 #define TRM_S1040_SCSI_OFFSET 0x84 /* SCSI Offset Count (W) */ 326 /* 327 * Bit Name Definition 328 * 07-05 0 RSVD Reversed. Always 0. 329 * 04 0 OFFSET4 Reversed for LVDS. Always 0. 330 * 03-00 0 OFFSET[03:00] Offset number from 0 to 15 331 */ 332 #define TRM_S1040_SCSI_SYNC 0x85 /* SCSI Synchronous Control (R/W) */ 333 #define LVDS_SYNC 0x20 /* Enable LVDS synchronous */ 334 #define WIDE_SYNC 0x10 /* Enable WIDE synchronous */ 335 #define ALT_SYNC 0x08 /* Enable Fast-20 alternate synchronous */ 336 /* 337 * SYNCM 7 6 5 4 3 2 1 0 338 * Name RSVD RSVD LVDS WIDE ALTPERD PERIOD2 PERIOD1 PERIOD0 339 * Default 0 0 0 0 0 0 0 0 340 * 341 * 342 * Bit Name Definition 343 * --- ---- ---------- 344 * 07-06 0 RSVD Reversed. Always read 0 345 * 05 0 LVDS Reversed. Always read 0 346 * 04 0 WIDE/WSCSI Enable wide (16-bits) SCSI transfer. 347 * 03 0 ALTPERD/ALTPD Alternate (Sync./Period) mode. 348 * 349 * @@ When this bit is set, 350 * the synchronous period bits 2:0 351 * in the Synchronous Mode register 352 * are used to transfer data 353 * at the Fast-20 rate. 354 * @@ When this bit is reset, 355 * the synchronous period bits 2:0 356 * in the Synchronous Mode Register 357 * are used to transfer data 358 * at the Fast-40 rate. 359 * 360 * 02-00 0 PERIOD[2:0]/SXPD[02:00] Synchronous SCSI Transfer Rate. 361 * These 3 bits specify 362 * the Synchronous SCSI Transfer Rate 363 * for Fast-20 and Fast-10. 364 * These bits are also reset 365 * by a SCSI Bus reset. 366 * 367 * For Fast-10 bit ALTPD = 0 and LVDS = 0 368 * and bit2,bit1,bit0 is defined as follows : 369 * 370 * 000 100ns, 10.0 Mbytes/s 371 * 001 150ns, 6.6 Mbytes/s 372 * 010 200ns, 5.0 Mbytes/s 373 * 011 250ns, 4.0 Mbytes/s 374 * 100 300ns, 3.3 Mbytes/s 375 * 101 350ns, 2.8 Mbytes/s 376 * 110 400ns, 2.5 Mbytes/s 377 * 111 450ns, 2.2 Mbytes/s 378 * 379 * For Fast-20 bit ALTPD = 1 and LVDS = 0 380 * and bit2,bit1,bit0 is defined as follows : 381 * 382 * 000 50ns, 20.0 Mbytes/s 383 * 001 75ns, 13.3 Mbytes/s 384 * 010 100ns, 10.0 Mbytes/s 385 * 011 125ns, 8.0 Mbytes/s 386 * 100 150ns, 6.6 Mbytes/s 387 * 101 175ns, 5.7 Mbytes/s 388 * 110 200ns, 5.0 Mbytes/s 389 * 111 250ns, 4.0 Mbytes/s 390 * 391 * For Fast-40 bit ALTPD = 0 and LVDS = 1 392 * and bit2,bit1,bit0 is defined as follows : 393 * 394 * 000 25ns, 40.0 Mbytes/s 395 * 001 50ns, 20.0 Mbytes/s 396 * 010 75ns, 13.3 Mbytes/s 397 * 011 100ns, 10.0 Mbytes/s 398 * 100 125ns, 8.0 Mbytes/s 399 * 101 150ns, 6.6 Mbytes/s 400 * 110 175ns, 5.7 Mbytes/s 401 * 111 200ns, 5.0 Mbytes/s 402 */ 403 #define TRM_S1040_SCSI_TARGETID 0x86 /* SCSI Target ID (R/W) */ 404 #define TRM_S1040_SCSI_IDMSG 0x87 /* SCSI Identify Message (R) */ 405 #define TRM_S1040_SCSI_HOSTID 0x87 /* SCSI Host ID (W) */ 406 #define TRM_S1040_SCSI_COUNTER 0x88 /* SCSI Transfer Counter 24bits(R/W) */ 407 #define TRM_S1040_SCSI_INTEN 0x8C /* SCSI Interrupt Enable (R/W) */ 408 #define EN_SCAM 0x80 /* Enable SCAM selection interrupt */ 409 #define EN_SELECT 0x40 /* Enable selection interrupt */ 410 #define EN_SELTIMEOUT 0x20 /* Enable selection timeout interrupt */ 411 #define EN_DISCONNECT 0x10 /* Enable bus disconnected interrupt */ 412 #define EN_RESELECTED 0x08 /* Enable reselected interrupt */ 413 #define EN_SCSIRESET 0x04 /* Enable SCSI reset detected interrupt*/ 414 #define EN_BUSSERVICE 0x02 /* Enable bus service interrupt */ 415 #define EN_CMDDONE 0x01 /* Enable SCSI command done interrupt */ 416 #define TRM_S1040_SCSI_CONFIG0 0x8D /* SCSI Configuration 0 (R/W) */ 417 #define PHASELATCH 0x40 /* Enable phase latch */ 418 #define INITIATOR 0x20 /* Enable initiator mode */ 419 #define PARITYCHECK 0x10 /* Enable parity check */ 420 #define BLOCKRST 0x01 /* Disable SCSI reset1 */ 421 #define TRM_S1040_SCSI_CONFIG1 0x8E /* SCSI Configuration 1 (R/W) */ 422 #define ACTIVE_NEGPLUS 0x10 /* Enhance active negation */ 423 #define FILTER_DISABLE 0x08 /* Disable SCSI data filter */ 424 #define ACTIVE_NEG 0x02 /* Enable active negation */ 425 #define TRM_S1040_SCSI_CONFIG2 0x8F /* SCSI Configuration 2 (R/W) */ 426 #define TRM_S1040_SCSI_COMMAND 0x90 /* SCSI Command (R/W) */ 427 #define SCMD_COMP 0x12 /* Command complete */ 428 #define SCMD_SEL_ATN 0x60 /* Selection with ATN */ 429 #define SCMD_SEL_ATN3 0x64 /* Selection with ATN3 */ 430 #define SCMD_SEL_ATNSTOP 0xB8 /* Selection with ATN and Stop */ 431 #define SCMD_FIFO_OUT 0xC0 /* SCSI FIFO transfer out */ 432 #define SCMD_DMA_OUT 0xC1 /* SCSI DMA transfer out */ 433 #define SCMD_FIFO_IN 0xC2 /* SCSI FIFO transfer in */ 434 #define SCMD_DMA_IN 0xC3 /* SCSI DMA transfer in */ 435 #define SCMD_MSGACCEPT 0xD8 /* Message accept */ 436 /* 437 * Code Command Description 438 * 439 * 02 Enable reselection with FIFO 440 * 40 Select without ATN with FIFO 441 * 60 Select with ATN with FIFO 442 * 64 Select with ATN3 with FIFO 443 * A0 Select with ATN and stop with FIFO 444 * C0 Transfer information out with FIFO 445 * C1 Transfer information out with DMA 446 * C2 Transfer information in with FIFO 447 * C3 Transfer information in with DMA 448 * 12 Initiator command complete with FIFO 449 * 50 Initiator transfer information out sequence without ATN with FIFO 450 * 70 Initiator transfer information out sequence with ATN with FIFO 451 * 74 Initiator transfer information out sequence with ATN3 with FIFO 452 * 52 Initiator transfer information in sequence without ATN with FIFO 453 * 72 Initiator transfer information in sequence with ATN with FIFO 454 * 76 Initiator transfer information in sequence with ATN3 with FIFO 455 * 90 Initiator transfer information out command complete with FIFO 456 * 92 Initiator transfer information in command complete with FIFO 457 * D2 Enable selection 458 * 08 Reselection 459 * 48 Disconnect command with FIFO 460 * 88 Terminate command with FIFO 461 * C8 Target command complete with FIFO 462 * 18 SCAM Arbitration/ Selection 463 * 5A Enable reselection 464 * 98 Select without ATN with FIFO 465 * B8 Select with ATN with FIFO 466 * D8 Message Accepted 467 * 58 NOP 468 */ 469 #define TRM_S1040_SCSI_TIMEOUT 0x91 /* SCSI Time Out Value (R/W) */ 470 #define TRM_S1040_SCSI_FIFO 0x98 /* SCSI FIFO (R/W) */ 471 #define TRM_S1040_SCSI_TCR0 0x9C /* SCSI Target Control 0 (R/W) */ 472 #define TCR0_WIDE_NEGO_DONE 0x8000 /* Wide nego done */ 473 #define TCR0_SYNC_NEGO_DONE 0x4000 /* Synchronous nego done */ 474 #define TCR0_ENABLE_LVDS 0x2000 /* Enable LVDS synchronous */ 475 #define TCR0_ENABLE_WIDE 0x1000 /* Enable WIDE synchronous */ 476 #define TCR0_ENABLE_ALT 0x0800 /* Enable alternate synchronous */ 477 #define TCR0_PERIOD_MASK 0x0700 /* Transfer rate */ 478 #define TCR0_DO_WIDE_NEGO 0x0080 /* Do wide NEGO */ 479 #define TCR0_DO_SYNC_NEGO 0x0040 /* Do sync NEGO */ 480 #define TCR0_DISCONNECT_EN 0x0020 /* Disconnection enable */ 481 #define TCR0_OFFSET_MASK 0x001F /* Offset number */ 482 #define TRM_S1040_SCSI_TCR1 0x9E /* SCSI Target Control 1 (R/W) */ 483 #define MAXTAG_MASK 0x7F00 /* Maximum tags (127) */ 484 #define NON_TAG_BUSY 0x0080 /* Non tag command active */ 485 #define ACTTAG_MASK 0x007F /* Active tags */ 486 487 #define TRM_S1040_DMA_COMMAND 0xA0 /* DMA Command (R/W) */ 488 #define XFERDATAIN 0x0103 /* Transfer data in */ 489 #define XFERDATAOUT 0x0102 /* Transfer data out */ 490 #define TRM_S1040_DMA_FIFOCNT 0xA1 /* DMA FIFO Counter (R) */ 491 #define TRM_S1040_DMA_CONTROL 0xA1 /* DMA Control (W) */ 492 #define STOPDMAXFER 0x08 /* Stop DMA transfer */ 493 #define ABORTXFER 0x04 /* Abort DMA transfer */ 494 #define CLRXFIFO 0x02 /* Clear DMA transfer FIFO */ 495 #define STARTDMAXFER 0x01 /* Start DMA transfer */ 496 #define TRM_S1040_DMA_STATUS 0xA3 /* DMA Interrupt Status (R/W) */ 497 #define XFERPENDING 0x80 /* Transfer pending */ 498 #define DMAXFERCOMP 0x02 /* Bus Master XFER Complete status */ 499 #define SCSICOMP 0x01 /* SCSI complete interrupt */ 500 #define TRM_S1040_DMA_INTEN 0xA4 /* DMA Interrupt Enable (R/W) */ 501 #define EN_SCSIINTR 0x01 /* Enable SCSI complete interrupt */ 502 #define TRM_S1040_DMA_CONFIG 0xA6 /* DMA Configuration (R/W) */ 503 #define DMA_ENHANCE 0x8000 /* Enable DMA enhance feature */ 504 #define TRM_S1040_DMA_XCNT 0xA8 /* DMA Transfer Counter (R/W) */ 505 #define TRM_S1040_DMA_CXCNT 0xAC /* DMA Current Transfer Counter (R) */ 506 #define TRM_S1040_DMA_XLOWADDR 0xB0 /* DMA Transfer Physical Low Address */ 507 #define TRM_S1040_DMA_XHIGHADDR 0xB4 /* DMA Transfer Physical High Address */ 508 509 #define TRM_S1040_GEN_CONTROL 0xD4 /* Global Control */ 510 #define EN_EEPROM 0x10 /* Enable EEPROM programming */ 511 #define AUTOTERM 0x04 /* Enable Auto SCSI terminator */ 512 #define LOW8TERM 0x02 /* Enable Lower 8 bit SCSI terminator */ 513 #define UP8TERM 0x01 /* Enable Upper 8 bit SCSI terminator */ 514 #define TRM_S1040_GEN_STATUS 0xD5 /* Global Status */ 515 #define GTIMEOUT 0x80 /* Global timer reach 0 */ 516 #define CON5068 0x10 /* External 50/68 pin connected */ 517 #define CON68 0x08 /* Internal 68 pin connected */ 518 #define CON50 0x04 /* Internal 50 pin connected */ 519 #define WIDESCSI 0x02 /* Wide SCSI card */ 520 #define TRM_S1040_GEN_NVRAM 0xD6 /* Serial NON-VOLATILE RAM port */ 521 #define NVR_BITOUT 0x08 /* Serial data out */ 522 #define NVR_BITIN 0x04 /* Serial data in */ 523 #define NVR_CLOCK 0x02 /* Serial clock */ 524 #define NVR_SELECT 0x01 /* Serial select */ 525 #define TRM_S1040_GEN_EDATA 0xD7 /* Parallel EEPROM data port */ 526 #define TRM_S1040_GEN_EADDRESS 0xD8 /* Parallel EEPROM address */ 527 #define TRM_S1040_GEN_TIMER 0xDB /* Global timer */ 528 529 int trm_Interrupt(void *); 530 int trm_init(struct trm_softc *, int); 531 532 #endif /* trm_h */ 533