📄 mptbase.h
字号:
/* IEEE Registered Extended Identifier obtained via INQUIRY VPD page 0x83 */ /* NOTE: Do not separate uniq_prepad and uniq_data as they are treateed as a single entity in the code */ u8 uniq_prepad[8]; u8 uniq_data[20]; u8 pad2[4];} VirtDevice;/* * Fibre Channel (SCSI) target device and associated defines... */#define MPT_TARGET_DEFAULT_DV_STATUS 0x00#define MPT_TARGET_FLAGS_VALID_NEGO 0x01#define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02#define MPT_TARGET_FLAGS_Q_YES 0x08#define MPT_TARGET_FLAGS_VALID_56 0x10#define MPT_TARGET_FLAGS_SAF_TE_ISSUED 0x20/* * /proc/mpt interface */typedef struct { const char *name; mode_t mode; int pad; read_proc_t *read_proc; write_proc_t *write_proc;} mpt_proc_entry_t;#define MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len) \do { \ len -= offset; \ if (len < request) { \ *eof = 1; \ if (len <= 0) \ return 0; \ } else \ len = request; \ *start = buf + offset; \ return len; \} while (0)/* * IOCTL structure and associated defines */#define MPT_IOCTL_STATUS_DID_IOCRESET 0x01 /* IOC Reset occurred on the current*/#define MPT_IOCTL_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */#define MPT_IOCTL_STATUS_TIMER_ACTIVE 0x04 /* The timer is running */#define MPT_IOCTL_STATUS_SENSE_VALID 0x08 /* Sense data is valid */#define MPT_IOCTL_STATUS_COMMAND_GOOD 0x10 /* Command Status GOOD */#define MPT_IOCTL_STATUS_TMTIMER_ACTIVE 0x20 /* The TM timer is running */#define MPT_IOCTL_STATUS_TM_FAILED 0x40 /* User TM request failed */#define MPTCTL_RESET_OK 0x01 /* Issue Bus Reset */typedef struct _MPT_IOCTL { struct _MPT_ADAPTER *ioc; u8 ReplyFrame[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ u8 sense[MPT_SENSE_BUFFER_ALLOC]; int wait_done; /* wake-up value for this ioc */ u8 rsvd; u8 status; /* current command status */ u8 reset; /* 1 if bus reset allowed */ u8 target; /* target for reset */ struct semaphore sem_ioc;} MPT_IOCTL;/* * Event Structure and define */#define MPTCTL_EVENT_LOG_SIZE (0x000000032)typedef struct _mpt_ioctl_events { u32 event; /* Specified by define above */ u32 eventContext; /* Index or counter */ int data[2]; /* First 8 bytes of Event Data */} MPT_IOCTL_EVENTS;/* * CONFIGPARM status defines */#define MPT_CONFIG_GOOD MPI_IOCSTATUS_SUCCESS#define MPT_CONFIG_ERROR 0x002F/* * Substructure to store SCSI specific configuration page data */ /* dvStatus defines: */#define MPT_SCSICFG_NEGOTIATE 0x01 /* Negotiate on next IO */#define MPT_SCSICFG_NEED_DV 0x02 /* Schedule DV */#define MPT_SCSICFG_DV_PENDING 0x04 /* DV on this physical id pending */#define MPT_SCSICFG_DV_NOT_DONE 0x08 /* DV has not been performed */#define MPT_SCSICFG_BLK_NEGO 0x10 /* WriteSDP1 with WDTR and SDTR disabled */#define MPT_SCSICFG_RELOAD_IOC_PG3 0x20 /* IOC Pg 3 data is obsolete */ /* Args passed to writeSDP1: */#define MPT_SCSICFG_USE_NVRAM 0x01 /* WriteSDP1 using NVRAM */#define MPT_SCSICFG_ALL_IDS 0x02 /* WriteSDP1 to all IDS *//* #define MPT_SCSICFG_BLK_NEGO 0x10 WriteSDP1 with WDTR and SDTR disabled */typedef struct _SpiCfgData { u32 PortFlags; int *nvram; /* table of device NVRAM values */ IOCPage4_t *pIocPg4; /* SEP devices addressing */ dma_addr_t IocPg4_dma; /* Phys Addr of IOCPage4 data */ int IocPg4Sz; /* IOCPage4 size */ u8 dvStatus[MPT_MAX_SCSI_DEVICES]; u8 minSyncFactor; /* 0xFF if async */ u8 maxSyncOffset; /* 0 if async */ u8 maxBusWidth; /* 0 if narrow, 1 if wide */ u8 busType; /* SE, LVD, HD */ u8 sdp1version; /* SDP1 version */ u8 sdp1length; /* SDP1 length */ u8 sdp0version; /* SDP0 version */ u8 sdp0length; /* SDP0 length */ u8 dvScheduled; /* 1 if scheduled */ u8 forceDv; /* 1 to force DV scheduling */ u8 noQas; /* Disable QAS for this adapter */ u8 Saf_Te; /* 1 to force all Processors as * SAF-TE if Inquiry data length * is too short to check for SAF-TE */ u8 mpt_dv; /* command line option: enhanced=1, basic=0 */ u8 bus_reset; /* 1 to allow bus reset */ u8 rsvd[1];}SpiCfgData;typedef struct _SasCfgData { u8 ptClear; /* 1 to automatically clear the * persistent table. * 0 to disable * automatic clearing. */}SasCfgData;typedef struct _RaidCfgData { IOCPage2_t *pIocPg2; /* table of Raid Volumes */ IOCPage3_t *pIocPg3; /* table of physical disks */ int isRaid; /* bit field, 1 if RAID */}RaidCfgData;/* * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS */typedef struct _MPT_ADAPTER{ int id; /* Unique adapter id N {0,1,2,...} */ int pci_irq; /* This irq */ char name[MPT_NAME_LENGTH]; /* "iocN" */ char *prod_name; /* "LSIFC9x9" */ SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ u8 bus_type; u32 mem_phys; /* == f4020000 (mmap) */ u32 pio_mem_phys; /* Programmed IO (downloadboot) */ int mem_size; /* mmap memory size */ int alloc_total; u32 last_state; int active; u8 *alloc; /* frames alloc ptr */ dma_addr_t alloc_dma; u32 alloc_sz; MPT_FRAME_HDR *reply_frames; /* Reply msg frames - rounded up! */ u32 reply_frames_low_dma; int reply_depth; /* Num Allocated reply frames */ int reply_sz; /* Reply frame size */ int num_chain; /* Number of chain buffers */ /* Pool of buffers for chaining. ReqToChain * and ChainToChain track index of chain buffers. * ChainBuffer (DMA) virt/phys addresses. * FreeChainQ (lock) locking mechanisms. */ int *ReqToChain; int *RequestNB; int *ChainToChain; u8 *ChainBuffer; dma_addr_t ChainBufferDMA; struct list_head FreeChainQ; spinlock_t FreeChainQlock; /* We (host driver) get to manage our own RequestQueue! */ dma_addr_t req_frames_dma; MPT_FRAME_HDR *req_frames; /* Request msg frames - rounded up! */ u32 req_frames_low_dma; int req_depth; /* Number of request frames */ int req_sz; /* Request frame size (bytes) */ spinlock_t FreeQlock; struct list_head FreeQ; /* Pool of SCSI sense buffers for commands coming from * the SCSI mid-layer. We have one 256 byte sense buffer * for each REQ entry. */ u8 *sense_buf_pool; dma_addr_t sense_buf_pool_dma; u32 sense_buf_low_dma; u8 *HostPageBuffer; /* SAS - host page buffer support */ u32 HostPageBuffer_sz; dma_addr_t HostPageBuffer_dma; int mtrr_reg; struct pci_dev *pcidev; /* struct pci_dev pointer */ u8 __iomem *memmap; /* mmap address */ struct Scsi_Host *sh; /* Scsi Host pointer */ SpiCfgData spi_data; /* Scsi config. data */ RaidCfgData raid_data; /* Raid config. data */ SasCfgData sas_data; /* Sas config. data */ MPT_IOCTL *ioctl; /* ioctl data pointer */ struct proc_dir_entry *ioc_dentry; struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */ spinlock_t diagLock; /* diagnostic reset lock */ int diagPending; u32 biosVersion; /* BIOS version from IO Unit Page 2 */ int eventTypes; /* Event logging parameters */ int eventContext; /* Next event context */ int eventLogSize; /* Max number of cached events */ struct _mpt_ioctl_events *events; /* pointer to event log */ u8 *cached_fw; /* Pointer to FW */ dma_addr_t cached_fw_dma; struct list_head configQ; /* linked list of config. requests */ int hs_reply_idx;#ifndef MFCNT u32 pad0;#else u32 mfcnt;#endif u32 NB_for_64_byte_frame; u32 hs_req[MPT_MAX_FRAME_SIZE/sizeof(u32)]; u16 hs_reply[MPT_MAX_FRAME_SIZE/sizeof(u16)]; IOCFactsReply_t facts; PortFactsReply_t pfacts[2]; FCPortPage0_t fc_port_page0[2]; struct timer_list persist_timer; /* persist table timer */ int persist_wait_done; /* persist completion flag */ u8 persist_reply_frame[MPT_DEFAULT_FRAME_SIZE]; /* persist reply */ LANPage0_t lan_cnfg_page0; LANPage1_t lan_cnfg_page1; /* * Description: errata_flag_1064 * If a PCIX read occurs within 1 or 2 cycles after the chip receives * a split completion for a read data, an internal address pointer incorrectly * increments by 32 bytes */ int errata_flag_1064; u8 FirstWhoInit; u8 upload_fw; /* If set, do a fw upload */ u8 reload_fw; /* Force a FW Reload on next reset */ u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */ u8 pad1[4]; int DoneCtx; int TaskCtx; int InternalCtx; struct list_head list; struct net_device *netdev; struct list_head sas_topology;} MPT_ADAPTER;/* * New return value convention: * 1 = Ok to free associated request frame * 0 = not Ok ... */typedef int (*MPT_CALLBACK)(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply);typedef int (*MPT_EVHANDLER)(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply);typedef int (*MPT_RESETHANDLER)(MPT_ADAPTER *ioc, int reset_phase);/* reset_phase defs */#define MPT_IOC_PRE_RESET 0#define MPT_IOC_POST_RESET 1#define MPT_IOC_SETUP_RESET 2/* * Invent MPT host event (super-set of MPI Events) * Fitted to 1030's 64-byte [max] request frame size */typedef struct _MPT_HOST_EVENT { EventNotificationReply_t MpiEvent; /* 8 32-bit words! */ u32 pad[6]; void *next;} MPT_HOST_EVENT;#define MPT_HOSTEVENT_IOC_BRINGUP 0x91#define MPT_HOSTEVENT_IOC_RECOVER 0x92/* Define the generic types based on the size * of the dma_addr_t type. */typedef struct _mpt_sge { u32 FlagsLength; dma_addr_t Address;} MptSge_t;#define mpt_addr_size() \ ((sizeof(dma_addr_t) == sizeof(u64)) ? MPI_SGE_FLAGS_64_BIT_ADDRESSING : \ MPI_SGE_FLAGS_32_BIT_ADDRESSING)#define mpt_msg_flags() \ ((sizeof(dma_addr_t) == sizeof(u64)) ? MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 : \ MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * Funky (private) macros... */#ifdef MPT_DEBUG#define dprintk(x) printk x#else#define dprintk(x)#endif#ifdef MPT_DEBUG_INIT#define dinitprintk(x) printk x#define DBG_DUMP_FW_REQUEST_FRAME(mfp) \ { int i, n = 10; \ u32 *m = (u32 *)(mfp); \ printk(KERN_INFO " "); \ for (i=0; i<n; i++) \ printk(" %08x", le32_to_cpu(m[i])); \ printk("\n"); \ }#else#define dinitprintk(x)#define DBG_DUMP_FW_REQUEST_FRAME(mfp)#endif#ifdef MPT_DEBUG_EXIT#define dexitprintk(x) printk x#else#define dexitprintk(x)#endif#if defined MPT_DEBUG_FAIL || defined (MPT_DEBUG_SG)#define dfailprintk(x) printk x#else#define dfailprintk(x)#endif#ifdef MPT_DEBUG_HANDSHAKE#define dhsprintk(x) printk x#else#define dhsprintk(x)#endif#ifdef MPT_DEBUG_EVENTS#define devtprintk(x) printk x#else#define devtprintk(x)#endif#ifdef MPT_DEBUG_RESET#define drsprintk(x) printk x#else#define drsprintk(x)#endif//#if defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -