aic79xx.h

来自「linux 内核源代码」· C头文件 代码 · 共 1,487 行 · 第 1/4 页

H
1,487
字号
	 * Device instance currently on the bus awaiting a continue TIO	 * for a command that was not given the disconnect priveledge.	 */	struct ahd_tmode_lstate  *pending_device;	/*	 * Timer handles for timer driven callbacks.	 */	ahd_timer_t		  reset_timer;	ahd_timer_t		  stat_timer;	/*	 * Statistics.	 */#define	AHD_STAT_UPDATE_US	250000 /* 250ms */#define	AHD_STAT_BUCKETS	4	u_int			  cmdcmplt_bucket;	uint32_t		  cmdcmplt_counts[AHD_STAT_BUCKETS];	uint32_t		  cmdcmplt_total;	/*	 * Card characteristics	 */	ahd_chip		  chip;	ahd_feature		  features;	ahd_bug			  bugs;	ahd_flag		  flags;	struct seeprom_config	 *seep_config;	/* Command Queues */	struct ahd_completion	  *qoutfifo;	uint16_t		  qoutfifonext;	uint16_t		  qoutfifonext_valid_tag;	uint16_t		  qinfifonext;	uint16_t		  qinfifo[AHD_SCB_MAX];	/*	 * Our qfreeze count.  The sequencer compares	 * this value with its own counter to determine	 * whether to allow selections to occur.	 */	uint16_t		  qfreeze_cnt;	/* Values to store in the SEQCTL register for pause and unpause */	uint8_t			  unpause;	uint8_t			  pause;	/* Critical Section Data */	struct cs		 *critical_sections;	u_int			  num_critical_sections;	/* Buffer for handling packetized bitbucket. */	uint8_t			 *overrun_buf;	/* Links for chaining softcs */	TAILQ_ENTRY(ahd_softc)	  links;	/* Channel Names ('A', 'B', etc.) */	char			  channel;	/* Initiator Bus ID */	uint8_t			  our_id;	/*	 * Target incoming command FIFO.	 */	struct target_cmd	 *targetcmds;	uint8_t			  tqinfifonext;	/*	 * Cached verson of the hs_mailbox so we can avoid	 * pausing the sequencer during mailbox updates.	 */	uint8_t			  hs_mailbox;	/*	 * Incoming and outgoing message handling.	 */	uint8_t			  send_msg_perror;	ahd_msg_flags		  msg_flags;	ahd_msg_type		  msg_type;	uint8_t			  msgout_buf[12];/* Message we are sending */	uint8_t			  msgin_buf[12];/* Message we are receiving */	u_int			  msgout_len;	/* Length of message to send */	u_int			  msgout_index;	/* Current index in msgout */	u_int			  msgin_index;	/* Current index in msgin */	/*	 * Mapping information for data structures shared	 * between the sequencer and kernel.	 */	bus_dma_tag_t		  parent_dmat;	bus_dma_tag_t		  shared_data_dmat;	struct map_node		  shared_data_map;	/* Information saved through suspend/resume cycles */	struct ahd_suspend_state  suspend_state;	/* Number of enabled target mode device on this card */	u_int			  enabled_luns;	/* Initialization level of this data structure */	u_int			  init_level;	/* PCI cacheline size. */	u_int			  pci_cachesize;	/* IO Cell Parameters */	uint8_t			  iocell_opts[AHD_NUM_PER_DEV_ANNEXCOLS];	u_int			  stack_size;	uint16_t		 *saved_stack;	/* Per-Unit descriptive information */	const char		 *description;	const char		 *bus_description;	char			 *name;	int			  unit;	/* Selection Timer settings */	int			  seltime;	/*	 * Interrupt coalescing settings.	 */#define	AHD_INT_COALESCING_TIMER_DEFAULT		250 /*us*/#define	AHD_INT_COALESCING_MAXCMDS_DEFAULT		10#define	AHD_INT_COALESCING_MAXCMDS_MAX			127#define	AHD_INT_COALESCING_MINCMDS_DEFAULT		5#define	AHD_INT_COALESCING_MINCMDS_MAX			127#define	AHD_INT_COALESCING_THRESHOLD_DEFAULT		2000#define	AHD_INT_COALESCING_STOP_THRESHOLD_DEFAULT	1000	u_int			  int_coalescing_timer;	u_int			  int_coalescing_maxcmds;	u_int			  int_coalescing_mincmds;	u_int			  int_coalescing_threshold;	u_int			  int_coalescing_stop_threshold;	uint16_t	 	  user_discenable;/* Disconnection allowed  */	uint16_t		  user_tagenable;/* Tagged Queuing allowed */};/*************************** IO Cell Configuration ****************************/#define	AHD_PRECOMP_SLEW_INDEX						\    (AHD_ANNEXCOL_PRECOMP_SLEW - AHD_ANNEXCOL_PER_DEV0)#define	AHD_AMPLITUDE_INDEX						\    (AHD_ANNEXCOL_AMPLITUDE - AHD_ANNEXCOL_PER_DEV0)#define AHD_SET_SLEWRATE(ahd, new_slew)					\do {									\    (ahd)->iocell_opts[AHD_PRECOMP_SLEW_INDEX] &= ~AHD_SLEWRATE_MASK;	\    (ahd)->iocell_opts[AHD_PRECOMP_SLEW_INDEX] |=			\	(((new_slew) << AHD_SLEWRATE_SHIFT) & AHD_SLEWRATE_MASK);	\} while (0)#define AHD_SET_PRECOMP(ahd, new_pcomp)					\do {									\    (ahd)->iocell_opts[AHD_PRECOMP_SLEW_INDEX] &= ~AHD_PRECOMP_MASK;	\    (ahd)->iocell_opts[AHD_PRECOMP_SLEW_INDEX] |=			\	(((new_pcomp) << AHD_PRECOMP_SHIFT) & AHD_PRECOMP_MASK);	\} while (0)#define AHD_SET_AMPLITUDE(ahd, new_amp)					\do {									\    (ahd)->iocell_opts[AHD_AMPLITUDE_INDEX] &= ~AHD_AMPLITUDE_MASK;	\    (ahd)->iocell_opts[AHD_AMPLITUDE_INDEX] |=				\	(((new_amp) << AHD_AMPLITUDE_SHIFT) & AHD_AMPLITUDE_MASK);	\} while (0)/************************ Active Device Information ***************************/typedef enum {	ROLE_UNKNOWN,	ROLE_INITIATOR,	ROLE_TARGET} role_t;struct ahd_devinfo {	int	 our_scsiid;	int	 target_offset;	uint16_t target_mask;	u_int	 target;	u_int	 lun;	char	 channel;	role_t	 role;		/*				 * Only guaranteed to be correct if not				 * in the busfree state.				 */};/****************************** PCI Structures ********************************/#define AHD_PCI_IOADDR0	PCIR_BAR(0)	/* I/O BAR*/#define AHD_PCI_MEMADDR	PCIR_BAR(1)	/* Memory BAR */#define AHD_PCI_IOADDR1	PCIR_BAR(3)	/* Second I/O BAR */typedef int (ahd_device_setup_t)(struct ahd_softc *);struct ahd_pci_identity {	uint64_t		 full_id;	uint64_t		 id_mask;	char			*name;	ahd_device_setup_t	*setup;};/***************************** VL/EISA Declarations ***************************/struct aic7770_identity {	uint32_t		 full_id;	uint32_t		 id_mask;	char			*name;	ahd_device_setup_t	*setup;};extern struct aic7770_identity aic7770_ident_table [];extern const int ahd_num_aic7770_devs;#define AHD_EISA_SLOT_OFFSET	0xc00#define AHD_EISA_IOSIZE		0x100/*************************** Function Declarations ****************************//******************************************************************************/void			ahd_reset_cmds_pending(struct ahd_softc *ahd);/***************************** PCI Front End *********************************/struct	ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);int			  ahd_pci_config(struct ahd_softc *,					 struct ahd_pci_identity *);int	ahd_pci_test_register_access(struct ahd_softc *);void	ahd_pci_suspend(struct ahd_softc *);void	ahd_pci_resume(struct ahd_softc *);/************************** SCB and SCB queue management **********************/void		ahd_qinfifo_requeue_tail(struct ahd_softc *ahd,					 struct scb *scb);/****************************** Initialization ********************************/struct ahd_softc	*ahd_alloc(void *platform_arg, char *name);int			 ahd_softc_init(struct ahd_softc *);void			 ahd_controller_info(struct ahd_softc *ahd, char *buf);int			 ahd_init(struct ahd_softc *ahd);int			 ahd_suspend(struct ahd_softc *ahd);void			 ahd_resume(struct ahd_softc *ahd);int			 ahd_default_config(struct ahd_softc *ahd);int			 ahd_parse_vpddata(struct ahd_softc *ahd,					   struct vpd_config *vpd);int			 ahd_parse_cfgdata(struct ahd_softc *ahd,					   struct seeprom_config *sc);void			 ahd_intr_enable(struct ahd_softc *ahd, int enable);void			 ahd_pause_and_flushwork(struct ahd_softc *ahd);int			 ahd_suspend(struct ahd_softc *ahd); void			 ahd_set_unit(struct ahd_softc *, int);void			 ahd_set_name(struct ahd_softc *, char *);struct scb		*ahd_get_scb(struct ahd_softc *ahd, u_int col_idx);void			 ahd_free_scb(struct ahd_softc *ahd, struct scb *scb);void			 ahd_free(struct ahd_softc *ahd);int			 ahd_reset(struct ahd_softc *ahd, int reinit);int			 ahd_write_flexport(struct ahd_softc *ahd,					    u_int addr, u_int value);int			 ahd_read_flexport(struct ahd_softc *ahd, u_int addr,					   uint8_t *value);/*************************** Interrupt Services *******************************/void			ahd_run_qoutfifo(struct ahd_softc *ahd);#ifdef AHD_TARGET_MODEvoid			ahd_run_tqinfifo(struct ahd_softc *ahd, int paused);#endifvoid			ahd_handle_hwerrint(struct ahd_softc *ahd);void			ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat);void			ahd_handle_scsiint(struct ahd_softc *ahd,					   u_int intstat);/***************************** Error Recovery *********************************/typedef enum {	SEARCH_COMPLETE,	SEARCH_COUNT,	SEARCH_REMOVE,	SEARCH_PRINT} ahd_search_action;int			ahd_search_qinfifo(struct ahd_softc *ahd, int target,					   char channel, int lun, u_int tag,					   role_t role, uint32_t status,					   ahd_search_action action);int			ahd_search_disc_list(struct ahd_softc *ahd, int target,					     char channel, int lun, u_int tag,					     int stop_on_first, int remove,					     int save_state);int			ahd_reset_channel(struct ahd_softc *ahd, char channel,					  int initiate_reset);/*************************** Utility Functions ********************************/void			ahd_compile_devinfo(struct ahd_devinfo *devinfo,					    u_int our_id, u_int target,					    u_int lun, char channel,					    role_t role);/************************** Transfer Negotiation ******************************/void			ahd_find_syncrate(struct ahd_softc *ahd, u_int *period,					  u_int *ppr_options, u_int maxsync);/* * Negotiation types.  These are used to qualify if we should renegotiate * even if our goal and current transport parameters are identical. */typedef enum {	AHD_NEG_TO_GOAL,	/* Renegotiate only if goal and curr differ. */	AHD_NEG_IF_NON_ASYNC,	/* Renegotiate so long as goal is non-async. */	AHD_NEG_ALWAYS		/* Renegotiat even if goal is async. */} ahd_neg_type;int			ahd_update_neg_request(struct ahd_softc*,					       struct ahd_devinfo*,					       struct ahd_tmode_tstate*,					       struct ahd_initiator_tinfo*,					       ahd_neg_type);void			ahd_set_width(struct ahd_softc *ahd,				      struct ahd_devinfo *devinfo,				      u_int width, u_int type, int paused);void			ahd_set_syncrate(struct ahd_softc *ahd,					 struct ahd_devinfo *devinfo,					 u_int period, u_int offset,					 u_int ppr_options,					 u_int type, int paused);typedef enum {	AHD_QUEUE_NONE,	AHD_QUEUE_BASIC,	AHD_QUEUE_TAGGED} ahd_queue_alg;/**************************** Target Mode *************************************/#ifdef AHD_TARGET_MODEvoid		ahd_send_lstate_events(struct ahd_softc *,				       struct ahd_tmode_lstate *);void		ahd_handle_en_lun(struct ahd_softc *ahd,				  struct cam_sim *sim, union ccb *ccb);cam_status	ahd_find_tmode_devs(struct ahd_softc *ahd,				    struct cam_sim *sim, union ccb *ccb,				    struct ahd_tmode_tstate **tstate,				    struct ahd_tmode_lstate **lstate,				    int notfound_failure);#ifndef AHD_TMODE_ENABLE#define AHD_TMODE_ENABLE 0#endif#endif/******************************* Debug ***************************************/#ifdef AHD_DEBUGextern uint32_t ahd_debug;#define AHD_SHOW_MISC		0x00001#define AHD_SHOW_SENSE		0x00002#define AHD_SHOW_RECOVERY	0x00004#define AHD_DUMP_SEEPROM	0x00008#define AHD_SHOW_TERMCTL	0x00010#define AHD_SHOW_MEMORY		0x00020#define AHD_SHOW_MESSAGES	0x00040#define AHD_SHOW_MODEPTR	0x00080#define AHD_SHOW_SELTO		0x00100#define AHD_SHOW_FIFOS		0x00200#define AHD_SHOW_QFULL		0x00400#define	AHD_SHOW_DV		0x00800#define AHD_SHOW_MASKED_ERRORS	0x01000#define AHD_SHOW_QUEUE		0x02000#define AHD_SHOW_TQIN		0x04000#define AHD_SHOW_SG		0x08000#define AHD_SHOW_INT_COALESCING	0x10000#define AHD_DEBUG_SEQUENCER	0x20000#endifvoid			ahd_print_devinfo(struct ahd_softc *ahd,					  struct ahd_devinfo *devinfo);void			ahd_dump_card_state(struct ahd_softc *ahd);int			ahd_print_register(ahd_reg_parse_entry_t *table,					   u_int num_entries,					   const char *name,					   u_int address,					   u_int value,					   u_int *cur_column,					   u_int wrap_point);#endif /* _AIC79XX_H_ */

⌨️ 快捷键说明

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