2 * Aic7xxx register and scratch ram definitions.
4 * Copyright (c) 1994-2001 Justin T. Gibbs.
5 * Copyright (c) 2000-2001 Adaptec Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,
13 * without modification.
14 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15 * substantially similar to the "NO WARRANTY" disclaimer below
16 * ("Disclaimer") and any redistribution must be conditioned upon
17 * including a substantially similar Disclaimer requirement for further
18 * binary redistribution.
19 * 3. Neither the names of the above-listed copyright holders nor the names
20 * of any contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * Alternatively, this software may be distributed under the terms of the
24 * GNU General Public License ("GPL") version 2 as published by the Free
25 * Software Foundation.
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES.
42 VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $"
45 * This file is processed by the aic7xxx_asm utility for use in assembling
46 * firmware for the aic7xxx family of SCSI host adapters as well as to generate
47 * a C header file for use in the kernel portion of the Aic7xxx driver.
49 * All page numbers refer to the Adaptec AIC-7770 Data Book available from
50 * Adaptec's Technical Documents Department 1-800-934-2766
54 * Registers marked "dont_generate_debug_code" are not (yet) referenced
55 * from the driver code, and this keyword inhibit generation
56 * of debug code for them.
58 * REG_PRETTY_PRINT config will complain if dont_generate_debug_code
59 * is added to the register which is referenced in the driver.
60 * Unreferenced register with no dont_generate_debug_code will result
61 * in dead code. No warning is issued.
65 * SCSI Sequence Control (p. 3-11).
66 * Each bit, when set starts a specific SCSI sequence on the bus
82 * SCSI Transfer Control 0 Register (pp. 3-13).
83 * Controls the SCSI module data path.
98 * SCSI Transfer Control 1 Register (pp. 3-14,15).
99 * Controls the SCSI module data path.
110 field STPWEN 0x01 /* Powered Termination */
111 dont_generate_debug_code
115 * SCSI Control Signal Read Register (p. 3-15).
116 * Reads the actual state of the SCSI bus pins
130 * Possible phases in SCSISIGI
132 mask PHASE_MASK CDI|IOI|MSGI
135 mask P_DATAOUT_DT P_DATAOUT|MSGI
136 mask P_DATAIN_DT P_DATAIN|MSGI
138 mask P_MESGOUT CDI|MSGI
139 mask P_STATUS CDI|IOI
140 mask P_MESGIN CDI|IOI|MSGI
144 * SCSI Control Signal Write Register (p. 3-16).
145 * Writing to this register modifies the control signals on the bus. Only
146 * those signals that are allowed in the current mode (Initiator/Target) are
161 * Possible phases to write into SCSISIG0
163 mask PHASE_MASK CDI|IOI|MSGI
167 mask P_MESGOUT CDI|MSGI
168 mask P_STATUS CDI|IOI
169 mask P_MESGIN CDI|IOI|MSGI
170 dont_generate_debug_code
174 * SCSI Rate Control (p. 3-17).
175 * Contents of this register determine the Synchronous SCSI data transfer
176 * rate and the maximum synchronous Req/Ack offset. An offset of 0 in the
177 * SOFS (3:0) bits disables synchronous data transfers. Any offset value
178 * greater than 0 enables synchronous transfers.
183 field WIDEXFER 0x80 /* Wide transfer control */
184 field ENABLE_CRC 0x40 /* CRC for D-Phases */
185 field SINGLE_EDGE 0x10 /* Disable DT Transfers */
186 mask SXFR 0x70 /* Sync transfer rate */
187 mask SXFR_ULTRA2 0x0f /* Sync transfer rate */
188 mask SOFS 0x0f /* Sync offset */
193 * Contains the ID of the board and the current target on the
199 mask TID 0xf0 /* Target ID mask */
201 field TWIN_CHNLB 0x80
202 mask OID 0x0f /* Our ID mask */
204 * SCSI Maximum Offset (p. 4-61 aic7890/91 Data Book)
205 * The aic7890/91 allow an offset of up to 127 transfers in both wide
209 mask SOFS_ULTRA2 0x7f /* Sync offset U2 chips */
210 dont_generate_debug_code
214 * SCSI Latched Data (p. 3-19).
215 * Read/Write latches used to transfer data on the SCSI bus during
216 * Automatic or Manual PIO mode. SCSIDATH can be used for the
217 * upper byte of a 16bit wide asynchronouse data phase transfer.
222 dont_generate_debug_code
231 * SCSI Transfer Count (pp. 3-19,20)
232 * These registers count down the number of bytes transferred
233 * across the SCSI bus. The counter is decremented only once
234 * the data has been safely transferred. SDONE in SSTAT0 is
235 * set when STCNT goes to 0
241 dont_generate_debug_code
244 /* ALT_MODE registers (Ultra2 and Ultra160 chips) */
248 field AUTORSTDIS 0x10
250 mask ASYNC_SETUP 0x07
253 /* ALT_MODE register on Ultra160 chips */
254 register OPTIONMODE {
258 field AUTORATEEN 0x80
260 field ATNMGMNTEN 0x20
261 field BUSFREEREV 0x10
262 field EXPPHASEDIS 0x08
263 field SCSIDATL_IMGEN 0x04
264 field AUTO_MSGOUT_DE 0x02
265 field DIS_MSGIN_DUALEDGE 0x01
266 mask OPTIONMODE_DEFAULTS AUTO_MSGOUT_DE|DIS_MSGIN_DUALEDGE
267 dont_generate_debug_code
270 /* ALT_MODE register on Ultra160 chips */
271 register TARGCRCCNT {
276 dont_generate_debug_code
280 * Clear SCSI Interrupt 0 (p. 3-20)
281 * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0.
288 field CLRSELINGO 0x10
290 field CLRIOERR 0x08 /* Ultra2 Only */
291 field CLRSPIORDY 0x02
292 dont_generate_debug_code
296 * SCSI Status 0 (p. 3-21)
297 * Contains one set of SCSI Interrupt codes
298 * These are most likely of interest to the sequencer
303 field TARGET 0x80 /* Board acting as target */
304 field SELDO 0x40 /* Selection Done */
305 field SELDI 0x20 /* Board has been selected */
306 field SELINGO 0x10 /* Selection In Progress */
307 field SWRAP 0x08 /* 24bit counter wrap */
308 field IOERR 0x08 /* LVD Tranceiver mode changed */
309 field SDONE 0x04 /* STCNT = 0x000000 */
310 field SPIORDY 0x02 /* SCSI PIO Ready */
311 field DMADONE 0x01 /* DMA transfer completed */
315 * Clear SCSI Interrupt 1 (p. 3-23)
316 * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
321 field CLRSELTIMEO 0x80
323 field CLRSCSIRSTI 0x20
324 field CLRBUSFREE 0x08
325 field CLRSCSIPERR 0x04
326 field CLRPHASECHG 0x02
327 field CLRREQINIT 0x01
328 dont_generate_debug_code
332 * SCSI Status 1 (p. 3-24)
348 * SCSI Status 2 (pp. 3-25,26)
354 field SHVALID 0x40 /* Shadow Layer non-zero */
355 field EXP_ACTIVE 0x10 /* SCSI Expander Active */
356 field CRCVALERR 0x08 /* CRC doesn't match (U3 only) */
357 field CRCENDERR 0x04 /* No terminal CRC packet (U3 only) */
358 field CRCREQERR 0x02 /* Illegal CRC packet req (U3 only) */
359 field DUAL_EDGE_ERR 0x01 /* Incorrect data phase (U3 only) */
364 * SCSI Status 3 (p. 3-26)
376 * SCSI ID for the aic7890/91 chips
378 register SCSIID_ULTRA2 {
381 mask TID 0xf0 /* Target ID mask */
382 mask OID 0x0f /* Our ID mask */
383 dont_generate_debug_code
387 * SCSI Interrupt Mode 1 (p. 3-28)
388 * Setting any bit will enable the corresponding function
389 * in SIMODE0 to interrupt via the IRQ pin.
399 field ENIOERR 0x08 /* LVD Tranceiver mode changes */
406 * SCSI Interrupt Mode 1 (pp. 3-28,29)
407 * Setting any bit will enable the corresponding function
408 * in SIMODE1 to interrupt via the IRQ pin.
416 field ENPHASEMIS 0x10
418 field ENSCSIPERR 0x04
419 field ENPHASECHG 0x02
424 * SCSI Data Bus (High) (p. 3-29)
425 * This register reads data on the SCSI Data bus directly.
438 * SCSI/Host Address (p. 3-30)
439 * These registers hold the host address for the byte about to be
440 * transferred on the SCSI bus. They are counted up in the same
441 * manner as STCNT is counted down. SHADDR should always be used
442 * to determine the address of the last byte transferred since HADDR
443 * can be skewed by write ahead.
449 dont_generate_debug_code
453 * Selection Timeout Timer (p. 3-30)
466 dont_generate_debug_code
470 * Selection/Reselection ID (p. 3-31)
471 * Upper four bits are the device id. The ONEBIT is set when the re/selecting
472 * device did not set its own ID.
479 dont_generate_debug_code
485 field ENSCAMSELO 0x80
486 field CLRSCAMSELID 0x40
493 * Target Mode Selecting in ID bitmask (aic7890/91/96/97)
500 dont_generate_debug_code
504 * Serial Port I/O Cabability register (p. 4-95 aic7860 Data Book)
505 * Indicates if external logic has been attached to the chip to
506 * perform the tasks of accessing a serial eeprom, testing termination
507 * strength, and performing cable detection. On the aic7860, most of
508 * these features are handled on chip, but on the aic7855 an attached
509 * aic3800 does the grunt work.
518 field EXT_BRDCTL 0x10 /* External Board control */
519 field SEEPROM 0x08 /* External serial eeprom logic */
520 field EEPROM 0x04 /* Writable external BIOS ROM */
521 field ROM 0x02 /* Logic for accessing external ROM */
522 field SSPIOCPS 0x01 /* Termination and cable detection */
523 dont_generate_debug_code
537 /* 7890 Definitions */
541 field BRDRW_ULTRA2 0x02
542 field BRDSTB_ULTRA2 0x01
543 dont_generate_debug_code
547 * Serial EEPROM Control (p. 4-92 in 7870 Databook)
548 * Controls the reading and writing of an external serial 1-bit
549 * EEPROM Device. In order to access the serial EEPROM, you must
550 * first set the SEEMS bit that generates a request to the memory
551 * port for access to the serial EEPROM device. When the memory
552 * port is not busy servicing another request, it reconfigures
553 * to allow access to the serial EEPROM. When this happens, SEERDY
554 * gets set high to verify that the memory port access has been
557 * After successful arbitration for the memory port, the SEECS bit of
558 * the SEECTL register is connected to the chip select. The SEECK,
559 * SEEDO, and SEEDI are connected to the clock, data out, and data in
560 * lines respectively. The SEERDY bit of SEECTL is useful in that it
561 * gives us an 800 nsec timer. After a write to the SEECTL register,
562 * the SEERDY goes high 800 nsec later. The one exception to this is
563 * when we first request access to the memory port. The SEERDY goes
564 * high to signify that access has been granted and, for this case, has
567 * See 93cx6.c for detailed information on the protocol necessary to
568 * read the serial EEPROM.
581 dont_generate_debug_code
584 * SCSI Block Control (p. 3-32)
585 * Controls Bus type and channel selection. In a twin channel configuration
586 * addresses 0x00-0x1e are gated to the appropriate channel based on this
587 * register. SELWIDE allows for the coexistence of 8bit and 16bit devices
593 field DIAGLEDEN 0x80 /* Aic78X0 only */
594 field DIAGLEDON 0x40 /* Aic78X0 only */
595 field AUTOFLUSHDIS 0x20
597 field ENAB40 0x08 /* LVD transceiver active */
598 field ENAB20 0x04 /* SE/HVD transceiver active */
600 field XCVR 0x01 /* External transceiver active */
604 * Sequencer Control (p. 3-33)
605 * Error detection mode and speed configuration
615 field BRKADRINTEN 0x08
622 * Sequencer RAM Data (p. 3-34)
623 * Single byte window into the Scratch Ram area starting at the address
624 * specified by SEQADDR0 and SEQADDR1. To write a full word, simply write
625 * four bytes in succession. The SEQADDRs will increment after the most
626 * significant byte is written
632 dont_generate_debug_code
636 * Sequencer Address Registers (p. 3-35)
637 * Only the first bit of SEQADDR1 holds addressing information
642 dont_generate_debug_code
649 mask SEQADDR1_MASK 0x01
650 dont_generate_debug_code
655 * We cheat by passing arguments in the Accumulator up to the kernel driver
661 dont_generate_debug_code
668 dont_generate_debug_code
674 dont_generate_debug_code
681 dont_generate_debug_code
688 dont_generate_debug_code
695 dont_generate_debug_code
704 dont_generate_debug_code
710 dont_generate_debug_code
716 dont_generate_debug_code
728 dont_generate_debug_code
734 * Board Control (p. 3-43)
744 * On the aic78X0 chips, Board Control is replaced by the DSCommand
747 register DSCOMMAND0 {
751 field CACHETHEN 0x80 /* Cache Threshold enable */
752 field DPARCKEN 0x40 /* Data Parity Check Enable */
753 field MPARCKEN 0x20 /* Memory Parity Check Enable */
754 field EXTREQLCK 0x10 /* External Request Lock */
755 /* aic7890/91/96/97 only */
756 field INTSCBRAMSEL 0x08 /* Internal SCB RAM Select */
757 field RAMPS 0x04 /* External SCB RAM Present */
758 field USCBSIZE32 0x02 /* Use 32byte SCB Page Size */
759 field CIOPARCKEN 0x01 /* Internal bus parity error enable */
760 dont_generate_debug_code
763 register DSCOMMAND1 {
766 mask DSLATT 0xfc /* PCI latency timer (non-ultra2) */
767 field HADDLDSEL1 0x02 /* Host Address Load Select Bits */
768 field HADDLDSEL0 0x01
769 dont_generate_debug_code
773 * Bus On/Off Time (p. 3-44) aic7770 only
781 dont_generate_debug_code
785 * Bus Speed (p. 3-45) aic7770 only
794 mask DFTHRSH_100 0xc0
796 dont_generate_debug_code
799 /* aic7850/55/60/70/80/95 only */
800 register DSPCISTATUS {
803 mask DFTHRSH_100 0xc0
804 dont_generate_debug_code
807 /* aic7890/91/96/97 only */
808 register HS_MAILBOX {
810 mask HOST_MAILBOX 0xF0
811 mask SEQ_MAILBOX 0x0F
812 mask HOST_TQINPOS 0x80 /* Boundary at either 0 or 128 */
813 dont_generate_debug_code
816 const HOST_MAILBOX_SHIFT 4
817 const SEQ_MAILBOX_SHIFT 0
820 * Host Control (p. 3-47) R/W
821 * Overall host control of the device.
833 field CHIPRSTACK 0x01
834 dont_generate_debug_code
838 * Host Address (p. 3-48)
839 * This register contains the address of the byte about
840 * to be transferred across the host bus.
846 dont_generate_debug_code
853 dont_generate_debug_code
857 * SCB Pointer (p. 3-49)
858 * Gate one of the SCBs into the SCBARRAY window.
863 dont_generate_debug_code
867 * Interrupt Status (p. 3-50)
868 * Status for system interrupts
877 mask BAD_PHASE SEQINT /* unknown scsi bus phase */
878 mask SEND_REJECT 0x10|SEQINT /* sending a message reject */
879 mask PROTO_VIOLATION 0x20|SEQINT /* SCSI protocol violation */
880 mask NO_MATCH 0x30|SEQINT /* no cmd match for reconnect */
881 mask IGN_WIDE_RES 0x40|SEQINT /* Complex IGN Wide Res Msg */
882 mask PDATA_REINIT 0x50|SEQINT /*
883 * Returned to data phase
885 * transfer pointers to be
886 * recalculated from the
889 mask HOST_MSG_LOOP 0x60|SEQINT /*
890 * The bus is ready for the
891 * host to perform another
892 * message transaction. This
893 * mechanism is used for things
894 * like sync/wide negotiation
895 * that require a kernel based
896 * message state engine.
898 mask BAD_STATUS 0x70|SEQINT /* Bad status from target */
899 mask PERR_DETECTED 0x80|SEQINT /*
900 * Either the phase_lock
901 * or inb_next routine has
902 * noticed a parity error.
904 mask DATA_OVERRUN 0x90|SEQINT /*
905 * Target attempted to write
906 * beyond the bounds of its
909 mask MKMSG_FAILED 0xa0|SEQINT /*
910 * Target completed command
911 * without honoring our ATN
912 * request to issue a message.
914 mask MISSED_BUSFREE 0xb0|SEQINT /*
915 * The sequencer never saw
916 * the bus go free after
917 * either a command complete
918 * or disconnect message.
920 mask SCB_MISMATCH 0xc0|SEQINT /*
921 * Downloaded SCB's tag does
922 * not match the entry we
923 * intended to download.
925 mask NO_FREE_SCB 0xd0|SEQINT /*
926 * get_free_or_disc_scb failed.
928 mask OUT_OF_RANGE 0xe0|SEQINT
930 mask SEQINT_MASK 0xf0|SEQINT /* SEQINT Status Codes */
931 mask INT_PEND (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT)
932 dont_generate_debug_code
936 * Hard Error (p. 3-53)
937 * Reporting of catastrophic errors. You usually cannot recover from
938 * these without a full board reset.
944 field CIOPARERR 0x80 /* Ultra2 only */
945 field PCIERRSTAT 0x40 /* PCI only */
946 field MPARERR 0x20 /* PCI only */
947 field DPARERR 0x10 /* PCI only */
955 * Clear Interrupt Status (p. 3-52)
961 field CLRPARERR 0x10 /* PCI only */
962 field CLRBRKADRINT 0x08
963 field CLRSCSIINT 0x04
966 dont_generate_debug_code
972 field PRELOADEN 0x80 /* aic7890 only */
987 field PRELOAD_AVAIL 0x80
989 field FIFOQWDEMP 0x20
1000 dont_generate_debug_code
1011 dont_generate_debug_code
1015 * SCB Auto Increment (p. 3-59)
1016 * Byte offset into the SCB Array and an optional bit to allow auto
1017 * incrementing of the address during download and upload operations
1024 mask SCBCNT_MASK 0x1f
1025 dont_generate_debug_code
1029 * Queue In FIFO (p. 3-60)
1030 * Input queue for queued SCBs (commands that the seqencer has yet to start)
1036 dont_generate_debug_code
1040 * Queue In Count (p. 3-60)
1041 * Number of queued SCBs
1049 * Queue Out FIFO (p. 3-61)
1050 * Queue of SCBs that have completed and await the host
1056 dont_generate_debug_code
1059 register CRCCONTROL1 {
1063 field CRCONSEEN 0x80
1064 field CRCVALCHKEN 0x40
1065 field CRCENDCHKEN 0x20
1066 field CRCREQCHKEN 0x10
1067 field TARGCRCENDEN 0x08
1068 field TARGCRCCNTEN 0x04
1069 dont_generate_debug_code
1074 * Queue Out Count (p. 3-61)
1075 * Number of queued SCBs in the Out FIFO
1082 register SCSIPHASE {
1085 field STATUS_PHASE 0x20
1086 field COMMAND_PHASE 0x10
1087 field MSG_IN_PHASE 0x08
1088 field MSG_OUT_PHASE 0x04
1089 field DATA_IN_PHASE 0x02
1090 field DATA_OUT_PHASE 0x01
1091 mask DATA_PHASE_MASK 0x03
1102 dont_generate_debug_code
1106 * SCB Definition (p. 5-4)
1114 alias SCB_RESIDUAL_DATACNT
1116 dont_generate_debug_code
1118 SCB_RESIDUAL_SGPTR {
1120 dont_generate_debug_code
1124 dont_generate_debug_code
1128 dont_generate_debug_code
1130 SCB_TARGET_DATA_DIR {
1132 dont_generate_debug_code
1136 dont_generate_debug_code
1140 dont_generate_debug_code
1144 * The last byte is really the high address bits for
1148 field SG_LAST_SEG 0x80 /* In the fourth byte */
1149 mask SG_HIGH_ADDR_BITS 0x7F /* In the fourth byte */
1150 dont_generate_debug_code
1154 field SG_RESID_VALID 0x04 /* In the first byte */
1155 field SG_FULL_RESID 0x02 /* In the first byte */
1156 field SG_LIST_NULL 0x01 /* In the first byte */
1157 dont_generate_debug_code
1161 field TARGET_SCB 0x80
1162 field STATUS_RCVD 0x80
1165 field MK_MESSAGE 0x10
1167 field DISCONNECTED 0x04
1168 mask SCB_TAG_TYPE 0x03
1172 field TWIN_CHNLB 0x80
1178 field SCB_XFERLEN_ODD 0x80
1187 dont_generate_debug_code
1191 dont_generate_debug_code
1196 dont_generate_debug_code
1200 dont_generate_debug_code
1207 dont_generate_debug_code
1211 const SCB_UPLOAD_SIZE 32
1212 const SCB_DOWNLOAD_SIZE 32
1213 const SCB_DOWNLOAD_SIZE_64 48
1215 const SG_SIZEOF 0x08 /* sizeof(struct ahc_dma) */
1217 /* --------------------- AHA-2840-only definitions -------------------- */
1219 register SEECTL_2840 {
1226 dont_generate_debug_code
1229 register STATUS_2840 {
1233 field EEPROM_TF 0x80
1237 dont_generate_debug_code
1240 /* --------------------- AIC-7870-only definitions -------------------- */
1245 dont_generate_debug_code
1250 dont_generate_debug_code
1255 dont_generate_debug_code
1260 dont_generate_debug_code
1267 field SG_FETCH_NEEDED 0x02 /* Bit used for software state */
1268 field CCSGRESET 0x01
1269 dont_generate_debug_code
1275 dont_generate_debug_code
1280 field CCSCBDONE 0x80
1281 field ARRDONE 0x40 /* SCB Array prefetch done */
1285 field CCSCBRESET 0x01
1286 dont_generate_debug_code
1289 register CCSCBADDR {
1291 dont_generate_debug_code
1296 dont_generate_debug_code
1300 * SCB bank address (7895/7896/97 only)
1306 dont_generate_debug_code
1311 dont_generate_debug_code
1314 register HNSCB_QOFF {
1317 dont_generate_debug_code
1320 register SNSCB_QOFF {
1322 dont_generate_debug_code
1325 register SDSCB_QOFF {
1327 dont_generate_debug_code
1330 register QOFF_CTLSTA {
1332 field SCB_AVAIL 0x40
1333 field SNSCB_ROLLOVER 0x20
1334 field SDSCB_ROLLOVER 0x10
1336 mask SCB_QSIZE_256 0x06
1337 dont_generate_debug_code
1340 register DFF_THRSH {
1342 mask WR_DFTHRSH 0x70
1343 mask RD_DFTHRSH 0x07
1344 mask RD_DFTHRSH_MIN 0x00
1345 mask RD_DFTHRSH_25 0x01
1346 mask RD_DFTHRSH_50 0x02
1347 mask RD_DFTHRSH_63 0x03
1348 mask RD_DFTHRSH_75 0x04
1349 mask RD_DFTHRSH_85 0x05
1350 mask RD_DFTHRSH_90 0x06
1351 mask RD_DFTHRSH_MAX 0x07
1352 mask WR_DFTHRSH_MIN 0x00
1353 mask WR_DFTHRSH_25 0x10
1354 mask WR_DFTHRSH_50 0x20
1355 mask WR_DFTHRSH_63 0x30
1356 mask WR_DFTHRSH_75 0x40
1357 mask WR_DFTHRSH_85 0x50
1358 mask WR_DFTHRSH_90 0x60
1359 mask WR_DFTHRSH_MAX 0x70
1361 dont_generate_debug_code
1364 register SG_CACHE_PRE {
1367 mask SG_ADDR_MASK 0xf8
1369 field LAST_SEG_DONE 0x01
1370 dont_generate_debug_code
1373 register SG_CACHE_SHADOW {
1376 mask SG_ADDR_MASK 0xf8
1378 field LAST_SEG_DONE 0x01
1379 dont_generate_debug_code
1381 /* ---------------------- Scratch RAM Offsets ------------------------- */
1382 /* These offsets are either to values that are initialized by the board's
1383 * BIOS or are specified by the sequencer code.
1385 * The host adapter card (at least the BIOS) uses 20-2f for SCSI
1386 * device information, 32-33 and 5a-5f as well. As it turns out, the
1387 * BIOS trashes 20-2f, writing the synchronous negotiation results
1388 * on top of the BIOS values, so we re-use those for our per-target
1389 * scratchspace (actually a value that can be copied directly into
1390 * SCSIRATE). The kernel driver will enable synchronous negotiation
1391 * for all targets that have a value other than 0 in the lower four
1392 * bits of the target scratch space. This should work regardless of
1393 * whether the bios has been installed.
1401 * 1 byte per target starting at this address for configuration values
1406 dont_generate_debug_code
1409 * Bit vector of targets that have ULTRA enabled as set by
1410 * the BIOS. The Sequencer relies on a per-SCB field to
1411 * control whether to enable Ultra transfers or not. During
1412 * initialization, we read this field and reuse it for 2
1413 * entries in the busy target table.
1419 dont_generate_debug_code
1422 * Bit vector of targets that have disconnection disabled as set by
1423 * the BIOS. The Sequencer relies in a per-SCB field to control the
1424 * disconnect priveldge. During initialization, we read this field
1425 * and reuse it for 2 entries in the busy target table.
1430 dont_generate_debug_code
1432 CMDSIZE_TABLE_TAIL {
1436 * Partial transfer past cacheline end to be
1437 * transferred using an extra S/G.
1441 dont_generate_debug_code
1444 * SCBID of the next SCB to be started by the controller.
1448 dont_generate_debug_code
1451 * Single byte buffer used to designate the type or message
1452 * to send to a target.
1456 dont_generate_debug_code
1458 /* Parameters for DMA Logic */
1462 field PRELOADEN 0x80
1466 field SDMAENACK 0x10
1468 field HDMAENACK 0x08
1469 field DIRECTION 0x04 /* Set indicates PCI->SCSI */
1470 field FIFOFLUSH 0x02
1471 field FIFORESET 0x01
1472 dont_generate_debug_code
1476 field NOT_IDENTIFIED 0x80
1477 field NO_CDB_SENT 0x40
1478 field TARGET_CMD_IS_TAGGED 0x40
1481 field TARG_CMD_PENDING 0x10
1482 field CMDPHASE_PENDING 0x08
1483 field DPHASE_PENDING 0x04
1484 field SPHASE_PENDING 0x02
1485 field NO_DISCONNECT 0x01
1488 * Temporary storage for the
1489 * target/channel/lun of a
1490 * reconnecting target
1494 dont_generate_debug_code
1498 dont_generate_debug_code
1501 * The last bus phase as seen by the sequencer.
1508 mask PHASE_MASK CDI|IOI|MSGI
1512 mask P_MESGOUT CDI|MSGI
1513 mask P_STATUS CDI|IOI
1514 mask P_MESGIN CDI|IOI|MSGI
1518 * head of list of SCBs awaiting
1523 dont_generate_debug_code
1526 * head of list of SCBs that are
1527 * disconnected. Used for SCB
1532 dont_generate_debug_code
1535 * head of list of SCBs that are
1536 * not in use. Used for SCB paging.
1540 dont_generate_debug_code
1543 * head of list of SCBs that have
1544 * completed but have not been
1545 * put into the qoutfifo.
1551 * Address of the hardware scb array in the host.
1555 dont_generate_debug_code
1558 * Base address of our shared data with the kernel driver in host
1559 * memory. This includes the qoutfifo and target mode
1560 * incoming command queue.
1564 dont_generate_debug_code
1568 dont_generate_debug_code
1572 dont_generate_debug_code
1576 dont_generate_debug_code
1579 * Kernel and sequencer offsets into the queue of
1580 * incoming target mode command descriptors. The
1581 * queue is full when the KERNEL_TQINPOS == TQINPOS.
1585 dont_generate_debug_code
1589 dont_generate_debug_code
1595 mask SEND_SENSE 0x40
1597 mask MSGOUT_PHASEMIS 0x10
1598 mask EXIT_MSG_LOOP 0x08
1599 mask CONT_MSG_LOOP 0x04
1600 mask CONT_TARG_SESSION 0x02
1602 dont_generate_debug_code
1607 dont_generate_debug_code
1611 * Snapshot of MSG_OUT taken after each message is sent.
1615 alias TARG_IMMEDIATE_SCB
1616 dont_generate_debug_code
1620 * Sequences the kernel driver has okayed for us. This allows
1621 * the driver to do things like prevent initiator or target
1629 field ENAUTOATNO 0x08
1630 field ENAUTOATNI 0x04
1631 field ENAUTOATNP 0x02
1632 dont_generate_debug_code
1640 * These scratch ram locations are initialized by the 274X BIOS.
1641 * We reuse them after capturing the BIOS settings during
1646 * The initiator specified tag for this target mode transaction.
1650 field HA_274_EXTENDED_TRANS 0x01
1653 dont_generate_debug_code
1659 field TARGET_MSG_PENDING 0x02
1660 dont_generate_debug_code
1668 * These are reserved registers in the card's scratch ram on the 2742.
1669 * The EISA configuraiton chip is mapped here. On Rev E. of the
1670 * aic7770, the sequencer can use this area for scratch, but the
1671 * host cannot directly access these registers. On later chips, this
1672 * area can be read and written by both the host and the sequencer.
1673 * Even on later chips, many of these locations are initialized by
1680 field RESET_SCSI 0x40
1682 mask HSCSIID 0x07 /* our SCSI ID */
1683 mask HWSCSIID 0x0f /* our SCSI ID if Wide Bus */
1684 dont_generate_debug_code
1690 field EDGE_TRIG 0x80
1692 dont_generate_debug_code
1698 dont_generate_debug_code
1705 mask BIOSDISABLED 0x30
1706 field CHANNEL_B_PRIMARY 0x08
1707 dont_generate_debug_code
1716 * Per target SCSI offset values for Ultra2 controllers.
1721 dont_generate_debug_code
1726 const SCB_LIST_NULL 0xff
1727 const TARGET_CMD_CMPLT 0xfe
1729 const CCSGADDR_MAX 0x80
1730 const CCSGRAM_MAXSEGS 16
1732 /* WDTR Message values */
1733 const BUS_8_BIT 0x00
1734 const BUS_16_BIT 0x01
1735 const BUS_32_BIT 0x02
1737 /* Offset maximums */
1738 const MAX_OFFSET_8BIT 0x0f
1739 const MAX_OFFSET_16BIT 0x08
1740 const MAX_OFFSET_ULTRA2 0x7f
1741 const MAX_OFFSET 0x7f
1744 /* Target mode command processing constants */
1745 const CMD_GROUP_CODE_SHIFT 0x05
1747 const STATUS_BUSY 0x08
1748 const STATUS_QUEUE_FULL 0x28
1749 const TARGET_DATA_IN 1
1752 * Downloaded (kernel inserted) constants
1754 /* Offsets into the SCBID array where different data is stored */
1755 const QOUTFIFO_OFFSET download
1756 const QINFIFO_OFFSET download
1757 const CACHESIZE_MASK download
1758 const INVERTED_CACHESIZE_MASK download
1759 const SG_PREFETCH_CNT download
1760 const SG_PREFETCH_ALIGN_MASK download
1761 const SG_PREFETCH_ADDR_MASK download