blob: 239f169b06733cb6d1aa1ad04967f45e4cda7c41 [file] [log] [blame]
Eric Moore635374e2009-03-09 01:21:12 -06001/*
2 * This is the Fusion MPT base driver providing common API layer interface
3 * for access to MPT (Message Passing Technology) firmware.
4 *
5 * This code is based on drivers/scsi/mpt2sas/mpt2_base.h
Sreekanth Reddye9edbe32014-09-12 15:35:18 +05306 * Copyright (C) 2007-2014 LSI Corporation
Eric Moore635374e2009-03-09 01:21:12 -06007 * (mailto:DL-MPTFusionLinux@lsi.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * NO WARRANTY
20 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
21 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
22 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
23 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
24 * solely responsible for determining the appropriateness of using and
25 * distributing the Program and assumes all risks associated with its
26 * exercise of rights under this Agreement, including but not limited to
27 * the risks and costs of program errors, damage to or loss of data,
28 * programs or equipment, and unavailability or interruption of operations.
29
30 * DISCLAIMER OF LIABILITY
31 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
34 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
38
39 * You should have received a copy of the GNU General Public License
40 * along with this program; if not, write to the Free Software
41 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
42 * USA.
43 */
44
45#ifndef MPT2SAS_BASE_H_INCLUDED
46#define MPT2SAS_BASE_H_INCLUDED
47
48#include "mpi/mpi2_type.h"
49#include "mpi/mpi2.h"
50#include "mpi/mpi2_ioc.h"
51#include "mpi/mpi2_cnfg.h"
52#include "mpi/mpi2_init.h"
53#include "mpi/mpi2_raid.h"
54#include "mpi/mpi2_tool.h"
55#include "mpi/mpi2_sas.h"
56
57#include <scsi/scsi.h>
58#include <scsi/scsi_cmnd.h>
59#include <scsi/scsi_device.h>
60#include <scsi/scsi_host.h>
61#include <scsi/scsi_tcq.h>
62#include <scsi/scsi_transport_sas.h>
63#include <scsi/scsi_dbg.h>
Eric Moore3c621b32009-05-18 12:59:41 -060064#include <scsi/scsi_eh.h>
Eric Moore635374e2009-03-09 01:21:12 -060065
66#include "mpt2sas_debug.h"
67
68/* driver versioning info */
69#define MPT2SAS_DRIVER_NAME "mpt2sas"
70#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
71#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
Sreekanth Reddy9b2dcba2014-09-12 15:35:24 +053072#define MPT2SAS_DRIVER_VERSION "18.100.00.00"
73#define MPT2SAS_MAJOR_VERSION 18
Eric Moore635374e2009-03-09 01:21:12 -060074#define MPT2SAS_MINOR_VERSION 100
Kashyap, Desai1a7d7ea2010-03-17 16:28:34 +053075#define MPT2SAS_BUILD_VERSION 00
nagalakshmi.nandigama@lsi.com6e880202011-10-19 15:37:54 +053076#define MPT2SAS_RELEASE_VERSION 00
Eric Moore635374e2009-03-09 01:21:12 -060077
78/*
79 * Set MPT2SAS_SG_DEPTH value based on user input.
80 */
81#ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
82#if CONFIG_SCSI_MPT2SAS_MAX_SGE < 16
83#define MPT2SAS_SG_DEPTH 16
84#elif CONFIG_SCSI_MPT2SAS_MAX_SGE > 128
85#define MPT2SAS_SG_DEPTH 128
86#else
87#define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
88#endif
89#else
90#define MPT2SAS_SG_DEPTH 128 /* MAX_HW_SEGMENTS */
91#endif
92
93
94/*
95 * Generic Defines
96 */
97#define MPT2SAS_SATA_QUEUE_DEPTH 32
98#define MPT2SAS_SAS_QUEUE_DEPTH 254
99#define MPT2SAS_RAID_QUEUE_DEPTH 128
100
101#define MPT_NAME_LENGTH 32 /* generic length of strings */
102#define MPT_STRING_LENGTH 64
103
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530104#define MPT_MAX_CALLBACKS 16
105
Eric Moore635374e2009-03-09 01:21:12 -0600106
107#define CAN_SLEEP 1
108#define NO_SLEEP 0
109
110#define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
111
112#define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/
113
114#define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF
115
116
117/*
118 * reset phases
119 */
120#define MPT2_IOC_PRE_RESET 1 /* prior to host reset */
121#define MPT2_IOC_AFTER_RESET 2 /* just after host reset */
122#define MPT2_IOC_DONE_RESET 3 /* links re-initialized */
123
124/*
125 * logging format
126 */
127#define MPT2SAS_FMT "%s: "
Eric Moore635374e2009-03-09 01:21:12 -0600128#define MPT2SAS_INFO_FMT KERN_INFO MPT2SAS_FMT
129#define MPT2SAS_NOTE_FMT KERN_NOTICE MPT2SAS_FMT
130#define MPT2SAS_WARN_FMT KERN_WARNING MPT2SAS_FMT
131#define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT
132
133/*
Eric Mooref0f9cc12009-04-21 15:40:48 -0600134 * Dell HBA branding
135 */
136#define MPT2SAS_DELL_BRANDING_SIZE 32
137
138#define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA"
139#define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter"
140#define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
141#define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular"
142#define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded"
143#define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200"
144#define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS"
145
146/*
147 * Dell HBA SSDIDs
148 */
149#define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C
150#define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D
151#define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E
152#define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F
153#define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20
154#define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21
155#define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22
156
157/*
Kashyap, Desaifb396be2011-01-04 11:36:37 +0530158 * Intel HBA branding
159 */
nagalakshmi.nandigama@lsi.com8bad3052011-12-01 07:52:42 +0530160#define MPT2SAS_INTEL_RMS25JB080_BRANDING \
161 "Intel(R) Integrated RAID Module RMS25JB080"
162#define MPT2SAS_INTEL_RMS25JB040_BRANDING \
163 "Intel(R) Integrated RAID Module RMS25JB040"
164#define MPT2SAS_INTEL_RMS25KB080_BRANDING \
165 "Intel(R) Integrated RAID Module RMS25KB080"
166#define MPT2SAS_INTEL_RMS25KB040_BRANDING \
167 "Intel(R) Integrated RAID Module RMS25KB040"
Sreekanth Reddy7887ea72013-02-01 21:49:30 +0530168#define MPT2SAS_INTEL_RMS25LB040_BRANDING \
169 "Intel(R) Integrated RAID Module RMS25LB040"
170#define MPT2SAS_INTEL_RMS25LB080_BRANDING \
171 "Intel(R) Integrated RAID Module RMS25LB080"
Kashyap, Desaifb396be2011-01-04 11:36:37 +0530172#define MPT2SAS_INTEL_RMS2LL080_BRANDING \
173 "Intel Integrated RAID Module RMS2LL080"
174#define MPT2SAS_INTEL_RMS2LL040_BRANDING \
175 "Intel Integrated RAID Module RMS2LL040"
Kashyap, Desaiab3e5f62011-06-14 10:57:31 +0530176#define MPT2SAS_INTEL_RS25GB008_BRANDING \
177 "Intel(R) RAID Controller RS25GB008"
sreekanth.reddy@lsi.come17eee42012-07-17 15:56:05 +0530178#define MPT2SAS_INTEL_SSD910_BRANDING \
179 "Intel(R) SSD 910 Series"
Kashyap, Desaifb396be2011-01-04 11:36:37 +0530180/*
181 * Intel HBA SSDIDs
182 */
nagalakshmi.nandigama@lsi.com8bad3052011-12-01 07:52:42 +0530183#define MPT2SAS_INTEL_RMS25JB080_SSDID 0x3516
184#define MPT2SAS_INTEL_RMS25JB040_SSDID 0x3517
185#define MPT2SAS_INTEL_RMS25KB080_SSDID 0x3518
186#define MPT2SAS_INTEL_RMS25KB040_SSDID 0x3519
Sreekanth Reddy7887ea72013-02-01 21:49:30 +0530187#define MPT2SAS_INTEL_RMS25LB040_SSDID 0x351A
188#define MPT2SAS_INTEL_RMS25LB080_SSDID 0x351B
Kashyap, Desaifb396be2011-01-04 11:36:37 +0530189#define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E
190#define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F
Kashyap, Desaiab3e5f62011-06-14 10:57:31 +0530191#define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000
sreekanth.reddy@lsi.come17eee42012-07-17 15:56:05 +0530192#define MPT2SAS_INTEL_SSD910_SSDID 0x3700
Kashyap, Desai0a2385c2011-03-15 20:04:26 +0530193
194/*
195 * HP HBA branding
196 */
197#define MPT2SAS_HP_3PAR_SSVID 0x1590
198#define MPT2SAS_HP_2_4_INTERNAL_BRANDING "HP H220 Host Bus Adapter"
199#define MPT2SAS_HP_2_4_EXTERNAL_BRANDING "HP H221 Host Bus Adapter"
200#define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING "HP H222 Host Bus Adapter"
201#define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING "HP H220i Host Bus Adapter"
202#define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING "HP H210i Host Bus Adapter"
203
204/*
205 * HO HBA SSDIDs
206 */
207#define MPT2SAS_HP_2_4_INTERNAL_SSDID 0x0041
208#define MPT2SAS_HP_2_4_EXTERNAL_SSDID 0x0042
209#define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID 0x0043
210#define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID 0x0044
211#define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID 0x0046
212
Kashyap, Desaifb396be2011-01-04 11:36:37 +0530213/*
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530214 * WarpDrive Specific Log codes
215 */
216
217#define MPT2_WARPDRIVE_LOGENTRY (0x8002)
218#define MPT2_WARPDRIVE_LC_SSDT (0x41)
219#define MPT2_WARPDRIVE_LC_SSDLW (0x43)
220#define MPT2_WARPDRIVE_LC_SSDLF (0x44)
221#define MPT2_WARPDRIVE_LC_BRMF (0x4D)
222
223/*
Eric Moore635374e2009-03-09 01:21:12 -0600224 * per target private data
225 */
226#define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
227#define MPT_TARGET_FLAGS_VOLUME 0x02
228#define MPT_TARGET_FLAGS_DELETED 0x04
229
230/**
231 * struct MPT2SAS_TARGET - starget private hostdata
232 * @starget: starget object
233 * @sas_address: target sas address
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530234 * @raid_device: raid_device pointer to access volume data
Eric Moore635374e2009-03-09 01:21:12 -0600235 * @handle: device handle
236 * @num_luns: number luns
237 * @flags: MPT_TARGET_FLAGS_XXX flags
238 * @deleted: target flaged for deletion
239 * @tm_busy: target is busy with TM request.
240 */
241struct MPT2SAS_TARGET {
242 struct scsi_target *starget;
243 u64 sas_address;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530244 struct _raid_device *raid_device;
Eric Moore635374e2009-03-09 01:21:12 -0600245 u16 handle;
246 int num_luns;
247 u32 flags;
248 u8 deleted;
249 u8 tm_busy;
250};
251
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530252
Eric Moore635374e2009-03-09 01:21:12 -0600253/*
254 * per device private data
255 */
256#define MPT_DEVICE_FLAGS_INIT 0x01
257#define MPT_DEVICE_TLR_ON 0x02
258
259/**
260 * struct MPT2SAS_DEVICE - sdev private hostdata
261 * @sas_target: starget private hostdata
262 * @lun: lun number
263 * @flags: MPT_DEVICE_XXX flags
264 * @configured_lun: lun is configured
265 * @block: device is in SDEV_BLOCK state
266 * @tlr_snoop_check: flag used in determining whether to disable TLR
267 */
Kashyap, Desaied79f122009-08-20 13:23:49 +0530268
269/* OEM Identifiers */
270#define MFG10_OEM_ID_INVALID (0x00000000)
271#define MFG10_OEM_ID_DELL (0x00000001)
272#define MFG10_OEM_ID_FSC (0x00000002)
273#define MFG10_OEM_ID_SUN (0x00000003)
274#define MFG10_OEM_ID_IBM (0x00000004)
275
276/* GENERIC Flags 0*/
277#define MFG10_GF0_OCE_DISABLED (0x00000001)
278#define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002)
279#define MFG10_GF0_R10_DISPLAY (0x00000004)
280#define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008)
281#define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010)
282
283/* OEM Specific Flags will come from OEM specific header files */
284typedef struct _MPI2_CONFIG_PAGE_MAN_10 {
285 MPI2_CONFIG_PAGE_HEADER Header; /* 00h */
286 U8 OEMIdentifier; /* 04h */
287 U8 Reserved1; /* 05h */
288 U16 Reserved2; /* 08h */
289 U32 Reserved3; /* 0Ch */
290 U32 GenericFlags0; /* 10h */
291 U32 GenericFlags1; /* 14h */
292 U32 Reserved4; /* 18h */
293 U32 OEMSpecificFlags0; /* 1Ch */
294 U32 OEMSpecificFlags1; /* 20h */
295 U32 Reserved5[18]; /* 24h-60h*/
296} MPI2_CONFIG_PAGE_MAN_10,
297 MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10,
298 Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t;
299
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530300#define MFG_PAGE10_HIDE_SSDS_MASK (0x00000003)
301#define MFG_PAGE10_HIDE_ALL_DISKS (0x00)
302#define MFG_PAGE10_EXPOSE_ALL_DISKS (0x01)
303#define MFG_PAGE10_HIDE_IF_VOL_PRESENT (0x02)
304
305
Eric Moore635374e2009-03-09 01:21:12 -0600306struct MPT2SAS_DEVICE {
307 struct MPT2SAS_TARGET *sas_target;
308 unsigned int lun;
309 u32 flags;
310 u8 configured_lun;
311 u8 block;
312 u8 tlr_snoop_check;
313};
314
315#define MPT2_CMD_NOT_USED 0x8000 /* free */
316#define MPT2_CMD_COMPLETE 0x0001 /* completed */
317#define MPT2_CMD_PENDING 0x0002 /* pending */
318#define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */
319#define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */
320
321/**
322 * struct _internal_cmd - internal commands struct
323 * @mutex: mutex
324 * @done: completion
325 * @reply: reply message pointer
Kashyap, Desai769578f2010-06-17 13:49:28 +0530326 * @sense: sense data
Eric Moore635374e2009-03-09 01:21:12 -0600327 * @status: MPT2_CMD_XXX status
328 * @smid: system message id
329 */
330struct _internal_cmd {
331 struct mutex mutex;
332 struct completion done;
333 void *reply;
Kashyap, Desai769578f2010-06-17 13:49:28 +0530334 void *sense;
Eric Moore635374e2009-03-09 01:21:12 -0600335 u16 status;
336 u16 smid;
337};
338
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530339
Eric Moore635374e2009-03-09 01:21:12 -0600340/**
341 * struct _sas_device - attached device information
342 * @list: sas device list
343 * @starget: starget object
344 * @sas_address: device sas address
345 * @device_name: retrieved from the SAS IDENTIFY frame.
346 * @handle: device handle
Kashyap, Desaic5e039b2009-09-23 17:21:29 +0530347 * @sas_address_parent: sas address of parent expander or sas host
Eric Moore635374e2009-03-09 01:21:12 -0600348 * @enclosure_handle: enclosure handle
349 * @enclosure_logical_id: enclosure logical identifier
350 * @volume_handle: volume handle (valid when hidden raid member)
351 * @volume_wwid: volume unique identifier
352 * @device_info: bitfield provides detailed info about the device
353 * @id: target id
354 * @channel: target channel
355 * @slot: number number
Kashyap, Desai7fbae672010-06-17 13:45:17 +0530356 * @phy: phy identifier provided in sas device page 0
Eric Moore635374e2009-03-09 01:21:12 -0600357 * @responding: used in _scsih_sas_device_mark_responding
Sreekanth Reddybd58ea32014-09-12 15:35:19 +0530358 * @pfa_led_on: flag for PFA LED status
Eric Moore635374e2009-03-09 01:21:12 -0600359 */
360struct _sas_device {
361 struct list_head list;
362 struct scsi_target *starget;
363 u64 sas_address;
364 u64 device_name;
365 u16 handle;
Kashyap, Desaic5e039b2009-09-23 17:21:29 +0530366 u64 sas_address_parent;
Eric Moore635374e2009-03-09 01:21:12 -0600367 u16 enclosure_handle;
368 u64 enclosure_logical_id;
369 u16 volume_handle;
370 u64 volume_wwid;
371 u32 device_info;
372 int id;
373 int channel;
374 u16 slot;
Kashyap, Desai7fbae672010-06-17 13:45:17 +0530375 u8 phy;
Eric Moore635374e2009-03-09 01:21:12 -0600376 u8 responding;
Sreekanth Reddybd58ea32014-09-12 15:35:19 +0530377 u8 pfa_led_on;
Eric Moore635374e2009-03-09 01:21:12 -0600378};
379
380/**
381 * struct _raid_device - raid volume link list
382 * @list: sas device list
383 * @starget: starget object
384 * @sdev: scsi device struct (volumes are single lun)
385 * @wwid: unique identifier for the volume
386 * @handle: device handle
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530387 * @block_size: Block size of the volume
Eric Moore635374e2009-03-09 01:21:12 -0600388 * @id: target id
389 * @channel: target channel
390 * @volume_type: the raid level
391 * @device_info: bitfield provides detailed info about the hidden components
392 * @num_pds: number of hidden raid components
393 * @responding: used in _scsih_raid_device_mark_responding
Kashyap, Desaif7c95ef2009-12-16 18:54:42 +0530394 * @percent_complete: resync percent complete
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530395 * @direct_io_enabled: Whether direct io to PDs are allowed or not
396 * @stripe_exponent: X where 2powX is the stripe sz in blocks
nagalakshmi.nandigama@lsi.comba96bd02011-12-01 07:51:55 +0530397 * @block_exponent: X where 2powX is the block sz in bytes
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530398 * @max_lba: Maximum number of LBA in the volume
399 * @stripe_sz: Stripe Size of the volume
400 * @device_info: Device info of the volume member disk
401 * @pd_handle: Array of handles of the physical drives for direct I/O in le16
Eric Moore635374e2009-03-09 01:21:12 -0600402 */
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530403#define MPT_MAX_WARPDRIVE_PDS 8
Eric Moore635374e2009-03-09 01:21:12 -0600404struct _raid_device {
405 struct list_head list;
406 struct scsi_target *starget;
407 struct scsi_device *sdev;
408 u64 wwid;
409 u16 handle;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530410 u16 block_sz;
Eric Moore635374e2009-03-09 01:21:12 -0600411 int id;
412 int channel;
413 u8 volume_type;
Eric Moore635374e2009-03-09 01:21:12 -0600414 u8 num_pds;
415 u8 responding;
Kashyap, Desaif7c95ef2009-12-16 18:54:42 +0530416 u8 percent_complete;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530417 u8 direct_io_enabled;
418 u8 stripe_exponent;
nagalakshmi.nandigama@lsi.comba96bd02011-12-01 07:51:55 +0530419 u8 block_exponent;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530420 u64 max_lba;
421 u32 stripe_sz;
422 u32 device_info;
423 u16 pd_handle[MPT_MAX_WARPDRIVE_PDS];
Eric Moore635374e2009-03-09 01:21:12 -0600424};
425
426/**
427 * struct _boot_device - boot device info
428 * @is_raid: flag to indicate whether this is volume
429 * @device: holds pointer for either struct _sas_device or
430 * struct _raid_device
431 */
432struct _boot_device {
433 u8 is_raid;
434 void *device;
435};
436
437/**
438 * struct _sas_port - wide/narrow sas port information
439 * @port_list: list of ports belonging to expander
Eric Moore635374e2009-03-09 01:21:12 -0600440 * @num_phys: number of phys belonging to this port
441 * @remote_identify: attached device identification
442 * @rphy: sas transport rphy object
443 * @port: sas transport wide/narrow port object
444 * @phy_list: _sas_phy list objects belonging to this port
445 */
446struct _sas_port {
447 struct list_head port_list;
Eric Moore635374e2009-03-09 01:21:12 -0600448 u8 num_phys;
449 struct sas_identify remote_identify;
450 struct sas_rphy *rphy;
451 struct sas_port *port;
452 struct list_head phy_list;
453};
454
455/**
456 * struct _sas_phy - phy information
457 * @port_siblings: list of phys belonging to a port
458 * @identify: phy identification
459 * @remote_identify: attached device identification
460 * @phy: sas transport phy object
461 * @phy_id: unique phy id
462 * @handle: device handle for this phy
463 * @attached_handle: device handle for attached device
Kashyap, Desai38c29112010-04-05 14:18:34 +0530464 * @phy_belongs_to_port: port has been created for this phy
Eric Moore635374e2009-03-09 01:21:12 -0600465 */
466struct _sas_phy {
467 struct list_head port_siblings;
468 struct sas_identify identify;
469 struct sas_identify remote_identify;
470 struct sas_phy *phy;
471 u8 phy_id;
472 u16 handle;
473 u16 attached_handle;
Kashyap, Desai38c29112010-04-05 14:18:34 +0530474 u8 phy_belongs_to_port;
Eric Moore635374e2009-03-09 01:21:12 -0600475};
476
477/**
478 * struct _sas_node - sas_host/expander information
479 * @list: list of expanders
480 * @parent_dev: parent device class
481 * @num_phys: number phys belonging to this sas_host/expander
482 * @sas_address: sas address of this sas_host/expander
483 * @handle: handle for this sas_host/expander
Kashyap, Desaic5e039b2009-09-23 17:21:29 +0530484 * @sas_address_parent: sas address of parent expander or sas host
Eric Moore635374e2009-03-09 01:21:12 -0600485 * @enclosure_handle: handle for this a member of an enclosure
486 * @device_info: bitwise defining capabilities of this sas_host/expander
487 * @responding: used in _scsih_expander_device_mark_responding
488 * @phy: a list of phys that make up this sas_host/expander
489 * @sas_port_list: list of ports attached to this sas_host/expander
490 */
491struct _sas_node {
492 struct list_head list;
493 struct device *parent_dev;
494 u8 num_phys;
495 u64 sas_address;
496 u16 handle;
Kashyap, Desaic5e039b2009-09-23 17:21:29 +0530497 u64 sas_address_parent;
Eric Moore635374e2009-03-09 01:21:12 -0600498 u16 enclosure_handle;
499 u64 enclosure_logical_id;
500 u8 responding;
501 struct _sas_phy *phy;
502 struct list_head sas_port_list;
503};
504
505/**
506 * enum reset_type - reset state
507 * @FORCE_BIG_HAMMER: issue diagnostic reset
508 * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
509 */
510enum reset_type {
511 FORCE_BIG_HAMMER,
512 SOFT_RESET,
513};
514
515/**
Kashyap, Desai35f805b2010-11-13 04:34:06 +0530516 * struct chain_tracker - firmware chain tracker
517 * @chain_buffer: chain buffer
518 * @chain_buffer_dma: physical address
519 * @tracker_list: list of free request (ioc->free_chain_list)
520 */
521struct chain_tracker {
522 void *chain_buffer;
523 dma_addr_t chain_buffer_dma;
524 struct list_head tracker_list;
525};
526
527/**
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530528 * struct scsiio_tracker - scsi mf request tracker
Eric Moore635374e2009-03-09 01:21:12 -0600529 * @smid: system message id
530 * @scmd: scsi request pointer
531 * @cb_idx: callback index
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530532 * @direct_io: To indicate whether I/O is direct (WARPDRIVE)
Eric Moore635374e2009-03-09 01:21:12 -0600533 * @chain_list: list of chains associated to this IO
534 * @tracker_list: list of free request (ioc->free_list)
535 */
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530536struct scsiio_tracker {
Eric Moore635374e2009-03-09 01:21:12 -0600537 u16 smid;
538 struct scsi_cmnd *scmd;
539 u8 cb_idx;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530540 u8 direct_io;
Kashyap, Desai35f805b2010-11-13 04:34:06 +0530541 struct list_head chain_list;
Eric Moore635374e2009-03-09 01:21:12 -0600542 struct list_head tracker_list;
543};
544
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530545/**
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +0530546 * struct request_tracker - firmware request tracker
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530547 * @smid: system message id
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530548 * @cb_idx: callback index
549 * @tracker_list: list of free request (ioc->free_list)
550 */
551struct request_tracker {
552 u16 smid;
553 u8 cb_idx;
554 struct list_head tracker_list;
555};
556
557/**
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530558 * struct _tr_list - target reset list
559 * @handle: device handle
560 * @state: state machine
561 */
562struct _tr_list {
563 struct list_head list;
564 u16 handle;
565 u16 state;
566};
567
Eric Moore635374e2009-03-09 01:21:12 -0600568typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
569
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530570/**
571 * struct adapter_reply_queue - the reply queue struct
572 * @ioc: per adapter object
573 * @msix_index: msix index into vector table
574 * @vector: irq vector
575 * @reply_post_host_index: head index in the pool where FW completes IO
576 * @reply_post_free: reply post base virt address
577 * @name: the name registered to request_irq()
578 * @busy: isr is actively processing replies on another cpu
579 * @list: this list
580*/
581struct adapter_reply_queue {
582 struct MPT2SAS_ADAPTER *ioc;
583 u8 msix_index;
584 unsigned int vector;
585 u32 reply_post_host_index;
586 Mpi2ReplyDescriptorsUnion_t *reply_post_free;
587 char name[MPT_NAME_LENGTH];
588 atomic_t busy;
589 struct list_head list;
590};
591
Kashyap, Desaic97951e2011-06-14 10:54:56 +0530592/* IOC Facts and Port Facts converted from little endian to cpu */
593union mpi2_version_union {
594 MPI2_VERSION_STRUCT Struct;
595 u32 Word;
596};
597
598struct mpt2sas_facts {
599 u16 MsgVersion;
600 u16 HeaderVersion;
601 u8 IOCNumber;
602 u8 VP_ID;
603 u8 VF_ID;
604 u16 IOCExceptions;
605 u16 IOCStatus;
606 u32 IOCLogInfo;
607 u8 MaxChainDepth;
608 u8 WhoInit;
609 u8 NumberOfPorts;
610 u8 MaxMSIxVectors;
611 u16 RequestCredit;
612 u16 ProductID;
613 u32 IOCCapabilities;
614 union mpi2_version_union FWVersion;
615 u16 IOCRequestFrameSize;
616 u16 Reserved3;
617 u16 MaxInitiators;
618 u16 MaxTargets;
619 u16 MaxSasExpanders;
620 u16 MaxEnclosures;
621 u16 ProtocolFlags;
622 u16 HighPriorityCredit;
623 u16 MaxReplyDescriptorPostQueueDepth;
624 u8 ReplyFrameSize;
625 u8 MaxVolumes;
626 u16 MaxDevHandle;
627 u16 MaxPersistentEntries;
628 u16 MinDevHandle;
629};
630
631struct mpt2sas_port_facts {
632 u8 PortNumber;
633 u8 VP_ID;
634 u8 VF_ID;
635 u8 PortType;
636 u16 MaxPostedCmdBuffers;
637};
638
Sreekanth Reddy5fb1bf82014-09-12 15:35:22 +0530639struct reply_post_struct {
640 Mpi2ReplyDescriptorsUnion_t *reply_post_free;
641 dma_addr_t reply_post_free_dma;
642};
643
Eric Moore635374e2009-03-09 01:21:12 -0600644/**
Kashyap, Desaif93213d2011-06-14 10:56:43 +0530645 * enum mutex_type - task management mutex type
646 * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it
647 * @TM_MUTEX_ON: mutex is required
648 */
649enum mutex_type {
650 TM_MUTEX_OFF = 0,
651 TM_MUTEX_ON = 1,
652};
653
nagalakshmi.nandigama@lsi.com845a0e42011-12-01 07:42:04 +0530654typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS)(struct MPT2SAS_ADAPTER *ioc);
Kashyap, Desaif93213d2011-06-14 10:56:43 +0530655/**
Eric Moore635374e2009-03-09 01:21:12 -0600656 * struct MPT2SAS_ADAPTER - per adapter struct
657 * @list: ioc_list
658 * @shost: shost object
659 * @id: unique adapter id
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530660 * @cpu_count: number online cpus
Eric Moore635374e2009-03-09 01:21:12 -0600661 * @name: generic ioc string
662 * @tmp_string: tmp string used for logging
663 * @pdev: pci pdev object
664 * @chip: memory mapped register space
665 * @chip_phys: physical addrss prior to mapping
Eric Moore635374e2009-03-09 01:21:12 -0600666 * @logging_level: see mpt2sas_debug.h
Kashyap, Desaifa7f3162009-09-23 17:26:58 +0530667 * @fwfault_debug: debuging FW timeouts
Eric Moore635374e2009-03-09 01:21:12 -0600668 * @ir_firmware: IR firmware present
669 * @bars: bitmask of BAR's that must be configured
670 * @mask_interrupts: ignore interrupt
Sreekanth Reddy5fb1bf82014-09-12 15:35:22 +0530671 * @dma_mask: used to set the consistent dma mask
Eric Moore635374e2009-03-09 01:21:12 -0600672 * @fault_reset_work_q_name: fw fault work queue
673 * @fault_reset_work_q: ""
674 * @fault_reset_work: ""
675 * @firmware_event_name: fw event work queue
676 * @firmware_event_thread: ""
677 * @fw_events_off: flag to turn off fw event handling
678 * @fw_event_lock:
679 * @fw_event_list: list of fw events
680 * @aen_event_read_flag: event log was read
681 * @broadcast_aen_busy: broadcast aen waiting to be serviced
Kashyap, Desai155dd4c2009-08-20 13:22:00 +0530682 * @shost_recovery: host reset in progress
Eric Moore635374e2009-03-09 01:21:12 -0600683 * @ioc_reset_in_progress_lock:
684 * @ioc_link_reset_in_progress: phy/hard reset in progress
Uwe Kleine-König65155b32010-06-11 12:17:01 +0200685 * @ignore_loginfos: ignore loginfos during task management
Eric Moore635374e2009-03-09 01:21:12 -0600686 * @remove_host: flag for when driver unloads, to avoid sending dev resets
Eric Moore3cb54692010-07-08 14:44:34 -0600687 * @pci_error_recovery: flag to prevent ioc access until slot reset completes
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +0530688 * @wait_for_discovery_to_complete: flag set at driver load time when
689 * waiting on reporting devices
690 * @is_driver_loading: flag set at driver load time
691 * @port_enable_failed: flag set when port enable has failed
692 * @start_scan: flag set from scan_start callback, cleared from _mpt2sas_fw_work
693 * @start_scan_failed: means port enable failed, return's the ioc_status
Eric Moore635374e2009-03-09 01:21:12 -0600694 * @msix_enable: flag indicating msix is enabled
695 * @msix_vector_count: number msix vectors
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530696 * @cpu_msix_table: table for mapping cpus to msix index
697 * @cpu_msix_table_sz: table size
nagalakshmi.nandigama@lsi.com845a0e42011-12-01 07:42:04 +0530698 * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
Eric Moore635374e2009-03-09 01:21:12 -0600699 * @scsi_io_cb_idx: shost generated commands
700 * @tm_cb_idx: task management commands
Kashyap, Desai744090d2009-10-05 15:56:56 +0530701 * @scsih_cb_idx: scsih internal commands
Eric Moore635374e2009-03-09 01:21:12 -0600702 * @transport_cb_idx: transport internal commands
703 * @ctl_cb_idx: clt internal commands
704 * @base_cb_idx: base internal commands
705 * @config_cb_idx: base internal commands
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530706 * @tm_tr_cb_idx : device removal target reset handshake
707 * @tm_tr_volume_cb_idx : volume removal target reset
Eric Moore635374e2009-03-09 01:21:12 -0600708 * @base_cmds:
709 * @transport_cmds:
Kashyap, Desai744090d2009-10-05 15:56:56 +0530710 * @scsih_cmds:
Eric Moore635374e2009-03-09 01:21:12 -0600711 * @tm_cmds:
712 * @ctl_cmds:
713 * @config_cmds:
714 * @base_add_sg_single: handler for either 32/64 bit sgl's
715 * @event_type: bits indicating which events to log
716 * @event_context: unique id for each logged event
717 * @event_log: event log pointer
718 * @event_masks: events that are masked
719 * @facts: static facts data
720 * @pfacts: static port facts data
721 * @manu_pg0: static manufacturing page 0
Kashyap, Desaied79f122009-08-20 13:23:49 +0530722 * @manu_pg10: static manufacturing page 10
Eric Moore635374e2009-03-09 01:21:12 -0600723 * @bios_pg2: static bios page 2
724 * @bios_pg3: static bios page 3
725 * @ioc_pg8: static ioc page 8
726 * @iounit_pg0: static iounit page 0
727 * @iounit_pg1: static iounit page 1
728 * @sas_hba: sas host object
729 * @sas_expander_list: expander object list
730 * @sas_node_lock:
731 * @sas_device_list: sas device object list
732 * @sas_device_init_list: sas device object list (used only at init time)
733 * @sas_device_lock:
734 * @io_missing_delay: time for IO completed by fw when PDR enabled
735 * @device_missing_delay: time for device missing by fw when PDR enabled
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530736 * @sas_id : used for setting volume target IDs
nagalakshmi.nandigama@lsi.com09da0b32012-03-20 12:06:50 +0530737 * @blocking_handles: bitmask used to identify which devices need blocking
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530738 * @pd_handles : bitmask for PD handles
739 * @pd_handles_sz : size of pd_handle bitmask
Eric Moore635374e2009-03-09 01:21:12 -0600740 * @config_page_sz: config page size
741 * @config_page: reserve memory for config page payload
742 * @config_page_dma:
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530743 * @hba_queue_depth: hba request queue depth
Eric Moore635374e2009-03-09 01:21:12 -0600744 * @sge_size: sg element size for either 32/64 bit
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530745 * @scsiio_depth: SCSI_IO queue depth
Eric Moore635374e2009-03-09 01:21:12 -0600746 * @request_sz: per request frame size
747 * @request: pool of request frames
748 * @request_dma:
749 * @request_dma_sz:
750 * @scsi_lookup: firmware request tracker list
751 * @scsi_lookup_lock:
752 * @free_list: free list of request
753 * @chain: pool of chains
754 * @pending_io_count:
755 * @reset_wq:
756 * @chain_dma:
757 * @max_sges_in_main_message: number sg elements in main message
758 * @max_sges_in_chain_message: number sg elements per chain
759 * @chains_needed_per_io: max chains per io
760 * @chain_offset_value_for_main_message: location 1st sg in main
761 * @chain_depth: total chains allocated
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530762 * @hi_priority_smid:
763 * @hi_priority:
764 * @hi_priority_dma:
765 * @hi_priority_depth:
766 * @hpr_lookup:
767 * @hpr_free_list:
768 * @internal_smid:
769 * @internal:
770 * @internal_dma:
771 * @internal_depth:
772 * @internal_lookup:
773 * @internal_free_list:
Eric Moore635374e2009-03-09 01:21:12 -0600774 * @sense: pool of sense
775 * @sense_dma:
776 * @sense_dma_pool:
777 * @reply_depth: hba reply queue depth:
778 * @reply_sz: per reply frame size:
779 * @reply: pool of replys:
780 * @reply_dma:
781 * @reply_dma_pool:
782 * @reply_free_queue_depth: reply free depth
783 * @reply_free: pool for reply free queue (32 bit addr)
784 * @reply_free_dma:
785 * @reply_free_dma_pool:
786 * @reply_free_host_index: tail index in pool to insert free replys
787 * @reply_post_queue_depth: reply post queue depth
Sreekanth Reddy5fb1bf82014-09-12 15:35:22 +0530788 * @reply_post_struct: struct for reply_post_free physical & virt address
789 * @rdpq_array_capable: FW supports multiple reply queue addresses in ioc_init
790 * @rdpq_array_enable: rdpq_array support is enabled in the driver
791 * @rdpq_array_enable_assigned: this ensures that rdpq_array_enable flag
792 * is assigned only ones
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530793 * @reply_queue_count: number of reply queue's
794 * @reply_queue_list: link list contaning the reply queue info
Eric Moore635374e2009-03-09 01:21:12 -0600795 * @reply_post_host_index: head index in the pool where FW completes IO
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530796 * @delayed_tr_list: target reset link list
797 * @delayed_tr_volume_list: volume target reset link list
Eric Moore635374e2009-03-09 01:21:12 -0600798 */
799struct MPT2SAS_ADAPTER {
800 struct list_head list;
801 struct Scsi_Host *shost;
802 u8 id;
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530803 int cpu_count;
Eric Moore635374e2009-03-09 01:21:12 -0600804 char name[MPT_NAME_LENGTH];
805 char tmp_string[MPT_STRING_LENGTH];
806 struct pci_dev *pdev;
807 Mpi2SystemInterfaceRegs_t __iomem *chip;
Kashyap, Desai6846e752009-12-16 18:51:45 +0530808 resource_size_t chip_phys;
Eric Moore635374e2009-03-09 01:21:12 -0600809 int logging_level;
Kashyap, Desaifa7f3162009-09-23 17:26:58 +0530810 int fwfault_debug;
Eric Moore635374e2009-03-09 01:21:12 -0600811 u8 ir_firmware;
812 int bars;
813 u8 mask_interrupts;
Sreekanth Reddy5fb1bf82014-09-12 15:35:22 +0530814 int dma_mask;
Eric Moore635374e2009-03-09 01:21:12 -0600815
816 /* fw fault handler */
817 char fault_reset_work_q_name[20];
818 struct workqueue_struct *fault_reset_work_q;
819 struct delayed_work fault_reset_work;
820
821 /* fw event handler */
822 char firmware_event_name[20];
823 struct workqueue_struct *firmware_event_thread;
Eric Moore635374e2009-03-09 01:21:12 -0600824 spinlock_t fw_event_lock;
825 struct list_head fw_event_list;
826
827 /* misc flags */
828 int aen_event_read_flag;
829 u8 broadcast_aen_busy;
Kashyap, Desaif93213d2011-06-14 10:56:43 +0530830 u16 broadcast_aen_pending;
Eric Moore635374e2009-03-09 01:21:12 -0600831 u8 shost_recovery;
Kashyap, Desaid2742132010-06-17 13:28:55 +0530832
833 struct mutex reset_in_progress_mutex;
Eric Moore635374e2009-03-09 01:21:12 -0600834 spinlock_t ioc_reset_in_progress_lock;
835 u8 ioc_link_reset_in_progress;
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +0530836 u8 ioc_reset_in_progress_status;
Kashyap, Desaid2742132010-06-17 13:28:55 +0530837
Eric Moore635374e2009-03-09 01:21:12 -0600838 u8 ignore_loginfos;
839 u8 remove_host;
Eric Moore3cb54692010-07-08 14:44:34 -0600840 u8 pci_error_recovery;
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +0530841 u8 wait_for_discovery_to_complete;
842 struct completion port_enable_done;
843 u8 is_driver_loading;
844 u8 port_enable_failed;
845
846 u8 start_scan;
847 u16 start_scan_failed;
Eric Moore635374e2009-03-09 01:21:12 -0600848
849 u8 msix_enable;
850 u16 msix_vector_count;
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530851 u8 *cpu_msix_table;
Joe Lawrence42de5972014-06-25 17:04:06 -0400852 resource_size_t __iomem **reply_post_host_index;
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530853 u16 cpu_msix_table_sz;
Kashyap, Desaid32a8c12010-06-17 13:36:53 +0530854 u32 ioc_reset_count;
nagalakshmi.nandigama@lsi.com845a0e42011-12-01 07:42:04 +0530855 MPT2SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds;
Sreekanth Reddyb4730fb2012-12-18 14:45:30 +0100856 u32 non_operational_loop;
Eric Moore635374e2009-03-09 01:21:12 -0600857
858 /* internal commands, callback index */
859 u8 scsi_io_cb_idx;
860 u8 tm_cb_idx;
861 u8 transport_cb_idx;
Kashyap, Desai744090d2009-10-05 15:56:56 +0530862 u8 scsih_cb_idx;
Eric Moore635374e2009-03-09 01:21:12 -0600863 u8 ctl_cb_idx;
864 u8 base_cb_idx;
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +0530865 u8 port_enable_cb_idx;
Eric Moore635374e2009-03-09 01:21:12 -0600866 u8 config_cb_idx;
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530867 u8 tm_tr_cb_idx;
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530868 u8 tm_tr_volume_cb_idx;
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530869 u8 tm_sas_control_cb_idx;
Eric Moore635374e2009-03-09 01:21:12 -0600870 struct _internal_cmd base_cmds;
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +0530871 struct _internal_cmd port_enable_cmds;
Eric Moore635374e2009-03-09 01:21:12 -0600872 struct _internal_cmd transport_cmds;
Kashyap, Desai744090d2009-10-05 15:56:56 +0530873 struct _internal_cmd scsih_cmds;
Eric Moore635374e2009-03-09 01:21:12 -0600874 struct _internal_cmd tm_cmds;
875 struct _internal_cmd ctl_cmds;
876 struct _internal_cmd config_cmds;
877
878 MPT_ADD_SGE base_add_sg_single;
879
880 /* event log */
881 u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
882 u32 event_context;
883 void *event_log;
884 u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
885
886 /* static config pages */
Kashyap, Desaic97951e2011-06-14 10:54:56 +0530887 struct mpt2sas_facts facts;
888 struct mpt2sas_port_facts *pfacts;
Eric Moore635374e2009-03-09 01:21:12 -0600889 Mpi2ManufacturingPage0_t manu_pg0;
890 Mpi2BiosPage2_t bios_pg2;
891 Mpi2BiosPage3_t bios_pg3;
892 Mpi2IOCPage8_t ioc_pg8;
893 Mpi2IOUnitPage0_t iounit_pg0;
894 Mpi2IOUnitPage1_t iounit_pg1;
895
896 struct _boot_device req_boot_device;
897 struct _boot_device req_alt_boot_device;
898 struct _boot_device current_boot_device;
899
900 /* sas hba, expander, and device list */
901 struct _sas_node sas_hba;
902 struct list_head sas_expander_list;
903 spinlock_t sas_node_lock;
904 struct list_head sas_device_list;
905 struct list_head sas_device_init_list;
906 spinlock_t sas_device_lock;
907 struct list_head raid_device_list;
908 spinlock_t raid_device_lock;
909 u8 io_missing_delay;
910 u16 device_missing_delay;
911 int sas_id;
nagalakshmi.nandigama@lsi.com09da0b32012-03-20 12:06:50 +0530912 void *blocking_handles;
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530913 void *pd_handles;
914 u16 pd_handles_sz;
915
Eric Moore635374e2009-03-09 01:21:12 -0600916 /* config page */
917 u16 config_page_sz;
918 void *config_page;
919 dma_addr_t config_page_dma;
920
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530921 /* scsiio request */
922 u16 hba_queue_depth;
Eric Moore635374e2009-03-09 01:21:12 -0600923 u16 sge_size;
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530924 u16 scsiio_depth;
Eric Moore635374e2009-03-09 01:21:12 -0600925 u16 request_sz;
926 u8 *request;
927 dma_addr_t request_dma;
928 u32 request_dma_sz;
Kashyap, Desaid5bd3491c2011-01-04 11:39:20 +0530929 struct scsiio_tracker *scsi_lookup;
Kashyap, Desai89009fb2010-03-17 16:22:52 +0530930 ulong scsi_lookup_pages;
931 spinlock_t scsi_lookup_lock;
Eric Moore635374e2009-03-09 01:21:12 -0600932 struct list_head free_list;
933 int pending_io_count;
934 wait_queue_head_t reset_wq;
935
936 /* chain */
Kashyap, Desai35f805b2010-11-13 04:34:06 +0530937 struct chain_tracker *chain_lookup;
938 struct list_head free_chain_list;
939 struct dma_pool *chain_dma_pool;
940 ulong chain_pages;
Eric Moore635374e2009-03-09 01:21:12 -0600941 u16 max_sges_in_main_message;
942 u16 max_sges_in_chain_message;
943 u16 chains_needed_per_io;
944 u16 chain_offset_value_for_main_message;
Kashyap, Desai89009fb2010-03-17 16:22:52 +0530945 u32 chain_depth;
Eric Moore635374e2009-03-09 01:21:12 -0600946
Kashyap, Desai595bb0b2009-09-14 11:02:48 +0530947 /* hi-priority queue */
948 u16 hi_priority_smid;
949 u8 *hi_priority;
950 dma_addr_t hi_priority_dma;
951 u16 hi_priority_depth;
952 struct request_tracker *hpr_lookup;
953 struct list_head hpr_free_list;
954
955 /* internal queue */
956 u16 internal_smid;
957 u8 *internal;
958 dma_addr_t internal_dma;
959 u16 internal_depth;
960 struct request_tracker *internal_lookup;
961 struct list_head internal_free_list;
962
Eric Moore635374e2009-03-09 01:21:12 -0600963 /* sense */
964 u8 *sense;
965 dma_addr_t sense_dma;
966 struct dma_pool *sense_dma_pool;
967
968 /* reply */
969 u16 reply_sz;
970 u8 *reply;
971 dma_addr_t reply_dma;
Kashyap, Desaidd3741d2010-11-13 04:31:14 +0530972 u32 reply_dma_max_address;
973 u32 reply_dma_min_address;
Eric Moore635374e2009-03-09 01:21:12 -0600974 struct dma_pool *reply_dma_pool;
975
976 /* reply free queue */
977 u16 reply_free_queue_depth;
Kashyap, Desaic97951e2011-06-14 10:54:56 +0530978 __le32 *reply_free;
Eric Moore635374e2009-03-09 01:21:12 -0600979 dma_addr_t reply_free_dma;
980 struct dma_pool *reply_free_dma_pool;
981 u32 reply_free_host_index;
982
983 /* reply post queue */
984 u16 reply_post_queue_depth;
Sreekanth Reddy5fb1bf82014-09-12 15:35:22 +0530985 struct reply_post_struct *reply_post;
986 u8 rdpq_array_capable;
987 u8 rdpq_array_enable;
988 u8 rdpq_array_enable_assigned;
Eric Moore635374e2009-03-09 01:21:12 -0600989 struct dma_pool *reply_post_free_dma_pool;
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +0530990 u8 reply_queue_count;
991 struct list_head reply_queue_list;
Eric Moore635374e2009-03-09 01:21:12 -0600992
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530993 struct list_head delayed_tr_list;
Kashyap, Desaif3eedd62010-06-17 13:46:13 +0530994 struct list_head delayed_tr_volume_list;
Kashyap, Desai77e63ed2009-09-14 11:04:23 +0530995
Eric Moore635374e2009-03-09 01:21:12 -0600996 /* diag buffer support */
997 u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
998 u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
999 dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
1000 u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
1001 u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
Kashyap, Desaied79f122009-08-20 13:23:49 +05301002 Mpi2ManufacturingPage10_t manu_pg10;
Eric Moore635374e2009-03-09 01:21:12 -06001003 u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
1004 u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
Kashyap, Desai570c67a2010-06-17 13:43:17 +05301005 u32 ring_buffer_offset;
1006 u32 ring_buffer_sz;
Kashyap, Desai0bdccdb2011-04-07 12:32:49 +05301007 u8 is_warpdrive;
1008 u8 hide_ir_msg;
1009 u8 mfg_pg10_hide_flag;
1010 u8 hide_drives;
1011
Eric Moore635374e2009-03-09 01:21:12 -06001012};
1013
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301014typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
1015 u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001016
1017
1018/* base shared API */
Eric Mooreba33fad2009-03-15 21:37:18 -06001019extern struct list_head mpt2sas_ioc_list;
Kashyap, Desaie4750c92009-08-07 19:37:59 +05301020void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
1021void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
Eric Moore635374e2009-03-09 01:21:12 -06001022
1023int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
1024void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
1025int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc);
1026void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc);
1027int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
1028 enum reset_type type);
1029
1030void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid);
1031void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
1032void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
Kashyap, Desaiec9472c2009-09-23 17:34:13 +05301033__le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc,
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301034 u16 smid);
nagalakshmi.nandigama@lsi.com911ae942011-09-08 06:18:50 +05301035void mpt2sas_base_flush_reply_queues(struct MPT2SAS_ADAPTER *ioc);
Eric Moore635374e2009-03-09 01:21:12 -06001036
Kashyap, Desai595bb0b2009-09-14 11:02:48 +05301037/* hi-priority queue */
1038u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
1039u16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
1040 struct scsi_cmnd *scmd);
1041
Eric Moore635374e2009-03-09 01:21:12 -06001042u16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
1043void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid);
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301044void mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid,
Eric Moore635374e2009-03-09 01:21:12 -06001045 u16 handle);
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301046void mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid);
Eric Moore635374e2009-03-09 01:21:12 -06001047void mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301048 u16 io_index);
1049void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid);
Eric Moore635374e2009-03-09 01:21:12 -06001050void mpt2sas_base_initialize_callback_handler(void);
1051u8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func);
1052void mpt2sas_base_release_callback_handler(u8 cb_idx);
1053
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301054u8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301055 u32 reply);
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +05301056u8 mpt2sas_port_enable_done(struct MPT2SAS_ADAPTER *ioc, u16 smid,
1057 u8 msix_index, u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001058void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr);
1059
1060u32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked);
1061
1062void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code);
1063int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
1064 Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t
1065 *mpi_request);
1066int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
1067 Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
1068void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type);
1069
Kashyap, Desaifa7f3162009-09-23 17:26:58 +05301070void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc);
1071
Reddy, Sreekanthb0df96a02013-02-26 16:59:59 +05301072void mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc,
1073 u16 device_missing_delay, u8 io_missing_delay);
1074
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +05301075int mpt2sas_port_enable(struct MPT2SAS_ADAPTER *ioc);
1076
Eric Moore635374e2009-03-09 01:21:12 -06001077/* scsih shared API */
Sreekanth Reddy6409a7d2013-07-25 11:24:35 +05301078void mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301079 u32 reply);
Kashyap, Desai8ed9a032010-03-17 16:25:59 +05301080int mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle,
Kashyap, Desaif93213d2011-06-14 10:56:43 +05301081 uint channel, uint id, uint lun, u8 type, u16 smid_task,
Matthew Wilcox2e45c8b2014-03-27 16:40:32 -04001082 ulong timeout, enum mutex_type m_type);
Eric Moore635374e2009-03-09 01:21:12 -06001083void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
1084void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
Kashyap, Desai7f6f7942010-11-13 04:35:30 +05301085void mpt2sas_expander_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
nagalakshmi.nandigama@lsi.com09da0b32012-03-20 12:06:50 +05301086void mpt2sas_device_remove_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
1087 u64 sas_address);
Eric Moore635374e2009-03-09 01:21:12 -06001088struct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc,
1089 u16 handle);
1090struct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
1091 *ioc, u64 sas_address);
1092struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address(
1093 struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
1094
nagalakshmi.nandigama@lsi.com921cd802011-10-19 15:36:26 +05301095void mpt2sas_port_enable_complete(struct MPT2SAS_ADAPTER *ioc);
1096
Eric Moore635374e2009-03-09 01:21:12 -06001097void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
1098
1099/* config shared API */
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301100u8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301101 u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001102int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys);
1103int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
1104 Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
Kashyap, Desaied79f122009-08-20 13:23:49 +05301105int mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc,
1106 Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page);
Eric Moore635374e2009-03-09 01:21:12 -06001107int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1108 *mpi_reply, Mpi2BiosPage2_t *config_page);
1109int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1110 *mpi_reply, Mpi2BiosPage3_t *config_page);
1111int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1112 *mpi_reply, Mpi2IOUnitPage0_t *config_page);
1113int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1114 *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle);
1115int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1116 *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle);
1117int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1118 *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz);
1119int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1120 *mpi_reply, Mpi2IOUnitPage1_t *config_page);
1121int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
Kashyap, Desai5b768582009-08-20 13:24:31 +05301122 *mpi_reply, Mpi2IOUnitPage1_t *config_page);
sreekanth.reddy@lsi.com6c265662012-07-17 15:56:07 +05301123int mpt2sas_config_get_iounit_pg3(struct MPT2SAS_ADAPTER *ioc,
1124 Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz);
Eric Moore635374e2009-03-09 01:21:12 -06001125int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1126 *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
Kashyap, Desai50d5c602009-12-16 18:55:26 +05301127int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
1128 Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
Eric Moore635374e2009-03-09 01:21:12 -06001129int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1130 *mpi_reply, Mpi2IOCPage8_t *config_page);
1131int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1132 *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle);
1133int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1134 *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle);
1135int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1136 *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle);
1137int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1138 *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
1139int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1140 *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
1141int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1142 *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle);
1143int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds);
1144int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1145 *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz);
1146int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1147 *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form,
1148 u32 form_specific);
1149int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
1150 u16 *volume_handle);
1151int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle,
1152 u64 *wwid);
Eric Moore635374e2009-03-09 01:21:12 -06001153/* ctl shared API */
1154extern struct device_attribute *mpt2sas_host_attrs[];
1155extern struct device_attribute *mpt2sas_dev_attrs[];
1156void mpt2sas_ctl_init(void);
1157void mpt2sas_ctl_exit(void);
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301158u8 mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301159 u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001160void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
Sreekanth Reddy6409a7d2013-07-25 11:24:35 +05301161void mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
Kashyap, Desai7b936b02009-09-25 11:44:41 +05301162 u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001163void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
1164 Mpi2EventNotificationReply_t *mpi_reply);
1165
Kashyap, Desai32e0eb52009-09-23 17:28:09 +05301166void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
1167 u8 bits_to_regsiter);
1168
Eric Moore635374e2009-03-09 01:21:12 -06001169/* transport shared API */
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301170u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
1171 u32 reply);
Eric Moore635374e2009-03-09 01:21:12 -06001172struct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc,
Kashyap, Desaic5e039b2009-09-23 17:21:29 +05301173 u16 handle, u64 sas_address);
Eric Moore635374e2009-03-09 01:21:12 -06001174void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
Kashyap, Desaic5e039b2009-09-23 17:21:29 +05301175 u64 sas_address_parent);
Eric Moore635374e2009-03-09 01:21:12 -06001176int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
1177 *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
1178int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
1179 *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev);
Kashyap, Desaic5e039b2009-09-23 17:21:29 +05301180void mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
1181 u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
Eric Moore635374e2009-03-09 01:21:12 -06001182extern struct sas_function_template mpt2sas_transport_functions;
1183extern struct scsi_transport_template *mpt2sas_transport_template;
Kashyap, Desai34a03be2009-08-20 13:23:19 +05301184extern int scsi_internal_device_block(struct scsi_device *sdev);
Kashyap, Desai77e63ed2009-09-14 11:04:23 +05301185extern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc,
1186 u8 msix_index, u32 reply);
Mike Christie5d9fb5c2012-05-17 23:56:57 -05001187extern int scsi_internal_device_unblock(struct scsi_device *sdev,
1188 enum scsi_device_state new_state);
Eric Moore635374e2009-03-09 01:21:12 -06001189
1190#endif /* MPT2SAS_BASE_H_INCLUDED */