162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * linux/drivers/message/fusion/mptbase.h 362306a36Sopenharmony_ci * High performance SCSI + LAN / Fibre Channel device drivers. 462306a36Sopenharmony_ci * For use with PCI chip/adapter(s): 562306a36Sopenharmony_ci * LSIFC9xx/LSI409xx Fibre Channel 662306a36Sopenharmony_ci * running LSI Fusion MPT (Message Passing Technology) firmware. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (c) 1999-2008 LSI Corporation 962306a36Sopenharmony_ci * (mailto:DL-MPTFusionLinux@lsi.com) 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci This program is free software; you can redistribute it and/or modify 1562306a36Sopenharmony_ci it under the terms of the GNU General Public License as published by 1662306a36Sopenharmony_ci the Free Software Foundation; version 2 of the License. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci This program is distributed in the hope that it will be useful, 1962306a36Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 2062306a36Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2162306a36Sopenharmony_ci GNU General Public License for more details. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci NO WARRANTY 2462306a36Sopenharmony_ci THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 2562306a36Sopenharmony_ci CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 2662306a36Sopenharmony_ci LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 2762306a36Sopenharmony_ci MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 2862306a36Sopenharmony_ci solely responsible for determining the appropriateness of using and 2962306a36Sopenharmony_ci distributing the Program and assumes all risks associated with its 3062306a36Sopenharmony_ci exercise of rights under this Agreement, including but not limited to 3162306a36Sopenharmony_ci the risks and costs of program errors, damage to or loss of data, 3262306a36Sopenharmony_ci programs or equipment, and unavailability or interruption of operations. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci DISCLAIMER OF LIABILITY 3562306a36Sopenharmony_ci NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 3662306a36Sopenharmony_ci DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3762306a36Sopenharmony_ci DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 3862306a36Sopenharmony_ci ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 3962306a36Sopenharmony_ci TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 4062306a36Sopenharmony_ci USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 4162306a36Sopenharmony_ci HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci You should have received a copy of the GNU General Public License 4462306a36Sopenharmony_ci along with this program; if not, write to the Free Software 4562306a36Sopenharmony_ci Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 4662306a36Sopenharmony_ci*/ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#ifndef MPTBASE_H_INCLUDED 4962306a36Sopenharmony_ci#define MPTBASE_H_INCLUDED 5062306a36Sopenharmony_ci/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#include <linux/kernel.h> 5362306a36Sopenharmony_ci#include <linux/pci.h> 5462306a36Sopenharmony_ci#include <linux/mutex.h> 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#include "lsi/mpi_type.h" 5762306a36Sopenharmony_ci#include "lsi/mpi.h" /* Fusion MPI(nterface) basic defs */ 5862306a36Sopenharmony_ci#include "lsi/mpi_ioc.h" /* Fusion MPT IOC(ontroller) defs */ 5962306a36Sopenharmony_ci#include "lsi/mpi_cnfg.h" /* IOC configuration support */ 6062306a36Sopenharmony_ci#include "lsi/mpi_init.h" /* SCSI Host (initiator) protocol support */ 6162306a36Sopenharmony_ci#include "lsi/mpi_lan.h" /* LAN over FC protocol support */ 6262306a36Sopenharmony_ci#include "lsi/mpi_raid.h" /* Integrated Mirroring support */ 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */ 6562306a36Sopenharmony_ci#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */ 6662306a36Sopenharmony_ci#include "lsi/mpi_tool.h" /* Tools support */ 6762306a36Sopenharmony_ci#include "lsi/mpi_sas.h" /* SAS support */ 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#ifndef MODULEAUTHOR 7262306a36Sopenharmony_ci#define MODULEAUTHOR "LSI Corporation" 7362306a36Sopenharmony_ci#endif 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#ifndef COPYRIGHT 7662306a36Sopenharmony_ci#define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR 7762306a36Sopenharmony_ci#endif 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define MPT_LINUX_VERSION_COMMON "3.04.20" 8062306a36Sopenharmony_ci#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.20" 8162306a36Sopenharmony_ci#define WHAT_MAGIC_STRING "@" "(" "#" ")" 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci#define show_mptmod_ver(s,ver) \ 8462306a36Sopenharmony_ci printk(KERN_INFO "%s %s\n", s, ver); 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 8762306a36Sopenharmony_ci/* 8862306a36Sopenharmony_ci * Fusion MPT(linux) driver configurable stuff... 8962306a36Sopenharmony_ci */ 9062306a36Sopenharmony_ci#define MPT_MAX_ADAPTERS 18 9162306a36Sopenharmony_ci#define MPT_MAX_PROTOCOL_DRIVERS 16 9262306a36Sopenharmony_ci#define MPT_MAX_CALLBACKNAME_LEN 49 9362306a36Sopenharmony_ci#define MPT_MAX_BUS 1 /* Do not change */ 9462306a36Sopenharmony_ci#define MPT_MAX_FC_DEVICES 255 9562306a36Sopenharmony_ci#define MPT_MAX_SCSI_DEVICES 16 9662306a36Sopenharmony_ci#define MPT_LAST_LUN 255 9762306a36Sopenharmony_ci#define MPT_SENSE_BUFFER_ALLOC 64 9862306a36Sopenharmony_ci /* allow for 256 max sense alloc, but only 255 max request */ 9962306a36Sopenharmony_ci#if MPT_SENSE_BUFFER_ALLOC >= 256 10062306a36Sopenharmony_ci# undef MPT_SENSE_BUFFER_ALLOC 10162306a36Sopenharmony_ci# define MPT_SENSE_BUFFER_ALLOC 256 10262306a36Sopenharmony_ci# define MPT_SENSE_BUFFER_SIZE 255 10362306a36Sopenharmony_ci#else 10462306a36Sopenharmony_ci# define MPT_SENSE_BUFFER_SIZE MPT_SENSE_BUFFER_ALLOC 10562306a36Sopenharmony_ci#endif 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci#define MPT_NAME_LENGTH 32 10862306a36Sopenharmony_ci#define MPT_KOBJ_NAME_LEN 20 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define MPT_PROCFS_MPTBASEDIR "mpt" 11162306a36Sopenharmony_ci /* chg it to "driver/fusion" ? */ 11262306a36Sopenharmony_ci#define MPT_PROCFS_SUMMARY_ALL_NODE MPT_PROCFS_MPTBASEDIR "/summary" 11362306a36Sopenharmony_ci#define MPT_PROCFS_SUMMARY_ALL_PATHNAME "/proc/" MPT_PROCFS_SUMMARY_ALL_NODE 11462306a36Sopenharmony_ci#define MPT_FW_REV_MAGIC_ID_STRING "FwRev=" 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define MPT_MAX_REQ_DEPTH 1023 11762306a36Sopenharmony_ci#define MPT_DEFAULT_REQ_DEPTH 256 11862306a36Sopenharmony_ci#define MPT_MIN_REQ_DEPTH 128 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define MPT_MAX_REPLY_DEPTH MPT_MAX_REQ_DEPTH 12162306a36Sopenharmony_ci#define MPT_DEFAULT_REPLY_DEPTH 128 12262306a36Sopenharmony_ci#define MPT_MIN_REPLY_DEPTH 8 12362306a36Sopenharmony_ci#define MPT_MAX_REPLIES_PER_ISR 32 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define MPT_MAX_FRAME_SIZE 128 12662306a36Sopenharmony_ci#define MPT_DEFAULT_FRAME_SIZE 128 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci#define MPT_REPLY_FRAME_SIZE 0x50 /* Must be a multiple of 8 */ 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define MPT_SG_REQ_128_SCALE 1 13162306a36Sopenharmony_ci#define MPT_SG_REQ_96_SCALE 2 13262306a36Sopenharmony_ci#define MPT_SG_REQ_64_SCALE 4 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define CAN_SLEEP 1 13562306a36Sopenharmony_ci#define NO_SLEEP 0 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define MPT_COALESCING_TIMEOUT 0x10 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/* 14162306a36Sopenharmony_ci * SCSI transfer rate defines. 14262306a36Sopenharmony_ci */ 14362306a36Sopenharmony_ci#define MPT_ULTRA320 0x08 14462306a36Sopenharmony_ci#define MPT_ULTRA160 0x09 14562306a36Sopenharmony_ci#define MPT_ULTRA2 0x0A 14662306a36Sopenharmony_ci#define MPT_ULTRA 0x0C 14762306a36Sopenharmony_ci#define MPT_FAST 0x19 14862306a36Sopenharmony_ci#define MPT_SCSI 0x32 14962306a36Sopenharmony_ci#define MPT_ASYNC 0xFF 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define MPT_NARROW 0 15262306a36Sopenharmony_ci#define MPT_WIDE 1 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci#define C0_1030 0x08 15562306a36Sopenharmony_ci#define XL_929 0x01 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci/* 15962306a36Sopenharmony_ci * Try to keep these at 2^N-1 16062306a36Sopenharmony_ci */ 16162306a36Sopenharmony_ci#define MPT_FC_CAN_QUEUE 1024 16262306a36Sopenharmony_ci#define MPT_SCSI_CAN_QUEUE 127 16362306a36Sopenharmony_ci#define MPT_SAS_CAN_QUEUE 127 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci/* 16662306a36Sopenharmony_ci * Set the MAX_SGE value based on user input. 16762306a36Sopenharmony_ci */ 16862306a36Sopenharmony_ci#ifdef CONFIG_FUSION_MAX_SGE 16962306a36Sopenharmony_ci#if CONFIG_FUSION_MAX_SGE < 16 17062306a36Sopenharmony_ci#define MPT_SCSI_SG_DEPTH 16 17162306a36Sopenharmony_ci#elif CONFIG_FUSION_MAX_SGE > 128 17262306a36Sopenharmony_ci#define MPT_SCSI_SG_DEPTH 128 17362306a36Sopenharmony_ci#else 17462306a36Sopenharmony_ci#define MPT_SCSI_SG_DEPTH CONFIG_FUSION_MAX_SGE 17562306a36Sopenharmony_ci#endif 17662306a36Sopenharmony_ci#else 17762306a36Sopenharmony_ci#define MPT_SCSI_SG_DEPTH 40 17862306a36Sopenharmony_ci#endif 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#ifdef CONFIG_FUSION_MAX_FC_SGE 18162306a36Sopenharmony_ci#if CONFIG_FUSION_MAX_FC_SGE < 16 18262306a36Sopenharmony_ci#define MPT_SCSI_FC_SG_DEPTH 16 18362306a36Sopenharmony_ci#elif CONFIG_FUSION_MAX_FC_SGE > 256 18462306a36Sopenharmony_ci#define MPT_SCSI_FC_SG_DEPTH 256 18562306a36Sopenharmony_ci#else 18662306a36Sopenharmony_ci#define MPT_SCSI_FC_SG_DEPTH CONFIG_FUSION_MAX_FC_SGE 18762306a36Sopenharmony_ci#endif 18862306a36Sopenharmony_ci#else 18962306a36Sopenharmony_ci#define MPT_SCSI_FC_SG_DEPTH 40 19062306a36Sopenharmony_ci#endif 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/* debug print string length used for events and iocstatus */ 19362306a36Sopenharmony_ci# define EVENT_DESCR_STR_SZ 100 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define MPT_POLLING_INTERVAL 1000 /* in milliseconds */ 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci#ifdef __KERNEL__ /* { */ 19862306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#include <linux/proc_fs.h> 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 20362306a36Sopenharmony_ci/* 20462306a36Sopenharmony_ci * Attempt semi-consistent error & warning msgs across 20562306a36Sopenharmony_ci * MPT drivers. NOTE: Users of these macro defs must 20662306a36Sopenharmony_ci * themselves define their own MYNAM. 20762306a36Sopenharmony_ci */ 20862306a36Sopenharmony_ci#define MYIOC_s_FMT MYNAM ": %s: " 20962306a36Sopenharmony_ci#define MYIOC_s_DEBUG_FMT KERN_DEBUG MYNAM ": %s: " 21062306a36Sopenharmony_ci#define MYIOC_s_INFO_FMT KERN_INFO MYNAM ": %s: " 21162306a36Sopenharmony_ci#define MYIOC_s_NOTE_FMT KERN_NOTICE MYNAM ": %s: " 21262306a36Sopenharmony_ci#define MYIOC_s_WARN_FMT KERN_WARNING MYNAM ": %s: WARNING - " 21362306a36Sopenharmony_ci#define MYIOC_s_ERR_FMT KERN_ERR MYNAM ": %s: ERROR - " 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 21662306a36Sopenharmony_ci/* 21762306a36Sopenharmony_ci * ATTO UL4D associated structures and defines 21862306a36Sopenharmony_ci */ 21962306a36Sopenharmony_ci#define ATTOFLAG_DISC 0x0001 22062306a36Sopenharmony_ci#define ATTOFLAG_TAGGED 0x0002 22162306a36Sopenharmony_ci#define ATTOFLAG_WIDE_ENB 0x0008 22262306a36Sopenharmony_ci#define ATTOFLAG_ID_ENB 0x0010 22362306a36Sopenharmony_ci#define ATTOFLAG_LUN_ENB 0x0060 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_citypedef struct _ATTO_DEVICE_INFO 22662306a36Sopenharmony_ci{ 22762306a36Sopenharmony_ci u8 Offset; /* 00h */ 22862306a36Sopenharmony_ci u8 Period; /* 01h */ 22962306a36Sopenharmony_ci u16 ATTOFlags; /* 02h */ 23062306a36Sopenharmony_ci} ATTO_DEVICE_INFO, MPI_POINTER PTR_ATTO_DEVICE_INFO, 23162306a36Sopenharmony_ci ATTODeviceInfo_t, MPI_POINTER pATTODeviceInfo_t; 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_citypedef struct _ATTO_CONFIG_PAGE_SCSI_PORT_2 23462306a36Sopenharmony_ci{ 23562306a36Sopenharmony_ci CONFIG_PAGE_HEADER Header; /* 00h */ 23662306a36Sopenharmony_ci u16 PortFlags; /* 04h */ 23762306a36Sopenharmony_ci u16 Unused1; /* 06h */ 23862306a36Sopenharmony_ci u32 Unused2; /* 08h */ 23962306a36Sopenharmony_ci ATTO_DEVICE_INFO DeviceSettings[16]; /* 0Ch */ 24062306a36Sopenharmony_ci} fATTO_CONFIG_PAGE_SCSI_PORT_2, MPI_POINTER PTR_ATTO_CONFIG_PAGE_SCSI_PORT_2, 24162306a36Sopenharmony_ci ATTO_SCSIPortPage2_t, MPI_POINTER pATTO_SCSIPortPage2_t; 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 24562306a36Sopenharmony_ci/* 24662306a36Sopenharmony_ci * MPT protocol driver defs... 24762306a36Sopenharmony_ci */ 24862306a36Sopenharmony_citypedef enum { 24962306a36Sopenharmony_ci MPTBASE_DRIVER, /* MPT base class */ 25062306a36Sopenharmony_ci MPTCTL_DRIVER, /* MPT ioctl class */ 25162306a36Sopenharmony_ci MPTSPI_DRIVER, /* MPT SPI host class */ 25262306a36Sopenharmony_ci MPTFC_DRIVER, /* MPT FC host class */ 25362306a36Sopenharmony_ci MPTSAS_DRIVER, /* MPT SAS host class */ 25462306a36Sopenharmony_ci MPTLAN_DRIVER, /* MPT LAN class */ 25562306a36Sopenharmony_ci MPTSTM_DRIVER, /* MPT SCSI target mode class */ 25662306a36Sopenharmony_ci MPTUNKNOWN_DRIVER 25762306a36Sopenharmony_ci} MPT_DRIVER_CLASS; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_cistruct mpt_pci_driver{ 26062306a36Sopenharmony_ci int (*probe) (struct pci_dev *dev); 26162306a36Sopenharmony_ci void (*remove) (struct pci_dev *dev); 26262306a36Sopenharmony_ci}; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci/* 26562306a36Sopenharmony_ci * MPT adapter / port / bus / device info structures... 26662306a36Sopenharmony_ci */ 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_citypedef union _MPT_FRAME_TRACKER { 26962306a36Sopenharmony_ci struct { 27062306a36Sopenharmony_ci struct list_head list; 27162306a36Sopenharmony_ci u32 arg1; 27262306a36Sopenharmony_ci u32 pad; 27362306a36Sopenharmony_ci void *argp1; 27462306a36Sopenharmony_ci } linkage; 27562306a36Sopenharmony_ci /* 27662306a36Sopenharmony_ci * NOTE: When request frames are free, on the linkage structure 27762306a36Sopenharmony_ci * contents are valid. All other values are invalid. 27862306a36Sopenharmony_ci * In particular, do NOT reply on offset [2] 27962306a36Sopenharmony_ci * (in words) being the * message context. 28062306a36Sopenharmony_ci * The message context must be reset (computed via base address 28162306a36Sopenharmony_ci * + an offset) prior to issuing any command. 28262306a36Sopenharmony_ci * 28362306a36Sopenharmony_ci * NOTE2: On non-32-bit systems, where pointers are LARGE, 28462306a36Sopenharmony_ci * using the linkage pointers destroys our sacred MsgContext 28562306a36Sopenharmony_ci * field contents. But we don't care anymore because these 28662306a36Sopenharmony_ci * are now reset in mpt_put_msg_frame() just prior to sending 28762306a36Sopenharmony_ci * a request off to the IOC. 28862306a36Sopenharmony_ci */ 28962306a36Sopenharmony_ci struct { 29062306a36Sopenharmony_ci u32 __hdr[2]; 29162306a36Sopenharmony_ci /* 29262306a36Sopenharmony_ci * The following _MUST_ match the location of the 29362306a36Sopenharmony_ci * MsgContext field in the MPT message headers. 29462306a36Sopenharmony_ci */ 29562306a36Sopenharmony_ci union { 29662306a36Sopenharmony_ci u32 MsgContext; 29762306a36Sopenharmony_ci struct { 29862306a36Sopenharmony_ci u16 req_idx; /* Request index */ 29962306a36Sopenharmony_ci u8 cb_idx; /* callback function index */ 30062306a36Sopenharmony_ci u8 rsvd; 30162306a36Sopenharmony_ci } fld; 30262306a36Sopenharmony_ci } msgctxu; 30362306a36Sopenharmony_ci } hwhdr; 30462306a36Sopenharmony_ci /* 30562306a36Sopenharmony_ci * Remark: 32 bit identifier: 30662306a36Sopenharmony_ci * 31-24: reserved 30762306a36Sopenharmony_ci * 23-16: call back index 30862306a36Sopenharmony_ci * 15-0 : request index 30962306a36Sopenharmony_ci */ 31062306a36Sopenharmony_ci} MPT_FRAME_TRACKER; 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci/* 31362306a36Sopenharmony_ci * We might want to view/access a frame as: 31462306a36Sopenharmony_ci * 1) generic request header 31562306a36Sopenharmony_ci * 2) SCSIIORequest 31662306a36Sopenharmony_ci * 3) SCSIIOReply 31762306a36Sopenharmony_ci * 4) MPIDefaultReply 31862306a36Sopenharmony_ci * 5) frame tracker 31962306a36Sopenharmony_ci */ 32062306a36Sopenharmony_citypedef struct _MPT_FRAME_HDR { 32162306a36Sopenharmony_ci union { 32262306a36Sopenharmony_ci MPIHeader_t hdr; 32362306a36Sopenharmony_ci SCSIIORequest_t scsireq; 32462306a36Sopenharmony_ci SCSIIOReply_t sreply; 32562306a36Sopenharmony_ci ConfigReply_t configreply; 32662306a36Sopenharmony_ci MPIDefaultReply_t reply; 32762306a36Sopenharmony_ci MPT_FRAME_TRACKER frame; 32862306a36Sopenharmony_ci } u; 32962306a36Sopenharmony_ci} MPT_FRAME_HDR; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci#define MPT_REQ_MSGFLAGS_DROPME 0x80 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_citypedef struct _MPT_SGL_HDR { 33462306a36Sopenharmony_ci SGESimple32_t sge[1]; 33562306a36Sopenharmony_ci} MPT_SGL_HDR; 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_citypedef struct _MPT_SGL64_HDR { 33862306a36Sopenharmony_ci SGESimple64_t sge[1]; 33962306a36Sopenharmony_ci} MPT_SGL64_HDR; 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci/* 34262306a36Sopenharmony_ci * System interface register set 34362306a36Sopenharmony_ci */ 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_citypedef struct _SYSIF_REGS 34662306a36Sopenharmony_ci{ 34762306a36Sopenharmony_ci u32 Doorbell; /* 00 System<->IOC Doorbell reg */ 34862306a36Sopenharmony_ci u32 WriteSequence; /* 04 Write Sequence register */ 34962306a36Sopenharmony_ci u32 Diagnostic; /* 08 Diagnostic register */ 35062306a36Sopenharmony_ci u32 TestBase; /* 0C Test Base Address */ 35162306a36Sopenharmony_ci u32 DiagRwData; /* 10 Read Write Data (fw download) */ 35262306a36Sopenharmony_ci u32 DiagRwAddress; /* 14 Read Write Address (fw download)*/ 35362306a36Sopenharmony_ci u32 Reserved1[6]; /* 18-2F reserved for future use */ 35462306a36Sopenharmony_ci u32 IntStatus; /* 30 Interrupt Status */ 35562306a36Sopenharmony_ci u32 IntMask; /* 34 Interrupt Mask */ 35662306a36Sopenharmony_ci u32 Reserved2[2]; /* 38-3F reserved for future use */ 35762306a36Sopenharmony_ci u32 RequestFifo; /* 40 Request Post/Free FIFO */ 35862306a36Sopenharmony_ci u32 ReplyFifo; /* 44 Reply Post/Free FIFO */ 35962306a36Sopenharmony_ci u32 RequestHiPriFifo; /* 48 Hi Priority Request FIFO */ 36062306a36Sopenharmony_ci u32 Reserved3; /* 4C-4F reserved for future use */ 36162306a36Sopenharmony_ci u32 HostIndex; /* 50 Host Index register */ 36262306a36Sopenharmony_ci u32 Reserved4[15]; /* 54-8F */ 36362306a36Sopenharmony_ci u32 Fubar; /* 90 For Fubar usage */ 36462306a36Sopenharmony_ci u32 Reserved5[1050];/* 94-10F8 */ 36562306a36Sopenharmony_ci u32 Reset_1078; /* 10FC Reset 1078 */ 36662306a36Sopenharmony_ci} SYSIF_REGS; 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci/* 36962306a36Sopenharmony_ci * NOTE: Use MPI_{DOORBELL,WRITESEQ,DIAG}_xxx defs in lsi/mpi.h 37062306a36Sopenharmony_ci * in conjunction with SYSIF_REGS accesses! 37162306a36Sopenharmony_ci */ 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci/* 37562306a36Sopenharmony_ci * Dynamic Multi-Pathing specific stuff... 37662306a36Sopenharmony_ci */ 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci/* VirtTarget negoFlags field */ 37962306a36Sopenharmony_ci#define MPT_TARGET_NO_NEGO_WIDE 0x01 38062306a36Sopenharmony_ci#define MPT_TARGET_NO_NEGO_SYNC 0x02 38162306a36Sopenharmony_ci#define MPT_TARGET_NO_NEGO_QAS 0x04 38262306a36Sopenharmony_ci#define MPT_TAPE_NEGO_IDP 0x08 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci/* 38562306a36Sopenharmony_ci * VirtDevice - FC LUN device or SCSI target device 38662306a36Sopenharmony_ci */ 38762306a36Sopenharmony_citypedef struct _VirtTarget { 38862306a36Sopenharmony_ci struct scsi_target *starget; 38962306a36Sopenharmony_ci u8 tflags; 39062306a36Sopenharmony_ci u8 ioc_id; 39162306a36Sopenharmony_ci u8 id; 39262306a36Sopenharmony_ci u8 channel; 39362306a36Sopenharmony_ci u8 minSyncFactor; /* 0xFF is async */ 39462306a36Sopenharmony_ci u8 maxOffset; /* 0 if async */ 39562306a36Sopenharmony_ci u8 maxWidth; /* 0 if narrow, 1 if wide */ 39662306a36Sopenharmony_ci u8 negoFlags; /* bit field, see above */ 39762306a36Sopenharmony_ci u8 raidVolume; /* set, if RAID Volume */ 39862306a36Sopenharmony_ci u8 type; /* byte 0 of Inquiry data */ 39962306a36Sopenharmony_ci u8 deleted; /* target in process of being removed */ 40062306a36Sopenharmony_ci u8 inDMD; /* currently in the device 40162306a36Sopenharmony_ci removal delay timer */ 40262306a36Sopenharmony_ci u32 num_luns; 40362306a36Sopenharmony_ci} VirtTarget; 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_citypedef struct _VirtDevice { 40662306a36Sopenharmony_ci VirtTarget *vtarget; 40762306a36Sopenharmony_ci u8 configured_lun; 40862306a36Sopenharmony_ci u64 lun; 40962306a36Sopenharmony_ci} VirtDevice; 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci/* 41262306a36Sopenharmony_ci * Fibre Channel (SCSI) target device and associated defines... 41362306a36Sopenharmony_ci */ 41462306a36Sopenharmony_ci#define MPT_TARGET_DEFAULT_DV_STATUS 0x00 41562306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_VALID_NEGO 0x01 41662306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02 41762306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_Q_YES 0x08 41862306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_VALID_56 0x10 41962306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_SAF_TE_ISSUED 0x20 42062306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_RAID_COMPONENT 0x40 42162306a36Sopenharmony_ci#define MPT_TARGET_FLAGS_LED_ON 0x80 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci/* 42462306a36Sopenharmony_ci * IOCTL structure and associated defines 42562306a36Sopenharmony_ci */ 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci#define MPTCTL_RESET_OK 0x01 /* Issue Bus Reset */ 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci#define MPT_MGMT_STATUS_RF_VALID 0x01 /* The Reply Frame is VALID */ 43062306a36Sopenharmony_ci#define MPT_MGMT_STATUS_COMMAND_GOOD 0x02 /* Command Status GOOD */ 43162306a36Sopenharmony_ci#define MPT_MGMT_STATUS_PENDING 0x04 /* command is pending */ 43262306a36Sopenharmony_ci#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred 43362306a36Sopenharmony_ci on the current*/ 43462306a36Sopenharmony_ci#define MPT_MGMT_STATUS_SENSE_VALID 0x10 /* valid sense info */ 43562306a36Sopenharmony_ci#define MPT_MGMT_STATUS_TIMER_ACTIVE 0x20 /* obsolete */ 43662306a36Sopenharmony_ci#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf from 43762306a36Sopenharmony_ci complete routine */ 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci#define INITIALIZE_MGMT_STATUS(status) \ 44062306a36Sopenharmony_ci status = MPT_MGMT_STATUS_PENDING; 44162306a36Sopenharmony_ci#define CLEAR_MGMT_STATUS(status) \ 44262306a36Sopenharmony_ci status = 0; 44362306a36Sopenharmony_ci#define CLEAR_MGMT_PENDING_STATUS(status) \ 44462306a36Sopenharmony_ci status &= ~MPT_MGMT_STATUS_PENDING; 44562306a36Sopenharmony_ci#define SET_MGMT_MSG_CONTEXT(msg_context, value) \ 44662306a36Sopenharmony_ci msg_context = value; 44762306a36Sopenharmony_ci 44862306a36Sopenharmony_citypedef struct _MPT_MGMT { 44962306a36Sopenharmony_ci struct mutex mutex; 45062306a36Sopenharmony_ci struct completion done; 45162306a36Sopenharmony_ci u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ 45262306a36Sopenharmony_ci u8 sense[MPT_SENSE_BUFFER_ALLOC]; 45362306a36Sopenharmony_ci u8 status; /* current command status */ 45462306a36Sopenharmony_ci int completion_code; 45562306a36Sopenharmony_ci u32 msg_context; 45662306a36Sopenharmony_ci} MPT_MGMT; 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci/* 45962306a36Sopenharmony_ci * Event Structure and define 46062306a36Sopenharmony_ci */ 46162306a36Sopenharmony_ci#define MPTCTL_EVENT_LOG_SIZE (0x000000032) 46262306a36Sopenharmony_citypedef struct _mpt_ioctl_events { 46362306a36Sopenharmony_ci u32 event; /* Specified by define above */ 46462306a36Sopenharmony_ci u32 eventContext; /* Index or counter */ 46562306a36Sopenharmony_ci u32 data[2]; /* First 8 bytes of Event Data */ 46662306a36Sopenharmony_ci} MPT_IOCTL_EVENTS; 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* 46962306a36Sopenharmony_ci * CONFIGPARM status defines 47062306a36Sopenharmony_ci */ 47162306a36Sopenharmony_ci#define MPT_CONFIG_GOOD MPI_IOCSTATUS_SUCCESS 47262306a36Sopenharmony_ci#define MPT_CONFIG_ERROR 0x002F 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci/* 47562306a36Sopenharmony_ci * Substructure to store SCSI specific configuration page data 47662306a36Sopenharmony_ci */ 47762306a36Sopenharmony_ci /* dvStatus defines: */ 47862306a36Sopenharmony_ci#define MPT_SCSICFG_USE_NVRAM 0x01 /* WriteSDP1 using NVRAM */ 47962306a36Sopenharmony_ci#define MPT_SCSICFG_ALL_IDS 0x02 /* WriteSDP1 to all IDS */ 48062306a36Sopenharmony_ci/* #define MPT_SCSICFG_BLK_NEGO 0x10 WriteSDP1 with WDTR and SDTR disabled */ 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_citypedef struct _SpiCfgData { 48362306a36Sopenharmony_ci u32 PortFlags; 48462306a36Sopenharmony_ci int *nvram; /* table of device NVRAM values */ 48562306a36Sopenharmony_ci IOCPage4_t *pIocPg4; /* SEP devices addressing */ 48662306a36Sopenharmony_ci dma_addr_t IocPg4_dma; /* Phys Addr of IOCPage4 data */ 48762306a36Sopenharmony_ci int IocPg4Sz; /* IOCPage4 size */ 48862306a36Sopenharmony_ci u8 minSyncFactor; /* 0xFF if async */ 48962306a36Sopenharmony_ci u8 maxSyncOffset; /* 0 if async */ 49062306a36Sopenharmony_ci u8 maxBusWidth; /* 0 if narrow, 1 if wide */ 49162306a36Sopenharmony_ci u8 busType; /* SE, LVD, HD */ 49262306a36Sopenharmony_ci u8 sdp1version; /* SDP1 version */ 49362306a36Sopenharmony_ci u8 sdp1length; /* SDP1 length */ 49462306a36Sopenharmony_ci u8 sdp0version; /* SDP0 version */ 49562306a36Sopenharmony_ci u8 sdp0length; /* SDP0 length */ 49662306a36Sopenharmony_ci u8 dvScheduled; /* 1 if scheduled */ 49762306a36Sopenharmony_ci u8 noQas; /* Disable QAS for this adapter */ 49862306a36Sopenharmony_ci u8 Saf_Te; /* 1 to force all Processors as 49962306a36Sopenharmony_ci * SAF-TE if Inquiry data length 50062306a36Sopenharmony_ci * is too short to check for SAF-TE 50162306a36Sopenharmony_ci */ 50262306a36Sopenharmony_ci u8 bus_reset; /* 1 to allow bus reset */ 50362306a36Sopenharmony_ci u8 rsvd[1]; 50462306a36Sopenharmony_ci}SpiCfgData; 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_citypedef struct _SasCfgData { 50762306a36Sopenharmony_ci u8 ptClear; /* 1 to automatically clear the 50862306a36Sopenharmony_ci * persistent table. 50962306a36Sopenharmony_ci * 0 to disable 51062306a36Sopenharmony_ci * automatic clearing. 51162306a36Sopenharmony_ci */ 51262306a36Sopenharmony_ci}SasCfgData; 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci/* 51562306a36Sopenharmony_ci * Inactive volume link list of raid component data 51662306a36Sopenharmony_ci * @inactive_list 51762306a36Sopenharmony_ci */ 51862306a36Sopenharmony_cistruct inactive_raid_component_info { 51962306a36Sopenharmony_ci struct list_head list; 52062306a36Sopenharmony_ci u8 volumeID; /* volume target id */ 52162306a36Sopenharmony_ci u8 volumeBus; /* volume channel */ 52262306a36Sopenharmony_ci IOC_3_PHYS_DISK d; /* phys disk info */ 52362306a36Sopenharmony_ci}; 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_citypedef struct _RaidCfgData { 52662306a36Sopenharmony_ci IOCPage2_t *pIocPg2; /* table of Raid Volumes */ 52762306a36Sopenharmony_ci IOCPage3_t *pIocPg3; /* table of physical disks */ 52862306a36Sopenharmony_ci struct mutex inactive_list_mutex; 52962306a36Sopenharmony_ci struct list_head inactive_list; /* link list for physical 53062306a36Sopenharmony_ci disk that belong in 53162306a36Sopenharmony_ci inactive volumes */ 53262306a36Sopenharmony_ci}RaidCfgData; 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_citypedef struct _FcCfgData { 53562306a36Sopenharmony_ci /* will ultimately hold fc_port_page0 also */ 53662306a36Sopenharmony_ci struct { 53762306a36Sopenharmony_ci FCPortPage1_t *data; 53862306a36Sopenharmony_ci dma_addr_t dma; 53962306a36Sopenharmony_ci int pg_sz; 54062306a36Sopenharmony_ci } fc_port_page1[2]; 54162306a36Sopenharmony_ci} FcCfgData; 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ 54462306a36Sopenharmony_ci#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_ci/* 54762306a36Sopenharmony_ci * data allocated for each fc rport device 54862306a36Sopenharmony_ci */ 54962306a36Sopenharmony_cistruct mptfc_rport_info 55062306a36Sopenharmony_ci{ 55162306a36Sopenharmony_ci struct list_head list; 55262306a36Sopenharmony_ci struct fc_rport *rport; 55362306a36Sopenharmony_ci struct scsi_target *starget; 55462306a36Sopenharmony_ci FCDevicePage0_t pg0; 55562306a36Sopenharmony_ci u8 flags; 55662306a36Sopenharmony_ci}; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_ci/* 56162306a36Sopenharmony_ci * MPT_SCSI_HOST defines - Used by the IOCTL and the SCSI drivers 56262306a36Sopenharmony_ci * Private to the driver. 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ci#define MPT_HOST_BUS_UNKNOWN (0xFF) 56662306a36Sopenharmony_ci#define MPT_HOST_TOO_MANY_TM (0x05) 56762306a36Sopenharmony_ci#define MPT_HOST_NVRAM_INVALID (0xFFFFFFFF) 56862306a36Sopenharmony_ci#define MPT_HOST_NO_CHAIN (0xFFFFFFFF) 56962306a36Sopenharmony_ci#define MPT_NVRAM_MASK_TIMEOUT (0x000000FF) 57062306a36Sopenharmony_ci#define MPT_NVRAM_SYNC_MASK (0x0000FF00) 57162306a36Sopenharmony_ci#define MPT_NVRAM_SYNC_SHIFT (8) 57262306a36Sopenharmony_ci#define MPT_NVRAM_DISCONNECT_ENABLE (0x00010000) 57362306a36Sopenharmony_ci#define MPT_NVRAM_ID_SCAN_ENABLE (0x00020000) 57462306a36Sopenharmony_ci#define MPT_NVRAM_LUN_SCAN_ENABLE (0x00040000) 57562306a36Sopenharmony_ci#define MPT_NVRAM_TAG_QUEUE_ENABLE (0x00080000) 57662306a36Sopenharmony_ci#define MPT_NVRAM_WIDE_DISABLE (0x00100000) 57762306a36Sopenharmony_ci#define MPT_NVRAM_BOOT_CHOICE (0x00200000) 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_citypedef enum { 58062306a36Sopenharmony_ci FC, 58162306a36Sopenharmony_ci SPI, 58262306a36Sopenharmony_ci SAS 58362306a36Sopenharmony_ci} BUS_TYPE; 58462306a36Sopenharmony_ci 58562306a36Sopenharmony_citypedef struct _MPT_SCSI_HOST { 58662306a36Sopenharmony_ci struct _MPT_ADAPTER *ioc; 58762306a36Sopenharmony_ci ushort sel_timeout[MPT_MAX_FC_DEVICES]; 58862306a36Sopenharmony_ci char *info_kbuf; 58962306a36Sopenharmony_ci long last_queue_full; 59062306a36Sopenharmony_ci u16 spi_pending; 59162306a36Sopenharmony_ci struct list_head target_reset_list; 59262306a36Sopenharmony_ci} MPT_SCSI_HOST; 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_citypedef void (*MPT_ADD_SGE)(void *pAddr, u32 flagslength, dma_addr_t dma_addr); 59562306a36Sopenharmony_citypedef void (*MPT_ADD_CHAIN)(void *pAddr, u8 next, u16 length, 59662306a36Sopenharmony_ci dma_addr_t dma_addr); 59762306a36Sopenharmony_citypedef void (*MPT_SCHEDULE_TARGET_RESET)(void *ioc); 59862306a36Sopenharmony_citypedef void (*MPT_FLUSH_RUNNING_CMDS)(MPT_SCSI_HOST *hd); 59962306a36Sopenharmony_ci 60062306a36Sopenharmony_ci/* 60162306a36Sopenharmony_ci * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS 60262306a36Sopenharmony_ci */ 60362306a36Sopenharmony_citypedef struct _MPT_ADAPTER 60462306a36Sopenharmony_ci{ 60562306a36Sopenharmony_ci int id; /* Unique adapter id N {0,1,2,...} */ 60662306a36Sopenharmony_ci int pci_irq; /* This irq */ 60762306a36Sopenharmony_ci char name[MPT_NAME_LENGTH]; /* "iocN" */ 60862306a36Sopenharmony_ci const char *prod_name; /* "LSIFC9x9" */ 60962306a36Sopenharmony_ci#ifdef CONFIG_FUSION_LOGGING 61062306a36Sopenharmony_ci /* used in mpt_display_event_info */ 61162306a36Sopenharmony_ci char evStr[EVENT_DESCR_STR_SZ]; 61262306a36Sopenharmony_ci#endif 61362306a36Sopenharmony_ci char board_name[16]; 61462306a36Sopenharmony_ci char board_assembly[16]; 61562306a36Sopenharmony_ci char board_tracer[16]; 61662306a36Sopenharmony_ci u16 nvdata_version_persistent; 61762306a36Sopenharmony_ci u16 nvdata_version_default; 61862306a36Sopenharmony_ci int debug_level; 61962306a36Sopenharmony_ci u8 io_missing_delay; 62062306a36Sopenharmony_ci u16 device_missing_delay; 62162306a36Sopenharmony_ci SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ 62262306a36Sopenharmony_ci SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ 62362306a36Sopenharmony_ci u8 bus_type; 62462306a36Sopenharmony_ci u32 mem_phys; /* == f4020000 (mmap) */ 62562306a36Sopenharmony_ci u32 pio_mem_phys; /* Programmed IO (downloadboot) */ 62662306a36Sopenharmony_ci int mem_size; /* mmap memory size */ 62762306a36Sopenharmony_ci int number_of_buses; 62862306a36Sopenharmony_ci int devices_per_bus; 62962306a36Sopenharmony_ci int alloc_total; 63062306a36Sopenharmony_ci u32 last_state; 63162306a36Sopenharmony_ci int active; 63262306a36Sopenharmony_ci u8 *alloc; /* frames alloc ptr */ 63362306a36Sopenharmony_ci dma_addr_t alloc_dma; 63462306a36Sopenharmony_ci u32 alloc_sz; 63562306a36Sopenharmony_ci MPT_FRAME_HDR *reply_frames; /* Reply msg frames - rounded up! */ 63662306a36Sopenharmony_ci u32 reply_frames_low_dma; 63762306a36Sopenharmony_ci int reply_depth; /* Num Allocated reply frames */ 63862306a36Sopenharmony_ci int reply_sz; /* Reply frame size */ 63962306a36Sopenharmony_ci int num_chain; /* Number of chain buffers */ 64062306a36Sopenharmony_ci MPT_ADD_SGE add_sge; /* Pointer to add_sge 64162306a36Sopenharmony_ci function */ 64262306a36Sopenharmony_ci MPT_ADD_CHAIN add_chain; /* Pointer to add_chain 64362306a36Sopenharmony_ci function */ 64462306a36Sopenharmony_ci /* Pool of buffers for chaining. ReqToChain 64562306a36Sopenharmony_ci * and ChainToChain track index of chain buffers. 64662306a36Sopenharmony_ci * ChainBuffer (DMA) virt/phys addresses. 64762306a36Sopenharmony_ci * FreeChainQ (lock) locking mechanisms. 64862306a36Sopenharmony_ci */ 64962306a36Sopenharmony_ci int *ReqToChain; 65062306a36Sopenharmony_ci int *RequestNB; 65162306a36Sopenharmony_ci int *ChainToChain; 65262306a36Sopenharmony_ci u8 *ChainBuffer; 65362306a36Sopenharmony_ci dma_addr_t ChainBufferDMA; 65462306a36Sopenharmony_ci struct list_head FreeChainQ; 65562306a36Sopenharmony_ci spinlock_t FreeChainQlock; 65662306a36Sopenharmony_ci /* We (host driver) get to manage our own RequestQueue! */ 65762306a36Sopenharmony_ci dma_addr_t req_frames_dma; 65862306a36Sopenharmony_ci MPT_FRAME_HDR *req_frames; /* Request msg frames - rounded up! */ 65962306a36Sopenharmony_ci u32 req_frames_low_dma; 66062306a36Sopenharmony_ci int req_depth; /* Number of request frames */ 66162306a36Sopenharmony_ci int req_sz; /* Request frame size (bytes) */ 66262306a36Sopenharmony_ci spinlock_t FreeQlock; 66362306a36Sopenharmony_ci struct list_head FreeQ; 66462306a36Sopenharmony_ci /* Pool of SCSI sense buffers for commands coming from 66562306a36Sopenharmony_ci * the SCSI mid-layer. We have one 256 byte sense buffer 66662306a36Sopenharmony_ci * for each REQ entry. 66762306a36Sopenharmony_ci */ 66862306a36Sopenharmony_ci u8 *sense_buf_pool; 66962306a36Sopenharmony_ci dma_addr_t sense_buf_pool_dma; 67062306a36Sopenharmony_ci u32 sense_buf_low_dma; 67162306a36Sopenharmony_ci u8 *HostPageBuffer; /* SAS - host page buffer support */ 67262306a36Sopenharmony_ci u32 HostPageBuffer_sz; 67362306a36Sopenharmony_ci dma_addr_t HostPageBuffer_dma; 67462306a36Sopenharmony_ci struct pci_dev *pcidev; /* struct pci_dev pointer */ 67562306a36Sopenharmony_ci int bars; /* bitmask of BAR's that must be configured */ 67662306a36Sopenharmony_ci int msi_enable; 67762306a36Sopenharmony_ci u8 __iomem *memmap; /* mmap address */ 67862306a36Sopenharmony_ci struct Scsi_Host *sh; /* Scsi Host pointer */ 67962306a36Sopenharmony_ci SpiCfgData spi_data; /* Scsi config. data */ 68062306a36Sopenharmony_ci RaidCfgData raid_data; /* Raid config. data */ 68162306a36Sopenharmony_ci SasCfgData sas_data; /* Sas config. data */ 68262306a36Sopenharmony_ci FcCfgData fc_data; /* Fc config. data */ 68362306a36Sopenharmony_ci struct proc_dir_entry *ioc_dentry; 68462306a36Sopenharmony_ci struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */ 68562306a36Sopenharmony_ci u32 biosVersion; /* BIOS version from IO Unit Page 2 */ 68662306a36Sopenharmony_ci int eventTypes; /* Event logging parameters */ 68762306a36Sopenharmony_ci int eventContext; /* Next event context */ 68862306a36Sopenharmony_ci int eventLogSize; /* Max number of cached events */ 68962306a36Sopenharmony_ci struct _mpt_ioctl_events *events; /* pointer to event log */ 69062306a36Sopenharmony_ci u8 *cached_fw; /* Pointer to FW */ 69162306a36Sopenharmony_ci dma_addr_t cached_fw_dma; 69262306a36Sopenharmony_ci int hs_reply_idx; 69362306a36Sopenharmony_ci#ifndef MFCNT 69462306a36Sopenharmony_ci u32 pad0; 69562306a36Sopenharmony_ci#else 69662306a36Sopenharmony_ci u32 mfcnt; 69762306a36Sopenharmony_ci#endif 69862306a36Sopenharmony_ci u32 NB_for_64_byte_frame; 69962306a36Sopenharmony_ci u32 hs_req[MPT_MAX_FRAME_SIZE/sizeof(u32)]; 70062306a36Sopenharmony_ci u16 hs_reply[MPT_MAX_FRAME_SIZE/sizeof(u16)]; 70162306a36Sopenharmony_ci IOCFactsReply_t facts; 70262306a36Sopenharmony_ci PortFactsReply_t pfacts[2]; 70362306a36Sopenharmony_ci FCPortPage0_t fc_port_page0[2]; 70462306a36Sopenharmony_ci LANPage0_t lan_cnfg_page0; 70562306a36Sopenharmony_ci LANPage1_t lan_cnfg_page1; 70662306a36Sopenharmony_ci 70762306a36Sopenharmony_ci u8 ir_firmware; /* =1 if IR firmware detected */ 70862306a36Sopenharmony_ci /* 70962306a36Sopenharmony_ci * Description: errata_flag_1064 71062306a36Sopenharmony_ci * If a PCIX read occurs within 1 or 2 cycles after the chip receives 71162306a36Sopenharmony_ci * a split completion for a read data, an internal address pointer incorrectly 71262306a36Sopenharmony_ci * increments by 32 bytes 71362306a36Sopenharmony_ci */ 71462306a36Sopenharmony_ci int errata_flag_1064; 71562306a36Sopenharmony_ci int aen_event_read_flag; /* flag to indicate event log was read*/ 71662306a36Sopenharmony_ci u8 FirstWhoInit; 71762306a36Sopenharmony_ci u8 upload_fw; /* If set, do a fw upload */ 71862306a36Sopenharmony_ci u8 NBShiftFactor; /* NB Shift Factor based on Block Size (Facts) */ 71962306a36Sopenharmony_ci u8 pad1[4]; 72062306a36Sopenharmony_ci u8 DoneCtx; 72162306a36Sopenharmony_ci u8 TaskCtx; 72262306a36Sopenharmony_ci u8 InternalCtx; 72362306a36Sopenharmony_ci struct list_head list; 72462306a36Sopenharmony_ci struct net_device *netdev; 72562306a36Sopenharmony_ci struct list_head sas_topology; 72662306a36Sopenharmony_ci struct mutex sas_topology_mutex; 72762306a36Sopenharmony_ci 72862306a36Sopenharmony_ci struct workqueue_struct *fw_event_q; 72962306a36Sopenharmony_ci struct list_head fw_event_list; 73062306a36Sopenharmony_ci spinlock_t fw_event_lock; 73162306a36Sopenharmony_ci u8 fw_events_off; /* if '1', then ignore events */ 73262306a36Sopenharmony_ci char fw_event_q_name[MPT_KOBJ_NAME_LEN]; 73362306a36Sopenharmony_ci 73462306a36Sopenharmony_ci struct mutex sas_discovery_mutex; 73562306a36Sopenharmony_ci u8 sas_discovery_runtime; 73662306a36Sopenharmony_ci u8 sas_discovery_ignore_events; 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci /* port_info object for the host */ 73962306a36Sopenharmony_ci struct mptsas_portinfo *hba_port_info; 74062306a36Sopenharmony_ci u64 hba_port_sas_addr; 74162306a36Sopenharmony_ci u16 hba_port_num_phy; 74262306a36Sopenharmony_ci struct list_head sas_device_info_list; 74362306a36Sopenharmony_ci struct mutex sas_device_info_mutex; 74462306a36Sopenharmony_ci u8 old_sas_discovery_protocal; 74562306a36Sopenharmony_ci u8 sas_discovery_quiesce_io; 74662306a36Sopenharmony_ci int sas_index; /* index refrencing */ 74762306a36Sopenharmony_ci MPT_MGMT sas_mgmt; 74862306a36Sopenharmony_ci MPT_MGMT mptbase_cmds; /* for sending config pages */ 74962306a36Sopenharmony_ci MPT_MGMT internal_cmds; 75062306a36Sopenharmony_ci MPT_MGMT taskmgmt_cmds; 75162306a36Sopenharmony_ci MPT_MGMT ioctl_cmds; 75262306a36Sopenharmony_ci spinlock_t taskmgmt_lock; /* diagnostic reset lock */ 75362306a36Sopenharmony_ci int taskmgmt_in_progress; 75462306a36Sopenharmony_ci u8 taskmgmt_quiesce_io; 75562306a36Sopenharmony_ci u8 ioc_reset_in_progress; 75662306a36Sopenharmony_ci u8 reset_status; 75762306a36Sopenharmony_ci u8 wait_on_reset_completion; 75862306a36Sopenharmony_ci MPT_SCHEDULE_TARGET_RESET schedule_target_reset; 75962306a36Sopenharmony_ci MPT_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; 76062306a36Sopenharmony_ci 76162306a36Sopenharmony_ci struct work_struct fc_setup_reset_work; 76262306a36Sopenharmony_ci struct list_head fc_rports; 76362306a36Sopenharmony_ci struct work_struct fc_lsc_work; 76462306a36Sopenharmony_ci u8 fc_link_speed[2]; 76562306a36Sopenharmony_ci spinlock_t fc_rescan_work_lock; 76662306a36Sopenharmony_ci struct work_struct fc_rescan_work; 76762306a36Sopenharmony_ci char fc_rescan_work_q_name[MPT_KOBJ_NAME_LEN]; 76862306a36Sopenharmony_ci struct workqueue_struct *fc_rescan_work_q; 76962306a36Sopenharmony_ci 77062306a36Sopenharmony_ci /* driver forced bus resets count */ 77162306a36Sopenharmony_ci unsigned long hard_resets; 77262306a36Sopenharmony_ci /* fw/external bus resets count */ 77362306a36Sopenharmony_ci unsigned long soft_resets; 77462306a36Sopenharmony_ci /* cmd timeouts */ 77562306a36Sopenharmony_ci unsigned long timeouts; 77662306a36Sopenharmony_ci 77762306a36Sopenharmony_ci struct scsi_cmnd **ScsiLookup; 77862306a36Sopenharmony_ci spinlock_t scsi_lookup_lock; 77962306a36Sopenharmony_ci u64 dma_mask; 78062306a36Sopenharmony_ci u32 broadcast_aen_busy; 78162306a36Sopenharmony_ci char reset_work_q_name[MPT_KOBJ_NAME_LEN]; 78262306a36Sopenharmony_ci struct workqueue_struct *reset_work_q; 78362306a36Sopenharmony_ci struct delayed_work fault_reset_work; 78462306a36Sopenharmony_ci 78562306a36Sopenharmony_ci u8 sg_addr_size; 78662306a36Sopenharmony_ci u8 in_rescan; 78762306a36Sopenharmony_ci u8 SGE_size; 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_ci} MPT_ADAPTER; 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci/* 79262306a36Sopenharmony_ci * New return value convention: 79362306a36Sopenharmony_ci * 1 = Ok to free associated request frame 79462306a36Sopenharmony_ci * 0 = not Ok ... 79562306a36Sopenharmony_ci */ 79662306a36Sopenharmony_citypedef int (*MPT_CALLBACK)(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply); 79762306a36Sopenharmony_citypedef int (*MPT_EVHANDLER)(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply); 79862306a36Sopenharmony_citypedef int (*MPT_RESETHANDLER)(MPT_ADAPTER *ioc, int reset_phase); 79962306a36Sopenharmony_ci/* reset_phase defs */ 80062306a36Sopenharmony_ci#define MPT_IOC_PRE_RESET 0 80162306a36Sopenharmony_ci#define MPT_IOC_POST_RESET 1 80262306a36Sopenharmony_ci#define MPT_IOC_SETUP_RESET 2 80362306a36Sopenharmony_ci 80462306a36Sopenharmony_ci/* 80562306a36Sopenharmony_ci * Invent MPT host event (super-set of MPI Events) 80662306a36Sopenharmony_ci * Fitted to 1030's 64-byte [max] request frame size 80762306a36Sopenharmony_ci */ 80862306a36Sopenharmony_citypedef struct _MPT_HOST_EVENT { 80962306a36Sopenharmony_ci EventNotificationReply_t MpiEvent; /* 8 32-bit words! */ 81062306a36Sopenharmony_ci u32 pad[6]; 81162306a36Sopenharmony_ci void *next; 81262306a36Sopenharmony_ci} MPT_HOST_EVENT; 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ci#define MPT_HOSTEVENT_IOC_BRINGUP 0x91 81562306a36Sopenharmony_ci#define MPT_HOSTEVENT_IOC_RECOVER 0x92 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_ci/* Define the generic types based on the size 81862306a36Sopenharmony_ci * of the dma_addr_t type. 81962306a36Sopenharmony_ci */ 82062306a36Sopenharmony_citypedef struct _mpt_sge { 82162306a36Sopenharmony_ci u32 FlagsLength; 82262306a36Sopenharmony_ci dma_addr_t Address; 82362306a36Sopenharmony_ci} MptSge_t; 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci 82662306a36Sopenharmony_ci#define mpt_msg_flags(ioc) \ 82762306a36Sopenharmony_ci (ioc->sg_addr_size == sizeof(u64)) ? \ 82862306a36Sopenharmony_ci MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 : \ 82962306a36Sopenharmony_ci MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32 83062306a36Sopenharmony_ci 83162306a36Sopenharmony_ci#define MPT_SGE_FLAGS_64_BIT_ADDRESSING \ 83262306a36Sopenharmony_ci (MPI_SGE_FLAGS_64_BIT_ADDRESSING << MPI_SGE_FLAGS_SHIFT) 83362306a36Sopenharmony_ci 83462306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 83562306a36Sopenharmony_ci/* 83662306a36Sopenharmony_ci * Funky (private) macros... 83762306a36Sopenharmony_ci */ 83862306a36Sopenharmony_ci#include "mptdebug.h" 83962306a36Sopenharmony_ci 84062306a36Sopenharmony_ci#define MPT_INDEX_2_MFPTR(ioc,idx) \ 84162306a36Sopenharmony_ci (MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) ) 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_ci#define MFPTR_2_MPT_INDEX(ioc,mf) \ 84462306a36Sopenharmony_ci (int)( ((u8*)mf - (u8*)(ioc)->req_frames) / (ioc)->req_sz ) 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci#define MPT_INDEX_2_RFPTR(ioc,idx) \ 84762306a36Sopenharmony_ci (MPT_FRAME_HDR*)( (u8*)(ioc)->reply_frames + (ioc)->req_sz * (idx) ) 84862306a36Sopenharmony_ci 84962306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 85062306a36Sopenharmony_ci 85162306a36Sopenharmony_ci#define SCSI_STD_SENSE_BYTES 18 85262306a36Sopenharmony_ci#define SCSI_STD_INQUIRY_BYTES 36 85362306a36Sopenharmony_ci#define SCSI_MAX_INQUIRY_BYTES 96 85462306a36Sopenharmony_ci 85562306a36Sopenharmony_ci/* 85662306a36Sopenharmony_ci * MPT_SCSI_HOST defines - Used by the IOCTL and the SCSI drivers 85762306a36Sopenharmony_ci * Private to the driver. 85862306a36Sopenharmony_ci */ 85962306a36Sopenharmony_ci/* LOCAL structure and fields used when processing 86062306a36Sopenharmony_ci * internally generated commands. These include: 86162306a36Sopenharmony_ci * bus scan, dv and config requests. 86262306a36Sopenharmony_ci */ 86362306a36Sopenharmony_citypedef struct _MPT_LOCAL_REPLY { 86462306a36Sopenharmony_ci ConfigPageHeader_t header; 86562306a36Sopenharmony_ci int completion; 86662306a36Sopenharmony_ci u8 sense[SCSI_STD_SENSE_BYTES]; 86762306a36Sopenharmony_ci u8 scsiStatus; 86862306a36Sopenharmony_ci u8 skip; 86962306a36Sopenharmony_ci u32 pad; 87062306a36Sopenharmony_ci} MPT_LOCAL_REPLY; 87162306a36Sopenharmony_ci 87262306a36Sopenharmony_ci 87362306a36Sopenharmony_ci/* The TM_STATE variable is used to provide strict single threading of TM 87462306a36Sopenharmony_ci * requests as well as communicate TM error conditions. 87562306a36Sopenharmony_ci */ 87662306a36Sopenharmony_ci#define TM_STATE_NONE (0) 87762306a36Sopenharmony_ci#define TM_STATE_IN_PROGRESS (1) 87862306a36Sopenharmony_ci#define TM_STATE_ERROR (2) 87962306a36Sopenharmony_ci 88062306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 88162306a36Sopenharmony_ci/* 88262306a36Sopenharmony_ci * More Dynamic Multi-Pathing stuff... 88362306a36Sopenharmony_ci */ 88462306a36Sopenharmony_ci 88562306a36Sopenharmony_ci/* Forward decl, a strange C thing, to prevent gcc compiler warnings */ 88662306a36Sopenharmony_cistruct scsi_cmnd; 88762306a36Sopenharmony_ci 88862306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 88962306a36Sopenharmony_ci/* 89062306a36Sopenharmony_ci * Generic structure passed to the base mpt_config function. 89162306a36Sopenharmony_ci */ 89262306a36Sopenharmony_citypedef struct _x_config_parms { 89362306a36Sopenharmony_ci union { 89462306a36Sopenharmony_ci ConfigExtendedPageHeader_t *ehdr; 89562306a36Sopenharmony_ci ConfigPageHeader_t *hdr; 89662306a36Sopenharmony_ci } cfghdr; 89762306a36Sopenharmony_ci dma_addr_t physAddr; 89862306a36Sopenharmony_ci u32 pageAddr; /* properly formatted */ 89962306a36Sopenharmony_ci u16 status; 90062306a36Sopenharmony_ci u8 action; 90162306a36Sopenharmony_ci u8 dir; 90262306a36Sopenharmony_ci u8 timeout; /* seconds */ 90362306a36Sopenharmony_ci} CONFIGPARMS; 90462306a36Sopenharmony_ci 90562306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 90662306a36Sopenharmony_ci/* 90762306a36Sopenharmony_ci * Public entry points... 90862306a36Sopenharmony_ci */ 90962306a36Sopenharmony_ciextern int mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id); 91062306a36Sopenharmony_ciextern void mpt_detach(struct pci_dev *pdev); 91162306a36Sopenharmony_ci#ifdef CONFIG_PM 91262306a36Sopenharmony_ciextern int mpt_suspend(struct pci_dev *pdev, pm_message_t state); 91362306a36Sopenharmony_ciextern int mpt_resume(struct pci_dev *pdev); 91462306a36Sopenharmony_ci#endif 91562306a36Sopenharmony_ciextern u8 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass, 91662306a36Sopenharmony_ci char *func_name); 91762306a36Sopenharmony_ciextern void mpt_deregister(u8 cb_idx); 91862306a36Sopenharmony_ciextern int mpt_event_register(u8 cb_idx, MPT_EVHANDLER ev_cbfunc); 91962306a36Sopenharmony_ciextern void mpt_event_deregister(u8 cb_idx); 92062306a36Sopenharmony_ciextern int mpt_reset_register(u8 cb_idx, MPT_RESETHANDLER reset_func); 92162306a36Sopenharmony_ciextern void mpt_reset_deregister(u8 cb_idx); 92262306a36Sopenharmony_ciextern int mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx); 92362306a36Sopenharmony_ciextern void mpt_device_driver_deregister(u8 cb_idx); 92462306a36Sopenharmony_ciextern MPT_FRAME_HDR *mpt_get_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc); 92562306a36Sopenharmony_ciextern void mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); 92662306a36Sopenharmony_ciextern void mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); 92762306a36Sopenharmony_ciextern void mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf); 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ciextern int mpt_send_handshake_request(u8 cb_idx, MPT_ADAPTER *ioc, int reqBytes, u32 *req, int sleepFlag); 93062306a36Sopenharmony_ciextern int mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp); 93162306a36Sopenharmony_ciextern u32 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked); 93262306a36Sopenharmony_ciextern void mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buf, int *size, int len, int showlan); 93362306a36Sopenharmony_ciextern int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 93462306a36Sopenharmony_ciextern int mpt_Soft_Hard_ResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 93562306a36Sopenharmony_ciextern int mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *cfg); 93662306a36Sopenharmony_ciextern int mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size); 93762306a36Sopenharmony_ciextern void mpt_free_fw_memory(MPT_ADAPTER *ioc); 93862306a36Sopenharmony_ciextern int mpt_findImVolumes(MPT_ADAPTER *ioc); 93962306a36Sopenharmony_ciextern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); 94062306a36Sopenharmony_ciextern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk); 94162306a36Sopenharmony_ciextern int mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, 94262306a36Sopenharmony_ci pRaidPhysDiskPage1_t phys_disk); 94362306a36Sopenharmony_ciextern int mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, 94462306a36Sopenharmony_ci u8 phys_disk_num); 94562306a36Sopenharmony_ciextern int mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc); 94662306a36Sopenharmony_ciextern void mpt_clear_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc); 94762306a36Sopenharmony_ciextern void __noreturn mpt_halt_firmware(MPT_ADAPTER *ioc); 94862306a36Sopenharmony_ci 94962306a36Sopenharmony_ci 95062306a36Sopenharmony_ci/* 95162306a36Sopenharmony_ci * Public data decl's... 95262306a36Sopenharmony_ci */ 95362306a36Sopenharmony_ciextern struct list_head ioc_list; 95462306a36Sopenharmony_ciextern int mpt_fwfault_debug; 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 95762306a36Sopenharmony_ci#endif /* } __KERNEL__ */ 95862306a36Sopenharmony_ci 95962306a36Sopenharmony_ci#ifdef CONFIG_64BIT 96062306a36Sopenharmony_ci#define CAST_U32_TO_PTR(x) ((void *)(u64)x) 96162306a36Sopenharmony_ci#define CAST_PTR_TO_U32(x) ((u32)(u64)x) 96262306a36Sopenharmony_ci#else 96362306a36Sopenharmony_ci#define CAST_U32_TO_PTR(x) ((void *)x) 96462306a36Sopenharmony_ci#define CAST_PTR_TO_U32(x) ((u32)x) 96562306a36Sopenharmony_ci#endif 96662306a36Sopenharmony_ci 96762306a36Sopenharmony_ci#define MPT_PROTOCOL_FLAGS_c_c_c_c(pflags) \ 96862306a36Sopenharmony_ci ((pflags) & MPI_PORTFACTS_PROTOCOL_INITIATOR) ? 'I' : 'i', \ 96962306a36Sopenharmony_ci ((pflags) & MPI_PORTFACTS_PROTOCOL_TARGET) ? 'T' : 't', \ 97062306a36Sopenharmony_ci ((pflags) & MPI_PORTFACTS_PROTOCOL_LAN) ? 'L' : 'l', \ 97162306a36Sopenharmony_ci ((pflags) & MPI_PORTFACTS_PROTOCOL_LOGBUSADDR) ? 'B' : 'b' 97262306a36Sopenharmony_ci 97362306a36Sopenharmony_ci/* 97462306a36Sopenharmony_ci * Shifted SGE Defines - Use in SGE with FlagsLength member. 97562306a36Sopenharmony_ci * Otherwise, use MPI_xxx defines (refer to "lsi/mpi.h" header). 97662306a36Sopenharmony_ci * Defaults: 32 bit SGE, SYSTEM_ADDRESS if direction bit is 0, read 97762306a36Sopenharmony_ci */ 97862306a36Sopenharmony_ci#define MPT_TRANSFER_IOC_TO_HOST (0x00000000) 97962306a36Sopenharmony_ci#define MPT_TRANSFER_HOST_TO_IOC (0x04000000) 98062306a36Sopenharmony_ci#define MPT_SGE_FLAGS_LAST_ELEMENT (0x80000000) 98162306a36Sopenharmony_ci#define MPT_SGE_FLAGS_END_OF_BUFFER (0x40000000) 98262306a36Sopenharmony_ci#define MPT_SGE_FLAGS_LOCAL_ADDRESS (0x08000000) 98362306a36Sopenharmony_ci#define MPT_SGE_FLAGS_DIRECTION (0x04000000) 98462306a36Sopenharmony_ci#define MPT_SGE_FLAGS_END_OF_LIST (0x01000000) 98562306a36Sopenharmony_ci 98662306a36Sopenharmony_ci#define MPT_SGE_FLAGS_TRANSACTION_ELEMENT (0x00000000) 98762306a36Sopenharmony_ci#define MPT_SGE_FLAGS_SIMPLE_ELEMENT (0x10000000) 98862306a36Sopenharmony_ci#define MPT_SGE_FLAGS_CHAIN_ELEMENT (0x30000000) 98962306a36Sopenharmony_ci#define MPT_SGE_FLAGS_ELEMENT_MASK (0x30000000) 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci#define MPT_SGE_FLAGS_SSIMPLE_READ \ 99262306a36Sopenharmony_ci (MPT_SGE_FLAGS_LAST_ELEMENT | \ 99362306a36Sopenharmony_ci MPT_SGE_FLAGS_END_OF_BUFFER | \ 99462306a36Sopenharmony_ci MPT_SGE_FLAGS_END_OF_LIST | \ 99562306a36Sopenharmony_ci MPT_SGE_FLAGS_SIMPLE_ELEMENT | \ 99662306a36Sopenharmony_ci MPT_TRANSFER_IOC_TO_HOST) 99762306a36Sopenharmony_ci#define MPT_SGE_FLAGS_SSIMPLE_WRITE \ 99862306a36Sopenharmony_ci (MPT_SGE_FLAGS_LAST_ELEMENT | \ 99962306a36Sopenharmony_ci MPT_SGE_FLAGS_END_OF_BUFFER | \ 100062306a36Sopenharmony_ci MPT_SGE_FLAGS_END_OF_LIST | \ 100162306a36Sopenharmony_ci MPT_SGE_FLAGS_SIMPLE_ELEMENT | \ 100262306a36Sopenharmony_ci MPT_TRANSFER_HOST_TO_IOC) 100362306a36Sopenharmony_ci 100462306a36Sopenharmony_ci/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 100562306a36Sopenharmony_ci#endif 100662306a36Sopenharmony_ci 1007