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

📄 ncr.c

📁 国产CPU-龙芯(loongson)BIOS源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	struct timeval	reselect;};/***	profiling data (per device)*/struct profile {	u_long	num_trans;	u_long	num_bytes;	u_long	num_disc;	u_long	num_break;	u_long	num_int;	u_long	num_fly;	u_long	ms_setup;	u_long	ms_data;	u_long	ms_disc;	u_long	ms_post;};/*==========================================================****	Declaration of structs:		target control block****==========================================================*/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.	*/	u_char	usrsync;	u_char	usrtags;	u_char	usrwide;	u_char	usrflag;	/*	**	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;};/*==========================================================****      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_t	savep;	u_int32_t	lastp;	u_int32_t	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		status[8];};/***	The status bytes are used by the host and the script processor.****	The first four byte are copied to the scratchb register**	(declared as scr0..scr3 in ncrreg.h) just after the select/reselect,**	and copied back just after disconnecting.**	Inside the script the XX_REG are used.****	The last four bytes are used inside the script by "COPY" commands.**	Because source and destination must have the same alignment**	in a longword, the fields HAVE to be at the choosen offsets.**		xerr_st	(4)	0	(0x34)	scratcha**		sync_st	(5)	1	(0x05)	sxfer**		wide_st	(7)	3	(0x03)	scntl3*//***	First four bytes (script)*/#define  QU_REG	scr0#define  HS_REG	scr1#define  HS_PRT	nc_scr1#define  SS_REG	scr2#define  PS_REG	scr3/***	First 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]/***	Last four bytes (script)*/#define  xerr_st       header.status[4]	/* MUST be ==0 mod 4 */#define  sync_st       header.status[5]	/* MUST be ==1 mod 4 */#define  nego_st       header.status[6]#define  wide_st       header.status[7]	/* MUST be ==3 mod 4 *//***	Last 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 filler ensures that the global header is	**	cache line size aligned.	*/	ncrcmd	filler[4];	/*	**	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.	*/	struct scsi_xfer	*xfer;	/*	**	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];#if defined(__mips__)	u_char			local_sense[sizeof(struct scsi_sense_data)];#endif	/*	**	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;};#define CCB_PHYS(cp,lbl)	(cp->p_ccb + offsetof(struct ccb, lbl))/*==========================================================****      Declaration of structs:     NCR device descriptor****==========================================================*/struct ncb {#ifndef __OpenBSD__	/*	**	The global header.	**	Accessible to both the host and the	**	script-processor.	**	We assume it is cache line size aligned.	*/	struct head     header;#endif#ifdef __OpenBSD__	struct device sc_dev;	pci_chipset_tag_t sc_pc;	void *sc_ih;	bus_space_tag_t sc_st;	bus_space_handle_t sc_sh;	int sc_iomapped;#else /* !__OpenBSD__ */	int	unit;#endif /* __OpenBSD__ */	/*-----------------------------------------------	**	Scripts ..	**-----------------------------------------------	**	**	During reselection the ncr jumps to this point.	**	The SFBR register is loaded with the encoded target id.	**	**	Jump to the first target.	**	**	JUMP	**	@(next tcb)	*/	struct link     jump_tcb;	/*-----------------------------------------------	**	Configuration ..	**-----------------------------------------------	**	**	virtual and physical addresses	**	of the 53c810 chip.	*/#ifdef __OpenBSD__	bus_addr_t	paddr;	bus_space_tag_t ram_tag;	bus_space_handle_t ram_handle;	bus_addr_t	paddr2;	int		scriptmapped;#else	vm_offset_t     vaddr;	vm_offset_t     paddr;	vm_offset_t     vaddr2;	vm_offset_t     paddr2;	/*	**	pointer to the chip's registers.	*/	volatile	struct ncr_reg* reg;#endif	/*	**	Scripts instance virtual address.	*/	struct script	*script;	struct scripth	*scripth;	/*	**	Scripts instance physical address.	*/	u_long		p_script;	u_long		p_scripth;	/*	**	The SCSI address of the host adapter.	*/	u_char		myaddr;	/*	**	timing parameters	*/	u_char		minsync;	/* Minimum sync period factor	*/	u_char		maxsync;	/* Maximum sync period factor	*/	u_char		maxoffs;	/* Max scsi offset		*/	u_char		clock_divn;	/* Number of clock divisors	*/	u_long		clock_khz;	/* SCSI clock frequency in KHz	*/	u_long		features;	/* Chip features map		*/	u_char		multiplier;	/* Clock multiplier (1,2,4)	*/	u_char		maxburst;	/* log base 2 of dwords burst	*/	/*	**	BIOS supplied PCI bus options	*/	u_char		rv_scntl3;	u_char		rv_dcntl;	u_char		rv_dmode;	u_char		rv_ctest3;	u_char		rv_ctest4;	u_char		rv_ctest5;	u_char		rv_gpcntl;

⌨️ 快捷键说明

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