/* ESP command register read-write */ /* Group 1 commands: These may be sent at any point in time to the ESP *chip.Noneofthemcangenerateinterrupts'cept *the"SCSIbusreset"commandifyouhavenotdisabled *SCSIresetinterruptsintheconfig1ESPregister.
*/ #define ESP_CMD_NULL 0x00 /* Null command, ie. a nop */ #define ESP_CMD_FLUSH 0x01 /* FIFO Flush */ #define ESP_CMD_RC 0x02 /* Chip reset */ #define ESP_CMD_RS 0x03 /* SCSI bus reset */
/* Group 2 commands: ESP must be an initiator and connected to a target *forthesecommandstowork.
*/ #define ESP_CMD_TI 0x10 /* Transfer Information */ #define ESP_CMD_ICCSEQ 0x11 /* Initiator cmd complete sequence */ #define ESP_CMD_MOK 0x12 /* Message okie-dokie */ #define ESP_CMD_TPAD 0x18 /* Transfer Pad */ #define ESP_CMD_SATN 0x1a /* Set ATN */ #define ESP_CMD_RATN 0x1b /* De-assert ATN */
/* Group 3 commands: ESP must be in the MSGOUT or MSGIN state and be connected *toatargetastheinitiatorforthesecommandstowork.
*/ #define ESP_CMD_SMSG 0x20 /* Send message */ #define ESP_CMD_SSTAT 0x21 /* Send status */ #define ESP_CMD_SDATA 0x22 /* Send data */ #define ESP_CMD_DSEQ 0x23 /* Discontinue Sequence */ #define ESP_CMD_TSEQ 0x24 /* Terminate Sequence */ #define ESP_CMD_TCCSEQ 0x25 /* Target cmd cmplt sequence */ #define ESP_CMD_DCNCT 0x27 /* Disconnect */ #define ESP_CMD_RMSG 0x28 /* Receive Message */ #define ESP_CMD_RCMD 0x29 /* Receive Command */ #define ESP_CMD_RDATA 0x2a /* Receive Data */ #define ESP_CMD_RCSEQ 0x2b /* Receive cmd sequence */
/* Group 4 commands: The ESP must be in the disconnected state and must *notbeconnectedtoanytargetsasinitiatorfor *thesecommandstowork.
*/ #define ESP_CMD_RSEL 0x40 /* Reselect */ #define ESP_CMD_SEL 0x41 /* Select w/o ATN */ #define ESP_CMD_SELA 0x42 /* Select w/ATN */ #define ESP_CMD_SELAS 0x43 /* Select w/ATN & STOP */ #define ESP_CMD_ESEL 0x44 /* Enable selection */ #define ESP_CMD_DSEL 0x45 /* Disable selections */ #define ESP_CMD_SA3 0x46 /* Select w/ATN3 */ #define ESP_CMD_RSEL3 0x47 /* Reselect3 */
/* This bit enables the ESP's DMA on the SBus */ #define ESP_CMD_DMA 0x80 /* Do DMA? */
/* ESP status register read-only */ #define ESP_STAT_PIO 0x01 /* IO phase bit */ #define ESP_STAT_PCD 0x02 /* CD phase bit */ #define ESP_STAT_PMSG 0x04 /* MSG phase bit */ #define ESP_STAT_PMASK 0x07 /* Mask of phase bits */ #define ESP_STAT_TDONE 0x08 /* Transfer Completed */ #define ESP_STAT_TCNT 0x10 /* Transfer Counter Is Zero */ #define ESP_STAT_PERR 0x20 /* Parity error */ #define ESP_STAT_SPAM 0x40 /* Real bad error */ /* This indicates the 'interrupt pending' condition on esp236, it is a reserved *bitonotherrevsoftheESP.
*/ #define ESP_STAT_INTR 0x80 /* Interrupt */
/* The status register can be masked with ESP_STAT_PMASK and compared *withthefollowingvaluestodeterminethecurrentphasetheESP *(atleastthinksit)isin.Forourpurposeswealsoaddourown *software'done'bitforourphasemanagementengine.
*/ #define ESP_DOP (0) /* Data Out */ #define ESP_DIP (ESP_STAT_PIO) /* Data In */ #define ESP_CMDP (ESP_STAT_PCD) /* Command */ #define ESP_STATP (ESP_STAT_PCD|ESP_STAT_PIO) /* Status */ #define ESP_MOP (ESP_STAT_PMSG|ESP_STAT_PCD) /* Message Out */ #define ESP_MIP (ESP_STAT_PMSG|ESP_STAT_PCD|ESP_STAT_PIO) /* Message In */
/* HME only: status 2 register */ #define ESP_STAT2_SCHBIT 0x01 /* Upper bits 3-7 of sstep enabled */ #define ESP_STAT2_FFLAGS 0x02 /* The fifo flags are now latched */ #define ESP_STAT2_XCNT 0x04 /* The transfer counter is latched */ #define ESP_STAT2_CREGA 0x08 /* The command reg is active now */ #define ESP_STAT2_WIDE 0x10 /* Interface on this adapter is wide */ #define ESP_STAT2_F1BYTE 0x20 /* There is one byte at top of fifo */ #define ESP_STAT2_FMSB 0x40 /* Next byte in fifo is most significant */ #define ESP_STAT2_FEMPTY 0x80 /* FIFO is empty */
/* ESP fifo flags register read-only */ /* Note that the following implies a 16 byte FIFO on the ESP. */ #define ESP_FF_FBYTES 0x1f /* Num bytes in FIFO */ #define ESP_FF_ONOTZERO 0x20 /* offset ctr not zero (esp100) */ #define ESP_FF_SSTEP 0xe0 /* Sequence step */
/* For slow to medium speed input clock rates we shoot for 5mb/s, but for high *inputclockrateswetrytodo10mb/salthoughIdon'tthinkatransfercan *evenrunthatfastwithanESPevenwithDMA2scattergatherpipelining.
*/ #define SYNC_DEFP_SLOW 0x32 /* 5mb/s */ #define SYNC_DEFP_FAST 0x19 /* 10mb/s */
struct esp_cmd_priv { int num_sg; int cur_residue; struct scatterlist *prv_sg; struct scatterlist *cur_sg; int tot_residue;
};
struct esp_lun_data { struct esp_cmd_entry *non_tagged_cmd; int num_tagged; int hold; struct esp_cmd_entry *tagged_cmds[ESP_MAX_TAG];
};
struct esp_target_data { /* These are the ESP_STP, ESP_SOFF, and ESP_CFG3 register values which *matchthecurrentlynegotiatedsettingsforthistarget.TheSCSI *protocolvaluesaremaintainedinspi_{offset,period,wide}(starget).
*/
u8 esp_period;
u8 esp_offset;
u8 esp_config3;
/* When ESP_TGT_CHECK_NEGO is set, on the next scsi command to this *devicewewilltrytonegotiatethefollowingparameters.
*/
u8 nego_goal_period;
u8 nego_goal_offset;
u8 nego_goal_width;
u8 nego_goal_tags;
struct esp; struct esp_driver_ops { /* Read and write the ESP 8-bit registers. On some *applicationsoftheESPchiptheregistersareat4-byte *insteadof1-byteintervals.
*/ void (*esp_write8)(struct esp *esp, u8 val, unsignedlong reg);
u8 (*esp_read8)(struct esp *esp, unsignedlong reg);
/* Return non-zero if there is an IRQ pending. Usually this *statusbitlivesintheDMAcontrollersittinginfrontof *theESP.ThishastobeaccurateorelsetheESPinterrupt *handlerwillnotrun.
*/ int (*irq_pending)(struct esp *esp);
/* Return the maximum allowable size of a DMA transfer for a *givenbuffer.
*/
u32 (*dma_length_limit)(struct esp *esp, u32 dma_addr,
u32 dma_len);
/* Reset the DMA engine entirely. On return, ESP interrupts *shouldbeenabled.Oftentheinterruptenablingis *controlledintheDMAengine.
*/ void (*reset_dma)(struct esp *esp);
/* Drain any pending DMA in the DMA engine after a transfer. *Thisisforwritestomemory.
*/ void (*dma_drain)(struct esp *esp);
/* Invalidate the DMA engine after a DMA transfer. */ void (*dma_invalidate)(struct esp *esp);
/* Setup an ESP command that will use a DMA transfer. *The'esp_count'specifieswhattransferlengthshouldbe *programmedintotheESPtransfercounterregisters,whereas *the'dma_count'isthelengththatshouldbeprogrammedinto *theDMAcontroller.Usuallytheyarethesame.If'write' *isnon-zero,thistransferisawriteintomemory.'cmd' *holdstheESPcommandthatshouldbeissuedbycalling *scsi_esp_cmd()attheappropriatetimewhileprogramming *theDMAhardware.
*/ void (*send_dma_cmd)(struct esp *esp, u32 dma_addr, u32 esp_count,
u32 dma_count, int write, u8 cmd);
/* Return non-zero if the DMA engine is reporting an error *currently.
*/ int (*dma_error)(struct esp *esp);
};
/* The following are used to determine the cause of an IRQ. Upon every *IRQentrywesynchronizethesewiththehardwareregisters.
*/
u8 sreg;
u8 seqreg;
u8 sreg2;
u8 ireg;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.