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

📄 aic7xxx.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 3 页
字号:
 *	o A residual has occurred if SG_FULL_RESID is set in sgptr, *	  or residual_sgptr does not have SG_LIST_NULL set. * *	o We are transfering the last segment if residual_datacnt has *	  the SG_LAST_SEG flag set. * * Host: *	o A residual has occurred if a completed scb has the *	  SG_RESID_VALID flag set. * *	o residual_sgptr and sgptr refer to the "next" sg entry *	  and so may point beyond the last valid sg entry for the *	  transfer. */ /*12*/	uint32_t dataptr;/*16*/	uint32_t datacnt;		/*					 * Byte 3 (numbered from 0) of					 * the datacnt is really the					 * 4th byte in that data address.					 *//*20*/	uint32_t sgptr;#define SG_PTR_MASK	0xFFFFFFF8/*24*/	uint8_t  control;	/* See SCB_CONTROL in aic7xxx.reg for details *//*25*/	uint8_t  scsiid;	/* what to load in the SCSIID register *//*26*/	uint8_t  lun;/*27*/	uint8_t  tag;			/*					 * Index into our kernel SCB array.					 * Also used as the tag for tagged I/O					 *//*28*/	uint8_t  cdb_len;/*29*/	uint8_t  scsirate;		/* Value for SCSIRATE register *//*30*/	uint8_t  scsioffset;		/* Value for SCSIOFFSET register *//*31*/	uint8_t  next;			/*					 * Used for threading SCBs in the					 * "Waiting for Selection" and					 * "Disconnected SCB" lists down					 * in the sequencer.					 *//*32*/	uint8_t  cdb32[32];		/*					 * CDB storage for cdbs of size					 * 13->32.  We store them here					 * because hardware scbs are					 * allocated from DMA safe					 * memory so we are guaranteed					 * the controller can access					 * this data.					 */};/************************ Kernel SCB Definitions ******************************//* * Some fields of the SCB are OS dependent.  Here we collect the * definitions for elements that all OS platforms need to include * in there SCB definition. *//* * Definition of a scatter/gather element as transfered to the controller. * The aic7xxx chips only support a 24bit length.  We use the top byte of * the length to store additional address bits and a flag to indicate * that a given segment terminates the transfer.  This gives us an * addressable range of 512GB on machines with 64bit PCI or with chips * that can support dual address cycles on 32bit PCI busses. */struct ahc_dma_seg {	uint32_t	addr;	uint32_t	len;#define	AHC_DMA_LAST_SEG	0x80000000#define	AHC_SG_HIGH_ADDR_MASK	0x7F000000#define	AHC_SG_LEN_MASK		0x00FFFFFF};struct sg_map_node {	bus_dmamap_t		 sg_dmamap;	dma_addr_t		 sg_physaddr;	struct ahc_dma_seg*	 sg_vaddr;	SLIST_ENTRY(sg_map_node) links;};/* * The current state of this SCB. */typedef enum {	SCB_FREE		= 0x0000,	SCB_OTHERTCL_TIMEOUT	= 0x0002,/*					  * Another device was active					  * during the first timeout for					  * this SCB so we gave ourselves					  * an additional timeout period					  * in case it was hogging the					  * bus.				          */	SCB_DEVICE_RESET	= 0x0004,	SCB_SENSE		= 0x0008,	SCB_CDB32_PTR		= 0x0010,	SCB_RECOVERY_SCB	= 0x0020,	SCB_AUTO_NEGOTIATE	= 0x0040,/* Negotiate to achieve goal. */	SCB_NEGOTIATE		= 0x0080,/* Negotiation forced for command. */	SCB_ABORT		= 0x0100,	SCB_UNTAGGEDQ		= 0x0200,	SCB_ACTIVE		= 0x0400,	SCB_TARGET_IMMEDIATE	= 0x0800,	SCB_TRANSMISSION_ERROR	= 0x1000,/*					  * We detected a parity or CRC					  * error that has effected the					  * payload of the command.  This					  * flag is checked when normal					  * status is returned to catch					  * the case of a target not					  * responding to our attempt					  * to report the error.					  */	SCB_TARGET_SCB		= 0x2000,	SCB_SILENT		= 0x4000 /*					  * Be quiet about transmission type					  * errors.  They are expected and we					  * don't want to upset the user.  This					  * flag is typically used during DV.					  */} scb_flag;struct scb {	struct	hardware_scb	 *hscb;	union {		SLIST_ENTRY(scb)  sle;		TAILQ_ENTRY(scb)  tqe;	} links;	LIST_ENTRY(scb)		  pending_links;	ahc_io_ctx_t		  io_ctx;	struct ahc_softc	 *ahc_softc;	scb_flag		  flags;#ifndef __linux__	bus_dmamap_t		  dmamap;#endif	struct scb_platform_data *platform_data;	struct sg_map_node	 *sg_map;	struct ahc_dma_seg 	 *sg_list;	dma_addr_t		  sg_list_phys;	u_int			  sg_count;/* How full ahc_dma_seg is */};struct scb_data {	SLIST_HEAD(, scb) free_scbs;	/*					 * Pool of SCBs ready to be assigned					 * commands to execute.					 */	struct	scb *scbindex[256];	/*					 * Mapping from tag to SCB.					 * As tag identifiers are an					 * 8bit value, we provide space					 * for all possible tag values.					 * Any lookups to entries at or					 * above AHC_SCB_MAX_ALLOC will					 * always fail.					 */	struct	hardware_scb	*hscbs;	/* Array of hardware SCBs */	struct	scb *scbarray;		/* Array of kernel SCBs */	struct	scsi_sense_data *sense; /* Per SCB sense data */	/*	 * "Bus" addresses of our data structures.	 */	bus_dma_tag_t	 hscb_dmat;	/* dmat for our hardware SCB array */	bus_dmamap_t	 hscb_dmamap;	dma_addr_t	 hscb_busaddr;	bus_dma_tag_t	 sense_dmat;	bus_dmamap_t	 sense_dmamap;	dma_addr_t	 sense_busaddr;	bus_dma_tag_t	 sg_dmat;	/* dmat for our sg segments */	SLIST_HEAD(, sg_map_node) sg_maps;	uint8_t	numscbs;	uint8_t	maxhscbs;		/* Number of SCBs on the card */	uint8_t	init_level;		/*					 * How far we've initialized					 * this structure.					 */};/************************ Target Mode Definitions *****************************//* * Connection desciptor for select-in requests in target mode. */struct target_cmd {	uint8_t scsiid;		/* Our ID and the initiator's ID */	uint8_t identify;	/* Identify message */	uint8_t bytes[22];	/* 				 * Bytes contains any additional message				 * bytes terminated by 0xFF.  The remainder				 * is the cdb to execute.				 */	uint8_t cmd_valid;	/*				 * When a command is complete, the firmware				 * will set cmd_valid to all bits set.				 * After the host has seen the command,				 * the bits are cleared.  This allows us				 * to just peek at host memory to determine				 * if more work is complete. cmd_valid is on				 * an 8 byte boundary to simplify setting				 * it on aic7880 hardware which only has				 * limited direct access to the DMA FIFO.				 */	uint8_t pad[7];};/* * Number of events we can buffer up if we run out * of immediate notify ccbs. */#define AHC_TMODE_EVENT_BUFFER_SIZE 8struct ahc_tmode_event {	uint8_t initiator_id;	uint8_t event_type;	/* MSG type or EVENT_TYPE_BUS_RESET */#define	EVENT_TYPE_BUS_RESET 0xFF	uint8_t event_arg;};/* * Per enabled lun target mode state. * As this state is directly influenced by the host OS'es target mode * environment, we let the OS module define it.  Forward declare the * structure here so we can store arrays of them, etc. in OS neutral * data structures. */#ifdef AHC_TARGET_MODE struct ahc_tmode_lstate {	struct cam_path *path;	struct ccb_hdr_slist accept_tios;	struct ccb_hdr_slist immed_notifies;	struct ahc_tmode_event event_buffer[AHC_TMODE_EVENT_BUFFER_SIZE];	uint8_t event_r_idx;	uint8_t event_w_idx;};#elsestruct ahc_tmode_lstate;#endif/******************** Transfer Negotiation Datastructures *********************/#define AHC_TRANS_CUR		0x01	/* Modify current neogtiation status */#define AHC_TRANS_ACTIVE	0x03	/* Assume this target is on the bus */#define AHC_TRANS_GOAL		0x04	/* Modify negotiation goal */#define AHC_TRANS_USER		0x08	/* Modify user negotiation settings */#define AHC_WIDTH_UNKNOWN	0xFF#define AHC_PERIOD_UNKNOWN	0xFF#define AHC_OFFSET_UNKNOWN	0xFF#define AHC_PPR_OPTS_UNKNOWN	0xFF/* * Transfer Negotiation Information. */struct ahc_transinfo {	uint8_t protocol_version;	/* SCSI Revision level */	uint8_t transport_version;	/* SPI Revision level */	uint8_t width;			/* Bus width */	uint8_t period;			/* Sync rate factor */	uint8_t offset;			/* Sync offset */	uint8_t ppr_options;		/* Parallel Protocol Request options */};/* * Per-initiator current, goal and user transfer negotiation information. */struct ahc_initiator_tinfo {	uint8_t scsirate;		/* Computed value for SCSIRATE reg */	struct ahc_transinfo curr;	struct ahc_transinfo goal;	struct ahc_transinfo user;};/* * Per enabled target ID state. * Pointers to lun target state as well as sync/wide negotiation information * for each initiator<->target mapping.  For the initiator role we pretend * that we are the target and the targets are the initiators since the * negotiation is the same regardless of role. */struct ahc_tmode_tstate {	struct ahc_tmode_lstate*	enabled_luns[AHC_NUM_LUNS];	struct ahc_initiator_tinfo	transinfo[AHC_NUM_TARGETS];	/*	 * Per initiator state bitmasks.	 */	uint16_t	 auto_negotiate;/* Auto Negotiation Required */	uint16_t	 ultraenb;	/* Using ultra sync rate  */	uint16_t	 discenable;	/* Disconnection allowed  */	uint16_t	 tagenable;	/* Tagged Queuing allowed */};/* * Data structure for our table of allowed synchronous transfer rates. */struct ahc_syncrate {	u_int sxfr_u2;	/* Value of the SXFR parameter for Ultra2+ Chips */	u_int sxfr;	/* Value of the SXFR parameter for <= Ultra Chips */#define		ULTRA_SXFR 0x100	/* Rate Requires Ultra Mode set */#define		ST_SXFR	   0x010	/* Rate Single Transition Only */#define		DT_SXFR	   0x040	/* Rate Double Transition Only */	uint8_t period; /* Period to send to SCSI target */	char *rate;};/* Safe and valid period for async negotiations. */#define	AHC_ASYNC_XFER_PERIOD 0x45#define	AHC_ULTRA2_XFER_PERIOD 0x0a/* * Indexes into our table of syncronous transfer rates. */#define AHC_SYNCRATE_DT		0#define AHC_SYNCRATE_ULTRA2	1#define AHC_SYNCRATE_ULTRA	3#define AHC_SYNCRATE_FAST	6#define AHC_SYNCRATE_MAX	AHC_SYNCRATE_DT#define	AHC_SYNCRATE_MIN	13/***************************** Lookup Tables **********************************//* * Phase -> name and message out response * to parity errors in each phase table.  */struct ahc_phase_table_entry {        uint8_t phase;        uint8_t mesg_out; /* Message response to parity errors */	char *phasemsg;};/************************** Serial EEPROM Format ******************************/struct seeprom_config {/* * Per SCSI ID Configuration Flags */	uint16_t device_flags[16];	/* words 0-15 */#define		CFXFER		0x0007	/* synchronous transfer rate */#define		CFSYNCH		0x0008	/* enable synchronous transfer */#define		CFDISC		0x0010	/* enable disconnection */#define		CFWIDEB		0x0020	/* wide bus device */#define		CFSYNCHISULTRA	0x0040	/* CFSYNCH is an ultra offset (2940AU)*/#define		CFSYNCSINGLE	0x0080	/* Single-Transition signalling */#define		CFSTART		0x0100	/* send start unit SCSI command */#define		CFINCBIOS	0x0200	/* include in BIOS scan */#define		CFRNFOUND	0x0400	/* report even if not found */#define		CFMULTILUNDEV	0x0800	/* Probe multiple luns in BIOS scan */#define		CFWBCACHEENB	0x4000	/* Enable W-Behind Cache on disks */#define		CFWBCACHENOP	0xc000	/* Don't touch W-Behind Cache *//* * BIOS Control Bits */	uint16_t bios_control;		/* word 16 */#define		CFSUPREM	0x0001	/* support all removeable drives */#define		CFSUPREMB	0x0002	/* support removeable boot drives */#define		CFBIOSEN	0x0004	/* BIOS enabled */#define		CFBIOS_BUSSCAN	0x0008	/* Have the BIOS Scan the Bus */#define		CFSM2DRV	0x0010	/* support more than two drives */#define		CFSTPWLEVEL	0x0010	/* Termination level control */#define		CF284XEXTEND	0x0020	/* extended translation (284x cards) */	#define		CFCTRL_A	0x0020	/* BIOS displays Ctrl-A message */	#define		CFTERM_MENU	0x0040	/* BIOS displays termination menu */	#define		CFEXTEND	0x0080	/* extended translation enabled */#define		CFSCAMEN	0x0100	/* SCAM enable */#define		CFMSG_LEVEL	0x0600	/* BIOS Message Level */#define			CFMSG_VERBOSE	0x0000#define			CFMSG_SILENT	0x0200#define			CFMSG_DIAG	0x0400#define		CFBOOTCD	0x0800  /* Support Bootable CD-ROM *//*		UNUSED		0xff00	*//* * Host Adapter Control Bits */	uint16_t adapter_control;	/* word 17 */	#define		CFAUTOTERM	0x0001	/* Perform Auto termination */#define		CFULTRAEN	0x0002	/* Ultra SCSI speed enable */#define		CF284XSELTO     0x0003	/* Selection timeout (284x cards) */#define		CF284XFIFO      0x000C	/* FIFO Threshold (284x cards) */#define		CFSTERM		0x0004	/* SCSI low byte termination */#define		CFWSTERM	0x0008	/* SCSI high byte termination */#define		CFSPARITY	0x0010	/* SCSI parity */#define		CF284XSTERM     0x0020	/* SCSI low byte term (284x cards) */	#define		CFMULTILUN	0x0020#define		CFRESETB	0x0040	/* reset SCSI bus at boot */#define		CFCLUSTERENB	0x0080	/* Cluster Enable */#define		CFBOOTCHAN	0x0300	/* probe this channel first */#define		CFBOOTCHANSHIFT 8#define		CFSEAUTOTERM	0x0400	/* Ultra2 Perform secondary Auto Term*/#define		CFSELOWTERM	0x0800	/* Ultra2 secondary low term */#define		CFSEHIGHTERM	0x1000	/* Ultra2 secondary high term */#define		CFENABLEDV	0x4000	/* Perform Domain Validation*//* * Bus Release Time, Host Adapter ID */	uint16_t brtime_id;		/* word 18 */#define		CFSCSIID	0x000f	/* host adapter SCSI ID *//*		UNUSED		0x00f0	*/#define		CFBRTIME	0xff00	/* bus release time *//* * Maximum targets */	uint16_t max_targets;		/* word 19 */	#define		CFMAXTARG	0x00ff	/* maximum targets */#define		CFBOOTLUN	0x0f00	/* Lun to boot from */#define		CFBOOTID	0xf000	/* Target to boot from */	uint16_t res_1[10];		/* words 20-29 */	uint16_t signature;		/* Signature == 0x250 */#define		CFSIGNATURE	0x250#define		CFSIGNATURE2	0x300	uint16_t checksum;		/* word 31 */};/****************************  Message Buffer *********************************/typedef enum {	MSG_TYPE_NONE			= 0x00,	MSG_TYPE_INITIATOR_MSGOUT	= 0x01,	MSG_TYPE_INITIATOR_MSGIN	= 0x02,	MSG_TYPE_TARGET_MSGOUT		= 0x03,	MSG_TYPE_TARGET_MSGIN		= 0x04} ahc_msg_type;typedef enum {	MSGLOOP_IN_PROG,	MSGLOOP_MSGCOMPLETE,	MSGLOOP_TERMINATED} msg_loop_stat;/*********************** Software Configuration Structure *********************/TAILQ_HEAD(scb_tailq, scb);struct ahc_aic7770_softc {	/*	 * Saved register state used for chip_init().	 */	uint8_t busspd;	uint8_t bustime;};struct ahc_pci_softc {	/*	 * Saved register state used for chip_init().	 */	uint32_t  devconfig;	uint16_t  targcrccnt;	uint8_t   command;	uint8_t   csize_lattime;	uint8_t   optionmode;

⌨️ 快捷键说明

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