⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncr53c8xx.c

📁 GNU Mach 微内核源代码, 基于美国卡内基美隆大学的 Mach 研究项目
💻 C
📖 第 1 页 / 共 5 页
字号:
**==========================================================*/struct tcb {	/*	**	during reselection the ncr jumps to this point	**	with SFBR set to the encoded target number	**	with bit 7 set.	**	if it's not this target, jump to the next.	**	**	JUMP  IF (SFBR != #target#)	**	@(next tcb)	*/	struct link   jump_tcb;	/*	**	load the actual values for the sxfer and the scntl3	**	register (sync/wide mode).	**	**	SCR_COPY (1);	**	@(sval field of this tcb)	**	@(sxfer register)	**	SCR_COPY (1);	**	@(wval field of this tcb)	**	@(scntl3 register)	*/	ncrcmd	getscr[6];	/*	**	if next message is "identify"	**	then load the message to SFBR,	**	else load 0 to SFBR.	**	**	CALL	**	<RESEL_LUN>	*/	struct link   call_lun;	/*	**	now look for the right lun.	**	**	JUMP	**	@(first ccb of this lun)	*/	struct link   jump_lcb;	/*	**	pointer to interrupted getcc ccb	*/	ccb_p   hold_cp;	/*	**	pointer to ccb used for negotiating.	**	Avoid to start a nego for all queued commands 	**	when tagged command queuing is enabled.	*/	ccb_p   nego_cp;	/*	**	statistical data	*/	u_long	transfers;	u_long	bytes;	/*	**	user settable limits for sync transfer	**	and tagged commands.	**	These limits are read from the NVRAM if present.	*/	u_char	usrsync;	u_char	usrwide;	u_char	usrtags;	u_char	usrflag;	u_char	numtags;	u_char	maxtags;	u_short	num_good;	/*	**	negotiation of wide and synch transfer.	**	device quirks.	*//*0*/	u_char	minsync;/*1*/	u_char	sval;/*2*/	u_short	period;/*0*/	u_char	maxoffs;/*1*/	u_char	quirks;/*2*/	u_char	widedone;/*3*/	u_char	wval;	/*	**	inquire data	*/#define MAX_INQUIRE 36	u_char	inqdata[MAX_INQUIRE];	/*	**	the lcb's of this tcb	*/	lcb_p   lp[MAX_LUN];};/*==========================================================****	Declaration of structs:		lun control block****==========================================================*/struct lcb {	/*	**	during reselection the ncr jumps to this point	**	with SFBR set to the "Identify" message.	**	if it's not this lun, jump to the next.	**	**	JUMP  IF (SFBR != #lun#)	**	@(next lcb of this target)	*/	struct link	jump_lcb;	/*	**	if next message is "simple tag",	**	then load the tag to SFBR,	**	else load 0 to SFBR.	**	**	CALL	**	<RESEL_TAG>	*/	struct link	call_tag;	/*	**	now look for the right ccb.	**	**	JUMP	**	@(first ccb of this lun)	*/	struct link	jump_ccb;	/*	**	start of the ccb chain	*/	ccb_p	next_ccb;	/*	**	Control of tagged queueing	*/	u_char		reqccbs;	u_char		actccbs;	u_char		reqlink;	u_char		actlink;	u_char		usetags;	u_char		lasttag;	/*	**	Linux specific fields:	**	Number of active commands and current credit.	**	Should be managed by the generic scsi driver	*/	u_char		active;	u_char		opennings;	/*-----------------------------------------------	**	Flag to force M_ORDERED_TAG on next command	**	in order to avoid spurious timeout when	**	M_SIMPLE_TAG is used for all operations.	**-----------------------------------------------	*/	u_char	force_ordered_tag;#define NCR_TIMEOUT_INCREASE	(5*HZ)};/*==========================================================****      Declaration of structs:     COMMAND control block****==========================================================****	This substructure is copied from the ccb to a**	global address after selection (or reselection)**	and copied back before disconnect.****	These fields are accessible to the script processor.****----------------------------------------------------------*/struct head {	/*	**	Execution of a ccb starts at this point.	**	It's a jump to the "SELECT" label	**	of the script.	**	**	After successful selection the script	**	processor overwrites it with a jump to	**	the IDLE label of the script.	*/	struct link	launch;	/*	**	Saved data pointer.	**	Points to the position in the script	**	responsible for the actual transfer	**	of data.	**	It's written after reception of a	**	"SAVE_DATA_POINTER" message.	**	The goalpointer points after	**	the last transfer command.	*/	u_int32		savep;	u_int32		lastp;	u_int32		goalp;	/*	**	The virtual address of the ccb	**	containing this header.	*/	ccb_p	cp;	/*	**	space for some timestamps to gather	**	profiling data about devices and this driver.	*/	struct tstamp	stamp;	/*	**	status fields.	*/	u_char		scr_st[4];	/* script status */	u_char		status[4];	/* host status. Must be the last */					/* DWORD of the CCB header */};/***	The status bytes are used by the host and the script processor.****	The byte corresponding to the host_status must be stored in the **	last DWORD of the CCB header since it is used for command **	completion (ncr_wakeup()). Doing so, we are sure that the header **	has been entirely copied back to the CCB when the host_status is **	seen complete by the CPU.****	The last four bytes (status[4]) are copied to the scratchb register**	(declared as scr0..scr3 in ncr_reg.h) just after the select/reselect,**	and copied back just after disconnecting.**	Inside the script the XX_REG are used.****	The first four bytes (scr_st[4]) are used inside the script by **	"COPY" commands.**	Because source and destination must have the same alignment**	in a DWORD, the fields HAVE to be at the choosen offsets.**		xerr_st		0	(0x34)	scratcha**		sync_st		1	(0x05)	sxfer**		wide_st		3	(0x03)	scntl3*//***	Last four bytes (script)*/#define  QU_REG	scr0#define  HS_REG	scr1#define  HS_PRT	nc_scr1#define  SS_REG	scr2#define  PS_REG	scr3/***	Last four bytes (host)*/#define  actualquirks  phys.header.status[0]#define  host_status   phys.header.status[1]#define  scsi_status   phys.header.status[2]#define  parity_status phys.header.status[3]/***	First four bytes (script)*/#define  xerr_st       header.scr_st[0]#define  sync_st       header.scr_st[1]#define  nego_st       header.scr_st[2]#define  wide_st       header.scr_st[3]/***	First four bytes (host)*/#define  xerr_status   phys.xerr_st#define  sync_status   phys.sync_st#define  nego_status   phys.nego_st#define  wide_status   phys.wide_st/*==========================================================****      Declaration of structs:     Data structure block****==========================================================****	During execution of a ccb by the script processor,**	the DSA (data structure address) register points**	to this substructure of the ccb.**	This substructure contains the header with**	the script-processor-changable data and**	data blocks for the indirect move commands.****----------------------------------------------------------*/struct dsb {	/*	**	Header.	**	Has to be the first entry,	**	because it's jumped to by the	**	script processor	*/	struct head	header;	/*	**	Table data for Script	*/	struct scr_tblsel  select;	struct scr_tblmove smsg  ;	struct scr_tblmove smsg2 ;	struct scr_tblmove cmd   ;	struct scr_tblmove scmd  ;	struct scr_tblmove sense ;	struct scr_tblmove data [MAX_SCATTER];};/*==========================================================****      Declaration of structs:     Command control block.****==========================================================****	During execution of a ccb by the script processor,**	the DSA (data structure address) register points**	to this substructure of the ccb.**	This substructure contains the header with**	the script-processor-changable data and then**	data blocks for the indirect move commands.****----------------------------------------------------------*/struct ccb {	/*	**	This field forces 32 bytes alignement for phys.header,	**	in order to use cache line bursting when copying it 	**	to the ncb.	*/	struct link		filler[2];	/*	**	during reselection the ncr jumps to this point.	**	If a "SIMPLE_TAG" message was received,	**	then SFBR is set to the tag.	**	else SFBR is set to 0	**	If looking for another tag, jump to the next ccb.	**	**	JUMP  IF (SFBR != #TAG#)	**	@(next ccb of this lun)	*/	struct link		jump_ccb;	/*	**	After execution of this call, the return address	**	(in  the TEMP register) points to the following	**	data structure block.	**	So copy it to the DSA register, and start	**	processing of this data structure.	**	**	CALL	**	<RESEL_TMP>	*/	struct link		call_tmp;	/*	**	This is the data structure which is	**	to be executed by the script processor.	*/	struct dsb		phys;	/*	**	If a data transfer phase is terminated too early	**	(after reception of a message (i.e. DISCONNECT)),	**	we have to prepare a mini script to transfer	**	the rest of the data.	*/	ncrcmd			patch[8];	/*	**	The general SCSI driver provides a	**	pointer to a control block.	*/	Scsi_Cmnd	*cmd;	int data_len;	/*	**	We prepare a message to be sent after selection,	**	and a second one to be sent after getcc selection.	**      Contents are IDENTIFY and SIMPLE_TAG.	**	While negotiating sync or wide transfer,	**	a SDTM or WDTM message is appended.	*/	u_char			scsi_smsg [8];	u_char			scsi_smsg2[8];	/*	**	Lock this ccb.	**	Flag is used while looking for a free ccb.	*/	u_long		magic;	/*	**	Physical address of this instance of ccb	*/	u_long		p_ccb;	/*	**	Completion time out for this job.	**	It's set to time of start + allowed number of seconds.	*/	u_long		tlimit;	/*	**	All ccbs of one hostadapter are chained.	*/	ccb_p		link_ccb;	/*	**	All ccbs of one target/lun are chained.	*/	ccb_p		next_ccb;	/*	**	Sense command	*/	u_char		sensecmd[6];	/*	**	Tag for this transfer.	**	It's patched into jump_ccb.	**	If it's not zero, a SIMPLE_TAG	**	message is included in smsg.	*/	u_char			tag;	/*	**	Number of segments of the scatter list.	**	Used for recalculation of savep/goalp/lastp on 	**	SIR_DATA_IO_IS_OUT interrupt.	*/		u_char			segments;};#define CCB_PHYS(cp,lbl)	(cp->p_ccb + offsetof(struct ccb, lbl))/*==========================================================****      Declaration of structs:     NCR device descriptor****==========================================================*/struct ncb {	/*	**	The global header.	**	Accessible to both the host and the	**	script-processor.	**	Is 32 bytes aligned since ncb is, in order to 	**	allow cache line bursting when copying it from or 	**	to ccbs.	*/	struct head     header;	/*-----------------------------------------------	**	Specific Linux fields	**-----------------------------------------------	*/	int    unit;			/* Unit number                       */	char   chip_name[8];		/* Chip name                         */	char   inst_name[16];		/* Instance name                     */	struct timer_list timer;	/* Timer link header                 */	int	ncr_cache;		/* Cache test variable               */	Scsi_Cmnd *waiting_list;	/* Waiting list header for commands  */					/* that we can't put into the squeue */	u_long	settle_time;		/* Reset in progess		     */	u_char	release_stage;		/* Synchronisation stage on release  */	u_char	verbose;		/* Boot verbosity for this controller*/#ifdef	SCSI_NCR_DEBUG_ERROR_RECOVERY_SUPPORT	u_char	debug_error_recovery;	u_char	stalling;	u_char	assert_atn;#endif	/*-----------------------------------------------	**	Added field to support differences	**	between ncr chips.	**	sv_xxx are some io register bit value at start-up and	**	so assumed to have been set by the sdms bios.	**	rv_xxx are the bit fields of io register that will keep 	**	the features used by the driver.	**-----------------------------------------------	*/	u_short	device_id;	u_char	revision_id;	u_char	sv_scntl0;	u_char	sv_scntl3;	u_char	sv_dmode;	u_char	sv_dcntl;	u_char	sv_ctest3;	u_char	sv_ctest4;	u_char	sv_ctest5;	u_char	sv_gpcntl;

⌨️ 快捷键说明

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