📄 mptbase.h
字号:
/* * linux/drivers/message/fusion/mptbase.h * High performance SCSI + LAN / Fibre Channel device drivers. * For use with PCI chip/adapter(s): * LSIFC9xx/LSI409xx Fibre Channel * running LSI Logic Fusion MPT (Message Passing Technology) firmware. * * Credits: * (see mptbase.c) * * Copyright (c) 1999-2004 LSI Logic Corporation * Originally By: Steven J. Ralston * (mailto:sjralston1@netscape.net) * (mailto:mpt_linux_developer@lsil.com) * * $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $ *//*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. NO WARRANTY THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. DISCLAIMER OF LIABILITY NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifndef MPTBASE_H_INCLUDED#define MPTBASE_H_INCLUDED/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/#include <linux/version.h>#include <linux/config.h>#include <linux/kernel.h>#include <linux/pci.h>#include "scsi3.h" /* SCSI defines */#include "lsi/mpi_type.h"#include "lsi/mpi.h" /* Fusion MPI(nterface) basic defs */#include "lsi/mpi_ioc.h" /* Fusion MPT IOC(ontroller) defs */#include "lsi/mpi_cnfg.h" /* IOC configuration support */#include "lsi/mpi_init.h" /* SCSI Host (initiator) protocol support */#include "lsi/mpi_lan.h" /* LAN over FC protocol support */#include "lsi/mpi_raid.h" /* Integrated Mirroring support */#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */#include "lsi/mpi_tool.h" /* Tools support */#include "lsi/fc_log.h"/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/#ifndef MODULEAUTHOR#define MODULEAUTHOR "LSI Logic Corporation"#endif#ifndef COPYRIGHT#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR#endif#define MPT_LINUX_VERSION_COMMON "3.01.09"#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.09"#define WHAT_MAGIC_STRING "@" "(" "#" ")"#define show_mptmod_ver(s,ver) \ printk(KERN_INFO "%s %s\n", s, ver);/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * Fusion MPT(linux) driver configurable stuff... */#define MPT_MAX_ADAPTERS 18#define MPT_MAX_PROTOCOL_DRIVERS 16#define MPT_MAX_BUS 1 /* Do not change */#define MPT_MAX_FC_DEVICES 255#define MPT_MAX_SCSI_DEVICES 16#define MPT_LAST_LUN 255#define MPT_SENSE_BUFFER_ALLOC 64 /* allow for 256 max sense alloc, but only 255 max request */#if MPT_SENSE_BUFFER_ALLOC >= 256# undef MPT_SENSE_BUFFER_ALLOC# define MPT_SENSE_BUFFER_ALLOC 256# define MPT_SENSE_BUFFER_SIZE 255#else# define MPT_SENSE_BUFFER_SIZE MPT_SENSE_BUFFER_ALLOC#endif#define MPT_NAME_LENGTH 32#define MPT_PROCFS_MPTBASEDIR "mpt" /* chg it to "driver/fusion" ? */#define MPT_PROCFS_SUMMARY_ALL_NODE MPT_PROCFS_MPTBASEDIR "/summary"#define MPT_PROCFS_SUMMARY_ALL_PATHNAME "/proc/" MPT_PROCFS_SUMMARY_ALL_NODE#define MPT_FW_REV_MAGIC_ID_STRING "FwRev="#define MPT_MAX_REQ_DEPTH 1023#define MPT_DEFAULT_REQ_DEPTH 256#define MPT_MIN_REQ_DEPTH 128#define MPT_MAX_REPLY_DEPTH MPT_MAX_REQ_DEPTH#define MPT_DEFAULT_REPLY_DEPTH 128#define MPT_MIN_REPLY_DEPTH 8#define MPT_MAX_REPLIES_PER_ISR 32#define MPT_MAX_FRAME_SIZE 128#define MPT_DEFAULT_FRAME_SIZE 128#define MPT_REPLY_FRAME_SIZE 0x40 /* Must be a multiple of 8 */#define MPT_SG_REQ_128_SCALE 1#define MPT_SG_REQ_96_SCALE 2#define MPT_SG_REQ_64_SCALE 4#define CAN_SLEEP 1#define NO_SLEEP 0#define MPT_COALESCING_TIMEOUT 0x10/* * SCSI transfer rate defines. */#define MPT_ULTRA320 0x08#define MPT_ULTRA160 0x09#define MPT_ULTRA2 0x0A#define MPT_ULTRA 0x0C#define MPT_FAST 0x19#define MPT_SCSI 0x32#define MPT_ASYNC 0xFF#define MPT_NARROW 0#define MPT_WIDE 1#define C0_1030 0x08#define XL_929 0x01/* * Try to keep these at 2^N-1 */#define MPT_FC_CAN_QUEUE 127#define MPT_SCSI_CAN_QUEUE 127/* * Set the MAX_SGE value based on user input. */#ifdef CONFIG_FUSION_MAX_SGE#if CONFIG_FUSION_MAX_SGE < 16#define MPT_SCSI_SG_DEPTH 16#elif CONFIG_FUSION_MAX_SGE > 128#define MPT_SCSI_SG_DEPTH 128#else#define MPT_SCSI_SG_DEPTH CONFIG_FUSION_MAX_SGE#endif#else#define MPT_SCSI_SG_DEPTH 40#endif#ifdef __KERNEL__ /* { *//*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/#include <linux/proc_fs.h>/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * Attempt semi-consistent error & warning msgs across * MPT drivers. NOTE: Users of these macro defs must * themselves define their own MYNAM. */#define MYIOC_s_INFO_FMT KERN_INFO MYNAM ": %s: "#define MYIOC_s_NOTE_FMT KERN_NOTICE MYNAM ": %s: "#define MYIOC_s_WARN_FMT KERN_WARNING MYNAM ": %s: WARNING - "#define MYIOC_s_ERR_FMT KERN_ERR MYNAM ": %s: ERROR - "/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * MPT protocol driver defs... */typedef enum { MPTBASE_DRIVER, /* MPT base class */ MPTCTL_DRIVER, /* MPT ioctl class */ MPTSCSIH_DRIVER, /* MPT SCSI host (initiator) class */ MPTLAN_DRIVER, /* MPT LAN class */ MPTSTM_DRIVER, /* MPT SCSI target mode class */ MPTDMP_DRIVER, /* MPT Dynamic Multi-pathing class */ MPTUNKNOWN_DRIVER} MPT_DRIVER_CLASS;struct mpt_pci_driver{ int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); void (*remove) (struct pci_dev *dev); void (*shutdown) (struct device * dev);#ifdef CONFIG_PM int (*resume) (struct pci_dev *dev); int (*suspend) (struct pci_dev *dev, u32 state);#endif};/* * MPT adapter / port / bus / device info structures... */typedef union _MPT_FRAME_TRACKER { struct { struct _MPT_FRAME_HDR *forw; struct _MPT_FRAME_HDR *back; u32 arg1; u32 pad; void *argp1; } linkage; /* * NOTE: When request frames are free, on the linkage structure * contets are valid. All other values are invalid. * In particular, do NOT reply on offset [2] * (in words) being the * message context. * The message context must be reset (computed via base address * + an offset) prior to issuing any command. * * NOTE2: On non-32-bit systems, where pointers are LARGE, * using the linkage pointers destroys our sacred MsgContext * field contents. But we don't care anymore because these * are now reset in mpt_put_msg_frame() just prior to sending * a request off to the IOC. */ struct { u32 __hdr[2]; /* * The following _MUST_ match the location of the * MsgContext field in the MPT message headers. */ union { u32 MsgContext; struct { u16 req_idx; /* Request index */ u8 cb_idx; /* callback function index */ u8 rsvd; } fld; } msgctxu; } hwhdr; /* * Remark: 32 bit identifier: * 31-24: reserved * 23-16: call back index * 15-0 : request index */} MPT_FRAME_TRACKER;/* * We might want to view/access a frame as: * 1) generic request header * 2) SCSIIORequest * 3) SCSIIOReply * 4) MPIDefaultReply * 5) frame tracker */typedef struct _MPT_FRAME_HDR { union { MPIHeader_t hdr; SCSIIORequest_t scsireq; SCSIIOReply_t sreply; ConfigReply_t configreply; MPIDefaultReply_t reply; MPT_FRAME_TRACKER frame; } u;} MPT_FRAME_HDR;#define MPT_REQ_MSGFLAGS_DROPME 0x80/* Used for tracking the free request frames * and free reply frames. */typedef struct _MPT_Q_TRACKER { MPT_FRAME_HDR *head; MPT_FRAME_HDR *tail;} MPT_Q_TRACKER;typedef struct _MPT_SGL_HDR { SGESimple32_t sge[1];} MPT_SGL_HDR;typedef struct _MPT_SGL64_HDR { SGESimple64_t sge[1];} MPT_SGL64_HDR;typedef struct _Q_ITEM { struct _Q_ITEM *forw; struct _Q_ITEM *back;} Q_ITEM;typedef struct _Q_TRACKER { struct _Q_ITEM *head; struct _Q_ITEM *tail;} Q_TRACKER;typedef struct _MPT_DONE_Q { struct _MPT_DONE_Q *forw; struct _MPT_DONE_Q *back; void *argp;} MPT_DONE_Q;typedef struct _DONE_Q_TRACKER { MPT_DONE_Q *head; MPT_DONE_Q *tail;} DONE_Q_TRACKER;/* * Chip-specific stuff... FC929 delineates break between * FC and Parallel SCSI parts. Do NOT re-order. */typedef enum { FC919X = 0x0819, FC929X = 0x0829, FC909 = 0x0909, FC919 = 0x0919, FC929 = 0x0929, C1030 = 0x1030, C1035 = 0x1035, FCUNK = 0xFBAD} CHIP_TYPE;/* * System interface register set */typedef struct _SYSIF_REGS{ u32 Doorbell; /* 00 System<->IOC Doorbell reg */ u32 WriteSequence; /* 04 Write Sequence register */ u32 Diagnostic; /* 08 Diagnostic register */ u32 TestBase; /* 0C Test Base Address */ u32 DiagRwData; /* 10 Read Write Data (fw download) */ u32 DiagRwAddress; /* 14 Read Write Address (fw download)*/ u32 Reserved1[6]; /* 18-2F reserved for future use */ u32 IntStatus; /* 30 Interrupt Status */ u32 IntMask; /* 34 Interrupt Mask */ u32 Reserved2[2]; /* 38-3F reserved for future use */ u32 RequestFifo; /* 40 Request Post/Free FIFO */ u32 ReplyFifo; /* 44 Reply Post/Free FIFO */ u32 Reserved3[2]; /* 48-4F reserved for future use */ u32 HostIndex; /* 50 Host Index register */ u32 Reserved4[15]; /* 54-8F */ u32 Fubar; /* 90 For Fubar usage */ u32 Reserved5[27]; /* 94-FF */} SYSIF_REGS;/* * NOTE: Use MPI_{DOORBELL,WRITESEQ,DIAG}_xxx defs in lsi/mpi.h * in conjunction with SYSIF_REGS accesses! *//* * Dynamic Multi-Pathing specific stuff... */#define DMP_MAX_PATHS 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -