mpt2sas_base.h revision 38c2911449b19664e0dc46132a7b4cb249ff5e06
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"
721a7d7eac6f651c00e954023dd2542f0c65ef66b7Kashyap, Desai#define MPT2SAS_DRIVER_VERSION		"05.100.00.00"
731a7d7eac6f651c00e954023dd2542f0c65ef66b7Kashyap, Desai#define MPT2SAS_MAJOR_VERSION		05
74635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_MINOR_VERSION		100
751a7d7eac6f651c00e954023dd2542f0c65ef66b7Kashyap, Desai#define MPT2SAS_BUILD_VERSION		00
761a7d7eac6f651c00e954023dd2542f0c65ef66b7Kashyap, 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_DEBUG_FMT		KERN_DEBUG MPT2SAS_FMT
128635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_INFO_FMT		KERN_INFO MPT2SAS_FMT
129635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_NOTE_FMT		KERN_NOTICE MPT2SAS_FMT
130635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_WARN_FMT		KERN_WARNING MPT2SAS_FMT
131635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2SAS_ERR_FMT			KERN_ERR MPT2SAS_FMT
132635374e7eb110e80d9918b8611198edd56a32975Eric Moore
133635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
134f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore * Dell HBA branding
135f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore */
136f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_BRANDING_SIZE                 32
137f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
138f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING        "Dell 6Gbps SAS HBA"
139f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING    "Dell PERC H200 Adapter"
140f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
141f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING    "Dell PERC H200 Modular"
142f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING   "Dell PERC H200 Embedded"
143f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_BRANDING            "Dell PERC H200"
144f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_BRANDING            "Dell 6Gbps SAS"
145f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
146f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore/*
147f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore * Dell HBA SSDIDs
148f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore */
149f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID           0x1F1C
150f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID       0x1F1D
151f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID    0x1F1E
152f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID       0x1F1F
153f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID      0x1F20
154f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_PERC_H200_SSDID               0x1F21
155f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore#define MPT2SAS_DELL_6GBPS_SAS_SSDID               0x1F22
156f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore
157f0f9cc1fb8a21f3ff90900505fc82a43d29d0975Eric Moore/*
158635374e7eb110e80d9918b8611198edd56a32975Eric Moore * per target private data
159635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
160635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_RAID_COMPONENT	0x01
161635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_VOLUME		0x02
162635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_TARGET_FLAGS_DELETED	0x04
163635374e7eb110e80d9918b8611198edd56a32975Eric Moore
164635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
165635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_TARGET - starget private hostdata
166635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
167635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: target sas address
168635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
169635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_luns: number luns
170635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @flags: MPT_TARGET_FLAGS_XXX flags
171635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @deleted: target flaged for deletion
172635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_busy: target is busy with TM request.
173635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
174635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_TARGET {
175635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
176635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
177635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
178635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	num_luns;
179635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	flags;
180635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	deleted;
181635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	tm_busy;
182635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
183635374e7eb110e80d9918b8611198edd56a32975Eric Moore
184635374e7eb110e80d9918b8611198edd56a32975Eric Moore/*
185635374e7eb110e80d9918b8611198edd56a32975Eric Moore * per device private data
186635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
187635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_DEVICE_FLAGS_INIT		0x01
188635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT_DEVICE_TLR_ON		0x02
189635374e7eb110e80d9918b8611198edd56a32975Eric Moore
190635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
191635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_DEVICE - sdev private hostdata
192635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_target: starget private hostdata
193635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @lun: lun number
194635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @flags: MPT_DEVICE_XXX flags
195635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @configured_lun: lun is configured
196635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @block: device is in SDEV_BLOCK state
197635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tlr_snoop_check: flag used in determining whether to disable TLR
198635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
199ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
200ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* OEM Identifiers */
201ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_INVALID                   (0x00000000)
202ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_DELL                      (0x00000001)
203ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_FSC                       (0x00000002)
204ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_SUN                       (0x00000003)
205ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_OEM_ID_IBM                       (0x00000004)
206ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
207ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* GENERIC Flags 0*/
208ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_OCE_DISABLED                 (0x00000001)
209ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_R1E_DRIVE_COUNT              (0x00000002)
210ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_R10_DISPLAY                  (0x00000004)
211ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_SSD_DATA_SCRUB_DISABLE       (0x00000008)
212ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai#define MFG10_GF0_SINGLE_DRIVE_R0              (0x00000010)
213ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
214ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai/* OEM Specific Flags will come from OEM specific header files */
215ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desaitypedef struct _MPI2_CONFIG_PAGE_MAN_10 {
216ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    MPI2_CONFIG_PAGE_HEADER Header;                                 /* 00h */
217ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U8                      OEMIdentifier;                          /* 04h */
218ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U8                      Reserved1;                              /* 05h */
219ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U16                     Reserved2;                              /* 08h */
220ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved3;                              /* 0Ch */
221ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     GenericFlags0;                          /* 10h */
222ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     GenericFlags1;                          /* 14h */
223ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved4;                              /* 18h */
224ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     OEMSpecificFlags0;                      /* 1Ch */
225ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     OEMSpecificFlags1;                      /* 20h */
226ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    U32                     Reserved5[18];                          /* 24h-60h*/
227ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai} MPI2_CONFIG_PAGE_MAN_10,
228ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai  MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10,
229ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai  Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t;
230ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai
231635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_DEVICE {
232635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct MPT2SAS_TARGET *sas_target;
233635374e7eb110e80d9918b8611198edd56a32975Eric Moore	unsigned int	lun;
234635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	flags;
235635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	configured_lun;
236635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	block;
237635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	tlr_snoop_check;
238635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
239635374e7eb110e80d9918b8611198edd56a32975Eric Moore
240635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_NOT_USED	0x8000	/* free */
241635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_COMPLETE	0x0001	/* completed */
242635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_PENDING	0x0002	/* pending */
243635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_REPLY_VALID	0x0004	/* reply is valid */
244635374e7eb110e80d9918b8611198edd56a32975Eric Moore#define MPT2_CMD_RESET		0x0008	/* host reset dropped the command */
245635374e7eb110e80d9918b8611198edd56a32975Eric Moore
246635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
247635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _internal_cmd - internal commands struct
248635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @mutex: mutex
249635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @done: completion
250635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply: reply message pointer
251635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @status: MPT2_CMD_XXX status
252635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @smid: system message id
253635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
254635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _internal_cmd {
255635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct mutex mutex;
256635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct completion done;
257635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void 	*reply;
258635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	status;
259635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	smid;
260635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
261635374e7eb110e80d9918b8611198edd56a32975Eric Moore
262595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
263635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
264635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_device - attached device information
265635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: sas device list
266635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
267635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: device sas address
268635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_name: retrieved from the SAS IDENTIFY frame.
269635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
270c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai * @sas_address_parent: sas address of parent expander or sas host
271635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_handle: enclosure handle
272635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_logical_id: enclosure logical identifier
273635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_handle: volume handle (valid when hidden raid member)
274635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_wwid: volume unique identifier
275635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitfield provides detailed info about the device
276635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: target id
277635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @channel: target channel
278635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @slot: number number
279635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @hidden_raid_component: set to 1 when this is a raid member
280635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_sas_device_mark_responding
281635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
282635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_device {
283635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
284635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
285635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
286635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	device_name;
287635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
288c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai	u64	sas_address_parent;
289635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	enclosure_handle;
290635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	enclosure_logical_id;
291635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	volume_handle;
292635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	volume_wwid;
293635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	device_info;
294635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	id;
295635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	channel;
296635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	slot;
297635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	hidden_raid_component;
298635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
299635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
300635374e7eb110e80d9918b8611198edd56a32975Eric Moore
301635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
302635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _raid_device - raid volume link list
303635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: sas device list
304635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @starget: starget object
305635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sdev: scsi device struct (volumes are single lun)
306635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @wwid: unique identifier for the volume
307635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle
308635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: target id
309635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @channel: target channel
310635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @volume_type: the raid level
311635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitfield provides detailed info about the hidden components
312635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_pds: number of hidden raid components
313635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_raid_device_mark_responding
314f7c95ef02b564d9984c0655c9659791b1dd5d7adKashyap, Desai * @percent_complete: resync percent complete
315635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
316635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _raid_device {
317635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
318635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_target *starget;
319635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_device *sdev;
320635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	wwid;
321635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
322635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	id;
323635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int	channel;
324635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	volume_type;
325635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32	device_info;
326635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_pds;
327635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
328f7c95ef02b564d9984c0655c9659791b1dd5d7adKashyap, Desai	u8	percent_complete;
329635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
330635374e7eb110e80d9918b8611198edd56a32975Eric Moore
331635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
332635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _boot_device - boot device info
333635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @is_raid: flag to indicate whether this is volume
334635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device: holds pointer for either struct _sas_device or
335635374e7eb110e80d9918b8611198edd56a32975Eric Moore *     struct _raid_device
336635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
337635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _boot_device {
338635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8 is_raid;
339635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void *device;
340635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
341635374e7eb110e80d9918b8611198edd56a32975Eric Moore
342635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
343635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_port - wide/narrow sas port information
344635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port_list: list of ports belonging to expander
345635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_phys: number of phys belonging to this port
346635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remote_identify: attached device identification
347635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @rphy: sas transport rphy object
348635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port: sas transport wide/narrow port object
349635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy_list: _sas_phy list objects belonging to this port
350635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
351635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_port {
352635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head port_list;
353635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_phys;
354635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify remote_identify;
355635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_rphy *rphy;
356635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_port *port;
357635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head phy_list;
358635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
359635374e7eb110e80d9918b8611198edd56a32975Eric Moore
360635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
361635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_phy - phy information
362635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @port_siblings: list of phys belonging to a port
363635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @identify: phy identification
364635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remote_identify: attached device identification
365635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy: sas transport phy object
366635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy_id: unique phy id
367635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: device handle for this phy
368635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @attached_handle: device handle for attached device
36938c2911449b19664e0dc46132a7b4cb249ff5e06Kashyap, Desai * @phy_belongs_to_port: port has been created for this phy
370635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
371635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_phy {
372635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head port_siblings;
373635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify identify;
374635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_identify remote_identify;
375635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct sas_phy *phy;
376635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	phy_id;
377635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
378635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	attached_handle;
37938c2911449b19664e0dc46132a7b4cb249ff5e06Kashyap, Desai	u8	phy_belongs_to_port;
380635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
381635374e7eb110e80d9918b8611198edd56a32975Eric Moore
382635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
383635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct _sas_node - sas_host/expander information
384635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: list of expanders
385635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @parent_dev: parent device class
386635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @num_phys: number phys belonging to this sas_host/expander
387635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_address: sas address of this sas_host/expander
388635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @handle: handle for this sas_host/expander
389c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai * @sas_address_parent: sas address of parent expander or sas host
390635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @enclosure_handle: handle for this a member of an enclosure
391635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_info: bitwise defining capabilities of this sas_host/expander
392635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @responding: used in _scsih_expander_device_mark_responding
393635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @phy: a list of phys that make up this sas_host/expander
394635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_port_list: list of ports attached to this sas_host/expander
395635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
396635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node {
397635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
398635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct device *parent_dev;
399635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	num_phys;
400635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	sas_address;
401635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	handle;
402c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai	u64	sas_address_parent;
403635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	enclosure_handle;
404635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u64	enclosure_logical_id;
405635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	responding;
406635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct	_sas_phy *phy;
407635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_port_list;
408635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
409635374e7eb110e80d9918b8611198edd56a32975Eric Moore
410635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
411635374e7eb110e80d9918b8611198edd56a32975Eric Moore * enum reset_type - reset state
412635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @FORCE_BIG_HAMMER: issue diagnostic reset
413635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
414635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
415635374e7eb110e80d9918b8611198edd56a32975Eric Mooreenum reset_type {
416635374e7eb110e80d9918b8611198edd56a32975Eric Moore	FORCE_BIG_HAMMER,
417635374e7eb110e80d9918b8611198edd56a32975Eric Moore	SOFT_RESET,
418635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
419635374e7eb110e80d9918b8611198edd56a32975Eric Moore
420635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
421635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct request_tracker - firmware request tracker
422635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @smid: system message id
423635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scmd: scsi request pointer
424635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @cb_idx: callback index
425635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_list: list of chains associated to this IO
426635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tracker_list: list of free request (ioc->free_list)
427635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
428635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct request_tracker {
429635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16	smid;
430635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct scsi_cmnd *scmd;
431635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8	cb_idx;
432635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head tracker_list;
433635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
434635374e7eb110e80d9918b8611198edd56a32975Eric Moore
43577e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai/**
43677e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * struct _tr_list - target reset list
43777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * @handle: device handle
43877e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai * @state: state machine
43977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai */
44077e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaistruct _tr_list {
44177e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	struct list_head list;
44277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u16	handle;
44377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u16	state;
44477e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai};
44577e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai
446635374e7eb110e80d9918b8611198edd56a32975Eric Mooretypedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
447635374e7eb110e80d9918b8611198edd56a32975Eric Moore
448635374e7eb110e80d9918b8611198edd56a32975Eric Moore/**
449635374e7eb110e80d9918b8611198edd56a32975Eric Moore * struct MPT2SAS_ADAPTER - per adapter struct
450635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @list: ioc_list
451635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @shost: shost object
452635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @id: unique adapter id
453635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pci_irq: irq number
454635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @name: generic ioc string
455635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tmp_string: tmp string used for logging
456635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pdev: pci pdev object
457635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chip: memory mapped register space
458635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chip_phys: physical addrss prior to mapping
459635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @logging_level: see mpt2sas_debug.h
460fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai * @fwfault_debug: debuging FW timeouts
461635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ir_firmware: IR firmware present
462635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bars: bitmask of BAR's that must be configured
463635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @mask_interrupts: ignore interrupt
464635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work_q_name: fw fault work queue
465635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work_q: ""
466635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fault_reset_work: ""
467635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @firmware_event_name: fw event work queue
468635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @firmware_event_thread: ""
469635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_events_off: flag to turn off fw event handling
470635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_event_lock:
471635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @fw_event_list: list of fw events
472635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @aen_event_read_flag: event log was read
473635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @broadcast_aen_busy: broadcast aen waiting to be serviced
474155dd4c763694222c125e65438d823f58ea653bcKashyap, Desai * @shost_recovery: host reset in progress
475635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_reset_in_progress_lock:
476635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_link_reset_in_progress: phy/hard reset in progress
477635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ignore_loginfos: ignore loginfos during task managment
478635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @remove_host: flag for when driver unloads, to avoid sending dev resets
479635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @wait_for_port_enable_to_complete:
480635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_enable: flag indicating msix is enabled
481635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_vector_count: number msix vectors
482635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_table: virt address to the msix table
483635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @msix_table_backup: backup msix table
484635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_io_cb_idx: shost generated commands
485635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_cb_idx: task management commands
486744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai * @scsih_cb_idx: scsih internal commands
487635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @transport_cb_idx: transport internal commands
488635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ctl_cb_idx: clt internal commands
489635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_cb_idx: base internal commands
490635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_cb_idx: base internal commands
491635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_cmds:
492635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @transport_cmds:
493744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai * @scsih_cmds:
494635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @tm_cmds:
495635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ctl_cmds:
496635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_cmds:
497635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @base_add_sg_single: handler for either 32/64 bit sgl's
498635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_type: bits indicating which events to log
499635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_context: unique id for each logged event
500635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_log: event log pointer
501635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @event_masks: events that are masked
502635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @facts: static facts data
503635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pfacts: static port facts data
504635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @manu_pg0: static manufacturing page 0
505ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai * @manu_pg10: static manufacturing page 10
506635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bios_pg2: static bios page 2
507635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @bios_pg3: static bios page 3
508635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @ioc_pg8: static ioc page 8
509635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @iounit_pg0: static iounit page 0
510635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @iounit_pg1: static iounit page 1
511635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_hba: sas host object
512635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_expander_list: expander object list
513635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_node_lock:
514635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_list: sas device object list
515635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_init_list: sas device object list (used only at init time)
516635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sas_device_lock:
517635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @io_missing_delay: time for IO completed by fw when PDR enabled
518635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @device_missing_delay: time for device missing by fw when PDR enabled
519635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page_sz: config page size
520635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page: reserve memory for config page payload
521635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @config_page_dma:
522595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hba_queue_depth: hba request queue depth
523635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sge_size: sg element size for either 32/64 bit
524595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @scsiio_depth: SCSI_IO queue depth
525635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_sz: per request frame size
526635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request: pool of request frames
527635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_dma:
528635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @request_dma_sz:
529635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_lookup: firmware request tracker list
530635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @scsi_lookup_lock:
531635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @free_list: free list of request
532635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain: pool of chains
533635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @pending_io_count:
534635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reset_wq:
535635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_dma:
536635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @max_sges_in_main_message: number sg elements in main message
537635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @max_sges_in_chain_message: number sg elements per chain
538635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chains_needed_per_io: max chains per io
539635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_offset_value_for_main_message: location 1st sg in main
540635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @chain_depth: total chains allocated
541595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_smid:
542595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority:
543595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_dma:
544595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hi_priority_depth:
545595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hpr_lookup:
546595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @hpr_free_list:
547595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_smid:
548595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal:
549595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_dma:
550595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_depth:
551595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_lookup:
552595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai * @internal_free_list:
553635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense: pool of sense
554635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense_dma:
555635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @sense_dma_pool:
556635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_depth: hba reply queue depth:
557635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_sz: per reply frame size:
558635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply: pool of replys:
559635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_dma:
560635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_dma_pool:
561635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_queue_depth: reply free depth
562635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free: pool for reply free queue (32 bit addr)
563635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_dma:
564635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_dma_pool:
565635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_free_host_index: tail index in pool to insert free replys
566635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_queue_depth: reply post queue depth
567635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free: pool for reply post (64bit descriptor)
568635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free_dma:
569635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_free_dma_pool:
570635374e7eb110e80d9918b8611198edd56a32975Eric Moore * @reply_post_host_index: head index in the pool where FW completes IO
571635374e7eb110e80d9918b8611198edd56a32975Eric Moore */
572635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct MPT2SAS_ADAPTER {
573635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head list;
574635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct Scsi_Host *shost;
575635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		id;
576635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		pci_irq;
577635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		name[MPT_NAME_LENGTH];
578635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		tmp_string[MPT_STRING_LENGTH];
579635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct pci_dev	*pdev;
580635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2SystemInterfaceRegs_t __iomem *chip;
5816846e75cdfa76c6609ac0381a6739c9f4af8fd3bKashyap, Desai	resource_size_t	chip_phys;
582635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		logging_level;
583fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai	int		fwfault_debug;
584635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ir_firmware;
585635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		bars;
586635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		mask_interrupts;
587635374e7eb110e80d9918b8611198edd56a32975Eric Moore
588635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* fw fault handler */
589635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		fault_reset_work_q_name[20];
590635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct workqueue_struct *fault_reset_work_q;
591635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct delayed_work fault_reset_work;
592635374e7eb110e80d9918b8611198edd56a32975Eric Moore
593635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* fw event handler */
594635374e7eb110e80d9918b8611198edd56a32975Eric Moore	char		firmware_event_name[20];
595635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct workqueue_struct	*firmware_event_thread;
596635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	fw_event_lock;
597635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head fw_event_list;
598635374e7eb110e80d9918b8611198edd56a32975Eric Moore
599635374e7eb110e80d9918b8611198edd56a32975Eric Moore	 /* misc flags */
600635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		aen_event_read_flag;
601635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		broadcast_aen_busy;
602635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		shost_recovery;
603f1c35e6aea579d5bdb6dc02dfa99c67c7c3b3f67Kashyap, Desai	struct completion	shost_recovery_done;
604635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t 	ioc_reset_in_progress_lock;
605635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ioc_link_reset_in_progress;
606635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ignore_loginfos;
607635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		remove_host;
608635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		wait_for_port_enable_to_complete;
609635374e7eb110e80d9918b8611198edd56a32975Eric Moore
610635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		msix_enable;
611635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		msix_vector_count;
612635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*msix_table;
613635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*msix_table_backup;
614635374e7eb110e80d9918b8611198edd56a32975Eric Moore
615635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* internal commands, callback index */
616635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		scsi_io_cb_idx;
617635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		tm_cb_idx;
618635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		transport_cb_idx;
619744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai	u8		scsih_cb_idx;
620635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		ctl_cb_idx;
621635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		base_cb_idx;
622635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		config_cb_idx;
62377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u8		tm_tr_cb_idx;
62477e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	u8		tm_sas_control_cb_idx;
625635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd base_cmds;
626635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd transport_cmds;
627744090d38b47ed8ead8f68b6f0c65866c0b9b17aKashyap, Desai	struct _internal_cmd scsih_cmds;
628635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd tm_cmds;
629635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd ctl_cmds;
630635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _internal_cmd config_cmds;
631635374e7eb110e80d9918b8611198edd56a32975Eric Moore
632635374e7eb110e80d9918b8611198edd56a32975Eric Moore	MPT_ADD_SGE	base_add_sg_single;
633635374e7eb110e80d9918b8611198edd56a32975Eric Moore
634635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* event log */
635635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
636635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_context;
637635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void		*event_log;
638635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
639635374e7eb110e80d9918b8611198edd56a32975Eric Moore
640635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* static config pages */
641635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOCFactsReply_t facts;
642635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2PortFactsReply_t *pfacts;
643635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2ManufacturingPage0_t manu_pg0;
644635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2BiosPage2_t	bios_pg2;
645635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2BiosPage3_t	bios_pg3;
646635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOCPage8_t ioc_pg8;
647635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOUnitPage0_t iounit_pg0;
648635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2IOUnitPage1_t iounit_pg1;
649635374e7eb110e80d9918b8611198edd56a32975Eric Moore
650635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device req_boot_device;
651635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device req_alt_boot_device;
652635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _boot_device current_boot_device;
653635374e7eb110e80d9918b8611198edd56a32975Eric Moore
654635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* sas hba, expander, and device list */
655635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct _sas_node sas_hba;
656635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_expander_list;
657635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	sas_node_lock;
658635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_device_list;
659635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head sas_device_init_list;
660635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	sas_device_lock;
661635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head raid_device_list;
662635374e7eb110e80d9918b8611198edd56a32975Eric Moore	spinlock_t	raid_device_lock;
663635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		io_missing_delay;
664635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		device_missing_delay;
665635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		sas_id;
666635374e7eb110e80d9918b8611198edd56a32975Eric Moore
667635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* config page */
668635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		config_page_sz;
669635374e7eb110e80d9918b8611198edd56a32975Eric Moore	void 		*config_page;
670635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	config_page_dma;
671635374e7eb110e80d9918b8611198edd56a32975Eric Moore
672595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* scsiio request */
673595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hba_queue_depth;
674635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		sge_size;
675595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16 		scsiio_depth;
676635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		request_sz;
677635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*request;
678635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	request_dma;
679635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		request_dma_sz;
680635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct request_tracker *scsi_lookup;
68189009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	ulong		scsi_lookup_pages;
68289009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	spinlock_t 	scsi_lookup_lock;
683635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct list_head free_list;
684635374e7eb110e80d9918b8611198edd56a32975Eric Moore	int		pending_io_count;
685635374e7eb110e80d9918b8611198edd56a32975Eric Moore	wait_queue_head_t reset_wq;
686635374e7eb110e80d9918b8611198edd56a32975Eric Moore
687635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* chain */
688635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*chain;
689635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	chain_dma;
690635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		max_sges_in_main_message;
691635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		max_sges_in_chain_message;
692635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		chains_needed_per_io;
693635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		chain_offset_value_for_main_message;
69489009fbb7d2df37536c8dc932fdead4189783f92Kashyap, Desai	u32		chain_depth;
695635374e7eb110e80d9918b8611198edd56a32975Eric Moore
696595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* hi-priority queue */
697595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hi_priority_smid;
698595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u8		*hi_priority;
699595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	dma_addr_t	hi_priority_dma;
700595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		hi_priority_depth;
701595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct request_tracker *hpr_lookup;
702595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct list_head hpr_free_list;
703595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
704595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	/* internal queue */
705595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		internal_smid;
706595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u8		*internal;
707595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	dma_addr_t	internal_dma;
708595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	u16		internal_depth;
709595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct request_tracker *internal_lookup;
710595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai	struct list_head internal_free_list;
711595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
712635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* sense */
713635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*sense;
714635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	sense_dma;
715635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *sense_dma_pool;
716635374e7eb110e80d9918b8611198edd56a32975Eric Moore
717635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply */
718635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16		reply_sz;
719635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*reply;
720635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_dma;
721635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_dma_pool;
722635374e7eb110e80d9918b8611198edd56a32975Eric Moore
723635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply free queue */
724635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		reply_free_queue_depth;
725635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		*reply_free;
726635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_free_dma;
727635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_free_dma_pool;
728635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		reply_free_host_index;
729635374e7eb110e80d9918b8611198edd56a32975Eric Moore
730635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* reply post queue */
731635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u16 		reply_post_queue_depth;
732635374e7eb110e80d9918b8611198edd56a32975Eric Moore	Mpi2ReplyDescriptorsUnion_t *reply_post_free;
733635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	reply_post_free_dma;
734635374e7eb110e80d9918b8611198edd56a32975Eric Moore	struct dma_pool *reply_post_free_dma_pool;
735635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		reply_post_host_index;
736635374e7eb110e80d9918b8611198edd56a32975Eric Moore
73777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai	struct list_head delayed_tr_list;
73877e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai
739635374e7eb110e80d9918b8611198edd56a32975Eric Moore	/* diag buffer support */
740635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		*diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
741635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
742635374e7eb110e80d9918b8611198edd56a32975Eric Moore	dma_addr_t	diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
743635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u8		diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
744635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
745ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai	Mpi2ManufacturingPage10_t manu_pg10;
746635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
747635374e7eb110e80d9918b8611198edd56a32975Eric Moore	u32		diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
748635374e7eb110e80d9918b8611198edd56a32975Eric Moore};
749635374e7eb110e80d9918b8611198edd56a32975Eric Moore
75077e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaitypedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
75177e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
752635374e7eb110e80d9918b8611198edd56a32975Eric Moore
753635374e7eb110e80d9918b8611198edd56a32975Eric Moore
754635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* base shared API */
755ba33fadfabe88e838e73c76a6ff59546f5f6b92bEric Mooreextern struct list_head mpt2sas_ioc_list;
756e4750c989f732555fca86dd73d488c79972362dbKashyap, Desaivoid mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
757e4750c989f732555fca86dd73d488c79972362dbKashyap, Desaivoid mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
758635374e7eb110e80d9918b8611198edd56a32975Eric Moore
759635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
760635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
761635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc);
762635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc);
763635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
764635374e7eb110e80d9918b8611198edd56a32975Eric Moore    enum reset_type type);
765635374e7eb110e80d9918b8611198edd56a32975Eric Moore
766635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid);
767635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
768635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
769ec9472c74c3074541ea8389517f406b5c7ad0632Kashyap, Desai__le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc,
77077e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u16 smid);
771635374e7eb110e80d9918b8611198edd56a32975Eric Moore
772595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai/* hi-priority queue */
773595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desaiu16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
774595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desaiu16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
775595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai    struct scsi_cmnd *scmd);
776595bb0bd62edb28a965993d90e0fa1285560ce53Kashyap, Desai
777635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
778635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid);
7797b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid,
780635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 handle);
7817b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid);
782635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
7837b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u16 io_index);
7847b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desaivoid mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid);
785635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_initialize_callback_handler(void);
786635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func);
787635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_release_callback_handler(u8 cb_idx);
788635374e7eb110e80d9918b8611198edd56a32975Eric Moore
78977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
7907b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
791635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr);
792635374e7eb110e80d9918b8611198edd56a32975Eric Moore
793635374e7eb110e80d9918b8611198edd56a32975Eric Mooreu32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked);
794635374e7eb110e80d9918b8611198edd56a32975Eric Moore
795635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code);
796635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
797635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t
798635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_request);
799635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
800635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
801635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type);
802635374e7eb110e80d9918b8611198edd56a32975Eric Moore
803fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desaivoid mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc);
804fa7f31673583a6e0876f8bb420735cdd8a3ffa57Kashyap, Desai
805635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* scsih shared API */
80677e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
80777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
8088ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desaiint mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle,
8098ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desai    uint channel, uint id, uint lun, u8 type, u16 smid_task,
8108ed9a03ad4c1b6c5ae163e5e9f140852be0273a1Kashyap, Desai    ulong timeout, struct scsi_cmnd *scmd);
811635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
812635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
813635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc,
814635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 handle);
815635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
816635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *ioc, u64 sas_address);
817635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address(
818635374e7eb110e80d9918b8611198edd56a32975Eric Moore    struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
819635374e7eb110e80d9918b8611198edd56a32975Eric Moore
820635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
821635374e7eb110e80d9918b8611198edd56a32975Eric Moore
822635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* config shared API */
82377e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
8247b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
825635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys);
826635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
827635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
828ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desaiint mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc,
829ed79f1280d1bc54f168abcffc8c3e0bf8ffb1873Kashyap, Desai    Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page);
830635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
831635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2BiosPage2_t *config_page);
832635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
833635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2BiosPage3_t *config_page);
834635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
835635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOUnitPage0_t *config_page);
836635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
837635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle);
838635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
839635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle);
840635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
841635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz);
842635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
843635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOUnitPage1_t *config_page);
844635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
8455b768581ea722172f059ad5a5eebea9008961af0Kashyap, Desai    *mpi_reply, Mpi2IOUnitPage1_t *config_page);
846635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
847635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
84850d5c60634673a79f8d88564e10345b50fca7378Kashyap, Desaiint mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
84950d5c60634673a79f8d88564e10345b50fca7378Kashyap, Desai    Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
850635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
851635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2IOCPage8_t *config_page);
852635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
853635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle);
854635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
855635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle);
856635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
857635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle);
858635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
859635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
860635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
861635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
862635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
863635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle);
864635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds);
865635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
866635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz);
867635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
868635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form,
869635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u32 form_specific);
870635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
871635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u16 *volume_handle);
872635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle,
873635374e7eb110e80d9918b8611198edd56a32975Eric Moore    u64 *wwid);
874635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* ctl shared API */
875635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct device_attribute *mpt2sas_host_attrs[];
876635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct device_attribute *mpt2sas_dev_attrs[];
877635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_init(void);
878635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_exit(void);
87977e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
8807b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
881635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
88277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
8837b936b02293b2891d899233d3f4bb45295e8c1f9Kashyap, Desai    u32 reply);
884635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
885635374e7eb110e80d9918b8611198edd56a32975Eric Moore    Mpi2EventNotificationReply_t *mpi_reply);
886635374e7eb110e80d9918b8611198edd56a32975Eric Moore
88732e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desaivoid mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
88832e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desai	u8 bits_to_regsiter);
88932e0eb569df09a8cb790cf370ee498721d88e5c6Kashyap, Desai
890635374e7eb110e80d9918b8611198edd56a32975Eric Moore/* transport shared API */
89177e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiu8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
89277e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u32 reply);
893635374e7eb110e80d9918b8611198edd56a32975Eric Moorestruct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc,
894c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u16 handle, u64 sas_address);
895635374e7eb110e80d9918b8611198edd56a32975Eric Moorevoid mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
896c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u64 sas_address_parent);
897635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
898635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
899635374e7eb110e80d9918b8611198edd56a32975Eric Mooreint mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
900635374e7eb110e80d9918b8611198edd56a32975Eric Moore    *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev);
901c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desaivoid mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
902c5e039be7e81168a9156e801cfef2adae72e775bKashyap, Desai     u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
903635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct sas_function_template mpt2sas_transport_functions;
904635374e7eb110e80d9918b8611198edd56a32975Eric Mooreextern struct scsi_transport_template *mpt2sas_transport_template;
90534a03bef2202d0c9983a8da0a8abaee37d285847Kashyap, Desaiextern int scsi_internal_device_block(struct scsi_device *sdev);
90677e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desaiextern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc,
90777e63ed44305e89c0564f8292f9cd5764d4fddfbKashyap, Desai    u8 msix_index, u32 reply);
90834a03bef2202d0c9983a8da0a8abaee37d285847Kashyap, Desaiextern int scsi_internal_device_unblock(struct scsi_device *sdev);
909635374e7eb110e80d9918b8611198edd56a32975Eric Moore
910635374e7eb110e80d9918b8611198edd56a32975Eric Moore#endif /* MPT2SAS_BASE_H_INCLUDED */
911