[v2 PATCH 1/20][SCSI] mpt3sas: Makefile, Kconfig and scsi_transport_sas file changes to support new driver mpt3sas

2012-11-29 Thread sreekanth.reddy
This patch contains the Makefile, Kconfig and 
scsi_transport_sas file changes to support new driver mpt3sas

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index e955978..49244f8 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -620,6 +620,7 @@ config SCSI_ARCMSR
 
 source drivers/scsi/megaraid/Kconfig.megaraid
 source drivers/scsi/mpt2sas/Kconfig
+source drivers/scsi/mpt3sas/Kconfig
 source drivers/scsi/ufs/Kconfig
 
 config SCSI_HPTIOP
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 1a3368b..88e52bb 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -106,6 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY)   += megaraid.o
 obj-$(CONFIG_MEGARAID_NEWGEN)  += megaraid/
 obj-$(CONFIG_MEGARAID_SAS) += megaraid/
 obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas/
+obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/
 obj-$(CONFIG_SCSI_UFSHCD)  += ufs/
 obj-$(CONFIG_SCSI_ACARD)   += atp870u.o
 obj-$(CONFIG_SCSI_SUNESP)  += esp_scsi.o   sun_esp.o
diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
new file mode 100644
index 000..81471bf
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -0,0 +1,67 @@
+#
+# Kernel configuration file for the MPT3SAS
+#
+# This code is based on drivers/scsi/mpt3sas/Kconfig
+# Copyright (C) 2012  LSI Corporation
+#  (mailto:dl-mptfusionli...@lsi.com)
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# NO WARRANTY
+# THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+# LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+# solely responsible for determining the appropriateness of using and
+# distributing the Program and assumes all risks associated with its
+# exercise of rights under this Agreement, including but not limited to
+# the risks and costs of program errors, damage to or loss of data,
+# programs or equipment, and unavailability or interruption of operations.
+
+# DISCLAIMER OF LIABILITY
+# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+# USA.
+
+config SCSI_MPT3SAS
+   tristate LSI MPT Fusion SAS 3.0 Device Driver
+   depends on PCI  SCSI
+   select SCSI_SAS_ATTRS
+   select RAID_ATTRS
+   ---help---
+   This driver supports PCI-Express SAS 12Gb/s Host Adapters.
+
+config SCSI_MPT3SAS_MAX_SGE
+   int LSI MPT Fusion Max number of SG Entries (16 - 256)
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   default 128
+   range 16 256
+   ---help---
+   This option allows you to specify the maximum number of scatter-
+   gather entries per I/O. The driver default is 128, which matches
+   MAX_PHYS_SEGMENTS in most kernels.  However in SuSE kernels this
+   can be 256. However, it may decreased down to 16.  Decreasing this
+   parameter will reduce memory requirements on a per controller instance.
+
+config SCSI_MPT3SAS_LOGGING
+   bool LSI MPT Fusion logging facility
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   ---help---
+   This turns on a logging facility.
diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile
new file mode 100644
index 000..4c1d2e7
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Makefile
@@ -0,0 +1,8 @@
+# mpt3sas makefile
+obj-m += mpt3sas.o
+mpt3sas-y +=  mpt3sas_base.o \
+   mpt3sas_config.o \
+   mpt3sas_scsih.o  \
+   mpt3sas_transport.o \
+   mpt3sas_ctl.o   \
+   mpt3sas_trigger_diag.o
diff --git a/drivers/scsi/scsi_transport_sas.c 
b/drivers/scsi/scsi_transport_sas.c
index f7565fc..1b68142 100644
--- 

[v2 PATCH 2/20][SCSI] mpt3sas: Part 1 of MPI API headers

2012-11-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 1 of MPI API headers.

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h
new file mode 100644
index 000..03317ff
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2.h
@@ -0,0 +1,1164 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2.h
+ * Title:  MPI Message independent structures and definitions
+ * including System Interface Register Set and
+ * scatter/gather formats.
+ * Creation Date:  June 21, 2006
+ *
+ * mpi2.h Version:  02.00.26
+ *
+ * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
+ *   prefix are for use only on MPI v2.5 products, and must not be used
+ *   with MPI v2.0 products. Unless otherwise noted, names beginning with
+ *   MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 06-04-07  02.00.01  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 06-26-07  02.00.02  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-31-07  02.00.03  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved ReplyPostHostIndex register to offset 0x6C of the
+ * MPI2_SYSTEM_INTERFACE_REGS and modified the define for
+ * MPI2_REPLY_POST_HOST_INDEX_OFFSET.
+ * Added union of request descriptors.
+ * Added union of reply descriptors.
+ * 10-31-07  02.00.04  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_VERSION_02_00.
+ * Fixed the size of the FunctionDependent5 field in the
+ * MPI2_DEFAULT_REPLY structure.
+ * 12-18-07  02.00.05  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Removed the MPI-defined Fault Codes and extended the
+ * product specific codes up to 0xEFFF.
+ * Added a sixth key value for the WriteSequence register
+ * and changed the flush value to 0x0.
+ * Added message function codes for Diagnostic Buffer Post
+ * and Diagnsotic Release.
+ * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED
+ * Moved MPI2_VERSION_UNION from mpi2_ioc.h.
+ * 02-29-08  02.00.06  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-03-08  02.00.07  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-21-08  02.00.08  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added #defines for marking a reply descriptor as unused.
+ * 06-27-08  02.00.09  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-02-08  02.00.10  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved LUN field defines from mpi2_init.h.
+ * 01-19-09  02.00.11  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-06-09  02.00.12  Bumped MPI2_HEADER_VERSION_UNIT.
+ * In all request and reply descriptors, replaced VF_ID
+ * field with MSIxIndex field.
+ * Removed DevHandle field from
+ * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
+ * bytes reserved.
+ * Added RAID Accelerator functionality.
+ * 07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MSI-x index mask and shift for Reply Post Host
+ * Index register.
+ * Added function code for Host Based Discovery Action.
+ * 02-10-10  02.00.15  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL.
+ * Added defines for product-specific range of message
+ * function codes, 0xF0 to 0xFF.
+ * 05-12-10  02.00.16  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added alternative defines for the SGE Direction bit.
+ * 08-11-10  02.00.17  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-10-10  02.00.18  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define.
+ * 02-23-11  02.00.19  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
+ * 03-09-11  02.00.20  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-25-11  02.00.21  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-24-11  02.00.22  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-18-11  02.00.23  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.24  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-29-12  02.00.25  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added 

[v2 PATCH 6/20][SCSI] mpt3sas: Part 5 of MPI API headers

2012-11-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 5 of MPI API headers.

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h 
b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
new file mode 100644
index 000..d1d9866
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2_raid.h
+ * Title:  MPI Integrated RAID messages and structures
+ * Creation Date:  April 26, 2007
+ *
+ *   mpi2_raid.h Version:  02.00.08
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 08-31-07  02.00.01  Modifications to RAID Action request and reply,
+ * including the Actions and ActionData.
+ * 02-29-08  02.00.02  Added MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD.
+ * 05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
+ * the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
+ * can be sized by the build environment.
+ * 07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
+ * VolumeCreationFlags and marked the old one as obsolete.
+ * 05-12-10  02.00.05  Added MPI2_RAID_VOL_FLAGS_OP_MDC define.
+ * 08-24-10  02.00.06  Added MPI2_RAID_ACTION_COMPATIBILITY_CHECK along with
+ * related structures and defines.
+ * Added product-specific range to RAID Action values.
+ * 11-18-11  02.00.07  Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.08  Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN.
+ * --
+ */
+
+#ifndef MPI2_RAID_H
+#define MPI2_RAID_H
+
+/*
+*
+*  Integrated RAID Messages
+*
+*/
+
+/
+* RAID Action messages
+/
+
+/*ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */
+#define MPI2_RAID_ACTION_ADATA_KEEP_LBA0(0x)
+#define MPI2_RAID_ACTION_ADATA_ZERO_LBA0(0x0001)
+
+/*use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for
+ *MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
+
+/*ActionDataWord defines for use with
+ *MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES action */
+#define MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD  (0x0001)
+
+/*ActionDataWord for MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE Action */
+typedef struct _MPI2_RAID_ACTION_RATE_DATA {
+   U8 RateToChange;/*0x00 */
+   U8 RateOrMode;  /*0x01 */
+   U16 DataScrubDuration;  /*0x02 */
+} MPI2_RAID_ACTION_RATE_DATA, *PTR_MPI2_RAID_ACTION_RATE_DATA,
+   Mpi2RaidActionRateData_t, *pMpi2RaidActionRateData_t;
+
+#define MPI2_RAID_ACTION_SET_RATE_RESYNC(0x00)
+#define MPI2_RAID_ACTION_SET_RATE_DATA_SCRUB(0x01)
+#define MPI2_RAID_ACTION_SET_RATE_POWERSAVE_MODE(0x02)
+
+/*ActionDataWord for MPI2_RAID_ACTION_START_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_START_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   Mpi2RaidActionStartRaidFunction_t,
+   *pMpi2RaidActionStartRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_START_BACKGROUND_INIT  (0x00)
+#define MPI2_RAID_ACTION_START_ONLINE_CAP_EXPANSION (0x01)
+#define MPI2_RAID_ACTION_START_CONSISTENCY_CHECK(0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_START_NEW  (0x00)
+#define MPI2_RAID_ACTION_START_RESUME   (0x01)
+
+/*ActionDataWord for MPI2_RAID_ACTION_STOP_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_STOP_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   Mpi2RaidActionStopRaidFunction_t,
+   *pMpi2RaidActionStopRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_STOP_BACKGROUND_INIT   (0x00)
+#define MPI2_RAID_ACTION_STOP_ONLINE_CAP_EXPANSION  (0x01)
+#define MPI2_RAID_ACTION_STOP_CONSISTENCY_CHECK (0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_STOP_ABORT (0x00)
+#define 

[v2 PATCH 9/20][SCSI] mpt3sas: Common API layer interface headers for access to MPT firmware.

2012-11-29 Thread sreekanth.reddy
This patch contains the Fusion MPT base driver providing common API layer 
interface
headers for access to MPT (Message Passing Technology) firmware.

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
new file mode 100644
index 000..994656c
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -0,0 +1,1139 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * for access to MPT (Message Passing Technology) firmware.
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_BASE_H_INCLUDED
+#define MPT3SAS_BASE_H_INCLUDED
+
+#include mpi/mpi2_type.h
+#include mpi/mpi2.h
+#include mpi/mpi2_ioc.h
+#include mpi/mpi2_cnfg.h
+#include mpi/mpi2_init.h
+#include mpi/mpi2_raid.h
+#include mpi/mpi2_tool.h
+#include mpi/mpi2_sas.h
+
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_device.h
+#include scsi/scsi_host.h
+#include scsi/scsi_tcq.h
+#include scsi/scsi_transport_sas.h
+#include scsi/scsi_dbg.h
+#include scsi/scsi_eh.h
+
+#include mpt3sas_debug.h
+#include mpt3sas_trigger_diag.h
+
+/* driver versioning info */
+#define MPT3SAS_DRIVER_NAMEmpt3sas
+#define MPT3SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com
+#define MPT3SAS_DESCRIPTIONLSI MPT Fusion SAS 3.0 Device Driver
+#define MPT3SAS_DRIVER_VERSION 01.100.01.00
+#define MPT3SAS_MAJOR_VERSION  1
+#define MPT3SAS_MINOR_VERSION  100
+#define MPT3SAS_BUILD_VERSION  1
+#define MPT3SAS_RELEASE_VERSION00
+
+/*
+ * Set MPT3SAS_SG_DEPTH value based on user input.
+ */
+#define MPT3SAS_MAX_PHYS_SEGMENTS  SCSI_MAX_SG_SEGMENTS
+#define MPT3SAS_MIN_PHYS_SEGMENTS  16
+#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
+#define MPT3SAS_SG_DEPTH   CONFIG_SCSI_MPT3SAS_MAX_SGE
+#else
+#define MPT3SAS_SG_DEPTH   MPT3SAS_MAX_PHYS_SEGMENTS
+#endif
+
+
+/*
+ * Generic Defines
+ */
+#define MPT3SAS_SATA_QUEUE_DEPTH   32
+#define MPT3SAS_SAS_QUEUE_DEPTH254
+#define MPT3SAS_RAID_QUEUE_DEPTH   128
+
+#define MPT_NAME_LENGTH32  /* generic length of 
strings */
+#define MPT_STRING_LENGTH  64
+
+#define MPT_MAX_CALLBACKS  32
+
+
+#define CAN_SLEEP  1
+#define  NO_SLEEP  0
+
+#define INTERNAL_CMDS_COUNT10  /* reserved cmds */
+
+#define MPI3_HIM_MASK  0x /* mask every bit*/
+
+#define MPT3SAS_INVALID_DEVICE_HANDLE  0x
+
+/*
+ * reset phases
+ */
+#define MPT3_IOC_PRE_RESET 1 /* prior to host reset */
+#define MPT3_IOC_AFTER_RESET   2 /* just after host reset */
+#define MPT3_IOC_DONE_RESET3 /* links re-initialized */
+
+/*
+ * logging format
+ */
+#define 

[v2 PATCH 12/20][SCSI] mpt3sas: Ioctl Module Support for MPT based controllers

2012-11-29 Thread sreekanth.reddy
This patch provides headers for ioctl Module Support for MPT (Message Passing 
Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.h 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
new file mode 100644
index 000..bd89f4f
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
@@ -0,0 +1,418 @@
+/*
+ * Management Module Support for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_CTL_H_INCLUDED
+#define MPT3SAS_CTL_H_INCLUDED
+
+#ifdef __KERNEL__
+#include linux/miscdevice.h
+#endif
+
+
+#ifndef MPT3SAS_MINOR
+#define MPT3SAS_MINOR  (MPT_MINOR + 2)
+#endif
+#define MPT3SAS_DEV_NAME   mpt3ctl
+#define MPT3_MAGIC_NUMBER  'L'
+#define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
+
+/**
+ * IOCTL opcodes
+ */
+#define MPT3IOCINFO_IOWR(MPT3_MAGIC_NUMBER, 17, \
+   struct mpt3_ioctl_iocinfo)
+#define MPT3COMMAND_IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command)
+#ifdef CONFIG_COMPAT
+#define MPT3COMMAND32  _IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command32)
+#endif
+#define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \
+   struct mpt3_ioctl_eventquery)
+#define MPT3EVENTENABLE_IOWR(MPT3_MAGIC_NUMBER, 22, \
+   struct mpt3_ioctl_eventenable)
+#define MPT3EVENTREPORT_IOWR(MPT3_MAGIC_NUMBER, 23, \
+   struct mpt3_ioctl_eventreport)
+#define MPT3HARDRESET  _IOWR(MPT3_MAGIC_NUMBER, 24, \
+   struct mpt3_ioctl_diag_reset)
+#define MPT3BTDHMAPPING_IOWR(MPT3_MAGIC_NUMBER, 31, \
+   struct mpt3_ioctl_btdh_mapping)
+
+/* diag buffer support */
+#define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \
+   struct mpt3_diag_register)
+#define MPT3DIAGRELEASE_IOWR(MPT3_MAGIC_NUMBER, 27, \
+   struct mpt3_diag_release)
+#define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \
+   struct mpt3_diag_unregister)
+#define MPT3DIAGQUERY  _IOWR(MPT3_MAGIC_NUMBER, 29, \
+   struct mpt3_diag_query)
+#define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \
+   struct mpt3_diag_read_buffer)
+
+/**
+ * struct mpt3_ioctl_header - main header structure
+ * @ioc_number -  IOC unit number
+ * @port_number - IOC port number
+ * @max_data_size - maximum number bytes to transfer on read
+ */
+struct mpt3_ioctl_header {
+   uint32_t ioc_number;
+   uint32_t port_number;
+   uint32_t max_data_size;
+};
+
+/**
+ * struct mpt3_ioctl_diag_reset - diagnostic reset
+ * @hdr - generic header
+ */
+struct mpt3_ioctl_diag_reset {
+   struct mpt3_ioctl_header hdr;
+};
+
+
+/**
+ * struct mpt3_ioctl_pci_info - pci device info
+ * @device - pci device id
+ * @function - pci function id
+ * @bus - pci bus id
+ * @segment_id - pci segment id
+ */
+struct mpt3_ioctl_pci_info {
+

[v2 PATCH 13/20][SCSI] mpt3sas: Logging Support for MPT based controllers

2012-11-29 Thread sreekanth.reddy
This patch provides Logging Support for MPT (Message Passing Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_debug.h 
b/drivers/scsi/mpt3sas/mpt3sas_debug.h
new file mode 100644
index 000..ce70b87
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_debug.h
@@ -0,0 +1,219 @@
+/*
+ * Logging Support for MPT (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_debug.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_DEBUG_H_INCLUDED
+#define MPT3SAS_DEBUG_H_INCLUDED
+
+#define MPT_DEBUG  0x0001
+#define MPT_DEBUG_MSG_FRAME0x0002
+#define MPT_DEBUG_SG   0x0004
+#define MPT_DEBUG_EVENTS   0x0008
+#define MPT_DEBUG_EVENT_WORK_TASK  0x0010
+#define MPT_DEBUG_INIT 0x0020
+#define MPT_DEBUG_EXIT 0x0040
+#define MPT_DEBUG_FAIL 0x0080
+#define MPT_DEBUG_TM   0x0100
+#define MPT_DEBUG_REPLY0x0200
+#define MPT_DEBUG_HANDSHAKE0x0400
+#define MPT_DEBUG_CONFIG   0x0800
+#define MPT_DEBUG_DL   0x1000
+#define MPT_DEBUG_RESET0x2000
+#define MPT_DEBUG_SCSI 0x4000
+#define MPT_DEBUG_IOCTL0x8000
+#define MPT_DEBUG_SAS  0x0002
+#define MPT_DEBUG_TRANSPORT0x0004
+#define MPT_DEBUG_TASK_SET_FULL0x0008
+
+#define MPT_DEBUG_TRIGGER_DIAG 0x0020
+
+
+/*
+ * CONFIG_SCSI_MPT3SAS_LOGGING - enabled in Kconfig
+ */
+
+#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)  \
+{  \
+   if (IOC-logging_level  BITS)  \
+   CMD;\
+}
+#else
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
+#endif /* CONFIG_SCSI_MPT3SAS_LOGGING */
+
+
+/*
+ * debug macros
+ */
+
+#define dprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
+
+#define dsgprintk(IOC, CMD)\
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
+
+#define devtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
+
+#define dewtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENT_WORK_TASK)
+
+#define dinitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
+
+#define dexitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
+
+#define dfailprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
+
+#define dtmprintk(IOC, CMD)\
+   

[v2 PATCH 18/20][SCSI] mpt3sas: Common API to set Diagnostic trigger for MPT based controllers

2012-11-29 Thread sreekanth.reddy
This patch provides common API to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
new file mode 100644
index 000..da6c5f2
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
@@ -0,0 +1,434 @@
+/*
+ * This module provides common API to set Diagnostic trigger for MPT
+ * (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#include linux/version.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/errno.h
+#include linux/init.h
+#include linux/slab.h
+#include linux/types.h
+#include linux/pci.h
+#include linux/delay.h
+#include linux/compat.h
+#include linux/poll.h
+
+#include linux/io.h
+#include linux/uaccess.h
+
+#include mpt3sas_base.h
+
+/**
+ * _mpt3sas_raise_sigio - notifiy app
+ * @ioc: per adapter object
+ * @event_data:
+ */
+static void
+_mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   Mpi2EventNotificationReply_t *mpi_reply;
+   u16 sz, event_data_sz;
+   unsigned long flags;
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: enter\n,
+   ioc-name, __func__));
+
+   sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
+   mpi_reply = kzalloc(sz, GFP_KERNEL);
+   if (!mpi_reply)
+   goto out;
+   mpi_reply-Event = cpu_to_le16(MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED);
+   event_data_sz = (sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4) / 4;
+   mpi_reply-EventDataLength = cpu_to_le16(event_data_sz);
+   memcpy(mpi_reply-EventData, event_data,
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: add to driver event log\n,
+   ioc-name, __func__));
+   mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
+   kfree(mpi_reply);
+ out:
+
+   /* clearing the diag_trigger_active flag */
+   spin_lock_irqsave(ioc-diag_trigger_lock, flags);
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: clearing diag_trigger_active flag\n,
+   ioc-name, __func__));
+   ioc-diag_trigger_active = 0;
+   spin_unlock_irqrestore(ioc-diag_trigger_lock, flags);
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: exit\n, ioc-name,
+   __func__));
+}
+
+/**
+ * mpt3sas_process_trigger_data - process the event data for the trigger
+ * @ioc: per adapter object
+ * @event_data:
+ */
+void
+mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   u8 issue_reset = 0;
+
+  

[v2 PATCH 19/20][SCSI] mpt3sas: Common API headers to set Diagnostic trigger for MPT based controllers

2012-11-29 Thread sreekanth.reddy
This patch provides common API headers to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
new file mode 100644
index 000..a10c309
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
@@ -0,0 +1,193 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * to set Diagnostic triggers for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+  /* Diagnostic Trigger Configuration Data Structures */
+
+#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+
+/* limitation on number of entries */
+#define NUM_VALID_ENTRIES   (20)
+
+/* trigger types */
+#define MPT3SAS_TRIGGER_MASTER  (1)
+#define MPT3SAS_TRIGGER_EVENT   (2)
+#define MPT3SAS_TRIGGER_SCSI(3)
+#define MPT3SAS_TRIGGER_MPI (4)
+
+/* trigger names */
+#define MASTER_TRIGGER_FILE_NAMEdiag_trigger_master
+#define EVENT_TRIGGERS_FILE_NAMEdiag_trigger_event
+#define SCSI_TRIGGERS_FILE_NAME diag_trigger_scsi
+#define MPI_TRIGGER_FILE_NAME   diag_trigger_mpi
+
+/* master trigger bitmask */
+#define MASTER_TRIGGER_FW_FAULT (0x0001)
+#define MASTER_TRIGGER_ADAPTER_RESET(0x0002)
+#define MASTER_TRIGGER_TASK_MANAGMENT   (0x0004)
+#define MASTER_TRIGGER_DEVICE_REMOVAL   (0x0008)
+
+/* fake firmware event for tigger */
+#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED(0x6E)
+
+/**
+ * MasterTrigger is a single U32 passed to/from sysfs.
+ *
+ * Bit Flags (enables) include:
+ * 1. FW Faults
+ * 2. Adapter Reset issued by driver
+ * 3. TMs
+ * 4. Device Remove Event sent by FW
+ */
+
+struct SL_WH_MASTER_TRIGGER_T {
+   uint32_t MasterData;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGER_T -  Definition of an event trigger element
+ * @EventValue: Event Code to trigger on
+ * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event 
only)
+ *
+ * Defines an event that should induce a DIAG_TRIGGER driver event if observed.
+ */
+struct SL_WH_EVENT_TRIGGER_T {
+   uint16_t EventValue;
+   uint16_t LogEntryQualifier;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGERS_T -  Structure passed to/from sysfs containing a
+ *list of Event Triggers to be monitored for.
+ * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this
+ *structure.
+ * @EventTriggerEntry: List of Event trigger elements.
+ *
+ * This binary structure is transferred via sysfs to get/set Event Triggers
+ * in the Linux Driver.
+ */
+
+struct SL_WH_EVENT_TRIGGERS_T {
+   uint32_t ValidEntries;
+   struct SL_WH_EVENT_TRIGGER_T 

[v2 PATCH 20/20][SCSI] mpt3sas: Adding support for MPT3SAS_MINOR(222)

2012-11-29 Thread sreekanth.reddy
Adding support for MPT3SAS_MINOR(222)

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 0549d211..9c9ba04 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -34,6 +34,7 @@
 #define MWAVE_MINOR219 /* ACP/Mwave Modem */
 #define MPT_MINOR  220
 #define MPT2SAS_MINOR  221
+#define MPT3SAS_MINOR  222
 #define UINPUT_MINOR   223
 #define HPET_MINOR 228
 #define FUSE_MINOR 229
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error handling on FC devices

2012-11-29 Thread James Smart
Always possible - but   Our f/w works at the FCP level and below, 
which means it doesn't know/do SCSI commands - e.g what the cdb within 
the FCP CMD frame is; know anything about SCSI device classes and state; 
etc. And it shouldn't be required to do so. Anytime this has been there 
in the past, it's been problematic.


if we want to do this - we should add it to the midlayer/transport.

-- james  s


On 11/28/2012 2:09 AM, Hannes Reinecke wrote:

On 11/27/2012 09:29 PM, Elliott, Robert (Server Storage) wrote:
There is a new command in SPC-4 called REMOVE I_T NEXUS that is 
intended to help
 that situation.  REMOVE I_T NEXUS lets the application client use a 
good I_T nexus
 to abort commands that were being processed on a bad I_T nexus, so 
it can safely
 re-issue those commands on the good I_T nexus without worrying that 
the original

 commands might resume.


In contrast:
- the ABORT TASK, ABORT TASK SET, and CLEAR TASK SET must use the 
same I_T nexus
   as the commands being aborted, so are not viable if that I_T nexus 
is bad
- LOGICAL UNIT RESET aborts commands from every I_T nexus, so in 
addition to
   aborting commands from the bad I_T nexus it also affects commands 
on the

   good I_T nexus


Hmm. Nice in principle, but the problem here is that we cannot 
guarantee the nexus is still intact.
So one would need to implement this in the HBA firmware; the firmware 
would need to be able to process the TMF, and do the appropriate 
things for the FC stack like dropping the rport etc.


Good idea, though.

James, Andrew, Chad?
Any chance of having a firmware supporting REMOVE IT-NEXUS ?

Cheers,

Hannes


--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-11-29 Thread Roland Dreier
On Mon, Nov 26, 2012 at 8:04 PM, David Dillow dillo...@ornl.gov wrote:
 We can push it through James's tree if need be, but Bart's code is
 pretty self-contained, and going through the SCSI tree will introduce
 merge dependencies. It'd be much easier to push it all through the RDMA
 tree, especially if we want to get this landed for 3.8.

OK, I guess all the srp_transport stuff looks quite simple and good to
me, so I'm OK merging it.

Is there some subset of patches that you and Bart agree are good,
which I can pick up now?  I'd love to get at least some of the SRP
stuff into 3.8, and that window is opening pretty soon.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-11-29 Thread David Dillow
On Thu, 2012-11-29 at 12:21 -0800, Roland Dreier wrote:
 On Mon, Nov 26, 2012 at 8:04 PM, David Dillow dillo...@ornl.gov wrote:
  We can push it through James's tree if need be, but Bart's code is
  pretty self-contained, and going through the SCSI tree will introduce
  merge dependencies. It'd be much easier to push it all through the RDMA
  tree, especially if we want to get this landed for 3.8.
 
 OK, I guess all the srp_transport stuff looks quite simple and good to
 me, so I'm OK merging it.
 
 Is there some subset of patches that you and Bart agree are good,
 which I can pick up now?  I'd love to get at least some of the SRP
 stuff into 3.8, and that window is opening pretty soon.

Modulo a few style issues (braces around one line if branches, etc.) and
having three state variables vs one, I can live with everything up to
aabfa852acd27962 at git://github.com/bvanassche/linux.git#srp-ha. Those
two are small things that can be fixed later and are not worth holding
things up any further.

I'll try to spend some time on the final four patches tomorrow
afternoon.
-- 
Dave Dillow
National Center for Computational Science
Oak Ridge National Laboratory
(865) 241-6602 office

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html