tmscsim.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 652 行 · 第 1/2 页

H
652
字号
/***********************************************************************;*	File Name : TMSCSIM.H					       *;*		    TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter  *;*		    Device Driver				       *;***********************************************************************//* $Id: tmscsim.h,v 2.15.2.3 2000/11/17 20:52:27 garloff Exp $ */#ifndef _TMSCSIM_H#define _TMSCSIM_H#include <linux/types.h>#include <linux/config.h>#define SCSI_IRQ_NONE 255#define MAX_ADAPTER_NUM 	4#define MAX_SG_LIST_BUF 	16	/* Not used */#define MAX_CMD_PER_LUN 	32#define MAX_CMD_QUEUE		MAX_CMD_PER_LUN+MAX_CMD_PER_LUN/2+1	#define MAX_SCSI_ID		8#define MAX_SRB_CNT		MAX_CMD_QUEUE+1	/* Max number of started commands */#define SEL_TIMEOUT		153	/* 250 ms selection timeout (@ 40 MHz) */#define pci_dma_lo32(a)			(a & 0xffffffff)typedef u8		UCHAR;	/*  8 bits */typedef u16		USHORT;	/* 16 bits */typedef u32		UINT;	/* 32 bits */typedef unsigned long	ULONG;	/* 32/64 bits *//*;-----------------------------------------------------------------------; SCSI Request Block;-----------------------------------------------------------------------*/struct dc390_srb{//u8		CmdBlock[12];struct dc390_srb	*pNextSRB;struct dc390_dcb	*pSRBDCB;struct scsi_cmnd	*pcmd;struct scatterlist	*pSegmentList;/* 0x10: */struct scatterlist Segmentx;	/* make a one entry of S/G list table *//* 0x1c: */unsigned long	SGBusAddr;	/*;a segment starting address as seen by AM53C974A*/unsigned long	SGToBeXferLen;	/*; to be xfer length */unsigned long	TotalXferredLen;unsigned long	SavedTotXLen;u32		SRBState;/* 0x30: */u8		SRBStatus;u8		SRBFlag;	/*; b0-AutoReqSense,b6-Read,b7-write */				/*; b4-settimeout,b5-Residual valid */u8		AdaptStatus;u8		TargetStatus;u8		ScsiPhase;u8		TagNumber;u8		SGIndex;u8		SGcount;/* 0x38: */u8		MsgCnt;u8		EndMessage;u8		RetryCnt;u8		SavedSGCount;			unsigned long	Saved_Ptr;/* 0x40: */u8		MsgInBuf[6];u8		MsgOutBuf[6];//u8		IORBFlag;	/*;81h-Reset, 2-retry *//* 0x4c: */};/*;-----------------------------------------------------------------------; Device Control Block;-----------------------------------------------------------------------*/struct dc390_dcb{struct dc390_dcb	*pNextDCB;struct dc390_acb	*pDCBACB;/* 0x08: *//* Queued SRBs */struct dc390_srb	*pWaitingSRB;struct dc390_srb	*pWaitLast;struct dc390_srb	*pGoingSRB;struct dc390_srb	*pGoingLast;struct dc390_srb	*pActiveSRB;u8		WaitSRBCnt;	/* Not used */u8		GoingSRBCnt;u8		DevType;u8		MaxCommand;/* 0x20: */u32		TagMask;u8		TargetID;	/*; SCSI Target ID  (SCSI Only) */u8		TargetLUN;	/*; SCSI Log.  Unit (SCSI Only) */u8		DevMode;u8		DCBFlag;u8		CtrlR1;u8		CtrlR3;u8		CtrlR4;u8		Inquiry7;/* 0x2c: */u8		SyncMode;	/*; 0:async mode */u8		NegoPeriod;	/*;for nego. */u8		SyncPeriod;	/*;for reg. */u8		SyncOffset;	/*;for reg. and nego.(low nibble) *//* 0x30:*///u8		InqDataBuf[8];//u8		CapacityBuf[8];///* 0x40: */};/*;-----------------------------------------------------------------------; Adapter Control Block;-----------------------------------------------------------------------*/struct dc390_acb{struct Scsi_Host *pScsiHost;struct dc390_acb	*pNextACB;u16		IOPortBase;u8		IRQLevel;u8		status;u8		SRBCount;u8		AdapterIndex;	/*; nth Adapter this driver */u8		DCBCnt;u8		TagMaxNum;u8		ACBFlag;u8		Gmode2;u8		scan_devices;struct dc390_dcb	*pLinkDCB;struct dc390_dcb	*pLastDCB;struct dc390_dcb	*pDCBRunRobin;struct dc390_dcb	*pActiveDCB;struct dc390_srb	*pFreeSRB;struct dc390_srb	*pTmpSRB;u8		msgin123[4];u8		Connected;u8		pad;#if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0)spinlock_t	lock;#endifu8		sel_timeout;u8		glitch_cfg;u8		MsgLen;u8		Ignore_IRQ;	/* Not used */struct pci_dev	*pdev;unsigned long	Cmds;u32		SelLost;u32		SelConn;u32		CmdInQ;u32		CmdOutOfSRB;	struct timer_list	Waiting_Timer;struct dc390_srb	TmpSRB;struct dc390_srb	SRB_array[MAX_SRB_CNT]; 	/* 50 SRBs */};/*;-----------------------------------------------------------------------*/#define BIT31	0x80000000#define BIT30	0x40000000#define BIT29	0x20000000#define BIT28	0x10000000#define BIT27	0x08000000#define BIT26	0x04000000#define BIT25	0x02000000#define BIT24	0x01000000#define BIT23	0x00800000#define BIT22	0x00400000#define BIT21	0x00200000#define BIT20	0x00100000#define BIT19	0x00080000#define BIT18	0x00040000#define BIT17	0x00020000#define BIT16	0x00010000#define BIT15	0x00008000#define BIT14	0x00004000#define BIT13	0x00002000#define BIT12	0x00001000#define BIT11	0x00000800#define BIT10	0x00000400#define BIT9	0x00000200#define BIT8	0x00000100#define BIT7	0x00000080#define BIT6	0x00000040#define BIT5	0x00000020#define BIT4	0x00000010#define BIT3	0x00000008#define BIT2	0x00000004#define BIT1	0x00000002#define BIT0	0x00000001/*;---UnitCtrlFlag */#define UNIT_ALLOCATED	BIT0#define UNIT_INFO_CHANGED BIT1#define FORMATING_MEDIA BIT2#define UNIT_RETRY	BIT3/*;---UnitFlags */#define DASD_SUPPORT	BIT0#define SCSI_SUPPORT	BIT1#define ASPI_SUPPORT	BIT2/*;----SRBState machine definition */#define SRB_FREE	0#define SRB_WAIT	BIT0#define SRB_READY	BIT1#define SRB_MSGOUT	BIT2	/*;arbitration+msg_out 1st byte*/#define SRB_MSGIN	BIT3#define SRB_MSGIN_MULTI BIT4#define SRB_COMMAND	BIT5#define SRB_START_	BIT6	/*;arbitration+msg_out+command_out*/#define SRB_DISCONNECT	BIT7#define SRB_DATA_XFER	BIT8#define SRB_XFERPAD	BIT9#define SRB_STATUS	BIT10#define SRB_COMPLETED	BIT11#define SRB_ABORT_SENT	BIT12#define DO_SYNC_NEGO	BIT13#define SRB_UNEXPECT_RESEL BIT14/*;---SRBstatus */#define SRB_OK		BIT0#define ABORTION	BIT1#define OVER_RUN	BIT2#define UNDER_RUN	BIT3#define PARITY_ERROR	BIT4#define SRB_ERROR	BIT5/*;---ACBFlag */#define RESET_DEV	BIT0#define RESET_DETECT	BIT1#define RESET_DONE	BIT2/*;---DCBFlag */#define ABORT_DEV_	BIT0/*;---SRBFlag */#define DATAOUT 	BIT7#define DATAIN		BIT6#define RESIDUAL_VALID	BIT5#define ENABLE_TIMER	BIT4#define RESET_DEV0	BIT2#define ABORT_DEV	BIT1#define AUTO_REQSENSE	BIT0/*;---Adapter status */#define H_STATUS_GOOD	 0#define H_SEL_TIMEOUT	 0x11#define H_OVER_UNDER_RUN 0x12#define H_UNEXP_BUS_FREE 0x13#define H_TARGET_PHASE_F 0x14#define H_INVALID_CCB_OP 0x16#define H_LINK_CCB_BAD	 0x17#define H_BAD_TARGET_DIR 0x18#define H_DUPLICATE_CCB  0x19#define H_BAD_CCB_OR_SG  0x1A#define H_ABORT 	 0x0FF/*; SCSI Status byte codes*/ /* The values defined in include/scsi/scsi.h, to be shifted << 1 */#define SCSI_STAT_UNEXP_BUS_F	0xFD	/*;  Unexpect Bus Free */#define SCSI_STAT_BUS_RST_DETECT 0xFE	/*;  Scsi Bus Reset detected */#define SCSI_STAT_SEL_TIMEOUT	0xFF	/*;  Selection Time out *//* cmd->result */#define RES_TARGET		0x000000FF	/* Target State */#define RES_TARGET_LNX		STATUS_MASK	/* Only official ... */#define RES_ENDMSG		0x0000FF00	/* End Message */#define RES_DID			0x00FF0000	/* DID_ codes */#define RES_DRV			0xFF000000	/* DRIVER_ codes */#define MK_RES(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))#define MK_RES_LNX(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)#define SET_RES_TARGET(who,tgt) { who &= ~RES_TARGET; who |= (int)(tgt); }#define SET_RES_TARGET_LNX(who,tgt) { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }#define SET_RES_MSG(who,msg) { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }#define SET_RES_DID(who,did) { who &= ~RES_DID; who |= (int)(did) << 16; }#define SET_RES_DRV(who,drv) { who &= ~RES_DRV; who |= (int)(drv) << 24; }/*;---Sync_Mode */#define SYNC_DISABLE	0#define SYNC_ENABLE	BIT0#define SYNC_NEGO_DONE	BIT1#define WIDE_ENABLE	BIT2	/* Not used ;-) */#define WIDE_NEGO_DONE	BIT3	/* Not used ;-) */#define EN_TAG_QUEUEING	BIT4#define EN_ATN_STOP	BIT5

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?