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

📄 aic79xx.h

📁 这个linux源代码是很全面的~基本完整了~使用c编译的~由于时间问题我没有亲自测试~但就算用来做参考资料也是非常好的
💻 H
📖 第 1 页 / 共 3 页
字号:
 * 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 ahd_dma_seg {	uint32_t	addr;	uint32_t	len;#define	AHD_DMA_LAST_SEG	0x80000000#define	AHD_SG_HIGH_ADDR_MASK	0x7F000000#define	AHD_SG_LEN_MASK		0x00FFFFFF};struct ahd_dma64_seg {	uint64_t	addr;	uint32_t	len;	uint32_t	pad;};struct map_node {	bus_dmamap_t		 dmamap;	bus_addr_t		 physaddr;	uint8_t			*vaddr;	SLIST_ENTRY(map_node)	 links;};/* * The current state of this SCB. */typedef enum {	SCB_FREE		= 0x0000,	SCB_TRANSMISSION_ERROR	= 0x0001,/*					  * 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_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_PACKETIZED		= 0x1000,	SCB_EXPECT_PPR_BUSFREE	= 0x2000,	SCB_PKT_SENSE		= 0x4000,	SCB_CMDPHASE_ABORT	= 0x8000} scb_flag;struct scb {	struct	hardware_scb	 *hscb;	union {		SLIST_ENTRY(scb)  sle;		TAILQ_ENTRY(scb)  tqe;	} links;	LIST_ENTRY(scb)		  pending_links;	ahd_io_ctx_t		  io_ctx;	struct ahd_softc	 *ahd_softc;	scb_flag		  flags;#ifndef __linux__	bus_dmamap_t		  dmamap;#endif	struct scb_platform_data *platform_data;	struct map_node	 	 *hscb_map;	struct map_node	 	 *sg_map;	struct map_node	 	 *sense_map;	void			 *sg_list;	uint8_t			 *sense_data;	bus_addr_t		  sg_list_busaddr;	bus_addr_t		  sense_busaddr;	u_int			  sg_count;/* How full ahd_dma_seg is */};struct scb_data {	SLIST_HEAD(, scb) free_scbs;	/*					 * Pool of SCBs ready to be assigned					 * commands to execute.					 */	struct	scb *scbindex[AHD_SCB_MAX];					/*					 * Mapping from tag to SCB.					 */	/*	 * "Bus" addresses of our data structures.	 */	bus_dma_tag_t	 hscb_dmat;	/* dmat for our hardware SCB array */	bus_dma_tag_t	 sg_dmat;	/* dmat for our sg segments */	bus_dma_tag_t	 sense_dmat;	/* dmat for our sense buffers */	SLIST_HEAD(, map_node) hscb_maps;	SLIST_HEAD(, map_node) sg_maps;	SLIST_HEAD(, map_node) sense_maps;	int		 scbs_left;	/* unallocated scbs in head map_node */	int		 sgs_left;	/* unallocated sgs in head map_node */	int		 sense_left;	/* unallocated sense in head map_node */	uint16_t	 numscbs;	uint16_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 AHD_TMODE_EVENT_BUFFER_SIZE 8struct ahd_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 AHD_TARGET_MODE struct ahd_tmode_lstate {	struct cam_path *path;	struct ccb_hdr_slist accept_tios;	struct ccb_hdr_slist immed_notifies;	struct ahd_tmode_event event_buffer[AHD_TMODE_EVENT_BUFFER_SIZE];	uint8_t event_r_idx;	uint8_t event_w_idx;};#elsestruct ahd_tmode_lstate;#endif/******************** Transfer Negotiation Datastructures *********************/#define AHD_TRANS_CUR		0x01	/* Modify current neogtiation status */#define AHD_TRANS_ACTIVE	0x03	/* Assume this target is on the bus */#define AHD_TRANS_GOAL		0x04	/* Modify negotiation goal */#define AHD_TRANS_USER		0x08	/* Modify user negotiation settings */#define AHD_PERIOD_ASYNC	0xFF#define AHD_PERIOD_10MHz	0x19/* * Transfer Negotiation Information. */struct ahd_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 ahd_initiator_tinfo {	struct ahd_transinfo curr;	struct ahd_transinfo goal;	struct ahd_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 ahd_tmode_tstate {	struct ahd_tmode_lstate*	enabled_luns[AHD_NUM_LUNS];	struct ahd_initiator_tinfo	transinfo[AHD_NUM_TARGETS];	/*	 * Per initiator state bitmasks.	 */	uint16_t	 auto_negotiate;/* Auto Negotiation Required */	uint16_t	 discenable;	/* Disconnection allowed  */	uint16_t	 tagenable;	/* Tagged Queuing allowed */};/* * Points of interest along the negotiated transfer scale. */#define AHD_SYNCRATE_MAX	0x8#define AHD_SYNCRATE_160	0x8#define AHD_SYNCRATE_PACED	0x8#define AHD_SYNCRATE_DT		0x9#define AHD_SYNCRATE_ULTRA2	0xa#define AHD_SYNCRATE_ULTRA	0xc#define AHD_SYNCRATE_FAST	0x19#define AHD_SYNCRATE_MIN_DT	AHD_SYNCRATE_FAST#define AHD_SYNCRATE_SYNC	0x32#define AHD_SYNCRATE_MIN	0x60#define	AHD_SYNCRATE_ASYNC	0xFF/* * In RevA, the synctable uses a 120MHz rate for the period * factor 8 and 160MHz for the period factor 7.  The 120MHz * rate never made it into the official SCSI spec, so we must * compensate when setting the negotiation table for Rev A * parts. */#define AHD_SYNCRATE_REVA_120	0x8#define AHD_SYNCRATE_REVA_160	0x7/***************************** Lookup Tables **********************************//* * Phase -> name and message out response * to parity errors in each phase table.  */struct ahd_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		0x003F	/* synchronous transfer rate */#define			CFXFER_ASYNC	0x3F#define		CFQAS		0x0040	/* Negotiate QAS */#define		CFPACKETIZED	0x0080	/* Negotiate Packetized Transfers */#define		CFSTART		0x0100	/* send start unit SCSI command */#define		CFINCBIOS	0x0200	/* include in BIOS scan */#define		CFDISC		0x0400	/* enable disconnection */#define		CFMULTILUNDEV	0x0800	/* Probe multiple luns in BIOS scan */#define		CFWIDEB		0x1000	/* wide bus device */#define		CFHOSTMANAGED	0x8000	/* Managed by a RAID controller *//* * BIOS Control Bits */	uint16_t bios_control;		/* word 16 */#define		CFSUPREM	0x0001	/* support all removeable drives */#define		CFSUPREMB	0x0002	/* support removeable boot drives */#define		CFBIOSSTATE	0x000C	/* BIOS Action State */#define		    CFBS_DISABLED	0x00#define		    CFBS_ENABLED	0x04#define		    CFBS_DISABLED_SCAN	0x08#define		CFENABLEDV	0x0010	/* Perform Domain Validation */#define		CFCTRL_A	0x0020	/* BIOS displays Ctrl-A message */	#define		CFSPARITY	0x0040	/* SCSI parity */#define		CFEXTEND	0x0080	/* extended translation enabled */#define		CFBOOTCD	0x0100  /* Support Bootable CD-ROM */#define		CFMSG_LEVEL	0x0600	/* BIOS Message Level */#define			CFMSG_VERBOSE	0x0000#define			CFMSG_SILENT	0x0200#define			CFMSG_DIAG	0x0400#define		CFRESETB	0x0800	/* reset SCSI bus at boot *//*		UNUSED		0xf000	*//* * Host Adapter Control Bits */	uint16_t adapter_control;	/* word 17 */	#define		CFAUTOTERM	0x0001	/* Perform Auto termination */#define		CFSTERM		0x0002	/* SCSI low byte termination */#define		CFWSTERM	0x0004	/* SCSI high byte termination */#define		CFSEAUTOTERM	0x0008	/* Ultra2 Perform secondary Auto Term*/#define		CFSELOWTERM	0x0010	/* Ultra2 secondary low term */#define		CFSEHIGHTERM	0x0020	/* Ultra2 secondary high term */#define		CFSTPWLEVEL	0x0040	/* Termination level control */#define		CFBIOSAUTOTERM	0x0080	/* Perform Auto termination */#define		CFTERM_MENU	0x0100	/* BIOS displays termination menu */	#define		CFCLUSTERENB	0x8000	/* Cluster Enable *//* * 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/PCI Latency 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;		/* BIOS Signature */#define		CFSIGNATURE	0x400	uint16_t checksum;		/* word 31 */};/****************************** Flexport Logic ********************************/#define FLXADDR_TERMCTL			0x0#define		FLX_TERMCTL_ENSECHIGH	0x8#define		FLX_TERMCTL_ENSECLOW	0x4#define		FLX_TERMCTL_ENPRIHIGH	0x2#define		FLX_TERMCTL_ENPRILOW	0x1#define FLXADDR_ROMSTAT_CURSENSECTL	0x1#define		FLX_ROMSTAT_SEECFG	0xF0#define		FLX_ROMSTAT_EECFG	0x0F#define		FLX_ROMSTAT_SEE_93C66	0x00#define		FLX_ROMSTAT_SEE_NONE	0xF0#define		FLX_ROMSTAT_EE_512x8	0x0#define		FLX_ROMSTAT_EE_1MBx8	0x1#define		FLX_ROMSTAT_EE_2MBx8	0x2#define		FLX_ROMSTAT_EE_4MBx8	0x3#define		FLX_ROMSTAT_EE_16MBx8	0x4#define 		CURSENSE_ENB	0x1#define	FLXADDR_FLEXSTAT		0x2#define		FLX_FSTAT_BUSY		0x1#define FLXADDR_CURRENT_STAT		0x4#define		FLX_CSTAT_SEC_HIGH	0xC0#define		FLX_CSTAT_SEC_LOW	0x30#define		FLX_CSTAT_PRI_HIGH	0x0C#define		FLX_CSTAT_PRI_LOW	0x03#define		FLX_CSTAT_MASK		0x03#define		FLX_CSTAT_SHIFT		2#define		FLX_CSTAT_OKAY		0x0#define		FLX_CSTAT_OVER		0x1#define		FLX_CSTAT_UNDER		0x2#define		FLX_CSTAT_INVALID	0x3int		ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,				 u_int start_addr, u_int count);int		ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,				  u_int start_addr, u_int count);int		ahd_wait_seeprom(struct ahd_softc *ahd);int		ahd_verify_cksum(struct seeprom_config *sc);int		ahd_acquire_seeprom(struct ahd_softc *ahd);void		ahd_release_seeprom(struct ahd_softc *ahd);/****************************  Message Buffer *********************************/typedef enum {	MSG_FLAG_NONE			= 0x00,	MSG_FLAG_EXPECT_PPR_BUSFREE	= 0x01,	MSG_FLAG_IU_REQ_CHANGED		= 0x02,	MSG_FLAG_EXPECT_IDE_BUSFREE	= 0x04,	MSG_FLAG_PACKETIZED		= 0x08} ahd_msg_flags;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} ahd_msg_type;typedef enum {	MSGLOOP_IN_PROG,	MSGLOOP_MSGCOMPLETE,	MSGLOOP_TERMINATED} msg_loop_stat;/*********************** Software Configuration Structure *********************/TAILQ_HEAD(scb_tailq, scb);struct ahd_suspend_channel_state {	uint8_t	scsiseq;	uint8_t	sxfrctl0;	uint8_t	sxfrctl1;	uint8_t	simode0;	uint8_t	simode1;	uint8_t	seltimer;	uint8_t	seqctl;};struct ahd_suspend_state {	struct	ahd_suspend_channel_state channel[2];	uint8_t	optionmode;	uint8_t	dscommand0;	uint8_t	dspcistatus;	/* hsmailbox */	uint8_t	crccontrol1;	uint8_t	scbbaddr;	/* Host and sequencer SCB counts */	uint8_t	dff_thrsh;	uint8_t	*scratch_ram;	uint8_t	*btt;};typedef void (*ahd_bus_intr_t)(struct ahd_softc *);typedef enum {	AHD_MODE_DFF0,

⌨️ 快捷键说明

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