summaryrefslogtreecommitdiffstats
path: root/sys/dev/aic7xxx/aic7xxx.reg
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-09-15 07:24:17 +0000
committergibbs <gibbs@FreeBSD.org>1998-09-15 07:24:17 +0000
commitb845ffee8074eddeeb44108a8646161fbcf33aff (patch)
tree29b6ded2164fbd85ddc231ce2953cec74858b5bc /sys/dev/aic7xxx/aic7xxx.reg
parentfd4d41dcf7b1812c21942f9a24ef7ee737d2f1dd (diff)
downloadFreeBSD-src-b845ffee8074eddeeb44108a8646161fbcf33aff.zip
FreeBSD-src-b845ffee8074eddeeb44108a8646161fbcf33aff.tar.gz
Massive overhaul of the aic7xxx driver:
- Convert to CAM - Use a new DMA based queuing and paging scheme - Add preliminary target mode support - Add support for the aic789X chips - Take advantage of external SRAM on more controllers. - Numerous bug fixes and performance improvements.
Diffstat (limited to 'sys/dev/aic7xxx/aic7xxx.reg')
-rw-r--r--sys/dev/aic7xxx/aic7xxx.reg458
1 files changed, 354 insertions, 104 deletions
diff --git a/sys/dev/aic7xxx/aic7xxx.reg b/sys/dev/aic7xxx/aic7xxx.reg
index b166c33..fff2b6f 100644
--- a/sys/dev/aic7xxx/aic7xxx.reg
+++ b/sys/dev/aic7xxx/aic7xxx.reg
@@ -1,7 +1,7 @@
/*
* Aic7xxx register and scratch ram definitions.
*
- * Copyright (c) 1994-1997 Justin Gibbs.
+ * Copyright (c) 1994-1998 Justin Gibbs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,10 +10,7 @@
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification, immediately at the beginning of the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
+ * 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Where this Software is combined with software released under the terms of
@@ -35,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx.reg,v 1.5 1997/08/13 17:02:24 gibbs Exp $
+ * $Id: aic7xxx.reg,v 1.4 1997/06/27 19:38:39 gibbs Exp $
*/
/*
@@ -164,6 +161,7 @@ register SCSIRATE {
access_mode RW
bit WIDEXFER 0x80 /* Wide transfer control */
mask SXFR 0x70 /* Sync transfer rate */
+ mask SXFR_ULTRA2 0x7f /* Sync transfer rate */
mask SOFS 0x0f /* Sync offset */
}
@@ -177,6 +175,13 @@ register SCSIID {
access_mode RW
mask TID 0xf0 /* Target ID mask */
mask OID 0x0f /* Our ID mask */
+ /*
+ * SCSI Maximum Offset (p. 4-61 aic7890/91 Data Book)
+ * The aic7890/91 allow an offset of up to 127 transfers in both wide
+ * and narrow mode.
+ */
+ alias SCSIOFFSET
+ mask SOFS_ULTRA2 0x7f /* Sync offset U2 chips */
}
/*
@@ -230,14 +235,15 @@ register CLRSINT0 {
register SSTAT0 {
address 0x00b
access_mode RO
- bit TARGET 0x80 /* Board acting as target */
- bit SELDO 0x40 /* Selection Done */
- bit SELDI 0x20 /* Board has been selected */
- bit SELINGO 0x10 /* Selection In Progress */
- bit SWRAP 0x08 /* 24bit counter wrap */
- bit SDONE 0x04 /* STCNT = 0x000000 */
- bit SPIORDY 0x02 /* SCSI PIO Ready */
- bit DMADONE 0x01 /* DMA transfer completed */
+ bit TARGET 0x80 /* Board acting as target */
+ bit SELDO 0x40 /* Selection Done */
+ bit SELDI 0x20 /* Board has been selected */
+ bit SELINGO 0x10 /* Selection In Progress */
+ bit SWRAP 0x08 /* 24bit counter wrap */
+ bit IOERR 0x08 /* LVD Tranceiver mode changed */
+ bit SDONE 0x04 /* STCNT = 0x000000 */
+ bit SPIORDY 0x02 /* SCSI PIO Ready */
+ bit DMADONE 0x01 /* DMA transfer completed */
}
/*
@@ -279,6 +285,7 @@ register SSTAT2 {
address 0x00d
access_mode RO
bit OVERRUN 0x80
+ bit EXP_ACTIVE 0x10 /* SCSI Expander Active */
mask SFCNT 0x1f
}
@@ -293,14 +300,13 @@ register SSTAT3 {
}
/*
- * SCSI Test Control (p. 3-27)
+ * SCSI ID for the aic7890/91 chips
*/
-register SCSITEST {
+register SCSIID_ULTRA2 {
address 0x00f
access_mode RW
- bit RQAKCNT 0x04
- bit CNTRTEST 0x02
- bit CMODE 0x01
+ mask TID 0xf0 /* Target ID mask */
+ mask OID 0x0f /* Our ID mask */
}
/*
@@ -315,6 +321,7 @@ register SIMODE0 {
bit ENSELDI 0x20
bit ENSELINGO 0x10
bit ENSWRAP 0x08
+ bit ENIOERR 0x08 /* LVD Tranceiver mode changes */
bit ENSDONE 0x04
bit ENSPIORDY 0x02
bit ENDMADONE 0x01
@@ -378,6 +385,7 @@ register SELTIMER {
bit STAGE3 0x04
bit STAGE2 0x02
bit STAGE1 0x01
+ alias TARGIDIN
}
/*
@@ -393,6 +401,36 @@ register SELID {
}
/*
+ * Target Mode Selecting in ID bitmask (aic7890/91/96/97)
+ */
+register TARGID {
+ address 0x01b
+ size 2
+ access_mode RW
+}
+
+/*
+ * Serial Port I/O Cabability register (p. 4-95 aic7860 Data Book)
+ * Indicates if external logic has been attached to the chip to
+ * perform the tasks of accessing a serial eeprom, testing termination
+ * strength, and performing cable detection. On the aic7860, most of
+ * these features are handled on chip, but on the aic7855 an attached
+ * aic3800 does the grunt work.
+ */
+register SPIOCAP {
+ address 0x01b
+ access_mode RW
+ bit SOFT1 0x80
+ bit SOFT0 0x40
+ bit SOFTCMDEN 0x20
+ bit HAS_BRDCTL 0x10 /* External Board control */
+ bit SEEPROM 0x08 /* External serial eeprom logic */
+ bit EEPROM 0x04 /* Writable external BIOS ROM */
+ bit ROM 0x02 /* Logic for accessing external ROM */
+ bit SSPIOCPS 0x01 /* Termination and cable detection */
+}
+
+/*
* SCSI Block Control (p. 3-32)
* Controls Bus type and channel selection. In a twin channel configuration
* addresses 0x00-0x1e are gated to the appropriate channel based on this
@@ -406,7 +444,10 @@ register SBLKCTL {
bit DIAGLEDON 0x40 /* Aic78X0 only */
bit AUTOFLUSHDIS 0x20
bit SELBUSB 0x08
+ bit ENAB40 0x08 /* LVD transceiver active */
+ bit ENAB20 0x04 /* SE/HVD transceiver active */
bit SELWIDE 0x02
+ bit XCVR 0x01 /* External transceiver active */
}
/*
@@ -529,6 +570,19 @@ register BCTL {
bit ENABLE 0x01
}
+register DSCOMMAND0 {
+ address 0x084
+ access_mode RW
+ bit CACHETHEN 0x80
+ bit DPARCKEN 0x40
+ bit MPARCKEN 0x20
+ bit EXTREQLCK 0x10
+ bit INTSCBRAMSEL 0x08
+ bit RAMPS 0x04
+ bit USCBSIZE32 0x02
+ bit CIOPARCKEN 0x01
+}
+
/*
* On the aic78X0 chips, Board Control is replaced by the DSCommand
* register (p. 4-64)
@@ -622,32 +676,26 @@ register INTSTAT {
mask NO_IDENT 0x20|SEQINT /* no IDENTIFY after reconnect*/
mask NO_MATCH 0x30|SEQINT /* no cmd match for reconnect */
mask EXTENDED_MSG 0x40|SEQINT /* Extended message received */
- mask NO_MATCH_BUSY 0x50|SEQINT /* Couldn't find BUSY SCB */
+ mask ABORT_REQUESTED 0x50|SEQINT /* Reconect of aborted SCB */
mask REJECT_MSG 0x60|SEQINT /* Reject message received */
mask BAD_STATUS 0x70|SEQINT /* Bad status from target */
mask RESIDUAL 0x80|SEQINT /* Residual byte count != 0 */
- mask ABORT_CMDCMPLT 0x91 /*
- * Command tagged for abort
- * completed successfully.
- */
mask AWAITING_MSG 0xa0|SEQINT /*
* Kernel requested to specify
- * a message to this target
- * (command was null), so tell
- * it that it can fill the
- * message buffer.
- */
- mask MSG_BUFFER_BUSY 0xc0|SEQINT /*
- * Sequencer wants to use the
- * message buffer, but it
- * already contains a message
+ * a message to this target
+ * (command was null), so tell
+ * it that it can fill the
+ * message buffer.
*/
- mask MSGIN_PHASEMIS 0xd0|SEQINT /*
+ mask TARGET_MSG_HELP 0xb0|SEQINT
+ mask TARGET_SYNC_CMD 0xc0|SEQINT
+ mask TRACEPOINT 0xd0|SEQINT
+ mask MSGIN_PHASEMIS 0xe0|SEQINT /*
* Target changed phase on us
* when we were expecting
* another msgin byte.
*/
- mask DATA_OVERRUN 0xe0|SEQINT /*
+ mask DATA_OVERRUN 0xf0|SEQINT /*
* Target attempted to write
* beyond the bounds of its
* command.
@@ -665,7 +713,11 @@ register INTSTAT {
register ERROR {
address 0x092
access_mode RO
- bit PARERR 0x08
+ bit CIOPARERR 0x80 /* Ultra2 only */
+ bit PCIERRSTAT 0x40 /* PCI only */
+ bit MPARERR 0x20 /* PCI only */
+ bit DPARERR 0x10 /* PCI only */
+ bit SQPARERR 0x08
bit ILLOPCODE 0x04
bit ILLSADDR 0x02
bit ILLHADDR 0x01
@@ -677,6 +729,7 @@ register ERROR {
register CLRINT {
address 0x092
access_mode WO
+ bit CLRPARERR 0x10 /* PCI only */
bit CLRBRKADRINT 0x08
bit CLRSCSIINT 0x04
bit CLRCMDINT 0x02
@@ -686,6 +739,7 @@ register CLRINT {
register DFCNTRL {
address 0x093
access_mode RW
+ bit PRELOADEN 0x80 /* aic7890 only */
bit WIDEODD 0x40
bit SCSIEN 0x20
bit SDMAEN 0x10
@@ -700,6 +754,7 @@ register DFCNTRL {
register DFSTATUS {
address 0x094
access_mode RO
+ bit PRELOAD_AVAIL 0x80
bit DWORDEMP 0x20
bit MREQPEND 0x10
bit HDONE 0x08
@@ -762,17 +817,25 @@ register QOUTCNT {
}
/*
+ * Special Function
+ */
+register SFUNCT {
+ address 0x09f
+ access_mode RW
+}
+
+/*
* SCB Definition (p. 5-4)
*/
scb {
address 0x0a0
SCB_CONTROL {
size 1
- bit MK_MESSAGE 0x80
+ bit TARGET_SCB 0x80
bit DISCENB 0x40
bit TAG_ENB 0x20
- bit MUST_DMAUP_SCB 0x10
- bit ABORT_SCB 0x08
+ bit MK_MESSAGE 0x10
+ bit ULTRAENB 0x08
bit DISCONNECTED 0x04
mask SCB_TAG_TYPE 0x03
}
@@ -801,15 +864,20 @@ scb {
size 4
}
SCB_DATACNT {
- size 3
- }
- SCB_LINKED_NEXT {
- size 1
+ /*
+ * Really only 3 bytes, but padded to make
+ * the kernel's job easier.
+ */
+ size 4
}
SCB_CMDPTR {
+ alias SCB_TARGET_PHASES
+ alias SCB_TARGET_ID /* Byte 2 */
+ bit TARGET_DATA_IN 0x1 /* In the second byte */
size 4
}
SCB_CMDLEN {
+ alias SCB_INITIATOR_TAG
size 1
}
SCB_TAG {
@@ -818,14 +886,29 @@ scb {
SCB_NEXT {
size 1
}
- SCB_PREV {
+ SCB_SCSIRATE {
+ size 1
+ }
+ SCB_SCSIOFFSET {
size 1
}
- SCB_BUSYTARGETS {
+ SCB_SPARE {
+ size 3
+ }
+ SCB_CMDSTORE {
+ size 16
+ }
+ SCB_CMDSTORE_BUSADDR {
size 4
}
+ SCB_64BYTE_SPARE {
+ size 12
+ }
}
+const SCB_32BYTE_SIZE 28
+const SCB_64BYTE_SIZE 48
+
const SG_SIZEOF 0x08 /* sizeof(struct ahc_dma) */
/* --------------------- AHA-2840-only definitions -------------------- */
@@ -851,6 +934,117 @@ register STATUS_2840 {
register DSPCISTATUS {
address 0x086
+ mask DFTHRSH_100 0xc0
+}
+
+register CCHADDR {
+ address 0x0E0
+ size 8
+}
+
+register CCHCNT {
+ address 0x0E8
+}
+
+register CCSGRAM {
+ address 0x0E9
+}
+
+register CCSGADDR {
+ address 0x0EA
+}
+
+register CCSGCTL {
+ address 0x0EB
+ bit CCSGDONE 0x80
+ bit CCSGEN 0x08
+ bit FLAG 0x02
+ bit CCSGRESET 0x01
+}
+
+register CCSCBCNT {
+ address 0xEF
+}
+
+register CCSCBCTL {
+ address 0x0EE
+ bit CCSCBDONE 0x80
+ bit ARRDONE 0x40 /* SCB Array prefetch done */
+ bit CCARREN 0x10
+ bit CCSCBEN 0x08
+ bit CCSCBDIR 0x04
+ bit CCSCBRESET 0x01
+}
+
+register CCSCBADDR {
+ address 0x0ED
+}
+
+register CCSCBRAM {
+ address 0xEC
+}
+
+/*
+ * SCB bank address (7895/7896/97 only)
+ */
+register SCBBADDR {
+ address 0x0F0
+ access_mode RW
+}
+
+register CCSCBPTR {
+ address 0x0F1
+}
+
+register HNSCB_QOFF {
+ address 0x0F4
+}
+
+register SNSCB_QOFF {
+ address 0x0F6
+}
+
+register SDSCB_QOFF {
+ address 0x0F8
+}
+
+register QOFF_CTLSTA {
+ address 0x0FA
+ bit SCB_AVAIL 0x40
+ bit SNSCB_ROLLOVER 0x20
+ bit SDSCB_ROLLOVER 0x10
+ mask SCB_QSIZE 0x07
+ mask SCB_QSIZE_256 0x06
+}
+
+register DFF_THRSH {
+ address 0x0FB
+ mask WR_DFTHRSH 0x70
+ mask RD_DFTHRSH 0x07
+ mask RD_DFTHRSH_MIN 0x00
+ mask RD_DFTHRSH_25 0x01
+ mask RD_DFTHRSH_50 0x02
+ mask RD_DFTHRSH_63 0x03
+ mask RD_DFTHRSH_75 0x04
+ mask RD_DFTHRSH_85 0x05
+ mask RD_DFTHRSH_90 0x06
+ mask RD_DFTHRSH_MAX 0x07
+ mask WR_DFTHRSH_MIN 0x00
+ mask WR_DFTHRSH_25 0x10
+ mask WR_DFTHRSH_50 0x20
+ mask WR_DFTHRSH_63 0x30
+ mask WR_DFTHRSH_75 0x40
+ mask WR_DFTHRSH_85 0x50
+ mask WR_DFTHRSH_90 0x60
+ mask WR_DFTHRSH_MAX 0x70
+}
+
+register SG_CACHEPTR {
+ access_mode RW
+ address 0x0fc
+ mask SG_USER_DATA 0xfc
+ bit LAST_SEG 0x02
+ bit LAST_SEG_DONE 0x01
}
register BRDCTL {
@@ -863,6 +1057,12 @@ register BRDCTL {
bit BRDRW 0x04
bit BRDCTL1 0x02
bit BRDCTL0 0x01
+ /* 7890 Definitions */
+ bit BRDDAT4 0x10
+ bit BRDDAT3 0x08
+ bit BRDDAT2 0x04
+ bit BRDRW_ULTRA2 0x02
+ bit BRDSTB_ULTRA2 0x01
}
/*
@@ -921,9 +1121,13 @@ scratch_ram {
/*
* 1 byte per target starting at this address for configuration values
*/
- TARG_SCRATCH {
+ TARG_SCSIRATE {
+ alias CMDSIZE_TABLE
size 16
}
+ /*
+ * Bit vector of targets that have ULTRA enabled.
+ */
ULTRA_ENB {
size 2
}
@@ -934,18 +1138,16 @@ scratch_ram {
size 2
}
/*
- * Length of pending message
+ * Single byte buffer used to designate the type or message
+ * to send to a target.
*/
- MSG_LEN {
- size 1
- }
- /* We reserve 8bytes to store outgoing messages */
MSG_OUT {
- size 8
+ size 1
}
/* Parameters for DMA Logic */
DMAPARAMS {
size 1
+ bit PRELOADEN 0x80
bit WIDEODD 0x40
bit SCSIEN 0x20
bit SDMAEN 0x10
@@ -958,13 +1160,15 @@ scratch_ram {
}
SEQ_FLAGS {
size 1
- bit RESELECTED 0x80
- bit IDENTIFY_SEEN 0x40
- bit TAGGED_SCB 0x20
- bit DPHASE 0x10
- bit PAGESCBS 0x04
- bit WIDE_BUS 0x02
- bit TWIN_BUS 0x01
+ bit IDENTIFY_SEEN 0x80
+ bit SCBPTR_VALID 0x40
+ bit DPHASE 0x20
+ /* Target flags */
+ bit TARG_CMD_PENDING 0x10
+ bit CMDPHASE_PENDING 0x08
+ bit DPHASE_PENDING 0x04
+ bit SPHASE_PENDING 0x02
+ bit NO_DISCONNECT 0x01
}
/*
* Temporary storage for the
@@ -974,27 +1178,15 @@ scratch_ram {
SAVED_TCL {
size 1
}
+ /* Working value of the number of SG segments left */
SG_COUNT {
size 1
}
- /* working value of SG pointer */
+ /* Working value of SG pointer */
SG_NEXT {
size 4
}
/*
- * head of list of SCBs awaiting
- * selection
- */
- WAITING_SCBH {
- size 1
- }
- SAVED_LINKPTR {
- size 1
- }
- SAVED_SCBPTR {
- size 1
- }
- /*
* The last bus phase as seen by the sequencer.
*/
LASTPHASE {
@@ -1011,23 +1203,12 @@ scratch_ram {
mask P_MESGIN CDI|IOI|MSGI
mask P_BUSFREE 0x01
}
- MSGIN_EXT_LEN {
- size 1
- }
- MSGIN_EXT_OPCODE {
- size 1
- }
/*
- * location 3, stores the last
- * byte of an extended message if
- * it passes the two bytes of space
- * we allow now. This byte isn't
- * used for anything, it just makes
- * the code shorter for tossing
- * extra bytes.
+ * head of list of SCBs awaiting
+ * selection
*/
- MSGIN_EXT_BYTES {
- size 3
+ WAITING_SCBH {
+ size 1
}
/*
* head of list of SCBs that are
@@ -1044,18 +1225,40 @@ scratch_ram {
FREE_SCBH {
size 1
}
+ /*
+ * Address of the hardware scb array in the host.
+ */
HSCB_ADDR {
size 4
}
- CUR_SCBID {
+ /*
+ * Address of the 256 byte array storing the SCBID of outstanding
+ * untagged SCBs indexed by TCL.
+ */
+ SCBID_ADDR {
+ size 4
+ }
+ /*
+ * Address of the array of command descriptors used to store
+ * information about incoming selections.
+ */
+ TMODE_CMDADDR {
+ size 4
+ }
+ KERNEL_QINPOS {
+ size 1
+ }
+ QINPOS {
+ size 1
+ }
+ QOUTPOS {
size 1
}
/*
- * Running count of commands placed in
- * the QOUTFIFO. This is cleared by the
- * kernel driver every FIFODEPTH commands.
+ * Offset into the command descriptor array for the next
+ * available desciptor to use.
*/
- CMDOUTCNT {
+ TMODE_CMDADDR_NEXT {
size 1
}
ARG_1 {
@@ -1063,8 +1266,30 @@ scratch_ram {
mask SEND_MSG 0x80
mask SEND_SENSE 0x40
mask SEND_REJ 0x20
+ mask MSGOUT_PHASEMIS 0x10
alias RETURN_1
}
+ ARG_2 {
+ size 1
+ alias RETURN_2
+ }
+
+ /*
+ * Snapshot of MSG_OUT taken after each message is sent.
+ */
+ LAST_MSG {
+ size 1
+ }
+
+ /*
+ * Number of times we have filled the CCSGRAM with prefetched
+ * SG elements.
+ */
+ PREFETCH_CNT {
+ size 1
+ }
+
+
/*
* These are reserved registers in the card's scratch ram. Some of
* the values are specified in the AHA2742 technical reference manual
@@ -1073,7 +1298,10 @@ scratch_ram {
SCSICONF {
address 0x05a
size 1
+ bit TERM_ENB 0x80
bit RESET_SCSI 0x40
+ mask HSCSIID 0x07 /* our SCSI ID */
+ mask HWSCSIID 0x0f /* our SCSI ID if Wide Bus */
}
HOSTCONF {
address 0x05d
@@ -1086,29 +1314,51 @@ scratch_ram {
mask BIOSDISABLED 0x30
bit CHANNEL_B_PRIMARY 0x08
}
+ /*
+ * Per target SCSI offset values for Ultra2 controllers.
+ */
+ TARG_OFFSET {
+ address 0x070
+ size 16
+ }
}
const SCB_LIST_NULL 0xff
+const TARGET_CMD_CMPLT 0xfe
+
+const CCSGADDR_MAX 0x80
+const CCSGRAM_MAXSEGS 16
+/* Offsets into the SCBID array where different data is stored */
+const QOUTFIFO_OFFSET 0
+const QINFIFO_OFFSET 1
+const UNTAGGEDSCB_OFFSET 2
/* WDTR Message values */
-const BUS_8_BIT 0x00
+const BUS_8_BIT 0x00
const BUS_16_BIT 0x01
const BUS_32_BIT 0x02
+
+/* Offset maximums */
const MAX_OFFSET_8BIT 0x0f
-const MAX_OFFSET_16BIT 0x08
+const MAX_OFFSET_16BIT 0x08
+const MAX_OFFSET_ULTRA2 0x7f
+const HOST_MSG 0xff
+
+/* Target mode command processing constants */
+const CMD_GROUP_CODE_SHIFT 0x05
+const CMD_GROUP0_BYTE_DELTA -4
+const CMD_GROUP2_BYTE_DELTA 9
+const CMD_GROUP3_BYTE_DELTA -15
+const CMD_GROUP4_BYTE_DELTA 4
+const CMD_GROUP5_BYTE_DELTA 11
+
/*
* Downloaded (kernel inserted) constants
*/
-const SCBCOUNT download /* The number of SCBs on this card */
-const COMP_SCBCOUNT download /* Two's complement of max SCBID */
-/*
- * The maximum number of entries allowed in the QIN/OUTFIFO.
- */
-const FIFODEPTH download /* Two's complement of SCBCOUNT */
+
/*
- * Mask of bits to test against when looking at the Queue Count
- * registers. Works around a bug on aic7850 chips.
+ * Number of command descriptors in the command descriptor array.
*/
-const QCNTMASK download
+const TMODE_NUMCMDS download
OpenPOWER on IntegriCloud