Commit 8397990b authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-scsi.bkbits.net/scsi-for-linus-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents f1e706d0 8808b074
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* NCR 53c{7,8}0x0 driver, header file
*
* Sponsored by
* iX Multiuser Multitasking Magazine
* Hannover, Germany
* hm@ix.de
*
* Copyright 1993, 1994, 1995 Drew Eckhardt
* Visionary Computing
* (Unix and Linux consulting and custom programming)
* drew@PoohSticks.ORG
* +1 (303) 786-7975
*
* TolerANT and SCSI SCRIPTS are registered trademarks of NCR Corporation.
*
* PRE-ALPHA
*
* For more information, please consult
*
* NCR 53C700/53C700-66
* SCSI I/O Processor
* Data Manual
*
* NCR 53C810
* PCI-SCSI I/O Processor
* Data Manual
*
* NCR Microelectronics
* 1635 Aeroplaza Drive
* Colorado Springs, CO 80916
* +1 (719) 578-3400
*
* Toll free literature number
* +1 (800) 334-5454
*
*/
#ifndef NCR53c7x0_H
#define NCR53c7x0_H
#include <linux/version.h>
/*
* Prevent name space pollution in hosts.c, and only provide the
* define we need to get the NCR53c7x0 driver into the host template
* array.
*/
#include <scsi/scsicam.h>
extern int NCR53c7xx_abort(Scsi_Cmnd *);
extern int NCR53c7xx_detect(Scsi_Host_Template *tpnt);
extern int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
extern int NCR53c7xx_reset(Scsi_Cmnd *, unsigned int);
#ifdef MODULE
extern int NCR53c7xx_release(struct Scsi_Host *);
#else
#define NCR53c7xx_release NULL
#endif
#define NCR53c7xx { \
.name = "NCR53c{7,8}xx (rel 17)", \
.detect = NCR53c7xx_detect, \
.queuecommand = NCR53c7xx_queue_command, \
.abort = NCR53c7xx_abort, \
.reset = NCR53c7xx_reset, \
.can_queue = 24, \
.this_id = 7, \
.sg_tablesize = 127, \
.cmd_per_lun = 3, \
.use_clustering = DISABLE_CLUSTERING}
#ifndef HOSTS_C
/* Register addresses, ordered numerically */
/* SCSI control 0 rw, default = 0xc0 */
#define SCNTL0_REG 0x00
#define SCNTL0_ARB1 0x80 /* 0 0 = simple arbitration */
#define SCNTL0_ARB2 0x40 /* 1 1 = full arbitration */
#define SCNTL0_STRT 0x20 /* Start Sequence */
#define SCNTL0_WATN 0x10 /* Select with ATN */
#define SCNTL0_EPC 0x08 /* Enable parity checking */
/* Bit 2 is reserved on 800 series chips */
#define SCNTL0_EPG_700 0x04 /* Enable parity generation */
#define SCNTL0_AAP 0x02 /* ATN/ on parity error */
#define SCNTL0_TRG 0x01 /* Target mode */
/* SCSI control 1 rw, default = 0x00 */
#define SCNTL1_REG 0x01
#define SCNTL1_EXC 0x80 /* Extra Clock Cycle of Data setup */
#define SCNTL1_ADB 0x40 /* contents of SODL on bus */
#define SCNTL1_ESR_700 0x20 /* Enable SIOP response to selection
and reselection */
#define SCNTL1_DHP_800 0x20 /* Disable halt on parity error or ATN
target mode only */
#define SCNTL1_CON 0x10 /* Connected */
#define SCNTL1_RST 0x08 /* SCSI RST/ */
#define SCNTL1_AESP 0x04 /* Force bad parity */
#define SCNTL1_SND_700 0x02 /* Start SCSI send */
#define SCNTL1_IARB_800 0x02 /* Immediate Arbitration, start
arbitration immediately after
busfree is detected */
#define SCNTL1_RCV_700 0x01 /* Start SCSI receive */
#define SCNTL1_SST_800 0x01 /* Start SCSI transfer */
/* SCSI control 2 rw, */
#define SCNTL2_REG_800 0x02
#define SCNTL2_800_SDU 0x80 /* SCSI disconnect unexpected */
/* SCSI control 3 rw */
#define SCNTL3_REG_800 0x03
#define SCNTL3_800_SCF_SHIFT 4
#define SCNTL3_800_SCF_MASK 0x70
#define SCNTL3_800_SCF2 0x40 /* Synchronous divisor */
#define SCNTL3_800_SCF1 0x20 /* 0x00 = SCLK/3 */
#define SCNTL3_800_SCF0 0x10 /* 0x10 = SCLK/1 */
/* 0x20 = SCLK/1.5
0x30 = SCLK/2
0x40 = SCLK/3 */
#define SCNTL3_800_CCF_SHIFT 0
#define SCNTL3_800_CCF_MASK 0x07
#define SCNTL3_800_CCF2 0x04 /* 0x00 50.01 to 66 */
#define SCNTL3_800_CCF1 0x02 /* 0x01 16.67 to 25 */
#define SCNTL3_800_CCF0 0x01 /* 0x02 25.01 - 37.5
0x03 37.51 - 50
0x04 50.01 - 66 */
/*
* SCSI destination ID rw - the appropriate bit is set for the selected
* target ID. This is written by the SCSI SCRIPTS processor.
* default = 0x00
*/
#define SDID_REG_700 0x02
#define SDID_REG_800 0x06
#define GP_REG_800 0x07 /* General purpose IO */
#define GP_800_IO1 0x02
#define GP_800_IO2 0x01
/* SCSI interrupt enable rw, default = 0x00 */
#define SIEN_REG_700 0x03
#define SIEN0_REG_800 0x40
#define SIEN_MA 0x80 /* Phase mismatch (ini) or ATN (tgt) */
#define SIEN_FC 0x40 /* Function complete */
#define SIEN_700_STO 0x20 /* Selection or reselection timeout */
#define SIEN_800_SEL 0x20 /* Selected */
#define SIEN_700_SEL 0x10 /* Selected or reselected */
#define SIEN_800_RESEL 0x10 /* Reselected */
#define SIEN_SGE 0x08 /* SCSI gross error */
#define SIEN_UDC 0x04 /* Unexpected disconnect */
#define SIEN_RST 0x02 /* SCSI RST/ received */
#define SIEN_PAR 0x01 /* Parity error */
/*
* SCSI chip ID rw
* NCR53c700 :
* When arbitrating, the highest bit is used, when reselection or selection
* occurs, the chip responds to all IDs for which a bit is set.
* default = 0x00
* NCR53c810 :
* Uses bit mapping
*/
#define SCID_REG 0x04
/* Bit 7 is reserved on 800 series chips */
#define SCID_800_RRE 0x40 /* Enable response to reselection */
#define SCID_800_SRE 0x20 /* Enable response to selection */
/* Bits four and three are reserved on 800 series chips */
#define SCID_800_ENC_MASK 0x07 /* Encoded SCSI ID */
/* SCSI transfer rw, default = 0x00 */
#define SXFER_REG 0x05
#define SXFER_DHP 0x80 /* Disable halt on parity */
#define SXFER_TP2 0x40 /* Transfer period msb */
#define SXFER_TP1 0x20
#define SXFER_TP0 0x10 /* lsb */
#define SXFER_TP_MASK 0x70
/* FIXME : SXFER_TP_SHIFT == 5 is right for '8xx chips */
#define SXFER_TP_SHIFT 5
#define SXFER_TP_4 0x00 /* Divisors */
#define SXFER_TP_5 0x10<<1
#define SXFER_TP_6 0x20<<1
#define SXFER_TP_7 0x30<<1
#define SXFER_TP_8 0x40<<1
#define SXFER_TP_9 0x50<<1
#define SXFER_TP_10 0x60<<1
#define SXFER_TP_11 0x70<<1
#define SXFER_MO3 0x08 /* Max offset msb */
#define SXFER_MO2 0x04
#define SXFER_MO1 0x02
#define SXFER_MO0 0x01 /* lsb */
#define SXFER_MO_MASK 0x0f
#define SXFER_MO_SHIFT 0
/*
* SCSI output data latch rw
* The contents of this register are driven onto the SCSI bus when
* the Assert Data Bus bit of the SCNTL1 register is set and
* the CD, IO, and MSG bits of the SOCL register match the SCSI phase
*/
#define SODL_REG_700 0x06
#define SODL_REG_800 0x54
/*
* SCSI output control latch rw, default = 0
* Note that when the chip is being manually programmed as an initiator,
* the MSG, CD, and IO bits must be set correctly for the phase the target
* is driving the bus in. Otherwise no data transfer will occur due to
* phase mismatch.
*/
#define SBCL_REG 0x0b
#define SBCL_REQ 0x80 /* REQ */
#define SBCL_ACK 0x40 /* ACK */
#define SBCL_BSY 0x20 /* BSY */
#define SBCL_SEL 0x10 /* SEL */
#define SBCL_ATN 0x08 /* ATN */
#define SBCL_MSG 0x04 /* MSG */
#define SBCL_CD 0x02 /* C/D */
#define SBCL_IO 0x01 /* I/O */
#define SBCL_PHASE_CMDOUT SBCL_CD
#define SBCL_PHASE_DATAIN SBCL_IO
#define SBCL_PHASE_DATAOUT 0
#define SBCL_PHASE_MSGIN (SBCL_CD|SBCL_IO|SBCL_MSG)
#define SBCL_PHASE_MSGOUT (SBCL_CD|SBCL_MSG)
#define SBCL_PHASE_STATIN (SBCL_CD|SBCL_IO)
#define SBCL_PHASE_MASK (SBCL_CD|SBCL_IO|SBCL_MSG)
/*
* SCSI first byte received latch ro
* This register contains the first byte received during a block MOVE
* SCSI SCRIPTS instruction, including
*
* Initiator mode Target mode
* Message in Command
* Status Message out
* Data in Data out
*
* It also contains the selecting or reselecting device's ID and our
* ID.
*
* Note that this is the register the various IF conditionals can
* operate on.
*/
#define SFBR_REG 0x08
/*
* SCSI input data latch ro
* In initiator mode, data is latched into this register on the rising
* edge of REQ/. In target mode, data is latched on the rising edge of
* ACK/
*/
#define SIDL_REG_700 0x09
#define SIDL_REG_800 0x50
/*
* SCSI bus data lines ro
* This register reflects the instantaneous status of the SCSI data
* lines. Note that SCNTL0 must be set to disable parity checking,
* otherwise reading this register will latch new parity.
*/
#define SBDL_REG_700 0x0a
#define SBDL_REG_800 0x58
#define SSID_REG_800 0x0a
#define SSID_800_VAL 0x80 /* Exactly two bits asserted at sel */
#define SSID_800_ENCID_MASK 0x07 /* Device which performed operation */
/*
* SCSI bus control lines rw,
* instantaneous readout of control lines
*/
#define SOCL_REG 0x0b
#define SOCL_REQ 0x80 /* REQ ro */
#define SOCL_ACK 0x40 /* ACK ro */
#define SOCL_BSY 0x20 /* BSY ro */
#define SOCL_SEL 0x10 /* SEL ro */
#define SOCL_ATN 0x08 /* ATN ro */
#define SOCL_MSG 0x04 /* MSG ro */
#define SOCL_CD 0x02 /* C/D ro */
#define SOCL_IO 0x01 /* I/O ro */
/*
* Synchronous SCSI Clock Control bits
* 0 - set by DCNTL
* 1 - SCLK / 1.0
* 2 - SCLK / 1.5
* 3 - SCLK / 2.0
*/
#define SBCL_SSCF1 0x02 /* wo, -66 only */
#define SBCL_SSCF0 0x01 /* wo, -66 only */
#define SBCL_SSCF_MASK 0x03
/*
* XXX note : when reading the DSTAT and STAT registers to clear interrupts,
* insure that 10 clocks elapse between the two
*/
/* DMA status ro */
#define DSTAT_REG 0x0c
#define DSTAT_DFE 0x80 /* DMA FIFO empty */
#define DSTAT_800_MDPE 0x40 /* Master Data Parity Error */
#define DSTAT_800_BF 0x20 /* Bus Fault */
#define DSTAT_ABRT 0x10 /* Aborted - set on error */
#define DSTAT_SSI 0x08 /* SCRIPTS single step interrupt */
#define DSTAT_SIR 0x04 /* SCRIPTS interrupt received -
set when INT instruction is
executed */
#define DSTAT_WTD 0x02 /* Watchdog timeout detected */
#define DSTAT_OPC 0x01 /* Illegal instruction */
#define DSTAT_800_IID 0x01 /* Same thing, different name */
/* NCR53c800 moves this stuff into SIST0 */
#define SSTAT0_REG 0x0d /* SCSI status 0 ro */
#define SIST0_REG_800 0x42
#define SSTAT0_MA 0x80 /* ini : phase mismatch,
* tgt : ATN/ asserted
*/
#define SSTAT0_CMP 0x40 /* function complete */
#define SSTAT0_700_STO 0x20 /* Selection or reselection timeout */
#define SIST0_800_SEL 0x20 /* Selected */
#define SSTAT0_700_SEL 0x10 /* Selected or reselected */
#define SIST0_800_RSL 0x10 /* Reselected */
#define SSTAT0_SGE 0x08 /* SCSI gross error */
#define SSTAT0_UDC 0x04 /* Unexpected disconnect */
#define SSTAT0_RST 0x02 /* SCSI RST/ received */
#define SSTAT0_PAR 0x01 /* Parity error */
/* And uses SSTAT0 for what was SSTAT1 */
#define SSTAT1_REG 0x0e /* SCSI status 1 ro */
#define SSTAT1_ILF 0x80 /* SIDL full */
#define SSTAT1_ORF 0x40 /* SODR full */
#define SSTAT1_OLF 0x20 /* SODL full */
#define SSTAT1_AIP 0x10 /* Arbitration in progress */
#define SSTAT1_LOA 0x08 /* Lost arbitration */
#define SSTAT1_WOA 0x04 /* Won arbitration */
#define SSTAT1_RST 0x02 /* Instant readout of RST/ */
#define SSTAT1_SDP 0x01 /* Instant readout of SDP/ */
#define SSTAT2_REG 0x0f /* SCSI status 2 ro */
#define SSTAT2_FF3 0x80 /* number of bytes in synchronous */
#define SSTAT2_FF2 0x40 /* data FIFO */
#define SSTAT2_FF1 0x20
#define SSTAT2_FF0 0x10
#define SSTAT2_FF_MASK 0xf0
#define SSTAT2_FF_SHIFT 4
/*
* Latched signals, latched on the leading edge of REQ/ for initiators,
* ACK/ for targets.
*/
#define SSTAT2_SDP 0x08 /* SDP */
#define SSTAT2_MSG 0x04 /* MSG */
#define SSTAT2_CD 0x02 /* C/D */
#define SSTAT2_IO 0x01 /* I/O */
#define SSTAT2_PHASE_CMDOUT SSTAT2_CD
#define SSTAT2_PHASE_DATAIN SSTAT2_IO
#define SSTAT2_PHASE_DATAOUT 0
#define SSTAT2_PHASE_MSGIN (SSTAT2_CD|SSTAT2_IO|SSTAT2_MSG)
#define SSTAT2_PHASE_MSGOUT (SSTAT2_CD|SSTAT2_MSG)
#define SSTAT2_PHASE_STATIN (SSTAT2_CD|SSTAT2_IO)
#define SSTAT2_PHASE_MASK (SSTAT2_CD|SSTAT2_IO|SSTAT2_MSG)
/* NCR53c700-66 only */
#define SCRATCHA_REG_00 0x10 /* through 0x13 Scratch A rw */
/* NCR53c710 and higher */
#define DSA_REG 0x10 /* DATA structure address */
#define CTEST0_REG_700 0x14 /* Chip test 0 ro */
#define CTEST0_REG_800 0x18 /* Chip test 0 rw, general purpose */
/* 0x80 - 0x04 are reserved */
#define CTEST0_700_RTRG 0x02 /* Real target mode */
#define CTEST0_700_DDIR 0x01 /* Data direction, 1 =
* SCSI bus to host, 0 =
* host to SCSI.
*/
#define CTEST1_REG_700 0x15 /* Chip test 1 ro */
#define CTEST1_REG_800 0x19 /* Chip test 1 ro */
#define CTEST1_FMT3 0x80 /* Identify which byte lanes are empty */
#define CTEST1_FMT2 0x40 /* in the DMA FIFO */
#define CTEST1_FMT1 0x20
#define CTEST1_FMT0 0x10
#define CTEST1_FFL3 0x08 /* Identify which bytes lanes are full */
#define CTEST1_FFL2 0x04 /* in the DMA FIFO */
#define CTEST1_FFL1 0x02
#define CTEST1_FFL0 0x01
#define CTEST2_REG_700 0x16 /* Chip test 2 ro */
#define CTEST2_REG_800 0x1a /* Chip test 2 ro */
#define CTEST2_800_DDIR 0x80 /* 1 = SCSI->host */
#define CTEST2_800_SIGP 0x40 /* A copy of SIGP in ISTAT.
Reading this register clears */
#define CTEST2_800_CIO 0x20 /* Configured as IO */.
#define CTEST2_800_CM 0x10 /* Configured as memory */
/* 0x80 - 0x40 are reserved on 700 series chips */
#define CTEST2_700_SOFF 0x20 /* SCSI Offset Compare,
* As an initiator, this bit is
* one when the synchronous offset
* is zero, as a target this bit
* is one when the synchronous
* offset is at the maximum
* defined in SXFER
*/
#define CTEST2_700_SFP 0x10 /* SCSI FIFO parity bit,
* reading CTEST3 unloads a byte
* from the FIFO and sets this
*/
#define CTEST2_700_DFP 0x08 /* DMA FIFO parity bit,
* reading CTEST6 unloads a byte
* from the FIFO and sets this
*/
#define CTEST2_TEOP 0x04 /* SCSI true end of process,
* indicates a totally finished
* transfer
*/
#define CTEST2_DREQ 0x02 /* Data request signal */
/* 0x01 is reserved on 700 series chips */
#define CTEST2_800_DACK 0x01
/*
* Chip test 3 ro
* Unloads the bottom byte of the eight deep SCSI synchronous FIFO,
* check SSTAT2 FIFO full bits to determine size. Note that a GROSS
* error results if a read is attempted on this register. Also note
* that 16 and 32 bit reads of this register will cause corruption.
*/
#define CTEST3_REG_700 0x17
/* Chip test 3 rw */
#define CTEST3_REG_800 0x1b
#define CTEST3_800_V3 0x80 /* Chip revision */
#define CTEST3_800_V2 0x40
#define CTEST3_800_V1 0x20
#define CTEST3_800_V0 0x10
#define CTEST3_800_FLF 0x08 /* Flush DMA FIFO */
#define CTEST3_800_CLF 0x04 /* Clear DMA FIFO */
#define CTEST3_800_FM 0x02 /* Fetch mode pin */
/* bit 0 is reserved on 800 series chips */
#define CTEST4_REG_700 0x18 /* Chip test 4 rw */
#define CTEST4_REG_800 0x21 /* Chip test 4 rw */
/* 0x80 is reserved on 700 series chips */
#define CTEST4_800_BDIS 0x80 /* Burst mode disable */
#define CTEST4_ZMOD 0x40 /* High impedance mode */
#define CTEST4_SZM 0x20 /* SCSI bus high impedance */
#define CTEST4_700_SLBE 0x10 /* SCSI loopback enabled */
#define CTEST4_800_SRTM 0x10 /* Shadow Register Test Mode */
#define CTEST4_700_SFWR 0x08 /* SCSI FIFO write enable,
* redirects writes from SODL
* to the SCSI FIFO.
*/
#define CTEST4_800_MPEE 0x08 /* Enable parity checking
during master cycles on PCI
bus */
/*
* These bits send the contents of the CTEST6 register to the appropriate
* byte lane of the 32 bit DMA FIFO. Normal operation is zero, otherwise
* the high bit means the low two bits select the byte lane.
*/
#define CTEST4_FBL2 0x04
#define CTEST4_FBL1 0x02
#define CTEST4_FBL0 0x01
#define CTEST4_FBL_MASK 0x07
#define CTEST4_FBL_0 0x04 /* Select DMA FIFO byte lane 0 */
#define CTEST4_FBL_1 0x05 /* Select DMA FIFO byte lane 1 */
#define CTEST4_FBL_2 0x06 /* Select DMA FIFO byte lane 2 */
#define CTEST4_FBL_3 0x07 /* Select DMA FIFO byte lane 3 */
#define CTEST4_800_SAVE (CTEST4_800_BDIS)
#define CTEST5_REG_700 0x19 /* Chip test 5 rw */
#define CTEST5_REG_800 0x22 /* Chip test 5 rw */
/*
* Clock Address Incrementor. When set, it increments the
* DNAD register to the next bus size boundary. It automatically
* resets itself when the operation is complete.
*/
#define CTEST5_ADCK 0x80
/*
* Clock Byte Counter. When set, it decrements the DBC register to
* the next bus size boundary.
*/
#define CTEST5_BBCK 0x40
/*
* Reset SCSI Offset. Setting this bit to 1 clears the current offset
* pointer in the SCSI synchronous offset counter (SSTAT). This bit
* is set to 1 if a SCSI Gross Error Condition occurs. The offset should
* be cleared when a synchronous transfer fails. When written, it is
* automatically cleared after the SCSI synchronous offset counter is
* reset.
*/
/* Bit 5 is reserved on 800 series chips */
#define CTEST5_700_ROFF 0x20
/*
* Master Control for Set or Reset pulses. When 1, causes the low
* four bits of register to set when set, 0 causes the low bits to
* clear when set.
*/
#define CTEST5_MASR 0x10
#define CTEST5_DDIR 0x08 /* DMA direction */
/*
* Bits 2-0 are reserved on 800 series chips
*/
#define CTEST5_700_EOP 0x04 /* End of process */
#define CTEST5_700_DREQ 0x02 /* Data request */
#define CTEST5_700_DACK 0x01 /* Data acknowledge */
/*
* Chip test 6 rw - writing to this register writes to the byte
* lane in the DMA FIFO as determined by the FBL bits in the CTEST4
* register.
*/
#define CTEST6_REG_700 0x1a
#define CTEST6_REG_800 0x23
#define CTEST7_REG 0x1b /* Chip test 7 rw */
/* 0x80 - 0x40 are reserved on NCR53c700 and NCR53c700-66 chips */
#define CTEST7_10_CDIS 0x80 /* Cache burst disable */
#define CTEST7_10_SC1 0x40 /* Snoop control bits */
#define CTEST7_10_SC0 0x20
#define CTEST7_10_SC_MASK 0x60
/* 0x20 is reserved on the NCR53c700 */
#define CTEST7_0060_FM 0x20 /* Fetch mode */
#define CTEST7_STD 0x10 /* Selection timeout disable */
#define CTEST7_DFP 0x08 /* DMA FIFO parity bit for CTEST6 */
#define CTEST7_EVP 0x04 /* 1 = host bus even parity, 0 = odd */
#define CTEST7_10_TT1 0x02 /* Transfer type */
#define CTEST7_00_DC 0x02 /* Set to drive DC low during instruction
fetch */
#define CTEST7_DIFF 0x01 /* Differential mode */
#define CTEST7_SAVE ( CTEST7_EVP | CTEST7_DIFF )
#define TEMP_REG 0x1c /* through 0x1f Temporary stack rw */
#define DFIFO_REG 0x20 /* DMA FIFO rw */
/*
* 0x80 is reserved on the NCR53c710, the CLF and FLF bits have been
* moved into the CTEST8 register.
*/
#define DFIFO_00_FLF 0x80 /* Flush DMA FIFO to memory */
#define DFIFO_00_CLF 0x40 /* Clear DMA and SCSI FIFOs */
#define DFIFO_BO6 0x40
#define DFIFO_BO5 0x20
#define DFIFO_BO4 0x10
#define DFIFO_BO3 0x08
#define DFIFO_BO2 0x04
#define DFIFO_BO1 0x02
#define DFIFO_BO0 0x01
#define DFIFO_10_BO_MASK 0x7f /* 7 bit counter */
#define DFIFO_00_BO_MASK 0x3f /* 6 bit counter */
/*
* Interrupt status rw
* Note that this is the only register which can be read while SCSI
* SCRIPTS are being executed.
*/
#define ISTAT_REG_700 0x21
#define ISTAT_REG_800 0x14
#define ISTAT_ABRT 0x80 /* Software abort, write
*1 to abort, wait for interrupt. */
/* 0x40 and 0x20 are reserved on NCR53c700 and NCR53c700-66 chips */
#define ISTAT_10_SRST 0x40 /* software reset */
#define ISTAT_10_SIGP 0x20 /* signal script */
/* 0x10 is reserved on NCR53c700 series chips */
#define ISTAT_800_SEM 0x10 /* semaphore */
#define ISTAT_CON 0x08 /* 1 when connected */
#define ISTAT_800_INTF 0x04 /* Interrupt on the fly */
#define ISTAT_700_PRE 0x04 /* Pointer register empty.
* Set to 1 when DSPS and DSP
* registers are empty in pipeline
* mode, always set otherwise.
*/
#define ISTAT_SIP 0x02 /* SCSI interrupt pending from
* SCSI portion of SIOP see
* SSTAT0
*/
#define ISTAT_DIP 0x01 /* DMA interrupt pending
* see DSTAT
*/
/* NCR53c700-66 and NCR53c710 only */
#define CTEST8_REG 0x22 /* Chip test 8 rw */
#define CTEST8_0066_EAS 0x80 /* Enable alternate SCSI clock,
* ie read from SCLK/ rather than CLK/
*/
#define CTEST8_0066_EFM 0x40 /* Enable fetch and master outputs */
#define CTEST8_0066_GRP 0x20 /* Generate Receive Parity for
* pass through. This insures that
* bad parity won't reach the host
* bus.
*/
#define CTEST8_0066_TE 0x10 /* TolerANT enable. Enable
* active negation, should only
* be used for slow SCSI
* non-differential.
*/
#define CTEST8_0066_HSC 0x08 /* Halt SCSI clock */
#define CTEST8_0066_SRA 0x04 /* Shorten REQ/ACK filtering,
* must be set for fast SCSI-II
* speeds.
*/
#define CTEST8_0066_DAS 0x02 /* Disable automatic target/initiator
* switching.
*/
#define CTEST8_0066_LDE 0x01 /* Last disconnect enable.
* The status of pending
* disconnect is maintained by
* the core, eliminating
* the possibility of missing a
* selection or reselection
* while waiting to fetch a
* WAIT DISCONNECT opcode.
*/
#define CTEST8_10_V3 0x80 /* Chip revision */
#define CTEST8_10_V2 0x40
#define CTEST8_10_V1 0x20
#define CTEST8_10_V0 0x10
#define CTEST8_10_V_MASK 0xf0
#define CTEST8_10_FLF 0x08 /* Flush FIFOs */
#define CTEST8_10_CLF 0x04 /* Clear FIFOs */
#define CTEST8_10_FM 0x02 /* Fetch pin mode */
#define CTEST8_10_SM 0x01 /* Snoop pin mode */
/*
* The CTEST9 register may be used to differentiate between a
* NCR53c700 and a NCR53c710.
*
* Write 0xff to this register.
* Read it.
* If the contents are 0xff, it is a NCR53c700
* If the contents are 0x00, it is a NCR53c700-66 first revision
* If the contents are some other value, it is some other NCR53c700-66
*/
#define CTEST9_REG_00 0x23 /* Chip test 9 ro */
#define LCRC_REG_10 0x23
/*
* 0x24 through 0x27 are the DMA byte counter register. Instructions
* write their high 8 bits into the DCMD register, the low 24 bits into
* the DBC register.
*
* Function is dependent on the command type being executed.
*/
#define DBC_REG 0x24
/*
* For Block Move Instructions, DBC is a 24 bit quantity representing
* the number of bytes to transfer.
* For Transfer Control Instructions, DBC is bit fielded as follows :
*/
/* Bits 20 - 23 should be clear */
#define DBC_TCI_TRUE (1 << 19) /* Jump when true */
#define DBC_TCI_COMPARE_DATA (1 << 18) /* Compare data */
#define DBC_TCI_COMPARE_PHASE (1 << 17) /* Compare phase with DCMD field */
#define DBC_TCI_WAIT_FOR_VALID (1 << 16) /* Wait for REQ */
/* Bits 8 - 15 are reserved on some implementations ? */
#define DBC_TCI_MASK_MASK 0xff00 /* Mask for data compare */
#define DBC_TCI_MASK_SHIFT 8
#define DBC_TCI_DATA_MASK 0xff /* Data to be compared */
#define DBC_TCI_DATA_SHIFT 0
#define DBC_RWRI_IMMEDIATE_MASK 0xff00 /* Immediate data */
#define DBC_RWRI_IMMEDIATE_SHIFT 8 /* Amount to shift */
#define DBC_RWRI_ADDRESS_MASK 0x3f0000 /* Register address */
#define DBC_RWRI_ADDRESS_SHIFT 16
/*
* DMA command r/w
*/
#define DCMD_REG 0x27
#define DCMD_TYPE_MASK 0xc0 /* Masks off type */
#define DCMD_TYPE_BMI 0x00 /* Indicates a Block Move instruction */
#define DCMD_BMI_IO 0x01 /* I/O, CD, and MSG bits selecting */
#define DCMD_BMI_CD 0x02 /* the phase for the block MOVE */
#define DCMD_BMI_MSG 0x04 /* instruction */
#define DCMD_BMI_OP_MASK 0x18 /* mask for opcode */
#define DCMD_BMI_OP_MOVE_T 0x00 /* MOVE */
#define DCMD_BMI_OP_MOVE_I 0x08 /* MOVE Initiator */
#define DCMD_BMI_INDIRECT 0x20 /* Indirect addressing */
#define DCMD_TYPE_TCI 0x80 /* Indicates a Transfer Control
instruction */
#define DCMD_TCI_IO 0x01 /* I/O, CD, and MSG bits selecting */
#define DCMD_TCI_CD 0x02 /* the phase for the block MOVE */
#define DCMD_TCI_MSG 0x04 /* instruction */
#define DCMD_TCI_OP_MASK 0x38 /* mask for opcode */
#define DCMD_TCI_OP_JUMP 0x00 /* JUMP */
#define DCMD_TCI_OP_CALL 0x08 /* CALL */
#define DCMD_TCI_OP_RETURN 0x10 /* RETURN */
#define DCMD_TCI_OP_INT 0x18 /* INT */
#define DCMD_TYPE_RWRI 0x40 /* Indicates I/O or register Read/Write
instruction */
#define DCMD_RWRI_OPC_MASK 0x38 /* Opcode mask */
#define DCMD_RWRI_OPC_WRITE 0x28 /* Write SFBR to register */
#define DCMD_RWRI_OPC_READ 0x30 /* Read register to SFBR */
#define DCMD_RWRI_OPC_MODIFY 0x38 /* Modify in place */
#define DCMD_RWRI_OP_MASK 0x07
#define DCMD_RWRI_OP_MOVE 0x00
#define DCMD_RWRI_OP_SHL 0x01
#define DCMD_RWRI_OP_OR 0x02
#define DCMD_RWRI_OP_XOR 0x03
#define DCMD_RWRI_OP_AND 0x04
#define DCMD_RWRI_OP_SHR 0x05
#define DCMD_RWRI_OP_ADD 0x06
#define DCMD_RWRI_OP_ADDC 0x07
#define DCMD_TYPE_MMI 0xc0 /* Indicates a Memory Move instruction
(three words) */
#define DNAD_REG 0x28 /* through 0x2b DMA next address for
data */
#define DSP_REG 0x2c /* through 0x2f DMA SCRIPTS pointer rw */
#define DSPS_REG 0x30 /* through 0x33 DMA SCRIPTS pointer
save rw */
#define DMODE_REG_00 0x34 /* DMA mode rw */
#define DMODE_00_BL1 0x80 /* Burst length bits */
#define DMODE_00_BL0 0x40
#define DMODE_BL_MASK 0xc0
/* Burst lengths (800) */
#define DMODE_BL_2 0x00 /* 2 transfer */
#define DMODE_BL_4 0x40 /* 4 transfers */
#define DMODE_BL_8 0x80 /* 8 transfers */
#define DMODE_BL_16 0xc0 /* 16 transfers */
#define DMODE_700_BW16 0x20 /* Host buswidth = 16 */
#define DMODE_700_286 0x10 /* 286 mode */
#define DMODE_700_IOM 0x08 /* Transfer to IO port */
#define DMODE_700_FAM 0x04 /* Fixed address mode */
#define DMODE_700_PIPE 0x02 /* Pipeline mode disables
* automatic fetch / exec
*/
#define DMODE_MAN 0x01 /* Manual start mode,
* requires a 1 to be written
* to the start DMA bit in the DCNTL
* register to run scripts
*/
#define DMODE_700_SAVE ( DMODE_00_BL_MASK | DMODE_00_BW16 | DMODE_00_286 )
/* NCR53c800 series only */
#define SCRATCHA_REG_800 0x34 /* through 0x37 Scratch A rw */
/* NCR53c710 only */
#define SCRATCB_REG_10 0x34 /* through 0x37 scratch B rw */
#define DMODE_REG_10 0x38 /* DMA mode rw, NCR53c710 and newer */
#define DMODE_800_SIOM 0x20 /* Source IO = 1 */
#define DMODE_800_DIOM 0x10 /* Destination IO = 1 */
#define DMODE_800_ERL 0x08 /* Enable Read Line */
/* 35-38 are reserved on 700 and 700-66 series chips */
#define DIEN_REG 0x39 /* DMA interrupt enable rw */
/* 0x80, 0x40, and 0x20 are reserved on 700-series chips */
#define DIEN_800_MDPE 0x40 /* Master data parity error */
#define DIEN_800_BF 0x20 /* BUS fault */
#define DIEN_ABRT 0x10 /* Enable aborted interrupt */
#define DIEN_SSI 0x08 /* Enable single step interrupt */
#define DIEN_SIR 0x04 /* Enable SCRIPTS INT command
* interrupt
*/
/* 0x02 is reserved on 800 series chips */
#define DIEN_700_WTD 0x02 /* Enable watchdog timeout interrupt */
#define DIEN_700_OPC 0x01 /* Enable illegal instruction
* interrupt
*/
#define DIEN_800_IID 0x01 /* Same meaning, different name */
/*
* DMA watchdog timer rw
* set in 16 CLK input periods.
*/
#define DWT_REG 0x3a
/* DMA control rw */
#define DCNTL_REG 0x3b
#define DCNTL_700_CF1 0x80 /* Clock divisor bits */
#define DCNTL_700_CF0 0x40
#define DCNTL_700_CF_MASK 0xc0
/* Clock divisors Divisor SCLK range (MHZ) */
#define DCNTL_700_CF_2 0x00 /* 2.0 37.51-50.00 */
#define DCNTL_700_CF_1_5 0x40 /* 1.5 25.01-37.50 */
#define DCNTL_700_CF_1 0x80 /* 1.0 16.67-25.00 */
#define DCNTL_700_CF_3 0xc0 /* 3.0 50.01-66.67 (53c700-66) */
#define DCNTL_700_S16 0x20 /* Load scripts 16 bits at a time */
#define DCNTL_SSM 0x10 /* Single step mode */
#define DCNTL_700_LLM 0x08 /* Low level mode, can only be set
* after selection */
#define DCNTL_800_IRQM 0x08 /* Totem pole IRQ pin */
#define DCNTL_STD 0x04 /* Start DMA / SCRIPTS */
/* 0x02 is reserved */
#define DCNTL_00_RST 0x01 /* Software reset, resets everything
* but 286 mode bit in DMODE. On the
* NCR53c710, this bit moved to CTEST8
*/
#define DCNTL_10_COM 0x01 /* 700 software compatibility mode */
#define DCNTL_700_SAVE ( DCNTL_CF_MASK | DCNTL_S16)
/* NCR53c700-66 only */
#define SCRATCHB_REG_00 0x3c /* through 0x3f scratch b rw */
#define SCRATCHB_REG_800 0x5c /* through 0x5f scratch b rw */
/* NCR53c710 only */
#define ADDER_REG_10 0x3c /* Adder, NCR53c710 only */
#define SIEN1_REG_800 0x41
#define SIEN1_800_STO 0x04 /* selection/reselection timeout */
#define SIEN1_800_GEN 0x02 /* general purpose timer */
#define SIEN1_800_HTH 0x01 /* handshake to handshake */
#define SIST1_REG_800 0x43
#define SIST1_800_STO 0x04 /* selection/reselection timeout */
#define SIST1_800_GEN 0x02 /* general purpose timer */
#define SIST1_800_HTH 0x01 /* handshake to handshake */
#define SLPAR_REG_800 0x44 /* Parity */
#define MACNTL_REG_800 0x46 /* Memory access control */
#define MACNTL_800_TYP3 0x80
#define MACNTL_800_TYP2 0x40
#define MACNTL_800_TYP1 0x20
#define MACNTL_800_TYP0 0x10
#define MACNTL_800_DWR 0x08
#define MACNTL_800_DRD 0x04
#define MACNTL_800_PSCPT 0x02
#define MACNTL_800_SCPTS 0x01
#define GPCNTL_REG_800 0x47 /* General Purpose Pin Control */
/* Timeouts are expressed such that 0=off, 1=100us, doubling after that */
#define STIME0_REG_800 0x48 /* SCSI Timer Register 0 */
#define STIME0_800_HTH_MASK 0xf0 /* Handshake to Handshake timeout */
#define STIME0_800_HTH_SHIFT 4
#define STIME0_800_SEL_MASK 0x0f /* Selection timeout */
#define STIME0_800_SEL_SHIFT 0
#define STIME1_REG_800 0x49
#define STIME1_800_GEN_MASK 0x0f /* General purpose timer */
#define RESPID_REG_800 0x4a /* Response ID, bit fielded. 8
bits on narrow chips, 16 on WIDE */
#define STEST0_REG_800 0x4c
#define STEST0_800_SLT 0x08 /* Selection response logic test */
#define STEST0_800_ART 0x04 /* Arbitration priority encoder test */
#define STEST0_800_SOZ 0x02 /* Synchronous offset zero */
#define STEST0_800_SOM 0x01 /* Synchronous offset maximum */
#define STEST1_REG_800 0x4d
#define STEST1_800_SCLK 0x80 /* Disable SCSI clock */
#define STEST2_REG_800 0x4e
#define STEST2_800_SCE 0x80 /* Enable SOCL/SODL */
#define STEST2_800_ROF 0x40 /* Reset SCSI sync offset */
#define STEST2_800_SLB 0x10 /* Enable SCSI loopback mode */
#define STEST2_800_SZM 0x08 /* SCSI high impedance mode */
#define STEST2_800_EXT 0x02 /* Extend REQ/ACK filter 30 to 60ns */
#define STEST2_800_LOW 0x01 /* SCSI low level mode */
#define STEST3_REG_800 0x4f
#define STEST3_800_TE 0x80 /* Enable active negation */
#define STEST3_800_STR 0x40 /* SCSI FIFO test read */
#define STEST3_800_HSC 0x20 /* Halt SCSI clock */
#define STEST3_800_DSI 0x10 /* Disable single initiator response */
#define STEST3_800_TTM 0x04 /* Time test mode */
#define STEST3_800_CSF 0x02 /* Clear SCSI FIFO */
#define STEST3_800_STW 0x01 /* SCSI FIFO test write */
#define OPTION_PARITY 0x1 /* Enable parity checking */
#define OPTION_TAGGED_QUEUE 0x2 /* Enable SCSI-II tagged queuing */
#define OPTION_700 0x8 /* Always run NCR53c700 scripts */
#define OPTION_INTFLY 0x10 /* Use INTFLY interrupts */
#define OPTION_DEBUG_INTR 0x20 /* Debug interrupts */
#define OPTION_DEBUG_INIT_ONLY 0x40 /* Run initialization code and
simple test code, return
DID_NO_CONNECT if any SCSI
commands are attempted. */
#define OPTION_DEBUG_READ_ONLY 0x80 /* Return DID_ERROR if any
SCSI write is attempted */
#define OPTION_DEBUG_TRACE 0x100 /* Animated trace mode, print
each address and instruction
executed to debug buffer. */
#define OPTION_DEBUG_SINGLE 0x200 /* stop after executing one
instruction */
#define OPTION_SYNCHRONOUS 0x400 /* Enable sync SCSI. */
#define OPTION_MEMORY_MAPPED 0x800 /* NCR registers have valid
memory mapping */
#define OPTION_IO_MAPPED 0x1000 /* NCR registers have valid
I/O mapping */
#define OPTION_DEBUG_PROBE_ONLY 0x2000 /* Probe only, don't even init */
#define OPTION_DEBUG_TESTS_ONLY 0x4000 /* Probe, init, run selected tests */
#define OPTION_DEBUG_TEST0 0x08000 /* Run test 0 */
#define OPTION_DEBUG_TEST1 0x10000 /* Run test 1 */
#define OPTION_DEBUG_TEST2 0x20000 /* Run test 2 */
#define OPTION_DEBUG_DUMP 0x40000 /* Dump commands */
#define OPTION_DEBUG_TARGET_LIMIT 0x80000 /* Only talk to target+luns specified */
#define OPTION_DEBUG_NCOMMANDS_LIMIT 0x100000 /* Limit the number of commands */
#define OPTION_DEBUG_SCRIPT 0x200000 /* Print when checkpoints are passed */
#define OPTION_DEBUG_FIXUP 0x400000 /* print fixup values */
#define OPTION_DEBUG_DSA 0x800000
#define OPTION_DEBUG_CORRUPTION 0x1000000 /* Detect script corruption */
#define OPTION_DEBUG_SDTR 0x2000000 /* Debug SDTR problem */
#define OPTION_DEBUG_MISMATCH 0x4000000 /* Debug phase mismatches */
#define OPTION_DISCONNECT 0x8000000 /* Allow disconnect */
#define OPTION_DEBUG_DISCONNECT 0x10000000
#define OPTION_ALWAYS_SYNCHRONOUS 0x20000000 /* Negotiate sync. transfers
on power up */
#define OPTION_DEBUG_QUEUES 0x80000000
#define OPTION_DEBUG_ALLOCATION 0x100000000LL
#define OPTION_DEBUG_SYNCHRONOUS 0x200000000LL /* Sanity check SXFER and
SCNTL3 registers */
#define OPTION_NO_ASYNC 0x400000000LL /* Don't automagically send
SDTR for async transfers when
we haven't been told to do
a synchronous transfer. */
#define OPTION_NO_PRINT_RACE 0x800000000LL /* Don't print message when
the reselect/WAIT DISCONNECT
race condition hits */
#if !defined(PERM_OPTIONS)
#define PERM_OPTIONS 0
#endif
struct NCR53c7x0_synchronous {
u32 select_indirect; /* Value used for indirect selection */
u32 script[8]; /* Size ?? Script used when target is
reselected */
unsigned char synchronous_want[5]; /* Per target desired SDTR */
/*
* Set_synchronous programs these, select_indirect and current settings after
* int_debug_should show a match.
*/
unsigned char sxfer_sanity, scntl3_sanity;
};
#define CMD_FLAG_SDTR 1 /* Initiating synchronous
transfer negotiation */
#define CMD_FLAG_WDTR 2 /* Initiating wide transfer
negotiation */
#define CMD_FLAG_DID_SDTR 4 /* did SDTR */
#define CMD_FLAG_DID_WDTR 8 /* did WDTR */
struct NCR53c7x0_table_indirect {
u32 count;
void *address;
};
enum ncr_event {
EVENT_NONE = 0,
/*
* Order is IMPORTANT, since these must correspond to the event interrupts
* in 53c7,8xx.scr
*/
EVENT_ISSUE_QUEUE = 0x5000000, /* Command was added to issue queue */
EVENT_START_QUEUE, /* Command moved to start queue */
EVENT_SELECT, /* Command completed selection */
EVENT_DISCONNECT, /* Command disconnected */
EVENT_RESELECT, /* Command reselected */
EVENT_COMPLETE, /* Command completed */
EVENT_IDLE,
EVENT_SELECT_FAILED,
EVENT_BEFORE_SELECT,
EVENT_RESELECT_FAILED
};
struct NCR53c7x0_event {
enum ncr_event event; /* What type of event */
unsigned char target;
unsigned char lun;
struct timeval time;
u32 *dsa; /* What's in the DSA register now (virt) */
/*
* A few things from that SCSI pid so we know what happened after
* the Scsi_Cmnd structure in question may have disappeared.
*/
unsigned long pid; /* The SCSI PID which caused this
event */
unsigned char cmnd[12];
};
/*
* Things in the NCR53c7x0_cmd structure are split into two parts :
*
* 1. A fixed portion, for things which are not accessed directly by static NCR
* code (ie, are referenced only by the Linux side of the driver,
* or only by dynamically generated code).
*
* 2. The DSA portion, for things which are accessed directly by static NCR
* code.
*
* This is a little ugly, but it
* 1. Avoids conflicts between the NCR code's picture of the structure, and
* Linux code's idea of what it looks like.
*
* 2. Minimizes the pain in the Linux side of the code needed
* to calculate real dsa locations for things, etc.
*
*/
struct NCR53c7x0_cmd {
void *real; /* Real, unaligned address for
free function */
void (* free)(void *, int); /* Command to deallocate; NULL
for structures allocated with
scsi_register, etc. */
Scsi_Cmnd *cmd; /* Associated Scsi_Cmnd
structure, Scsi_Cmnd points
at NCR53c7x0_cmd using
host_scribble structure */
int size; /* scsi_malloc'd size of this
structure */
int flags; /* CMD_* flags */
/*
* SDTR and WIDE messages are an either/or affair
* in this message, since we will go into message out and send
* _the whole mess_ without dropping out of message out to
* let the target go into message in after sending the first
* message.
*/
unsigned char select[11]; /* Select message, includes
IDENTIFY
(optional) QUEUE TAG
(optional) SDTR or WDTR
*/
volatile struct NCR53c7x0_cmd *next; /* Linux maintained lists (free,
running, eventually finished */
u32 *data_transfer_start; /* Start of data transfer routines */
u32 *data_transfer_end; /* Address after end of data transfer o
routines */
/*
* The following three fields were moved from the DSA proper to here
* since only dynamically generated NCR code refers to them, meaning
* we don't need dsa_* absolutes, and it is simpler to let the
* host code refer to them directly.
*/
/*
* HARD CODED : residual and saved_residual need to agree with the sizes
* used in NCR53c7,8xx.scr.
*
* FIXME: we want to consider the case where we have odd-length
* scatter/gather buffers and a WIDE transfer, in which case
* we'll need to use the CHAIN MOVE instruction. Ick.
*/
u32 residual[6]; /* Residual data transfer which
allows pointer code to work
right.
[0-1] : Conditional call to
appropriate other transfer
routine.
[2-3] : Residual block transfer
instruction.
[4-5] : Jump to instruction
after splice.
*/
u32 saved_residual[6]; /* Copy of old residual, so we
can get another partial
transfer and still recover
*/
u32 saved_data_pointer; /* Saved data pointer */
u32 dsa_next_addr; /* _Address_ of dsa_next field
in this dsa for RISCy
style constant. */
u32 dsa_addr; /* Address of dsa; RISCy style
constant */
u32 dsa[0]; /* Variable length (depending
on host type, number of scatter /
gather buffers, etc). */
};
struct NCR53c7x0_break {
u32 *address, old_instruction[2];
struct NCR53c7x0_break *next;
unsigned char old_size; /* Size of old instruction */
};
/* Indicates that the NCR is not executing code */
#define STATE_HALTED 0
/*
* Indicates that the NCR is executing the wait for select / reselect
* script. Only used when running NCR53c700 compatible scripts, only
* state during which an ABORT is _not_ considered an error condition.
*/
#define STATE_WAITING 1
/* Indicates that the NCR is executing other code. */
#define STATE_RUNNING 2
/*
* Indicates that the NCR was being aborted.
*/
#define STATE_ABORTING 3
/* Indicates that the NCR was successfully aborted. */
#define STATE_ABORTED 4
/* Indicates that the NCR has been disabled due to a fatal error */
#define STATE_DISABLED 5
/*
* Where knowledge of SCSI SCRIPT(tm) specified values are needed
* in an interrupt handler, an interrupt handler exists for each
* different SCSI script so we don't have name space problems.
*
* Return values of these handlers are as follows :
*/
#define SPECIFIC_INT_NOTHING 0 /* don't even restart */
#define SPECIFIC_INT_RESTART 1 /* restart at the next instruction */
#define SPECIFIC_INT_ABORT 2 /* recoverable error, abort cmd */
#define SPECIFIC_INT_PANIC 3 /* unrecoverable error, panic */
#define SPECIFIC_INT_DONE 4 /* normal command completion */
#define SPECIFIC_INT_BREAK 5 /* break point encountered */
struct NCR53c7x0_hostdata {
int size; /* Size of entire Scsi_Host
structure */
int board; /* set to board type, useful if
we have host specific things,
ie, a general purpose I/O
bit is being used to enable
termination, etc. */
int chip; /* set to chip type; 700-66 is
700-66, rest are last three
digits of part number */
/*
* PCI device, only for NCR53c8x0 chips.
* pci_valid indicates that the PCI configuration information
* is valid, and we can twiddle MAX_LAT, etc. as recommended
* for maximum performance in the NCR documentation.
*/
struct pci_dev *pci_dev;
unsigned pci_valid:1;
u32 *dsp; /* dsp to restart with after
all stacked interrupts are
handled. */
unsigned dsp_changed:1; /* Has dsp changed within this
set of stacked interrupts ? */
unsigned char dstat; /* Most recent value of dstat */
unsigned dstat_valid:1;
unsigned expecting_iid:1; /* Expect IID interrupt */
unsigned expecting_sto:1; /* Expect STO interrupt */
/*
* The code stays cleaner if we use variables with function
* pointers and offsets that are unique for the different
* scripts rather than having a slew of switch(hostdata->chip)
* statements.
*
* It also means that the #defines from the SCSI SCRIPTS(tm)
* don't have to be visible outside of the script-specific
* instructions, preventing name space pollution.
*/
void (* init_fixup)(struct Scsi_Host *host);
void (* init_save_regs)(struct Scsi_Host *host);
void (* dsa_fixup)(struct NCR53c7x0_cmd *cmd);
void (* soft_reset)(struct Scsi_Host *host);
int (* run_tests)(struct Scsi_Host *host);
/*
* Called when DSTAT_SIR is set, indicating an interrupt generated
* by the INT instruction, where values are unique for each SCSI
* script. Should return one of the SPEC_* values.
*/
int (* dstat_sir_intr)(struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd);
int dsa_len; /* Size of DSA structure */
/*
* Location of DSA fields for the SCSI SCRIPT corresponding to this
* chip.
*/
s32 dsa_start;
s32 dsa_end;
s32 dsa_next;
s32 dsa_prev;
s32 dsa_cmnd;
s32 dsa_select;
s32 dsa_msgout;
s32 dsa_cmdout;
s32 dsa_dataout;
s32 dsa_datain;
s32 dsa_msgin;
s32 dsa_msgout_other;
s32 dsa_write_sync;
s32 dsa_write_resume;
s32 dsa_check_reselect;
s32 dsa_status;
s32 dsa_saved_pointer;
s32 dsa_jump_dest;
/*
* Important entry points that generic fixup code needs
* to know about, fixed up.
*/
s32 E_accept_message;
s32 E_command_complete;
s32 E_data_transfer;
s32 E_dsa_code_template;
s32 E_dsa_code_template_end;
s32 E_end_data_transfer;
s32 E_msg_in;
s32 E_initiator_abort;
s32 E_other_transfer;
s32 E_other_in;
s32 E_other_out;
s32 E_target_abort;
s32 E_debug_break;
s32 E_reject_message;
s32 E_respond_message;
s32 E_select;
s32 E_select_msgout;
s32 E_test_0;
s32 E_test_1;
s32 E_test_2;
s32 E_test_3;
s32 E_dsa_zero;
s32 E_cmdout_cmdout;
s32 E_wait_reselect;
s32 E_dsa_code_begin;
long long options; /* Bitfielded set of options enabled */
volatile u32 test_completed; /* Test completed */
int test_running; /* Test currently running */
s32 test_source;
volatile s32 test_dest;
volatile int state; /* state of driver, only used for
OPTION_700 */
unsigned char dmode; /*
* set to the address of the DMODE
* register for this chip.
*/
unsigned char istat; /*
* set to the address of the ISTAT
* register for this chip.
*/
int scsi_clock; /*
* SCSI clock in HZ. 0 may be used
* for unknown, although this will
* disable synchronous negotiation.
*/
volatile int intrs; /* Number of interrupts */
volatile int resets; /* Number of SCSI resets */
unsigned char saved_dmode;
unsigned char saved_ctest4;
unsigned char saved_ctest7;
unsigned char saved_dcntl;
unsigned char saved_scntl3;
unsigned char this_id_mask;
/* Debugger information */
struct NCR53c7x0_break *breakpoints, /* Linked list of all break points */
*breakpoint_current; /* Current breakpoint being stepped
through, NULL if we are running
normally. */
#ifdef NCR_DEBUG
int debug_size; /* Size of debug buffer */
volatile int debug_count; /* Current data count */
volatile char *debug_buf; /* Output ring buffer */
volatile char *debug_write; /* Current write pointer */
volatile char *debug_read; /* Current read pointer */
#endif /* def NCR_DEBUG */
/* XXX - primitive debugging junk, remove when working ? */
int debug_print_limit; /* Number of commands to print
out exhaustive debugging
information for if
OPTION_DEBUG_DUMP is set */
unsigned char debug_lun_limit[16]; /* If OPTION_DEBUG_TARGET_LIMIT
set, puke if commands are sent
to other target/lun combinations */
int debug_count_limit; /* Number of commands to execute
before puking to limit debugging
output */
volatile unsigned idle:1; /* set to 1 if idle */
/*
* Table of synchronous+wide transfer parameters set on a per-target
* basis.
*/
volatile struct NCR53c7x0_synchronous sync[16];
volatile Scsi_Cmnd *issue_queue;
/* waiting to be issued by
Linux driver */
volatile struct NCR53c7x0_cmd *running_list;
/* commands running, maintained
by Linux driver */
volatile struct NCR53c7x0_cmd *curr; /* currently connected
nexus, ONLY valid for
NCR53c700/NCR53c700-66
*/
volatile struct NCR53c7x0_cmd *spare; /* pointer to spare,
allocated at probe time,
which we can use for
initialization */
volatile struct NCR53c7x0_cmd *free;
int max_cmd_size; /* Maximum size of NCR53c7x0_cmd
based on number of
scatter/gather segments, etc.
*/
volatile int num_cmds; /* Number of commands
allocated */
volatile int extra_allocate;
volatile unsigned char cmd_allocated[16]; /* Have we allocated commands
for this target yet? If not,
do so ASAP */
volatile unsigned char busy[16][8]; /* number of commands
executing on each target
*/
/*
* Eventually, I'll switch to a coroutine for calling
* cmd->done(cmd), etc. so that we can overlap interrupt
* processing with this code for maximum performance.
*/
volatile struct NCR53c7x0_cmd *finished_queue;
/* Shared variables between SCRIPT and host driver */
volatile u32 *schedule; /* Array of JUMPs to dsa_begin
routines of various DSAs.
When not in use, replace
with jump to next slot */
volatile unsigned char msg_buf[16]; /* buffer for messages
other than the command
complete message */
/* Per-target default synchronous and WIDE messages */
volatile unsigned char synchronous_want[16][5];
volatile unsigned char wide_want[16][4];
/* Bit fielded set of targets we want to speak synchronously with */
volatile u16 initiate_sdtr;
/* Bit fielded set of targets we want to speak wide with */
volatile u16 initiate_wdtr;
/* Bit fielded list of targets we've talked to. */
volatile u16 talked_to;
/* Array of bit-fielded lun lists that we need to request_sense */
volatile unsigned char request_sense[16];
u32 addr_reconnect_dsa_head; /* RISCy style constant,
address of following */
volatile u32 reconnect_dsa_head;
/* Data identifying nexus we are trying to match during reselection */
volatile unsigned char reselected_identify; /* IDENTIFY message */
volatile unsigned char reselected_tag; /* second byte of queue tag
message or 0 */
/* These were static variables before we moved them */
s32 NCR53c7xx_zero;
s32 NCR53c7xx_sink;
u32 NOP_insn;
char NCR53c7xx_msg_reject;
char NCR53c7xx_msg_abort;
char NCR53c7xx_msg_nop;
volatile int event_size, event_index;
volatile struct NCR53c7x0_event *events;
/* If we need to generate code to kill off the currently connected
command, this is where we do it. Should have a BMI instruction
to source or sink the current data, followed by a JUMP
to abort_connected */
u32 *abort_script;
int script_count; /* Size of script in words */
u32 script[0]; /* Relocated SCSI script */
};
#define IRQ_NONE 255
#define DMA_NONE 255
#define IRQ_AUTO 254
#define DMA_AUTO 254
#define BOARD_GENERIC 0
#define NCR53c7x0_insn_size(insn) \
(((insn) & DCMD_TYPE_MASK) == DCMD_TYPE_MMI ? 3 : 2)
#define NCR53c7x0_local_declare() \
volatile unsigned char *NCR53c7x0_address_memory; \
unsigned int NCR53c7x0_address_io; \
int NCR53c7x0_memory_mapped
#define NCR53c7x0_local_setup(host) \
NCR53c7x0_address_memory = (void *) (host)->base; \
NCR53c7x0_address_io = (unsigned int) (host)->io_port; \
NCR53c7x0_memory_mapped = ((struct NCR53c7x0_hostdata *) \
host->hostdata)-> options & OPTION_MEMORY_MAPPED
#define NCR53c7x0_read8(address) \
(NCR53c7x0_memory_mapped ? \
(unsigned int)readb(NCR53c7x0_address_memory + (address)) : \
inb(NCR53c7x0_address_io + (address)))
#define NCR53c7x0_read16(address) \
(NCR53c7x0_memory_mapped ? \
(unsigned int)readw(NCR53c7x0_address_memory + (address)) : \
inw(NCR53c7x0_address_io + (address)))
#define NCR53c7x0_read32(address) \
(NCR53c7x0_memory_mapped ? \
(unsigned int) readl(NCR53c7x0_address_memory + (address)) : \
inl(NCR53c7x0_address_io + (address)))
#define NCR53c7x0_write8(address,value) \
(NCR53c7x0_memory_mapped ? \
({writeb((value), NCR53c7x0_address_memory + (address)); mb();}) : \
outb((value), NCR53c7x0_address_io + (address)))
#define NCR53c7x0_write16(address,value) \
(NCR53c7x0_memory_mapped ? \
({writew((value), NCR53c7x0_address_memory + (address)); mb();}) : \
outw((value), NCR53c7x0_address_io + (address)))
#define NCR53c7x0_write32(address,value) \
(NCR53c7x0_memory_mapped ? \
({writel((value), NCR53c7x0_address_memory + (address)); mb();}) : \
outl((value), NCR53c7x0_address_io + (address)))
/* Patch arbitrary 32 bit words in the script */
#define patch_abs_32(script, offset, symbol, value) \
for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
(u32)); ++i) { \
(script)[A_##symbol##_used[i] - (offset)] += (value); \
if (hostdata->options & OPTION_DEBUG_FIXUP) \
printk("scsi%d : %s reference %d at 0x%x in %s is now 0x%x\n",\
host->host_no, #symbol, i, A_##symbol##_used[i] - \
(int)(offset), #script, (script)[A_##symbol##_used[i] - \
(offset)]); \
}
/* Patch read/write instruction immediate field */
#define patch_abs_rwri_data(script, offset, symbol, value) \
for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
(u32)); ++i) \
(script)[A_##symbol##_used[i] - (offset)] = \
((script)[A_##symbol##_used[i] - (offset)] & \
~DBC_RWRI_IMMEDIATE_MASK) | \
(((value) << DBC_RWRI_IMMEDIATE_SHIFT) & \
DBC_RWRI_IMMEDIATE_MASK)
/* Patch transfer control instruction data field */
#define patch_abs_tci_data(script, offset, symbol, value) \
for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
(u32)); ++i) \
(script)[A_##symbol##_used[i] - (offset)] = \
((script)[A_##symbol##_used[i] - (offset)] & \
~DBC_TCI_DATA_MASK) | \
(((value) << DBC_TCI_DATA_SHIFT) & \
DBC_TCI_DATA_MASK)
/* Patch field in dsa structure (assignment should be +=?) */
#define patch_dsa_32(dsa, symbol, word, value) \
{ \
(dsa)[(hostdata->symbol - hostdata->dsa_start) / sizeof(u32) \
+ (word)] = (value); \
if (hostdata->options & OPTION_DEBUG_DSA) \
printk("scsi : dsa %s symbol %s(%d) word %d now 0x%x\n", \
#dsa, #symbol, hostdata->symbol, \
(word), (u32) le32_to_cpu(value)); \
}
/* Paranoid people could use panic() here. */
#define FATAL(host) shutdown((host));
#endif /* NCR53c7x0_C */
#endif /* NCR53c7x0_H */
#undef DEBUG
#undef EVENTS
; NCR 53c810 driver, main script
; Sponsored by
; iX Multiuser Multitasking Magazine
; hm@ix.de
;
; Copyright 1993, 1994, 1995 Drew Eckhardt
; Visionary Computing
; (Unix and Linux consulting and custom programming)
; drew@PoohSticks.ORG
; +1 (303) 786-7975
;
; TolerANT and SCSI SCRIPTS are registered trademarks of NCR Corporation.
;
; PRE-ALPHA
;
; For more information, please consult
;
; NCR 53C810
; PCI-SCSI I/O Processor
; Data Manual
;
; NCR 53C710
; SCSI I/O Processor
; Programmers Guide
;
; NCR Microelectronics
; 1635 Aeroplaza Drive
; Colorado Springs, CO 80916
; 1+ (719) 578-3400
;
; Toll free literature number
; +1 (800) 334-5454
;
; IMPORTANT : This code is self modifying due to the limitations of
; the NCR53c7,8xx series chips. Persons debugging this code with
; the remote debugger should take this into account, and NOT set
; breakpoints in modified instructions.
;
; Design:
; The NCR53c7,8xx family of SCSI chips are busmasters with an onboard
; microcontroller using a simple instruction set.
;
; So, to minimize the effects of interrupt latency, and to maximize
; throughput, this driver offloads the practical maximum amount
; of processing to the SCSI chip while still maintaining a common
; structure.
;
; Where tradeoffs were needed between efficiency on the older
; chips and the newer NCR53c800 series, the NCR53c800 series
; was chosen.
;
; While the NCR53c700 and NCR53c700-66 lacked the facilities to fully
; automate SCSI transfers without host processor intervention, this
; isn't the case with the NCR53c710 and newer chips which allow
;
; - reads and writes to the internal registers from within the SCSI
; scripts, allowing the SCSI SCRIPTS(tm) code to save processor
; state so that multiple threads of execution are possible, and also
; provide an ALU for loop control, etc.
;
; - table indirect addressing for some instructions. This allows
; pointers to be located relative to the DSA ((Data Structure
; Address) register.
;
; These features make it possible to implement a mailbox style interface,
; where the same piece of code is run to handle I/O for multiple threads
; at once minimizing our need to relocate code. Since the NCR53c700/
; NCR53c800 series have a unique combination of features, making a
; a standard ingoing/outgoing mailbox system, costly, I've modified it.
;
; - Mailboxes are a mixture of code and data. This lets us greatly
; simplify the NCR53c810 code and do things that would otherwise
; not be possible.
;
; The saved data pointer is now implemented as follows :
;
; Control flow has been architected such that if control reaches
; munge_save_data_pointer, on a restore pointers message or
; reconnection, a jump to the address formerly in the TEMP register
; will allow the SCSI command to resume execution.
;
;
; Note : the DSA structures must be aligned on 32 bit boundaries,
; since the source and destination of MOVE MEMORY instructions
; must share the same alignment and this is the alignment of the
; NCR registers.
;
ABSOLUTE dsa_temp_lun = 0 ; Patch to lun for current dsa
ABSOLUTE dsa_temp_next = 0 ; Patch to dsa next for current dsa
ABSOLUTE dsa_temp_addr_next = 0 ; Patch to address of dsa next address
; for current dsa
ABSOLUTE dsa_temp_sync = 0 ; Patch to address of per-target
; sync routine
ABSOLUTE dsa_temp_target = 0 ; Patch to id for current dsa
ABSOLUTE dsa_temp_addr_saved_pointer = 0; Patch to address of per-command
; saved data pointer
ABSOLUTE dsa_temp_addr_residual = 0 ; Patch to address of per-command
; current residual code
ABSOLUTE dsa_temp_addr_saved_residual = 0; Patch to address of per-command
; saved residual code
ABSOLUTE dsa_temp_addr_new_value = 0 ; Address of value for JUMP operand
ABSOLUTE dsa_temp_addr_array_value = 0 ; Address to copy to
ABSOLUTE dsa_temp_addr_dsa_value = 0 ; Address of this DSA value
;
; Once a device has initiated reselection, we need to compare it
; against the singly linked list of commands which have disconnected
; and are pending reselection. These commands are maintained in
; an unordered singly linked list of DSA structures, through the
; DSA pointers at their 'centers' headed by the reconnect_dsa_head
; pointer.
;
; To avoid complications in removing commands from the list,
; I minimize the amount of expensive (at eight operations per
; addition @ 500-600ns each) pointer operations which must
; be done in the NCR driver by precomputing them on the
; host processor during dsa structure generation.
;
; The fixed-up per DSA code knows how to recognize the nexus
; associated with the corresponding SCSI command, and modifies
; the source and destination pointers for the MOVE MEMORY
; instruction which is executed when reselected_ok is called
; to remove the command from the list. Similarly, DSA is
; loaded with the address of the next DSA structure and
; reselected_check_next is called if a failure occurs.
;
; Perhaps more concisely, the net effect of the mess is
;
; for (dsa = reconnect_dsa_head, dest = &reconnect_dsa_head,
; src = NULL; dsa; dest = &dsa->next, dsa = dsa->next) {
; src = &dsa->next;
; if (target_id == dsa->id && target_lun == dsa->lun) {
; *dest = *src;
; break;
; }
; }
;
; if (!dsa)
; error (int_err_unexpected_reselect);
; else
; longjmp (dsa->jump_resume, 0);
;
;
#if (CHIP != 700) && (CHIP != 70066)
; Define DSA structure used for mailboxes
ENTRY dsa_code_template
dsa_code_template:
ENTRY dsa_code_begin
dsa_code_begin:
MOVE dmode_memory_to_ncr TO DMODE
MOVE MEMORY 4, dsa_temp_addr_dsa_value, addr_scratch
MOVE dmode_memory_to_memory TO DMODE
CALL scratch_to_dsa
CALL select
; Handle the phase mismatch which may have resulted from the
; MOVE FROM dsa_msgout if we returned here. The CLEAR ATN
; may or may not be necessary, and we should update script_asm.pl
; to handle multiple pieces.
CLEAR ATN
CLEAR ACK
; Replace second operand with address of JUMP instruction dest operand
; in schedule table for this DSA. Becomes dsa_jump_dest in 53c7,8xx.c.
ENTRY dsa_code_fix_jump
dsa_code_fix_jump:
MOVE MEMORY 4, NOP_insn, 0
JUMP select_done
; wrong_dsa loads the DSA register with the value of the dsa_next
; field.
;
wrong_dsa:
; Patch the MOVE MEMORY INSTRUCTION such that
; the destination address is the address of the OLD
; next pointer.
;
MOVE MEMORY 4, dsa_temp_addr_next, reselected_ok + 8
MOVE dmode_memory_to_ncr TO DMODE
;
; Move the _contents_ of the next pointer into the DSA register as
; the next I_T_L or I_T_L_Q tupple to check against the established
; nexus.
;
MOVE MEMORY 4, dsa_temp_next, addr_scratch
MOVE dmode_memory_to_memory TO DMODE
CALL scratch_to_dsa
JUMP reselected_check_next
ABSOLUTE dsa_save_data_pointer = 0
ENTRY dsa_code_save_data_pointer
dsa_code_save_data_pointer:
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_temp, dsa_temp_addr_saved_pointer
MOVE dmode_memory_to_memory TO DMODE
; HARD CODED : 24 bytes needs to agree with 53c7,8xx.h
MOVE MEMORY 24, dsa_temp_addr_residual, dsa_temp_addr_saved_residual
CLEAR ACK
#ifdef DEBUG
INT int_debug_saved
#endif
RETURN
ABSOLUTE dsa_restore_pointers = 0
ENTRY dsa_code_restore_pointers
dsa_code_restore_pointers:
MOVE dmode_memory_to_ncr TO DMODE
MOVE MEMORY 4, dsa_temp_addr_saved_pointer, addr_temp
MOVE dmode_memory_to_memory TO DMODE
; HARD CODED : 24 bytes needs to agree with 53c7,8xx.h
MOVE MEMORY 24, dsa_temp_addr_saved_residual, dsa_temp_addr_residual
CLEAR ACK
#ifdef DEBUG
INT int_debug_restored
#endif
RETURN
ABSOLUTE dsa_check_reselect = 0
; dsa_check_reselect determines whether or not the current target and
; lun match the current DSA
ENTRY dsa_code_check_reselect
dsa_code_check_reselect:
MOVE SSID TO SFBR ; SSID contains 3 bit target ID
; FIXME : we need to accommodate bit fielded and binary here for '7xx/'8xx chips
JUMP REL (wrong_dsa), IF NOT dsa_temp_target, AND MASK 0xf8
;
; Hack - move to scratch first, since SFBR is not writeable
; via the CPU and hence a MOVE MEMORY instruction.
;
MOVE dmode_memory_to_ncr TO DMODE
MOVE MEMORY 1, reselected_identify, addr_scratch
MOVE dmode_memory_to_memory TO DMODE
MOVE SCRATCH0 TO SFBR
; FIXME : we need to accommodate bit fielded and binary here for '7xx/'8xx chips
JUMP REL (wrong_dsa), IF NOT dsa_temp_lun, AND MASK 0xf8
; Patch the MOVE MEMORY INSTRUCTION such that
; the source address is the address of this dsa's
; next pointer.
MOVE MEMORY 4, dsa_temp_addr_next, reselected_ok + 4
CALL reselected_ok
CALL dsa_temp_sync
; Release ACK on the IDENTIFY message _after_ we've set the synchronous
; transfer parameters!
CLEAR ACK
; Implicitly restore pointers on reselection, so a RETURN
; will transfer control back to the right spot.
CALL REL (dsa_code_restore_pointers)
RETURN
ENTRY dsa_zero
dsa_zero:
ENTRY dsa_code_template_end
dsa_code_template_end:
; Perform sanity check for dsa_fields_start == dsa_code_template_end -
; dsa_zero, puke.
ABSOLUTE dsa_fields_start = 0 ; Sanity marker
; pad 48 bytes (fix this RSN)
ABSOLUTE dsa_next = 48 ; len 4 Next DSA
; del 4 Previous DSA address
ABSOLUTE dsa_cmnd = 56 ; len 4 Scsi_Cmnd * for this thread.
ABSOLUTE dsa_select = 60 ; len 4 Device ID, Period, Offset for
; table indirect select
ABSOLUTE dsa_msgout = 64 ; len 8 table indirect move parameter for
; select message
ABSOLUTE dsa_cmdout = 72 ; len 8 table indirect move parameter for
; command
ABSOLUTE dsa_dataout = 80 ; len 4 code pointer for dataout
ABSOLUTE dsa_datain = 84 ; len 4 code pointer for datain
ABSOLUTE dsa_msgin = 88 ; len 8 table indirect move for msgin
ABSOLUTE dsa_status = 96 ; len 8 table indirect move for status byte
ABSOLUTE dsa_msgout_other = 104 ; len 8 table indirect for normal message out
; (Synchronous transfer negotiation, etc).
ABSOLUTE dsa_end = 112
ABSOLUTE schedule = 0 ; Array of JUMP dsa_begin or JUMP (next),
; terminated by a call to JUMP wait_reselect
; Linked lists of DSA structures
ABSOLUTE reconnect_dsa_head = 0 ; Link list of DSAs which can reconnect
ABSOLUTE addr_reconnect_dsa_head = 0 ; Address of variable containing
; address of reconnect_dsa_head
; These select the source and destination of a MOVE MEMORY instruction
ABSOLUTE dmode_memory_to_memory = 0x0
ABSOLUTE dmode_memory_to_ncr = 0x0
ABSOLUTE dmode_ncr_to_memory = 0x0
ABSOLUTE addr_scratch = 0x0
ABSOLUTE addr_temp = 0x0
#endif /* CHIP != 700 && CHIP != 70066 */
; Interrupts -
; MSB indicates type
; 0 handle error condition
; 1 handle message
; 2 handle normal condition
; 3 debugging interrupt
; 4 testing interrupt
; Next byte indicates specific error
; XXX not yet implemented, I'm not sure if I want to -
; Next byte indicates the routine the error occurred in
; The LSB indicates the specific place the error occurred
ABSOLUTE int_err_unexpected_phase = 0x00000000 ; Unexpected phase encountered
ABSOLUTE int_err_selected = 0x00010000 ; SELECTED (nee RESELECTED)
ABSOLUTE int_err_unexpected_reselect = 0x00020000
ABSOLUTE int_err_check_condition = 0x00030000
ABSOLUTE int_err_no_phase = 0x00040000
ABSOLUTE int_msg_wdtr = 0x01000000 ; WDTR message received
ABSOLUTE int_msg_sdtr = 0x01010000 ; SDTR received
ABSOLUTE int_msg_1 = 0x01020000 ; single byte special message
; received
ABSOLUTE int_norm_select_complete = 0x02000000 ; Select complete, reprogram
; registers.
ABSOLUTE int_norm_reselect_complete = 0x02010000 ; Nexus established
ABSOLUTE int_norm_command_complete = 0x02020000 ; Command complete
ABSOLUTE int_norm_disconnected = 0x02030000 ; Disconnected
ABSOLUTE int_norm_aborted =0x02040000 ; Aborted *dsa
ABSOLUTE int_norm_reset = 0x02050000 ; Generated BUS reset.
ABSOLUTE int_debug_break = 0x03000000 ; Break point
#ifdef DEBUG
ABSOLUTE int_debug_scheduled = 0x03010000 ; new I/O scheduled
ABSOLUTE int_debug_idle = 0x03020000 ; scheduler is idle
ABSOLUTE int_debug_dsa_loaded = 0x03030000 ; dsa reloaded
ABSOLUTE int_debug_reselected = 0x03040000 ; NCR reselected
ABSOLUTE int_debug_head = 0x03050000 ; issue head overwritten
ABSOLUTE int_debug_disconnected = 0x03060000 ; disconnected
ABSOLUTE int_debug_disconnect_msg = 0x03070000 ; got message to disconnect
ABSOLUTE int_debug_dsa_schedule = 0x03080000 ; in dsa_schedule
ABSOLUTE int_debug_reselect_check = 0x03090000 ; Check for reselection of DSA
ABSOLUTE int_debug_reselected_ok = 0x030a0000 ; Reselection accepted
#endif
ABSOLUTE int_debug_panic = 0x030b0000 ; Panic driver
#ifdef DEBUG
ABSOLUTE int_debug_saved = 0x030c0000 ; save/restore pointers
ABSOLUTE int_debug_restored = 0x030d0000
ABSOLUTE int_debug_sync = 0x030e0000 ; Sanity check synchronous
; parameters.
ABSOLUTE int_debug_datain = 0x030f0000 ; going into data in phase
; now.
ABSOLUTE int_debug_check_dsa = 0x03100000 ; Sanity check DSA against
; SDID.
#endif
ABSOLUTE int_test_1 = 0x04000000 ; Test 1 complete
ABSOLUTE int_test_2 = 0x04010000 ; Test 2 complete
ABSOLUTE int_test_3 = 0x04020000 ; Test 3 complete
; These should start with 0x05000000, with low bits incrementing for
; each one.
#ifdef EVENTS
ABSOLUTE int_EVENT_SELECT = 0
ABSOLUTE int_EVENT_DISCONNECT = 0
ABSOLUTE int_EVENT_RESELECT = 0
ABSOLUTE int_EVENT_COMPLETE = 0
ABSOLUTE int_EVENT_IDLE = 0
ABSOLUTE int_EVENT_SELECT_FAILED = 0
ABSOLUTE int_EVENT_BEFORE_SELECT = 0
ABSOLUTE int_EVENT_RESELECT_FAILED = 0
#endif
ABSOLUTE NCR53c7xx_msg_abort = 0 ; Pointer to abort message
ABSOLUTE NCR53c7xx_msg_reject = 0 ; Pointer to reject message
ABSOLUTE NCR53c7xx_zero = 0 ; long with zero in it, use for source
ABSOLUTE NCR53c7xx_sink = 0 ; long to dump worthless data in
ABSOLUTE NOP_insn = 0 ; NOP instruction
; Pointer to message, potentially multi-byte
ABSOLUTE msg_buf = 0
; Pointer to holding area for reselection information
ABSOLUTE reselected_identify = 0
ABSOLUTE reselected_tag = 0
; Request sense command pointer, it's a 6 byte command, should
; be constant for all commands since we always want 16 bytes of
; sense and we don't need to change any fields as we did under
; SCSI-I when we actually cared about the LUN field.
;EXTERNAL NCR53c7xx_sense ; Request sense command
#if (CHIP != 700) && (CHIP != 70066)
; dsa_schedule
; PURPOSE : after a DISCONNECT message has been received, and pointers
; saved, insert the current DSA structure at the head of the
; disconnected queue and fall through to the scheduler.
;
; CALLS : OK
;
; INPUTS : dsa - current DSA structure, reconnect_dsa_head - list
; of disconnected commands
;
; MODIFIES : SCRATCH, reconnect_dsa_head
;
; EXITS : always passes control to schedule
ENTRY dsa_schedule
dsa_schedule:
#if 0
INT int_debug_dsa_schedule
#endif
;
; Calculate the address of the next pointer within the DSA
; structure of the command that is currently disconnecting
;
CALL dsa_to_scratch
MOVE SCRATCH0 + dsa_next TO SCRATCH0
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
; Point the next field of this DSA structure at the current disconnected
; list
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, dsa_schedule_insert + 8
MOVE dmode_memory_to_memory TO DMODE
dsa_schedule_insert:
MOVE MEMORY 4, reconnect_dsa_head, 0
; And update the head pointer.
CALL dsa_to_scratch
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, reconnect_dsa_head
MOVE dmode_memory_to_memory TO DMODE
/* Temporarily, see what happens. */
#ifndef ORIGINAL
MOVE SCNTL2 & 0x7f TO SCNTL2
CLEAR ACK
#endif
WAIT DISCONNECT
#ifdef EVENTS
INT int_EVENT_DISCONNECT;
#endif
#if 0
INT int_debug_disconnected
#endif
JUMP schedule
#endif
;
; select
;
; PURPOSE : establish a nexus for the SCSI command referenced by DSA.
; On success, the current DSA structure is removed from the issue
; queue. Usually, this is entered as a fall-through from schedule,
; although the contingent allegiance handling code will write
; the select entry address to the DSP to restart a command as a
; REQUEST SENSE. A message is sent (usually IDENTIFY, although
; additional SDTR or WDTR messages may be sent). COMMAND OUT
; is handled.
;
; INPUTS : DSA - SCSI command, issue_dsa_head
;
; CALLS : NOT OK
;
; MODIFIES : SCRATCH, issue_dsa_head
;
; EXITS : on reselection or selection, go to select_failed
; otherwise, RETURN so control is passed back to
; dsa_begin.
;
ENTRY select
select:
#if 0
#ifdef EVENTS
INT int_EVENT_BEFORE_SELECT
#endif
#endif
#if 0
#ifdef DEBUG
INT int_debug_scheduled
#endif
#endif
CLEAR TARGET
; XXX
;
; In effect, SELECTION operations are backgrounded, with execution
; continuing until code which waits for REQ or a fatal interrupt is
; encountered.
;
; So, for more performance, we could overlap the code which removes
; the command from the NCRs issue queue with the selection, but
; at this point I don't want to deal with the error recovery.
;
#if (CHIP != 700) && (CHIP != 70066)
SELECT ATN FROM dsa_select, select_failed
JUMP select_msgout, WHEN MSG_OUT
ENTRY select_msgout
select_msgout:
MOVE FROM dsa_msgout, WHEN MSG_OUT
#else
ENTRY select_msgout
SELECT ATN 0, select_failed
select_msgout:
MOVE 0, 0, WHEN MSGOUT
#endif
#ifdef EVENTS
INT int_EVENT_SELECT
#endif
RETURN
;
; select_done
;
; PURPOSE: continue on to normal data transfer; called as the exit
; point from dsa_begin.
;
; INPUTS: dsa
;
; CALLS: OK
;
;
select_done:
#ifdef DEBUG
ENTRY select_check_dsa
select_check_dsa:
INT int_debug_check_dsa
#endif
; After a successful selection, we should get either a CMD phase or
; some transfer request negotiation message.
JUMP cmdout, WHEN CMD
INT int_err_unexpected_phase, WHEN NOT MSG_IN
select_msg_in:
CALL msg_in, WHEN MSG_IN
JUMP select_msg_in, WHEN MSG_IN
cmdout:
INT int_err_unexpected_phase, WHEN NOT CMD
#if (CHIP == 700)
INT int_norm_selected
#endif
ENTRY cmdout_cmdout
cmdout_cmdout:
#if (CHIP != 700) && (CHIP != 70066)
MOVE FROM dsa_cmdout, WHEN CMD
#else
MOVE 0, 0, WHEN CMD
#endif /* (CHIP != 700) && (CHIP != 70066) */
;
; data_transfer
; other_out
; other_in
; other_transfer
;
; PURPOSE : handle the main data transfer for a SCSI command in
; several parts. In the first part, data_transfer, DATA_IN
; and DATA_OUT phases are allowed, with the user provided
; code (usually dynamically generated based on the scatter/gather
; list associated with a SCSI command) called to handle these
; phases.
;
; After control has passed to one of the user provided
; DATA_IN or DATA_OUT routines, back calls are made to
; other_transfer_in or other_transfer_out to handle non-DATA IN
; and DATA OUT phases respectively, with the state of the active
; data pointer being preserved in TEMP.
;
; On completion, the user code passes control to other_transfer
; which causes DATA_IN and DATA_OUT to result in unexpected_phase
; interrupts so that data overruns may be trapped.
;
; INPUTS : DSA - SCSI command
;
; CALLS : OK in data_transfer_start, not ok in other_out and other_in, ok in
; other_transfer
;
; MODIFIES : SCRATCH
;
; EXITS : if STATUS IN is detected, signifying command completion,
; the NCR jumps to command_complete. If MSG IN occurs, a
; CALL is made to msg_in. Otherwise, other_transfer runs in
; an infinite loop.
;
ENTRY data_transfer
data_transfer:
JUMP cmdout_cmdout, WHEN CMD
CALL msg_in, WHEN MSG_IN
INT int_err_unexpected_phase, WHEN MSG_OUT
JUMP do_dataout, WHEN DATA_OUT
JUMP do_datain, WHEN DATA_IN
JUMP command_complete, WHEN STATUS
JUMP data_transfer
ENTRY end_data_transfer
end_data_transfer:
;
; FIXME: On NCR53c700 and NCR53c700-66 chips, do_dataout/do_datain
; should be fixed up whenever the nexus changes so it can point to the
; correct routine for that command.
;
#if (CHIP != 700) && (CHIP != 70066)
; Nasty jump to dsa->dataout
do_dataout:
CALL dsa_to_scratch
MOVE SCRATCH0 + dsa_dataout TO SCRATCH0
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, dataout_to_jump + 4
MOVE dmode_memory_to_memory TO DMODE
dataout_to_jump:
MOVE MEMORY 4, 0, dataout_jump + 4
dataout_jump:
JUMP 0
; Nasty jump to dsa->dsain
do_datain:
CALL dsa_to_scratch
MOVE SCRATCH0 + dsa_datain TO SCRATCH0
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, datain_to_jump + 4
MOVE dmode_memory_to_memory TO DMODE
ENTRY datain_to_jump
datain_to_jump:
MOVE MEMORY 4, 0, datain_jump + 4
#if 0
INT int_debug_datain
#endif
datain_jump:
JUMP 0
#endif /* (CHIP != 700) && (CHIP != 70066) */
; Note that other_out and other_in loop until a non-data phase
; is discovered, so we only execute return statements when we
; can go on to the next data phase block move statement.
ENTRY other_out
other_out:
#if 0
INT 0x03ffdead
#endif
INT int_err_unexpected_phase, WHEN CMD
JUMP msg_in_restart, WHEN MSG_IN
INT int_err_unexpected_phase, WHEN MSG_OUT
INT int_err_unexpected_phase, WHEN DATA_IN
JUMP command_complete, WHEN STATUS
JUMP other_out, WHEN NOT DATA_OUT
RETURN
ENTRY other_in
other_in:
#if 0
INT 0x03ffdead
#endif
INT int_err_unexpected_phase, WHEN CMD
JUMP msg_in_restart, WHEN MSG_IN
INT int_err_unexpected_phase, WHEN MSG_OUT
INT int_err_unexpected_phase, WHEN DATA_OUT
JUMP command_complete, WHEN STATUS
JUMP other_in, WHEN NOT DATA_IN
RETURN
ENTRY other_transfer
other_transfer:
INT int_err_unexpected_phase, WHEN CMD
CALL msg_in, WHEN MSG_IN
INT int_err_unexpected_phase, WHEN MSG_OUT
INT int_err_unexpected_phase, WHEN DATA_OUT
INT int_err_unexpected_phase, WHEN DATA_IN
JUMP command_complete, WHEN STATUS
JUMP other_transfer
;
; msg_in_restart
; msg_in
; munge_msg
;
; PURPOSE : process messages from a target. msg_in is called when the
; caller hasn't read the first byte of the message. munge_message
; is called when the caller has read the first byte of the message,
; and left it in SFBR. msg_in_restart is called when the caller
; hasn't read the first byte of the message, and wishes RETURN
; to transfer control back to the address of the conditional
; CALL instruction rather than to the instruction after it.
;
; Various int_* interrupts are generated when the host system
; needs to intervene, as is the case with SDTR, WDTR, and
; INITIATE RECOVERY messages.
;
; When the host system handles one of these interrupts,
; it can respond by reentering at reject_message,
; which rejects the message and returns control to
; the caller of msg_in or munge_msg, accept_message
; which clears ACK and returns control, or reply_message
; which sends the message pointed to by the DSA
; msgout_other table indirect field.
;
; DISCONNECT messages are handled by moving the command
; to the reconnect_dsa_queue.
;
; INPUTS : DSA - SCSI COMMAND, SFBR - first byte of message (munge_msg
; only)
;
; CALLS : NO. The TEMP register isn't backed up to allow nested calls.
;
; MODIFIES : SCRATCH, DSA on DISCONNECT
;
; EXITS : On receipt of SAVE DATA POINTER, RESTORE POINTERS,
; and normal return from message handlers running under
; Linux, control is returned to the caller. Receipt
; of DISCONNECT messages pass control to dsa_schedule.
;
ENTRY msg_in_restart
msg_in_restart:
; XXX - hackish
;
; Since it's easier to debug changes to the statically
; compiled code, rather than the dynamically generated
; stuff, such as
;
; MOVE x, y, WHEN data_phase
; CALL other_z, WHEN NOT data_phase
; MOVE x, y, WHEN data_phase
;
; I'd like to have certain routines (notably the message handler)
; restart on the conditional call rather than the next instruction.
;
; So, subtract 8 from the return address
MOVE TEMP0 + 0xf8 TO TEMP0
MOVE TEMP1 + 0xff TO TEMP1 WITH CARRY
MOVE TEMP2 + 0xff TO TEMP2 WITH CARRY
MOVE TEMP3 + 0xff TO TEMP3 WITH CARRY
ENTRY msg_in
msg_in:
MOVE 1, msg_buf, WHEN MSG_IN
munge_msg:
JUMP munge_extended, IF 0x01 ; EXTENDED MESSAGE
JUMP munge_2, IF 0x20, AND MASK 0xdf ; two byte message
;
; XXX - I've seen a handful of broken SCSI devices which fail to issue
; a SAVE POINTERS message before disconnecting in the middle of
; a transfer, assuming that the DATA POINTER will be implicitly
; restored.
;
; Historically, I've often done an implicit save when the DISCONNECT
; message is processed. We may want to consider having the option of
; doing that here.
;
JUMP munge_save_data_pointer, IF 0x02 ; SAVE DATA POINTER
JUMP munge_restore_pointers, IF 0x03 ; RESTORE POINTERS
JUMP munge_disconnect, IF 0x04 ; DISCONNECT
INT int_msg_1, IF 0x07 ; MESSAGE REJECT
INT int_msg_1, IF 0x0f ; INITIATE RECOVERY
#ifdef EVENTS
INT int_EVENT_SELECT_FAILED
#endif
JUMP reject_message
munge_2:
JUMP reject_message
;
; The SCSI standard allows targets to recover from transient
; error conditions by backing up the data pointer with a
; RESTORE POINTERS message.
;
; So, we must save and restore the _residual_ code as well as
; the current instruction pointer. Because of this messiness,
; it is simpler to put dynamic code in the dsa for this and to
; just do a simple jump down there.
;
munge_save_data_pointer:
MOVE DSA0 + dsa_save_data_pointer TO SFBR
MOVE SFBR TO SCRATCH0
MOVE DSA1 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH1
MOVE DSA2 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH2
MOVE DSA3 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH3
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, jump_dsa_save + 4
MOVE dmode_memory_to_memory TO DMODE
jump_dsa_save:
JUMP 0
munge_restore_pointers:
MOVE DSA0 + dsa_restore_pointers TO SFBR
MOVE SFBR TO SCRATCH0
MOVE DSA1 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH1
MOVE DSA2 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH2
MOVE DSA3 + 0xff TO SFBR WITH CARRY
MOVE SFBR TO SCRATCH3
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, jump_dsa_restore + 4
MOVE dmode_memory_to_memory TO DMODE
jump_dsa_restore:
JUMP 0
munge_disconnect:
#if 0
INT int_debug_disconnect_msg
#endif
/*
* Before, we overlapped processing with waiting for disconnect, but
* debugging was beginning to appear messy. Temporarily move things
* to just before the WAIT DISCONNECT.
*/
#ifdef ORIGINAL
MOVE SCNTL2 & 0x7f TO SCNTL2
CLEAR ACK
#endif
#if (CHIP != 700) && (CHIP != 70066)
JUMP dsa_schedule
#else
WAIT DISCONNECT
INT int_norm_disconnected
#endif
munge_extended:
CLEAR ACK
INT int_err_unexpected_phase, WHEN NOT MSG_IN
MOVE 1, msg_buf + 1, WHEN MSG_IN
JUMP munge_extended_2, IF 0x02
JUMP munge_extended_3, IF 0x03
JUMP reject_message
munge_extended_2:
CLEAR ACK
MOVE 1, msg_buf + 2, WHEN MSG_IN
JUMP reject_message, IF NOT 0x02 ; Must be WDTR
CLEAR ACK
MOVE 1, msg_buf + 3, WHEN MSG_IN
INT int_msg_wdtr
munge_extended_3:
CLEAR ACK
MOVE 1, msg_buf + 2, WHEN MSG_IN
JUMP reject_message, IF NOT 0x01 ; Must be SDTR
CLEAR ACK
MOVE 2, msg_buf + 3, WHEN MSG_IN
INT int_msg_sdtr
ENTRY reject_message
reject_message:
SET ATN
CLEAR ACK
MOVE 1, NCR53c7xx_msg_reject, WHEN MSG_OUT
RETURN
ENTRY accept_message
accept_message:
CLEAR ATN
CLEAR ACK
RETURN
ENTRY respond_message
respond_message:
SET ATN
CLEAR ACK
MOVE FROM dsa_msgout_other, WHEN MSG_OUT
RETURN
;
; command_complete
;
; PURPOSE : handle command termination when STATUS IN is detected by reading
; a status byte followed by a command termination message.
;
; Normal termination results in an INTFLY instruction, and
; the host system can pick out which command terminated by
; examining the MESSAGE and STATUS buffers of all currently
; executing commands;
;
; Abnormal (CHECK_CONDITION) termination results in an
; int_err_check_condition interrupt so that a REQUEST SENSE
; command can be issued out-of-order so that no other command
; clears the contingent allegiance condition.
;
;
; INPUTS : DSA - command
;
; CALLS : OK
;
; EXITS : On successful termination, control is passed to schedule.
; On abnormal termination, the user will usually modify the
; DSA fields and corresponding buffers and return control
; to select.
;
ENTRY command_complete
command_complete:
MOVE FROM dsa_status, WHEN STATUS
#if (CHIP != 700) && (CHIP != 70066)
MOVE SFBR TO SCRATCH0 ; Save status
#endif /* (CHIP != 700) && (CHIP != 70066) */
ENTRY command_complete_msgin
command_complete_msgin:
MOVE FROM dsa_msgin, WHEN MSG_IN
; Indicate that we should be expecting a disconnect
MOVE SCNTL2 & 0x7f TO SCNTL2
CLEAR ACK
#if (CHIP != 700) && (CHIP != 70066)
WAIT DISCONNECT
;
; The SCSI specification states that when a UNIT ATTENTION condition
; is pending, as indicated by a CHECK CONDITION status message,
; the target shall revert to asynchronous transfers. Since
; synchronous transfers parameters are maintained on a per INITIATOR/TARGET
; basis, and returning control to our scheduler could work on a command
; running on another lun on that target using the old parameters, we must
; interrupt the host processor to get them changed, or change them ourselves.
;
; Once SCSI-II tagged queueing is implemented, things will be even more
; hairy, since contingent allegiance conditions exist on a per-target/lun
; basis, and issuing a new command with a different tag would clear it.
; In these cases, we must interrupt the host processor to get a request
; added to the HEAD of the queue with the request sense command, or we
; must automatically issue the request sense command.
#if 0
MOVE SCRATCH0 TO SFBR
JUMP command_failed, IF 0x02
#endif
INTFLY
#endif /* (CHIP != 700) && (CHIP != 70066) */
#ifdef EVENTS
INT int_EVENT_COMPLETE
#endif
#if (CHIP != 700) && (CHIP != 70066)
JUMP schedule
command_failed:
INT int_err_check_condition
#else
INT int_norm_command_complete
#endif
;
; wait_reselect
;
; PURPOSE : This is essentially the idle routine, where control lands
; when there are no new processes to schedule. wait_reselect
; waits for reselection, selection, and new commands.
;
; When a successful reselection occurs, with the aid
; of fixed up code in each DSA, wait_reselect walks the
; reconnect_dsa_queue, asking each dsa if the target ID
; and LUN match its.
;
; If a match is found, a call is made back to reselected_ok,
; which through the miracles of self modifying code, extracts
; the found DSA from the reconnect_dsa_queue and then
; returns control to the DSAs thread of execution.
;
; INPUTS : NONE
;
; CALLS : OK
;
; MODIFIES : DSA,
;
; EXITS : On successful reselection, control is returned to the
; DSA which called reselected_ok. If the WAIT RESELECT
; was interrupted by a new commands arrival signaled by
; SIG_P, control is passed to schedule. If the NCR is
; selected, the host system is interrupted with an
; int_err_selected which is usually responded to by
; setting DSP to the target_abort address.
ENTRY wait_reselect
wait_reselect:
#ifdef EVENTS
int int_EVENT_IDLE
#endif
#if 0
int int_debug_idle
#endif
WAIT RESELECT wait_reselect_failed
reselected:
#ifdef EVENTS
int int_EVENT_RESELECT
#endif
CLEAR TARGET
MOVE dmode_memory_to_memory TO DMODE
; Read all data needed to reestablish the nexus -
MOVE 1, reselected_identify, WHEN MSG_IN
; We used to CLEAR ACK here.
#if (CHIP != 700) && (CHIP != 70066)
#if 0
int int_debug_reselected
#endif
; Point DSA at the current head of the disconnected queue.
MOVE dmode_memory_to_ncr TO DMODE
MOVE MEMORY 4, reconnect_dsa_head, addr_scratch
MOVE dmode_memory_to_memory TO DMODE
CALL scratch_to_dsa
; Fix the update-next pointer so that the reconnect_dsa_head
; pointer is the one that will be updated if this DSA is a hit
; and we remove it from the queue.
MOVE MEMORY 4, addr_reconnect_dsa_head, reselected_ok + 8
ENTRY reselected_check_next
reselected_check_next:
#if 0
INT int_debug_reselect_check
#endif
; Check for a NULL pointer.
MOVE DSA0 TO SFBR
JUMP reselected_not_end, IF NOT 0
MOVE DSA1 TO SFBR
JUMP reselected_not_end, IF NOT 0
MOVE DSA2 TO SFBR
JUMP reselected_not_end, IF NOT 0
MOVE DSA3 TO SFBR
JUMP reselected_not_end, IF NOT 0
INT int_err_unexpected_reselect
reselected_not_end:
;
; XXX the ALU is only eight bits wide, and the assembler
; wont do the dirt work for us. As long as dsa_check_reselect
; is negative, we need to sign extend with 1 bits to the full
; 32 bit width of the address.
;
; A potential work around would be to have a known alignment
; of the DSA structure such that the base address plus
; dsa_check_reselect doesn't require carrying from bytes
; higher than the LSB.
;
MOVE DSA0 TO SFBR
MOVE SFBR + dsa_check_reselect TO SCRATCH0
MOVE DSA1 TO SFBR
MOVE SFBR + 0xff TO SCRATCH1 WITH CARRY
MOVE DSA2 TO SFBR
MOVE SFBR + 0xff TO SCRATCH2 WITH CARRY
MOVE DSA3 TO SFBR
MOVE SFBR + 0xff TO SCRATCH3 WITH CARRY
MOVE dmode_ncr_to_memory TO DMODE
MOVE MEMORY 4, addr_scratch, reselected_check + 4
MOVE dmode_memory_to_memory TO DMODE
reselected_check:
JUMP 0
;
;
ENTRY reselected_ok
reselected_ok:
MOVE MEMORY 4, 0, 0 ; Patched : first word
; is address of
; successful dsa_next
; Second word is last
; unsuccessful dsa_next,
; starting with
; dsa_reconnect_head
; We used to CLEAR ACK here.
#if 0
INT int_debug_reselected_ok
#endif
#ifdef DEBUG
INT int_debug_check_dsa
#endif
RETURN ; Return control to where
#else
INT int_norm_reselected
#endif /* (CHIP != 700) && (CHIP != 70066) */
selected:
INT int_err_selected;
;
; A select or reselect failure can be caused by one of two conditions :
; 1. SIG_P was set. This will be the case if the user has written
; a new value to a previously NULL head of the issue queue.
;
; 2. The NCR53c810 was selected or reselected by another device.
;
; 3. The bus was already busy since we were selected or reselected
; before starting the command.
wait_reselect_failed:
#ifdef EVENTS
INT int_EVENT_RESELECT_FAILED
#endif
; Check selected bit.
MOVE SIST0 & 0x20 TO SFBR
JUMP selected, IF 0x20
; Reading CTEST2 clears the SIG_P bit in the ISTAT register.
MOVE CTEST2 & 0x40 TO SFBR
JUMP schedule, IF 0x40
; Check connected bit.
; FIXME: this needs to change if we support target mode
MOVE ISTAT & 0x08 TO SFBR
JUMP reselected, IF 0x08
; FIXME : Something bogus happened, and we shouldn't fail silently.
#if 0
JUMP schedule
#else
INT int_debug_panic
#endif
select_failed:
#ifdef EVENTS
int int_EVENT_SELECT_FAILED
#endif
; Otherwise, mask the selected and reselected bits off SIST0
MOVE SIST0 & 0x30 TO SFBR
JUMP selected, IF 0x20
JUMP reselected, IF 0x10
; If SIGP is set, the user just gave us another command, and
; we should restart or return to the scheduler.
; Reading CTEST2 clears the SIG_P bit in the ISTAT register.
MOVE CTEST2 & 0x40 TO SFBR
JUMP select, IF 0x40
; Check connected bit.
; FIXME: this needs to change if we support target mode
; FIXME: is this really necessary?
MOVE ISTAT & 0x08 TO SFBR
JUMP reselected, IF 0x08
; FIXME : Something bogus happened, and we shouldn't fail silently.
#if 0
JUMP schedule
#else
INT int_debug_panic
#endif
;
; test_1
; test_2
;
; PURPOSE : run some verification tests on the NCR. test_1
; copies test_src to test_dest and interrupts the host
; processor, testing for cache coherency and interrupt
; problems in the processes.
;
; test_2 runs a command with offsets relative to the
; DSA on entry, and is useful for miscellaneous experimentation.
;
; Verify that interrupts are working correctly and that we don't
; have a cache invalidation problem.
ABSOLUTE test_src = 0, test_dest = 0
ENTRY test_1
test_1:
MOVE MEMORY 4, test_src, test_dest
INT int_test_1
;
; Run arbitrary commands, with test code establishing a DSA
;
ENTRY test_2
test_2:
CLEAR TARGET
SELECT ATN FROM 0, test_2_fail
JUMP test_2_msgout, WHEN MSG_OUT
ENTRY test_2_msgout
test_2_msgout:
MOVE FROM 8, WHEN MSG_OUT
MOVE FROM 16, WHEN CMD
MOVE FROM 24, WHEN DATA_IN
MOVE FROM 32, WHEN STATUS
MOVE FROM 40, WHEN MSG_IN
MOVE SCNTL2 & 0x7f TO SCNTL2
CLEAR ACK
WAIT DISCONNECT
test_2_fail:
INT int_test_2
ENTRY debug_break
debug_break:
INT int_debug_break
;
; initiator_abort
; target_abort
;
; PURPOSE : Abort the currently established nexus from with initiator
; or target mode.
;
;
ENTRY target_abort
target_abort:
SET TARGET
DISCONNECT
CLEAR TARGET
JUMP schedule
ENTRY initiator_abort
initiator_abort:
SET ATN
;
; The SCSI-I specification says that targets may go into MSG out at
; their leisure upon receipt of the ATN single. On all versions of the
; specification, we can't change phases until REQ transitions true->false,
; so we need to sink/source one byte of data to allow the transition.
;
; For the sake of safety, we'll only source one byte of data in all
; cases, but to accommodate the SCSI-I dain bramage, we'll sink an
; arbitrary number of bytes.
JUMP spew_cmd, WHEN CMD
JUMP eat_msgin, WHEN MSG_IN
JUMP eat_datain, WHEN DATA_IN
JUMP eat_status, WHEN STATUS
JUMP spew_dataout, WHEN DATA_OUT
JUMP sated
spew_cmd:
MOVE 1, NCR53c7xx_zero, WHEN CMD
JUMP sated
eat_msgin:
MOVE 1, NCR53c7xx_sink, WHEN MSG_IN
JUMP eat_msgin, WHEN MSG_IN
JUMP sated
eat_status:
MOVE 1, NCR53c7xx_sink, WHEN STATUS
JUMP eat_status, WHEN STATUS
JUMP sated
eat_datain:
MOVE 1, NCR53c7xx_sink, WHEN DATA_IN
JUMP eat_datain, WHEN DATA_IN
JUMP sated
spew_dataout:
MOVE 1, NCR53c7xx_zero, WHEN DATA_OUT
sated:
MOVE SCNTL2 & 0x7f TO SCNTL2
MOVE 1, NCR53c7xx_msg_abort, WHEN MSG_OUT
WAIT DISCONNECT
INT int_norm_aborted
;
; dsa_to_scratch
; scratch_to_dsa
;
; PURPOSE :
; The NCR chips cannot do a move memory instruction with the DSA register
; as the source or destination. So, we provide a couple of subroutines
; that let us switch between the DSA register and scratch register.
;
; Memory moves to/from the DSPS register also don't work, but we
; don't use them.
;
;
dsa_to_scratch:
MOVE DSA0 TO SFBR
MOVE SFBR TO SCRATCH0
MOVE DSA1 TO SFBR
MOVE SFBR TO SCRATCH1
MOVE DSA2 TO SFBR
MOVE SFBR TO SCRATCH2
MOVE DSA3 TO SFBR
MOVE SFBR TO SCRATCH3
RETURN
scratch_to_dsa:
MOVE SCRATCH0 TO SFBR
MOVE SFBR TO DSA0
MOVE SCRATCH1 TO SFBR
MOVE SFBR TO DSA1
MOVE SCRATCH2 TO SFBR
MOVE SFBR TO DSA2
MOVE SCRATCH3 TO SFBR
MOVE SFBR TO DSA3
RETURN
/* DO NOT EDIT - Generated automatically by script_asm.pl */
static u32 SCRIPT[] = {
/*
; NCR 53c810 driver, main script
; Sponsored by
; iX Multiuser Multitasking Magazine
; hm@ix.de
;
; Copyright 1993, 1994, 1995 Drew Eckhardt
; Visionary Computing
; (Unix and Linux consulting and custom programming)
; drew@PoohSticks.ORG
; +1 (303) 786-7975
;
; TolerANT and SCSI SCRIPTS are registered trademarks of NCR Corporation.
;
; PRE-ALPHA
;
; For more information, please consult
;
; NCR 53C810
; PCI-SCSI I/O Processor
; Data Manual
;
; NCR 53C710
; SCSI I/O Processor
; Programmers Guide
;
; NCR Microelectronics
; 1635 Aeroplaza Drive
; Colorado Springs, CO 80916
; 1+ (719) 578-3400
;
; Toll free literature number
; +1 (800) 334-5454
;
; IMPORTANT : This code is self modifying due to the limitations of
; the NCR53c7,8xx series chips. Persons debugging this code with
; the remote debugger should take this into account, and NOT set
; breakpoints in modified instructions.
;
; Design:
; The NCR53c7,8xx family of SCSI chips are busmasters with an onboard
; microcontroller using a simple instruction set.
;
; So, to minimize the effects of interrupt latency, and to maximize
; throughput, this driver offloads the practical maximum amount
; of processing to the SCSI chip while still maintaining a common
; structure.
;
; Where tradeoffs were needed between efficiency on the older
; chips and the newer NCR53c800 series, the NCR53c800 series
; was chosen.
;
; While the NCR53c700 and NCR53c700-66 lacked the facilities to fully
; automate SCSI transfers without host processor intervention, this
; isn't the case with the NCR53c710 and newer chips which allow
;
; - reads and writes to the internal registers from within the SCSI
; scripts, allowing the SCSI SCRIPTS(tm) code to save processor
; state so that multiple threads of execution are possible, and also
; provide an ALU for loop control, etc.
;
; - table indirect addressing for some instructions. This allows
; pointers to be located relative to the DSA ((Data Structure
; Address) register.
;
; These features make it possible to implement a mailbox style interface,
; where the same piece of code is run to handle I/O for multiple threads
; at once minimizing our need to relocate code. Since the NCR53c700/
; NCR53c800 series have a unique combination of features, making a
; a standard ingoing/outgoing mailbox system, costly, I've modified it.
;
; - Mailboxes are a mixture of code and data. This lets us greatly
; simplify the NCR53c810 code and do things that would otherwise
; not be possible.
;
; The saved data pointer is now implemented as follows :
;
; Control flow has been architected such that if control reaches
; munge_save_data_pointer, on a restore pointers message or
; reconnection, a jump to the address formerly in the TEMP register
; will allow the SCSI command to resume execution.
;
;
; Note : the DSA structures must be aligned on 32 bit boundaries,
; since the source and destination of MOVE MEMORY instructions
; must share the same alignment and this is the alignment of the
; NCR registers.
;
ABSOLUTE dsa_temp_lun = 0 ; Patch to lun for current dsa
ABSOLUTE dsa_temp_next = 0 ; Patch to dsa next for current dsa
ABSOLUTE dsa_temp_addr_next = 0 ; Patch to address of dsa next address
; for current dsa
ABSOLUTE dsa_temp_sync = 0 ; Patch to address of per-target
; sync routine
ABSOLUTE dsa_temp_target = 0 ; Patch to id for current dsa
ABSOLUTE dsa_temp_addr_saved_pointer = 0; Patch to address of per-command
; saved data pointer
ABSOLUTE dsa_temp_addr_residual = 0 ; Patch to address of per-command
; current residual code
ABSOLUTE dsa_temp_addr_saved_residual = 0; Patch to address of per-command
; saved residual code
ABSOLUTE dsa_temp_addr_new_value = 0 ; Address of value for JUMP operand
ABSOLUTE dsa_temp_addr_array_value = 0 ; Address to copy to
ABSOLUTE dsa_temp_addr_dsa_value = 0 ; Address of this DSA value
;
; Once a device has initiated reselection, we need to compare it
; against the singly linked list of commands which have disconnected
; and are pending reselection. These commands are maintained in
; an unordered singly linked list of DSA structures, through the
; DSA pointers at their 'centers' headed by the reconnect_dsa_head
; pointer.
;
; To avoid complications in removing commands from the list,
; I minimize the amount of expensive (at eight operations per
; addition @ 500-600ns each) pointer operations which must
; be done in the NCR driver by precomputing them on the
; host processor during dsa structure generation.
;
; The fixed-up per DSA code knows how to recognize the nexus
; associated with the corresponding SCSI command, and modifies
; the source and destination pointers for the MOVE MEMORY
; instruction which is executed when reselected_ok is called
; to remove the command from the list. Similarly, DSA is
; loaded with the address of the next DSA structure and
; reselected_check_next is called if a failure occurs.
;
; Perhaps more concisely, the net effect of the mess is
;
; for (dsa = reconnect_dsa_head, dest = &reconnect_dsa_head,
; src = NULL; dsa; dest = &dsa->next, dsa = dsa->next) {
; src = &dsa->next;
; if (target_id == dsa->id && target_lun == dsa->lun) {
; *dest = *src;
; break;
; }
; }
;
; if (!dsa)
; error (int_err_unexpected_reselect);
; else
; longjmp (dsa->jump_resume, 0);
;
;
; Define DSA structure used for mailboxes
ENTRY dsa_code_template
dsa_code_template:
ENTRY dsa_code_begin
dsa_code_begin:
MOVE dmode_memory_to_ncr TO DMODE
at 0x00000000 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, dsa_temp_addr_dsa_value, addr_scratch
at 0x00000002 : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000005 : */ 0x78380000,0x00000000,
/*
CALL scratch_to_dsa
at 0x00000007 : */ 0x88080000,0x00000980,
/*
CALL select
at 0x00000009 : */ 0x88080000,0x000001fc,
/*
; Handle the phase mismatch which may have resulted from the
; MOVE FROM dsa_msgout if we returned here. The CLEAR ATN
; may or may not be necessary, and we should update script_asm.pl
; to handle multiple pieces.
CLEAR ATN
at 0x0000000b : */ 0x60000008,0x00000000,
/*
CLEAR ACK
at 0x0000000d : */ 0x60000040,0x00000000,
/*
; Replace second operand with address of JUMP instruction dest operand
; in schedule table for this DSA. Becomes dsa_jump_dest in 53c7,8xx.c.
ENTRY dsa_code_fix_jump
dsa_code_fix_jump:
MOVE MEMORY 4, NOP_insn, 0
at 0x0000000f : */ 0xc0000004,0x00000000,0x00000000,
/*
JUMP select_done
at 0x00000012 : */ 0x80080000,0x00000224,
/*
; wrong_dsa loads the DSA register with the value of the dsa_next
; field.
;
wrong_dsa:
; Patch the MOVE MEMORY INSTRUCTION such that
; the destination address is the address of the OLD
; next pointer.
;
MOVE MEMORY 4, dsa_temp_addr_next, reselected_ok + 8
at 0x00000014 : */ 0xc0000004,0x00000000,0x00000758,
/*
MOVE dmode_memory_to_ncr TO DMODE
at 0x00000017 : */ 0x78380000,0x00000000,
/*
;
; Move the _contents_ of the next pointer into the DSA register as
; the next I_T_L or I_T_L_Q tupple to check against the established
; nexus.
;
MOVE MEMORY 4, dsa_temp_next, addr_scratch
at 0x00000019 : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x0000001c : */ 0x78380000,0x00000000,
/*
CALL scratch_to_dsa
at 0x0000001e : */ 0x88080000,0x00000980,
/*
JUMP reselected_check_next
at 0x00000020 : */ 0x80080000,0x000006a4,
/*
ABSOLUTE dsa_save_data_pointer = 0
ENTRY dsa_code_save_data_pointer
dsa_code_save_data_pointer:
MOVE dmode_ncr_to_memory TO DMODE
at 0x00000022 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_temp, dsa_temp_addr_saved_pointer
at 0x00000024 : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000027 : */ 0x78380000,0x00000000,
/*
; HARD CODED : 24 bytes needs to agree with 53c7,8xx.h
MOVE MEMORY 24, dsa_temp_addr_residual, dsa_temp_addr_saved_residual
at 0x00000029 : */ 0xc0000018,0x00000000,0x00000000,
/*
CLEAR ACK
at 0x0000002c : */ 0x60000040,0x00000000,
/*
RETURN
at 0x0000002e : */ 0x90080000,0x00000000,
/*
ABSOLUTE dsa_restore_pointers = 0
ENTRY dsa_code_restore_pointers
dsa_code_restore_pointers:
MOVE dmode_memory_to_ncr TO DMODE
at 0x00000030 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, dsa_temp_addr_saved_pointer, addr_temp
at 0x00000032 : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000035 : */ 0x78380000,0x00000000,
/*
; HARD CODED : 24 bytes needs to agree with 53c7,8xx.h
MOVE MEMORY 24, dsa_temp_addr_saved_residual, dsa_temp_addr_residual
at 0x00000037 : */ 0xc0000018,0x00000000,0x00000000,
/*
CLEAR ACK
at 0x0000003a : */ 0x60000040,0x00000000,
/*
RETURN
at 0x0000003c : */ 0x90080000,0x00000000,
/*
ABSOLUTE dsa_check_reselect = 0
; dsa_check_reselect determines whether or not the current target and
; lun match the current DSA
ENTRY dsa_code_check_reselect
dsa_code_check_reselect:
MOVE SSID TO SFBR ; SSID contains 3 bit target ID
at 0x0000003e : */ 0x720a0000,0x00000000,
/*
; FIXME : we need to accommodate bit fielded and binary here for '7xx/'8xx chips
JUMP REL (wrong_dsa), IF NOT dsa_temp_target, AND MASK 0xf8
at 0x00000040 : */ 0x8084f800,0x00ffff48,
/*
;
; Hack - move to scratch first, since SFBR is not writeable
; via the CPU and hence a MOVE MEMORY instruction.
;
MOVE dmode_memory_to_ncr TO DMODE
at 0x00000042 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 1, reselected_identify, addr_scratch
at 0x00000044 : */ 0xc0000001,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000047 : */ 0x78380000,0x00000000,
/*
MOVE SCRATCH0 TO SFBR
at 0x00000049 : */ 0x72340000,0x00000000,
/*
; FIXME : we need to accommodate bit fielded and binary here for '7xx/'8xx chips
JUMP REL (wrong_dsa), IF NOT dsa_temp_lun, AND MASK 0xf8
at 0x0000004b : */ 0x8084f800,0x00ffff1c,
/*
; Patch the MOVE MEMORY INSTRUCTION such that
; the source address is the address of this dsa's
; next pointer.
MOVE MEMORY 4, dsa_temp_addr_next, reselected_ok + 4
at 0x0000004d : */ 0xc0000004,0x00000000,0x00000754,
/*
CALL reselected_ok
at 0x00000050 : */ 0x88080000,0x00000750,
/*
CALL dsa_temp_sync
at 0x00000052 : */ 0x88080000,0x00000000,
/*
; Release ACK on the IDENTIFY message _after_ we've set the synchronous
; transfer parameters!
CLEAR ACK
at 0x00000054 : */ 0x60000040,0x00000000,
/*
; Implicitly restore pointers on reselection, so a RETURN
; will transfer control back to the right spot.
CALL REL (dsa_code_restore_pointers)
at 0x00000056 : */ 0x88880000,0x00ffff60,
/*
RETURN
at 0x00000058 : */ 0x90080000,0x00000000,
/*
ENTRY dsa_zero
dsa_zero:
ENTRY dsa_code_template_end
dsa_code_template_end:
; Perform sanity check for dsa_fields_start == dsa_code_template_end -
; dsa_zero, puke.
ABSOLUTE dsa_fields_start = 0 ; Sanity marker
; pad 48 bytes (fix this RSN)
ABSOLUTE dsa_next = 48 ; len 4 Next DSA
; del 4 Previous DSA address
ABSOLUTE dsa_cmnd = 56 ; len 4 Scsi_Cmnd * for this thread.
ABSOLUTE dsa_select = 60 ; len 4 Device ID, Period, Offset for
; table indirect select
ABSOLUTE dsa_msgout = 64 ; len 8 table indirect move parameter for
; select message
ABSOLUTE dsa_cmdout = 72 ; len 8 table indirect move parameter for
; command
ABSOLUTE dsa_dataout = 80 ; len 4 code pointer for dataout
ABSOLUTE dsa_datain = 84 ; len 4 code pointer for datain
ABSOLUTE dsa_msgin = 88 ; len 8 table indirect move for msgin
ABSOLUTE dsa_status = 96 ; len 8 table indirect move for status byte
ABSOLUTE dsa_msgout_other = 104 ; len 8 table indirect for normal message out
; (Synchronous transfer negotiation, etc).
ABSOLUTE dsa_end = 112
ABSOLUTE schedule = 0 ; Array of JUMP dsa_begin or JUMP (next),
; terminated by a call to JUMP wait_reselect
; Linked lists of DSA structures
ABSOLUTE reconnect_dsa_head = 0 ; Link list of DSAs which can reconnect
ABSOLUTE addr_reconnect_dsa_head = 0 ; Address of variable containing
; address of reconnect_dsa_head
; These select the source and destination of a MOVE MEMORY instruction
ABSOLUTE dmode_memory_to_memory = 0x0
ABSOLUTE dmode_memory_to_ncr = 0x0
ABSOLUTE dmode_ncr_to_memory = 0x0
ABSOLUTE addr_scratch = 0x0
ABSOLUTE addr_temp = 0x0
; Interrupts -
; MSB indicates type
; 0 handle error condition
; 1 handle message
; 2 handle normal condition
; 3 debugging interrupt
; 4 testing interrupt
; Next byte indicates specific error
; XXX not yet implemented, I'm not sure if I want to -
; Next byte indicates the routine the error occurred in
; The LSB indicates the specific place the error occurred
ABSOLUTE int_err_unexpected_phase = 0x00000000 ; Unexpected phase encountered
ABSOLUTE int_err_selected = 0x00010000 ; SELECTED (nee RESELECTED)
ABSOLUTE int_err_unexpected_reselect = 0x00020000
ABSOLUTE int_err_check_condition = 0x00030000
ABSOLUTE int_err_no_phase = 0x00040000
ABSOLUTE int_msg_wdtr = 0x01000000 ; WDTR message received
ABSOLUTE int_msg_sdtr = 0x01010000 ; SDTR received
ABSOLUTE int_msg_1 = 0x01020000 ; single byte special message
; received
ABSOLUTE int_norm_select_complete = 0x02000000 ; Select complete, reprogram
; registers.
ABSOLUTE int_norm_reselect_complete = 0x02010000 ; Nexus established
ABSOLUTE int_norm_command_complete = 0x02020000 ; Command complete
ABSOLUTE int_norm_disconnected = 0x02030000 ; Disconnected
ABSOLUTE int_norm_aborted =0x02040000 ; Aborted *dsa
ABSOLUTE int_norm_reset = 0x02050000 ; Generated BUS reset.
ABSOLUTE int_debug_break = 0x03000000 ; Break point
ABSOLUTE int_debug_panic = 0x030b0000 ; Panic driver
ABSOLUTE int_test_1 = 0x04000000 ; Test 1 complete
ABSOLUTE int_test_2 = 0x04010000 ; Test 2 complete
ABSOLUTE int_test_3 = 0x04020000 ; Test 3 complete
; These should start with 0x05000000, with low bits incrementing for
; each one.
ABSOLUTE NCR53c7xx_msg_abort = 0 ; Pointer to abort message
ABSOLUTE NCR53c7xx_msg_reject = 0 ; Pointer to reject message
ABSOLUTE NCR53c7xx_zero = 0 ; long with zero in it, use for source
ABSOLUTE NCR53c7xx_sink = 0 ; long to dump worthless data in
ABSOLUTE NOP_insn = 0 ; NOP instruction
; Pointer to message, potentially multi-byte
ABSOLUTE msg_buf = 0
; Pointer to holding area for reselection information
ABSOLUTE reselected_identify = 0
ABSOLUTE reselected_tag = 0
; Request sense command pointer, it's a 6 byte command, should
; be constant for all commands since we always want 16 bytes of
; sense and we don't need to change any fields as we did under
; SCSI-I when we actually cared about the LUN field.
;EXTERNAL NCR53c7xx_sense ; Request sense command
; dsa_schedule
; PURPOSE : after a DISCONNECT message has been received, and pointers
; saved, insert the current DSA structure at the head of the
; disconnected queue and fall through to the scheduler.
;
; CALLS : OK
;
; INPUTS : dsa - current DSA structure, reconnect_dsa_head - list
; of disconnected commands
;
; MODIFIES : SCRATCH, reconnect_dsa_head
;
; EXITS : always passes control to schedule
ENTRY dsa_schedule
dsa_schedule:
;
; Calculate the address of the next pointer within the DSA
; structure of the command that is currently disconnecting
;
CALL dsa_to_scratch
at 0x0000005a : */ 0x88080000,0x00000938,
/*
MOVE SCRATCH0 + dsa_next TO SCRATCH0
at 0x0000005c : */ 0x7e343000,0x00000000,
/*
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
at 0x0000005e : */ 0x7f350000,0x00000000,
/*
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
at 0x00000060 : */ 0x7f360000,0x00000000,
/*
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
at 0x00000062 : */ 0x7f370000,0x00000000,
/*
; Point the next field of this DSA structure at the current disconnected
; list
MOVE dmode_ncr_to_memory TO DMODE
at 0x00000064 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, dsa_schedule_insert + 8
at 0x00000066 : */ 0xc0000004,0x00000000,0x000001b4,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000069 : */ 0x78380000,0x00000000,
/*
dsa_schedule_insert:
MOVE MEMORY 4, reconnect_dsa_head, 0
at 0x0000006b : */ 0xc0000004,0x00000000,0x00000000,
/*
; And update the head pointer.
CALL dsa_to_scratch
at 0x0000006e : */ 0x88080000,0x00000938,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x00000070 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, reconnect_dsa_head
at 0x00000072 : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000075 : */ 0x78380000,0x00000000,
/*
MOVE SCNTL2 & 0x7f TO SCNTL2
at 0x00000077 : */ 0x7c027f00,0x00000000,
/*
CLEAR ACK
at 0x00000079 : */ 0x60000040,0x00000000,
/*
WAIT DISCONNECT
at 0x0000007b : */ 0x48000000,0x00000000,
/*
JUMP schedule
at 0x0000007d : */ 0x80080000,0x00000000,
/*
;
; select
;
; PURPOSE : establish a nexus for the SCSI command referenced by DSA.
; On success, the current DSA structure is removed from the issue
; queue. Usually, this is entered as a fall-through from schedule,
; although the contingent allegiance handling code will write
; the select entry address to the DSP to restart a command as a
; REQUEST SENSE. A message is sent (usually IDENTIFY, although
; additional SDTR or WDTR messages may be sent). COMMAND OUT
; is handled.
;
; INPUTS : DSA - SCSI command, issue_dsa_head
;
; CALLS : NOT OK
;
; MODIFIES : SCRATCH, issue_dsa_head
;
; EXITS : on reselection or selection, go to select_failed
; otherwise, RETURN so control is passed back to
; dsa_begin.
;
ENTRY select
select:
CLEAR TARGET
at 0x0000007f : */ 0x60000200,0x00000000,
/*
; XXX
;
; In effect, SELECTION operations are backgrounded, with execution
; continuing until code which waits for REQ or a fatal interrupt is
; encountered.
;
; So, for more performance, we could overlap the code which removes
; the command from the NCRs issue queue with the selection, but
; at this point I don't want to deal with the error recovery.
;
SELECT ATN FROM dsa_select, select_failed
at 0x00000081 : */ 0x4300003c,0x000007a4,
/*
JUMP select_msgout, WHEN MSG_OUT
at 0x00000083 : */ 0x860b0000,0x00000214,
/*
ENTRY select_msgout
select_msgout:
MOVE FROM dsa_msgout, WHEN MSG_OUT
at 0x00000085 : */ 0x1e000000,0x00000040,
/*
RETURN
at 0x00000087 : */ 0x90080000,0x00000000,
/*
;
; select_done
;
; PURPOSE: continue on to normal data transfer; called as the exit
; point from dsa_begin.
;
; INPUTS: dsa
;
; CALLS: OK
;
;
select_done:
; After a successful selection, we should get either a CMD phase or
; some transfer request negotiation message.
JUMP cmdout, WHEN CMD
at 0x00000089 : */ 0x820b0000,0x00000244,
/*
INT int_err_unexpected_phase, WHEN NOT MSG_IN
at 0x0000008b : */ 0x9f030000,0x00000000,
/*
select_msg_in:
CALL msg_in, WHEN MSG_IN
at 0x0000008d : */ 0x8f0b0000,0x00000404,
/*
JUMP select_msg_in, WHEN MSG_IN
at 0x0000008f : */ 0x870b0000,0x00000234,
/*
cmdout:
INT int_err_unexpected_phase, WHEN NOT CMD
at 0x00000091 : */ 0x9a030000,0x00000000,
/*
ENTRY cmdout_cmdout
cmdout_cmdout:
MOVE FROM dsa_cmdout, WHEN CMD
at 0x00000093 : */ 0x1a000000,0x00000048,
/*
;
; data_transfer
; other_out
; other_in
; other_transfer
;
; PURPOSE : handle the main data transfer for a SCSI command in
; several parts. In the first part, data_transfer, DATA_IN
; and DATA_OUT phases are allowed, with the user provided
; code (usually dynamically generated based on the scatter/gather
; list associated with a SCSI command) called to handle these
; phases.
;
; After control has passed to one of the user provided
; DATA_IN or DATA_OUT routines, back calls are made to
; other_transfer_in or other_transfer_out to handle non-DATA IN
; and DATA OUT phases respectively, with the state of the active
; data pointer being preserved in TEMP.
;
; On completion, the user code passes control to other_transfer
; which causes DATA_IN and DATA_OUT to result in unexpected_phase
; interrupts so that data overruns may be trapped.
;
; INPUTS : DSA - SCSI command
;
; CALLS : OK in data_transfer_start, not ok in other_out and other_in, ok in
; other_transfer
;
; MODIFIES : SCRATCH
;
; EXITS : if STATUS IN is detected, signifying command completion,
; the NCR jumps to command_complete. If MSG IN occurs, a
; CALL is made to msg_in. Otherwise, other_transfer runs in
; an infinite loop.
;
ENTRY data_transfer
data_transfer:
JUMP cmdout_cmdout, WHEN CMD
at 0x00000095 : */ 0x820b0000,0x0000024c,
/*
CALL msg_in, WHEN MSG_IN
at 0x00000097 : */ 0x8f0b0000,0x00000404,
/*
INT int_err_unexpected_phase, WHEN MSG_OUT
at 0x00000099 : */ 0x9e0b0000,0x00000000,
/*
JUMP do_dataout, WHEN DATA_OUT
at 0x0000009b : */ 0x800b0000,0x0000028c,
/*
JUMP do_datain, WHEN DATA_IN
at 0x0000009d : */ 0x810b0000,0x000002e4,
/*
JUMP command_complete, WHEN STATUS
at 0x0000009f : */ 0x830b0000,0x0000060c,
/*
JUMP data_transfer
at 0x000000a1 : */ 0x80080000,0x00000254,
/*
ENTRY end_data_transfer
end_data_transfer:
;
; FIXME: On NCR53c700 and NCR53c700-66 chips, do_dataout/do_datain
; should be fixed up whenever the nexus changes so it can point to the
; correct routine for that command.
;
; Nasty jump to dsa->dataout
do_dataout:
CALL dsa_to_scratch
at 0x000000a3 : */ 0x88080000,0x00000938,
/*
MOVE SCRATCH0 + dsa_dataout TO SCRATCH0
at 0x000000a5 : */ 0x7e345000,0x00000000,
/*
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
at 0x000000a7 : */ 0x7f350000,0x00000000,
/*
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
at 0x000000a9 : */ 0x7f360000,0x00000000,
/*
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
at 0x000000ab : */ 0x7f370000,0x00000000,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x000000ad : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, dataout_to_jump + 4
at 0x000000af : */ 0xc0000004,0x00000000,0x000002d4,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x000000b2 : */ 0x78380000,0x00000000,
/*
dataout_to_jump:
MOVE MEMORY 4, 0, dataout_jump + 4
at 0x000000b4 : */ 0xc0000004,0x00000000,0x000002e0,
/*
dataout_jump:
JUMP 0
at 0x000000b7 : */ 0x80080000,0x00000000,
/*
; Nasty jump to dsa->dsain
do_datain:
CALL dsa_to_scratch
at 0x000000b9 : */ 0x88080000,0x00000938,
/*
MOVE SCRATCH0 + dsa_datain TO SCRATCH0
at 0x000000bb : */ 0x7e345400,0x00000000,
/*
MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY
at 0x000000bd : */ 0x7f350000,0x00000000,
/*
MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY
at 0x000000bf : */ 0x7f360000,0x00000000,
/*
MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY
at 0x000000c1 : */ 0x7f370000,0x00000000,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x000000c3 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, datain_to_jump + 4
at 0x000000c5 : */ 0xc0000004,0x00000000,0x0000032c,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x000000c8 : */ 0x78380000,0x00000000,
/*
ENTRY datain_to_jump
datain_to_jump:
MOVE MEMORY 4, 0, datain_jump + 4
at 0x000000ca : */ 0xc0000004,0x00000000,0x00000338,
/*
datain_jump:
JUMP 0
at 0x000000cd : */ 0x80080000,0x00000000,
/*
; Note that other_out and other_in loop until a non-data phase
; is discovered, so we only execute return statements when we
; can go on to the next data phase block move statement.
ENTRY other_out
other_out:
INT int_err_unexpected_phase, WHEN CMD
at 0x000000cf : */ 0x9a0b0000,0x00000000,
/*
JUMP msg_in_restart, WHEN MSG_IN
at 0x000000d1 : */ 0x870b0000,0x000003e4,
/*
INT int_err_unexpected_phase, WHEN MSG_OUT
at 0x000000d3 : */ 0x9e0b0000,0x00000000,
/*
INT int_err_unexpected_phase, WHEN DATA_IN
at 0x000000d5 : */ 0x990b0000,0x00000000,
/*
JUMP command_complete, WHEN STATUS
at 0x000000d7 : */ 0x830b0000,0x0000060c,
/*
JUMP other_out, WHEN NOT DATA_OUT
at 0x000000d9 : */ 0x80030000,0x0000033c,
/*
RETURN
at 0x000000db : */ 0x90080000,0x00000000,
/*
ENTRY other_in
other_in:
INT int_err_unexpected_phase, WHEN CMD
at 0x000000dd : */ 0x9a0b0000,0x00000000,
/*
JUMP msg_in_restart, WHEN MSG_IN
at 0x000000df : */ 0x870b0000,0x000003e4,
/*
INT int_err_unexpected_phase, WHEN MSG_OUT
at 0x000000e1 : */ 0x9e0b0000,0x00000000,
/*
INT int_err_unexpected_phase, WHEN DATA_OUT
at 0x000000e3 : */ 0x980b0000,0x00000000,
/*
JUMP command_complete, WHEN STATUS
at 0x000000e5 : */ 0x830b0000,0x0000060c,
/*
JUMP other_in, WHEN NOT DATA_IN
at 0x000000e7 : */ 0x81030000,0x00000374,
/*
RETURN
at 0x000000e9 : */ 0x90080000,0x00000000,
/*
ENTRY other_transfer
other_transfer:
INT int_err_unexpected_phase, WHEN CMD
at 0x000000eb : */ 0x9a0b0000,0x00000000,
/*
CALL msg_in, WHEN MSG_IN
at 0x000000ed : */ 0x8f0b0000,0x00000404,
/*
INT int_err_unexpected_phase, WHEN MSG_OUT
at 0x000000ef : */ 0x9e0b0000,0x00000000,
/*
INT int_err_unexpected_phase, WHEN DATA_OUT
at 0x000000f1 : */ 0x980b0000,0x00000000,
/*
INT int_err_unexpected_phase, WHEN DATA_IN
at 0x000000f3 : */ 0x990b0000,0x00000000,
/*
JUMP command_complete, WHEN STATUS
at 0x000000f5 : */ 0x830b0000,0x0000060c,
/*
JUMP other_transfer
at 0x000000f7 : */ 0x80080000,0x000003ac,
/*
;
; msg_in_restart
; msg_in
; munge_msg
;
; PURPOSE : process messages from a target. msg_in is called when the
; caller hasn't read the first byte of the message. munge_message
; is called when the caller has read the first byte of the message,
; and left it in SFBR. msg_in_restart is called when the caller
; hasn't read the first byte of the message, and wishes RETURN
; to transfer control back to the address of the conditional
; CALL instruction rather than to the instruction after it.
;
; Various int_* interrupts are generated when the host system
; needs to intervene, as is the case with SDTR, WDTR, and
; INITIATE RECOVERY messages.
;
; When the host system handles one of these interrupts,
; it can respond by reentering at reject_message,
; which rejects the message and returns control to
; the caller of msg_in or munge_msg, accept_message
; which clears ACK and returns control, or reply_message
; which sends the message pointed to by the DSA
; msgout_other table indirect field.
;
; DISCONNECT messages are handled by moving the command
; to the reconnect_dsa_queue.
;
; INPUTS : DSA - SCSI COMMAND, SFBR - first byte of message (munge_msg
; only)
;
; CALLS : NO. The TEMP register isn't backed up to allow nested calls.
;
; MODIFIES : SCRATCH, DSA on DISCONNECT
;
; EXITS : On receipt of SAVE DATA POINTER, RESTORE POINTERS,
; and normal return from message handlers running under
; Linux, control is returned to the caller. Receipt
; of DISCONNECT messages pass control to dsa_schedule.
;
ENTRY msg_in_restart
msg_in_restart:
; XXX - hackish
;
; Since it's easier to debug changes to the statically
; compiled code, rather than the dynamically generated
; stuff, such as
;
; MOVE x, y, WHEN data_phase
; CALL other_z, WHEN NOT data_phase
; MOVE x, y, WHEN data_phase
;
; I'd like to have certain routines (notably the message handler)
; restart on the conditional call rather than the next instruction.
;
; So, subtract 8 from the return address
MOVE TEMP0 + 0xf8 TO TEMP0
at 0x000000f9 : */ 0x7e1cf800,0x00000000,
/*
MOVE TEMP1 + 0xff TO TEMP1 WITH CARRY
at 0x000000fb : */ 0x7f1dff00,0x00000000,
/*
MOVE TEMP2 + 0xff TO TEMP2 WITH CARRY
at 0x000000fd : */ 0x7f1eff00,0x00000000,
/*
MOVE TEMP3 + 0xff TO TEMP3 WITH CARRY
at 0x000000ff : */ 0x7f1fff00,0x00000000,
/*
ENTRY msg_in
msg_in:
MOVE 1, msg_buf, WHEN MSG_IN
at 0x00000101 : */ 0x0f000001,0x00000000,
/*
munge_msg:
JUMP munge_extended, IF 0x01 ; EXTENDED MESSAGE
at 0x00000103 : */ 0x800c0001,0x00000524,
/*
JUMP munge_2, IF 0x20, AND MASK 0xdf ; two byte message
at 0x00000105 : */ 0x800cdf20,0x0000044c,
/*
;
; XXX - I've seen a handful of broken SCSI devices which fail to issue
; a SAVE POINTERS message before disconnecting in the middle of
; a transfer, assuming that the DATA POINTER will be implicitly
; restored.
;
; Historically, I've often done an implicit save when the DISCONNECT
; message is processed. We may want to consider having the option of
; doing that here.
;
JUMP munge_save_data_pointer, IF 0x02 ; SAVE DATA POINTER
at 0x00000107 : */ 0x800c0002,0x00000454,
/*
JUMP munge_restore_pointers, IF 0x03 ; RESTORE POINTERS
at 0x00000109 : */ 0x800c0003,0x000004b8,
/*
JUMP munge_disconnect, IF 0x04 ; DISCONNECT
at 0x0000010b : */ 0x800c0004,0x0000051c,
/*
INT int_msg_1, IF 0x07 ; MESSAGE REJECT
at 0x0000010d : */ 0x980c0007,0x01020000,
/*
INT int_msg_1, IF 0x0f ; INITIATE RECOVERY
at 0x0000010f : */ 0x980c000f,0x01020000,
/*
JUMP reject_message
at 0x00000111 : */ 0x80080000,0x000005b4,
/*
munge_2:
JUMP reject_message
at 0x00000113 : */ 0x80080000,0x000005b4,
/*
;
; The SCSI standard allows targets to recover from transient
; error conditions by backing up the data pointer with a
; RESTORE POINTERS message.
;
; So, we must save and restore the _residual_ code as well as
; the current instruction pointer. Because of this messiness,
; it is simpler to put dynamic code in the dsa for this and to
; just do a simple jump down there.
;
munge_save_data_pointer:
MOVE DSA0 + dsa_save_data_pointer TO SFBR
at 0x00000115 : */ 0x76100000,0x00000000,
/*
MOVE SFBR TO SCRATCH0
at 0x00000117 : */ 0x6a340000,0x00000000,
/*
MOVE DSA1 + 0xff TO SFBR WITH CARRY
at 0x00000119 : */ 0x7711ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH1
at 0x0000011b : */ 0x6a350000,0x00000000,
/*
MOVE DSA2 + 0xff TO SFBR WITH CARRY
at 0x0000011d : */ 0x7712ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH2
at 0x0000011f : */ 0x6a360000,0x00000000,
/*
MOVE DSA3 + 0xff TO SFBR WITH CARRY
at 0x00000121 : */ 0x7713ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH3
at 0x00000123 : */ 0x6a370000,0x00000000,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x00000125 : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, jump_dsa_save + 4
at 0x00000127 : */ 0xc0000004,0x00000000,0x000004b4,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x0000012a : */ 0x78380000,0x00000000,
/*
jump_dsa_save:
JUMP 0
at 0x0000012c : */ 0x80080000,0x00000000,
/*
munge_restore_pointers:
MOVE DSA0 + dsa_restore_pointers TO SFBR
at 0x0000012e : */ 0x76100000,0x00000000,
/*
MOVE SFBR TO SCRATCH0
at 0x00000130 : */ 0x6a340000,0x00000000,
/*
MOVE DSA1 + 0xff TO SFBR WITH CARRY
at 0x00000132 : */ 0x7711ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH1
at 0x00000134 : */ 0x6a350000,0x00000000,
/*
MOVE DSA2 + 0xff TO SFBR WITH CARRY
at 0x00000136 : */ 0x7712ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH2
at 0x00000138 : */ 0x6a360000,0x00000000,
/*
MOVE DSA3 + 0xff TO SFBR WITH CARRY
at 0x0000013a : */ 0x7713ff00,0x00000000,
/*
MOVE SFBR TO SCRATCH3
at 0x0000013c : */ 0x6a370000,0x00000000,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x0000013e : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, jump_dsa_restore + 4
at 0x00000140 : */ 0xc0000004,0x00000000,0x00000518,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000143 : */ 0x78380000,0x00000000,
/*
jump_dsa_restore:
JUMP 0
at 0x00000145 : */ 0x80080000,0x00000000,
/*
munge_disconnect:
JUMP dsa_schedule
at 0x00000147 : */ 0x80080000,0x00000168,
/*
munge_extended:
CLEAR ACK
at 0x00000149 : */ 0x60000040,0x00000000,
/*
INT int_err_unexpected_phase, WHEN NOT MSG_IN
at 0x0000014b : */ 0x9f030000,0x00000000,
/*
MOVE 1, msg_buf + 1, WHEN MSG_IN
at 0x0000014d : */ 0x0f000001,0x00000001,
/*
JUMP munge_extended_2, IF 0x02
at 0x0000014f : */ 0x800c0002,0x00000554,
/*
JUMP munge_extended_3, IF 0x03
at 0x00000151 : */ 0x800c0003,0x00000584,
/*
JUMP reject_message
at 0x00000153 : */ 0x80080000,0x000005b4,
/*
munge_extended_2:
CLEAR ACK
at 0x00000155 : */ 0x60000040,0x00000000,
/*
MOVE 1, msg_buf + 2, WHEN MSG_IN
at 0x00000157 : */ 0x0f000001,0x00000002,
/*
JUMP reject_message, IF NOT 0x02 ; Must be WDTR
at 0x00000159 : */ 0x80040002,0x000005b4,
/*
CLEAR ACK
at 0x0000015b : */ 0x60000040,0x00000000,
/*
MOVE 1, msg_buf + 3, WHEN MSG_IN
at 0x0000015d : */ 0x0f000001,0x00000003,
/*
INT int_msg_wdtr
at 0x0000015f : */ 0x98080000,0x01000000,
/*
munge_extended_3:
CLEAR ACK
at 0x00000161 : */ 0x60000040,0x00000000,
/*
MOVE 1, msg_buf + 2, WHEN MSG_IN
at 0x00000163 : */ 0x0f000001,0x00000002,
/*
JUMP reject_message, IF NOT 0x01 ; Must be SDTR
at 0x00000165 : */ 0x80040001,0x000005b4,
/*
CLEAR ACK
at 0x00000167 : */ 0x60000040,0x00000000,
/*
MOVE 2, msg_buf + 3, WHEN MSG_IN
at 0x00000169 : */ 0x0f000002,0x00000003,
/*
INT int_msg_sdtr
at 0x0000016b : */ 0x98080000,0x01010000,
/*
ENTRY reject_message
reject_message:
SET ATN
at 0x0000016d : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x0000016f : */ 0x60000040,0x00000000,
/*
MOVE 1, NCR53c7xx_msg_reject, WHEN MSG_OUT
at 0x00000171 : */ 0x0e000001,0x00000000,
/*
RETURN
at 0x00000173 : */ 0x90080000,0x00000000,
/*
ENTRY accept_message
accept_message:
CLEAR ATN
at 0x00000175 : */ 0x60000008,0x00000000,
/*
CLEAR ACK
at 0x00000177 : */ 0x60000040,0x00000000,
/*
RETURN
at 0x00000179 : */ 0x90080000,0x00000000,
/*
ENTRY respond_message
respond_message:
SET ATN
at 0x0000017b : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x0000017d : */ 0x60000040,0x00000000,
/*
MOVE FROM dsa_msgout_other, WHEN MSG_OUT
at 0x0000017f : */ 0x1e000000,0x00000068,
/*
RETURN
at 0x00000181 : */ 0x90080000,0x00000000,
/*
;
; command_complete
;
; PURPOSE : handle command termination when STATUS IN is detected by reading
; a status byte followed by a command termination message.
;
; Normal termination results in an INTFLY instruction, and
; the host system can pick out which command terminated by
; examining the MESSAGE and STATUS buffers of all currently
; executing commands;
;
; Abnormal (CHECK_CONDITION) termination results in an
; int_err_check_condition interrupt so that a REQUEST SENSE
; command can be issued out-of-order so that no other command
; clears the contingent allegiance condition.
;
;
; INPUTS : DSA - command
;
; CALLS : OK
;
; EXITS : On successful termination, control is passed to schedule.
; On abnormal termination, the user will usually modify the
; DSA fields and corresponding buffers and return control
; to select.
;
ENTRY command_complete
command_complete:
MOVE FROM dsa_status, WHEN STATUS
at 0x00000183 : */ 0x1b000000,0x00000060,
/*
MOVE SFBR TO SCRATCH0 ; Save status
at 0x00000185 : */ 0x6a340000,0x00000000,
/*
ENTRY command_complete_msgin
command_complete_msgin:
MOVE FROM dsa_msgin, WHEN MSG_IN
at 0x00000187 : */ 0x1f000000,0x00000058,
/*
; Indicate that we should be expecting a disconnect
MOVE SCNTL2 & 0x7f TO SCNTL2
at 0x00000189 : */ 0x7c027f00,0x00000000,
/*
CLEAR ACK
at 0x0000018b : */ 0x60000040,0x00000000,
/*
WAIT DISCONNECT
at 0x0000018d : */ 0x48000000,0x00000000,
/*
;
; The SCSI specification states that when a UNIT ATTENTION condition
; is pending, as indicated by a CHECK CONDITION status message,
; the target shall revert to asynchronous transfers. Since
; synchronous transfers parameters are maintained on a per INITIATOR/TARGET
; basis, and returning control to our scheduler could work on a command
; running on another lun on that target using the old parameters, we must
; interrupt the host processor to get them changed, or change them ourselves.
;
; Once SCSI-II tagged queueing is implemented, things will be even more
; hairy, since contingent allegiance conditions exist on a per-target/lun
; basis, and issuing a new command with a different tag would clear it.
; In these cases, we must interrupt the host processor to get a request
; added to the HEAD of the queue with the request sense command, or we
; must automatically issue the request sense command.
INTFLY
at 0x0000018f : */ 0x98180000,0x00000000,
/*
JUMP schedule
at 0x00000191 : */ 0x80080000,0x00000000,
/*
command_failed:
INT int_err_check_condition
at 0x00000193 : */ 0x98080000,0x00030000,
/*
;
; wait_reselect
;
; PURPOSE : This is essentially the idle routine, where control lands
; when there are no new processes to schedule. wait_reselect
; waits for reselection, selection, and new commands.
;
; When a successful reselection occurs, with the aid
; of fixed up code in each DSA, wait_reselect walks the
; reconnect_dsa_queue, asking each dsa if the target ID
; and LUN match its.
;
; If a match is found, a call is made back to reselected_ok,
; which through the miracles of self modifying code, extracts
; the found DSA from the reconnect_dsa_queue and then
; returns control to the DSAs thread of execution.
;
; INPUTS : NONE
;
; CALLS : OK
;
; MODIFIES : DSA,
;
; EXITS : On successful reselection, control is returned to the
; DSA which called reselected_ok. If the WAIT RESELECT
; was interrupted by a new commands arrival signaled by
; SIG_P, control is passed to schedule. If the NCR is
; selected, the host system is interrupted with an
; int_err_selected which is usually responded to by
; setting DSP to the target_abort address.
ENTRY wait_reselect
wait_reselect:
WAIT RESELECT wait_reselect_failed
at 0x00000195 : */ 0x50000000,0x0000076c,
/*
reselected:
CLEAR TARGET
at 0x00000197 : */ 0x60000200,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x00000199 : */ 0x78380000,0x00000000,
/*
; Read all data needed to reestablish the nexus -
MOVE 1, reselected_identify, WHEN MSG_IN
at 0x0000019b : */ 0x0f000001,0x00000000,
/*
; We used to CLEAR ACK here.
; Point DSA at the current head of the disconnected queue.
MOVE dmode_memory_to_ncr TO DMODE
at 0x0000019d : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, reconnect_dsa_head, addr_scratch
at 0x0000019f : */ 0xc0000004,0x00000000,0x00000000,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x000001a2 : */ 0x78380000,0x00000000,
/*
CALL scratch_to_dsa
at 0x000001a4 : */ 0x88080000,0x00000980,
/*
; Fix the update-next pointer so that the reconnect_dsa_head
; pointer is the one that will be updated if this DSA is a hit
; and we remove it from the queue.
MOVE MEMORY 4, addr_reconnect_dsa_head, reselected_ok + 8
at 0x000001a6 : */ 0xc0000004,0x00000000,0x00000758,
/*
ENTRY reselected_check_next
reselected_check_next:
; Check for a NULL pointer.
MOVE DSA0 TO SFBR
at 0x000001a9 : */ 0x72100000,0x00000000,
/*
JUMP reselected_not_end, IF NOT 0
at 0x000001ab : */ 0x80040000,0x000006ec,
/*
MOVE DSA1 TO SFBR
at 0x000001ad : */ 0x72110000,0x00000000,
/*
JUMP reselected_not_end, IF NOT 0
at 0x000001af : */ 0x80040000,0x000006ec,
/*
MOVE DSA2 TO SFBR
at 0x000001b1 : */ 0x72120000,0x00000000,
/*
JUMP reselected_not_end, IF NOT 0
at 0x000001b3 : */ 0x80040000,0x000006ec,
/*
MOVE DSA3 TO SFBR
at 0x000001b5 : */ 0x72130000,0x00000000,
/*
JUMP reselected_not_end, IF NOT 0
at 0x000001b7 : */ 0x80040000,0x000006ec,
/*
INT int_err_unexpected_reselect
at 0x000001b9 : */ 0x98080000,0x00020000,
/*
reselected_not_end:
;
; XXX the ALU is only eight bits wide, and the assembler
; wont do the dirt work for us. As long as dsa_check_reselect
; is negative, we need to sign extend with 1 bits to the full
; 32 bit width of the address.
;
; A potential work around would be to have a known alignment
; of the DSA structure such that the base address plus
; dsa_check_reselect doesn't require carrying from bytes
; higher than the LSB.
;
MOVE DSA0 TO SFBR
at 0x000001bb : */ 0x72100000,0x00000000,
/*
MOVE SFBR + dsa_check_reselect TO SCRATCH0
at 0x000001bd : */ 0x6e340000,0x00000000,
/*
MOVE DSA1 TO SFBR
at 0x000001bf : */ 0x72110000,0x00000000,
/*
MOVE SFBR + 0xff TO SCRATCH1 WITH CARRY
at 0x000001c1 : */ 0x6f35ff00,0x00000000,
/*
MOVE DSA2 TO SFBR
at 0x000001c3 : */ 0x72120000,0x00000000,
/*
MOVE SFBR + 0xff TO SCRATCH2 WITH CARRY
at 0x000001c5 : */ 0x6f36ff00,0x00000000,
/*
MOVE DSA3 TO SFBR
at 0x000001c7 : */ 0x72130000,0x00000000,
/*
MOVE SFBR + 0xff TO SCRATCH3 WITH CARRY
at 0x000001c9 : */ 0x6f37ff00,0x00000000,
/*
MOVE dmode_ncr_to_memory TO DMODE
at 0x000001cb : */ 0x78380000,0x00000000,
/*
MOVE MEMORY 4, addr_scratch, reselected_check + 4
at 0x000001cd : */ 0xc0000004,0x00000000,0x0000074c,
/*
MOVE dmode_memory_to_memory TO DMODE
at 0x000001d0 : */ 0x78380000,0x00000000,
/*
reselected_check:
JUMP 0
at 0x000001d2 : */ 0x80080000,0x00000000,
/*
;
;
ENTRY reselected_ok
reselected_ok:
MOVE MEMORY 4, 0, 0 ; Patched : first word
at 0x000001d4 : */ 0xc0000004,0x00000000,0x00000000,
/*
; is address of
; successful dsa_next
; Second word is last
; unsuccessful dsa_next,
; starting with
; dsa_reconnect_head
; We used to CLEAR ACK here.
RETURN ; Return control to where
at 0x000001d7 : */ 0x90080000,0x00000000,
/*
selected:
INT int_err_selected;
at 0x000001d9 : */ 0x98080000,0x00010000,
/*
;
; A select or reselect failure can be caused by one of two conditions :
; 1. SIG_P was set. This will be the case if the user has written
; a new value to a previously NULL head of the issue queue.
;
; 2. The NCR53c810 was selected or reselected by another device.
;
; 3. The bus was already busy since we were selected or reselected
; before starting the command.
wait_reselect_failed:
; Check selected bit.
MOVE SIST0 & 0x20 TO SFBR
at 0x000001db : */ 0x74422000,0x00000000,
/*
JUMP selected, IF 0x20
at 0x000001dd : */ 0x800c0020,0x00000764,
/*
; Reading CTEST2 clears the SIG_P bit in the ISTAT register.
MOVE CTEST2 & 0x40 TO SFBR
at 0x000001df : */ 0x741a4000,0x00000000,
/*
JUMP schedule, IF 0x40
at 0x000001e1 : */ 0x800c0040,0x00000000,
/*
; Check connected bit.
; FIXME: this needs to change if we support target mode
MOVE ISTAT & 0x08 TO SFBR
at 0x000001e3 : */ 0x74140800,0x00000000,
/*
JUMP reselected, IF 0x08
at 0x000001e5 : */ 0x800c0008,0x0000065c,
/*
; FIXME : Something bogus happened, and we shouldn't fail silently.
INT int_debug_panic
at 0x000001e7 : */ 0x98080000,0x030b0000,
/*
select_failed:
; Otherwise, mask the selected and reselected bits off SIST0
MOVE SIST0 & 0x30 TO SFBR
at 0x000001e9 : */ 0x74423000,0x00000000,
/*
JUMP selected, IF 0x20
at 0x000001eb : */ 0x800c0020,0x00000764,
/*
JUMP reselected, IF 0x10
at 0x000001ed : */ 0x800c0010,0x0000065c,
/*
; If SIGP is set, the user just gave us another command, and
; we should restart or return to the scheduler.
; Reading CTEST2 clears the SIG_P bit in the ISTAT register.
MOVE CTEST2 & 0x40 TO SFBR
at 0x000001ef : */ 0x741a4000,0x00000000,
/*
JUMP select, IF 0x40
at 0x000001f1 : */ 0x800c0040,0x000001fc,
/*
; Check connected bit.
; FIXME: this needs to change if we support target mode
; FIXME: is this really necessary?
MOVE ISTAT & 0x08 TO SFBR
at 0x000001f3 : */ 0x74140800,0x00000000,
/*
JUMP reselected, IF 0x08
at 0x000001f5 : */ 0x800c0008,0x0000065c,
/*
; FIXME : Something bogus happened, and we shouldn't fail silently.
INT int_debug_panic
at 0x000001f7 : */ 0x98080000,0x030b0000,
/*
;
; test_1
; test_2
;
; PURPOSE : run some verification tests on the NCR. test_1
; copies test_src to test_dest and interrupts the host
; processor, testing for cache coherency and interrupt
; problems in the processes.
;
; test_2 runs a command with offsets relative to the
; DSA on entry, and is useful for miscellaneous experimentation.
;
; Verify that interrupts are working correctly and that we don't
; have a cache invalidation problem.
ABSOLUTE test_src = 0, test_dest = 0
ENTRY test_1
test_1:
MOVE MEMORY 4, test_src, test_dest
at 0x000001f9 : */ 0xc0000004,0x00000000,0x00000000,
/*
INT int_test_1
at 0x000001fc : */ 0x98080000,0x04000000,
/*
;
; Run arbitrary commands, with test code establishing a DSA
;
ENTRY test_2
test_2:
CLEAR TARGET
at 0x000001fe : */ 0x60000200,0x00000000,
/*
SELECT ATN FROM 0, test_2_fail
at 0x00000200 : */ 0x43000000,0x00000850,
/*
JUMP test_2_msgout, WHEN MSG_OUT
at 0x00000202 : */ 0x860b0000,0x00000810,
/*
ENTRY test_2_msgout
test_2_msgout:
MOVE FROM 8, WHEN MSG_OUT
at 0x00000204 : */ 0x1e000000,0x00000008,
/*
MOVE FROM 16, WHEN CMD
at 0x00000206 : */ 0x1a000000,0x00000010,
/*
MOVE FROM 24, WHEN DATA_IN
at 0x00000208 : */ 0x19000000,0x00000018,
/*
MOVE FROM 32, WHEN STATUS
at 0x0000020a : */ 0x1b000000,0x00000020,
/*
MOVE FROM 40, WHEN MSG_IN
at 0x0000020c : */ 0x1f000000,0x00000028,
/*
MOVE SCNTL2 & 0x7f TO SCNTL2
at 0x0000020e : */ 0x7c027f00,0x00000000,
/*
CLEAR ACK
at 0x00000210 : */ 0x60000040,0x00000000,
/*
WAIT DISCONNECT
at 0x00000212 : */ 0x48000000,0x00000000,
/*
test_2_fail:
INT int_test_2
at 0x00000214 : */ 0x98080000,0x04010000,
/*
ENTRY debug_break
debug_break:
INT int_debug_break
at 0x00000216 : */ 0x98080000,0x03000000,
/*
;
; initiator_abort
; target_abort
;
; PURPOSE : Abort the currently established nexus from with initiator
; or target mode.
;
;
ENTRY target_abort
target_abort:
SET TARGET
at 0x00000218 : */ 0x58000200,0x00000000,
/*
DISCONNECT
at 0x0000021a : */ 0x48000000,0x00000000,
/*
CLEAR TARGET
at 0x0000021c : */ 0x60000200,0x00000000,
/*
JUMP schedule
at 0x0000021e : */ 0x80080000,0x00000000,
/*
ENTRY initiator_abort
initiator_abort:
SET ATN
at 0x00000220 : */ 0x58000008,0x00000000,
/*
;
; The SCSI-I specification says that targets may go into MSG out at
; their leisure upon receipt of the ATN single. On all versions of the
; specification, we can't change phases until REQ transitions true->false,
; so we need to sink/source one byte of data to allow the transition.
;
; For the sake of safety, we'll only source one byte of data in all
; cases, but to accommodate the SCSI-I dain bramage, we'll sink an
; arbitrary number of bytes.
JUMP spew_cmd, WHEN CMD
at 0x00000222 : */ 0x820b0000,0x000008b8,
/*
JUMP eat_msgin, WHEN MSG_IN
at 0x00000224 : */ 0x870b0000,0x000008c8,
/*
JUMP eat_datain, WHEN DATA_IN
at 0x00000226 : */ 0x810b0000,0x000008f8,
/*
JUMP eat_status, WHEN STATUS
at 0x00000228 : */ 0x830b0000,0x000008e0,
/*
JUMP spew_dataout, WHEN DATA_OUT
at 0x0000022a : */ 0x800b0000,0x00000910,
/*
JUMP sated
at 0x0000022c : */ 0x80080000,0x00000918,
/*
spew_cmd:
MOVE 1, NCR53c7xx_zero, WHEN CMD
at 0x0000022e : */ 0x0a000001,0x00000000,
/*
JUMP sated
at 0x00000230 : */ 0x80080000,0x00000918,
/*
eat_msgin:
MOVE 1, NCR53c7xx_sink, WHEN MSG_IN
at 0x00000232 : */ 0x0f000001,0x00000000,
/*
JUMP eat_msgin, WHEN MSG_IN
at 0x00000234 : */ 0x870b0000,0x000008c8,
/*
JUMP sated
at 0x00000236 : */ 0x80080000,0x00000918,
/*
eat_status:
MOVE 1, NCR53c7xx_sink, WHEN STATUS
at 0x00000238 : */ 0x0b000001,0x00000000,
/*
JUMP eat_status, WHEN STATUS
at 0x0000023a : */ 0x830b0000,0x000008e0,
/*
JUMP sated
at 0x0000023c : */ 0x80080000,0x00000918,
/*
eat_datain:
MOVE 1, NCR53c7xx_sink, WHEN DATA_IN
at 0x0000023e : */ 0x09000001,0x00000000,
/*
JUMP eat_datain, WHEN DATA_IN
at 0x00000240 : */ 0x810b0000,0x000008f8,
/*
JUMP sated
at 0x00000242 : */ 0x80080000,0x00000918,
/*
spew_dataout:
MOVE 1, NCR53c7xx_zero, WHEN DATA_OUT
at 0x00000244 : */ 0x08000001,0x00000000,
/*
sated:
MOVE SCNTL2 & 0x7f TO SCNTL2
at 0x00000246 : */ 0x7c027f00,0x00000000,
/*
MOVE 1, NCR53c7xx_msg_abort, WHEN MSG_OUT
at 0x00000248 : */ 0x0e000001,0x00000000,
/*
WAIT DISCONNECT
at 0x0000024a : */ 0x48000000,0x00000000,
/*
INT int_norm_aborted
at 0x0000024c : */ 0x98080000,0x02040000,
/*
;
; dsa_to_scratch
; scratch_to_dsa
;
; PURPOSE :
; The NCR chips cannot do a move memory instruction with the DSA register
; as the source or destination. So, we provide a couple of subroutines
; that let us switch between the DSA register and scratch register.
;
; Memory moves to/from the DSPS register also don't work, but we
; don't use them.
;
;
dsa_to_scratch:
MOVE DSA0 TO SFBR
at 0x0000024e : */ 0x72100000,0x00000000,
/*
MOVE SFBR TO SCRATCH0
at 0x00000250 : */ 0x6a340000,0x00000000,
/*
MOVE DSA1 TO SFBR
at 0x00000252 : */ 0x72110000,0x00000000,
/*
MOVE SFBR TO SCRATCH1
at 0x00000254 : */ 0x6a350000,0x00000000,
/*
MOVE DSA2 TO SFBR
at 0x00000256 : */ 0x72120000,0x00000000,
/*
MOVE SFBR TO SCRATCH2
at 0x00000258 : */ 0x6a360000,0x00000000,
/*
MOVE DSA3 TO SFBR
at 0x0000025a : */ 0x72130000,0x00000000,
/*
MOVE SFBR TO SCRATCH3
at 0x0000025c : */ 0x6a370000,0x00000000,
/*
RETURN
at 0x0000025e : */ 0x90080000,0x00000000,
/*
scratch_to_dsa:
MOVE SCRATCH0 TO SFBR
at 0x00000260 : */ 0x72340000,0x00000000,
/*
MOVE SFBR TO DSA0
at 0x00000262 : */ 0x6a100000,0x00000000,
/*
MOVE SCRATCH1 TO SFBR
at 0x00000264 : */ 0x72350000,0x00000000,
/*
MOVE SFBR TO DSA1
at 0x00000266 : */ 0x6a110000,0x00000000,
/*
MOVE SCRATCH2 TO SFBR
at 0x00000268 : */ 0x72360000,0x00000000,
/*
MOVE SFBR TO DSA2
at 0x0000026a : */ 0x6a120000,0x00000000,
/*
MOVE SCRATCH3 TO SFBR
at 0x0000026c : */ 0x72370000,0x00000000,
/*
MOVE SFBR TO DSA3
at 0x0000026e : */ 0x6a130000,0x00000000,
/*
RETURN
at 0x00000270 : */ 0x90080000,0x00000000,
};
#define A_NCR53c7xx_msg_abort 0x00000000
static u32 A_NCR53c7xx_msg_abort_used[] __attribute((unused)) = {
0x00000249,
};
#define A_NCR53c7xx_msg_reject 0x00000000
static u32 A_NCR53c7xx_msg_reject_used[] __attribute((unused)) = {
0x00000172,
};
#define A_NCR53c7xx_sink 0x00000000
static u32 A_NCR53c7xx_sink_used[] __attribute((unused)) = {
0x00000233,
0x00000239,
0x0000023f,
};
#define A_NCR53c7xx_zero 0x00000000
static u32 A_NCR53c7xx_zero_used[] __attribute((unused)) = {
0x0000022f,
0x00000245,
};
#define A_NOP_insn 0x00000000
static u32 A_NOP_insn_used[] __attribute((unused)) = {
0x00000010,
};
#define A_addr_reconnect_dsa_head 0x00000000
static u32 A_addr_reconnect_dsa_head_used[] __attribute((unused)) = {
0x000001a7,
};
#define A_addr_scratch 0x00000000
static u32 A_addr_scratch_used[] __attribute((unused)) = {
0x00000004,
0x0000001b,
0x00000046,
0x00000067,
0x00000073,
0x000000b0,
0x000000c6,
0x00000128,
0x00000141,
0x000001a1,
0x000001ce,
};
#define A_addr_temp 0x00000000
static u32 A_addr_temp_used[] __attribute((unused)) = {
0x00000025,
0x00000034,
};
#define A_dmode_memory_to_memory 0x00000000
static u32 A_dmode_memory_to_memory_used[] __attribute((unused)) = {
0x00000005,
0x0000001c,
0x00000027,
0x00000035,
0x00000047,
0x00000069,
0x00000075,
0x000000b2,
0x000000c8,
0x0000012a,
0x00000143,
0x00000199,
0x000001a2,
0x000001d0,
};
#define A_dmode_memory_to_ncr 0x00000000
static u32 A_dmode_memory_to_ncr_used[] __attribute((unused)) = {
0x00000000,
0x00000017,
0x00000030,
0x00000042,
0x0000019d,
};
#define A_dmode_ncr_to_memory 0x00000000
static u32 A_dmode_ncr_to_memory_used[] __attribute((unused)) = {
0x00000022,
0x00000064,
0x00000070,
0x000000ad,
0x000000c3,
0x00000125,
0x0000013e,
0x000001cb,
};
#define A_dsa_check_reselect 0x00000000
static u32 A_dsa_check_reselect_used[] __attribute((unused)) = {
0x000001bd,
};
#define A_dsa_cmdout 0x00000048
static u32 A_dsa_cmdout_used[] __attribute((unused)) = {
0x00000094,
};
#define A_dsa_cmnd 0x00000038
static u32 A_dsa_cmnd_used[] __attribute((unused)) = {
};
#define A_dsa_datain 0x00000054
static u32 A_dsa_datain_used[] __attribute((unused)) = {
0x000000bb,
};
#define A_dsa_dataout 0x00000050
static u32 A_dsa_dataout_used[] __attribute((unused)) = {
0x000000a5,
};
#define A_dsa_end 0x00000070
static u32 A_dsa_end_used[] __attribute((unused)) = {
};
#define A_dsa_fields_start 0x00000000
static u32 A_dsa_fields_start_used[] __attribute((unused)) = {
};
#define A_dsa_msgin 0x00000058
static u32 A_dsa_msgin_used[] __attribute((unused)) = {
0x00000188,
};
#define A_dsa_msgout 0x00000040
static u32 A_dsa_msgout_used[] __attribute((unused)) = {
0x00000086,
};
#define A_dsa_msgout_other 0x00000068
static u32 A_dsa_msgout_other_used[] __attribute((unused)) = {
0x00000180,
};
#define A_dsa_next 0x00000030
static u32 A_dsa_next_used[] __attribute((unused)) = {
0x0000005c,
};
#define A_dsa_restore_pointers 0x00000000
static u32 A_dsa_restore_pointers_used[] __attribute((unused)) = {
0x0000012e,
};
#define A_dsa_save_data_pointer 0x00000000
static u32 A_dsa_save_data_pointer_used[] __attribute((unused)) = {
0x00000115,
};
#define A_dsa_select 0x0000003c
static u32 A_dsa_select_used[] __attribute((unused)) = {
0x00000081,
};
#define A_dsa_status 0x00000060
static u32 A_dsa_status_used[] __attribute((unused)) = {
0x00000184,
};
#define A_dsa_temp_addr_array_value 0x00000000
static u32 A_dsa_temp_addr_array_value_used[] __attribute((unused)) = {
};
#define A_dsa_temp_addr_dsa_value 0x00000000
static u32 A_dsa_temp_addr_dsa_value_used[] __attribute((unused)) = {
0x00000003,
};
#define A_dsa_temp_addr_new_value 0x00000000
static u32 A_dsa_temp_addr_new_value_used[] __attribute((unused)) = {
};
#define A_dsa_temp_addr_next 0x00000000
static u32 A_dsa_temp_addr_next_used[] __attribute((unused)) = {
0x00000015,
0x0000004e,
};
#define A_dsa_temp_addr_residual 0x00000000
static u32 A_dsa_temp_addr_residual_used[] __attribute((unused)) = {
0x0000002a,
0x00000039,
};
#define A_dsa_temp_addr_saved_pointer 0x00000000
static u32 A_dsa_temp_addr_saved_pointer_used[] __attribute((unused)) = {
0x00000026,
0x00000033,
};
#define A_dsa_temp_addr_saved_residual 0x00000000
static u32 A_dsa_temp_addr_saved_residual_used[] __attribute((unused)) = {
0x0000002b,
0x00000038,
};
#define A_dsa_temp_lun 0x00000000
static u32 A_dsa_temp_lun_used[] __attribute((unused)) = {
0x0000004b,
};
#define A_dsa_temp_next 0x00000000
static u32 A_dsa_temp_next_used[] __attribute((unused)) = {
0x0000001a,
};
#define A_dsa_temp_sync 0x00000000
static u32 A_dsa_temp_sync_used[] __attribute((unused)) = {
0x00000053,
};
#define A_dsa_temp_target 0x00000000
static u32 A_dsa_temp_target_used[] __attribute((unused)) = {
0x00000040,
};
#define A_int_debug_break 0x03000000
static u32 A_int_debug_break_used[] __attribute((unused)) = {
0x00000217,
};
#define A_int_debug_panic 0x030b0000
static u32 A_int_debug_panic_used[] __attribute((unused)) = {
0x000001e8,
0x000001f8,
};
#define A_int_err_check_condition 0x00030000
static u32 A_int_err_check_condition_used[] __attribute((unused)) = {
0x00000194,
};
#define A_int_err_no_phase 0x00040000
static u32 A_int_err_no_phase_used[] __attribute((unused)) = {
};
#define A_int_err_selected 0x00010000
static u32 A_int_err_selected_used[] __attribute((unused)) = {
0x000001da,
};
#define A_int_err_unexpected_phase 0x00000000
static u32 A_int_err_unexpected_phase_used[] __attribute((unused)) = {
0x0000008c,
0x00000092,
0x0000009a,
0x000000d0,
0x000000d4,
0x000000d6,
0x000000de,
0x000000e2,
0x000000e4,
0x000000ec,
0x000000f0,
0x000000f2,
0x000000f4,
0x0000014c,
};
#define A_int_err_unexpected_reselect 0x00020000
static u32 A_int_err_unexpected_reselect_used[] __attribute((unused)) = {
0x000001ba,
};
#define A_int_msg_1 0x01020000
static u32 A_int_msg_1_used[] __attribute((unused)) = {
0x0000010e,
0x00000110,
};
#define A_int_msg_sdtr 0x01010000
static u32 A_int_msg_sdtr_used[] __attribute((unused)) = {
0x0000016c,
};
#define A_int_msg_wdtr 0x01000000
static u32 A_int_msg_wdtr_used[] __attribute((unused)) = {
0x00000160,
};
#define A_int_norm_aborted 0x02040000
static u32 A_int_norm_aborted_used[] __attribute((unused)) = {
0x0000024d,
};
#define A_int_norm_command_complete 0x02020000
static u32 A_int_norm_command_complete_used[] __attribute((unused)) = {
};
#define A_int_norm_disconnected 0x02030000
static u32 A_int_norm_disconnected_used[] __attribute((unused)) = {
};
#define A_int_norm_reselect_complete 0x02010000
static u32 A_int_norm_reselect_complete_used[] __attribute((unused)) = {
};
#define A_int_norm_reset 0x02050000
static u32 A_int_norm_reset_used[] __attribute((unused)) = {
};
#define A_int_norm_select_complete 0x02000000
static u32 A_int_norm_select_complete_used[] __attribute((unused)) = {
};
#define A_int_test_1 0x04000000
static u32 A_int_test_1_used[] __attribute((unused)) = {
0x000001fd,
};
#define A_int_test_2 0x04010000
static u32 A_int_test_2_used[] __attribute((unused)) = {
0x00000215,
};
#define A_int_test_3 0x04020000
static u32 A_int_test_3_used[] __attribute((unused)) = {
};
#define A_msg_buf 0x00000000
static u32 A_msg_buf_used[] __attribute((unused)) = {
0x00000102,
0x0000014e,
0x00000158,
0x0000015e,
0x00000164,
0x0000016a,
};
#define A_reconnect_dsa_head 0x00000000
static u32 A_reconnect_dsa_head_used[] __attribute((unused)) = {
0x0000006c,
0x00000074,
0x000001a0,
};
#define A_reselected_identify 0x00000000
static u32 A_reselected_identify_used[] __attribute((unused)) = {
0x00000045,
0x0000019c,
};
#define A_reselected_tag 0x00000000
static u32 A_reselected_tag_used[] __attribute((unused)) = {
};
#define A_schedule 0x00000000
static u32 A_schedule_used[] __attribute((unused)) = {
0x0000007e,
0x00000192,
0x000001e2,
0x0000021f,
};
#define A_test_dest 0x00000000
static u32 A_test_dest_used[] __attribute((unused)) = {
0x000001fb,
};
#define A_test_src 0x00000000
static u32 A_test_src_used[] __attribute((unused)) = {
0x000001fa,
};
#define Ent_accept_message 0x000005d4
#define Ent_cmdout_cmdout 0x0000024c
#define Ent_command_complete 0x0000060c
#define Ent_command_complete_msgin 0x0000061c
#define Ent_data_transfer 0x00000254
#define Ent_datain_to_jump 0x00000328
#define Ent_debug_break 0x00000858
#define Ent_dsa_code_begin 0x00000000
#define Ent_dsa_code_check_reselect 0x000000f8
#define Ent_dsa_code_fix_jump 0x0000003c
#define Ent_dsa_code_restore_pointers 0x000000c0
#define Ent_dsa_code_save_data_pointer 0x00000088
#define Ent_dsa_code_template 0x00000000
#define Ent_dsa_code_template_end 0x00000168
#define Ent_dsa_schedule 0x00000168
#define Ent_dsa_zero 0x00000168
#define Ent_end_data_transfer 0x0000028c
#define Ent_initiator_abort 0x00000880
#define Ent_msg_in 0x00000404
#define Ent_msg_in_restart 0x000003e4
#define Ent_other_in 0x00000374
#define Ent_other_out 0x0000033c
#define Ent_other_transfer 0x000003ac
#define Ent_reject_message 0x000005b4
#define Ent_reselected_check_next 0x000006a4
#define Ent_reselected_ok 0x00000750
#define Ent_respond_message 0x000005ec
#define Ent_select 0x000001fc
#define Ent_select_msgout 0x00000214
#define Ent_target_abort 0x00000860
#define Ent_test_1 0x000007e4
#define Ent_test_2 0x000007f8
#define Ent_test_2_msgout 0x00000810
#define Ent_wait_reselect 0x00000654
static u32 LABELPATCHES[] __attribute((unused)) = {
0x00000008,
0x0000000a,
0x00000013,
0x00000016,
0x0000001f,
0x00000021,
0x0000004f,
0x00000051,
0x0000005b,
0x00000068,
0x0000006f,
0x00000082,
0x00000084,
0x0000008a,
0x0000008e,
0x00000090,
0x00000096,
0x00000098,
0x0000009c,
0x0000009e,
0x000000a0,
0x000000a2,
0x000000a4,
0x000000b1,
0x000000b6,
0x000000ba,
0x000000c7,
0x000000cc,
0x000000d2,
0x000000d8,
0x000000da,
0x000000e0,
0x000000e6,
0x000000e8,
0x000000ee,
0x000000f6,
0x000000f8,
0x00000104,
0x00000106,
0x00000108,
0x0000010a,
0x0000010c,
0x00000112,
0x00000114,
0x00000129,
0x00000142,
0x00000148,
0x00000150,
0x00000152,
0x00000154,
0x0000015a,
0x00000166,
0x00000196,
0x000001a5,
0x000001a8,
0x000001ac,
0x000001b0,
0x000001b4,
0x000001b8,
0x000001cf,
0x000001de,
0x000001e6,
0x000001ec,
0x000001ee,
0x000001f2,
0x000001f6,
0x00000201,
0x00000203,
0x00000223,
0x00000225,
0x00000227,
0x00000229,
0x0000022b,
0x0000022d,
0x00000231,
0x00000235,
0x00000237,
0x0000023b,
0x0000023d,
0x00000241,
0x00000243,
};
static struct {
u32 offset;
void *address;
} EXTERNAL_PATCHES[] __attribute((unused)) = {
};
static u32 INSTRUCTIONS __attribute((unused)) = 301;
static u32 PATCHES __attribute((unused)) = 81;
static u32 EXTERNAL_PATCHES_LEN __attribute((unused)) = 0;
#undef A_NCR53c7xx_msg_abort
#undef A_NCR53c7xx_msg_reject
#undef A_NCR53c7xx_sink
#undef A_NCR53c7xx_zero
#undef A_NOP_insn
#undef A_addr_reconnect_dsa_head
#undef A_addr_scratch
#undef A_addr_temp
#undef A_dmode_memory_to_memory
#undef A_dmode_memory_to_ncr
#undef A_dmode_ncr_to_memory
#undef A_dsa_check_reselect
#undef A_dsa_cmdout
#undef A_dsa_cmnd
#undef A_dsa_datain
#undef A_dsa_dataout
#undef A_dsa_end
#undef A_dsa_fields_start
#undef A_dsa_msgin
#undef A_dsa_msgout
#undef A_dsa_msgout_other
#undef A_dsa_next
#undef A_dsa_restore_pointers
#undef A_dsa_save_data_pointer
#undef A_dsa_select
#undef A_dsa_status
#undef A_dsa_temp_addr_array_value
#undef A_dsa_temp_addr_dsa_value
#undef A_dsa_temp_addr_new_value
#undef A_dsa_temp_addr_next
#undef A_dsa_temp_addr_residual
#undef A_dsa_temp_addr_saved_pointer
#undef A_dsa_temp_addr_saved_residual
#undef A_dsa_temp_lun
#undef A_dsa_temp_next
#undef A_dsa_temp_sync
#undef A_dsa_temp_target
#undef A_int_debug_break
#undef A_int_debug_panic
#undef A_int_err_check_condition
#undef A_int_err_no_phase
#undef A_int_err_selected
#undef A_int_err_unexpected_phase
#undef A_int_err_unexpected_reselect
#undef A_int_msg_1
#undef A_int_msg_sdtr
#undef A_int_msg_wdtr
#undef A_int_norm_aborted
#undef A_int_norm_command_complete
#undef A_int_norm_disconnected
#undef A_int_norm_reselect_complete
#undef A_int_norm_reset
#undef A_int_norm_select_complete
#undef A_int_test_1
#undef A_int_test_2
#undef A_int_test_3
#undef A_msg_buf
#undef A_reconnect_dsa_head
#undef A_reselected_identify
#undef A_reselected_tag
#undef A_schedule
#undef A_test_dest
#undef A_test_src
#undef Ent_accept_message
#undef Ent_cmdout_cmdout
#undef Ent_command_complete
#undef Ent_command_complete_msgin
#undef Ent_data_transfer
#undef Ent_datain_to_jump
#undef Ent_debug_break
#undef Ent_dsa_code_begin
#undef Ent_dsa_code_check_reselect
#undef Ent_dsa_code_fix_jump
#undef Ent_dsa_code_restore_pointers
#undef Ent_dsa_code_save_data_pointer
#undef Ent_dsa_code_template
#undef Ent_dsa_code_template_end
#undef Ent_dsa_schedule
#undef Ent_dsa_zero
#undef Ent_end_data_transfer
#undef Ent_initiator_abort
#undef Ent_msg_in
#undef Ent_msg_in_restart
#undef Ent_other_in
#undef Ent_other_out
#undef Ent_other_transfer
#undef Ent_reject_message
#undef Ent_reselected_check_next
#undef Ent_reselected_ok
#undef Ent_respond_message
#undef Ent_select
#undef Ent_select_msgout
#undef Ent_target_abort
#undef Ent_test_1
#undef Ent_test_2
#undef Ent_test_2_msgout
#undef Ent_wait_reselect
......@@ -1379,24 +1379,16 @@ config SCSI_SEAGATE
# definitely looks note 64bit safe:
config SCSI_SIM710
tristate "Simple 53c710 SCSI support (Compaq, NCR machines)"
depends on (ISA || MCA && !X86_64) && SCSI
depends on (EISA || MCA && !X86_64) && SCSI
---help---
This is a simple driver for NCR53c710 based SCSI host adapters.
This driver for NCR53c710 based SCSI host adapters.
More complex drivers for this chip are available ("NCR53c7,8xx SCSI
support", above), but they require that the scsi chip be able to do
DMA block moves between memory and on-chip registers, which can
cause problems under certain conditions. This driver is designed to
avoid these problems and is intended to work with any Intel machines
using 53c710 chips, including various Compaq and NCR machines.
It currently supports Compaq EISA cards and NCR MCA cards
Please read the comments at the top of the file
<file:drivers/scsi/sim710.c> for more information.
If you want to compile this driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/modules.txt>. The module
will be called sim710.o.
config 53C700_IO_MAPPED
bool
depends on SCSI_SIM710
default y
config SCSI_SYM53C416
tristate "Symbios 53c416 SCSI support"
......
......@@ -43,7 +43,7 @@ obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o
obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o
obj-$(CONFIG_MVME16x_SCSI) += mvme16x.o 53c7xx.o
obj-$(CONFIG_BVME6000_SCSI) += bvme6000.o 53c7xx.o
obj-$(CONFIG_SCSI_SIM710) += sim710.o
obj-$(CONFIG_SCSI_SIM710) += sim710.o 53c700.o
obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o
obj-$(CONFIG_SCSI_PCI2000) += pci2000.o
obj-$(CONFIG_SCSI_PCI2220I) += pci2220i.o
......@@ -78,7 +78,6 @@ obj-$(CONFIG_SCSI_FD_8xx) += seagate.o
obj-$(CONFIG_SCSI_T128) += t128.o
obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o
obj-$(CONFIG_SCSI_DTC3280) += dtc.o
obj-$(CONFIG_SCSI_NCR53C7xx) += 53c7,8xx.o
obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/
obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
obj-$(CONFIG_SCSI_NCR53C8XX) += ncr53c8xx.o
......@@ -139,12 +138,10 @@ cpqfc-objs := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \
cpqfcTSworker.o cpqfcTStrigger.o
# Files generated that shall be removed upon make clean
clean-files := 53c8xx_d.h 53c7xx_d.h sim710_d.h 53c700_d.h \
53c8xx_u.h 53c7xx_u.h sim710_u.h 53c700_u.h
clean-files := 53c7xx_d.h 53c700_d.h \
53c7xx_u.h 53c700_u.h
$(obj)/53c7,8xx.o: $(obj)/53c8xx_d.h $(obj)/53c8xx_u.h
$(obj)/53c7xx.o: $(obj)/53c7xx_d.h $(obj)/53c7xx_u.h
$(obj)/sim710.o: $(obj)/sim710_d.h
$(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h
# If you want to play with the firmware, uncomment
......@@ -152,21 +149,11 @@ $(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h
ifdef GENERATE_FIRMWARE
$(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=810 - < $< | grep -v '^#' | $(PERL) $(src)/script_asm.pl $@ $(@:_d.h=_u.h)
$(obj)/53c8xx_u.h: $(obj)/53c8xx_d.h
$(obj)/53c7xx_d.h: $(src)/53c7xx.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
$(obj)/53c7xx_u.h: $(obj)/53c7xx_d.h
$(obj)/sim710_d.h: $(src)/sim710.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
$(obj)/sim710_u.h: $(obj)/sim710_d.h
$(obj)/53c700_d.h: $(src)/53c700.scr $(src)/script_asm.pl
$(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $<
......
......@@ -2510,13 +2510,16 @@ static void adpt_fail_posted_scbs(adpt_hba* pHba)
Scsi_Device* d = NULL;
list_for_each_entry(d, &pHba->host->my_devices, siblings) {
for(cmd = d->device_queue; cmd ; cmd = cmd->next){
unsigned long flags;
spin_lock_irqsave(&d->list_lock, flags);
list_for_each_entry(cmd, &d->cmd_list, list) {
if(cmd->serial_number == 0){
continue;
}
cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
cmd->scsi_done(cmd);
}
spin_unlock_irqrestore(&d->list_lock, flags);
}
}
......
......@@ -205,13 +205,15 @@ static int scsi_check_device_busy(struct scsi_device *sdev)
{
struct Scsi_Host *shost = sdev->host;
struct scsi_cmnd *scmd;
unsigned long flags;
/*
* Loop over all of the commands associated with the
* device. If any of them are busy, then set the state
* back to inactive and bail.
*/
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
spin_lock_irqsave(&sdev->list_lock, flags);
list_for_each_entry(scmd, &sdev->cmd_list, list) {
if (scmd->request && scmd->request->rq_status != RQ_INACTIVE)
goto active;
......@@ -223,6 +225,7 @@ static int scsi_check_device_busy(struct scsi_device *sdev)
if (scmd->request)
scmd->request->rq_status = RQ_SCSI_DISCONNECTING;
}
spin_unlock_irqrestore(&sdev->list_lock, flags);
return 0;
......@@ -233,12 +236,13 @@ static int scsi_check_device_busy(struct scsi_device *sdev)
scmd->pid, scmd->state, scmd->owner);
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
list_for_each_entry(scmd, &sdev->cmd_list, list) {
if (scmd->request->rq_status == RQ_SCSI_DISCONNECTING)
scmd->request->rq_status = RQ_INACTIVE;
}
}
spin_unlock_irqrestore(&sdev->list_lock, flags);
printk(KERN_ERR "Device busy???\n");
return 1;
}
......
......@@ -403,12 +403,17 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask)
struct scsi_cmnd *cmd = __scsi_get_command(dev->host, gfp_mask);
if (likely(cmd != NULL)) {
unsigned long flags;
memset(cmd, 0, sizeof(*cmd));
cmd->device = dev;
cmd->state = SCSI_STATE_UNUSED;
cmd->owner = SCSI_OWNER_NOBODY;
init_timer(&cmd->eh_timeout);
INIT_LIST_HEAD(&cmd->list);
spin_lock_irqsave(&dev->list_lock, flags);
list_add_tail(&cmd->list, &dev->cmd_list);
spin_unlock_irqrestore(&dev->list_lock, flags);
}
return cmd;
......@@ -430,7 +435,13 @@ void scsi_put_command(struct scsi_cmnd *cmd)
struct Scsi_Host *shost = cmd->device->host;
unsigned long flags;
spin_lock_irqsave(&shost->free_list_lock, flags);
/* serious error if the command hasn't come from a device list */
spin_lock_irqsave(&cmd->device->list_lock, flags);
BUG_ON(list_empty(&cmd->list));
list_del_init(&cmd->list);
spin_unlock(&cmd->device->list_lock);
/* changing locks here, don't need to restore the irq state */
spin_lock(&shost->free_list_lock);
if (unlikely(list_empty(&shost->free_list))) {
list_add(&cmd->list, &shost->free_list);
cmd = NULL;
......
......@@ -571,9 +571,8 @@ struct scsi_device {
struct Scsi_Host *host;
request_queue_t *request_queue;
volatile unsigned short device_busy; /* commands actually active on low-level */
struct list_head free_cmnds; /* list of available Scsi_Cmnd structs */
struct list_head busy_cmnds; /* list of Scsi_Cmnd structs in use */
Scsi_Cmnd *device_queue; /* queue of SCSI Command structures */
spinlock_t list_lock;
struct list_head cmd_list; /* queue of in use SCSI Command structures */
Scsi_Cmnd *current_cmnd; /* currently active command */
unsigned short queue_depth; /* How deep of a queue we want */
unsigned short last_queue_full_depth; /* These two are used by */
......@@ -724,7 +723,6 @@ struct scsi_cmnd {
unsigned short state;
unsigned short owner;
Scsi_Request *sc_request;
struct scsi_cmnd *next;
struct scsi_cmnd *reset_chain;
struct list_head list; /* scsi_cmnd participates in queue lists */
......
......@@ -233,7 +233,10 @@ static void scsi_eh_get_failed(Scsi_Cmnd **sc_list, struct Scsi_Host *shost)
found = 0;
list_for_each_entry(sdev, &shost->my_devices, siblings) {
for (scmd = sdev->device_queue; scmd; scmd = scmd->next) {
unsigned long flags;
spin_lock_irqsave(&sdev->list_lock, flags);
list_for_each_entry(scmd, &sdev->cmd_list, list) {
if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)) {
scmd->bh_next = *sc_list;
*sc_list = scmd;
......@@ -266,6 +269,7 @@ static void scsi_eh_get_failed(Scsi_Cmnd **sc_list, struct Scsi_Host *shost)
}
}
}
spin_unlock_irqrestore(&sdev->list_lock, flags);
}
SCSI_LOG_ERROR_RECOVERY(1, scsi_eh_prt_fail_stats(*sc_list, shost));
......@@ -1739,25 +1743,13 @@ scsi_reset_provider_done_command(Scsi_Cmnd *SCpnt)
int
scsi_reset_provider(Scsi_Device *dev, int flag)
{
struct scsi_cmnd SC, *SCpnt = &SC;
struct scsi_cmnd *SCpnt = scsi_get_command(dev, GFP_KERNEL);
struct request req;
int rtn;
SCpnt->request = &req;
memset(&SCpnt->eh_timeout, 0, sizeof(SCpnt->eh_timeout));
SCpnt->device = dev;
SCpnt->request->rq_status = RQ_SCSI_BUSY;
SCpnt->request->waiting = NULL;
SCpnt->use_sg = 0;
SCpnt->old_use_sg = 0;
SCpnt->old_cmd_len = 0;
SCpnt->underflow = 0;
SCpnt->transfersize = 0;
SCpnt->resid = 0;
SCpnt->serial_number = 0;
SCpnt->serial_number_at_timeout = 0;
SCpnt->host_scribble = NULL;
SCpnt->next = NULL;
SCpnt->state = SCSI_STATE_INITIALIZING;
SCpnt->owner = SCSI_OWNER_MIDLEVEL;
......@@ -1790,5 +1782,6 @@ scsi_reset_provider(Scsi_Device *dev, int flag)
rtn = scsi_new_reset(SCpnt, flag);
scsi_delete_timer(SCpnt);
scsi_put_command(SCpnt);
return rtn;
}
......@@ -359,7 +359,10 @@ static void scsi_dump_status(int level)
printk(KERN_INFO "h:c:t:l (dev sect nsect cnumsec sg) "
"(ret all flg) (to/cmd to ito) cmd snse result\n");
list_for_each_entry(SDpnt, &shpnt->my_devices, siblings) {
for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) {
unsigned long flags;
spin_lock_irqsave(&SDpnt->list_lock, flags);
list_for_each_entry(SCpnt, &SDpnt->cmd_list, list) {
/* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */
printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4llu %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n",
i++,
......@@ -389,6 +392,7 @@ static void scsi_dump_status(int level)
SCpnt->sense_buffer[2],
SCpnt->result);
}
spin_unlock_irqrestore(&SDpnt->list_lock, flags);
}
}
}
......
......@@ -449,6 +449,8 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
sdev->online = TRUE;
INIT_LIST_HEAD(&sdev->siblings);
INIT_LIST_HEAD(&sdev->same_target_siblings);
INIT_LIST_HEAD(&sdev->cmd_list);
spin_lock_init(&sdev->list_lock);
/*
* Some low level driver could use device->type
*/
......
......@@ -22,96 +22,41 @@
* Some multiboard fixes from Rolf Eike Beer.
* Auto probing of EISA config space from Trevor Hemsley.
*
* Various bits of code in this driver have been copied from 53c7,8xx,c,
* which is coyright Drew Eckhardt. The scripts for the SCSI chip are
* compiled with the script compiler written by Drew.
*
* This is a simple driver for the NCR53c710. More complex drivers
* for this chip (e.g. 53c7xx.c) require that the scsi chip be able to
* do DMA block moves between memory and on-chip registers, which can
* be a problem if those registers are in the I/O address space. There
* can also be problems on hardware where the registers are memory
* mapped, if the design is such that memory-to-memory transfers initiated
* by the scsi chip cannot access the chip registers.
*
* This driver is designed to avoid these problems and is intended to
* work with any Intel machines using 53c710 chips, including various
* Compaq and NCR machines. It was initially written for the Tadpole
* TP34V VME board which is 68030 based.
*
* The driver supports boot-time parameters similar to
* sim710=addr:0x9000,irq:15
* and insmod parameters similar to
* sim710="addr:0x9000 irq:15"
*
* Multiple controllers can also be set up by command line, provided the
* addr: parameter is specified first for each controller. e.g.
* sim710="addr:0x9000 irq:15 addr:0x8000 irq:14"
*
* To separate the different options, ' ', '+', and ',' can be used, except
* that ',' can not be used in module parameters. ' ' can be a pain, because
* it needs to be quoted, which causes problems with some installers.
* The command line above is completely equivalent to
* sim710="addr:0x9000+irq:15+addr:0x8000+irq:14"
*
* The complete list of options are:
*
* addr:0x9000 Specifies the base I/O port (or address) of the 53C710.
* irq:15 Specifies the IRQ number used by the 53c710.
* debug:0xffff Generates lots of debug output.
* ignore:0x0a Makes the driver ignore SCSI IDs 0 and 2.
* nodisc:0x70 Prevents disconnects from IDs 6, 5 and 4.
* noneg:0x10 Prevents SDTR negotiation on ID 4.
* disabled:1 Completely disables the driver. When present, overrides
* all other options.
*
* The driver will auto-probe chip addresses and IRQs now, so typically no
* parameters are needed. Auto-probing of addresses is disabled if any addr:
* parameters are specified.
*
* Current limitations:
*
* o Async only
* o Severely lacking in error recovery
* o 'debug:' should be per host really.
* Rewritten to use 53c700.c by James.Bottomley@SteelEye.com
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/blk.h>
#include <linux/device.h>
#include <linux/init.h>
#ifdef CONFIG_MCA
#include <linux/mca.h>
#include <linux/interrupt.h>
#include <asm/dma.h>
#include <asm/system.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/byteorder.h>
#include <linux/blk.h>
#endif
#ifdef CONFIG_EISA
#include <linux/eisa.h>
#endif
/* All targets are I/O mapped at the moment */
#define IO_MAPPED
#include "scsi.h"
#include "hosts.h"
#include "53c700.h"
#if defined(CONFIG_MCA)
/* Must be enough for both EISA and MCA */
#define MAX_SLOTS 8
static __u8 __initdata id_array[MAX_SLOTS] = { [0 ... MAX_SLOTS-1] = 7 };
/*
* For each known microchannel card using the 53c710 we need a list
* of possible IRQ and IO settings, as well as their corresponding
* bit assignment in pos[]. This might get cumbersome if there
* are more than a few cards (I only know of 2 at this point).
*/
/* info is used to communicate global data across the driver register
* because the struct device_driver doesn't have any info fields. Sigh */
struct sim710_info {
Scsi_Host_Template *tpnt;
int found;
};
static __initdata struct sim710_info sim710_global_info;
#define MCA_53C710_IDS { 0x01bb, 0x01ba, 0x004f }
#if defined(CONFIG_MCA)
/* CARD ID 01BB and 01BA use the same pos values */
......@@ -130,63 +75,6 @@
#endif
#include "scsi.h"
#include "hosts.h"
#include "sim710.h"
#include<linux/stat.h>
#define DEBUG
#undef DEBUG_LIMIT_INTS /* Define to 10 to hang driver after 10 ints */
/* Debug options available via the "debug:0x1234" parameter */
#define DEB_NONE 0x0000 /* Nothing */
#define DEB_HALT 0x0001 /* Detailed trace of chip halt funtion */
#define DEB_REGS 0x0002 /* All chip register read/writes */
#define DEB_SYNC 0x0004 /* Sync/async negotiation */
#define DEB_PMM 0x0008 /* Phase mis-match handling */
#define DEB_INTS 0x0010 /* General interrupt trace */
#define DEB_TOUT 0x0020 /* Selection timeouts */
#define DEB_RESUME 0x0040 /* Resume addresses for the script */
#define DEB_CMND 0x0080 /* Commands and status returned */
#define DEB_FIXUP 0x0100 /* Fixup of scsi addresses */
#define DEB_DISC 0x0200 /* Disconnect/reselect handling */
#define DEB_ANY 0xffff /* Any and all debug options */
#ifdef DEBUG
#define DEB(m,x) if (sim710_debug & m) x
int sim710_debug;
#else
#define DEB(m,x)
#endif
/* Redefine scsi_done to force renegotiation of (a)sync transfers
* following any failed command.
*/
#define SCSI_DONE(cmd) { \
DEB(DEB_CMND, printk("scsi%d: Complete %08x\n", \
host->host_no, cmd->result)); \
if (cmd->result) \
hostdata->negotiate |= (1 << cmd->target); \
cmd->scsi_done(cmd); \
}
#ifndef offsetof
#define offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif
#define STATE_INITIALISED 0
#define STATE_HALTED 1
#define STATE_IDLE 2
#define STATE_BUSY 3
#define STATE_DISABLED 4
#define MAXBOARDS 4 /* Increase this and the sizes of the
arrays below, if you need more.. */
#ifdef MODULE
char *sim710; /* command line passed by insmod */
......@@ -199,194 +87,34 @@ MODULE_PARM(sim710, "s");
#endif
static int sim710_errors; /* Count of error interrupts */
static int sim710_intrs; /* Count of all interrupts */
static int ignore_ids[MAXBOARDS]; /* Accept all SCSI IDs */
static int opt_nodisc[MAXBOARDS]; /* Allow disconnect on all IDs */
static int opt_noneg[MAXBOARDS]; /* Allow SDTR negotiation on all IDs */
static int hostdata_order; /* Encoded size of hostdata for free_pages() */
static int no_of_boards; /* Actual number of boards/chips */
static unsigned int bases[MAXBOARDS]; /* Base addresses of chips */
static unsigned int irq_vectors[MAXBOARDS]; /* IRQ vectors used by chips */
/* The SCSI Script!!! */
#include "sim710_d.h"
/* Now define offsets in the DSA, as (A_dsa_xxx/4) */
#define DSA_SELECT (A_dsa_select/4)
#define DSA_MSGOUT (A_dsa_msgout/4)
#define DSA_CMND (A_dsa_cmnd/4)
#define DSA_STATUS (A_dsa_status/4)
#define DSA_MSGIN (A_dsa_msgin/4)
#define DSA_DATAIN (A_dsa_datain/4)
#define DSA_DATAOUT (A_dsa_dataout/4)
#define DSA_SIZE (A_dsa_size/4)
#define MAX_SG 128 /* Scatter/Gather elements */
#define MAX_MSGOUT 8
#define MAX_MSGIN 8
#define MAX_CMND 12
#define MAX_STATUS 1
struct sim710_hostdata{
int state;
Scsi_Cmnd * issue_queue;
Scsi_Cmnd * running;
int chip;
u8 negotiate;
u8 reselected_identify;
u8 msgin_buf[MAX_MSGIN];
u8 msg_reject;
u32 test1_src __attribute__ ((aligned (4)));
u32 test1_dst;
struct sim710_target {
Scsi_Cmnd *cur_cmd;
u32 resume_offset;
u32 data_in_jump;
u32 data_out_jump;
u32 dsa[DSA_SIZE]; /* SCSI Script DSA area */
u8 dsa_msgout[MAX_MSGOUT];
u8 dsa_msgin[MAX_MSGIN];
u8 dsa_cdb[MAX_CMND];
u8 dsa_status[MAX_STATUS];
} target[8];
u32 script[sizeof(SCRIPT)/4] __attribute__ ((aligned (4)));
};
/* Template to request asynchronous transfers */
static const unsigned char async_message[] = {
EXTENDED_MESSAGE, 3 /* length */, EXTENDED_SDTR, 0, 0 /* asynchronous */};
static void sim710_intr_handle(int irq, void *dev_id, struct pt_regs *regs);
static void do_sim710_intr_handle(int irq, void *dev_id, struct pt_regs *regs);
static __inline__ void run_process_issue_queue(struct sim710_hostdata *);
static void process_issue_queue (struct sim710_hostdata *, unsigned long flags);
static int full_reset(struct Scsi_Host * host);
/*
* Function : static void ncr_dump (struct Scsi_Host *host)
*
* Purpose : Dump (possibly) useful info
*
* Inputs : host - pointer to this host adapter's structure
*/
static void
ncr_dump (struct Scsi_Host *host)
{
unsigned long flags;
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)
host->hostdata[0];
save_flags(flags);
cli();
printk("scsi%d: Chip register contents:\n", host->host_no);
printk(" (script at virt %p, bus %lx)\n",
hostdata->script, virt_to_bus(hostdata->script));
printk(" 00 sien: %02x sdid: %02x scntl1:%02x scntl0:%02x\n"
" 04 socl: %02x sodl: %02x sxfer: %02x scid: %02x\n"
" 08 sbcl: %02x sbdl: %02x sidl: %02x sfbr: %02x\n"
" 0C sstat2:%02x sstat1:%02x sstat0:%02x dstat: %02x\n"
" 10 dsa: %08x\n"
" 14 ctest3:%02x ctest2:%02x ctest1:%02x ctest0:%02x\n"
" 18 ctest7:%02x ctest6:%02x ctest5:%02x ctest4:%02x\n"
" 1C temp: %08x\n"
" 20 lcrc: %02x ctest8:%02x istat: %02x dfifo: %02x\n"
" 24 dbc: %08x dnad: %08x dsp: %08x\n"
" 30 dsps: %08x scratch:%08x\n"
" 38 dcntl: %02x dwt: %02x dien: %02x dmode: %02x\n"
" 3C adder: %08x\n",
NCR_read8(SIEN_REG), NCR_read8(SDID_REG), NCR_read8(SCNTL1_REG),
NCR_read8(SCNTL0_REG), NCR_read8(SOCL_REG), NCR_read8(SODL_REG),
NCR_read8(SXFER_REG), NCR_read8(SCID_REG), NCR_read8(SBCL_REG),
NCR_read8(SBDL_REG), NCR_read8(SIDL_REG), NCR_read8(SFBR_REG),
NCR_read8(SSTAT2_REG), NCR_read8(SSTAT1_REG), NCR_read8(SSTAT0_REG),
NCR_read8(DSTAT_REG), NCR_read32(DSA_REG), NCR_read8(CTEST3_REG),
NCR_read8(CTEST2_REG), NCR_read8(CTEST1_REG), NCR_read8(CTEST0_REG),
NCR_read8(CTEST7_REG), NCR_read8(CTEST6_REG), NCR_read8(CTEST5_REG),
NCR_read8(CTEST4_REG), NCR_read8(TEMP_REG), NCR_read8(LCRC_REG),
NCR_read8(CTEST8_REG), NCR_read8(ISTAT_REG), NCR_read8(DFIFO_REG),
NCR_read32(DBC_REG), NCR_read32(DNAD_REG), NCR_read32(DSP_REG),
NCR_read32(DSPS_REG), NCR_read32(SCRATCH_REG), NCR_read8(DCNTL_REG),
NCR_read8(DWT_REG), NCR_read8(DIEN_REG), NCR_read8(DMODE_REG),
NCR_read32(ADDER_REG));
restore_flags(flags);
}
/*
* Function: int param_setup(char *str)
*/
#ifdef MODULE
#define ARG_SEP ' '
#else
#define ARG_SEP ','
#endif
__init int
param_setup(char *str)
{
char *cur = str;
char *p, *pc, *pv;
int val;
int c;
no_of_boards = 0;
while (no_of_boards < MAXBOARDS && cur != NULL &&
(pc = strchr(cur, ':')) != NULL) {
char *pe;
val = 0;
pv = pc;
c = *++pv;
val = (int) simple_strtoul(pv, &pe, 0);
if (!strncmp(cur, "addr:", 5)) {
bases[no_of_boards++] = val;
}
#ifdef DEBUG
else if (!strncmp(cur, "debug:", 6)) {
sim710_debug = val;
}
#endif
else if (no_of_boards == 0) {
printk("sim710: Invalid parameters, addr: must come first\n");
no_of_boards = -1;
return 1;
}
else if (!strncmp(cur, "irq:", 4))
irq_vectors[no_of_boards-1] = val;
else if (!strncmp(cur, "ignore:", 7))
ignore_ids[no_of_boards-1] = val;
else if (!strncmp(cur, "nodisc:", 7))
opt_nodisc[no_of_boards-1] = val;
else if (!strncmp(cur, "noneg:", 6))
opt_noneg[no_of_boards-1] = val;
else if (!strncmp(cur, "disabled:", 9)) {
no_of_boards = -1;
return 1;
char *pos = str, *next;
int slot = -1;
while(pos != NULL && (next = strchr(pos, ':')) != NULL) {
int val = (int)simple_strtoul(++next, NULL, 0);
if(!strncmp(pos, "slot:", 5))
slot = val;
else if(!strncmp(pos, "id:", 3)) {
if(slot == -1) {
printk(KERN_WARNING "sim710: Must specify slot for id parameter\n");
} else if(slot > MAX_SLOTS) {
printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val);
} else {
id_array[slot] = val;
}
else {
printk("sim710: unexpected boot option '%.*s'\n", (int)(pc-cur+1), cur);
no_of_boards = -1;
return 1;
}
/* Allow ',', ' ', or '+' separators. Used to be ',' at boot and
* ' ' for module load, some installers crap out on the space and
* insmod doesn't like the comma.
*/
if ((p = strchr(cur, ',')) || (p = strchr(cur, ' ')) ||
(p = strchr(cur, '+')))
cur = p + 1;
else
break;
if((pos = strchr(pos, ARG_SEP)) != NULL)
pos++;
}
return 1;
}
......@@ -395,1009 +123,90 @@ param_setup(char *str)
__setup("sim710=", param_setup);
#endif
/*
* Function: static const char *sbcl_to_phase (int sbcl)
*/
static const char *
sbcl_to_phase (int sbcl) {
switch (sbcl & SBCL_PHASE_MASK) {
case SBCL_PHASE_DATAIN:
return "DATAIN";
case SBCL_PHASE_DATAOUT:
return "DATAOUT";
case SBCL_PHASE_MSGIN:
return "MSGIN";
case SBCL_PHASE_MSGOUT:
return "MSGOUT";
case SBCL_PHASE_CMDOUT:
return "CMDOUT";
case SBCL_PHASE_STATIN:
return "STATUSIN";
default:
return "unknown";
}
}
/*
* Function : static int ncr_halt (struct Scsi_Host *host)
*
* Purpose : halts the SCSI SCRIPTS(tm) processor on the NCR chip
*
* Inputs : host - SCSI chip to halt
*
* Returns : 0 on success
*/
static int
ncr_halt (struct Scsi_Host *host)
{
unsigned long flags;
unsigned char istat, tmp;
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)
host->hostdata[0];
int stage;
int timeout;
int res = 0;
save_flags(flags);
cli();
/* Stage 0 : eat all interrupts
Stage 1 : set ABORT
Stage 2 : eat all but abort interrupts
Stage 3 : eat all interrupts
We loop for 50000 times with a delay of 10us which should give us
about half a second.
*/
for (stage = 0, timeout = 50000; timeout; timeout--) {
if (stage == 1) {
DEB(DEB_HALT, printk("ncr_halt: writing ISTAT_ABRT\n"));
NCR_write8(ISTAT_REG, ISTAT_ABRT);
++stage;
}
istat = NCR_read8 (ISTAT_REG);
if (istat & ISTAT_SIP) {
DEB(DEB_HALT, printk("ncr_halt: got ISTAT_SIP, istat=%02x\n", istat));
tmp = NCR_read8(SSTAT0_REG);
DEB(DEB_HALT, printk("ncr_halt: got SSTAT0_REG=%02x\n", tmp));
} else if (istat & ISTAT_DIP) {
DEB(DEB_HALT, printk("ncr_halt: got ISTAT_DIP, istat=%02x\n", istat));
tmp = NCR_read8(DSTAT_REG);
DEB(DEB_HALT, printk("ncr_halt: got DSTAT_REG=%02x\n", tmp));
if (stage == 2) {
if (tmp & DSTAT_ABRT) {
DEB(DEB_HALT, printk("ncr_halt: got DSTAT_ABRT, clearing istat\n"));
NCR_write8(ISTAT_REG, 0);
++stage;
} else {
res = 1;
break;
}
}
}
if (!(istat & (ISTAT_SIP|ISTAT_DIP))) {
if (stage == 0)
++stage;
else if (stage == 3)
break;
}
udelay(10);
}
restore_flags(flags);
if (timeout == 0 || res) {
printk(KERN_ALERT "scsi%d: could not halt NCR chip\n", host->host_no);
return 1;
}
else {
hostdata->state = STATE_HALTED;
return 0;
}
}
/*
* Function : static void sim710_soft_reset (struct Scsi_Host *host)
*
* Purpose : perform a soft reset of the NCR53c7xx chip
*
* Inputs : host - pointer to this host adapter's structure
*
* Preconditions : sim710_init must have been called for this
* host.
*
*/
static void
sim710_soft_reset (struct Scsi_Host *host)
{
unsigned long flags;
save_flags(flags);
cli();
/*
* Do a soft reset of the chip so that everything is
* reinitialized to the power-on state.
*
* Basically follow the procedure outlined in the NCR53c700
* data manual under Chapter Six, How to Use, Steps Necessary to
* Start SCRIPTS, with the exception of actually starting the
* script and setting up the synchronous transfer gunk.
*/
/* XXX Should we reset the scsi bus here? */
NCR_write8(SCNTL1_REG, SCNTL1_RST); /* Reset the bus */
udelay(50);
NCR_write8(SCNTL1_REG, 0);
udelay(500);
NCR_write8(ISTAT_REG, ISTAT_10_SRST); /* Reset the chip */
udelay(50);
NCR_write8(ISTAT_REG, 0);
mdelay(1000); /* Let devices recover */
NCR_write32(SCRATCH_REG, 0);
NCR_write8(DCNTL_REG, DCNTL_10_COM | DCNTL_700_CF_3);
NCR_write8(CTEST7_REG, CTEST7_10_CDIS|CTEST7_STD);
NCR_write8(DMODE_REG, DMODE_10_BL_8 | DMODE_10_FC2);
NCR_write8(SCID_REG, 1 << host->this_id);
NCR_write8(SBCL_REG, 0);
NCR_write8(SXFER_REG, 0);
NCR_write8(SCNTL1_REG, SCNTL1_ESR_700);
NCR_write8(SCNTL0_REG, SCNTL0_EPC | SCNTL0_EPG_700 | SCNTL0_ARB1 |
SCNTL0_ARB2);
NCR_write8(DIEN_REG, DIEN_700_BF |
DIEN_ABRT | DIEN_SSI | DIEN_SIR | DIEN_700_OPC);
NCR_write8(SIEN_REG_700,
SIEN_PAR | SIEN_700_STO | SIEN_RST | SIEN_UDC | SIEN_SGE | SIEN_MA);
restore_flags(flags);
}
/*
* Function : static void sim710_driver_init (struct Scsi_Host *host)
*
* Purpose : Initialize internal structures, as required on startup, or
* after a SCSI bus reset.
*
* Inputs : host - pointer to this host adapter's structure
*/
static void
sim710_driver_init (struct Scsi_Host *host)
{
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)
host->hostdata[0];
int i;
hostdata->running = NULL;
memcpy (hostdata->script, SCRIPT, sizeof(SCRIPT));
for (i = 0; i < PATCHES; i++)
hostdata->script[LABELPATCHES[i]] += isa_virt_to_bus(hostdata->script);
patch_abs_32 (hostdata->script, 0, reselected_identify,
isa_virt_to_bus((void *)&(hostdata->reselected_identify)));
patch_abs_32 (hostdata->script, 0, msgin_buf,
isa_virt_to_bus((void *)&(hostdata->msgin_buf[0])));
patch_abs_32 (hostdata->script, 0, msg_reject,
isa_virt_to_bus((void *)&(hostdata->msg_reject)));
patch_abs_32 (hostdata->script, 0, test1_src,
isa_virt_to_bus((void *)&(hostdata->test1_src)));
patch_abs_32 (hostdata->script, 0, test1_dst,
isa_virt_to_bus((void *)&(hostdata->test1_dst)));
hostdata->state = STATE_INITIALISED;
hostdata->negotiate = 0xff;
}
/* Handle incoming Synchronous data transfer request. If our negotiate
* flag is set then this is a response to our request, otherwise it is
* spurious request from the target. Don't really expect target initiated
* SDTRs, because we always negotiate on the first command. Could still
* get them though..
* The chip is currently paused with ACK asserted on the last byte of the
* SDTR.
* resa is the resume address if the message is in response to our outgoing
* SDTR. Only possible on initial identify.
* resb is the resume address if the message exchange is initiated by the
* target.
*/
static u32
handle_sdtr (struct Scsi_Host * host, Scsi_Cmnd * cmd, u32 resa, u32 resb)
{
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)host->hostdata[0];
struct sim710_target *targdata = hostdata->target + cmd->target;
u32 resume_offset;
if (resa && hostdata->negotiate & (1 << cmd->target)) {
DEB(DEB_SYNC, printk("scsi%d: Response to host SDTR = %02x %02x\n",
host->host_no, hostdata->msgin_buf[3], hostdata->msgin_buf[4]));
/* We always issue an SDTR with the identify, so we must issue
* the CDB next.
*/
resume_offset = resa;
hostdata->negotiate &= ~(1 << cmd->target);
}
else {
DEB(DEB_SYNC, printk("scsi%d: Target initiated SDTR = %02x %02x\n",
host->host_no, hostdata->msgin_buf[3], hostdata->msgin_buf[4]));
memcpy(targdata->dsa_msgout, async_message, sizeof(async_message));
targdata->dsa[DSA_MSGOUT] = sizeof(async_message);
/* I guess the target could do this anytime; we have to send our
* response, and then continue (sending the CDB if not already done).
*/
resume_offset = resb;
}
return resume_offset;
}
/*
* Function : static int datapath_residual (Scsi_Host *host)
*
* Purpose : return residual data count of what's in the chip.
*
* Inputs : host - SCSI host
*/
static int
datapath_residual (struct Scsi_Host *host) {
int count, synchronous, sstat;
unsigned int ddir;
count = ((NCR_read8 (DFIFO_REG) & DFIFO_10_BO_MASK) -
(NCR_read32 (DBC_REG) & DFIFO_10_BO_MASK)) & DFIFO_10_BO_MASK;
synchronous = NCR_read8 (SXFER_REG) & SXFER_MO_MASK;
ddir = NCR_read8 (CTEST0_REG_700) & CTEST0_700_DDIR;
if (ddir) {
/* Receive */
if (synchronous)
count += (NCR_read8 (SSTAT2_REG) & SSTAT2_FF_MASK) >> SSTAT2_FF_SHIFT;
else
if (NCR_read8 (SSTAT1_REG) & SSTAT1_ILF)
++count;
} else {
/* Send */
sstat = NCR_read8 (SSTAT1_REG);
if (sstat & SSTAT1_OLF)
++count;
if (synchronous && (sstat & SSTAT1_ORF))
++count;
}
return count;
}
static u32
handle_idd (struct Scsi_Host * host, Scsi_Cmnd * cmd)
{
struct sim710_hostdata *hostdata =
(struct sim710_hostdata *)host->hostdata[0];
struct sim710_target *targdata = hostdata->target + cmd->target;
u32 resume_offset = 0, index;
index = (u32)((u32 *)(isa_bus_to_virt(NCR_read32(DSP_REG))) - hostdata->script);
switch (index) {
case Ent_wait_disc_complete/4 + 2:
cmd->result = targdata->dsa_status[0];
SCSI_DONE(cmd);
targdata->cur_cmd = NULL;
resume_offset = Ent_reselect;
break;
case Ent_wait_disc2/4 + 2:
/* Disconnect after command - just wait for a reselect */
targdata->resume_offset = Ent_resume_msgin2a;
resume_offset = Ent_reselect;
break;
case Ent_wait_disc3/4 + 2:
/* Disconnect after the data phase */
targdata->resume_offset = Ent_resume_msgin3a;
resume_offset = Ent_reselect;
break;
case Ent_wait_disc1/4 + 2:
/* Disconnect before command - not expected */
targdata->resume_offset = Ent_resume_msgin1a;
resume_offset = Ent_reselect;
break;
default:
printk("scsi%d: Unexpected Illegal Instruction, script[%04x]\n",
host->host_no, index);
sim710_errors++;
/* resume_offset is zero, which will cause host reset */
}
return resume_offset;
}
/* Handle a phase mismatch.
*/
static u32
handle_phase_mismatch (struct Scsi_Host * host, Scsi_Cmnd * cmd)
{
struct sim710_hostdata *hostdata =
(struct sim710_hostdata *)host->hostdata[0];
struct sim710_target *targdata = hostdata->target + cmd->target;
u32 resume_offset = 0, index;
unsigned char sbcl;
sbcl = NCR_read8(SBCL_REG) & SBCL_PHASE_MASK;
index = (u32)((u32 *)(isa_bus_to_virt(NCR_read32(DSP_REG))) - hostdata->script);
DEB(DEB_PMM, printk("scsi%d: Phase mismatch, phase %s (%x) at script[0x%x]\n",
host->host_no, sbcl_to_phase(sbcl), sbcl, index));
DEB(DEB_PMM, print_command(cmd->cmnd));
if (index == Ent_done_ident/4) {
/* Sending initial message out - probably rejecting our sync
* negotiation request.
*/
NCR_write8(SOCL_REG, 0); /* Negate ATN */
if (sbcl == SBCL_PHASE_MSGIN)
resume_offset = Ent_resume_rej_ident;
else if (sbcl == SBCL_PHASE_CMDOUT) {
/* Some old devices (SQ555) switch to cmdout after the first
* byte of an identify message, regardless of whether we
* have more bytes to send!
*/
printk("scsi%d: Unexpected switch to CMDOUT during IDENTIFY\n",
host->host_no);
resume_offset = Ent_resume_cmd;
}
else if (sbcl == SBCL_PHASE_STATIN) {
/* Some devices do this on parity error, at least */
printk("scsi%d: Unexpected switch to STATUSIN on initial message out\n",
host->host_no);
resume_offset = Ent_end_data_trans;
}
else {
printk("scsi%d: Unexpected phase change to %s on initial msgout\n",
host->host_no, sbcl_to_phase(sbcl));
/* resume_offset is zero, which will cause a host reset */
}
hostdata->negotiate &= ~(1 << cmd->target);
}
else if (index > Ent_patch_input_data/4 &&
index < Ent_patch_output_data/4) {
/* DataIn transfer phase */
u32 sg_id, oaddr, olen, naddr, nlen;
int residual;
sg_id = (index - Ent_patch_input_data/4 - 4) / 2;
targdata->data_in_jump = hostdata->script[Ent_patch_input_data/4+1] =
isa_virt_to_bus(hostdata->script + Ent_patch_input_data/4 + sg_id * 2 + 2);
olen = targdata->dsa[DSA_DATAIN + sg_id * 2];
oaddr = targdata->dsa[DSA_DATAIN + sg_id * 2 + 1];
residual = datapath_residual (host);
if (residual)
printk("scsi%d: Residual count %d on DataIn - NOT expected!!!",
host->host_no, residual);
naddr = NCR_read32(DNAD_REG) - residual;
nlen = (NCR_read32(DBC_REG) & 0x00ffffff) + residual;
DEB(DEB_PMM, printk("scsi%d: DIN sg %d, old %08x/%08x, new %08x/%08x (%d)\n",
host->host_no, sg_id, oaddr, olen, naddr, nlen, residual));
if (oaddr+olen != naddr+nlen) {
printk("scsi%d: PMM DIN counts error: 0x%x + 0x%x != 0x%x + 0x%x",
host->host_no, oaddr, olen, naddr, nlen);
}
else {
targdata->dsa[DSA_DATAIN + sg_id * 2] = nlen;
targdata->dsa[DSA_DATAIN + sg_id * 2 + 1] = naddr;
resume_offset = Ent_resume_pmm;
}
}
else if (index > Ent_patch_output_data/4 &&
index <= Ent_end_data_trans/4) {
/* Dataout transfer phase */
u32 sg_id, oaddr, olen, naddr, nlen;
int residual;
sg_id = (index - Ent_patch_output_data/4 - 4) / 2;
targdata->data_out_jump = hostdata->script[Ent_patch_output_data/4+1] =
isa_virt_to_bus(hostdata->script + Ent_patch_output_data/4 + sg_id * 2 + 2);
olen = targdata->dsa[DSA_DATAOUT + sg_id * 2];
oaddr = targdata->dsa[DSA_DATAOUT + sg_id * 2 + 1];
residual = datapath_residual (host);
naddr = NCR_read32(DNAD_REG) - residual;
nlen = (NCR_read32(DBC_REG) & 0x00ffffff) + residual;
DEB(DEB_PMM, printk("scsi%d: DOUT sg %d, old %08x/%08x, new %08x/%08x (%d)\n",
host->host_no, sg_id, oaddr, olen, naddr, nlen, residual));
if (oaddr+olen != naddr+nlen) {
printk("scsi%d: PMM DOUT counts error: 0x%x + 0x%x != 0x%x + 0x%x",
host->host_no, oaddr, olen, naddr, nlen);
}
else {
targdata->dsa[DSA_DATAOUT + sg_id * 2] = nlen;
targdata->dsa[DSA_DATAOUT + sg_id * 2 + 1] = naddr;
resume_offset = Ent_resume_pmm;
}
}
else if (sbcl == SBCL_PHASE_STATIN) {
/* Change to Status In at some random point; probably wants to report a
* parity error or similar.
*/
printk("scsi%d: Unexpected phase change to STATUSIN at index 0x%x\n",
host->host_no, index);
resume_offset = Ent_end_data_trans;
}
else {
printk("scsi%d: Unexpected phase change to %s at index 0x%x\n",
host->host_no, sbcl_to_phase(sbcl), index);
/* resume_offset is zero, which will cause a host reset */
}
/* Flush DMA FIFO */
NCR_write8 (CTEST8_REG, CTEST8_10_CLF);
while (NCR_read8 (CTEST8_REG) & CTEST8_10_CLF);
return resume_offset;
}
static u32
handle_script_int(struct Scsi_Host * host, Scsi_Cmnd * cmd)
{
struct sim710_hostdata *hostdata =
(struct sim710_hostdata *)host->hostdata[0];
struct sim710_target *targdata = hostdata->target + cmd->target;
u32 dsps, resume_offset = 0;
unsigned char sbcl;
dsps = NCR_read32(DSPS_REG);
switch (dsps) {
case A_int_cmd_complete:
cmd->result = targdata->dsa_status[0];
SCSI_DONE(cmd);
targdata->cur_cmd = NULL;
resume_offset = Ent_reselect;
break;
case A_int_msg_sdtr1:
resume_offset = handle_sdtr(host, cmd,
Ent_resume_msgin1a, Ent_resume_msgin1b);
break;
case A_int_msg_sdtr2:
resume_offset = handle_sdtr(host, cmd, 0, Ent_resume_msgin2b);
break;
case A_int_msg_sdtr3:
resume_offset = handle_sdtr(host, cmd, 0, Ent_resume_msgin3b);
break;
case A_int_disc1:
/* Disconnect before command - not expected */
targdata->resume_offset = Ent_resume_msgin1a;
resume_offset = Ent_reselect;
break;
case A_int_disc2:
/* Disconnect after command - just wait for a reselect */
targdata->resume_offset = Ent_resume_msgin2a;
resume_offset = Ent_reselect;
break;
case A_int_disc3:
/* Disconnect after the data phase */
targdata->resume_offset = Ent_resume_msgin3a;
resume_offset = Ent_reselect;
break;
case A_int_reselected:
hostdata->script[Ent_patch_output_data/4+1] = targdata->data_out_jump;
hostdata->script[Ent_patch_input_data/4+1] = targdata->data_in_jump;
NCR_write32(DSA_REG, isa_virt_to_bus(targdata->dsa));
resume_offset = targdata->resume_offset;
break;
case A_int_data_bad_phase:
sbcl = NCR_read8(SBCL_REG) & SBCL_PHASE_MASK;
printk("scsi%d: int_data_bad_phase, phase %s (%x)\n",
host->host_no, sbcl_to_phase(sbcl), sbcl);
break;
case A_int_bad_msg1:
case A_int_bad_msg2:
case A_int_bad_msg3:
case A_int_cmd_bad_phase:
case A_int_no_msgout1:
case A_int_no_msgout2:
case A_int_no_msgout3:
case A_int_not_cmd_complete:
case A_int_sel_no_ident:
case A_int_sel_not_cmd:
case A_int_status_not_msgin:
case A_int_resel_not_msgin:
case A_int_selected:
case A_int_not_rej:
default:
sbcl = NCR_read8(SBCL_REG) & SBCL_PHASE_MASK;
printk("scsi%d: Unimplemented script interrupt: %08x, phase %s\n",
host->host_no, dsps, sbcl_to_phase(sbcl));
sim710_errors++;
/* resume_offset is zero, which will cause a host reset */
}
return resume_offset;
}
/* A quick wrapper for sim710_intr_handle to grab the spin lock */
static void
do_sim710_intr_handle(int irq, void *dev_id, struct pt_regs *regs)
{
struct Scsi_Host *host = dev_id;
unsigned long flags;
spin_lock_irqsave(host->host_lock, flags);
sim710_intr_handle(irq, host, regs);
spin_unlock_irqrestore(host->host_lock, flags);
}
/* A "high" level interrupt handler */
static void
sim710_intr_handle(int irq, void *dev_id, struct pt_regs *regs)
{
struct Scsi_Host * host = (struct Scsi_Host *)dev_id;
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)host->hostdata[0];
Scsi_Cmnd * cmd;
unsigned char istat, dstat;
unsigned char sstat0;
u32 scratch, dsps, resume_offset = 0;
istat = NCR_read8(ISTAT_REG);
if (!(istat & (ISTAT_SIP|ISTAT_DIP)))
return;
else {
sim710_intrs++;
dsps = NCR_read32(DSPS_REG);
hostdata->state = STATE_HALTED;
sstat0 = dstat = 0;
scratch = NCR_read32(SCRATCH_REG);
if (istat & ISTAT_SIP) {
sstat0 = NCR_read8(SSTAT0_REG);
}
if (istat & ISTAT_DIP) {
udelay(10); /* Some comment somewhere about 10cycles
* between accesses to sstat0 and dstat ??? */
dstat = NCR_read8(DSTAT_REG);
}
DEB(DEB_INTS, printk("scsi%d: Int %d, istat %02x, sstat0 %02x "
"dstat %02x, dsp [%04x], scratch %02x\n",
host->host_no, sim710_intrs, istat, sstat0, dstat,
(u32 *)(isa_bus_to_virt(NCR_read32(DSP_REG))) - hostdata->script,
scratch));
if (scratch & 0x100) {
u8 *p = hostdata->msgin_buf;
DEB(DEB_INTS, printk(" msgin_buf: %02x %02x %02x %02x\n",
p[0], p[1], p[2], p[3]));
}
if ((dstat & DSTAT_SIR) && dsps == A_int_reselected) {
/* Reselected. Identify the target from LCRC_REG, and
* update current command. If we were trying to select
* a device, then that command needs to go back on the
* issue_queue for later.
*/
unsigned char lcrc = NCR_read8(LCRC_REG_10);
int id = 0;
if (!(lcrc & 0x7f)) {
printk("scsi%d: Reselected with LCRC = %02x\n",
host->host_no, lcrc);
cmd = NULL;
}
else {
while (!(lcrc & 1)) {
id++;
lcrc >>= 1;
}
DEB(DEB_DISC, printk("scsi%d: Reselected by ID %d\n",
host->host_no, id));
if (hostdata->running) {
/* Clear SIGP */
(void)NCR_read8(CTEST2_REG_700);
DEB(DEB_DISC, printk("scsi%d: Select of %d interrupted "
"by reselect from %d (%p)\n",
host->host_no, hostdata->running->target,
id, hostdata->target[id].cur_cmd));
cmd = hostdata->running;
hostdata->target[cmd->target].cur_cmd = NULL;
cmd->SCp.ptr = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = cmd;
}
cmd = hostdata->running = hostdata->target[id].cur_cmd;
}
}
else
cmd = hostdata->running;
if (!cmd) {
printk("scsi%d: No active command!\n", host->host_no);
printk("scsi%d: Int %d, istat %02x, sstat0 %02x "
"dstat %02x, dsp [%04x], scratch %02x, dsps %08x\n",
host->host_no, sim710_intrs, istat, sstat0, dstat,
(u32 *)(isa_bus_to_virt(NCR_read32(DSP_REG))) - hostdata->script,
NCR_read32(SCRATCH_REG), dsps);
/* resume_offset is zero, which will cause a host reset */
}
else if (sstat0 & SSTAT0_700_STO) {
DEB(DEB_TOUT, printk("scsi%d: Selection timeout\n", host->host_no));
cmd->result = DID_NO_CONNECT << 16;
SCSI_DONE(cmd);
hostdata->target[cmd->target].cur_cmd = NULL;
resume_offset = Ent_reselect;
}
else if (sstat0 & (SSTAT0_SGE|SSTAT0_UDC|SSTAT0_RST|SSTAT0_PAR)) {
printk("scsi%d: Serious error, sstat0 = %02x\n", host->host_no,
sstat0);
sim710_errors++;
/* resume_offset is zero, which will cause a host reset */
}
else if (dstat & (DSTAT_BF|DSTAT_ABRT|DSTAT_SSI|DSTAT_WTD)) {
printk("scsi%d: Serious error, dstat = %02x\n", host->host_no,
dstat);
sim710_errors++;
/* resume_offset is zero, which will cause a host reset */
}
else if (dstat & DSTAT_SIR)
resume_offset = handle_script_int(host, cmd);
else if (sstat0 & SSTAT0_MA)
resume_offset = handle_phase_mismatch(host, cmd);
else if (dstat & DSTAT_IID) {
/* This can be due to a quick reselect while doing a WAIT
* DISCONNECT.
*/
resume_offset = handle_idd(host, cmd);
}
else {
sim710_errors++;
printk("scsi%d: Spurious interrupt!\n", host->host_no);
/* resume_offset is zero, which will cause a host reset */
}
}
if (resume_offset) {
if (resume_offset == Ent_reselect) {
hostdata->running = NULL;
hostdata->state = STATE_IDLE;
}
else
hostdata->state = STATE_BUSY;
DEB(DEB_RESUME, printk("scsi%d: Resuming at script[0x%x]\n",
host->host_no, resume_offset/4));
#ifdef DEBUG_LIMIT_INTS
if (sim710_intrs < DEBUG_LIMIT_INTS)
#endif
{
NCR_write32(SCRATCH_REG, 0);
NCR_write32(DSP_REG,
isa_virt_to_bus(hostdata->script+resume_offset/4));
}
if (resume_offset == Ent_reselect)
run_process_issue_queue(hostdata);
}
else {
printk("scsi%d: Failed to handle interrupt. Failing commands "
"and resetting SCSI bus and chip\n", host->host_no);
mdelay(1000); /* Give chance to read screen!! */
full_reset(host);
}
}
static void
run_command (struct sim710_hostdata *hostdata, Scsi_Cmnd *cmd)
__init int
sim710_probe_common(struct device *dev, unsigned long base_addr,
int irq, int clock, int differential, int scsi_id)
{
struct Scsi_Host *host = cmd->host;
struct sim710_target *targdata = hostdata->target + cmd->target;
int i, datain, dataout, sg_start;
u32 *dip, *dop, dsa;
DEB(DEB_CMND, printk("scsi%d: id%d starting ", host->host_no,
cmd->target));
DEB(DEB_CMND, print_command(cmd->cmnd));
switch (cmd->cmnd[0]) {
case INQUIRY:
case MODE_SENSE:
case READ_6:
case READ_10:
case READ_CAPACITY:
case REQUEST_SENSE:
case READ_BLOCK_LIMITS:
case READ_TOC:
datain = 1;
dataout = 0;
break;
case MODE_SELECT:
case WRITE_6:
case WRITE_10:
datain = 0;
dataout = 1;
break;
case TEST_UNIT_READY:
case ALLOW_MEDIUM_REMOVAL:
case START_STOP:
datain = dataout = 0;
break;
default:
datain = dataout = 1;
}
memcpy(targdata->dsa_cdb, cmd->cmnd, MAX_CMND);
targdata->dsa_msgout[0] =
IDENTIFY((opt_nodisc[hostdata->chip] & (1<<cmd->target)) ? 0 : 1 ,0);
if (hostdata->negotiate & (1 << cmd->target)) {
if (opt_noneg[hostdata->chip] & (1 << cmd->target)) {
hostdata->negotiate ^= (1 << cmd->target);
targdata->dsa[DSA_MSGOUT] = 1;
}
else {
DEB(DEB_SYNC, printk("scsi%d: Negotiating async transfers "
"for ID %d\n",
host->host_no, cmd->target));
memcpy(targdata->dsa_msgout+1, async_message, sizeof(async_message));
targdata->dsa[DSA_MSGOUT] = sizeof(async_message) + 1;
}
}
else
targdata->dsa[DSA_MSGOUT] = 1;
targdata->dsa_msgin[0] = 0xff;
targdata->dsa_status[0] = 0xff;
targdata->dsa[DSA_SELECT] = (1 << cmd->target) << 16;
targdata->dsa[DSA_MSGOUT+1] = isa_virt_to_bus(targdata->dsa_msgout);
targdata->dsa[DSA_CMND] = cmd->cmd_len;
targdata->dsa[DSA_CMND+1] = isa_virt_to_bus(targdata->dsa_cdb);
targdata->dsa[DSA_STATUS] = 1;
targdata->dsa[DSA_STATUS+1] = isa_virt_to_bus(targdata->dsa_status);
targdata->dsa[DSA_MSGIN] = 1;
targdata->dsa[DSA_MSGIN+1] = isa_virt_to_bus(targdata->dsa_msgin);
sg_start = (MAX_SG - (cmd->use_sg ? cmd->use_sg : 1)) * 2;
dip = targdata->dsa + DSA_DATAIN + sg_start;
dop = targdata->dsa + DSA_DATAOUT + sg_start;
struct Scsi_Host * host = NULL;
struct NCR_700_Host_Parameters *hostdata =
kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; i++) {
struct scatterlist *sgl = &((struct scatterlist *)cmd->buffer)[i];
void *vbuf = cmd->use_sg ?
(page_address(sgl->page) + sgl->offset) :
(cmd->request_buffer);
u32 bbuf = isa_virt_to_bus(vbuf);
u32 cnt = cmd->use_sg ? sgl->length : cmd->request_bufflen;
printk(KERN_NOTICE "sim710: %s\n", dev->name);
printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n",
irq, clock, base_addr, scsi_id);
if (datain) {
*dip++ = cnt;
*dip++ = bbuf;
if(hostdata == NULL) {
printk(KERN_ERR "sim710: Failed to allocate host data\n");
goto out;
}
if (dataout) {
*dop++ = cnt;
*dop++ = bbuf;
}
}
targdata->data_out_jump = hostdata->script[Ent_patch_output_data/4+1] =
isa_virt_to_bus(hostdata->script + Ent_patch_output_data/4 + sg_start + 2);
targdata->data_in_jump = hostdata->script[Ent_patch_input_data/4+1] =
isa_virt_to_bus(hostdata->script + Ent_patch_input_data/4 + sg_start + 2);
for (i = 0, dsa = isa_virt_to_bus(targdata->dsa); i < 4; i++) {
u32 v = hostdata->script[Ent_patch_new_dsa/4 + i * 2];
memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
v &= ~0x0000ff00;
v |= (dsa & 0xff) << 8;
hostdata->script[Ent_patch_new_dsa/4 + i * 2] = v;
dsa >>= 8;
if(request_region(base_addr, 64, "sim710") == NULL) {
printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n",
base_addr);
goto out_free;
}
hostdata->running = targdata->cur_cmd = cmd;
hostdata->state = STATE_BUSY;
NCR_write8(ISTAT_REG, ISTAT_10_SIGP);
}
static volatile int process_issue_queue_running = 0;
static __inline__ void
run_process_issue_queue(struct sim710_hostdata *hostdata)
{
unsigned long flags;
save_flags (flags);
cli();
if (!process_issue_queue_running) {
process_issue_queue_running = 1;
process_issue_queue(hostdata, flags);
/*
* process_issue_queue_running is cleared in process_issue_queue
* once it can't do more work, and process_issue_queue exits with
* interrupts disabled.
*/
}
restore_flags (flags);
}
/*
* Function : process_issue_queue (hostdata, flags)
*
* Purpose : Start next command for any idle target.
*
* NOTE : process_issue_queue exits with interrupts *disabled*, so the
* caller must reenable them if it desires.
*
* NOTE : process_issue_queue should be called from both
* sim710_queue_command() and from the interrupt handler
* after command completion.
*/
static void
process_issue_queue (struct sim710_hostdata *hostdata, unsigned long flags)
{
Scsi_Cmnd *tmp, *prev;
int done;
/*
* We run (with interrupts disabled) until we're sure that none of
* the host adapters have anything that can be done, at which point
* we set process_issue_queue_running to 0 and exit.
*
* Interrupts are enabled before doing various other internal
* instructions, after we've decided that we need to run through
* the loop again.
*
*/
/* Fill in the three required pieces of hostdata */
hostdata->base = base_addr;
hostdata->differential = differential;
hostdata->clock = clock;
hostdata->chip710 = 1;
do {
cli(); /* Freeze request queues */
done = 1;
if (hostdata->issue_queue) {
if (hostdata->state == STATE_DISABLED) {
tmp = (Scsi_Cmnd *) hostdata->issue_queue;
hostdata->issue_queue = (Scsi_Cmnd *) tmp->SCp.ptr;
tmp->result = (DID_BAD_TARGET << 16);
tmp->scsi_done (tmp);
done = 0;
/* and register the chip */
if((host = NCR_700_detect(sim710_global_info.tpnt, hostdata)) == NULL) {
printk(KERN_ERR "sim710: No host detected; card configuration problem?\n");
goto out_release;
}
else if (hostdata->state == STATE_IDLE) {
for (tmp = hostdata->issue_queue, prev = NULL; tmp;
prev = tmp, tmp = (Scsi_Cmnd *) tmp->SCp.ptr) {
if (hostdata->target[tmp->target].cur_cmd == NULL) {
if (prev)
prev->SCp.ptr = tmp->SCp.ptr;
else
hostdata->issue_queue = (Scsi_Cmnd *) tmp->SCp.ptr;
tmp->SCp.ptr = NULL;
run_command (hostdata, tmp);
done = 0;
} /* if target/lun is not busy */
} /* scan issue queue for work */
} /* host is idle */
} /* if hostdata->issue_queue */
if (!done)
restore_flags (flags);
} while (!done);
process_issue_queue_running = 0;
}
int
sim710_queuecommand(Scsi_Cmnd * cmd, void (*done)(Scsi_Cmnd *))
{
struct Scsi_Host *host = cmd->host;
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)host->hostdata[0];
Scsi_Cmnd *tmp;
unsigned long flags;
host->irq = irq;
host->this_id = scsi_id;
if (cmd->lun) {
/* Silently ignore luns other than zero! */
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
return 0;
if(request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) {
printk(KERN_ERR "sim710: irq problem with %d, detaching\n",
irq);
goto out_unregister;
}
DEB(DEB_CMND, printk("scsi%d: id%d queuing ", host->host_no,
cmd->target));
DEB(DEB_CMND, print_command(cmd->cmnd));
cmd->scsi_done = done;
cmd->host_scribble = NULL;
cmd->SCp.ptr = NULL;
cmd->SCp.buffer = NULL;
scsi_set_device(host, dev);
hostdata->dev = dev;
save_flags(flags);
cli();
sim710_global_info.found++;
if (ignore_ids[hostdata->chip] & (1 << cmd->target)) {
printk("scsi%d: ignoring target %d\n", host->host_no, cmd->target);
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
restore_flags (flags);
return 0;
}
#ifdef DEBUG_LIMIT_INTS
if (sim710_intrs > DEBUG_LIMIT_INTS) {
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
restore_flags (flags);
return 0;
}
#endif
if (cmd->use_sg > MAX_SG)
panic ("cmd->use_sg = %d\n", cmd->use_sg);
if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
cmd->SCp.ptr = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = cmd;
} else {
for (tmp = hostdata->issue_queue; tmp->SCp.ptr;
tmp = (Scsi_Cmnd *) tmp->SCp.ptr);
tmp->SCp.ptr = (unsigned char *) cmd;
}
restore_flags (flags);
run_process_issue_queue(hostdata);
return 0;
out_unregister:
scsi_unregister(host);
out_release:
release_region(host->base, 64);
out_free:
kfree(hostdata);
out:
return -ENODEV;
}
#ifdef CONFIG_MCA
static short sim710_mca_id_table[] = { 0x01bb, 0x01ba, 0x004f, 0};
__init int
sim710_detect(Scsi_Host_Template * tpnt)
sim710_mca_probe(struct device *dev)
{
unsigned char scsi_id;
unsigned int base_addr;
struct Scsi_Host * host = NULL;
struct sim710_hostdata *hostdata;
unsigned long timeout;
unsigned long irq_mask;
int requested_irq;
int probed_irq;
u32 dsps;
int chips = 0;
int limit;
int indx;
int revision;
int size;
volatile u8 tmp;
struct Scsi_Host *our_hosts[MAXBOARDS+1];
#ifdef MODULE
if (sim710)
param_setup(sim710);
#endif
if (no_of_boards < 0) {
printk("sim710: NCR53C710 driver disabled\n");
return 0;
}
#ifdef CONFIG_MCA
/* If board details have been specified via boot/module parameters,
* then don't bother probing.
*/
if (no_of_boards == 0) {
int slot;
struct mca_device *mca_dev = to_mca_device(dev);
int slot = mca_dev->slot;
int pos[3];
int mca_53c710_ids[] = MCA_53C710_IDS;
int *id_to_check = mca_53c710_ids;
unsigned int base;
int irq_vector;
short id = sim710_mca_id_table[mca_dev->index];
static int io_004f_by_pos[] = MCA_004F_IO_PORTS;
static int irq_004f_by_pos[] = MCA_004F_IRQS;
static int io_01bb_by_pos[] = MCA_01BB_IO_PORTS;
static int irq_01bb_by_pos[] = MCA_01BB_IRQS;
char *name;
int clock;
while ( *id_to_check && no_of_boards < MAXBOARDS) {
if (!MCA_bus)
return 0;
if ((slot = mca_find_adapter(*id_to_check, 0)) != MCA_NOTFOUND) {
pos[0] = mca_read_stored_pos(slot, 2);
pos[1] = mca_read_stored_pos(slot, 3);
pos[2] = mca_read_stored_pos(slot, 4);
pos[0] = mca_device_read_stored_pos(mca_dev, 2);
pos[1] = mca_device_read_stored_pos(mca_dev, 3);
pos[2] = mca_device_read_stored_pos(mca_dev, 4);
/*
* 01BB & 01BA port base by bits 7,6,5,4,3,2 in pos[2]
......@@ -1431,351 +240,141 @@ sim710_detect(Scsi_Host_Template * tpnt)
* 110 14
*/
if ( *id_to_check == 0x01bb || *id_to_check == 0x01ba ) {
bases[no_of_boards] = io_01bb_by_pos[(pos[2] & 0xFC) >> 2];
irq_vectors[no_of_boards] =
if (id == 0x01bb || id == 0x01ba) {
base = io_01bb_by_pos[(pos[2] & 0xFC) >> 2];
irq_vector =
irq_01bb_by_pos[((pos[0] & 0xC0) >> 6)];
if (bases[no_of_boards] == 0x0000)
printk("sim710: NCR53C710 Adapter ID 0x01bb is disabled.\n");
else {
no_of_boards++;
if ( *id_to_check == 0x01bb )
mca_set_adapter_name( slot,
"NCR 3360/3430 SCSI SubSystem" );
clock = 50;
if (id == 0x01bb)
name = "NCR 3360/3430 SCSI SubSystem";
else
mca_set_adapter_name(slot,
"NCR Dual SIOP SCSI Host Adapter Board");
}
}
else if ( *id_to_check == 0x004f ) {
bases[no_of_boards] = io_004f_by_pos[((pos[0] & 0x0E) >> 1)];
irq_vectors[no_of_boards] =
name = "NCR Dual SIOP SCSI Host Adapter Board";
} else if ( id == 0x004f ) {
base = io_004f_by_pos[((pos[0] & 0x0E) >> 1)];
irq_vector =
irq_004f_by_pos[((pos[0] & 0x70) >> 4) - 4];
if (bases[no_of_boards] == 0x0000)
printk("sim710: NCR53C710 Adapter ID 0x004f is disabled.\n");
else {
no_of_boards++;
mca_set_adapter_name(slot,
"NCR 53c710 SCSI Host Adapter Board");
}
}
}
id_to_check++;
}
}
#endif
#ifdef CONFIG_EISA
/* Auto probe, if no boards specified in boot parameters */
if (no_of_boards == 0) {
int io_addr;
/* reverse probe, so my on-board controller at 0x9000 is always scsi0 */
for (io_addr = 0x9000; no_of_boards < MAXBOARDS && io_addr >= 0x1000; io_addr -= 0x1000) {
if (request_region(io_addr, 0x40, "sim710") != NULL) {
int id0 = inw(io_addr + 0xc80);
int id1 = inw(io_addr + 0xc82);
/* The on-board controller on my Proliant 2000 is 0x1044,
* my EISA card is 0x1144.
*/
if (id0 == 0x110e && (id1 == 0x1044 || id1 == 0x1144)) {
bases[no_of_boards] = io_addr;
#if 0
/* This should detect the IRQ, but I havn't proved it for
* myself. Leave the old probe code active for now, as
* no-one has reported problems with it.
*/
switch (inb(io_addr + 0xc88)) {
case (0x00):
irq_vectors[no_of_boards] = 11;
break;
case (0x01):
irq_vectors[no_of_boards] = 14;
break;
case (0x02):
irq_vectors[no_of_boards] = 15;
break;
case (0x03):
irq_vectors[no_of_boards] = 10;
break;
case (0x04):
irq_vectors[no_of_boards] = 9;
break;
default:
printk("sim710.c: irq nasty\n");
}
#endif
no_of_boards++;
}
release_region(io_addr, 64);
}
}
}
#endif
if (!no_of_boards) {
printk("sim710: No NCR53C710 adapter found.\n");
return 0;
clock = 50;
name = "NCR 53c710 SCSI Host Adapter Board";
} else {
return -ENODEV;
}
strncpy(dev->name, name, sizeof(dev->name));
mca_device_set_claim(mca_dev, 1);
base = mca_device_transform_ioport(mca_dev, base);
irq_vector = mca_device_transform_irq(mca_dev, irq_vector);
size = sizeof(struct sim710_hostdata);
hostdata_order = 0;
while (size > (PAGE_SIZE << hostdata_order))
hostdata_order++;
size = PAGE_SIZE << hostdata_order;
DEB(DEB_ANY, printk("sim710: hostdata %d bytes, size %d, order %d\n",
sizeof(struct sim710_hostdata), size, hostdata_order));
tpnt->proc_name = "sim710";
memset(our_hosts, 0, sizeof(our_hosts));
for (indx = 0; indx < no_of_boards; indx++) {
unsigned long page = __get_free_pages(GFP_ATOMIC, hostdata_order);
if(page == 0UL)
{
printk(KERN_WARNING "sim710: out of memory registering board %d.\n", indx);
break;
}
host = scsi_register(tpnt, 4);
if(host == NULL) {
free_pages(host->hostdata[0], hostdata_order);
break;
}
our_hosts[chips] = host;
host->hostdata[0] = page;
hostdata = (struct sim710_hostdata *)host->hostdata[0];
memset(hostdata, 0, size);
scsi_id = 7;
base_addr = bases[indx];
requested_irq = irq_vectors[indx];
printk("scsi%d: Configuring Sim710 (SCSI-ID %d) at %x, IRQ %d\n",
host->host_no, scsi_id, base_addr, requested_irq);
DEB(DEB_ANY, printk("sim710: hostdata = %p (%d bytes), dsa0 = %p\n",
hostdata, sizeof(struct sim710_hostdata),
hostdata->target[0].dsa));
hostdata->chip = indx;
host->irq = requested_irq;
host->this_id = scsi_id;
host->unique_id = base_addr;
host->base = base_addr;
hostdata->msg_reject = MESSAGE_REJECT;
return sim710_probe_common(dev, base, irq_vector, clock,
0, id_array[slot]);
}
if (ncr_halt(host)) {
free_pages(host->hostdata[0], hostdata_order);
scsi_unregister (host);
printk("scsi%d: Failed to initialise 53c710 at address %x\n",
host->host_no, base_addr);
continue;
}
DEB(DEB_ANY,ncr_dump(host));
revision = (NCR_read8(CTEST8_REG) & 0xF0) >> 4;
printk("scsi%d: Revision 0x%x\n",host->host_no,revision);
sim710_soft_reset(host);
struct mca_driver sim710_mca_driver = {
.id_table = sim710_mca_id_table,
.driver = {
.name = "sim710",
.bus = &mca_bus_type,
.probe = sim710_mca_probe,
},
};
sim710_driver_init(host);
#endif /* CONFIG_MCA */
request_region((u32)host->base, 64, "sim710");
/* Now run test1 */
hostdata->test1_src = 0x53c710aa;
hostdata->test1_dst = 0x76543210;
NCR_write32(DSPS_REG, 0x89abcdef);
irq_mask = probe_irq_on();
NCR_write32(DSP_REG, virt_to_bus(hostdata->script+Ent_test1/4));
timeout = 5;
while (hostdata->test1_dst != hostdata->test1_src && timeout--)
mdelay(100);
tmp = NCR_read8(ISTAT_REG);
tmp = NCR_read8(SSTAT0_REG);
udelay(10);
tmp = NCR_read8(DSTAT_REG);
probed_irq = probe_irq_off(irq_mask);
if (requested_irq == 0) {
if (probed_irq > 0) {
printk("scsi%d: Chip is using IRQ %d\n", host->host_no,
probed_irq);
requested_irq = host->irq = probed_irq;
}
else {
printk("scsi%d: Failed to probe for IRQ (returned %d)\n",
host->host_no, probed_irq);
ncr_halt(host);
free_pages(host->hostdata[0], hostdata_order);
scsi_unregister (host);
release_region((u32)host->base, 64);
continue;
}
}
else if (probed_irq > 0 && probed_irq != requested_irq)
printk("scsi%d: WARNING requested IRQ %d, but probed as %d\n",
host->host_no, requested_irq, probed_irq);
else if (probed_irq <= 0)
printk("scsi%d: WARNING IRQ probe failed, (returned %d)\n",
host->host_no, probed_irq);
#ifdef CONFIG_EISA
struct eisa_device_id sim710_eisa_ids[] = {
{ "CPQ4410" },
{ "CPQ4411" },
{ "HWP0C80" },
{ "" }
};
dsps = NCR_read32(DSPS_REG);
if (hostdata->test1_dst != 0x53c710aa || dsps != A_int_test1) {
if (hostdata->test1_dst != 0x53c710aa)
printk("scsi%d: test 1 FAILED: data: exp 0x53c710aa, got 0x%08x\n",
host->host_no, hostdata->test1_dst);
if (dsps != A_int_test1)
printk("scsi%d: test 1 FAILED: dsps: exp 0x%08x, got 0x%08x\n",
host->host_no, A_int_test1, dsps);
ncr_dump(host);
ncr_halt(host);
free_pages(host->hostdata[0], hostdata_order);
scsi_unregister (host);
release_region((u32)host->base, 64);
continue;
__init int
sim710_eisa_probe(struct device *dev)
{
struct eisa_device *edev = to_eisa_device(dev);
unsigned long io_addr = edev->base_addr;
char eisa_cpq_irqs[] = { 11, 14, 15, 10, 9, 0 };
char eisa_hwp_irqs[] = { 3, 4, 5, 7, 12, 10, 11, 0};
char *eisa_irqs;
unsigned char irq_index;
unsigned char irq, differential = 0, scsi_id = 7;
if(strcmp(edev->id.sig, "HWP0C80") == 0) {
eisa_irqs = eisa_hwp_irqs;
irq_index = (inb(io_addr + 0xc85) & 0x7) - 1;
#if 0
/* this doesn't seem to work at the moment */
scsi_id = ffs(inb(io_addr + 0x4));
#endif
} else {
eisa_irqs = eisa_cpq_irqs;
irq_index = inb(io_addr + 0xc88);
}
printk("scsi%d: test 1 completed ok.\n", host->host_no);
NCR_write32(DSP_REG, virt_to_bus(hostdata->script+Ent_reselect/4));
hostdata->state = STATE_IDLE;
chips++;
}
/* OK, now run down our_hosts[] calling request_irq(... SA_SHIRQ ...).
* Couldn't call request_irq earlier, as probing would have failed.
*/
for (indx = 0, limit = chips; indx < limit; indx++) {
host = our_hosts[indx];
if (request_irq(host->irq, do_sim710_intr_handle,
SA_INTERRUPT | SA_SHIRQ, "sim710", host))
{
printk("scsi%d : IRQ%d not free, detaching\n",
host->host_no, host->irq);
ncr_halt(host);
free_pages(host->hostdata[0], hostdata_order);
scsi_unregister (host);
chips--;
}
if(irq_index >= strlen(eisa_irqs)) {
printk("sim710.c: irq nasty\n");
return -ENODEV;
}
return chips;
}
irq = eisa_irqs[irq_index];
int
sim710_abort(Scsi_Cmnd * cmd)
{
struct Scsi_Host * host = cmd->host;
printk("scsi%d: Unable to abort command for target %d\n",
host->host_no, cmd->target);
return FAILED;
return sim710_probe_common(dev, io_addr, irq, 50,
differential, scsi_id);
}
/*
* This is a device reset. Need to select and send a Bus Device Reset msg.
*/
int
sim710_dev_reset(Scsi_Cmnd * SCpnt)
{
struct Scsi_Host * host = SCpnt->host;
struct eisa_driver sim710_eisa_driver = {
.id_table = sim710_eisa_ids,
.driver = {
.name = "sim710",
.probe = sim710_eisa_probe,
.remove = __devexit_p(sim710_device_remove),
},
};
printk("scsi%d: Unable to send Bus Device Reset for target %d\n",
host->host_no, SCpnt->target);
return FAILED;
}
#endif /* CONFIG_EISA */
/*
* This is bus reset. We need to reset the bus and fail any active commands.
*/
int
sim710_bus_reset(Scsi_Cmnd * SCpnt)
{
struct Scsi_Host * host = SCpnt->host;
printk("scsi%d: Unable to do SCSI bus reset\n", host->host_no);
return FAILED;
}
static int
full_reset(struct Scsi_Host * host)
sim710_release(struct Scsi_Host *host)
{
struct sim710_hostdata *hostdata = (struct sim710_hostdata *)
host->hostdata[0];
int target;
Scsi_Cmnd *cmd;
u32 istat, dstat = 0, sstat0 = 0, sstat1 = 0, dsp, dsps, scratch;
unsigned long flags;
save_flags(flags);
cli();
istat = NCR_read8(ISTAT_REG);
if (istat & ISTAT_SIP) {
sstat0 = NCR_read8(SSTAT0_REG);
sstat1 = NCR_read8(SSTAT1_REG);
udelay(10);
}
if (istat & ISTAT_DIP)
dstat = NCR_read8(DSTAT_REG);
if (ncr_halt(host)) {
restore_flags(flags);
return FAILED;
}
restore_flags(flags);
dsp = NCR_read32(DSP_REG);
dsps = NCR_read32(DSPS_REG);
scratch = NCR_read32(SCRATCH_REG);
printk("scsi%d: istat = %02x, sstat0 = %02x, sstat1 = %02x, dstat = %02x\n",
host->host_no, istat, sstat0, sstat1, dstat);
printk("scsi%d: dsp = %08x (script[0x%04x]), dsps = %08x, scratch = %08x\n",
host->host_no, dsp,
((u32)bus_to_virt(dsp) - (u32)hostdata->script)/4, dsps, scratch);
for (target = 0; target < 7; target++) {
if ((cmd = hostdata->target[target].cur_cmd)) {
printk("scsi%d: Failing command for ID%d\n",
host->host_no, target);
cmd->result = DID_RESET << 16;
cmd->scsi_done(cmd);
hostdata->target[target].cur_cmd = NULL;
}
}
sim710_soft_reset(host);
sim710_driver_init(host);
NCR_write32(DSP_REG, isa_virt_to_bus(hostdata->script+Ent_reselect/4));
hostdata->state = STATE_IDLE;
run_process_issue_queue(hostdata);
struct D700_Host_Parameters *hostdata =
(struct D700_Host_Parameters *)host->hostdata[0];
return SUCCESS;
NCR_700_release(host);
kfree(hostdata);
free_irq(host->irq, host);
/* should do a refcount here and unregister the drivers when
* it reaches zero */
return 1;
}
/*
* This is host reset. We need to reset the chip and the bus.
*/
int
sim710_host_reset(Scsi_Cmnd * SCpnt)
int __init
sim710_detect(Scsi_Host_Template *tpnt)
{
struct Scsi_Host * host = SCpnt->host;
printk("scsi%d: >>>>>>>>>>>> Host reset <<<<<<<<<<<<\n", host->host_no);
return full_reset(host);
}
sim710_global_info.tpnt = tpnt;
sim710_global_info.found = 0;
#ifdef MODULE
if (sim710)
param_setup(sim710);
#endif
int
sim710_release(struct Scsi_Host *host)
{
ncr_halt(host);
free_pages(host->hostdata[0], hostdata_order);
free_irq(host->irq, host);
release_region((u32)host->base, 64);
return 1;
}
#ifdef CONFIG_MCA
if(MCA_bus)
mca_register_driver(&sim710_mca_driver);
#endif
#ifdef CONFIG_EISA
eisa_driver_register(&sim710_eisa_driver);
#endif
return sim710_global_info.found;
}
static Scsi_Host_Template driver_template = SIM710_SCSI;
static Scsi_Host_Template driver_template = {
.name = "LSI (Symbios) 710 MCA/EISA",
.proc_name = "sim710",
.detect = sim710_detect,
.release = sim710_release,
.this_id = 7,
};
#include "scsi_module.c"
#ifndef _SIM710_H
#define _SIM710_H
/*
* sim710.h - Copyright (C) 1999 Richard Hirst
*/
#include <linux/types.h>
int sim710_detect(Scsi_Host_Template *);
int sim710_command(Scsi_Cmnd *);
int sim710_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int sim710_abort(Scsi_Cmnd * SCpnt);
int sim710_bus_reset(Scsi_Cmnd * SCpnt);
int sim710_dev_reset(Scsi_Cmnd * SCpnt);
int sim710_host_reset(Scsi_Cmnd * SCpnt);
#ifdef MODULE
int sim710_release(struct Scsi_Host *);
#else
#define sim710_release NULL
#endif
#include <scsi/scsicam.h>
#define SIM710_SCSI { .proc_name = "sim710", \
.name = "53c710", \
.detect = sim710_detect, \
.release = sim710_release, \
.queuecommand = sim710_queuecommand, \
.eh_abort_handler = sim710_abort, \
.eh_device_reset_handler = sim710_dev_reset, \
.eh_bus_reset_handler = sim710_bus_reset, \
.eh_host_reset_handler = sim710_host_reset, \
.can_queue = 8, \
.this_id = 7, \
.sg_tablesize = 128, \
.cmd_per_lun = 1, \
.use_clustering = DISABLE_CLUSTERING }
#ifndef HOSTS_C
#ifdef __BIG_ENDIAN
#define bE 3 /* 0 for little endian, 3 for big endian */
#else
#define bE 0
#endif
/* SCSI control 0 rw, default = 0xc0 */
#define SCNTL0_REG (0x00^bE)
#define SCNTL0_ARB1 0x80 /* 0 0 = simple arbitration */
#define SCNTL0_ARB2 0x40 /* 1 1 = full arbitration */
#define SCNTL0_STRT 0x20 /* Start Sequence */
#define SCNTL0_WATN 0x10 /* Select with ATN */
#define SCNTL0_EPC 0x08 /* Enable parity checking */
/* Bit 2 is reserved on 800 series chips */
#define SCNTL0_EPG_700 0x04 /* Enable parity generation */
#define SCNTL0_AAP 0x02 /* ATN/ on parity error */
#define SCNTL0_TRG 0x01 /* Target mode */
/* SCSI control 1 rw, default = 0x00 */
#define SCNTL1_REG (0x01^bE)
#define SCNTL1_EXC 0x80 /* Extra Clock Cycle of Data setup */
#define SCNTL1_ADB 0x40 /* contents of SODL on bus */
#define SCNTL1_ESR_700 0x20 /* Enable SIOP response to selection
and reselection */
#define SCNTL1_CON 0x10 /* Connected */
#define SCNTL1_RST 0x08 /* SCSI RST/ */
#define SCNTL1_AESP 0x04 /* Force bad parity */
#define SCNTL1_SND_700 0x02 /* Start SCSI send */
#define SCNTL1_IARB_800 0x02 /* Immediate Arbitration, start
arbitration immediately after
busfree is detected */
#define SCNTL1_RCV_700 0x01 /* Start SCSI receive */
#define SCNTL1_SST_800 0x01 /* Start SCSI transfer */
/* SCSI control 2 rw, */
#define SCNTL2_REG_800 (0x02^bE)
#define SCNTL2_800_SDU 0x80 /* SCSI disconnect unexpected */
/* SCSI control 3 rw */
#define SCNTL3_REG_800 (0x03^bE)
#define SCNTL3_800_SCF_SHIFT 4
#define SCNTL3_800_SCF_MASK 0x70
#define SCNTL3_800_SCF2 0x40 /* Synchronous divisor */
#define SCNTL3_800_SCF1 0x20 /* 0x00 = SCLK/3 */
#define SCNTL3_800_SCF0 0x10 /* 0x10 = SCLK/1 */
/* 0x20 = SCLK/1.5
0x30 = SCLK/2
0x40 = SCLK/3 */
#define SCNTL3_800_CCF_SHIFT 0
#define SCNTL3_800_CCF_MASK 0x07
#define SCNTL3_800_CCF2 0x04 /* 0x00 50.01 to 66 */
#define SCNTL3_800_CCF1 0x02 /* 0x01 16.67 to 25 */
#define SCNTL3_800_CCF0 0x01 /* 0x02 25.01 - 37.5
0x03 37.51 - 50
0x04 50.01 - 66 */
/*
* SCSI destination ID rw - the appropriate bit is set for the selected
* target ID. This is written by the SCSI SCRIPTS processor.
* default = 0x00
*/
#define SDID_REG_700 (0x02^bE)
#define SDID_REG_800 (0x06^bE)
#define GP_REG_800 (0x07^bE) /* General purpose IO */
#define GP_800_IO1 0x02
#define GP_800_IO2 0x01
/* SCSI interrupt enable rw, default = 0x00 */
#define SIEN_REG_700 (0x03^bE)
#define SIEN0_REG_800 (0x40^bE)
#define SIEN_MA 0x80 /* Phase mismatch (ini) or ATN (tgt) */
#define SIEN_FC 0x40 /* Function complete */
#define SIEN_700_STO 0x20 /* Selection or reselection timeout */
#define SIEN_800_SEL 0x20 /* Selected */
#define SIEN_700_SEL 0x10 /* Selected or reselected */
#define SIEN_800_RESEL 0x10 /* Reselected */
#define SIEN_SGE 0x08 /* SCSI gross error */
#define SIEN_UDC 0x04 /* Unexpected disconnect */
#define SIEN_RST 0x02 /* SCSI RST/ received */
#define SIEN_PAR 0x01 /* Parity error */
/*
* SCSI chip ID rw
* NCR53c700 :
* When arbitrating, the highest bit is used, when reselection or selection
* occurs, the chip responds to all IDs for which a bit is set.
* default = 0x00
*/
#define SCID_REG (0x04^bE)
/* Bit 7 is reserved on 800 series chips */
#define SCID_800_RRE 0x40 /* Enable response to reselection */
#define SCID_800_SRE 0x20 /* Enable response to selection */
/* Bits four and three are reserved on 800 series chips */
#define SCID_800_ENC_MASK 0x07 /* Encoded SCSI ID */
/* SCSI transfer rw, default = 0x00 */
#define SXFER_REG (0x05^bE)
#define SXFER_DHP 0x80 /* Disable halt on parity */
#define SXFER_TP2 0x40 /* Transfer period msb */
#define SXFER_TP1 0x20
#define SXFER_TP0 0x10 /* lsb */
#define SXFER_TP_MASK 0x70
/* FIXME : SXFER_TP_SHIFT == 5 is right for '8xx chips */
#define SXFER_TP_SHIFT 5
#define SXFER_TP_4 0x00 /* Divisors */
#define SXFER_TP_5 0x10<<1
#define SXFER_TP_6 0x20<<1
#define SXFER_TP_7 0x30<<1
#define SXFER_TP_8 0x40<<1
#define SXFER_TP_9 0x50<<1
#define SXFER_TP_10 0x60<<1
#define SXFER_TP_11 0x70<<1
#define SXFER_MO3 0x08 /* Max offset msb */
#define SXFER_MO2 0x04
#define SXFER_MO1 0x02
#define SXFER_MO0 0x01 /* lsb */
#define SXFER_MO_MASK 0x0f
#define SXFER_MO_SHIFT 0
/*
* SCSI output data latch rw
* The contents of this register are driven onto the SCSI bus when
* the Assert Data Bus bit of the SCNTL1 register is set and
* the CD, IO, and MSG bits of the SOCL register match the SCSI phase
*/
#define SODL_REG_700 (0x06^bE)
#define SODL_REG_800 (0x54^bE)
/*
* SCSI output control latch rw, default = 0
* Note that when the chip is being manually programmed as an initiator,
* the MSG, CD, and IO bits must be set correctly for the phase the target
* is driving the bus in. Otherwise no data transfer will occur due to
* phase mismatch.
*/
#define SOCL_REG (0x07^bE)
#define SOCL_REQ 0x80 /* REQ */
#define SOCL_ACK 0x40 /* ACK */
#define SOCL_BSY 0x20 /* BSY */
#define SOCL_SEL 0x10 /* SEL */
#define SOCL_ATN 0x08 /* ATN */
#define SOCL_MSG 0x04 /* MSG */
#define SOCL_CD 0x02 /* C/D */
#define SOCL_IO 0x01 /* I/O */
/*
* SCSI first byte received latch ro
* This register contains the first byte received during a block MOVE
* SCSI SCRIPTS instruction, including
*
* Initiator mode Target mode
* Message in Command
* Status Message out
* Data in Data out
*
* It also contains the selecting or reselecting device's ID and our
* ID.
*
* Note that this is the register the various IF conditionals can
* operate on.
*/
#define SFBR_REG (0x08^bE)
/*
* SCSI input data latch ro
* In initiator mode, data is latched into this register on the rising
* edge of REQ/. In target mode, data is latched on the rising edge of
* ACK/
*/
#define SIDL_REG_700 (0x09^bE)
#define SIDL_REG_800 (0x50^bE)
/*
* SCSI bus data lines ro
* This register reflects the instantaneous status of the SCSI data
* lines. Note that SCNTL0 must be set to disable parity checking,
* otherwise reading this register will latch new parity.
*/
#define SBDL_REG_700 (0x0a^bE)
#define SBDL_REG_800 (0x58^bE)
#define SSID_REG_800 (0x0a^bE)
#define SSID_800_VAL 0x80 /* Exactly two bits asserted at sel */
#define SSID_800_ENCID_MASK 0x07 /* Device which performed operation */
/*
* SCSI bus control lines rw,
* instantaneous readout of control lines
*/
#define SBCL_REG (0x0b^bE)
#define SBCL_REQ 0x80 /* REQ ro */
#define SBCL_ACK 0x40 /* ACK ro */
#define SBCL_BSY 0x20 /* BSY ro */
#define SBCL_SEL 0x10 /* SEL ro */
#define SBCL_ATN 0x08 /* ATN ro */
#define SBCL_MSG 0x04 /* MSG ro */
#define SBCL_CD 0x02 /* C/D ro */
#define SBCL_IO 0x01 /* I/O ro */
#define SBCL_PHASE_CMDOUT SBCL_CD
#define SBCL_PHASE_DATAIN SBCL_IO
#define SBCL_PHASE_DATAOUT 0
#define SBCL_PHASE_MSGIN (SBCL_CD|SBCL_IO|SBCL_MSG)
#define SBCL_PHASE_MSGOUT (SBCL_CD|SBCL_MSG)
#define SBCL_PHASE_STATIN (SBCL_CD|SBCL_IO)
#define SBCL_PHASE_MASK (SBCL_CD|SBCL_IO|SBCL_MSG)
/*
* Synchronous SCSI Clock Control bits
* 0 - set by DCNTL
* 1 - SCLK / 1.0
* 2 - SCLK / 1.5
* 3 - SCLK / 2.0
*/
#define SBCL_SSCF1 0x02 /* wo, -66 only */
#define SBCL_SSCF0 0x01 /* wo, -66 only */
#define SBCL_SSCF_MASK 0x03
/*
* XXX note : when reading the DSTAT and STAT registers to clear interrupts,
* insure that 10 clocks elapse between the two
*/
/* DMA status ro */
#define DSTAT_REG (0x0c^bE)
#define DSTAT_DFE 0x80 /* DMA FIFO empty */
#define DSTAT_800_MDPE 0x40 /* Master Data Parity Error */
#define DSTAT_BF 0x20 /* Bus Fault */
#define DSTAT_ABRT 0x10 /* Aborted - set on error */
#define DSTAT_SSI 0x08 /* SCRIPTS single step interrupt */
#define DSTAT_SIR 0x04 /* SCRIPTS interrupt received -
set when INT instruction is
executed */
#define DSTAT_WTD 0x02 /* Watchdog timeout detected */
#define DSTAT_OPC 0x01 /* Illegal instruction */
#define DSTAT_IID 0x01 /* Same thing, different name */
#define SSTAT0_REG (0x0d^bE) /* SCSI status 0 ro */
#define SIST0_REG_800 (0x42^bE) /* SCSI status 0 ro */
#define SSTAT0_MA 0x80 /* ini : phase mismatch,
* tgt : ATN/ asserted
*/
#define SSTAT0_CMP 0x40 /* function complete */
#define SSTAT0_700_STO 0x20 /* Selection or reselection timeout */
#define SSTAT0_800_SEL 0x20 /* Selected */
#define SSTAT0_700_SEL 0x10 /* Selected or reselected */
#define SIST0_800_RSL 0x10 /* Reselected */
#define SSTAT0_SGE 0x08 /* SCSI gross error */
#define SSTAT0_UDC 0x04 /* Unexpected disconnect */
#define SSTAT0_RST 0x02 /* SCSI RST/ received */
#define SSTAT0_PAR 0x01 /* Parity error */
#define SSTAT1_REG (0x0e^bE) /* SCSI status 1 ro */
#define SSTAT1_ILF 0x80 /* SIDL full */
#define SSTAT1_ORF 0x40 /* SODR full */
#define SSTAT1_OLF 0x20 /* SODL full */
#define SSTAT1_AIP 0x10 /* Arbitration in progress */
#define SSTAT1_LOA 0x08 /* Lost arbitration */
#define SSTAT1_WOA 0x04 /* Won arbitration */
#define SSTAT1_RST 0x02 /* Instant readout of RST/ */
#define SSTAT1_SDP 0x01 /* Instant readout of SDP/ */
#define SSTAT2_REG (0x0f^bE) /* SCSI status 2 ro */
#define SSTAT2_FF3 0x80 /* number of bytes in synchronous */
#define SSTAT2_FF2 0x40 /* data FIFO */
#define SSTAT2_FF1 0x20
#define SSTAT2_FF0 0x10
#define SSTAT2_FF_MASK 0xf0
#define SSTAT2_FF_SHIFT 4
/*
* Latched signals, latched on the leading edge of REQ/ for initiators,
* ACK/ for targets.
*/
#define SSTAT2_SDP 0x08 /* SDP */
#define SSTAT2_MSG 0x04 /* MSG */
#define SSTAT2_CD 0x02 /* C/D */
#define SSTAT2_IO 0x01 /* I/O */
#define SSTAT2_PHASE_CMDOUT SSTAT2_CD
#define SSTAT2_PHASE_DATAIN SSTAT2_IO
#define SSTAT2_PHASE_DATAOUT 0
#define SSTAT2_PHASE_MSGIN (SSTAT2_CD|SSTAT2_IO|SSTAT2_MSG)
#define SSTAT2_PHASE_MSGOUT (SSTAT2_CD|SSTAT2_MSG)
#define SSTAT2_PHASE_STATIN (SSTAT2_CD|SSTAT2_IO)
#define SSTAT2_PHASE_MASK (SSTAT2_CD|SSTAT2_IO|SSTAT2_MSG)
#define DSA_REG 0x10 /* DATA structure address */
#define CTEST0_REG_700 (0x14^bE) /* Chip test 0 ro */
#define CTEST0_REG_800 (0x18^bE) /* Chip test 0 ro */
/* 0x80 - 0x04 are reserved */
#define CTEST0_700_RTRG 0x02 /* Real target mode */
#define CTEST0_700_DDIR 0x01 /* Data direction, 1 =
* SCSI bus to host, 0 =
* host to SCSI.
*/
#define CTEST1_REG_700 (0x15^bE) /* Chip test 1 ro */
#define CTEST1_REG_800 (0x19^bE) /* Chip test 1 ro */
#define CTEST1_FMT3 0x80 /* Identify which byte lanes are empty */
#define CTEST1_FMT2 0x40 /* in the DMA FIFO */
#define CTEST1_FMT1 0x20
#define CTEST1_FMT0 0x10
#define CTEST1_FFL3 0x08 /* Identify which bytes lanes are full */
#define CTEST1_FFL2 0x04 /* in the DMA FIFO */
#define CTEST1_FFL1 0x02
#define CTEST1_FFL0 0x01
#define CTEST2_REG_700 (0x16^bE) /* Chip test 2 ro */
#define CTEST2_REG_800 (0x1a^bE) /* Chip test 2 ro */
#define CTEST2_800_DDIR 0x80 /* 1 = SCSI->host */
#define CTEST2_800_SIGP 0x40 /* A copy of SIGP in ISTAT.
Reading this register clears */
#define CTEST2_800_CIO 0x20 /* Configured as IO */.
#define CTEST2_800_CM 0x10 /* Configured as memory */
/* 0x80 - 0x40 are reserved on 700 series chips */
#define CTEST2_700_SOFF 0x20 /* SCSI Offset Compare,
* As an initiator, this bit is
* one when the synchronous offset
* is zero, as a target this bit
* is one when the synchronous
* offset is at the maximum
* defined in SXFER
*/
#define CTEST2_700_SFP 0x10 /* SCSI FIFO parity bit,
* reading CTEST3 unloads a byte
* from the FIFO and sets this
*/
#define CTEST2_700_DFP 0x08 /* DMA FIFO parity bit,
* reading CTEST6 unloads a byte
* from the FIFO and sets this
*/
#define CTEST2_TEOP 0x04 /* SCSI true end of process,
* indicates a totally finished
* transfer
*/
#define CTEST2_DREQ 0x02 /* Data request signal */
/* 0x01 is reserved on 700 series chips */
#define CTEST2_800_DACK 0x01
/*
* Chip test 3 ro
* Unloads the bottom byte of the eight deep SCSI synchronous FIFO,
* check SSTAT2 FIFO full bits to determine size. Note that a GROSS
* error results if a read is attempted on this register. Also note
* that 16 and 32 bit reads of this register will cause corruption.
*/
#define CTEST3_REG_700 (0x17^bE)
/* Chip test 3 rw */
#define CTEST3_REG_800 (0x1b^bE)
#define CTEST3_800_V3 0x80 /* Chip revision */
#define CTEST3_800_V2 0x40
#define CTEST3_800_V1 0x20
#define CTEST3_800_V0 0x10
#define CTEST3_800_FLF 0x08 /* Flush DMA FIFO */
#define CTEST3_800_CLF 0x04 /* Clear DMA FIFO */
#define CTEST3_800_FM 0x02 /* Fetch mode pin */
/* bit 0 is reserved on 800 series chips */
#define CTEST4_REG_700 (0x18^bE) /* Chip test 4 rw */
#define CTEST4_REG_800 (0x21^bE) /* Chip test 4 rw */
/* 0x80 is reserved on 700 series chips */
#define CTEST4_800_BDIS 0x80 /* Burst mode disable */
#define CTEST4_ZMOD 0x40 /* High impedance mode */
#define CTEST4_SZM 0x20 /* SCSI bus high impedance */
#define CTEST4_700_SLBE 0x10 /* SCSI loopback enabled */
#define CTEST4_800_SRTM 0x10 /* Shadow Register Test Mode */
#define CTEST4_700_SFWR 0x08 /* SCSI FIFO write enable,
* redirects writes from SODL
* to the SCSI FIFO.
*/
#define CTEST4_800_MPEE 0x08 /* Enable parity checking
during master cycles on PCI
bus */
/*
* These bits send the contents of the CTEST6 register to the appropriate
* byte lane of the 32 bit DMA FIFO. Normal operation is zero, otherwise
* the high bit means the low two bits select the byte lane.
*/
#define CTEST4_FBL2 0x04
#define CTEST4_FBL1 0x02
#define CTEST4_FBL0 0x01
#define CTEST4_FBL_MASK 0x07
#define CTEST4_FBL_0 0x04 /* Select DMA FIFO byte lane 0 */
#define CTEST4_FBL_1 0x05 /* Select DMA FIFO byte lane 1 */
#define CTEST4_FBL_2 0x06 /* Select DMA FIFO byte lane 2 */
#define CTEST4_FBL_3 0x07 /* Select DMA FIFO byte lane 3 */
#define CTEST4_800_SAVE (CTEST4_800_BDIS)
#define CTEST5_REG_700 (0x19^bE) /* Chip test 5 rw */
#define CTEST5_REG_800 (0x22^bE) /* Chip test 5 rw */
/*
* Clock Address Incrementor. When set, it increments the
* DNAD register to the next bus size boundary. It automatically
* resets itself when the operation is complete.
*/
#define CTEST5_ADCK 0x80
/*
* Clock Byte Counter. When set, it decrements the DBC register to
* the next bus size boundary.
*/
#define CTEST5_BBCK 0x40
/*
* Reset SCSI Offset. Setting this bit to 1 clears the current offset
* pointer in the SCSI synchronous offset counter (SSTAT). This bit
* is set to 1 if a SCSI Gross Error Condition occurs. The offset should
* be cleared when a synchronous transfer fails. When written, it is
* automatically cleared after the SCSI synchronous offset counter is
* reset.
*/
/* Bit 5 is reserved on 800 series chips */
#define CTEST5_700_ROFF 0x20
/*
* Master Control for Set or Reset pulses. When 1, causes the low
* four bits of register to set when set, 0 causes the low bits to
* clear when set.
*/
#define CTEST5_MASR 0x10
#define CTEST5_DDIR 0x08 /* DMA direction */
/*
* Bits 2-0 are reserved on 800 series chips
*/
#define CTEST5_700_EOP 0x04 /* End of process */
#define CTEST5_700_DREQ 0x02 /* Data request */
#define CTEST5_700_DACK 0x01 /* Data acknowledge */
/*
* Chip test 6 rw - writing to this register writes to the byte
* lane in the DMA FIFO as determined by the FBL bits in the CTEST4
* register.
*/
#define CTEST6_REG_700 (0x1a^bE)
#define CTEST6_REG_800 (0x23^bE)
#define CTEST7_REG (0x1b^bE) /* Chip test 7 rw */
#define CTEST7_10_CDIS 0x80 /* Cache burst disable */
#define CTEST7_10_SC1 0x40 /* Snoop control bits */
#define CTEST7_10_SC0 0x20
#define CTEST7_10_SC_MASK 0x60
#define CTEST7_STD 0x10 /* Selection timeout disable */
#define CTEST7_DFP 0x08 /* DMA FIFO parity bit for CTEST6 */
#define CTEST7_EVP 0x04 /* 1 = host bus even parity, 0 = odd */
#define CTEST7_10_TT1 0x02 /* Transfer type */
#define CTEST7_DIFF 0x01 /* Differential mode */
#define CTEST7_SAVE ( CTEST7_EVP | CTEST7_DIFF )
#define TEMP_REG 0x1c /* through 0x1f Temporary stack rw */
#define DFIFO_REG (0x20^bE) /* DMA FIFO rw */
/*
* 0x80 is reserved on the NCR53c710, the CLF and FLF bits have been
* moved into the CTEST8 register.
*/
#define DFIFO_BO6 0x40
#define DFIFO_BO5 0x20
#define DFIFO_BO4 0x10
#define DFIFO_BO3 0x08
#define DFIFO_BO2 0x04
#define DFIFO_BO1 0x02
#define DFIFO_BO0 0x01
#define DFIFO_10_BO_MASK 0x7f /* 7 bit counter */
/*
* Interrupt status rw
* Note that this is the only register which can be read while SCSI
* SCRIPTS are being executed.
*/
#define ISTAT_REG_700 (0x21^bE)
#define ISTAT_REG_800 (0x14^bE)
#define ISTAT_ABRT 0x80 /* Software abort, write
*1 to abort, wait for interrupt. */
#define ISTAT_10_SRST 0x40 /* software reset */
#define ISTAT_10_SIGP 0x20 /* signal script */
#define ISTAT_CON 0x08 /* 1 when connected */
#define ISTAT_800_INTF 0x04 /* Interrupt on the fly */
#define ISTAT_700_PRE 0x04 /* Pointer register empty.
* Set to 1 when DSPS and DSP
* registers are empty in pipeline
* mode, always set otherwise.
*/
#define ISTAT_SIP 0x02 /* SCSI interrupt pending from
* SCSI portion of SIOP see
* SSTAT0
*/
#define ISTAT_DIP 0x01 /* DMA interrupt pending
* see DSTAT
*/
#define CTEST8_REG (0x22^bE) /* Chip test 8 rw */
#define CTEST8_10_V3 0x80 /* Chip revision */
#define CTEST8_10_V2 0x40
#define CTEST8_10_V1 0x20
#define CTEST8_10_V0 0x10
#define CTEST8_10_V_MASK 0xf0
#define CTEST8_10_FLF 0x08 /* Flush FIFOs */
#define CTEST8_10_CLF 0x04 /* Clear FIFOs */
#define CTEST8_10_FM 0x02 /* Fetch pin mode */
#define CTEST8_10_SM 0x01 /* Snoop pin mode */
#define LCRC_REG_10 (0x23^bE)
/*
* 0x24 through 0x27 are the DMA byte counter register. Instructions
* write their high 8 bits into the DCMD register, the low 24 bits into
* the DBC register.
*
* Function is dependent on the command type being executed.
*/
#define DBC_REG 0x24
/*
* For Block Move Instructions, DBC is a 24 bit quantity representing
* the number of bytes to transfer.
* For Transfer Control Instructions, DBC is bit fielded as follows :
*/
/* Bits 20 - 23 should be clear */
#define DBC_TCI_TRUE (1 << 19) /* Jump when true */
#define DBC_TCI_COMPARE_DATA (1 << 18) /* Compare data */
#define DBC_TCI_COMPARE_PHASE (1 << 17) /* Compare phase with DCMD field */
#define DBC_TCI_WAIT_FOR_VALID (1 << 16) /* Wait for REQ */
/* Bits 8 - 15 are reserved on some implementations ? */
#define DBC_TCI_MASK_MASK 0xff00 /* Mask for data compare */
#define DBC_TCI_MASK_SHIFT 8
#define DBC_TCI_DATA_MASK 0xff /* Data to be compared */
#define DBC_TCI_DATA_SHIFT 0
#define DBC_RWRI_IMMEDIATE_MASK 0xff00 /* Immediate data */
#define DBC_RWRI_IMMEDIATE_SHIFT 8 /* Amount to shift */
#define DBC_RWRI_ADDRESS_MASK 0x3f0000 /* Register address */
#define DBC_RWRI_ADDRESS_SHIFT 16
/*
* DMA command r/w
*/
#define DCMD_REG (0x27^bE)
#define DCMD_TYPE_MASK 0xc0 /* Masks off type */
#define DCMD_TYPE_BMI 0x00 /* Indicates a Block Move instruction */
#define DCMD_BMI_IO 0x01 /* I/O, CD, and MSG bits selecting */
#define DCMD_BMI_CD 0x02 /* the phase for the block MOVE */
#define DCMD_BMI_MSG 0x04 /* instruction */
#define DCMD_BMI_OP_MASK 0x18 /* mask for opcode */
#define DCMD_BMI_OP_MOVE_T 0x00 /* MOVE */
#define DCMD_BMI_OP_MOVE_I 0x08 /* MOVE Initiator */
#define DCMD_BMI_INDIRECT 0x20 /* Indirect addressing */
#define DCMD_TYPE_TCI 0x80 /* Indicates a Transfer Control
instruction */
#define DCMD_TCI_IO 0x01 /* I/O, CD, and MSG bits selecting */
#define DCMD_TCI_CD 0x02 /* the phase for the block MOVE */
#define DCMD_TCI_MSG 0x04 /* instruction */
#define DCMD_TCI_OP_MASK 0x38 /* mask for opcode */
#define DCMD_TCI_OP_JUMP 0x00 /* JUMP */
#define DCMD_TCI_OP_CALL 0x08 /* CALL */
#define DCMD_TCI_OP_RETURN 0x10 /* RETURN */
#define DCMD_TCI_OP_INT 0x18 /* INT */
#define DCMD_TYPE_RWRI 0x40 /* Indicates I/O or register Read/Write
instruction */
#define DCMD_RWRI_OPC_MASK 0x38 /* Opcode mask */
#define DCMD_RWRI_OPC_WRITE 0x28 /* Write SFBR to register */
#define DCMD_RWRI_OPC_READ 0x30 /* Read register to SFBR */
#define DCMD_RWRI_OPC_MODIFY 0x38 /* Modify in place */
#define DCMD_RWRI_OP_MASK 0x07
#define DCMD_RWRI_OP_MOVE 0x00
#define DCMD_RWRI_OP_SHL 0x01
#define DCMD_RWRI_OP_OR 0x02
#define DCMD_RWRI_OP_XOR 0x03
#define DCMD_RWRI_OP_AND 0x04
#define DCMD_RWRI_OP_SHR 0x05
#define DCMD_RWRI_OP_ADD 0x06
#define DCMD_RWRI_OP_ADDC 0x07
#define DCMD_TYPE_MMI 0xc0 /* Indicates a Memory Move instruction
(three words) */
#define DNAD_REG 0x28 /* through 0x2b DMA next address for
data */
#define DSP_REG 0x2c /* through 0x2f DMA SCRIPTS pointer rw */
#define DSPS_REG 0x30 /* through 0x33 DMA SCRIPTS pointer
save rw */
#define DMODE_BL1 0x80 /* Burst length bits */
#define DMODE_BL0 0x40
#define DMODE_BL_MASK 0xc0
/* Burst lengths (800) */
#define DMODE_BL_2 0x00 /* 2 transfer */
#define DMODE_BL_4 0x40 /* 4 transfers */
#define DMODE_BL_8 0x80 /* 8 transfers */
#define DMODE_BL_16 0xc0 /* 16 transfers */
#define DMODE_10_BL_1 0x00 /* 1 transfer */
#define DMODE_10_BL_2 0x40 /* 2 transfers */
#define DMODE_10_BL_4 0x80 /* 4 transfers */
#define DMODE_10_BL_8 0xc0 /* 8 transfers */
#define DMODE_10_FC2 0x20 /* Driven to FC2 pin */
#define DMODE_10_FC1 0x10 /* Driven to FC1 pin */
#define DMODE_710_PD 0x08 /* Program/data on FC0 pin */
#define DMODE_710_UO 0x02 /* User prog. output */
#define DMODE_MAN 0x01 /* Manual start mode,
* requires a 1 to be written
* to the start DMA bit in the DCNTL
* register to run scripts
*/
/* NCR53c800 series only */
#define SCRATCHA_REG_800 0x34 /* through 0x37 Scratch A rw */
/* NCR53c710 only */
#define SCRATCHB_REG_10 0x34 /* through 0x37 scratch rw */
#define DMODE_REG (0x38^bE) /* DMA mode rw, NCR53c710 and newer */
#define DMODE_800_SIOM 0x20 /* Source IO = 1 */
#define DMODE_800_DIOM 0x10 /* Destination IO = 1 */
#define DMODE_800_ERL 0x08 /* Enable Read Line */
#define DIEN_REG (0x39^bE) /* DMA interrupt enable rw */
/* 0x80, 0x40, and 0x20 are reserved on 700-series chips */
#define DIEN_800_MDPE 0x40 /* Master data parity error */
#define DIEN_800_BF 0x20 /* BUS fault */
#define DIEN_700_BF 0x20 /* BUS fault */
#define DIEN_ABRT 0x10 /* Enable aborted interrupt */
#define DIEN_SSI 0x08 /* Enable single step interrupt */
#define DIEN_SIR 0x04 /* Enable SCRIPTS INT command
* interrupt
*/
#define DIEN_700_WTD 0x02 /* Enable watchdog timeout interrupt */
#define DIEN_700_OPC 0x01 /* Enable illegal instruction
* interrupt
*/
#define DIEN_800_IID 0x01 /* Same meaning, different name */
/*
* DMA watchdog timer rw
* set in 16 CLK input periods.
*/
#define DWT_REG (0x3a^bE)
/* DMA control rw */
#define DCNTL_REG (0x3b^bE)
#define DCNTL_700_CF1 0x80 /* Clock divisor bits */
#define DCNTL_700_CF0 0x40
#define DCNTL_700_CF_MASK 0xc0
/* Clock divisors Divisor SCLK range (MHZ) */
#define DCNTL_700_CF_2 0x00 /* 2.0 37.51-50.00 */
#define DCNTL_700_CF_1_5 0x40 /* 1.5 25.01-37.50 */
#define DCNTL_700_CF_1 0x80 /* 1.0 16.67-25.00 */
#define DCNTL_700_CF_3 0xc0 /* 3.0 50.01-66.67 (53c700-66) */
#define DCNTL_700_S16 0x20 /* Load scripts 16 bits at a time */
#define DCNTL_SSM 0x10 /* Single step mode */
#define DCNTL_700_LLM 0x08 /* Low level mode, can only be set
* after selection */
#define DCNTL_800_IRQM 0x08 /* Totem pole IRQ pin */
#define DCNTL_STD 0x04 /* Start DMA / SCRIPTS */
/* 0x02 is reserved */
#define DCNTL_10_COM 0x01 /* 700 software compatibility mode */
#define DCNTL_10_EA 0x20 /* Enable Ack - needed for MVME16x */
#define SCRATCHB_REG_800 0x5c /* through 0x5f scratch b rw */
/* NCR53c710 only */
#define ADDER_REG_10 0x3c /* Adder, NCR53c710 only */
#define SIEN1_REG_800 (0x41^bE)
#define SIEN1_800_STO 0x04 /* selection/reselection timeout */
#define SIEN1_800_GEN 0x02 /* general purpose timer */
#define SIEN1_800_HTH 0x01 /* handshake to handshake */
#define SIST1_REG_800 (0x43^bE)
#define SIST1_800_STO 0x04 /* selection/reselection timeout */
#define SIST1_800_GEN 0x02 /* general purpose timer */
#define SIST1_800_HTH 0x01 /* handshake to handshake */
#define SLPAR_REG_800 (0x44^bE) /* Parity */
#define MACNTL_REG_800 (0x46^bE) /* Memory access control */
#define MACNTL_800_TYP3 0x80
#define MACNTL_800_TYP2 0x40
#define MACNTL_800_TYP1 0x20
#define MACNTL_800_TYP0 0x10
#define MACNTL_800_DWR 0x08
#define MACNTL_800_DRD 0x04
#define MACNTL_800_PSCPT 0x02
#define MACNTL_800_SCPTS 0x01
#define GPCNTL_REG_800 (0x47^bE) /* General Purpose Pin Control */
/* Timeouts are expressed such that 0=off, 1=100us, doubling after that */
#define STIME0_REG_800 (0x48^bE) /* SCSI Timer Register 0 */
#define STIME0_800_HTH_MASK 0xf0 /* Handshake to Handshake timeout */
#define STIME0_800_HTH_SHIFT 4
#define STIME0_800_SEL_MASK 0x0f /* Selection timeout */
#define STIME0_800_SEL_SHIFT 0
#define STIME1_REG_800 (0x49^bE)
#define STIME1_800_GEN_MASK 0x0f /* General purpose timer */
#define RESPID_REG_800 (0x4a^bE) /* Response ID, bit fielded. 8
bits on narrow chips, 16 on WIDE */
#define STEST0_REG_800 (0x4c^bE)
#define STEST0_800_SLT 0x08 /* Selection response logic test */
#define STEST0_800_ART 0x04 /* Arbitration priority encoder test */
#define STEST0_800_SOZ 0x02 /* Synchronous offset zero */
#define STEST0_800_SOM 0x01 /* Synchronous offset maximum */
#define STEST1_REG_800 (0x4d^bE)
#define STEST1_800_SCLK 0x80 /* Disable SCSI clock */
#define STEST2_REG_800 (0x4e^bE)
#define STEST2_800_SCE 0x80 /* Enable SOCL/SODL */
#define STEST2_800_ROF 0x40 /* Reset SCSI sync offset */
#define STEST2_800_SLB 0x10 /* Enable SCSI loopback mode */
#define STEST2_800_SZM 0x08 /* SCSI high impedance mode */
#define STEST2_800_EXT 0x02 /* Extend REQ/ACK filter 30 to 60ns */
#define STEST2_800_LOW 0x01 /* SCSI low level mode */
#define STEST3_REG_800 (0x4f^bE)
#define STEST3_800_TE 0x80 /* Enable active negation */
#define STEST3_800_STR 0x40 /* SCSI FIFO test read */
#define STEST3_800_HSC 0x20 /* Halt SCSI clock */
#define STEST3_800_DSI 0x10 /* Disable single initiator response */
#define STEST3_800_TTM 0x04 /* Time test mode */
#define STEST3_800_CSF 0x02 /* Clear SCSI FIFO */
#define STEST3_800_STW 0x01 /* SCSI FIFO test write */
#define ISTAT_REG ISTAT_REG_700
#define SCRATCH_REG SCRATCHB_REG_10
#define ADDER_REG ADDER_REG_10
#define SIEN_REG SIEN_REG_700
#define SDID_REG SDID_REG_700
#define CTEST0_REG CTEST0_REG_700
#define CTEST1_REG CTEST1_REG_700
#define CTEST2_REG CTEST2_REG_700
#define CTEST3_REG CTEST3_REG_700
#define CTEST4_REG CTEST4_REG_700
#define CTEST5_REG CTEST5_REG_700
#define CTEST6_REG CTEST6_REG_700
#define SODL_REG SODL_REG_700
#define SBDL_REG SBDL_REG_700
#define SIDL_REG SIDL_REG_700
#define LCRC_REG LCRC_REG_10
#ifdef MEM_MAPPED
#define NCR_read8(address) \
(unsigned int)readb((u32)(host->base) + ((u32)(address)))
#define NCR_read32(address) \
(unsigned int) readl((u32)(host->base) + (u32)(address))
#define NCR_write8(address,value) \
{ DEB(DEB_REGS, printk("NCR: %02x => %08x\n", (u32)(value), ((u32)(host->base) + (u32)(address)))); \
*(volatile unsigned char *) \
((u32)(host->base) + (u32)(address)) = (value); }
#define NCR_write32(address,value) \
{ DEB(DEB_REGS, printk("NCR: %08x => %08x\n", (u32)(value), ((u32)(host->base) + (u32)(address)))); \
*(volatile unsigned long *) \
((u32)(host->base) + (u32)(address)) = (value); }
#else
#define NCR_read8(address) \
inb((u32)(host->base) + (address))
#define NCR_read32(address) \
inl((u32)(host->base) + (address))
#define NCR_write8(address,value) \
{ DEB(DEB_REGS, printk("NCR: %02x => %08x\n", (u32)(value), ((u32)(host->base) + (u32)(address)))); \
outb((value), (u32)(host->base) + (u32)(address)); }
#define NCR_write32(address,value) \
{ DEB(DEB_REGS, printk("NCR: %08x => %08x\n", (u32)(value), ((u32)(host->base) + (u32)(address)))); \
outl((value), (u32)(host->base) + (u32)(address)); }
#endif
/* Patch arbitrary 32 bit words in the script */
#define patch_abs_32(script, offset, symbol, value) \
for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
(u32)); ++i) { \
(script)[A_##symbol##_used[i] - (offset)] += (value); \
DEB(DEB_FIXUP, printk("scsi%d: %s reference %d at 0x%x in %s is now 0x%x\n",\
host->host_no, #symbol, i, A_##symbol##_used[i] - \
(int)(offset), #script, (script)[A_##symbol##_used[i] - \
(offset)])); \
}
#endif
#endif
/*
* sim710.scr - Copyright (C) 1999 Richard Hirst
*/
/* Offsets from DSA, allow 128 elements of scatter/gather */
ABSOLUTE dsa_select = 0
ABSOLUTE dsa_msgout = 8
ABSOLUTE dsa_cmnd = 16
ABSOLUTE dsa_status = 24
ABSOLUTE dsa_msgin = 32
ABSOLUTE dsa_datain = 40 /* 8 * 128 = 1024 bytes */
ABSOLUTE dsa_dataout = 1064 /* 8 * 128 = 1024 bytes */
ABSOLUTE dsa_size = 2088
ABSOLUTE reselected_identify = 0
ABSOLUTE msgin_buf = 0
ABSOLUTE msg_reject = 0
ABSOLUTE test1_src = 0
ABSOLUTE test1_dst = 0
/* Interrupt values passed back to driver */
ABSOLUTE int_bad_msg1 = 0xab930006
ABSOLUTE int_bad_msg2 = 0xab930007
ABSOLUTE int_bad_msg3 = 0xab930008
ABSOLUTE int_cmd_bad_phase = 0xab930009
ABSOLUTE int_cmd_complete = 0xab93000a
ABSOLUTE int_data_bad_phase = 0xab93000b
ABSOLUTE int_msg_sdtr1 = 0xab93000c
ABSOLUTE int_msg_sdtr2 = 0xab93000d
ABSOLUTE int_msg_sdtr3 = 0xab93000e
ABSOLUTE int_no_msgout1 = 0xab93000f
ABSOLUTE int_no_msgout2 = 0xab930010
ABSOLUTE int_no_msgout3 = 0xab930011
ABSOLUTE int_not_cmd_complete = 0xab930012
ABSOLUTE int_sel_no_ident = 0xab930013
ABSOLUTE int_sel_not_cmd = 0xab930014
ABSOLUTE int_status_not_msgin = 0xab930015
ABSOLUTE int_resel_not_msgin = 0xab930016
ABSOLUTE int_reselected = 0xab930017
ABSOLUTE int_selected = 0xab930018
ABSOLUTE int_disc1 = 0xab930019
ABSOLUTE int_disc2 = 0xab93001a
ABSOLUTE int_disc3 = 0xab93001b
ABSOLUTE int_not_rej = 0xab93001c
ABSOLUTE int_test1 = 0xab93001d
/* Bit field settings used to record status in SCRATCH0 */
ABSOLUTE had_select = 0x01
ABSOLUTE had_msgout = 0x02
ABSOLUTE had_cmdout = 0x04
ABSOLUTE had_datain = 0x08
ABSOLUTE had_dataout = 0x10
ABSOLUTE had_status = 0x20
ABSOLUTE had_msgin = 0x40
ABSOLUTE had_extmsg = 0x80
/* Bit field settings used to record status in SCRATCH1 */
ABSOLUTE did_reject = 0x01
/* These scripts are heavily based on the examples in the NCR 53C710
* Programmer's Guide (Preliminary).
*/
ENTRY do_select
do_select:
CLEAR TARGET
; Enable selection timer
MOVE CTEST7 & 0xef TO CTEST7
SELECT ATN FROM dsa_select, reselect
JUMP get_status, WHEN STATUS
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
MOVE SCRATCH0 | had_select TO SCRATCH0
INT int_sel_no_ident, IF NOT MSG_OUT
MOVE SCRATCH0 | had_msgout TO SCRATCH0
MOVE FROM dsa_msgout, when MSG_OUT
ENTRY done_ident
done_ident:
JUMP get_status, IF STATUS
redo_msgin1:
JUMP get_msgin1, WHEN MSG_IN
INT int_sel_not_cmd, IF NOT CMD
ENTRY resume_cmd
resume_cmd:
MOVE SCRATCH0 | had_cmdout TO SCRATCH0
MOVE FROM dsa_cmnd, WHEN CMD
ENTRY resume_pmm
resume_pmm:
redo_msgin2:
JUMP get_msgin2, WHEN MSG_IN
JUMP get_status, IF STATUS
JUMP input_data, IF DATA_IN
JUMP output_data, IF DATA_OUT
INT int_cmd_bad_phase
get_status:
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
MOVE FROM dsa_status, WHEN STATUS
INT int_status_not_msgin, WHEN NOT MSG_IN
MOVE FROM dsa_msgin, WHEN MSG_IN
INT int_not_cmd_complete, IF NOT 0x00
CLEAR ACK
ENTRY wait_disc_complete
wait_disc_complete:
WAIT DISCONNECT
INT int_cmd_complete
input_data:
MOVE SCRATCH0 | had_datain TO SCRATCH0
ENTRY patch_input_data
patch_input_data:
JUMP 0
MOVE FROM dsa_datain+0x0000, WHEN DATA_IN
MOVE FROM dsa_datain+0x0008, WHEN DATA_IN
MOVE FROM dsa_datain+0x0010, WHEN DATA_IN
MOVE FROM dsa_datain+0x0018, WHEN DATA_IN
MOVE FROM dsa_datain+0x0020, WHEN DATA_IN
MOVE FROM dsa_datain+0x0028, WHEN DATA_IN
MOVE FROM dsa_datain+0x0030, WHEN DATA_IN
MOVE FROM dsa_datain+0x0038, WHEN DATA_IN
MOVE FROM dsa_datain+0x0040, WHEN DATA_IN
MOVE FROM dsa_datain+0x0048, WHEN DATA_IN
MOVE FROM dsa_datain+0x0050, WHEN DATA_IN
MOVE FROM dsa_datain+0x0058, WHEN DATA_IN
MOVE FROM dsa_datain+0x0060, WHEN DATA_IN
MOVE FROM dsa_datain+0x0068, WHEN DATA_IN
MOVE FROM dsa_datain+0x0070, WHEN DATA_IN
MOVE FROM dsa_datain+0x0078, WHEN DATA_IN
MOVE FROM dsa_datain+0x0080, WHEN DATA_IN
MOVE FROM dsa_datain+0x0088, WHEN DATA_IN
MOVE FROM dsa_datain+0x0090, WHEN DATA_IN
MOVE FROM dsa_datain+0x0098, WHEN DATA_IN
MOVE FROM dsa_datain+0x00a0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00a8, WHEN DATA_IN
MOVE FROM dsa_datain+0x00b0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00b8, WHEN DATA_IN
MOVE FROM dsa_datain+0x00c0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00c8, WHEN DATA_IN
MOVE FROM dsa_datain+0x00d0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00d8, WHEN DATA_IN
MOVE FROM dsa_datain+0x00e0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00e8, WHEN DATA_IN
MOVE FROM dsa_datain+0x00f0, WHEN DATA_IN
MOVE FROM dsa_datain+0x00f8, WHEN DATA_IN
MOVE FROM dsa_datain+0x0100, WHEN DATA_IN
MOVE FROM dsa_datain+0x0108, WHEN DATA_IN
MOVE FROM dsa_datain+0x0110, WHEN DATA_IN
MOVE FROM dsa_datain+0x0118, WHEN DATA_IN
MOVE FROM dsa_datain+0x0120, WHEN DATA_IN
MOVE FROM dsa_datain+0x0128, WHEN DATA_IN
MOVE FROM dsa_datain+0x0130, WHEN DATA_IN
MOVE FROM dsa_datain+0x0138, WHEN DATA_IN
MOVE FROM dsa_datain+0x0140, WHEN DATA_IN
MOVE FROM dsa_datain+0x0148, WHEN DATA_IN
MOVE FROM dsa_datain+0x0150, WHEN DATA_IN
MOVE FROM dsa_datain+0x0158, WHEN DATA_IN
MOVE FROM dsa_datain+0x0160, WHEN DATA_IN
MOVE FROM dsa_datain+0x0168, WHEN DATA_IN
MOVE FROM dsa_datain+0x0170, WHEN DATA_IN
MOVE FROM dsa_datain+0x0178, WHEN DATA_IN
MOVE FROM dsa_datain+0x0180, WHEN DATA_IN
MOVE FROM dsa_datain+0x0188, WHEN DATA_IN
MOVE FROM dsa_datain+0x0190, WHEN DATA_IN
MOVE FROM dsa_datain+0x0198, WHEN DATA_IN
MOVE FROM dsa_datain+0x01a0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01a8, WHEN DATA_IN
MOVE FROM dsa_datain+0x01b0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01b8, WHEN DATA_IN
MOVE FROM dsa_datain+0x01c0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01c8, WHEN DATA_IN
MOVE FROM dsa_datain+0x01d0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01d8, WHEN DATA_IN
MOVE FROM dsa_datain+0x01e0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01e8, WHEN DATA_IN
MOVE FROM dsa_datain+0x01f0, WHEN DATA_IN
MOVE FROM dsa_datain+0x01f8, WHEN DATA_IN
MOVE FROM dsa_datain+0x0200, WHEN DATA_IN
MOVE FROM dsa_datain+0x0208, WHEN DATA_IN
MOVE FROM dsa_datain+0x0210, WHEN DATA_IN
MOVE FROM dsa_datain+0x0218, WHEN DATA_IN
MOVE FROM dsa_datain+0x0220, WHEN DATA_IN
MOVE FROM dsa_datain+0x0228, WHEN DATA_IN
MOVE FROM dsa_datain+0x0230, WHEN DATA_IN
MOVE FROM dsa_datain+0x0238, WHEN DATA_IN
MOVE FROM dsa_datain+0x0240, WHEN DATA_IN
MOVE FROM dsa_datain+0x0248, WHEN DATA_IN
MOVE FROM dsa_datain+0x0250, WHEN DATA_IN
MOVE FROM dsa_datain+0x0258, WHEN DATA_IN
MOVE FROM dsa_datain+0x0260, WHEN DATA_IN
MOVE FROM dsa_datain+0x0268, WHEN DATA_IN
MOVE FROM dsa_datain+0x0270, WHEN DATA_IN
MOVE FROM dsa_datain+0x0278, WHEN DATA_IN
MOVE FROM dsa_datain+0x0280, WHEN DATA_IN
MOVE FROM dsa_datain+0x0288, WHEN DATA_IN
MOVE FROM dsa_datain+0x0290, WHEN DATA_IN
MOVE FROM dsa_datain+0x0298, WHEN DATA_IN
MOVE FROM dsa_datain+0x02a0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02a8, WHEN DATA_IN
MOVE FROM dsa_datain+0x02b0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02b8, WHEN DATA_IN
MOVE FROM dsa_datain+0x02c0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02c8, WHEN DATA_IN
MOVE FROM dsa_datain+0x02d0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02d8, WHEN DATA_IN
MOVE FROM dsa_datain+0x02e0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02e8, WHEN DATA_IN
MOVE FROM dsa_datain+0x02f0, WHEN DATA_IN
MOVE FROM dsa_datain+0x02f8, WHEN DATA_IN
MOVE FROM dsa_datain+0x0300, WHEN DATA_IN
MOVE FROM dsa_datain+0x0308, WHEN DATA_IN
MOVE FROM dsa_datain+0x0310, WHEN DATA_IN
MOVE FROM dsa_datain+0x0318, WHEN DATA_IN
MOVE FROM dsa_datain+0x0320, WHEN DATA_IN
MOVE FROM dsa_datain+0x0328, WHEN DATA_IN
MOVE FROM dsa_datain+0x0330, WHEN DATA_IN
MOVE FROM dsa_datain+0x0338, WHEN DATA_IN
MOVE FROM dsa_datain+0x0340, WHEN DATA_IN
MOVE FROM dsa_datain+0x0348, WHEN DATA_IN
MOVE FROM dsa_datain+0x0350, WHEN DATA_IN
MOVE FROM dsa_datain+0x0358, WHEN DATA_IN
MOVE FROM dsa_datain+0x0360, WHEN DATA_IN
MOVE FROM dsa_datain+0x0368, WHEN DATA_IN
MOVE FROM dsa_datain+0x0370, WHEN DATA_IN
MOVE FROM dsa_datain+0x0378, WHEN DATA_IN
MOVE FROM dsa_datain+0x0380, WHEN DATA_IN
MOVE FROM dsa_datain+0x0388, WHEN DATA_IN
MOVE FROM dsa_datain+0x0390, WHEN DATA_IN
MOVE FROM dsa_datain+0x0398, WHEN DATA_IN
MOVE FROM dsa_datain+0x03a0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03a8, WHEN DATA_IN
MOVE FROM dsa_datain+0x03b0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03b8, WHEN DATA_IN
MOVE FROM dsa_datain+0x03c0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03c8, WHEN DATA_IN
MOVE FROM dsa_datain+0x03d0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03d8, WHEN DATA_IN
MOVE FROM dsa_datain+0x03e0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03e8, WHEN DATA_IN
MOVE FROM dsa_datain+0x03f0, WHEN DATA_IN
MOVE FROM dsa_datain+0x03f8, WHEN DATA_IN
JUMP end_data_trans
output_data:
MOVE SCRATCH0 | had_dataout TO SCRATCH0
ENTRY patch_output_data
patch_output_data:
JUMP 0
MOVE FROM dsa_dataout+0x0000, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0008, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0010, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0018, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0020, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0028, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0030, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0038, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0040, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0048, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0050, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0058, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0060, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0068, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0070, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0078, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0080, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0088, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0090, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0098, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00a0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00a8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00b0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00b8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00c0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00c8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00d0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00d8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00e0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00e8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00f0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x00f8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0100, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0108, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0110, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0118, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0120, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0128, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0130, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0138, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0140, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0148, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0150, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0158, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0160, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0168, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0170, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0178, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0180, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0188, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0190, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0198, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01a0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01a8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01b0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01b8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01c0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01c8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01d0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01d8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01e0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01e8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01f0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x01f8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0200, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0208, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0210, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0218, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0220, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0228, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0230, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0238, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0240, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0248, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0250, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0258, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0260, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0268, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0270, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0278, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0280, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0288, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0290, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0298, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02a0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02a8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02b0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02b8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02c0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02c8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02d0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02d8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02e0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02e8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02f0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x02f8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0300, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0308, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0310, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0318, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0320, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0328, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0330, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0338, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0340, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0348, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0350, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0358, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0360, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0368, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0370, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0378, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0380, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0388, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0390, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x0398, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03a0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03a8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03b0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03b8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03c0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03c8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03d0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03d8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03e0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03e8, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03f0, WHEN DATA_OUT
MOVE FROM dsa_dataout+0x03f8, WHEN DATA_OUT
ENTRY end_data_trans
end_data_trans:
redo_msgin3:
JUMP get_status, WHEN STATUS
JUMP get_msgin3, WHEN MSG_IN
INT int_data_bad_phase
get_msgin1:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
MOVE 1, msgin_buf, WHEN MSG_IN
JUMP ext_msg1, IF 0x01 ; Extended Message
JUMP ignore_msg1, IF 0x02 ; Save Data Pointers
JUMP ignore_msg1, IF 0x03 ; Save Restore Pointers
JUMP disc1, IF 0x04 ; Disconnect
INT int_bad_msg1
ignore_msg1:
CLEAR ACK
JUMP redo_msgin1
ext_msg1:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
CLEAR ACK
MOVE 1, msgin_buf + 1, WHEN MSG_IN
JUMP reject_msg1, IF NOT 0x03 ; Only handle SDTR
CLEAR ACK
MOVE 1, msgin_buf + 2, WHEN MSG_IN
JUMP reject_msg1, IF NOT 0x01 ; Only handle SDTR
CLEAR ACK
MOVE 2, msgin_buf + 3, WHEN MSG_IN
INT int_msg_sdtr1
reject_msg1:
MOVE SCRATCH1 | did_reject TO SCRATCH1
SET ATN
CLEAR ACK
JUMP reject_msg1a, WHEN NOT MSG_IN
MOVE 1, msgin_buf + 7, WHEN MSG_IN
JUMP reject_msg1
reject_msg1a:
MOVE 1, msg_reject, WHEN MSG_OUT
JUMP redo_msgin1
disc1:
CLEAR ACK
ENTRY wait_disc1
wait_disc1:
WAIT DISCONNECT
INT int_disc1
ENTRY resume_msgin1a
resume_msgin1a:
CLEAR ACK
JUMP redo_msgin1
ENTRY resume_msgin1b
resume_msgin1b:
SET ATN
CLEAR ACK
INT int_no_msgout1, WHEN NOT MSG_OUT
MOVE SCRATCH0 | had_msgout TO SCRATCH0
MOVE FROM dsa_msgout, when MSG_OUT
JUMP redo_msgin1
get_msgin2:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
MOVE 1, msgin_buf, WHEN MSG_IN
JUMP ext_msg2, IF 0x01 ; Extended Message
JUMP ignore_msg2, IF 0x02 ; Save Data Pointers
JUMP ignore_msg2, IF 0x03 ; Save Restore Pointers
JUMP disc2, IF 0x04 ; Disconnect
INT int_bad_msg2
ignore_msg2:
CLEAR ACK
JUMP redo_msgin2
ext_msg2:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
CLEAR ACK
MOVE 1, msgin_buf + 1, WHEN MSG_IN
JUMP reject_msg2, IF NOT 0x03 ; Only handle SDTR
CLEAR ACK
MOVE 1, msgin_buf + 2, WHEN MSG_IN
JUMP reject_msg2, IF NOT 0x01 ; Only handle SDTR
CLEAR ACK
MOVE 2, msgin_buf + 3, WHEN MSG_IN
INT int_msg_sdtr2
reject_msg2:
MOVE SCRATCH1 | did_reject TO SCRATCH1
SET ATN
CLEAR ACK
JUMP reject_msg2a, WHEN NOT MSG_IN
MOVE 1, msgin_buf + 7, WHEN MSG_IN
JUMP reject_msg2
reject_msg2a:
MOVE 1, msg_reject, WHEN MSG_OUT
JUMP redo_msgin2
disc2:
CLEAR ACK
ENTRY wait_disc2
wait_disc2:
WAIT DISCONNECT
INT int_disc2
ENTRY resume_msgin2a
resume_msgin2a:
CLEAR ACK
JUMP redo_msgin2
ENTRY resume_msgin2b
resume_msgin2b:
SET ATN
CLEAR ACK
INT int_no_msgout2, WHEN NOT MSG_OUT
MOVE SCRATCH0 | had_msgout TO SCRATCH0
MOVE FROM dsa_msgout, when MSG_OUT
JUMP redo_msgin2
get_msgin3:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
MOVE 1, msgin_buf, WHEN MSG_IN
JUMP ext_msg3, IF 0x01 ; Extended Message
JUMP ignore_msg3, IF 0x02 ; Save Data Pointers
JUMP ignore_msg3, IF 0x03 ; Save Restore Pointers
JUMP disc3, IF 0x04 ; Disconnect
INT int_bad_msg3
ignore_msg3:
CLEAR ACK
JUMP redo_msgin3
ext_msg3:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
CLEAR ACK
MOVE 1, msgin_buf + 1, WHEN MSG_IN
JUMP reject_msg3, IF NOT 0x03 ; Only handle SDTR
CLEAR ACK
MOVE 1, msgin_buf + 2, WHEN MSG_IN
JUMP reject_msg3, IF NOT 0x01 ; Only handle SDTR
CLEAR ACK
MOVE 2, msgin_buf + 3, WHEN MSG_IN
INT int_msg_sdtr3
reject_msg3:
MOVE SCRATCH1 | did_reject TO SCRATCH1
SET ATN
CLEAR ACK
JUMP reject_msg3a, WHEN NOT MSG_IN
MOVE 1, msgin_buf + 7, WHEN MSG_IN
JUMP reject_msg3
reject_msg3a:
MOVE 1, msg_reject, WHEN MSG_OUT
JUMP redo_msgin3
disc3:
CLEAR ACK
ENTRY wait_disc3
wait_disc3:
WAIT DISCONNECT
INT int_disc3
ENTRY resume_msgin3a
resume_msgin3a:
CLEAR ACK
JUMP redo_msgin3
ENTRY resume_msgin3b
resume_msgin3b:
SET ATN
CLEAR ACK
INT int_no_msgout3, WHEN NOT MSG_OUT
MOVE SCRATCH0 | had_msgout TO SCRATCH0
MOVE FROM dsa_msgout, when MSG_OUT
JUMP redo_msgin3
ENTRY resume_rej_ident
resume_rej_ident:
CLEAR ATN
MOVE 1, msgin_buf, WHEN MSG_IN
INT int_not_rej, IF NOT 0x07 ; Reject
CLEAR ACK
JUMP done_ident
ENTRY reselect
reselect:
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
WAIT RESELECT resel_err
INT int_resel_not_msgin, WHEN NOT MSG_IN
MOVE 1, reselected_identify, WHEN MSG_IN
INT int_reselected
resel_err:
MOVE CTEST2 & 0x40 TO SFBR
JUMP selected, IF 0x00
MOVE SFBR & 0 TO SFBR
ENTRY patch_new_dsa
patch_new_dsa:
MOVE SFBR | 0x11 TO DSA0
MOVE SFBR | 0x22 TO DSA1
MOVE SFBR | 0x33 TO DSA2
MOVE SFBR | 0x44 TO DSA3
JUMP do_select
selected:
INT int_selected
ENTRY test1
test1:
MOVE MEMORY 4, test1_src, test1_dst
INT int_test1
/* DO NOT EDIT - Generated automatically by script_asm.pl */
static u32 SCRIPT[] = {
/*
ABSOLUTE dsa_select = 0
ABSOLUTE dsa_msgout = 8
ABSOLUTE dsa_cmnd = 16
ABSOLUTE dsa_status = 24
ABSOLUTE dsa_msgin = 32
ABSOLUTE dsa_datain = 40
ABSOLUTE dsa_dataout = 1064
ABSOLUTE dsa_size = 2088
ABSOLUTE reselected_identify = 0
ABSOLUTE msgin_buf = 0
ABSOLUTE msg_reject = 0
ABSOLUTE test1_src = 0
ABSOLUTE test1_dst = 0
ABSOLUTE int_bad_msg1 = 0xab930006
ABSOLUTE int_bad_msg2 = 0xab930007
ABSOLUTE int_bad_msg3 = 0xab930008
ABSOLUTE int_cmd_bad_phase = 0xab930009
ABSOLUTE int_cmd_complete = 0xab93000a
ABSOLUTE int_data_bad_phase = 0xab93000b
ABSOLUTE int_msg_sdtr1 = 0xab93000c
ABSOLUTE int_msg_sdtr2 = 0xab93000d
ABSOLUTE int_msg_sdtr3 = 0xab93000e
ABSOLUTE int_no_msgout1 = 0xab93000f
ABSOLUTE int_no_msgout2 = 0xab930010
ABSOLUTE int_no_msgout3 = 0xab930011
ABSOLUTE int_not_cmd_complete = 0xab930012
ABSOLUTE int_sel_no_ident = 0xab930013
ABSOLUTE int_sel_not_cmd = 0xab930014
ABSOLUTE int_status_not_msgin = 0xab930015
ABSOLUTE int_resel_not_msgin = 0xab930016
ABSOLUTE int_reselected = 0xab930017
ABSOLUTE int_selected = 0xab930018
ABSOLUTE int_disc1 = 0xab930019
ABSOLUTE int_disc2 = 0xab93001a
ABSOLUTE int_disc3 = 0xab93001b
ABSOLUTE int_not_rej = 0xab93001c
ABSOLUTE int_test1 = 0xab93001d
ABSOLUTE had_select = 0x01
ABSOLUTE had_msgout = 0x02
ABSOLUTE had_cmdout = 0x04
ABSOLUTE had_datain = 0x08
ABSOLUTE had_dataout = 0x10
ABSOLUTE had_status = 0x20
ABSOLUTE had_msgin = 0x40
ABSOLUTE had_extmsg = 0x80
ABSOLUTE did_reject = 0x01
ENTRY do_select
do_select:
CLEAR TARGET
at 0x00000000 : */ 0x60000200,0x00000000,
/*
; Enable selection timer
MOVE CTEST7 & 0xef TO CTEST7
at 0x00000002 : */ 0x7c1bef00,0x00000000,
/*
SELECT ATN FROM dsa_select, reselect
at 0x00000004 : */ 0x43000000,0x00000cd0,
/*
JUMP get_status, WHEN STATUS
at 0x00000006 : */ 0x830b0000,0x00000098,
/*
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
at 0x00000008 : */ 0x7a1b1000,0x00000000,
/*
MOVE SCRATCH0 | had_select TO SCRATCH0
at 0x0000000a : */ 0x7a340100,0x00000000,
/*
INT int_sel_no_ident, IF NOT MSG_OUT
at 0x0000000c : */ 0x9e020000,0xab930013,
/*
MOVE SCRATCH0 | had_msgout TO SCRATCH0
at 0x0000000e : */ 0x7a340200,0x00000000,
/*
MOVE FROM dsa_msgout, when MSG_OUT
at 0x00000010 : */ 0x1e000000,0x00000008,
/*
ENTRY done_ident
done_ident:
JUMP get_status, IF STATUS
at 0x00000012 : */ 0x830a0000,0x00000098,
/*
redo_msgin1:
JUMP get_msgin1, WHEN MSG_IN
at 0x00000014 : */ 0x870b0000,0x00000918,
/*
INT int_sel_not_cmd, IF NOT CMD
at 0x00000016 : */ 0x9a020000,0xab930014,
/*
ENTRY resume_cmd
resume_cmd:
MOVE SCRATCH0 | had_cmdout TO SCRATCH0
at 0x00000018 : */ 0x7a340400,0x00000000,
/*
MOVE FROM dsa_cmnd, WHEN CMD
at 0x0000001a : */ 0x1a000000,0x00000010,
/*
ENTRY resume_pmm
resume_pmm:
redo_msgin2:
JUMP get_msgin2, WHEN MSG_IN
at 0x0000001c : */ 0x870b0000,0x00000a48,
/*
JUMP get_status, IF STATUS
at 0x0000001e : */ 0x830a0000,0x00000098,
/*
JUMP input_data, IF DATA_IN
at 0x00000020 : */ 0x810a0000,0x000000d8,
/*
JUMP output_data, IF DATA_OUT
at 0x00000022 : */ 0x800a0000,0x000004f0,
/*
INT int_cmd_bad_phase
at 0x00000024 : */ 0x98080000,0xab930009,
/*
get_status:
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
at 0x00000026 : */ 0x7a1b1000,0x00000000,
/*
MOVE FROM dsa_status, WHEN STATUS
at 0x00000028 : */ 0x1b000000,0x00000018,
/*
INT int_status_not_msgin, WHEN NOT MSG_IN
at 0x0000002a : */ 0x9f030000,0xab930015,
/*
MOVE FROM dsa_msgin, WHEN MSG_IN
at 0x0000002c : */ 0x1f000000,0x00000020,
/*
INT int_not_cmd_complete, IF NOT 0x00
at 0x0000002e : */ 0x98040000,0xab930012,
/*
CLEAR ACK
at 0x00000030 : */ 0x60000040,0x00000000,
/*
ENTRY wait_disc_complete
wait_disc_complete:
WAIT DISCONNECT
at 0x00000032 : */ 0x48000000,0x00000000,
/*
INT int_cmd_complete
at 0x00000034 : */ 0x98080000,0xab93000a,
/*
input_data:
MOVE SCRATCH0 | had_datain TO SCRATCH0
at 0x00000036 : */ 0x7a340800,0x00000000,
/*
ENTRY patch_input_data
patch_input_data:
JUMP 0
at 0x00000038 : */ 0x80080000,0x00000000,
/*
MOVE FROM dsa_datain+0x0000, WHEN DATA_IN
at 0x0000003a : */ 0x19000000,0x00000028,
/*
MOVE FROM dsa_datain+0x0008, WHEN DATA_IN
at 0x0000003c : */ 0x19000000,0x00000030,
/*
MOVE FROM dsa_datain+0x0010, WHEN DATA_IN
at 0x0000003e : */ 0x19000000,0x00000038,
/*
MOVE FROM dsa_datain+0x0018, WHEN DATA_IN
at 0x00000040 : */ 0x19000000,0x00000040,
/*
MOVE FROM dsa_datain+0x0020, WHEN DATA_IN
at 0x00000042 : */ 0x19000000,0x00000048,
/*
MOVE FROM dsa_datain+0x0028, WHEN DATA_IN
at 0x00000044 : */ 0x19000000,0x00000050,
/*
MOVE FROM dsa_datain+0x0030, WHEN DATA_IN
at 0x00000046 : */ 0x19000000,0x00000058,
/*
MOVE FROM dsa_datain+0x0038, WHEN DATA_IN
at 0x00000048 : */ 0x19000000,0x00000060,
/*
MOVE FROM dsa_datain+0x0040, WHEN DATA_IN
at 0x0000004a : */ 0x19000000,0x00000068,
/*
MOVE FROM dsa_datain+0x0048, WHEN DATA_IN
at 0x0000004c : */ 0x19000000,0x00000070,
/*
MOVE FROM dsa_datain+0x0050, WHEN DATA_IN
at 0x0000004e : */ 0x19000000,0x00000078,
/*
MOVE FROM dsa_datain+0x0058, WHEN DATA_IN
at 0x00000050 : */ 0x19000000,0x00000080,
/*
MOVE FROM dsa_datain+0x0060, WHEN DATA_IN
at 0x00000052 : */ 0x19000000,0x00000088,
/*
MOVE FROM dsa_datain+0x0068, WHEN DATA_IN
at 0x00000054 : */ 0x19000000,0x00000090,
/*
MOVE FROM dsa_datain+0x0070, WHEN DATA_IN
at 0x00000056 : */ 0x19000000,0x00000098,
/*
MOVE FROM dsa_datain+0x0078, WHEN DATA_IN
at 0x00000058 : */ 0x19000000,0x000000a0,
/*
MOVE FROM dsa_datain+0x0080, WHEN DATA_IN
at 0x0000005a : */ 0x19000000,0x000000a8,
/*
MOVE FROM dsa_datain+0x0088, WHEN DATA_IN
at 0x0000005c : */ 0x19000000,0x000000b0,
/*
MOVE FROM dsa_datain+0x0090, WHEN DATA_IN
at 0x0000005e : */ 0x19000000,0x000000b8,
/*
MOVE FROM dsa_datain+0x0098, WHEN DATA_IN
at 0x00000060 : */ 0x19000000,0x000000c0,
/*
MOVE FROM dsa_datain+0x00a0, WHEN DATA_IN
at 0x00000062 : */ 0x19000000,0x000000c8,
/*
MOVE FROM dsa_datain+0x00a8, WHEN DATA_IN
at 0x00000064 : */ 0x19000000,0x000000d0,
/*
MOVE FROM dsa_datain+0x00b0, WHEN DATA_IN
at 0x00000066 : */ 0x19000000,0x000000d8,
/*
MOVE FROM dsa_datain+0x00b8, WHEN DATA_IN
at 0x00000068 : */ 0x19000000,0x000000e0,
/*
MOVE FROM dsa_datain+0x00c0, WHEN DATA_IN
at 0x0000006a : */ 0x19000000,0x000000e8,
/*
MOVE FROM dsa_datain+0x00c8, WHEN DATA_IN
at 0x0000006c : */ 0x19000000,0x000000f0,
/*
MOVE FROM dsa_datain+0x00d0, WHEN DATA_IN
at 0x0000006e : */ 0x19000000,0x000000f8,
/*
MOVE FROM dsa_datain+0x00d8, WHEN DATA_IN
at 0x00000070 : */ 0x19000000,0x00000100,
/*
MOVE FROM dsa_datain+0x00e0, WHEN DATA_IN
at 0x00000072 : */ 0x19000000,0x00000108,
/*
MOVE FROM dsa_datain+0x00e8, WHEN DATA_IN
at 0x00000074 : */ 0x19000000,0x00000110,
/*
MOVE FROM dsa_datain+0x00f0, WHEN DATA_IN
at 0x00000076 : */ 0x19000000,0x00000118,
/*
MOVE FROM dsa_datain+0x00f8, WHEN DATA_IN
at 0x00000078 : */ 0x19000000,0x00000120,
/*
MOVE FROM dsa_datain+0x0100, WHEN DATA_IN
at 0x0000007a : */ 0x19000000,0x00000128,
/*
MOVE FROM dsa_datain+0x0108, WHEN DATA_IN
at 0x0000007c : */ 0x19000000,0x00000130,
/*
MOVE FROM dsa_datain+0x0110, WHEN DATA_IN
at 0x0000007e : */ 0x19000000,0x00000138,
/*
MOVE FROM dsa_datain+0x0118, WHEN DATA_IN
at 0x00000080 : */ 0x19000000,0x00000140,
/*
MOVE FROM dsa_datain+0x0120, WHEN DATA_IN
at 0x00000082 : */ 0x19000000,0x00000148,
/*
MOVE FROM dsa_datain+0x0128, WHEN DATA_IN
at 0x00000084 : */ 0x19000000,0x00000150,
/*
MOVE FROM dsa_datain+0x0130, WHEN DATA_IN
at 0x00000086 : */ 0x19000000,0x00000158,
/*
MOVE FROM dsa_datain+0x0138, WHEN DATA_IN
at 0x00000088 : */ 0x19000000,0x00000160,
/*
MOVE FROM dsa_datain+0x0140, WHEN DATA_IN
at 0x0000008a : */ 0x19000000,0x00000168,
/*
MOVE FROM dsa_datain+0x0148, WHEN DATA_IN
at 0x0000008c : */ 0x19000000,0x00000170,
/*
MOVE FROM dsa_datain+0x0150, WHEN DATA_IN
at 0x0000008e : */ 0x19000000,0x00000178,
/*
MOVE FROM dsa_datain+0x0158, WHEN DATA_IN
at 0x00000090 : */ 0x19000000,0x00000180,
/*
MOVE FROM dsa_datain+0x0160, WHEN DATA_IN
at 0x00000092 : */ 0x19000000,0x00000188,
/*
MOVE FROM dsa_datain+0x0168, WHEN DATA_IN
at 0x00000094 : */ 0x19000000,0x00000190,
/*
MOVE FROM dsa_datain+0x0170, WHEN DATA_IN
at 0x00000096 : */ 0x19000000,0x00000198,
/*
MOVE FROM dsa_datain+0x0178, WHEN DATA_IN
at 0x00000098 : */ 0x19000000,0x000001a0,
/*
MOVE FROM dsa_datain+0x0180, WHEN DATA_IN
at 0x0000009a : */ 0x19000000,0x000001a8,
/*
MOVE FROM dsa_datain+0x0188, WHEN DATA_IN
at 0x0000009c : */ 0x19000000,0x000001b0,
/*
MOVE FROM dsa_datain+0x0190, WHEN DATA_IN
at 0x0000009e : */ 0x19000000,0x000001b8,
/*
MOVE FROM dsa_datain+0x0198, WHEN DATA_IN
at 0x000000a0 : */ 0x19000000,0x000001c0,
/*
MOVE FROM dsa_datain+0x01a0, WHEN DATA_IN
at 0x000000a2 : */ 0x19000000,0x000001c8,
/*
MOVE FROM dsa_datain+0x01a8, WHEN DATA_IN
at 0x000000a4 : */ 0x19000000,0x000001d0,
/*
MOVE FROM dsa_datain+0x01b0, WHEN DATA_IN
at 0x000000a6 : */ 0x19000000,0x000001d8,
/*
MOVE FROM dsa_datain+0x01b8, WHEN DATA_IN
at 0x000000a8 : */ 0x19000000,0x000001e0,
/*
MOVE FROM dsa_datain+0x01c0, WHEN DATA_IN
at 0x000000aa : */ 0x19000000,0x000001e8,
/*
MOVE FROM dsa_datain+0x01c8, WHEN DATA_IN
at 0x000000ac : */ 0x19000000,0x000001f0,
/*
MOVE FROM dsa_datain+0x01d0, WHEN DATA_IN
at 0x000000ae : */ 0x19000000,0x000001f8,
/*
MOVE FROM dsa_datain+0x01d8, WHEN DATA_IN
at 0x000000b0 : */ 0x19000000,0x00000200,
/*
MOVE FROM dsa_datain+0x01e0, WHEN DATA_IN
at 0x000000b2 : */ 0x19000000,0x00000208,
/*
MOVE FROM dsa_datain+0x01e8, WHEN DATA_IN
at 0x000000b4 : */ 0x19000000,0x00000210,
/*
MOVE FROM dsa_datain+0x01f0, WHEN DATA_IN
at 0x000000b6 : */ 0x19000000,0x00000218,
/*
MOVE FROM dsa_datain+0x01f8, WHEN DATA_IN
at 0x000000b8 : */ 0x19000000,0x00000220,
/*
MOVE FROM dsa_datain+0x0200, WHEN DATA_IN
at 0x000000ba : */ 0x19000000,0x00000228,
/*
MOVE FROM dsa_datain+0x0208, WHEN DATA_IN
at 0x000000bc : */ 0x19000000,0x00000230,
/*
MOVE FROM dsa_datain+0x0210, WHEN DATA_IN
at 0x000000be : */ 0x19000000,0x00000238,
/*
MOVE FROM dsa_datain+0x0218, WHEN DATA_IN
at 0x000000c0 : */ 0x19000000,0x00000240,
/*
MOVE FROM dsa_datain+0x0220, WHEN DATA_IN
at 0x000000c2 : */ 0x19000000,0x00000248,
/*
MOVE FROM dsa_datain+0x0228, WHEN DATA_IN
at 0x000000c4 : */ 0x19000000,0x00000250,
/*
MOVE FROM dsa_datain+0x0230, WHEN DATA_IN
at 0x000000c6 : */ 0x19000000,0x00000258,
/*
MOVE FROM dsa_datain+0x0238, WHEN DATA_IN
at 0x000000c8 : */ 0x19000000,0x00000260,
/*
MOVE FROM dsa_datain+0x0240, WHEN DATA_IN
at 0x000000ca : */ 0x19000000,0x00000268,
/*
MOVE FROM dsa_datain+0x0248, WHEN DATA_IN
at 0x000000cc : */ 0x19000000,0x00000270,
/*
MOVE FROM dsa_datain+0x0250, WHEN DATA_IN
at 0x000000ce : */ 0x19000000,0x00000278,
/*
MOVE FROM dsa_datain+0x0258, WHEN DATA_IN
at 0x000000d0 : */ 0x19000000,0x00000280,
/*
MOVE FROM dsa_datain+0x0260, WHEN DATA_IN
at 0x000000d2 : */ 0x19000000,0x00000288,
/*
MOVE FROM dsa_datain+0x0268, WHEN DATA_IN
at 0x000000d4 : */ 0x19000000,0x00000290,
/*
MOVE FROM dsa_datain+0x0270, WHEN DATA_IN
at 0x000000d6 : */ 0x19000000,0x00000298,
/*
MOVE FROM dsa_datain+0x0278, WHEN DATA_IN
at 0x000000d8 : */ 0x19000000,0x000002a0,
/*
MOVE FROM dsa_datain+0x0280, WHEN DATA_IN
at 0x000000da : */ 0x19000000,0x000002a8,
/*
MOVE FROM dsa_datain+0x0288, WHEN DATA_IN
at 0x000000dc : */ 0x19000000,0x000002b0,
/*
MOVE FROM dsa_datain+0x0290, WHEN DATA_IN
at 0x000000de : */ 0x19000000,0x000002b8,
/*
MOVE FROM dsa_datain+0x0298, WHEN DATA_IN
at 0x000000e0 : */ 0x19000000,0x000002c0,
/*
MOVE FROM dsa_datain+0x02a0, WHEN DATA_IN
at 0x000000e2 : */ 0x19000000,0x000002c8,
/*
MOVE FROM dsa_datain+0x02a8, WHEN DATA_IN
at 0x000000e4 : */ 0x19000000,0x000002d0,
/*
MOVE FROM dsa_datain+0x02b0, WHEN DATA_IN
at 0x000000e6 : */ 0x19000000,0x000002d8,
/*
MOVE FROM dsa_datain+0x02b8, WHEN DATA_IN
at 0x000000e8 : */ 0x19000000,0x000002e0,
/*
MOVE FROM dsa_datain+0x02c0, WHEN DATA_IN
at 0x000000ea : */ 0x19000000,0x000002e8,
/*
MOVE FROM dsa_datain+0x02c8, WHEN DATA_IN
at 0x000000ec : */ 0x19000000,0x000002f0,
/*
MOVE FROM dsa_datain+0x02d0, WHEN DATA_IN
at 0x000000ee : */ 0x19000000,0x000002f8,
/*
MOVE FROM dsa_datain+0x02d8, WHEN DATA_IN
at 0x000000f0 : */ 0x19000000,0x00000300,
/*
MOVE FROM dsa_datain+0x02e0, WHEN DATA_IN
at 0x000000f2 : */ 0x19000000,0x00000308,
/*
MOVE FROM dsa_datain+0x02e8, WHEN DATA_IN
at 0x000000f4 : */ 0x19000000,0x00000310,
/*
MOVE FROM dsa_datain+0x02f0, WHEN DATA_IN
at 0x000000f6 : */ 0x19000000,0x00000318,
/*
MOVE FROM dsa_datain+0x02f8, WHEN DATA_IN
at 0x000000f8 : */ 0x19000000,0x00000320,
/*
MOVE FROM dsa_datain+0x0300, WHEN DATA_IN
at 0x000000fa : */ 0x19000000,0x00000328,
/*
MOVE FROM dsa_datain+0x0308, WHEN DATA_IN
at 0x000000fc : */ 0x19000000,0x00000330,
/*
MOVE FROM dsa_datain+0x0310, WHEN DATA_IN
at 0x000000fe : */ 0x19000000,0x00000338,
/*
MOVE FROM dsa_datain+0x0318, WHEN DATA_IN
at 0x00000100 : */ 0x19000000,0x00000340,
/*
MOVE FROM dsa_datain+0x0320, WHEN DATA_IN
at 0x00000102 : */ 0x19000000,0x00000348,
/*
MOVE FROM dsa_datain+0x0328, WHEN DATA_IN
at 0x00000104 : */ 0x19000000,0x00000350,
/*
MOVE FROM dsa_datain+0x0330, WHEN DATA_IN
at 0x00000106 : */ 0x19000000,0x00000358,
/*
MOVE FROM dsa_datain+0x0338, WHEN DATA_IN
at 0x00000108 : */ 0x19000000,0x00000360,
/*
MOVE FROM dsa_datain+0x0340, WHEN DATA_IN
at 0x0000010a : */ 0x19000000,0x00000368,
/*
MOVE FROM dsa_datain+0x0348, WHEN DATA_IN
at 0x0000010c : */ 0x19000000,0x00000370,
/*
MOVE FROM dsa_datain+0x0350, WHEN DATA_IN
at 0x0000010e : */ 0x19000000,0x00000378,
/*
MOVE FROM dsa_datain+0x0358, WHEN DATA_IN
at 0x00000110 : */ 0x19000000,0x00000380,
/*
MOVE FROM dsa_datain+0x0360, WHEN DATA_IN
at 0x00000112 : */ 0x19000000,0x00000388,
/*
MOVE FROM dsa_datain+0x0368, WHEN DATA_IN
at 0x00000114 : */ 0x19000000,0x00000390,
/*
MOVE FROM dsa_datain+0x0370, WHEN DATA_IN
at 0x00000116 : */ 0x19000000,0x00000398,
/*
MOVE FROM dsa_datain+0x0378, WHEN DATA_IN
at 0x00000118 : */ 0x19000000,0x000003a0,
/*
MOVE FROM dsa_datain+0x0380, WHEN DATA_IN
at 0x0000011a : */ 0x19000000,0x000003a8,
/*
MOVE FROM dsa_datain+0x0388, WHEN DATA_IN
at 0x0000011c : */ 0x19000000,0x000003b0,
/*
MOVE FROM dsa_datain+0x0390, WHEN DATA_IN
at 0x0000011e : */ 0x19000000,0x000003b8,
/*
MOVE FROM dsa_datain+0x0398, WHEN DATA_IN
at 0x00000120 : */ 0x19000000,0x000003c0,
/*
MOVE FROM dsa_datain+0x03a0, WHEN DATA_IN
at 0x00000122 : */ 0x19000000,0x000003c8,
/*
MOVE FROM dsa_datain+0x03a8, WHEN DATA_IN
at 0x00000124 : */ 0x19000000,0x000003d0,
/*
MOVE FROM dsa_datain+0x03b0, WHEN DATA_IN
at 0x00000126 : */ 0x19000000,0x000003d8,
/*
MOVE FROM dsa_datain+0x03b8, WHEN DATA_IN
at 0x00000128 : */ 0x19000000,0x000003e0,
/*
MOVE FROM dsa_datain+0x03c0, WHEN DATA_IN
at 0x0000012a : */ 0x19000000,0x000003e8,
/*
MOVE FROM dsa_datain+0x03c8, WHEN DATA_IN
at 0x0000012c : */ 0x19000000,0x000003f0,
/*
MOVE FROM dsa_datain+0x03d0, WHEN DATA_IN
at 0x0000012e : */ 0x19000000,0x000003f8,
/*
MOVE FROM dsa_datain+0x03d8, WHEN DATA_IN
at 0x00000130 : */ 0x19000000,0x00000400,
/*
MOVE FROM dsa_datain+0x03e0, WHEN DATA_IN
at 0x00000132 : */ 0x19000000,0x00000408,
/*
MOVE FROM dsa_datain+0x03e8, WHEN DATA_IN
at 0x00000134 : */ 0x19000000,0x00000410,
/*
MOVE FROM dsa_datain+0x03f0, WHEN DATA_IN
at 0x00000136 : */ 0x19000000,0x00000418,
/*
MOVE FROM dsa_datain+0x03f8, WHEN DATA_IN
at 0x00000138 : */ 0x19000000,0x00000420,
/*
JUMP end_data_trans
at 0x0000013a : */ 0x80080000,0x00000900,
/*
output_data:
MOVE SCRATCH0 | had_dataout TO SCRATCH0
at 0x0000013c : */ 0x7a341000,0x00000000,
/*
ENTRY patch_output_data
patch_output_data:
JUMP 0
at 0x0000013e : */ 0x80080000,0x00000000,
/*
MOVE FROM dsa_dataout+0x0000, WHEN DATA_OUT
at 0x00000140 : */ 0x18000000,0x00000428,
/*
MOVE FROM dsa_dataout+0x0008, WHEN DATA_OUT
at 0x00000142 : */ 0x18000000,0x00000430,
/*
MOVE FROM dsa_dataout+0x0010, WHEN DATA_OUT
at 0x00000144 : */ 0x18000000,0x00000438,
/*
MOVE FROM dsa_dataout+0x0018, WHEN DATA_OUT
at 0x00000146 : */ 0x18000000,0x00000440,
/*
MOVE FROM dsa_dataout+0x0020, WHEN DATA_OUT
at 0x00000148 : */ 0x18000000,0x00000448,
/*
MOVE FROM dsa_dataout+0x0028, WHEN DATA_OUT
at 0x0000014a : */ 0x18000000,0x00000450,
/*
MOVE FROM dsa_dataout+0x0030, WHEN DATA_OUT
at 0x0000014c : */ 0x18000000,0x00000458,
/*
MOVE FROM dsa_dataout+0x0038, WHEN DATA_OUT
at 0x0000014e : */ 0x18000000,0x00000460,
/*
MOVE FROM dsa_dataout+0x0040, WHEN DATA_OUT
at 0x00000150 : */ 0x18000000,0x00000468,
/*
MOVE FROM dsa_dataout+0x0048, WHEN DATA_OUT
at 0x00000152 : */ 0x18000000,0x00000470,
/*
MOVE FROM dsa_dataout+0x0050, WHEN DATA_OUT
at 0x00000154 : */ 0x18000000,0x00000478,
/*
MOVE FROM dsa_dataout+0x0058, WHEN DATA_OUT
at 0x00000156 : */ 0x18000000,0x00000480,
/*
MOVE FROM dsa_dataout+0x0060, WHEN DATA_OUT
at 0x00000158 : */ 0x18000000,0x00000488,
/*
MOVE FROM dsa_dataout+0x0068, WHEN DATA_OUT
at 0x0000015a : */ 0x18000000,0x00000490,
/*
MOVE FROM dsa_dataout+0x0070, WHEN DATA_OUT
at 0x0000015c : */ 0x18000000,0x00000498,
/*
MOVE FROM dsa_dataout+0x0078, WHEN DATA_OUT
at 0x0000015e : */ 0x18000000,0x000004a0,
/*
MOVE FROM dsa_dataout+0x0080, WHEN DATA_OUT
at 0x00000160 : */ 0x18000000,0x000004a8,
/*
MOVE FROM dsa_dataout+0x0088, WHEN DATA_OUT
at 0x00000162 : */ 0x18000000,0x000004b0,
/*
MOVE FROM dsa_dataout+0x0090, WHEN DATA_OUT
at 0x00000164 : */ 0x18000000,0x000004b8,
/*
MOVE FROM dsa_dataout+0x0098, WHEN DATA_OUT
at 0x00000166 : */ 0x18000000,0x000004c0,
/*
MOVE FROM dsa_dataout+0x00a0, WHEN DATA_OUT
at 0x00000168 : */ 0x18000000,0x000004c8,
/*
MOVE FROM dsa_dataout+0x00a8, WHEN DATA_OUT
at 0x0000016a : */ 0x18000000,0x000004d0,
/*
MOVE FROM dsa_dataout+0x00b0, WHEN DATA_OUT
at 0x0000016c : */ 0x18000000,0x000004d8,
/*
MOVE FROM dsa_dataout+0x00b8, WHEN DATA_OUT
at 0x0000016e : */ 0x18000000,0x000004e0,
/*
MOVE FROM dsa_dataout+0x00c0, WHEN DATA_OUT
at 0x00000170 : */ 0x18000000,0x000004e8,
/*
MOVE FROM dsa_dataout+0x00c8, WHEN DATA_OUT
at 0x00000172 : */ 0x18000000,0x000004f0,
/*
MOVE FROM dsa_dataout+0x00d0, WHEN DATA_OUT
at 0x00000174 : */ 0x18000000,0x000004f8,
/*
MOVE FROM dsa_dataout+0x00d8, WHEN DATA_OUT
at 0x00000176 : */ 0x18000000,0x00000500,
/*
MOVE FROM dsa_dataout+0x00e0, WHEN DATA_OUT
at 0x00000178 : */ 0x18000000,0x00000508,
/*
MOVE FROM dsa_dataout+0x00e8, WHEN DATA_OUT
at 0x0000017a : */ 0x18000000,0x00000510,
/*
MOVE FROM dsa_dataout+0x00f0, WHEN DATA_OUT
at 0x0000017c : */ 0x18000000,0x00000518,
/*
MOVE FROM dsa_dataout+0x00f8, WHEN DATA_OUT
at 0x0000017e : */ 0x18000000,0x00000520,
/*
MOVE FROM dsa_dataout+0x0100, WHEN DATA_OUT
at 0x00000180 : */ 0x18000000,0x00000528,
/*
MOVE FROM dsa_dataout+0x0108, WHEN DATA_OUT
at 0x00000182 : */ 0x18000000,0x00000530,
/*
MOVE FROM dsa_dataout+0x0110, WHEN DATA_OUT
at 0x00000184 : */ 0x18000000,0x00000538,
/*
MOVE FROM dsa_dataout+0x0118, WHEN DATA_OUT
at 0x00000186 : */ 0x18000000,0x00000540,
/*
MOVE FROM dsa_dataout+0x0120, WHEN DATA_OUT
at 0x00000188 : */ 0x18000000,0x00000548,
/*
MOVE FROM dsa_dataout+0x0128, WHEN DATA_OUT
at 0x0000018a : */ 0x18000000,0x00000550,
/*
MOVE FROM dsa_dataout+0x0130, WHEN DATA_OUT
at 0x0000018c : */ 0x18000000,0x00000558,
/*
MOVE FROM dsa_dataout+0x0138, WHEN DATA_OUT
at 0x0000018e : */ 0x18000000,0x00000560,
/*
MOVE FROM dsa_dataout+0x0140, WHEN DATA_OUT
at 0x00000190 : */ 0x18000000,0x00000568,
/*
MOVE FROM dsa_dataout+0x0148, WHEN DATA_OUT
at 0x00000192 : */ 0x18000000,0x00000570,
/*
MOVE FROM dsa_dataout+0x0150, WHEN DATA_OUT
at 0x00000194 : */ 0x18000000,0x00000578,
/*
MOVE FROM dsa_dataout+0x0158, WHEN DATA_OUT
at 0x00000196 : */ 0x18000000,0x00000580,
/*
MOVE FROM dsa_dataout+0x0160, WHEN DATA_OUT
at 0x00000198 : */ 0x18000000,0x00000588,
/*
MOVE FROM dsa_dataout+0x0168, WHEN DATA_OUT
at 0x0000019a : */ 0x18000000,0x00000590,
/*
MOVE FROM dsa_dataout+0x0170, WHEN DATA_OUT
at 0x0000019c : */ 0x18000000,0x00000598,
/*
MOVE FROM dsa_dataout+0x0178, WHEN DATA_OUT
at 0x0000019e : */ 0x18000000,0x000005a0,
/*
MOVE FROM dsa_dataout+0x0180, WHEN DATA_OUT
at 0x000001a0 : */ 0x18000000,0x000005a8,
/*
MOVE FROM dsa_dataout+0x0188, WHEN DATA_OUT
at 0x000001a2 : */ 0x18000000,0x000005b0,
/*
MOVE FROM dsa_dataout+0x0190, WHEN DATA_OUT
at 0x000001a4 : */ 0x18000000,0x000005b8,
/*
MOVE FROM dsa_dataout+0x0198, WHEN DATA_OUT
at 0x000001a6 : */ 0x18000000,0x000005c0,
/*
MOVE FROM dsa_dataout+0x01a0, WHEN DATA_OUT
at 0x000001a8 : */ 0x18000000,0x000005c8,
/*
MOVE FROM dsa_dataout+0x01a8, WHEN DATA_OUT
at 0x000001aa : */ 0x18000000,0x000005d0,
/*
MOVE FROM dsa_dataout+0x01b0, WHEN DATA_OUT
at 0x000001ac : */ 0x18000000,0x000005d8,
/*
MOVE FROM dsa_dataout+0x01b8, WHEN DATA_OUT
at 0x000001ae : */ 0x18000000,0x000005e0,
/*
MOVE FROM dsa_dataout+0x01c0, WHEN DATA_OUT
at 0x000001b0 : */ 0x18000000,0x000005e8,
/*
MOVE FROM dsa_dataout+0x01c8, WHEN DATA_OUT
at 0x000001b2 : */ 0x18000000,0x000005f0,
/*
MOVE FROM dsa_dataout+0x01d0, WHEN DATA_OUT
at 0x000001b4 : */ 0x18000000,0x000005f8,
/*
MOVE FROM dsa_dataout+0x01d8, WHEN DATA_OUT
at 0x000001b6 : */ 0x18000000,0x00000600,
/*
MOVE FROM dsa_dataout+0x01e0, WHEN DATA_OUT
at 0x000001b8 : */ 0x18000000,0x00000608,
/*
MOVE FROM dsa_dataout+0x01e8, WHEN DATA_OUT
at 0x000001ba : */ 0x18000000,0x00000610,
/*
MOVE FROM dsa_dataout+0x01f0, WHEN DATA_OUT
at 0x000001bc : */ 0x18000000,0x00000618,
/*
MOVE FROM dsa_dataout+0x01f8, WHEN DATA_OUT
at 0x000001be : */ 0x18000000,0x00000620,
/*
MOVE FROM dsa_dataout+0x0200, WHEN DATA_OUT
at 0x000001c0 : */ 0x18000000,0x00000628,
/*
MOVE FROM dsa_dataout+0x0208, WHEN DATA_OUT
at 0x000001c2 : */ 0x18000000,0x00000630,
/*
MOVE FROM dsa_dataout+0x0210, WHEN DATA_OUT
at 0x000001c4 : */ 0x18000000,0x00000638,
/*
MOVE FROM dsa_dataout+0x0218, WHEN DATA_OUT
at 0x000001c6 : */ 0x18000000,0x00000640,
/*
MOVE FROM dsa_dataout+0x0220, WHEN DATA_OUT
at 0x000001c8 : */ 0x18000000,0x00000648,
/*
MOVE FROM dsa_dataout+0x0228, WHEN DATA_OUT
at 0x000001ca : */ 0x18000000,0x00000650,
/*
MOVE FROM dsa_dataout+0x0230, WHEN DATA_OUT
at 0x000001cc : */ 0x18000000,0x00000658,
/*
MOVE FROM dsa_dataout+0x0238, WHEN DATA_OUT
at 0x000001ce : */ 0x18000000,0x00000660,
/*
MOVE FROM dsa_dataout+0x0240, WHEN DATA_OUT
at 0x000001d0 : */ 0x18000000,0x00000668,
/*
MOVE FROM dsa_dataout+0x0248, WHEN DATA_OUT
at 0x000001d2 : */ 0x18000000,0x00000670,
/*
MOVE FROM dsa_dataout+0x0250, WHEN DATA_OUT
at 0x000001d4 : */ 0x18000000,0x00000678,
/*
MOVE FROM dsa_dataout+0x0258, WHEN DATA_OUT
at 0x000001d6 : */ 0x18000000,0x00000680,
/*
MOVE FROM dsa_dataout+0x0260, WHEN DATA_OUT
at 0x000001d8 : */ 0x18000000,0x00000688,
/*
MOVE FROM dsa_dataout+0x0268, WHEN DATA_OUT
at 0x000001da : */ 0x18000000,0x00000690,
/*
MOVE FROM dsa_dataout+0x0270, WHEN DATA_OUT
at 0x000001dc : */ 0x18000000,0x00000698,
/*
MOVE FROM dsa_dataout+0x0278, WHEN DATA_OUT
at 0x000001de : */ 0x18000000,0x000006a0,
/*
MOVE FROM dsa_dataout+0x0280, WHEN DATA_OUT
at 0x000001e0 : */ 0x18000000,0x000006a8,
/*
MOVE FROM dsa_dataout+0x0288, WHEN DATA_OUT
at 0x000001e2 : */ 0x18000000,0x000006b0,
/*
MOVE FROM dsa_dataout+0x0290, WHEN DATA_OUT
at 0x000001e4 : */ 0x18000000,0x000006b8,
/*
MOVE FROM dsa_dataout+0x0298, WHEN DATA_OUT
at 0x000001e6 : */ 0x18000000,0x000006c0,
/*
MOVE FROM dsa_dataout+0x02a0, WHEN DATA_OUT
at 0x000001e8 : */ 0x18000000,0x000006c8,
/*
MOVE FROM dsa_dataout+0x02a8, WHEN DATA_OUT
at 0x000001ea : */ 0x18000000,0x000006d0,
/*
MOVE FROM dsa_dataout+0x02b0, WHEN DATA_OUT
at 0x000001ec : */ 0x18000000,0x000006d8,
/*
MOVE FROM dsa_dataout+0x02b8, WHEN DATA_OUT
at 0x000001ee : */ 0x18000000,0x000006e0,
/*
MOVE FROM dsa_dataout+0x02c0, WHEN DATA_OUT
at 0x000001f0 : */ 0x18000000,0x000006e8,
/*
MOVE FROM dsa_dataout+0x02c8, WHEN DATA_OUT
at 0x000001f2 : */ 0x18000000,0x000006f0,
/*
MOVE FROM dsa_dataout+0x02d0, WHEN DATA_OUT
at 0x000001f4 : */ 0x18000000,0x000006f8,
/*
MOVE FROM dsa_dataout+0x02d8, WHEN DATA_OUT
at 0x000001f6 : */ 0x18000000,0x00000700,
/*
MOVE FROM dsa_dataout+0x02e0, WHEN DATA_OUT
at 0x000001f8 : */ 0x18000000,0x00000708,
/*
MOVE FROM dsa_dataout+0x02e8, WHEN DATA_OUT
at 0x000001fa : */ 0x18000000,0x00000710,
/*
MOVE FROM dsa_dataout+0x02f0, WHEN DATA_OUT
at 0x000001fc : */ 0x18000000,0x00000718,
/*
MOVE FROM dsa_dataout+0x02f8, WHEN DATA_OUT
at 0x000001fe : */ 0x18000000,0x00000720,
/*
MOVE FROM dsa_dataout+0x0300, WHEN DATA_OUT
at 0x00000200 : */ 0x18000000,0x00000728,
/*
MOVE FROM dsa_dataout+0x0308, WHEN DATA_OUT
at 0x00000202 : */ 0x18000000,0x00000730,
/*
MOVE FROM dsa_dataout+0x0310, WHEN DATA_OUT
at 0x00000204 : */ 0x18000000,0x00000738,
/*
MOVE FROM dsa_dataout+0x0318, WHEN DATA_OUT
at 0x00000206 : */ 0x18000000,0x00000740,
/*
MOVE FROM dsa_dataout+0x0320, WHEN DATA_OUT
at 0x00000208 : */ 0x18000000,0x00000748,
/*
MOVE FROM dsa_dataout+0x0328, WHEN DATA_OUT
at 0x0000020a : */ 0x18000000,0x00000750,
/*
MOVE FROM dsa_dataout+0x0330, WHEN DATA_OUT
at 0x0000020c : */ 0x18000000,0x00000758,
/*
MOVE FROM dsa_dataout+0x0338, WHEN DATA_OUT
at 0x0000020e : */ 0x18000000,0x00000760,
/*
MOVE FROM dsa_dataout+0x0340, WHEN DATA_OUT
at 0x00000210 : */ 0x18000000,0x00000768,
/*
MOVE FROM dsa_dataout+0x0348, WHEN DATA_OUT
at 0x00000212 : */ 0x18000000,0x00000770,
/*
MOVE FROM dsa_dataout+0x0350, WHEN DATA_OUT
at 0x00000214 : */ 0x18000000,0x00000778,
/*
MOVE FROM dsa_dataout+0x0358, WHEN DATA_OUT
at 0x00000216 : */ 0x18000000,0x00000780,
/*
MOVE FROM dsa_dataout+0x0360, WHEN DATA_OUT
at 0x00000218 : */ 0x18000000,0x00000788,
/*
MOVE FROM dsa_dataout+0x0368, WHEN DATA_OUT
at 0x0000021a : */ 0x18000000,0x00000790,
/*
MOVE FROM dsa_dataout+0x0370, WHEN DATA_OUT
at 0x0000021c : */ 0x18000000,0x00000798,
/*
MOVE FROM dsa_dataout+0x0378, WHEN DATA_OUT
at 0x0000021e : */ 0x18000000,0x000007a0,
/*
MOVE FROM dsa_dataout+0x0380, WHEN DATA_OUT
at 0x00000220 : */ 0x18000000,0x000007a8,
/*
MOVE FROM dsa_dataout+0x0388, WHEN DATA_OUT
at 0x00000222 : */ 0x18000000,0x000007b0,
/*
MOVE FROM dsa_dataout+0x0390, WHEN DATA_OUT
at 0x00000224 : */ 0x18000000,0x000007b8,
/*
MOVE FROM dsa_dataout+0x0398, WHEN DATA_OUT
at 0x00000226 : */ 0x18000000,0x000007c0,
/*
MOVE FROM dsa_dataout+0x03a0, WHEN DATA_OUT
at 0x00000228 : */ 0x18000000,0x000007c8,
/*
MOVE FROM dsa_dataout+0x03a8, WHEN DATA_OUT
at 0x0000022a : */ 0x18000000,0x000007d0,
/*
MOVE FROM dsa_dataout+0x03b0, WHEN DATA_OUT
at 0x0000022c : */ 0x18000000,0x000007d8,
/*
MOVE FROM dsa_dataout+0x03b8, WHEN DATA_OUT
at 0x0000022e : */ 0x18000000,0x000007e0,
/*
MOVE FROM dsa_dataout+0x03c0, WHEN DATA_OUT
at 0x00000230 : */ 0x18000000,0x000007e8,
/*
MOVE FROM dsa_dataout+0x03c8, WHEN DATA_OUT
at 0x00000232 : */ 0x18000000,0x000007f0,
/*
MOVE FROM dsa_dataout+0x03d0, WHEN DATA_OUT
at 0x00000234 : */ 0x18000000,0x000007f8,
/*
MOVE FROM dsa_dataout+0x03d8, WHEN DATA_OUT
at 0x00000236 : */ 0x18000000,0x00000800,
/*
MOVE FROM dsa_dataout+0x03e0, WHEN DATA_OUT
at 0x00000238 : */ 0x18000000,0x00000808,
/*
MOVE FROM dsa_dataout+0x03e8, WHEN DATA_OUT
at 0x0000023a : */ 0x18000000,0x00000810,
/*
MOVE FROM dsa_dataout+0x03f0, WHEN DATA_OUT
at 0x0000023c : */ 0x18000000,0x00000818,
/*
MOVE FROM dsa_dataout+0x03f8, WHEN DATA_OUT
at 0x0000023e : */ 0x18000000,0x00000820,
/*
ENTRY end_data_trans
end_data_trans:
redo_msgin3:
JUMP get_status, WHEN STATUS
at 0x00000240 : */ 0x830b0000,0x00000098,
/*
JUMP get_msgin3, WHEN MSG_IN
at 0x00000242 : */ 0x870b0000,0x00000b78,
/*
INT int_data_bad_phase
at 0x00000244 : */ 0x98080000,0xab93000b,
/*
get_msgin1:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
at 0x00000246 : */ 0x7a344000,0x00000000,
/*
MOVE 1, msgin_buf, WHEN MSG_IN
at 0x00000248 : */ 0x0f000001,0x00000000,
/*
JUMP ext_msg1, IF 0x01 ; Extended Message
at 0x0000024a : */ 0x800c0001,0x00000960,
/*
JUMP ignore_msg1, IF 0x02 ; Save Data Pointers
at 0x0000024c : */ 0x800c0002,0x00000950,
/*
JUMP ignore_msg1, IF 0x03 ; Save Restore Pointers
at 0x0000024e : */ 0x800c0003,0x00000950,
/*
JUMP disc1, IF 0x04 ; Disconnect
at 0x00000250 : */ 0x800c0004,0x000009f0,
/*
INT int_bad_msg1
at 0x00000252 : */ 0x98080000,0xab930006,
/*
ignore_msg1:
CLEAR ACK
at 0x00000254 : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin1
at 0x00000256 : */ 0x80080000,0x00000050,
/*
ext_msg1:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
at 0x00000258 : */ 0x7a348000,0x00000000,
/*
CLEAR ACK
at 0x0000025a : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 1, WHEN MSG_IN
at 0x0000025c : */ 0x0f000001,0x00000001,
/*
JUMP reject_msg1, IF NOT 0x03 ; Only handle SDTR
at 0x0000025e : */ 0x80040003,0x000009b0,
/*
CLEAR ACK
at 0x00000260 : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 2, WHEN MSG_IN
at 0x00000262 : */ 0x0f000001,0x00000002,
/*
JUMP reject_msg1, IF NOT 0x01 ; Only handle SDTR
at 0x00000264 : */ 0x80040001,0x000009b0,
/*
CLEAR ACK
at 0x00000266 : */ 0x60000040,0x00000000,
/*
MOVE 2, msgin_buf + 3, WHEN MSG_IN
at 0x00000268 : */ 0x0f000002,0x00000003,
/*
INT int_msg_sdtr1
at 0x0000026a : */ 0x98080000,0xab93000c,
/*
reject_msg1:
MOVE SCRATCH1 | did_reject TO SCRATCH1
at 0x0000026c : */ 0x7a350100,0x00000000,
/*
SET ATN
at 0x0000026e : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x00000270 : */ 0x60000040,0x00000000,
/*
JUMP reject_msg1a, WHEN NOT MSG_IN
at 0x00000272 : */ 0x87030000,0x000009e0,
/*
MOVE 1, msgin_buf + 7, WHEN MSG_IN
at 0x00000274 : */ 0x0f000001,0x00000007,
/*
JUMP reject_msg1
at 0x00000276 : */ 0x80080000,0x000009b0,
/*
reject_msg1a:
MOVE 1, msg_reject, WHEN MSG_OUT
at 0x00000278 : */ 0x0e000001,0x00000000,
/*
JUMP redo_msgin1
at 0x0000027a : */ 0x80080000,0x00000050,
/*
disc1:
CLEAR ACK
at 0x0000027c : */ 0x60000040,0x00000000,
/*
ENTRY wait_disc1
wait_disc1:
WAIT DISCONNECT
at 0x0000027e : */ 0x48000000,0x00000000,
/*
INT int_disc1
at 0x00000280 : */ 0x98080000,0xab930019,
/*
ENTRY resume_msgin1a
resume_msgin1a:
CLEAR ACK
at 0x00000282 : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin1
at 0x00000284 : */ 0x80080000,0x00000050,
/*
ENTRY resume_msgin1b
resume_msgin1b:
SET ATN
at 0x00000286 : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x00000288 : */ 0x60000040,0x00000000,
/*
INT int_no_msgout1, WHEN NOT MSG_OUT
at 0x0000028a : */ 0x9e030000,0xab93000f,
/*
MOVE SCRATCH0 | had_msgout TO SCRATCH0
at 0x0000028c : */ 0x7a340200,0x00000000,
/*
MOVE FROM dsa_msgout, when MSG_OUT
at 0x0000028e : */ 0x1e000000,0x00000008,
/*
JUMP redo_msgin1
at 0x00000290 : */ 0x80080000,0x00000050,
/*
get_msgin2:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
at 0x00000292 : */ 0x7a344000,0x00000000,
/*
MOVE 1, msgin_buf, WHEN MSG_IN
at 0x00000294 : */ 0x0f000001,0x00000000,
/*
JUMP ext_msg2, IF 0x01 ; Extended Message
at 0x00000296 : */ 0x800c0001,0x00000a90,
/*
JUMP ignore_msg2, IF 0x02 ; Save Data Pointers
at 0x00000298 : */ 0x800c0002,0x00000a80,
/*
JUMP ignore_msg2, IF 0x03 ; Save Restore Pointers
at 0x0000029a : */ 0x800c0003,0x00000a80,
/*
JUMP disc2, IF 0x04 ; Disconnect
at 0x0000029c : */ 0x800c0004,0x00000b20,
/*
INT int_bad_msg2
at 0x0000029e : */ 0x98080000,0xab930007,
/*
ignore_msg2:
CLEAR ACK
at 0x000002a0 : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin2
at 0x000002a2 : */ 0x80080000,0x00000070,
/*
ext_msg2:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
at 0x000002a4 : */ 0x7a348000,0x00000000,
/*
CLEAR ACK
at 0x000002a6 : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 1, WHEN MSG_IN
at 0x000002a8 : */ 0x0f000001,0x00000001,
/*
JUMP reject_msg2, IF NOT 0x03 ; Only handle SDTR
at 0x000002aa : */ 0x80040003,0x00000ae0,
/*
CLEAR ACK
at 0x000002ac : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 2, WHEN MSG_IN
at 0x000002ae : */ 0x0f000001,0x00000002,
/*
JUMP reject_msg2, IF NOT 0x01 ; Only handle SDTR
at 0x000002b0 : */ 0x80040001,0x00000ae0,
/*
CLEAR ACK
at 0x000002b2 : */ 0x60000040,0x00000000,
/*
MOVE 2, msgin_buf + 3, WHEN MSG_IN
at 0x000002b4 : */ 0x0f000002,0x00000003,
/*
INT int_msg_sdtr2
at 0x000002b6 : */ 0x98080000,0xab93000d,
/*
reject_msg2:
MOVE SCRATCH1 | did_reject TO SCRATCH1
at 0x000002b8 : */ 0x7a350100,0x00000000,
/*
SET ATN
at 0x000002ba : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x000002bc : */ 0x60000040,0x00000000,
/*
JUMP reject_msg2a, WHEN NOT MSG_IN
at 0x000002be : */ 0x87030000,0x00000b10,
/*
MOVE 1, msgin_buf + 7, WHEN MSG_IN
at 0x000002c0 : */ 0x0f000001,0x00000007,
/*
JUMP reject_msg2
at 0x000002c2 : */ 0x80080000,0x00000ae0,
/*
reject_msg2a:
MOVE 1, msg_reject, WHEN MSG_OUT
at 0x000002c4 : */ 0x0e000001,0x00000000,
/*
JUMP redo_msgin2
at 0x000002c6 : */ 0x80080000,0x00000070,
/*
disc2:
CLEAR ACK
at 0x000002c8 : */ 0x60000040,0x00000000,
/*
ENTRY wait_disc2
wait_disc2:
WAIT DISCONNECT
at 0x000002ca : */ 0x48000000,0x00000000,
/*
INT int_disc2
at 0x000002cc : */ 0x98080000,0xab93001a,
/*
ENTRY resume_msgin2a
resume_msgin2a:
CLEAR ACK
at 0x000002ce : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin2
at 0x000002d0 : */ 0x80080000,0x00000070,
/*
ENTRY resume_msgin2b
resume_msgin2b:
SET ATN
at 0x000002d2 : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x000002d4 : */ 0x60000040,0x00000000,
/*
INT int_no_msgout2, WHEN NOT MSG_OUT
at 0x000002d6 : */ 0x9e030000,0xab930010,
/*
MOVE SCRATCH0 | had_msgout TO SCRATCH0
at 0x000002d8 : */ 0x7a340200,0x00000000,
/*
MOVE FROM dsa_msgout, when MSG_OUT
at 0x000002da : */ 0x1e000000,0x00000008,
/*
JUMP redo_msgin2
at 0x000002dc : */ 0x80080000,0x00000070,
/*
get_msgin3:
MOVE SCRATCH0 | had_msgin TO SCRATCH0
at 0x000002de : */ 0x7a344000,0x00000000,
/*
MOVE 1, msgin_buf, WHEN MSG_IN
at 0x000002e0 : */ 0x0f000001,0x00000000,
/*
JUMP ext_msg3, IF 0x01 ; Extended Message
at 0x000002e2 : */ 0x800c0001,0x00000bc0,
/*
JUMP ignore_msg3, IF 0x02 ; Save Data Pointers
at 0x000002e4 : */ 0x800c0002,0x00000bb0,
/*
JUMP ignore_msg3, IF 0x03 ; Save Restore Pointers
at 0x000002e6 : */ 0x800c0003,0x00000bb0,
/*
JUMP disc3, IF 0x04 ; Disconnect
at 0x000002e8 : */ 0x800c0004,0x00000c50,
/*
INT int_bad_msg3
at 0x000002ea : */ 0x98080000,0xab930008,
/*
ignore_msg3:
CLEAR ACK
at 0x000002ec : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin3
at 0x000002ee : */ 0x80080000,0x00000900,
/*
ext_msg3:
MOVE SCRATCH0 | had_extmsg TO SCRATCH0
at 0x000002f0 : */ 0x7a348000,0x00000000,
/*
CLEAR ACK
at 0x000002f2 : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 1, WHEN MSG_IN
at 0x000002f4 : */ 0x0f000001,0x00000001,
/*
JUMP reject_msg3, IF NOT 0x03 ; Only handle SDTR
at 0x000002f6 : */ 0x80040003,0x00000c10,
/*
CLEAR ACK
at 0x000002f8 : */ 0x60000040,0x00000000,
/*
MOVE 1, msgin_buf + 2, WHEN MSG_IN
at 0x000002fa : */ 0x0f000001,0x00000002,
/*
JUMP reject_msg3, IF NOT 0x01 ; Only handle SDTR
at 0x000002fc : */ 0x80040001,0x00000c10,
/*
CLEAR ACK
at 0x000002fe : */ 0x60000040,0x00000000,
/*
MOVE 2, msgin_buf + 3, WHEN MSG_IN
at 0x00000300 : */ 0x0f000002,0x00000003,
/*
INT int_msg_sdtr3
at 0x00000302 : */ 0x98080000,0xab93000e,
/*
reject_msg3:
MOVE SCRATCH1 | did_reject TO SCRATCH1
at 0x00000304 : */ 0x7a350100,0x00000000,
/*
SET ATN
at 0x00000306 : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x00000308 : */ 0x60000040,0x00000000,
/*
JUMP reject_msg3a, WHEN NOT MSG_IN
at 0x0000030a : */ 0x87030000,0x00000c40,
/*
MOVE 1, msgin_buf + 7, WHEN MSG_IN
at 0x0000030c : */ 0x0f000001,0x00000007,
/*
JUMP reject_msg3
at 0x0000030e : */ 0x80080000,0x00000c10,
/*
reject_msg3a:
MOVE 1, msg_reject, WHEN MSG_OUT
at 0x00000310 : */ 0x0e000001,0x00000000,
/*
JUMP redo_msgin3
at 0x00000312 : */ 0x80080000,0x00000900,
/*
disc3:
CLEAR ACK
at 0x00000314 : */ 0x60000040,0x00000000,
/*
ENTRY wait_disc3
wait_disc3:
WAIT DISCONNECT
at 0x00000316 : */ 0x48000000,0x00000000,
/*
INT int_disc3
at 0x00000318 : */ 0x98080000,0xab93001b,
/*
ENTRY resume_msgin3a
resume_msgin3a:
CLEAR ACK
at 0x0000031a : */ 0x60000040,0x00000000,
/*
JUMP redo_msgin3
at 0x0000031c : */ 0x80080000,0x00000900,
/*
ENTRY resume_msgin3b
resume_msgin3b:
SET ATN
at 0x0000031e : */ 0x58000008,0x00000000,
/*
CLEAR ACK
at 0x00000320 : */ 0x60000040,0x00000000,
/*
INT int_no_msgout3, WHEN NOT MSG_OUT
at 0x00000322 : */ 0x9e030000,0xab930011,
/*
MOVE SCRATCH0 | had_msgout TO SCRATCH0
at 0x00000324 : */ 0x7a340200,0x00000000,
/*
MOVE FROM dsa_msgout, when MSG_OUT
at 0x00000326 : */ 0x1e000000,0x00000008,
/*
JUMP redo_msgin3
at 0x00000328 : */ 0x80080000,0x00000900,
/*
ENTRY resume_rej_ident
resume_rej_ident:
CLEAR ATN
at 0x0000032a : */ 0x60000008,0x00000000,
/*
MOVE 1, msgin_buf, WHEN MSG_IN
at 0x0000032c : */ 0x0f000001,0x00000000,
/*
INT int_not_rej, IF NOT 0x07 ; Reject
at 0x0000032e : */ 0x98040007,0xab93001c,
/*
CLEAR ACK
at 0x00000330 : */ 0x60000040,0x00000000,
/*
JUMP done_ident
at 0x00000332 : */ 0x80080000,0x00000048,
/*
ENTRY reselect
reselect:
; Disable selection timer
MOVE CTEST7 | 0x10 TO CTEST7
at 0x00000334 : */ 0x7a1b1000,0x00000000,
/*
WAIT RESELECT resel_err
at 0x00000336 : */ 0x50000000,0x00000cf8,
/*
INT int_resel_not_msgin, WHEN NOT MSG_IN
at 0x00000338 : */ 0x9f030000,0xab930016,
/*
MOVE 1, reselected_identify, WHEN MSG_IN
at 0x0000033a : */ 0x0f000001,0x00000000,
/*
INT int_reselected
at 0x0000033c : */ 0x98080000,0xab930017,
/*
resel_err:
MOVE CTEST2 & 0x40 TO SFBR
at 0x0000033e : */ 0x74164000,0x00000000,
/*
JUMP selected, IF 0x00
at 0x00000340 : */ 0x800c0000,0x00000d38,
/*
MOVE SFBR & 0 TO SFBR
at 0x00000342 : */ 0x7c080000,0x00000000,
/*
ENTRY patch_new_dsa
patch_new_dsa:
MOVE SFBR | 0x11 TO DSA0
at 0x00000344 : */ 0x6a101100,0x00000000,
/*
MOVE SFBR | 0x22 TO DSA1
at 0x00000346 : */ 0x6a112200,0x00000000,
/*
MOVE SFBR | 0x33 TO DSA2
at 0x00000348 : */ 0x6a123300,0x00000000,
/*
MOVE SFBR | 0x44 TO DSA3
at 0x0000034a : */ 0x6a134400,0x00000000,
/*
JUMP do_select
at 0x0000034c : */ 0x80080000,0x00000000,
/*
selected:
INT int_selected
at 0x0000034e : */ 0x98080000,0xab930018,
/*
ENTRY test1
test1:
MOVE MEMORY 4, test1_src, test1_dst
at 0x00000350 : */ 0xc0000004,0x00000000,0x00000000,
/*
INT int_test1
at 0x00000353 : */ 0x98080000,0xab93001d,
};
#define A_did_reject 0x00000001
static u32 A_did_reject_used[] __attribute((unused)) = {
0x0000026c,
0x000002b8,
0x00000304,
};
#define A_dsa_cmnd 0x00000010
static u32 A_dsa_cmnd_used[] __attribute((unused)) = {
0x0000001b,
};
#define A_dsa_datain 0x00000028
static u32 A_dsa_datain_used[] __attribute((unused)) = {
0x0000003b,
0x0000003d,
0x0000003f,
0x00000041,
0x00000043,
0x00000045,
0x00000047,
0x00000049,
0x0000004b,
0x0000004d,
0x0000004f,
0x00000051,
0x00000053,
0x00000055,
0x00000057,
0x00000059,
0x0000005b,
0x0000005d,
0x0000005f,
0x00000061,
0x00000063,
0x00000065,
0x00000067,
0x00000069,
0x0000006b,
0x0000006d,
0x0000006f,
0x00000071,
0x00000073,
0x00000075,
0x00000077,
0x00000079,
0x0000007b,
0x0000007d,
0x0000007f,
0x00000081,
0x00000083,
0x00000085,
0x00000087,
0x00000089,
0x0000008b,
0x0000008d,
0x0000008f,
0x00000091,
0x00000093,
0x00000095,
0x00000097,
0x00000099,
0x0000009b,
0x0000009d,
0x0000009f,
0x000000a1,
0x000000a3,
0x000000a5,
0x000000a7,
0x000000a9,
0x000000ab,
0x000000ad,
0x000000af,
0x000000b1,
0x000000b3,
0x000000b5,
0x000000b7,
0x000000b9,
0x000000bb,
0x000000bd,
0x000000bf,
0x000000c1,
0x000000c3,
0x000000c5,
0x000000c7,
0x000000c9,
0x000000cb,
0x000000cd,
0x000000cf,
0x000000d1,
0x000000d3,
0x000000d5,
0x000000d7,
0x000000d9,
0x000000db,
0x000000dd,
0x000000df,
0x000000e1,
0x000000e3,
0x000000e5,
0x000000e7,
0x000000e9,
0x000000eb,
0x000000ed,
0x000000ef,
0x000000f1,
0x000000f3,
0x000000f5,
0x000000f7,
0x000000f9,
0x000000fb,
0x000000fd,
0x000000ff,
0x00000101,
0x00000103,
0x00000105,
0x00000107,
0x00000109,
0x0000010b,
0x0000010d,
0x0000010f,
0x00000111,
0x00000113,
0x00000115,
0x00000117,
0x00000119,
0x0000011b,
0x0000011d,
0x0000011f,
0x00000121,
0x00000123,
0x00000125,
0x00000127,
0x00000129,
0x0000012b,
0x0000012d,
0x0000012f,
0x00000131,
0x00000133,
0x00000135,
0x00000137,
0x00000139,
};
#define A_dsa_dataout 0x00000428
static u32 A_dsa_dataout_used[] __attribute((unused)) = {
0x00000141,
0x00000143,
0x00000145,
0x00000147,
0x00000149,
0x0000014b,
0x0000014d,
0x0000014f,
0x00000151,
0x00000153,
0x00000155,
0x00000157,
0x00000159,
0x0000015b,
0x0000015d,
0x0000015f,
0x00000161,
0x00000163,
0x00000165,
0x00000167,
0x00000169,
0x0000016b,
0x0000016d,
0x0000016f,
0x00000171,
0x00000173,
0x00000175,
0x00000177,
0x00000179,
0x0000017b,
0x0000017d,
0x0000017f,
0x00000181,
0x00000183,
0x00000185,
0x00000187,
0x00000189,
0x0000018b,
0x0000018d,
0x0000018f,
0x00000191,
0x00000193,
0x00000195,
0x00000197,
0x00000199,
0x0000019b,
0x0000019d,
0x0000019f,
0x000001a1,
0x000001a3,
0x000001a5,
0x000001a7,
0x000001a9,
0x000001ab,
0x000001ad,
0x000001af,
0x000001b1,
0x000001b3,
0x000001b5,
0x000001b7,
0x000001b9,
0x000001bb,
0x000001bd,
0x000001bf,
0x000001c1,
0x000001c3,
0x000001c5,
0x000001c7,
0x000001c9,
0x000001cb,
0x000001cd,
0x000001cf,
0x000001d1,
0x000001d3,
0x000001d5,
0x000001d7,
0x000001d9,
0x000001db,
0x000001dd,
0x000001df,
0x000001e1,
0x000001e3,
0x000001e5,
0x000001e7,
0x000001e9,
0x000001eb,
0x000001ed,
0x000001ef,
0x000001f1,
0x000001f3,
0x000001f5,
0x000001f7,
0x000001f9,
0x000001fb,
0x000001fd,
0x000001ff,
0x00000201,
0x00000203,
0x00000205,
0x00000207,
0x00000209,
0x0000020b,
0x0000020d,
0x0000020f,
0x00000211,
0x00000213,
0x00000215,
0x00000217,
0x00000219,
0x0000021b,
0x0000021d,
0x0000021f,
0x00000221,
0x00000223,
0x00000225,
0x00000227,
0x00000229,
0x0000022b,
0x0000022d,
0x0000022f,
0x00000231,
0x00000233,
0x00000235,
0x00000237,
0x00000239,
0x0000023b,
0x0000023d,
0x0000023f,
};
#define A_dsa_msgin 0x00000020
static u32 A_dsa_msgin_used[] __attribute((unused)) = {
0x0000002d,
};
#define A_dsa_msgout 0x00000008
static u32 A_dsa_msgout_used[] __attribute((unused)) = {
0x00000011,
0x0000028f,
0x000002db,
0x00000327,
};
#define A_dsa_select 0x00000000
static u32 A_dsa_select_used[] __attribute((unused)) = {
0x00000004,
};
#define A_dsa_size 0x00000828
static u32 A_dsa_size_used[] __attribute((unused)) = {
};
#define A_dsa_status 0x00000018
static u32 A_dsa_status_used[] __attribute((unused)) = {
0x00000029,
};
#define A_had_cmdout 0x00000004
static u32 A_had_cmdout_used[] __attribute((unused)) = {
0x00000018,
};
#define A_had_datain 0x00000008
static u32 A_had_datain_used[] __attribute((unused)) = {
0x00000036,
};
#define A_had_dataout 0x00000010
static u32 A_had_dataout_used[] __attribute((unused)) = {
0x0000013c,
};
#define A_had_extmsg 0x00000080
static u32 A_had_extmsg_used[] __attribute((unused)) = {
0x00000258,
0x000002a4,
0x000002f0,
};
#define A_had_msgin 0x00000040
static u32 A_had_msgin_used[] __attribute((unused)) = {
0x00000246,
0x00000292,
0x000002de,
};
#define A_had_msgout 0x00000002
static u32 A_had_msgout_used[] __attribute((unused)) = {
0x0000000e,
0x0000028c,
0x000002d8,
0x00000324,
};
#define A_had_select 0x00000001
static u32 A_had_select_used[] __attribute((unused)) = {
0x0000000a,
};
#define A_had_status 0x00000020
static u32 A_had_status_used[] __attribute((unused)) = {
};
#define A_int_bad_msg1 0xab930006
static u32 A_int_bad_msg1_used[] __attribute((unused)) = {
0x00000253,
};
#define A_int_bad_msg2 0xab930007
static u32 A_int_bad_msg2_used[] __attribute((unused)) = {
0x0000029f,
};
#define A_int_bad_msg3 0xab930008
static u32 A_int_bad_msg3_used[] __attribute((unused)) = {
0x000002eb,
};
#define A_int_cmd_bad_phase 0xab930009
static u32 A_int_cmd_bad_phase_used[] __attribute((unused)) = {
0x00000025,
};
#define A_int_cmd_complete 0xab93000a
static u32 A_int_cmd_complete_used[] __attribute((unused)) = {
0x00000035,
};
#define A_int_data_bad_phase 0xab93000b
static u32 A_int_data_bad_phase_used[] __attribute((unused)) = {
0x00000245,
};
#define A_int_disc1 0xab930019
static u32 A_int_disc1_used[] __attribute((unused)) = {
0x00000281,
};
#define A_int_disc2 0xab93001a
static u32 A_int_disc2_used[] __attribute((unused)) = {
0x000002cd,
};
#define A_int_disc3 0xab93001b
static u32 A_int_disc3_used[] __attribute((unused)) = {
0x00000319,
};
#define A_int_msg_sdtr1 0xab93000c
static u32 A_int_msg_sdtr1_used[] __attribute((unused)) = {
0x0000026b,
};
#define A_int_msg_sdtr2 0xab93000d
static u32 A_int_msg_sdtr2_used[] __attribute((unused)) = {
0x000002b7,
};
#define A_int_msg_sdtr3 0xab93000e
static u32 A_int_msg_sdtr3_used[] __attribute((unused)) = {
0x00000303,
};
#define A_int_no_msgout1 0xab93000f
static u32 A_int_no_msgout1_used[] __attribute((unused)) = {
0x0000028b,
};
#define A_int_no_msgout2 0xab930010
static u32 A_int_no_msgout2_used[] __attribute((unused)) = {
0x000002d7,
};
#define A_int_no_msgout3 0xab930011
static u32 A_int_no_msgout3_used[] __attribute((unused)) = {
0x00000323,
};
#define A_int_not_cmd_complete 0xab930012
static u32 A_int_not_cmd_complete_used[] __attribute((unused)) = {
0x0000002f,
};
#define A_int_not_rej 0xab93001c
static u32 A_int_not_rej_used[] __attribute((unused)) = {
0x0000032f,
};
#define A_int_resel_not_msgin 0xab930016
static u32 A_int_resel_not_msgin_used[] __attribute((unused)) = {
0x00000339,
};
#define A_int_reselected 0xab930017
static u32 A_int_reselected_used[] __attribute((unused)) = {
0x0000033d,
};
#define A_int_sel_no_ident 0xab930013
static u32 A_int_sel_no_ident_used[] __attribute((unused)) = {
0x0000000d,
};
#define A_int_sel_not_cmd 0xab930014
static u32 A_int_sel_not_cmd_used[] __attribute((unused)) = {
0x00000017,
};
#define A_int_selected 0xab930018
static u32 A_int_selected_used[] __attribute((unused)) = {
0x0000034f,
};
#define A_int_status_not_msgin 0xab930015
static u32 A_int_status_not_msgin_used[] __attribute((unused)) = {
0x0000002b,
};
#define A_int_test1 0xab93001d
static u32 A_int_test1_used[] __attribute((unused)) = {
0x00000354,
};
#define A_msg_reject 0x00000000
static u32 A_msg_reject_used[] __attribute((unused)) = {
0x00000279,
0x000002c5,
0x00000311,
};
#define A_msgin_buf 0x00000000
static u32 A_msgin_buf_used[] __attribute((unused)) = {
0x00000249,
0x0000025d,
0x00000263,
0x00000269,
0x00000275,
0x00000295,
0x000002a9,
0x000002af,
0x000002b5,
0x000002c1,
0x000002e1,
0x000002f5,
0x000002fb,
0x00000301,
0x0000030d,
0x0000032d,
};
#define A_reselected_identify 0x00000000
static u32 A_reselected_identify_used[] __attribute((unused)) = {
0x0000033b,
};
#define A_test1_dst 0x00000000
static u32 A_test1_dst_used[] __attribute((unused)) = {
0x00000352,
};
#define A_test1_src 0x00000000
static u32 A_test1_src_used[] __attribute((unused)) = {
0x00000351,
};
#define Ent_do_select 0x00000000
#define Ent_done_ident 0x00000048
#define Ent_end_data_trans 0x00000900
#define Ent_patch_input_data 0x000000e0
#define Ent_patch_new_dsa 0x00000d10
#define Ent_patch_output_data 0x000004f8
#define Ent_reselect 0x00000cd0
#define Ent_resume_cmd 0x00000060
#define Ent_resume_msgin1a 0x00000a08
#define Ent_resume_msgin1b 0x00000a18
#define Ent_resume_msgin2a 0x00000b38
#define Ent_resume_msgin2b 0x00000b48
#define Ent_resume_msgin3a 0x00000c68
#define Ent_resume_msgin3b 0x00000c78
#define Ent_resume_pmm 0x00000070
#define Ent_resume_rej_ident 0x00000ca8
#define Ent_test1 0x00000d40
#define Ent_wait_disc1 0x000009f8
#define Ent_wait_disc2 0x00000b28
#define Ent_wait_disc3 0x00000c58
#define Ent_wait_disc_complete 0x000000c8
static u32 LABELPATCHES[] __attribute((unused)) = {
0x00000005,
0x00000007,
0x00000013,
0x00000015,
0x0000001d,
0x0000001f,
0x00000021,
0x00000023,
0x0000013b,
0x00000241,
0x00000243,
0x0000024b,
0x0000024d,
0x0000024f,
0x00000251,
0x00000257,
0x0000025f,
0x00000265,
0x00000273,
0x00000277,
0x0000027b,
0x00000285,
0x00000291,
0x00000297,
0x00000299,
0x0000029b,
0x0000029d,
0x000002a3,
0x000002ab,
0x000002b1,
0x000002bf,
0x000002c3,
0x000002c7,
0x000002d1,
0x000002dd,
0x000002e3,
0x000002e5,
0x000002e7,
0x000002e9,
0x000002ef,
0x000002f7,
0x000002fd,
0x0000030b,
0x0000030f,
0x00000313,
0x0000031d,
0x00000329,
0x00000333,
0x00000337,
0x00000341,
0x0000034d,
};
static struct {
u32 offset;
void *address;
} EXTERNAL_PATCHES[] __attribute((unused)) = {
};
static u32 INSTRUCTIONS __attribute((unused)) = 426;
static u32 PATCHES __attribute((unused)) = 51;
static u32 EXTERNAL_PATCHES_LEN __attribute((unused)) = 0;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment