📄 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 Fusion MPT (Message Passing Technology) firmware. * * Copyright (c) 1999-2007 LSI Corporation * (mailto:DL-MPTFusionLinux@lsi.com) * *//*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* 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/kernel.h>#include <linux/pci.h>#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/mpi_sas.h" /* SAS support *//*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/#ifndef MODULEAUTHOR#define MODULEAUTHOR "LSI Corporation"#endif#ifndef COPYRIGHT#define COPYRIGHT "Copyright (c) 1999-2007 " MODULEAUTHOR#endif#define MPT_LINUX_VERSION_COMMON "3.04.06"#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.06"#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 0x50 /* 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/* debug print string length used for events and iocstatus */# define EVENT_DESCR_STR_SZ 100#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_FMT MYNAM ": %s: "#define MYIOC_s_DEBUG_FMT KERN_DEBUG MYNAM ": %s: "#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 - "/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * ATTO UL4D associated structures and defines */#define ATTOFLAG_DISC 0x0001#define ATTOFLAG_TAGGED 0x0002#define ATTOFLAG_WIDE_ENB 0x0008#define ATTOFLAG_ID_ENB 0x0010#define ATTOFLAG_LUN_ENB 0x0060typedef struct _ATTO_DEVICE_INFO{ u8 Offset; /* 00h */ u8 Period; /* 01h */ u16 ATTOFlags; /* 02h */} ATTO_DEVICE_INFO, MPI_POINTER PTR_ATTO_DEVICE_INFO, ATTODeviceInfo_t, MPI_POINTER pATTODeviceInfo_t;typedef struct _ATTO_CONFIG_PAGE_SCSI_PORT_2{ CONFIG_PAGE_HEADER Header; /* 00h */ u16 PortFlags; /* 04h */ u16 Unused1; /* 06h */ u32 Unused2; /* 08h */ ATTO_DEVICE_INFO DeviceSettings[16]; /* 0Ch */} fATTO_CONFIG_PAGE_SCSI_PORT_2, MPI_POINTER PTR_ATTO_CONFIG_PAGE_SCSI_PORT_2, ATTO_SCSIPortPage2_t, MPI_POINTER pATTO_SCSIPortPage2_t;/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*//* * MPT protocol driver defs... */typedef enum { MPTBASE_DRIVER, /* MPT base class */ MPTCTL_DRIVER, /* MPT ioctl class */ MPTSPI_DRIVER, /* MPT SPI host class */ MPTFC_DRIVER, /* MPT FC host class */ MPTSAS_DRIVER, /* MPT SAS host class */ MPTLAN_DRIVER, /* MPT LAN class */ MPTSTM_DRIVER, /* MPT SCSI target mode 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);};/* * MPT adapter / port / bus / device info structures... */typedef union _MPT_FRAME_TRACKER { struct { struct list_head list; 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 0x80typedef struct _MPT_SGL_HDR { SGESimple32_t sge[1];} MPT_SGL_HDR;typedef struct _MPT_SGL64_HDR { SGESimple64_t sge[1];} MPT_SGL64_HDR;/* * System interface register set */typedef struct _SYSIF_REGS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -