📄 aic79xx.h
字号:
AHD_MODE_DFF1, AHD_MODE_CCHAN, AHD_MODE_SCSI, AHD_MODE_CFG, AHD_MODE_UNKNOWN} ahd_mode;#define AHD_MK_MSK(x) (0x01 << (x))#define AHD_MODE_DFF0_MSK AHD_MK_MSK(AHD_MODE_DFF0)#define AHD_MODE_DFF1_MSK AHD_MK_MSK(AHD_MODE_DFF1)#define AHD_MODE_CCHAN_MSK AHD_MK_MSK(AHD_MODE_CCHAN)#define AHD_MODE_SCSI_MSK AHD_MK_MSK(AHD_MODE_SCSI)#define AHD_MODE_CFG_MSK AHD_MK_MSK(AHD_MODE_CFG)#define AHD_MODE_UNKNOWN_MSK AHD_MK_MSK(AHD_MODE_UNKNOWN)#define AHD_MODE_ANY_MSK (~0)typedef uint8_t ahd_mode_state;typedef void ahd_callback_t (void *);struct ahd_softc { bus_space_tag_t tags[2]; bus_space_handle_t bshs[2];#ifndef __linux__ bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */#endif struct scb_data scb_data; struct scb *next_queued_scb; /* * SCBs that have been sent to the controller */ LIST_HEAD(, scb) pending_scbs; /* * Current register window mode information. */ ahd_mode dst_mode; ahd_mode src_mode; /* * Saved register window mode information * used for restore on next unpause. */ ahd_mode saved_dst_mode; ahd_mode saved_src_mode; /* * Counting lock for deferring the release of additional * untagged transactions from the untagged_queues. When * the lock is decremented to 0, all queues in the * untagged_queues array are run. */ u_int untagged_queue_lock; /* * Per-target queue of untagged-transactions. The * transaction at the head of the queue is the * currently pending untagged transaction for the * target. The driver only allows a single untagged * transaction per target. */ struct scb_tailq untagged_queues[AHD_NUM_TARGETS]; /* * Platform specific data. */ struct ahd_platform_data *platform_data; /* * Platform specific device information. */ ahd_dev_softc_t dev_softc; /* * Bus specific device information. */ ahd_bus_intr_t bus_intr; /* * Target mode related state kept on a per enabled lun basis. * Targets that are not enabled will have null entries. * As an initiator, we keep one target entry for our initiator * ID to store our sync/wide transfer settings. */ struct ahd_tmode_tstate *enabled_targets[AHD_NUM_TARGETS]; /* * The black hole device responsible for handling requests for * disabled luns on enabled targets. */ struct ahd_tmode_lstate *black_hole; /* * 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; /* * Card characteristics */ ahd_chip chip; ahd_feature features; ahd_bug bugs; ahd_flag flags; struct seeprom_config *seep_config; /* Values to store in the SEQCTL register for pause and unpause */ uint8_t unpause; uint8_t pause; /* Command Queues */ uint16_t qoutfifonext; uint16_t qinfifonext; uint16_t qinfifo[AHD_SCB_MAX]; uint16_t *qoutfifo; /* 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; /* * PCI error detection. */ int unsolicited_ints; /* * Target incoming command FIFO. */ struct target_cmd *targetcmds; uint8_t tqinfifonext; /* * 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; bus_dmamap_t shared_data_dmamap; bus_addr_t shared_data_busaddr; /* 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; /* Per-Unit descriptive information */ const char *description; const char *bus_description; char *name; int unit; /* Selection Timer settings */ int seltime; uint16_t user_discenable;/* Disconnection allowed */ uint16_t user_tagenable;/* Tagged Queuing allowed */};TAILQ_HEAD(ahd_softc_tailq, ahd_softc);extern struct ahd_softc_tailq ahd_tailq;/************************ 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_MAPS /* I/O BAR*/#define AHD_PCI_MEMADDR (PCIR_MAPS + 4) /* Memory BAR */#define AHD_PCI_IOADDR1 (PCIR_MAPS + 12)/* 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;};extern struct ahd_pci_identity ahd_pci_ident_table [];extern const u_int ahd_num_pci_devs;/***************************** 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 ****************************//******************************************************************************/u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl);void ahd_set_disconnected_list(struct ahd_softc *ahd, u_int target, u_int lun, u_int scbid);void ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int busyid);static __inline void ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl);static __inline voidahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl){ ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);}/***************************** 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 *);/*************************** EISA/VL Front End ********************************/struct aic7770_identity *aic7770_find_device(uint32_t);int aic7770_config(struct ahd_softc *ahd, struct aic7770_identity *);/************************** SCB and SCB queue management **********************/int ahd_probe_scbs(struct ahd_softc *);void ahd_run_untagged_queues(struct ahd_softc *ahd);void ahd_run_untagged_queue(struct ahd_softc *ahd, struct scb_tailq *queue);void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, struct scb *scb);int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target, char channel, int lun, u_int tag, role_t role);/****************************** 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_default_config(struct ahd_softc *ahd);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); int ahd_resume(struct ahd_softc *ahd);void ahd_softc_insert(struct ahd_softc *);struct ahd_softc *ahd_find_softc(struct ahd_softc *ahd);void ahd_set_unit(struct ahd_softc *, int);void ahd_set_name(struct ahd_softc *, char *);void ahd_alloc_scbs(struct ahd_softc *ahd);void ahd_free(struct ahd_softc *ahd);int ahd_reset(struct ahd_softc *ahd);void ahd_shutdown(void *arg);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);int ahd_wait_flexport(struct ahd_softc *ahd);/*************************** Interrupt Services *******************************/void ahd_pci_intr(struct ahd_softc *ahd);void ahd_clear_intstat(struct ahd_softc *ahd);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);void ahd_clear_critical_section(struct ahd_softc *ahd);/***************************** 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);void ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb);int ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset);int ahd_abort_scbs(struct ahd_softc *ahd, int target, char channel, int lun, u_int tag, role_t role, uint32_t status);void ahd_restart(struct ahd_softc *ahd);void ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo);void ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb);void ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb);void ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb);/*************************** Utility Functions ********************************/struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase);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);void ahd_validate_offset(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, u_int period, u_int *offset, int wide, role_t role);void ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, u_int *bus_width, role_t role);int ahd_update_neg_request(struct ahd_softc*, struct ahd_devinfo*, struct ahd_tmode_tstate*, struct ahd_initiator_tinfo*, int /*force*/);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;void ahd_set_tags(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, ahd_queue_alg 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 0x001#define AHD_SHOW_SENSE 0x002#define AHD_DUMP_SEEPROM 0x004#define AHD_SHOW_TERMCTL 0x008#define AHD_SHOW_MEMORY 0x010#define AHD_SHOW_MESSAGES 0x020#define AHD_SHOW_MODEPTR 0x040#define AHD_SHOW_SELTO 0x080#define AHD_SHOW_FIFOS 0x100#define AHD_SHOW_QFULL 0x200#define AHD_SHOW_QUEUE 0x400#define AHD_SHOW_TQIN 0x800#endifvoid ahd_print_scb(struct scb *scb);void ahd_dump_sglist(struct scb *scb);void ahd_dump_all_cards_state(void);void ahd_dump_card_state(struct ahd_softc *ahd);void ahd_dump_scbs(struct ahd_softc *ahd);#endif /* _AIC79XX_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -