📄 53c7xx.h
字号:
/* * 53c710 driver. Modified from Drew Eckhardts driver * for 53c810 by Richard Hirst [richard@sleepie.demon.co.uk] * * I have left the code for the 53c8xx family in here, because it didn't * seem worth removing it. The possibility of IO_MAPPED chips rather * than MEMORY_MAPPED remains, in case someone wants to add support for * 53c710 chips on Intel PCs (some older machines have them on the * motherboard). * * NOTE THERE MAY BE PROBLEMS WITH CASTS IN read8 AND Co. *//* * 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 NCR53c710_H#define NCR53c710_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 MODULEextern int NCR53c7xx_release(struct Scsi_Host *);#else#define NCR53c7xx_release NULL#endif#define NCR53c7xx {NULL, NULL, NULL, NULL, \ "NCR53c{7,8}xx (rel 17)", NCR53c7xx_detect,\ NULL, /* info */ NULL, /* command, deprecated */ NULL, \ NCR53c7xx_queue_command, NCR53c7xx_abort, NCR53c7xx_reset, \ NULL /* slave attach */, scsicam_bios_param, /* can queue */ 24, \ /* id */ 7, 127 /* old SG_ALL */, /* cmd per lun */ 3, \ /* present */ 0, /* unchecked isa dma */ 0, DISABLE_CLUSTERING} #ifndef HOSTS_C/* 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 SOCL_REG 0x07#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 /* * 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 SBCL_REG 0x0b #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 #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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -