mpt2sas_base.h revision fb396bec76187aae1a0eaf5b7f21327b8cb34fec
1635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
2635374e7eb110e80d9918b8611198edd56a32975Eric Moore * This is the Fusion MPT base driver providing common API layer interface
3635374e7eb110e80d9918b8611198edd56a32975Eric Moore * for access to MPT (Message Passing Technology) firmware.
4635374e7eb110e80d9918b8611198edd56a32975Eric Moore *
5635374e7eb110e80d9918b8611198edd56a32975Eric Moore * This code is based on drivers/scsi/mpt2sas/mpt2_base.h
631b7f2e25d4b30d9b8701a6820c8e521cf409c29Kashyap, Desai * Copyright (C) 2007-2010  LSI Corporation
7635374e7eb110e80d9918b8611198edd56a32975Eric Moore *  (mailto:DL-MPTFusionLinux@lsi.com)
8635374e7eb110e80d9918b8611198edd56a32975Eric Moore *
9635374e7eb110e80d9918b8611198edd56a32975Eric Moore * This program is free software; you can redistribute it and/or
10635374e7eb110e80d9918b8611198edd56a32975Eric Moore * modify it under the terms of the GNU General Public License
11635374e7eb110e80d9918b8611198edd56a32975Eric Moore * as published by the Free Software Foundation; either version 2
12635374e7eb110e80d9918b8611198edd56a32975Eric Moore * of the License, or (at your option) any later version.
13635374e7eb110e80d9918b8611198edd56a32975Eric Moore *
14635374e7eb110e80d9918b8611198edd56a32975Eric Moore * This program is distributed in the hope that it will be useful,
15635374e7eb110e80d9918b8611198edd56a32975Eric Moore * but WITHOUT ANY WARRANTY; without even the implied warranty of
16635374e7eb110e80d9918b8611198edd56a32975Eric Moore * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17635374e7eb110e80d9918b8611198edd56a32975Eric Moore * GNU General Public License for more details.
18635374e7eb110e80d9918b8611198edd56a32975Eric Moore *
19635374e7eb110e80d9918b8611198edd56a32975Eric Moore * NO WARRANTY
20635374e7eb110e80d9918b8611198edd56a32975Eric Moore * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
21635374e7eb110e80d9918b8611198edd56a32975Eric Moore * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
22635374e7eb110e80d9918b8611198edd56a32975Eric Moore * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
23635374e7eb110e80d9918b8611198edd56a32975Eric Moore * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
24635374e7eb110e80d9918b8611198edd56a32975Eric Moore * solely responsible for determining the appropriateness of using and
25635374e7eb110e80d9918b8611198edd56a32975Eric Moore * distributing the Program and assumes all risks associated with its
26635374e7eb110e80d9918b8611198edd56a32975Eric Moore * exercise of rights under this Agreement, including but not limited to
27635374e7eb110e80d9918b8611198edd56a32975Eric Moore * the risks and costs of program errors, damage to or loss of data,
28635374e7eb110e80d9918b8611198edd56a32975Eric Moore * programs or equipment, and unavailability or interruption of operations.
29635374e7eb110e80d9918b8611198edd56a32975Eric Moore
30635374e7eb110e80d9918b8611198edd56a32975Eric Moore * DISCLAIMER OF LIABILITY
31635374e7eb110e80d9918b8611198edd56a32975Eric Moore * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
32635374e7eb110e80d9918b8611198edd56a32975Eric Moore * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33635374e7eb110e80d9918b8611198edd56a32975Eric Moore * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
34635374e7eb110e80d9918b8611198edd56a32975Eric Moore * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
35635374e7eb110e80d9918b8611198edd56a32975Eric Moore * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36635374e7eb110e80d9918b8611198edd56a32975Eric Moore * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37635374e7eb110e80d9918b8611198edd56a32975Eric Moore * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
38635374e7eb110e80d9918b8611198edd56a32975Eric Moore
39635374e7eb110e80d9918b8611198edd56a32975Eric Moore * You should have received a copy of the GNU General Public License
40635374e7eb110e80d9918b8611198edd56a32975Eric Moore * along with this program; if not, write to the Free Software
41635374e7eb110e80d9918b8611198edd56a32975Eric Moore * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
42635374e7eb110e80d9918b8611198edd56a32975Eric Moore * USA.
43635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
44635374e7eb110e80d9918b8611198edd56a32975Eric Moore
45635374e7eb110e80d9918b8611198edd56a32975Eric Moore#ifndef MPT2SAS_BASE_H_INCLUDED
46635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_BASE_H_INCLUDED
47635374e7eb110e80d9918b8611198edd56a32975Eric Moore
48635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_type.h"
49635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2.h"
50635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_ioc.h"
51635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_cnfg.h"
52635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_init.h"
53635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_raid.h"
54635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_tool.h"
55635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpi/mpi2_sas.h"
56635374e7eb110e80d9918b8611198edd56a32975Eric Moore
57635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi.h>
58635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_cmnd.h>
59635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_device.h>
60635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_host.h>
61635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_tcq.h>
62635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_transport_sas.h>
63635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include <scsi/scsi_dbg.h>
643c621b3ee1432e7a2aca4a3b670b1d05f19ecf9cEric Moore#include <scsi/scsi_eh.h>
65635374e7eb110e80d9918b8611198edd56a32975Eric Moore
66635374e7eb110e80d9918b8611198edd56a32975Eric Moore#include "mpt2sas_debug.h"
67635374e7eb110e80d9918b8611198edd56a32975Eric Moore
68635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* driver versioning info */
69635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_DRIVER_NAME		"mpt2sas"
70635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_AUTHOR	"LSI Corporation <DL-MPTFusionLinux@lsi.com>"
71635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_DESCRIPTION	"LSI MPT Fusion SAS 2.0 Device Driver"
72f0cebfb0177f26e214adca3511f37c089d1317f8Kashyap, Desai#define MPT2SAS_DRIVER_VERSION		"07.100.00.00"
73f0cebfb0177f26e214adca3511f37c089d1317f8Kashyap, Desai#define MPT2SAS_MAJOR_VERSION		07
74635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_MINOR_VERSION		100
751a7d7eac6f651c00e954023dd2542f0c65ef66b7Kashyap, Desai#define MPT2SAS_BUILD_VERSION		00
76d4572c3dbb00fa47b9e8cd496f12a8ec9e9b66c3Kashyap, Desai#define MPT2SAS_RELEASE_VERSION		00
77635374e7eb110e80d9918b8611198edd56a32975Eric Moore
78635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
79635374e7eb110e80d9918b8611198edd56a32975Eric Moore * Set MPT2SAS_SG_DEPTH value based on user input.
80635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
81635374e7eb110e80d9918b8611198edd56a32975Eric Moore#ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
82635374e7eb110e80d9918b8611198edd56a32975Eric Moore#if     CONFIG_SCSI_MPT2SAS_MAX_SGE  < 16
83635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SG_DEPTH       16
84635374e7eb110e80d9918b8611198edd56a32975Eric Moore#elif CONFIG_SCSI_MPT2SAS_MAX_SGE  > 128
85635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SG_DEPTH       128
86635374e7eb110e80d9918b8611198edd56a32975Eric Moore#else
87635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SG_DEPTH       CONFIG_SCSI_MPT2SAS_MAX_SGE
88635374e7eb110e80d9918b8611198edd56a32975Eric Moore#endif
89635374e7eb110e80d9918b8611198edd56a32975Eric Moore#else
90635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SG_DEPTH       128 /* MAX_HW_SEGMENTS */
91635374e7eb110e80d9918b8611198edd56a32975Eric Moore#endif
92635374e7eb110e80d9918b8611198edd56a32975Eric Moore
93635374e7eb110e80d9918b8611198edd56a32975Eric Moore
94635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
95635374e7eb110e80d9918b8611198edd56a32975Eric Moore * Generic Defines
96635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
97635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SATA_QUEUE_DEPTH	32
98635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_SAS_QUEUE_DEPTH		254
99635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_RAID_QUEUE_DEPTH	128
100635374e7eb110e80d9918b8611198edd56a32975Eric Moore
101635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_NAME_LENGTH			32	/* generic length of strings */
102635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_STRING_LENGTH		64
103635374e7eb110e80d9918b8611198edd56a32975Eric Moore
104635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define	MPT_MAX_CALLBACKS		16
105635374e7eb110e80d9918b8611198edd56a32975Eric Moore
106635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define	 CAN_SLEEP			1
107635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define  NO_SLEEP			0
108635374e7eb110e80d9918b8611198edd56a32975Eric Moore
109635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define INTERNAL_CMDS_COUNT		10	/* reserved cmds */
110635374e7eb110e80d9918b8611198edd56a32975Eric Moore
111635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPI2_HIM_MASK			0xFFFFFFFF /* mask every bit*/
112635374e7eb110e80d9918b8611198edd56a32975Eric Moore
113635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_INVALID_DEVICE_HANDLE	0xFFFF
114635374e7eb110e80d9918b8611198edd56a32975Eric Moore
115635374e7eb110e80d9918b8611198edd56a32975Eric Moore
116635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
117635374e7eb110e80d9918b8611198edd56a32975Eric Moore * reset phases
118635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
119635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_IOC_PRE_RESET		1 /* prior to host reset */
120635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_IOC_AFTER_RESET		2 /* just after host reset */
121635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_IOC_DONE_RESET		3 /* links re-initialized */
122635374e7eb110e80d9918b8611198edd56a32975Eric Moore
123635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
124635374e7eb110e80d9918b8611198edd56a32975Eric Moore * logging format
125635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
126635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_FMT			"%s: "
127635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_INFO_FMT		KERN_INFO MPT2SAS_FMT
128635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_NOTE_FMT		KERN_NOTICE MPT2SAS_FMT
129635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_WARN_FMT		KERN_WARNING MPT2SAS_FMT
130635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_ERR_FMT			KERN_ERR MPT2SAS_FMT
131635374e7eb110e80d9918b8611198edd56a32975Eric Moore
132635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
133f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore * Dell HBA branding
134f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore */
135f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_BRANDING_SIZE                 32
136f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
137f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING        "Dell 6Gbps SAS HBA"
138f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING    "Dell PERC H200 Adapter"
139f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
140f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING    "Dell PERC H200 Modular"
141f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING   "Dell PERC H200 Embedded"
142f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_BRANDING            "Dell PERC H200"
143f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_BRANDING            "Dell 6Gbps SAS"
144f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
145f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore/*
146f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore * Dell HBA SSDIDs
147f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore */
148f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID           0x1F1C
149f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID       0x1F1D
150f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID    0x1F1E
151f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID       0x1F1F
152f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID      0x1F20
153f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_SSDID               0x1F21
154f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_SSDID               0x1F22
155f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
156f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore/*
157fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai * Intel HBA branding
158fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai */
159fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai#define MPT2SAS_INTEL_RMS2LL080_BRANDING	\
160fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai				"Intel Integrated RAID Module RMS2LL080"
161fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai#define MPT2SAS_INTEL_RMS2LL040_BRANDING	\
162fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai				"Intel Integrated RAID Module RMS2LL040"
163fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai
164fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai/*
165fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai * Intel HBA SSDIDs
166fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai */
167fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai#define MPT2SAS_INTEL_RMS2LL080_SSDID          0x350E
168fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai#define MPT2SAS_INTEL_RMS2LL040_SSDID          0x350F
169fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai
170fb396bec76187aae1a0eaf5b7f21327b8cb34fecKashyap, Desai/*
171635374e7eb110e80d9918b8611198edd56a32975Eric Moore * per target private data
172635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
173635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_RAID_COMPONENT	0x01
174635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_VOLUME		0x02
175635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_DELETED	0x04
176635374e7eb110e80d9918b8611198edd56a32975Eric Moore
177635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
178635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_TARGET - starget private hostdata
179635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
180635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: target sas address
181635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
182635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_luns: number luns
183635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @flags: MPT_TARGET_FLAGS_XXX flags
184635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @deleted: target flaged for deletion
185635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_busy: target is busy with TM request.
186635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
187635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_TARGET {
188635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
189635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
190635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
191635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	num_luns;
192635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	flags;
193635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	deleted;
194635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	tm_busy;
195635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
196635374e7eb110e80d9918b8611198edd56a32975Eric Moore
197635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
198635374e7eb110e80d9918b8611198edd56a32975Eric Moore * per device private data
199635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
200635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_DEVICE_FLAGS_INIT		0x01
201635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_DEVICE_TLR_ON		0x02
202635374e7eb110e80d9918b8611198edd56a32975Eric Moore
203635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
204635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_DEVICE - sdev private hostdata
205635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_target: starget private hostdata
206635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @lun: lun number
207635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @flags: MPT_DEVICE_XXX flags
208635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @configured_lun: lun is configured
209635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @block: device is in SDEV_BLOCK state
210635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tlr_snoop_check: flag used in determining whether to disable TLR
211635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
212ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
213ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* OEM Identifiers */
214ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_INVALID                   (0x00000000)
215ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_DELL                      (0x00000001)
216ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_FSC                       (0x00000002)
217ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_SUN                       (0x00000003)
218ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_IBM                       (0x00000004)
219ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
220ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* GENERIC Flags 0*/
221ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_OCE_DISABLED                 (0x00000001)
222ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_R1E_DRIVE_COUNT              (0x00000002)
223ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_R10_DISPLAY                  (0x00000004)
224ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_SSD_DATA_SCRUB_DISABLE       (0x00000008)
225ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_SINGLE_DRIVE_R0              (0x00000010)
226ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
227ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* OEM Specific Flags will come from OEM specific header files */
228ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desaitypedef struct _MPI2_CONFIG_PAGE_MAN_10 {
229ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    MPI2_CONFIG_PAGE_HEADER Header;                                 /* 00h */
230ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U8                      OEMIdentifier;                          /* 04h */
231ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U8                      Reserved1;                              /* 05h */
232ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U16                     Reserved2;                              /* 08h */
233ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved3;                              /* 0Ch */
234ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     GenericFlags0;                          /* 10h */
235ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     GenericFlags1;                          /* 14h */
236ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved4;                              /* 18h */
237ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     OEMSpecificFlags0;                      /* 1Ch */
238ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     OEMSpecificFlags1;                      /* 20h */
239ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved5[18];                          /* 24h-60h*/
240ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai} MPI2_CONFIG_PAGE_MAN_10,
241ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai  MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10,
242ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai  Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t;
243ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
244635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_DEVICE {
245635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct MPT2SAS_TARGET *sas_target;
246635374e7eb110e80d9918b8611198edd56a32975Eric Moore	unsigned int	lun;
247635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	flags;
248635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	configured_lun;
249635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	block;
250635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	tlr_snoop_check;
251635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
252635374e7eb110e80d9918b8611198edd56a32975Eric Moore
253635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_NOT_USED	0x8000	/* free */
254635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_COMPLETE	0x0001	/* completed */
255635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_PENDING	0x0002	/* pending */
256635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_REPLY_VALID	0x0004	/* reply is valid */
257635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_RESET		0x0008	/* host reset dropped the command */
258635374e7eb110e80d9918b8611198edd56a32975Eric Moore
259635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
260635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _internal_cmd - internal commands struct
261635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @mutex: mutex
262635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @done: completion
263635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply: reply message pointer
264769578ff811e43ccddd96b15640fa7c9df65c374Kashyap, Desai * @sense: sense data
265635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @status: MPT2_CMD_XXX status
266635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @smid: system message id
267635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
268635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _internal_cmd {
269635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct mutex mutex;
270635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct completion done;
271635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void 	*reply;
272769578ff811e43ccddd96b15640fa7c9df65c374Kashyap, Desai	void	*sense;
273635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	status;
274635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	smid;
275635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
276635374e7eb110e80d9918b8611198edd56a32975Eric Moore
277595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
278635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
279635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_device - attached device information
280635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: sas device list
281635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
282635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: device sas address
283635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_name: retrieved from the SAS IDENTIFY frame.
284635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
285c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai * @sas_address_parent: sas address of parent expander or sas host
286635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_handle: enclosure handle
287635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_logical_id: enclosure logical identifier
288635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_handle: volume handle (valid when hidden raid member)
289635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_wwid: volume unique identifier
290635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitfield provides detailed info about the device
291635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: target id
292635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @channel: target channel
293635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @slot: number number
2947fbae67a3faa90abcbe949f1494769c84e51e189Kashyap, Desai * @phy: phy identifier provided in sas device page 0
295635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_sas_device_mark_responding
296635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
297635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_device {
298635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
299635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
300635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
301635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	device_name;
302635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
303c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai	u64	sas_address_parent;
304635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	enclosure_handle;
305635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	enclosure_logical_id;
306635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	volume_handle;
307635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	volume_wwid;
308635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	device_info;
309635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	id;
310635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	channel;
311635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	slot;
3127fbae67a3faa90abcbe949f1494769c84e51e189Kashyap, Desai	u8	phy;
313635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
314635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
315635374e7eb110e80d9918b8611198edd56a32975Eric Moore
316635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
317635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _raid_device - raid volume link list
318635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: sas device list
319635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
320635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sdev: scsi device struct (volumes are single lun)
321635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @wwid: unique identifier for the volume
322635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
323635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: target id
324635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @channel: target channel
325635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_type: the raid level
326635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitfield provides detailed info about the hidden components
327635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_pds: number of hidden raid components
328635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_raid_device_mark_responding
329f7c95ef02b564d9984c0655c9659791b1dd5d7adKashyap, Desai * @percent_complete: resync percent complete
330635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
331635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _raid_device {
332635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
333635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
334635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_device *sdev;
335635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	wwid;
336635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
337635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	id;
338635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	channel;
339635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	volume_type;
340635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	device_info;
341635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_pds;
342635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
343f7c95ef02b564d9984c0655c9659791b1dd5d7adKashyap, Desai	u8	percent_complete;
344635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
345635374e7eb110e80d9918b8611198edd56a32975Eric Moore
346635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
347635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _boot_device - boot device info
348635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @is_raid: flag to indicate whether this is volume
349635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device: holds pointer for either struct _sas_device or
350635374e7eb110e80d9918b8611198edd56a32975Eric Moore *     struct _raid_device
351635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
352635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _boot_device {
353635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8 is_raid;
354635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void *device;
355635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
356635374e7eb110e80d9918b8611198edd56a32975Eric Moore
357635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
358635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_port - wide/narrow sas port information
359635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port_list: list of ports belonging to expander
360635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_phys: number of phys belonging to this port
361635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remote_identify: attached device identification
362635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @rphy: sas transport rphy object
363635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port: sas transport wide/narrow port object
364635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy_list: _sas_phy list objects belonging to this port
365635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
366635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_port {
367635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head port_list;
368635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_phys;
369635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify remote_identify;
370635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_rphy *rphy;
371635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_port *port;
372635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head phy_list;
373635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
374635374e7eb110e80d9918b8611198edd56a32975Eric Moore
375635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
376635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_phy - phy information
377635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port_siblings: list of phys belonging to a port
378635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @identify: phy identification
379635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remote_identify: attached device identification
380635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy: sas transport phy object
381635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy_id: unique phy id
382635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle for this phy
383635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @attached_handle: device handle for attached device
38438c2911449b19664e0dc46132a7b4cb249ff5e06Kashyap, Desai * @phy_belongs_to_port: port has been created for this phy
385635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
386635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_phy {
387635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head port_siblings;
388635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify identify;
389635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify remote_identify;
390635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_phy *phy;
391635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	phy_id;
392635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
393635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	attached_handle;
39438c2911449b19664e0dc46132a7b4cb249ff5e06Kashyap, Desai	u8	phy_belongs_to_port;
395635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
396635374e7eb110e80d9918b8611198edd56a32975Eric Moore
397635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
398635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_node - sas_host/expander information
399635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: list of expanders
400635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @parent_dev: parent device class
401635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_phys: number phys belonging to this sas_host/expander
402635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: sas address of this sas_host/expander
403635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: handle for this sas_host/expander
404c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai * @sas_address_parent: sas address of parent expander or sas host
405635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_handle: handle for this a member of an enclosure
406635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitwise defining capabilities of this sas_host/expander
407635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_expander_device_mark_responding
408635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy: a list of phys that make up this sas_host/expander
409635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_port_list: list of ports attached to this sas_host/expander
410635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
411635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node {
412635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
413635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct device *parent_dev;
414635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_phys;
415635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
416635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
417c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai	u64	sas_address_parent;
418635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	enclosure_handle;
419635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	enclosure_logical_id;
420635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
421635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct	_sas_phy *phy;
422635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_port_list;
423635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
424635374e7eb110e80d9918b8611198edd56a32975Eric Moore
425635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
426635374e7eb110e80d9918b8611198edd56a32975Eric Moore * enum reset_type - reset state
427635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @FORCE_BIG_HAMMER: issue diagnostic reset
428635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
429635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
430635374e7eb110e80d9918b8611198edd56a32975Eric Mooreenum reset_type {
431635374e7eb110e80d9918b8611198edd56a32975Eric Moore	FORCE_BIG_HAMMER,
432635374e7eb110e80d9918b8611198edd56a32975Eric Moore	SOFT_RESET,
433635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
434635374e7eb110e80d9918b8611198edd56a32975Eric Moore
435635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
43635f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai * struct chain_tracker - firmware chain tracker
43735f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai * @chain_buffer: chain buffer
43835f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai * @chain_buffer_dma: physical address
43935f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai * @tracker_list: list of free request (ioc->free_chain_list)
44035f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai */
44135f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desaistruct chain_tracker {
44235f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	void *chain_buffer;
44335f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	dma_addr_t chain_buffer_dma;
44435f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	struct list_head tracker_list;
44535f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai};
44635f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai
44735f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai/**
448635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct request_tracker - firmware request tracker
449635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @smid: system message id
450635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scmd: scsi request pointer
451635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @cb_idx: callback index
452635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_list: list of chains associated to this IO
453635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tracker_list: list of free request (ioc->free_list)
454635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
455635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct request_tracker {
456635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	smid;
457635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_cmnd *scmd;
458635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	cb_idx;
45935f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	struct list_head chain_list;
460635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head tracker_list;
461635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
462635374e7eb110e80d9918b8611198edd56a32975Eric Moore
46377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai/**
46477e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * struct _tr_list - target reset list
46577e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * @handle: device handle
46677e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * @state: state machine
46777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai */
46877e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaistruct _tr_list {
46977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	struct list_head list;
47077e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u16	handle;
47177e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u16	state;
47277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai};
47377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai
474635374e7eb110e80d9918b8611198edd56a32975Eric Mooretypedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
475635374e7eb110e80d9918b8611198edd56a32975Eric Moore
476635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
477635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_ADAPTER - per adapter struct
478635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: ioc_list
479635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @shost: shost object
480635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: unique adapter id
481635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pci_irq: irq number
482635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @name: generic ioc string
483635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tmp_string: tmp string used for logging
484635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pdev: pci pdev object
485635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chip: memory mapped register space
486635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chip_phys: physical addrss prior to mapping
487635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @logging_level: see mpt2sas_debug.h
488fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai * @fwfault_debug: debuging FW timeouts
489635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ir_firmware: IR firmware present
490635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bars: bitmask of BAR's that must be configured
491635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @mask_interrupts: ignore interrupt
492635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work_q_name: fw fault work queue
493635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work_q: ""
494635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work: ""
495635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @firmware_event_name: fw event work queue
496635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @firmware_event_thread: ""
497635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_events_off: flag to turn off fw event handling
498635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_event_lock:
499635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_event_list: list of fw events
500635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @aen_event_read_flag: event log was read
501635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @broadcast_aen_busy: broadcast aen waiting to be serviced
502155dd4c763694222c125e65438d823f58ea653bcKashyap, Desai * @shost_recovery: host reset in progress
503635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_reset_in_progress_lock:
504635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_link_reset_in_progress: phy/hard reset in progress
50565155b3708137fabee865dc4da822763c0c41208Uwe Kleine-König * @ignore_loginfos: ignore loginfos during task management
506635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remove_host: flag for when driver unloads, to avoid sending dev resets
5073cb5469a2ab4b87a7c63dd218fdc1625bc73ecccEric Moore * @pci_error_recovery: flag to prevent ioc access until slot reset completes
508635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @wait_for_port_enable_to_complete:
509635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_enable: flag indicating msix is enabled
510635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_vector_count: number msix vectors
511635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_table: virt address to the msix table
512635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_table_backup: backup msix table
513635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_io_cb_idx: shost generated commands
514635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_cb_idx: task management commands
515744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai * @scsih_cb_idx: scsih internal commands
516635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @transport_cb_idx: transport internal commands
517635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ctl_cb_idx: clt internal commands
518635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_cb_idx: base internal commands
519635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_cb_idx: base internal commands
520f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @tm_tr_cb_idx : device removal target reset handshake
521f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @tm_tr_volume_cb_idx : volume removal target reset
522635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_cmds:
523635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @transport_cmds:
524744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai * @scsih_cmds:
525635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_cmds:
526635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ctl_cmds:
527635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_cmds:
528635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_add_sg_single: handler for either 32/64 bit sgl's
529635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_type: bits indicating which events to log
530635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_context: unique id for each logged event
531635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_log: event log pointer
532635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_masks: events that are masked
533635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @facts: static facts data
534635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pfacts: static port facts data
535635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @manu_pg0: static manufacturing page 0
536ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai * @manu_pg10: static manufacturing page 10
537635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bios_pg2: static bios page 2
538635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bios_pg3: static bios page 3
539635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_pg8: static ioc page 8
540635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @iounit_pg0: static iounit page 0
541635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @iounit_pg1: static iounit page 1
542635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_hba: sas host object
543635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_expander_list: expander object list
544635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_node_lock:
545635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_list: sas device object list
546635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_init_list: sas device object list (used only at init time)
547635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_lock:
548635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @io_missing_delay: time for IO completed by fw when PDR enabled
549635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_missing_delay: time for device missing by fw when PDR enabled
550f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @sas_id : used for setting volume target IDs
551f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @pd_handles : bitmask for PD handles
552f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @pd_handles_sz : size of pd_handle bitmask
553635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page_sz: config page size
554635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page: reserve memory for config page payload
555635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page_dma:
556595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hba_queue_depth: hba request queue depth
557635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sge_size: sg element size for either 32/64 bit
558595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @scsiio_depth: SCSI_IO queue depth
559635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_sz: per request frame size
560635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request: pool of request frames
561635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_dma:
562635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_dma_sz:
563635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_lookup: firmware request tracker list
564635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_lookup_lock:
565635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @free_list: free list of request
566635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain: pool of chains
567635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pending_io_count:
568635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reset_wq:
569635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_dma:
570635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @max_sges_in_main_message: number sg elements in main message
571635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @max_sges_in_chain_message: number sg elements per chain
572635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chains_needed_per_io: max chains per io
573635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_offset_value_for_main_message: location 1st sg in main
574635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_depth: total chains allocated
575595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_smid:
576595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority:
577595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_dma:
578595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_depth:
579595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hpr_lookup:
580595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hpr_free_list:
581595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_smid:
582595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal:
583595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_dma:
584595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_depth:
585595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_lookup:
586595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_free_list:
587635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense: pool of sense
588635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense_dma:
589635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense_dma_pool:
590635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_depth: hba reply queue depth:
591635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_sz: per reply frame size:
592635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply: pool of replys:
593635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_dma:
594635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_dma_pool:
595635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_queue_depth: reply free depth
596635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free: pool for reply free queue (32 bit addr)
597635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_dma:
598635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_dma_pool:
599635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_host_index: tail index in pool to insert free replys
600635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_queue_depth: reply post queue depth
601635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free: pool for reply post (64bit descriptor)
602635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free_dma:
603635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free_dma_pool:
604635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_host_index: head index in the pool where FW completes IO
605f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @delayed_tr_list: target reset link list
606f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai * @delayed_tr_volume_list: volume target reset link list
607635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
608635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_ADAPTER {
609635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
610635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct Scsi_Host *shost;
611635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		id;
612635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		pci_irq;
613635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		name[MPT_NAME_LENGTH];
614635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		tmp_string[MPT_STRING_LENGTH];
615635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct pci_dev	*pdev;
616635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2SystemInterfaceRegs_t __iomem *chip;
6176846e75cdfa76c6609ac0381a6739c9f4af8fd3bKashyap, Desai	resource_size_t	chip_phys;
618635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		logging_level;
619fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai	int		fwfault_debug;
620635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ir_firmware;
621635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		bars;
622635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		mask_interrupts;
623635374e7eb110e80d9918b8611198edd56a32975Eric Moore
624635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* fw fault handler */
625635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		fault_reset_work_q_name[20];
626635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct workqueue_struct *fault_reset_work_q;
627635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct delayed_work fault_reset_work;
628635374e7eb110e80d9918b8611198edd56a32975Eric Moore
629635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* fw event handler */
630635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		firmware_event_name[20];
631635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct workqueue_struct	*firmware_event_thread;
632635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	fw_event_lock;
633635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head fw_event_list;
634635374e7eb110e80d9918b8611198edd56a32975Eric Moore
635635374e7eb110e80d9918b8611198edd56a32975Eric Moore	 /* misc flags */
636635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		aen_event_read_flag;
637635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		broadcast_aen_busy;
638635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		shost_recovery;
639d274213a1ae59e8abde8d43e1e3a478fe9f28794Kashyap, Desai
640d274213a1ae59e8abde8d43e1e3a478fe9f28794Kashyap, Desai	struct mutex	reset_in_progress_mutex;
641f1c35e6aea579d5bdb6dc02dfa99c67c7c3b3f67Kashyap, Desai	struct completion	shost_recovery_done;
642635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t 	ioc_reset_in_progress_lock;
643635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ioc_link_reset_in_progress;
644d274213a1ae59e8abde8d43e1e3a478fe9f28794Kashyap, Desai	int		ioc_reset_in_progress_status;
645d274213a1ae59e8abde8d43e1e3a478fe9f28794Kashyap, Desai
646635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ignore_loginfos;
647635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		remove_host;
6483cb5469a2ab4b87a7c63dd218fdc1625bc73ecccEric Moore	u8		pci_error_recovery;
649635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		wait_for_port_enable_to_complete;
650635374e7eb110e80d9918b8611198edd56a32975Eric Moore
651635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		msix_enable;
652635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		msix_vector_count;
653635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*msix_table;
654635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*msix_table_backup;
655d32a8c15e1116e87f0105356eca1afb99842ab49Kashyap, Desai	u32		ioc_reset_count;
656635374e7eb110e80d9918b8611198edd56a32975Eric Moore
657635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* internal commands, callback index */
658635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		scsi_io_cb_idx;
659635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		tm_cb_idx;
660635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		transport_cb_idx;
661744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai	u8		scsih_cb_idx;
662635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ctl_cb_idx;
663635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		base_cb_idx;
664635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		config_cb_idx;
66577e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u8		tm_tr_cb_idx;
666f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai	u8		tm_tr_volume_cb_idx;
66777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u8		tm_sas_control_cb_idx;
668635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd base_cmds;
669635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd transport_cmds;
670744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai	struct _internal_cmd scsih_cmds;
671635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd tm_cmds;
672635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd ctl_cmds;
673635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd config_cmds;
674635374e7eb110e80d9918b8611198edd56a32975Eric Moore
675635374e7eb110e80d9918b8611198edd56a32975Eric Moore	MPT_ADD_SGE	base_add_sg_single;
676635374e7eb110e80d9918b8611198edd56a32975Eric Moore
677635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* event log */
678635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
679635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_context;
680635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void		*event_log;
681635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
682635374e7eb110e80d9918b8611198edd56a32975Eric Moore
683635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* static config pages */
684635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOCFactsReply_t facts;
685635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2PortFactsReply_t *pfacts;
686635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2ManufacturingPage0_t manu_pg0;
687635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2BiosPage2_t	bios_pg2;
688635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2BiosPage3_t	bios_pg3;
689635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOCPage8_t ioc_pg8;
690635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOUnitPage0_t iounit_pg0;
691635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOUnitPage1_t iounit_pg1;
692635374e7eb110e80d9918b8611198edd56a32975Eric Moore
693635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device req_boot_device;
694635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device req_alt_boot_device;
695635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device current_boot_device;
696635374e7eb110e80d9918b8611198edd56a32975Eric Moore
697635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* sas hba, expander, and device list */
698635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _sas_node sas_hba;
699635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_expander_list;
700635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	sas_node_lock;
701635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_device_list;
702635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_device_init_list;
703635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	sas_device_lock;
704635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head raid_device_list;
705635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	raid_device_lock;
706635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		io_missing_delay;
707635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		device_missing_delay;
708635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		sas_id;
709635374e7eb110e80d9918b8611198edd56a32975Eric Moore
710f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai	void		*pd_handles;
711f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai	u16		pd_handles_sz;
712f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai
713635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* config page */
714635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		config_page_sz;
715635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void 		*config_page;
716635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	config_page_dma;
717635374e7eb110e80d9918b8611198edd56a32975Eric Moore
718595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* scsiio request */
719595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hba_queue_depth;
720635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		sge_size;
721595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16 		scsiio_depth;
722635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		request_sz;
723635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*request;
724635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	request_dma;
725635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		request_dma_sz;
726635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct request_tracker *scsi_lookup;
72789009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	ulong		scsi_lookup_pages;
72889009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	spinlock_t 	scsi_lookup_lock;
729635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head free_list;
730635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		pending_io_count;
731635374e7eb110e80d9918b8611198edd56a32975Eric Moore	wait_queue_head_t reset_wq;
732635374e7eb110e80d9918b8611198edd56a32975Eric Moore
733635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* chain */
73435f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	struct chain_tracker *chain_lookup;
73535f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	struct list_head free_chain_list;
73635f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	struct dma_pool *chain_dma_pool;
73735f805b52c94f8e6cb22907ef32517132a15cb96Kashyap, Desai	ulong		chain_pages;
738635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		max_sges_in_main_message;
739635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		max_sges_in_chain_message;
740635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		chains_needed_per_io;
741635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		chain_offset_value_for_main_message;
74289009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	u32		chain_depth;
743635374e7eb110e80d9918b8611198edd56a32975Eric Moore
744595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* hi-priority queue */
745595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hi_priority_smid;
746595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u8		*hi_priority;
747595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	dma_addr_t	hi_priority_dma;
748595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hi_priority_depth;
749595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct request_tracker *hpr_lookup;
750595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct list_head hpr_free_list;
751595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
752595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* internal queue */
753595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		internal_smid;
754595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u8		*internal;
755595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	dma_addr_t	internal_dma;
756595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		internal_depth;
757595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct request_tracker *internal_lookup;
758595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct list_head internal_free_list;
759595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
760635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* sense */
761635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*sense;
762635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	sense_dma;
763635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *sense_dma_pool;
764635374e7eb110e80d9918b8611198edd56a32975Eric Moore
765635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply */
766635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		reply_sz;
767635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*reply;
768635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_dma;
769dd3741d30300f9cf1adc046773a4bb87252d96acKashyap, Desai	u32		reply_dma_max_address;
770dd3741d30300f9cf1adc046773a4bb87252d96acKashyap, Desai	u32		reply_dma_min_address;
771635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_dma_pool;
772635374e7eb110e80d9918b8611198edd56a32975Eric Moore
773635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply free queue */
774635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		reply_free_queue_depth;
775635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*reply_free;
776635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_free_dma;
777635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_free_dma_pool;
778635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		reply_free_host_index;
779635374e7eb110e80d9918b8611198edd56a32975Eric Moore
780635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply post queue */
781635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		reply_post_queue_depth;
782635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2ReplyDescriptorsUnion_t *reply_post_free;
783635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_post_free_dma;
784635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_post_free_dma_pool;
785635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		reply_post_host_index;
786635374e7eb110e80d9918b8611198edd56a32975Eric Moore
78777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	struct list_head delayed_tr_list;
788f3eedd698ebafd0fe8a292672604a2db61c2c00aKashyap, Desai	struct list_head delayed_tr_volume_list;
78977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai
790635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* diag buffer support */
791635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
792635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
793635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
794635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
795635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
796ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai	Mpi2ManufacturingPage10_t manu_pg10;
797635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
798635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
799570c67ac443dab5c46e5744e950f0539724cb65dKashyap, Desai	u32		ring_buffer_offset;
800570c67ac443dab5c46e5744e950f0539724cb65dKashyap, Desai	u32		ring_buffer_sz;
801635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
802635374e7eb110e80d9918b8611198edd56a32975Eric Moore
80377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaitypedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
80477e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
805635374e7eb110e80d9918b8611198edd56a32975Eric Moore
806635374e7eb110e80d9918b8611198edd56a32975Eric Moore
807635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* base shared API */
808ba33fadfabe88e838e73c76a6ff59546f5f6b92bEric Mooreextern struct list_head mpt2sas_ioc_list;
809e4750c989f732555fca86dd73d488c79972362dbKashyap, Desaivoid mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
810e4750c989f732555fca86dd73d488c79972362dbKashyap, Desaivoid mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
811635374e7eb110e80d9918b8611198edd56a32975Eric Moore
812635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
813635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
814635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc);
815635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc);
816635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
817635374e7eb110e80d9918b8611198edd56a32975Eric Moore    enum reset_type type);
818635374e7eb110e80d9918b8611198edd56a32975Eric Moore
819635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid);
820635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
821635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
822ec9472c74c3074541ea8389517f406b5c7ad0632Kashyap, Desai__le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc,
82377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u16 smid);
824635374e7eb110e80d9918b8611198edd56a32975Eric Moore
825595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai/* hi-priority queue */
826595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desaiu16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
827595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desaiu16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
828595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai    struct scsi_cmnd *scmd);
829595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
830635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
831635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid);
8327b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid,
833635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 handle);
8347b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid);
835635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
8367b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u16 io_index);
8377b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid);
838635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_initialize_callback_handler(void);
839635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func);
840635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_release_callback_handler(u8 cb_idx);
841635374e7eb110e80d9918b8611198edd56a32975Eric Moore
84277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
8437b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
844635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr);
845635374e7eb110e80d9918b8611198edd56a32975Eric Moore
846635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked);
847635374e7eb110e80d9918b8611198edd56a32975Eric Moore
848635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code);
849635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
850635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t
851635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_request);
852635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
853635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
854635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type);
855635374e7eb110e80d9918b8611198edd56a32975Eric Moore
856fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desaivoid mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc);
857fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai
858635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* scsih shared API */
85977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
86077e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
8618ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desaiint mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle,
8628ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desai    uint channel, uint id, uint lun, u8 type, u16 smid_task,
8638ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desai    ulong timeout, struct scsi_cmnd *scmd);
864635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
865635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
8667f6f794dee50ba33710145140f39de59f5ec764eKashyap, Desaivoid mpt2sas_expander_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
8677f6f794dee50ba33710145140f39de59f5ec764eKashyap, Desaivoid mpt2sas_device_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
868635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc,
869635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 handle);
870635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
871635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *ioc, u64 sas_address);
872635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address(
873635374e7eb110e80d9918b8611198edd56a32975Eric Moore    struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
874635374e7eb110e80d9918b8611198edd56a32975Eric Moore
875635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
876635374e7eb110e80d9918b8611198edd56a32975Eric Moore
877635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* config shared API */
87877e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
8797b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
880635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys);
881635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
882635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
883ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desaiint mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc,
884ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page);
885635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
886635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2BiosPage2_t *config_page);
887635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
888635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2BiosPage3_t *config_page);
889635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
890635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOUnitPage0_t *config_page);
891635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
892635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle);
893635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
894635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle);
895635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
896635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz);
897635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
898635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOUnitPage1_t *config_page);
899635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
9005b768581ea722172f059ad5a5eebea9008961af0Kashyap, Desai    *mpi_reply, Mpi2IOUnitPage1_t *config_page);
901635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
902635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
90350d5c60634673a79f8d88564e10345b50fca7378Kashyap, Desaiint mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
90450d5c60634673a79f8d88564e10345b50fca7378Kashyap, Desai    Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
905635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
906635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOCPage8_t *config_page);
907635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
908635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle);
909635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
910635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle);
911635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
912635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle);
913635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
914635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
915635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
916635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
917635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
918635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle);
919635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds);
920635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
921635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz);
922635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
923635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form,
924635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u32 form_specific);
925635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
926635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 *volume_handle);
927635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle,
928635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u64 *wwid);
929635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* ctl shared API */
930635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct device_attribute *mpt2sas_host_attrs[];
931635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct device_attribute *mpt2sas_dev_attrs[];
932635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_init(void);
933635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_exit(void);
93477e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
9357b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
936635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
93777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
9387b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
939635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
940635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2EventNotificationReply_t *mpi_reply);
941635374e7eb110e80d9918b8611198edd56a32975Eric Moore
94232e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desaivoid mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
94332e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desai	u8 bits_to_regsiter);
94432e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desai
945635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* transport shared API */
94677e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
94777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
948635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc,
949c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u16 handle, u64 sas_address);
950635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
951c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u64 sas_address_parent);
952635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
953635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
954635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
955635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev);
956c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desaivoid mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
957c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
958635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct sas_function_template mpt2sas_transport_functions;
959635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct scsi_transport_template *mpt2sas_transport_template;
96034a03bef2202d0c9983a8da0a8abaee37d285847Kashyap, Desaiextern int scsi_internal_device_block(struct scsi_device *sdev);
96177e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiextern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc,
96277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u8 msix_index, u32 reply);
96334a03bef2202d0c9983a8da0a8abaee37d285847Kashyap, Desaiextern int scsi_internal_device_unblock(struct scsi_device *sdev);
964635374e7eb110e80d9918b8611198edd56a32975Eric Moore
965635374e7eb110e80d9918b8611198edd56a32975Eric Moore#endif /* MPT2SAS_BASE_H_INCLUDED */
966