📄 ispvar.h
字号:
*/void isp_fw_dump(struct ispsoftc *isp);#endif/* * Internal Interrupt Service Routine * * The outer layers do the spade work to get the appropriate status register, * semaphore register and first mailbox register (if appropriate). This also * means that most spurious/bogus interrupts not for us can be filtered first. */void isp_intr(struct ispsoftc *, u_int16_t, u_int16_t, u_int16_t);/* * Command Entry Point- Platform Dependent layers call into this */int isp_start(XS_T *);/* these values are what isp_start returns */#define CMD_COMPLETE 101 /* command completed */#define CMD_EAGAIN 102 /* busy- maybe retry later */#define CMD_QUEUED 103 /* command has been queued for execution */#define CMD_RQLATER 104 /* requeue this command later *//* * Command Completion Point- Core layers call out from this with completed cmds */void isp_done(XS_T *);/* * Platform Dependent to External to Internal Control Function * * Assumes locks are held on entry. You should note that with many of * these commands and locks may be released while this is occurring. * * A few notes about some of these functions: * * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link. * The argument is a pointer to an integer which is the time, in microseconds, * we should wait to see whether we have good link. This test, if successful, * lets us know our connection topology and our Loop ID/AL_PA and so on. * You can't get anywhere without this. * * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for * all entities using the FC Generic Services subcommand GET ALL NEXT. * For each found entity, an ISPASYNC_FABRICDEV event is generated (see * below). * * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection * topology is NL or FL port (private or public loop). Since the Qlogic f/w * 'automatically' manages local loop connections, this function essentially * notes the arrival, departure, and possible shuffling around of local loop * entities. Thus for each arrival and departure this generates an isp_async * event of ISPASYNC_PROMENADE (see below). * * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP. * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging * and logging out of fabric devices (if one is on a fabric) and then marking * the 'loop state' as being ready to now be used for sending commands to * devices. Originally fabric name server and local loop scanning were * part of this function. It's now been separated to allow for finer control. */typedef enum { ISPCTL_RESET_BUS, /* Reset Bus */ ISPCTL_RESET_DEV, /* Reset Device */ ISPCTL_ABORT_CMD, /* Abort Command */ ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */ ISPCTL_FCLINK_TEST, /* Test FC Link Status */ ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */ ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */ ISPCTL_PDB_SYNC, /* Synchronize Port Database */ ISPCTL_SEND_LIP, /* Send a LIP */ ISPCTL_GET_POSMAP, /* Get FC-AL position map */ ISPCTL_RUN_MBOXCMD, /* run a mailbox command */ ISPCTL_TOGGLE_TMODE /* toggle target mode */} ispctl_t;int isp_control(struct ispsoftc *, ispctl_t, void *);/* * Platform Dependent to Internal to External Control Function * (each platform must provide such a function) * * Assumes locks are held. * * A few notes about some of these functions: * * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has * occurred that invalidates the list of fabric devices known and/or * the list of known loop devices. The argument passed is a pointer * whose values are defined below (local loop change, name server * change, other). 'Other' may simply be a LIP, or a change in * connection topology. * * ISPASYNC_FABRIC_DEV announces the next element in a list of * fabric device names we're getting out of the name server. The * argument points to a GET ALL NEXT response structure. The list * is known to terminate with an entry that refers to ourselves. * One of the main purposes of this function is to allow outer * layers, which are OS dependent, to set policy as to which fabric * devices might actually be logged into (and made visible) later * at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric * devices that we can log into (256 less 3 'reserved' for F-port * topologies), and fabrics can grow up to 8 million or so entries * (24 bits of Port Address, less a wad of reserved spaces), clearly * we had better let the OS determine login policy. * * ISPASYNC_PROMENADE has an argument that is a pointer to an integer which * is an index into the portdb in the softc ('target'). Whether that entrie's * valid tag is set or not says whether something has arrived or departed. * The name refers to a favorite pastime of many city dwellers- watching * people come and go, talking of Michaelangelo, and so on.. * * ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a * response queue entry not otherwise handled. The outer layer should * return non-zero if it handled it. The 'arg' points to an unmassaged * response queue entry. */typedef enum { ISPASYNC_NEW_TGT_PARAMS, /* New Target Parameters Negotiated */ ISPASYNC_BUS_RESET, /* Bus Was Reset */ ISPASYNC_LOOP_DOWN, /* FC Loop Down */ ISPASYNC_LOOP_UP, /* FC Loop Up */ ISPASYNC_LIP, /* LIP Received */ ISPASYNC_LOOP_RESET, /* Loop Reset Received */ ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */ ISPASYNC_FABRIC_DEV, /* FC Fabric Device Arrival */ ISPASYNC_PROMENADE, /* FC Objects coming && going */ ISPASYNC_TARGET_MESSAGE, /* target message */ ISPASYNC_TARGET_EVENT, /* target asynchronous event */ ISPASYNC_TARGET_ACTION, /* other target command action */ ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */ ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */ ISPASYNC_FW_CRASH /* Firmware has crashed */} ispasync_t;int isp_async(struct ispsoftc *, ispasync_t, void *);#define ISPASYNC_CHANGE_PDB ((void *) 0)#define ISPASYNC_CHANGE_SNS ((void *) 1)#define ISPASYNC_CHANGE_OTHER ((void *) 2)/* * Platform Dependent Error and Debug Printout */#ifdef __GNUC__void isp_prt(struct ispsoftc *, int level, const char *, ...) __attribute__((__format__(__printf__,3,4)));#elsevoid isp_prt(struct ispsoftc *, int level, const char *, ...);#endif#define ISP_LOGALL 0x0 /* log always */#define ISP_LOGCONFIG 0x1 /* log configuration messages */#define ISP_LOGINFO 0x2 /* log informational messages */#define ISP_LOGWARN 0x4 /* log warning messages */#define ISP_LOGERR 0x8 /* log error messages */#define ISP_LOGDEBUG0 0x10 /* log simple debug messages */#define ISP_LOGDEBUG1 0x20 /* log intermediate debug messages */#define ISP_LOGDEBUG2 0x40 /* log most debug messages */#define ISP_LOGDEBUG3 0x80 /* log high frequency debug messages */#define ISP_LOGDEBUG4 0x100 /* log high frequency debug messages */#define ISP_LOGTDEBUG0 0x200 /* log simple debug messages (target mode) */#define ISP_LOGTDEBUG1 0x400 /* log intermediate debug messages (target) */#define ISP_LOGTDEBUG2 0x800 /* log all debug messages (target) *//* * Each Platform provides it's own isposinfo substructure of the ispsoftc * defined above. * * Each platform must also provide the following macros/defines: * * * INLINE - platform specific define for 'inline' functions * * ISP_DMA_ADDR_T - platform specific dma address coookie- basically * the largest integer that can hold the 32 or * 64 bit value appropriate for the QLogic's DMA * addressing. Defaults to u_int32_t. * * ISP2100_SCRLEN - length for the Fibre Channel scratch DMA area * * MEMZERO(dst, src) platform zeroing function * MEMCPY(dst, src, count) platform copying function * SNPRINTF(buf, bufsize, fmt, ...) snprintf * STRNCAT(dstbuf, size, srcbuf) strncat * USEC_DELAY(usecs) microsecond spindelay function * USEC_SLEEP(isp, usecs) microsecond sleep function * * NANOTIME_T nanosecond time type * * GET_NANOTIME(NANOTIME_T *) get current nanotime. * * GET_NANOSEC(NANOTIME_T *) get u_int64_t from NANOTIME_T * * NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *) * subtract two NANOTIME_T values * * * MAXISPREQUEST(struct ispsoftc *) maximum request queue size * for this particular board type * * MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size) * * Function/Macro the provides memory synchronization on * various objects so that the ISP's and the system's view * of the same object is consistent. * * MBOX_ACQUIRE(struct ispsoftc *) acquire lock on mailbox regs * MBOX_WAIT_COMPLETE(struct ispsoftc *) wait for mailbox cmd to be done * MBOX_NOTIFY_COMPLETE(struct ispsoftc *) notification of mbox cmd donee * MBOX_RELEASE(struct ispsoftc *) release lock on mailbox regs * * FC_SCRATCH_ACQUIRE(struct ispsoftc *) acquire lock on FC scratch area * FC_SCRATCH_RELEASE(struct ispsoftc *) acquire lock on FC scratch area * * SCSI_GOOD SCSI 'Good' Status * SCSI_CHECK SCSI 'Check Condition' Status * SCSI_BUSY SCSI 'Busy' Status * SCSI_QFULL SCSI 'Queue Full' Status * * XS_T Platform SCSI transaction type (i.e., command for HBA) * XS_ISP(xs) gets an instance out of an XS_T * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" * XS_TGT(xs) gets the target "" * XS_LUN(xs) gets the lun "" * XS_CDBP(xs) gets a pointer to the scsi CDB "" * XS_CDBLEN(xs) gets the CDB's length "" * XS_XFRLEN(xs) gets the associated data transfer length "" * XS_TIME(xs) gets the time (in milliseconds) for this command * XS_RESID(xs) gets the current residual count * XS_STSP(xs) gets a pointer to the SCSI status byte "" * XS_SNSP(xs) gets a pointer to the associate sense data * XS_SNSLEN(xs) gets the length of sense data storage * XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key * XS_TAG_P(xs) predicate of whether this command should be tagged * XS_TAG_TYPE(xs) which type of tag to use * XS_SETERR(xs) set error state * * HBA_NOERROR command has no erros * HBA_BOTCH hba botched something * HBA_CMDTIMEOUT command timed out * HBA_SELTIMEOUT selection timed out (also port logouts for FC) * HBA_TGTBSY target returned a BUSY status * HBA_BUSRESET bus reset destroyed command * HBA_ABORTED command was aborted (by request) * HBA_DATAOVR a data overrun was detected * HBA_ARQFAIL Automatic Request Sense failed * * XS_ERR(xs) return current error state * XS_NOERR(xs) there is no error currently set * XS_INITERR(xs) initialize error state * * XS_SAVE_SENSE(xs, sp) save sense data * * XS_SET_STATE_STAT(isp, sp, xs) platform dependent interpreter of * response queue entry status bits * * * DEFAULT_IID(struct ispsoftc *) Default SCSI initiator ID * DEFAULT_LOOPID(struct ispsoftc *) Default FC Loop ID * DEFAULT_NODEWWN(struct ispsoftc *) Default Node WWN * DEFAULT_PORTWWN(struct ispsoftc *) Default Port WWN * These establish reasonable defaults for each platform. * These must be available independent of card NVRAM and are * to be used should NVRAM not be readable. * * ISP_NODEWWN(struct ispsoftc *) FC Node WWN to use * ISP_PORTWWN(struct ispsoftc *) FC Port WWN to use * * These are to be used after NVRAM is read. The tags * in fcparam.isp_{node,port}wwn reflect the values * read from NVRAM (possibly corrected for card botches). * Each platform can take that information and override * it or ignore and return the Node and Port WWNs to be * used when sending the Qlogic f/w the Initialization Control * Block. * * (XXX these do endian specific transformations- in transition XXX) * * ISP_IOXPUT_8(struct ispsoftc *, u_int8_t srcval, u_int8_t *dstptr) * ISP_IOXPUT_16(struct ispsoftc *, u_int16_t srcval, u_int16_t *dstptr) * ISP_IOXPUT_32(struct ispsoftc *, u_int32_t srcval, u_int32_t *dstptr) * * ISP_IOXGET_8(struct ispsoftc *, u_int8_t *srcptr, u_int8_t dstrval) * ISP_IOXGET_16(struct ispsoftc *, u_int16_t *srcptr, u_int16_t dstrval) * ISP_IOXGET_32(struct ispsoftc *, u_int32_t *srcptr, u_int32_t dstrval) * * ISP_SWIZZLE_NVRAM_WORD(struct ispsoftc *, u_int16_t *) */#endif /* _ISPVAR_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -