📄 aic7xxx.h
字号:
uint8_t crccontrol1; uint8_t dscommand0; uint8_t dspcistatus; uint8_t scbbaddr; uint8_t dff_thrsh;};union ahc_bus_softc { struct ahc_aic7770_softc aic7770_softc; struct ahc_pci_softc pci_softc;};typedef void (*ahc_bus_intr_t)(struct ahc_softc *);typedef int (*ahc_bus_chip_init_t)(struct ahc_softc *);typedef int (*ahc_bus_suspend_t)(struct ahc_softc *);typedef int (*ahc_bus_resume_t)(struct ahc_softc *);typedef void ahc_callback_t (void *);struct ahc_softc { bus_space_tag_t tag; bus_space_handle_t bsh;#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; /* * 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[AHC_NUM_TARGETS]; /* * Bus attachment specific data. */ union ahc_bus_softc bus_softc; /* * Platform specific data. */ struct ahc_platform_data *platform_data; /* * Platform specific device information. */ ahc_dev_softc_t dev_softc; /* * Bus specific device information. */ ahc_bus_intr_t bus_intr; /* * Bus specific initialization required * after a chip reset. */ ahc_bus_chip_init_t bus_chip_init; /* * Bus specific suspend routine. */ ahc_bus_suspend_t bus_suspend; /* * Bus specific resume routine. */ ahc_bus_resume_t bus_resume; /* * 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 ahc_tmode_tstate *enabled_targets[AHC_NUM_TARGETS]; /* * The black hole device responsible for handling requests for * disabled luns on enabled targets. */ struct ahc_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 ahc_tmode_lstate *pending_device; /* * Card characteristics */ ahc_chip chip; ahc_feature features; ahc_bug bugs; ahc_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 */ uint8_t qoutfifonext; uint8_t qinfifonext; uint8_t *qoutfifo; uint8_t *qinfifo; /* Critical Section Data */ struct cs *critical_sections; u_int num_critical_sections; /* Channel Names ('A', 'B', etc.) */ char channel; char channel_b; /* Initiator Bus ID */ uint8_t our_id; uint8_t our_id_b; /* * PCI error detection. */ int unsolicited_ints; /* * Target incoming command FIFO. */ struct target_cmd *targetcmds; uint8_t tqinfifonext; /* * Cached copy of the sequencer control register. */ uint8_t seqctl; /* * Incoming and outgoing message handling. */ uint8_t send_msg_perror; ahc_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; dma_addr_t shared_data_busaddr; /* * Bus address of the one byte buffer used to * work-around a DMA bug for chips <= aic7880 * in target mode. */ dma_addr_t dma_bug_buf; /* 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; /* * Count of parity errors we have seen as a target. * We auto-disable parity error checking after seeing * AHC_PCI_TARGET_PERR_THRESH number of errors. */ u_int pci_target_perr_count;#define AHC_PCI_TARGET_PERR_THRESH 10 /* Maximum number of sequencer instructions supported. */ u_int instruction_ram_size; /* Per-Unit descriptive information */ const char *description; char *name; int unit; /* Selection Timer settings */ int seltime; int seltime_b; uint16_t user_discenable;/* Disconnection allowed */ uint16_t user_tagenable;/* Tagged Queuing allowed */};/************************ Active Device Information ***************************/typedef enum { ROLE_UNKNOWN, ROLE_INITIATOR, ROLE_TARGET} role_t;struct ahc_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 ********************************/typedef int (ahc_device_setup_t)(struct ahc_softc *);struct ahc_pci_identity { uint64_t full_id; uint64_t id_mask; char *name; ahc_device_setup_t *setup;};extern struct ahc_pci_identity ahc_pci_ident_table[];extern const u_int ahc_num_pci_devs;/***************************** VL/EISA Declarations ***************************/struct aic7770_identity { uint32_t full_id; uint32_t id_mask; const char *name; ahc_device_setup_t *setup;};extern struct aic7770_identity aic7770_ident_table[];extern const int ahc_num_aic7770_devs;#define AHC_EISA_SLOT_OFFSET 0xc00#define AHC_EISA_IOSIZE 0x100/*************************** Function Declarations ****************************//******************************************************************************/u_int ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl);void ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl);void ahc_busy_tcl(struct ahc_softc *ahc, u_int tcl, u_int busyid);/***************************** PCI Front End *********************************/struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);int ahc_pci_config(struct ahc_softc *, struct ahc_pci_identity *);int ahc_pci_test_register_access(struct ahc_softc *);/*************************** EISA/VL Front End ********************************/struct aic7770_identity *aic7770_find_device(uint32_t);int aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *, u_int port);/************************** SCB and SCB queue management **********************/int ahc_probe_scbs(struct ahc_softc *);void ahc_run_untagged_queues(struct ahc_softc *ahc);void ahc_run_untagged_queue(struct ahc_softc *ahc, struct scb_tailq *queue);void ahc_qinfifo_requeue_tail(struct ahc_softc *ahc, struct scb *scb);int ahc_match_scb(struct ahc_softc *ahc, struct scb *scb, int target, char channel, int lun, u_int tag, role_t role);/****************************** Initialization ********************************/struct ahc_softc *ahc_alloc(void *platform_arg, char *name);int ahc_softc_init(struct ahc_softc *);void ahc_controller_info(struct ahc_softc *ahc, char *buf);int ahc_chip_init(struct ahc_softc *ahc);int ahc_init(struct ahc_softc *ahc);void ahc_intr_enable(struct ahc_softc *ahc, int enable);void ahc_pause_and_flushwork(struct ahc_softc *ahc);int ahc_suspend(struct ahc_softc *ahc); int ahc_resume(struct ahc_softc *ahc);void ahc_set_unit(struct ahc_softc *, int);void ahc_set_name(struct ahc_softc *, char *);void ahc_alloc_scbs(struct ahc_softc *ahc);void ahc_free(struct ahc_softc *ahc);int ahc_reset(struct ahc_softc *ahc, int reinit);void ahc_shutdown(void *arg);/*************************** Interrupt Services *******************************/void ahc_clear_intstat(struct ahc_softc *ahc);void ahc_run_qoutfifo(struct ahc_softc *ahc);#ifdef AHC_TARGET_MODEvoid ahc_run_tqinfifo(struct ahc_softc *ahc, int paused);#endifvoid ahc_handle_brkadrint(struct ahc_softc *ahc);void ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat);void ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat);void ahc_clear_critical_section(struct ahc_softc *ahc);/***************************** Error Recovery *********************************/typedef enum { SEARCH_COMPLETE, SEARCH_COUNT, SEARCH_REMOVE} ahc_search_action;int ahc_search_qinfifo(struct ahc_softc *ahc, int target, char channel, int lun, u_int tag, role_t role, uint32_t status, ahc_search_action action);int ahc_search_untagged_queues(struct ahc_softc *ahc, ahc_io_ctx_t ctx, int target, char channel, int lun, uint32_t status, ahc_search_action action);int ahc_search_disc_list(struct ahc_softc *ahc, int target, char channel, int lun, u_int tag, int stop_on_first, int remove, int save_state);void ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb);int ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset);int ahc_abort_scbs(struct ahc_softc *ahc, int target, char channel, int lun, u_int tag, role_t role, uint32_t status);void ahc_restart(struct ahc_softc *ahc);void ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb);/*************************** Utility Functions ********************************/struct ahc_phase_table_entry* ahc_lookup_phase_entry(int phase);void ahc_compile_devinfo(struct ahc_devinfo *devinfo, u_int our_id, u_int target, u_int lun, char channel, role_t role);/************************** Transfer Negotiation ******************************/struct ahc_syncrate* ahc_find_syncrate(struct ahc_softc *ahc, u_int *period, u_int *ppr_options, u_int maxsync);u_int ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync);void ahc_validate_offset(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, struct ahc_syncrate *syncrate, u_int *offset, int wide, role_t role);void ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, u_int *bus_width, role_t role);/* * Negotiation types. These are used to qualify if we should renegotiate * even if our goal and current transport parameters are identical. */typedef enum { AHC_NEG_TO_GOAL, /* Renegotiate only if goal and curr differ. */ AHC_NEG_IF_NON_ASYNC, /* Renegotiate so long as goal is non-async. */ AHC_NEG_ALWAYS /* Renegotiat even if goal is async. */} ahc_neg_type;int ahc_update_neg_request(struct ahc_softc*, struct ahc_devinfo*, struct ahc_tmode_tstate*, struct ahc_initiator_tinfo*, ahc_neg_type);void ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, u_int width, u_int type, int paused);void ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, struct ahc_syncrate *syncrate, u_int period, u_int offset, u_int ppr_options, u_int type, int paused);typedef enum { AHC_QUEUE_NONE, AHC_QUEUE_BASIC, AHC_QUEUE_TAGGED} ahc_queue_alg;void ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_queue_alg alg);/**************************** Target Mode *************************************/#ifdef AHC_TARGET_MODEvoid ahc_send_lstate_events(struct ahc_softc *, struct ahc_tmode_lstate *);void ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb);cam_status ahc_find_tmode_devs(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb, struct ahc_tmode_tstate **tstate, struct ahc_tmode_lstate **lstate, int notfound_failure);#ifndef AHC_TMODE_ENABLE#define AHC_TMODE_ENABLE 0#endif#endif/******************************* Debug ***************************************/#ifdef AHC_DEBUGextern uint32_t ahc_debug;#define AHC_SHOW_MISC 0x0001#define AHC_SHOW_SENSE 0x0002#define AHC_DUMP_SEEPROM 0x0004#define AHC_SHOW_TERMCTL 0x0008#define AHC_SHOW_MEMORY 0x0010#define AHC_SHOW_MESSAGES 0x0020#define AHC_SHOW_DV 0x0040#define AHC_SHOW_SELTO 0x0080#define AHC_SHOW_QFULL 0x0200#define AHC_SHOW_QUEUE 0x0400#define AHC_SHOW_TQIN 0x0800#define AHC_SHOW_MASKED_ERRORS 0x1000#define AHC_DEBUG_SEQUENCER 0x2000#endifvoid ahc_print_scb(struct scb *scb);void ahc_print_devinfo(struct ahc_softc *ahc, struct ahc_devinfo *dev);void ahc_dump_card_state(struct ahc_softc *ahc);int ahc_print_register(ahc_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);/******************************* SEEPROM *************************************/int ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd);void ahc_release_seeprom(struct seeprom_descriptor *sd);#endif /* _AIC7XXX_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -