📄 sym_hipd.h
字号:
/* Transfer goal */ struct sym_trans tgoal; /* * Keep track of the CCB used for the negotiation in order * to ensure that only 1 negotiation is queued at a time. */ struct sym_ccb * nego_cp; /* CCB used for the nego */ /* * Set when we want to reset the device. */ u_char to_reset; /* * Other user settable limits and options. * These limits are read from the NVRAM if present. */ u_char usrflags; u_short usrtags; struct scsi_target *starget;};/* * Global LCB HEADER. * * Due to lack of indirect addressing on earlier NCR chips, * this substructure is copied from the LCB to a global * address after selection. * For SYMBIOS chips that support LOAD/STORE this copy is * not needed and thus not performed. */struct sym_lcbh { /* * SCRIPTS address jumped by SCRIPTS on reselection. * For not probed logical units, this address points to * SCRIPTS that deal with bad LU handling (must be at * offset zero of the LCB for that reason). *//*0*/ u32 resel_sa; /* * Task (bus address of a CCB) read from SCRIPTS that points * to the unique ITL nexus allowed to be disconnected. */ u32 itl_task_sa; /* * Task table bus address (read from SCRIPTS). */ u32 itlq_tbl_sa;};/* * Logical Unit Control Block */struct sym_lcb { /* * TCB header. * Assumed at offset 0. *//*0*/ struct sym_lcbh head; /* * Task table read from SCRIPTS that contains pointers to * ITLQ nexuses. The bus address read from SCRIPTS is * inside the header. */ u32 *itlq_tbl; /* Kernel virtual address */ /* * Busy CCBs management. */ u_short busy_itlq; /* Number of busy tagged CCBs */ u_short busy_itl; /* Number of busy untagged CCBs */ /* * Circular tag allocation buffer. */ u_short ia_tag; /* Tag allocation index */ u_short if_tag; /* Tag release index */ u_char *cb_tags; /* Circular tags buffer */ /* * O/S specific data structure. */#ifdef SYM_HAVE_SLCB struct sym_slcb s;#endif#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING /* * Optionnaly the driver can handle device queueing, * and requeues internally command to redo. */ SYM_QUEHEAD waiting_ccbq; SYM_QUEHEAD started_ccbq; int num_sgood; u_short started_tags; u_short started_no_tag; u_short started_max; u_short started_limit;#endif#ifdef SYM_OPT_LIMIT_COMMAND_REORDERING /* * Optionally the driver can try to prevent SCSI * IOs from being reordered too much. */ u_char tags_si; /* Current index to tags sum */ u_short tags_sum[2]; /* Tags sum counters */ u_short tags_since; /* # of tags since last switch */#endif /* * Set when we want to clear all tasks. */ u_char to_clear; /* * Capabilities. */ u_char user_flags; u_char curr_flags;};/* * Action from SCRIPTS on a task. * Is part of the CCB, but is also used separately to plug * error handling action to perform from SCRIPTS. */struct sym_actscr { u32 start; /* Jumped by SCRIPTS after selection */ u32 restart; /* Jumped by SCRIPTS on relection */};/* * Phase mismatch context. * * It is part of the CCB and is used as parameters for the * DATA pointer. We need two contexts to handle correctly the * SAVED DATA POINTER. */struct sym_pmc { struct sym_tblmove sg; /* Updated interrupted SG block */ u32 ret; /* SCRIPT return address */};/* * LUN control block lookup. * We use a direct pointer for LUN #0, and a table of * pointers which is only allocated for devices that support * LUN(s) > 0. */#if SYM_CONF_MAX_LUN <= 1#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : NULL#else#define sym_lp(tp, lun) \ (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : NULL#endif/* * Status are used by the host and the script processor. * * The last four bytes (status[4]) are copied to the * scratchb register (declared as scr0..scr3) just after the * select/reselect, and copied back just after disconnecting. * Inside the script the XX_REG are used. *//* * Last four bytes (script) */#define HX_REG scr0#define HX_PRT nc_scr0#define HS_REG scr1#define HS_PRT nc_scr1#define SS_REG scr2#define SS_PRT nc_scr2#define HF_REG scr3#define HF_PRT nc_scr3/* * Last four bytes (host) */#define host_xflags phys.head.status[0]#define host_status phys.head.status[1]#define ssss_status phys.head.status[2]#define host_flags phys.head.status[3]/* * Host flags */#define HF_IN_PM0 1u#define HF_IN_PM1 (1u<<1)#define HF_ACT_PM (1u<<2)#define HF_DP_SAVED (1u<<3)#define HF_SENSE (1u<<4)#define HF_EXT_ERR (1u<<5)#define HF_DATA_IN (1u<<6)#ifdef SYM_CONF_IARB_SUPPORT#define HF_HINT_IARB (1u<<7)#endif/* * More host flags */#if SYM_CONF_DMA_ADDRESSING_MODE == 2#define HX_DMAP_DIRTY (1u<<7)#endif/* * Global CCB HEADER. * * Due to lack of indirect addressing on earlier NCR chips, * this substructure is copied from the ccb to a global * address after selection (or reselection) and copied back * before disconnect. * For SYMBIOS chips that support LOAD/STORE this copy is * not needed and thus not performed. */struct sym_ccbh { /* * Start and restart SCRIPTS addresses (must be at 0). *//*0*/ struct sym_actscr go; /* * SCRIPTS jump address that deal with data pointers. * 'savep' points to the position in the script responsible * for the actual transfer of data. * It's written on reception of a SAVE_DATA_POINTER message. */ u32 savep; /* Jump address to saved data pointer */ u32 lastp; /* SCRIPTS address at end of data */#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN u32 wlastp;#endif /* * Status fields. */ u8 status[4];};/* * GET/SET the value of the data pointer used by SCRIPTS. * * We must distinguish between the LOAD/STORE-based SCRIPTS * that use directly the header in the CCB, and the NCR-GENERIC * SCRIPTS that use the copy of the header in the HCB. */#if SYM_CONF_GENERIC_SUPPORT#define sym_set_script_dp(np, cp, dp) \ do { \ if (np->features & FE_LDSTR) \ cp->phys.head.lastp = cpu_to_scr(dp); \ else \ np->ccb_head.lastp = cpu_to_scr(dp); \ } while (0)#define sym_get_script_dp(np, cp) \ scr_to_cpu((np->features & FE_LDSTR) ? \ cp->phys.head.lastp : np->ccb_head.lastp)#else#define sym_set_script_dp(np, cp, dp) \ do { \ cp->phys.head.lastp = cpu_to_scr(dp); \ } while (0)#define sym_get_script_dp(np, cp) (cp->phys.head.lastp)#endif/* * Data Structure Block * * During execution of a ccb by the script processor, the * DSA (data structure address) register points to this * substructure of the ccb. */struct sym_dsb { /* * CCB header. * Also assumed at offset 0 of the sym_ccb structure. *//*0*/ struct sym_ccbh head; /* * Phase mismatch contexts. * We need two to handle correctly the SAVED DATA POINTER. * MUST BOTH BE AT OFFSET < 256, due to using 8 bit arithmetic * for address calculation from SCRIPTS. */ struct sym_pmc pm0; struct sym_pmc pm1; /* * Table data for Script */ struct sym_tblsel select; struct sym_tblmove smsg; struct sym_tblmove smsg_ext; struct sym_tblmove cmd; struct sym_tblmove sense; struct sym_tblmove wresid; struct sym_tblmove data [SYM_CONF_MAX_SG];};/* * Our Command Control Block */struct sym_ccb { /* * This is the data structure which is pointed by the DSA * register when it is executed by the script processor. * It must be the first entry. */ struct sym_dsb phys; /* * Pointer to CAM ccb and related stuff. */ struct scsi_cmnd *cmd; /* CAM scsiio ccb */ u8 cdb_buf[16]; /* Copy of CDB */#define SYM_SNS_BBUF_LEN 32 u8 sns_bbuf[SYM_SNS_BBUF_LEN]; /* Bounce buffer for sense data */ int data_len; /* Total data length */ int segments; /* Number of SG segments */ u8 order; /* Tag type (if tagged command) */ unsigned char odd_byte_adjustment; /* odd-sized req on wide bus */ u_char nego_status; /* Negotiation status */ u_char xerr_status; /* Extended error flags */ u32 extra_bytes; /* Extraneous bytes transferred */ /* * Message areas. * We prepare a message to be sent after selection. * We may use a second one if the command is rescheduled * due to CHECK_CONDITION or COMMAND TERMINATED. * Contents are IDENTIFY and SIMPLE_TAG. * While negotiating sync or wide transfer, * a SDTR or WDTR message is appended. */ u_char scsi_smsg [12]; u_char scsi_smsg2[12]; /* * Auto request sense related fields. */ u_char sensecmd[6]; /* Request Sense command */ u_char sv_scsi_status; /* Saved SCSI status */ u_char sv_xerr_status; /* Saved extended status */ int sv_resid; /* Saved residual */ /* * Other fields. */ u32 ccb_ba; /* BUS address of this CCB */ u_short tag; /* Tag for this transfer */ /* NO_TAG means no tag */ u_char target; u_char lun; struct sym_ccb *link_ccbh; /* Host adapter CCB hash chain */ SYM_QUEHEAD link_ccbq; /* Link to free/busy CCB queue */ u32 startp; /* Initial data pointer */ u32 goalp; /* Expected last data pointer */#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN u32 wgoalp;#endif int ext_sg; /* Extreme data pointer, used */ int ext_ofs; /* to calculate the residual. */#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING SYM_QUEHEAD link2_ccbq; /* Link for device queueing */ u_char started; /* CCB queued to the squeue */#endif u_char to_abort; /* Want this IO to be aborted */#ifdef SYM_OPT_LIMIT_COMMAND_REORDERING u_char tags_si; /* Lun tags sum index (0,1) */#endif};#define CCB_BA(cp,lbl) cpu_to_scr(cp->ccb_ba + offsetof(struct sym_ccb, lbl))#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN#define sym_goalp(cp) ((cp->host_flags & HF_DATA_IN) ? cp->goalp : cp->wgoalp)#else#define sym_goalp(cp) (cp->goalp)#endiftypedef struct device *m_pool_ident_t;/* * Host Control Block */struct sym_hcb { /* * Global headers. * Due to poorness of addressing capabilities, earlier * chips (810, 815, 825) copy part of the data structures * (CCB, TCB and LCB) in fixed areas. */#if SYM_CONF_GENERIC_SUPPORT struct sym_ccbh ccb_head; struct sym_tcbh tcb_head; struct sym_lcbh lcb_head;#endif /* * Idle task and invalid task actions and * their bus addresses. */ struct sym_actscr idletask, notask, bad_itl, bad_itlq; u32 idletask_ba, notask_ba, bad_itl_ba, bad_itlq_ba; /* * Dummy lun table to protect us against target * returning bad lun number on reselection. */ u32 *badluntbl; /* Table physical address */ u32 badlun_sa; /* SCRIPT handler BUS address */ /* * Bus address of this host control block. */ u32 hcb_ba; /* * Bit 32-63 of the on-chip RAM bus address in LE format. * The START_RAM64 script loads the MMRS and MMWS from this * field. */ u32 scr_ram_seg; /* * Initial value of some IO register bits.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -