Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This is the Fusion MPT base driver providing common API layer interface
0003  * to set Diagnostic triggers for MPT (Message Passing Technology) based
0004  * controllers
0005  *
0006  * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
0007  * Copyright (C) 2012-2014  LSI Corporation
0008  * Copyright (C) 2013-2014 Avago Technologies
0009  *  (mailto: MPT-FusionLinux.pdl@avagotech.com)
0010  *
0011  * This program is free software; you can redistribute it and/or
0012  * modify it under the terms of the GNU General Public License
0013  * as published by the Free Software Foundation; either version 2
0014  * of the License, or (at your option) any later version.
0015  *
0016  * This program is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019  * GNU General Public License for more details.
0020  *
0021  * NO WARRANTY
0022  * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
0023  * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
0024  * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
0025  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
0026  * solely responsible for determining the appropriateness of using and
0027  * distributing the Program and assumes all risks associated with its
0028  * exercise of rights under this Agreement, including but not limited to
0029  * the risks and costs of program errors, damage to or loss of data,
0030  * programs or equipment, and unavailability or interruption of operations.
0031 
0032  * DISCLAIMER OF LIABILITY
0033  * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
0034  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0035  * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
0036  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
0037  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
0038  * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
0039  * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
0040 
0041  * You should have received a copy of the GNU General Public License
0042  * along with this program; if not, write to the Free Software
0043  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
0044  * USA.
0045  */
0046   /* Diagnostic Trigger Configuration Data Structures */
0047 
0048 #ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED
0049 #define MPT3SAS_TRIGGER_DIAG_H_INCLUDED
0050 
0051 /* limitation on number of entries */
0052 #define NUM_VALID_ENTRIES               (20)
0053 
0054 /* trigger types */
0055 #define MPT3SAS_TRIGGER_MASTER          (1)
0056 #define MPT3SAS_TRIGGER_EVENT           (2)
0057 #define MPT3SAS_TRIGGER_SCSI            (3)
0058 #define MPT3SAS_TRIGGER_MPI             (4)
0059 
0060 /* trigger names */
0061 #define MASTER_TRIGGER_FILE_NAME        "diag_trigger_master"
0062 #define EVENT_TRIGGERS_FILE_NAME        "diag_trigger_event"
0063 #define SCSI_TRIGGERS_FILE_NAME         "diag_trigger_scsi"
0064 #define MPI_TRIGGER_FILE_NAME           "diag_trigger_mpi"
0065 
0066 /* master trigger bitmask */
0067 #define MASTER_TRIGGER_FW_FAULT         (0x00000001)
0068 #define MASTER_TRIGGER_ADAPTER_RESET    (0x00000002)
0069 #define MASTER_TRIGGER_TASK_MANAGMENT   (0x00000004)
0070 #define MASTER_TRIGGER_DEVICE_REMOVAL   (0x00000008)
0071 
0072 /* fake firmware event for trigger */
0073 #define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED (0x6E)
0074 
0075 /**
0076  * MasterTrigger is a single U32 passed to/from sysfs.
0077  *
0078  * Bit Flags (enables) include:
0079  * 1. FW Faults
0080  * 2. Adapter Reset issued by driver
0081  * 3. TMs
0082  * 4. Device Remove Event sent by FW
0083  */
0084 
0085 struct SL_WH_MASTER_TRIGGER_T {
0086     uint32_t MasterData;
0087 };
0088 
0089 /**
0090  * struct SL_WH_EVENT_TRIGGER_T -  Definition of an event trigger element
0091  * @EventValue: Event Code to trigger on
0092  * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event only)
0093  *
0094  * Defines an event that should induce a DIAG_TRIGGER driver event if observed.
0095  */
0096 struct SL_WH_EVENT_TRIGGER_T {
0097     uint16_t EventValue;
0098     uint16_t LogEntryQualifier;
0099 };
0100 
0101 /**
0102  * struct SL_WH_EVENT_TRIGGERS_T -  Structure passed to/from sysfs containing a
0103  *    list of Event Triggers to be monitored for.
0104  * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this
0105  *    structure.
0106  * @EventTriggerEntry: List of Event trigger elements.
0107  *
0108  * This binary structure is transferred via sysfs to get/set Event Triggers
0109  * in the Linux Driver.
0110  */
0111 
0112 struct SL_WH_EVENT_TRIGGERS_T {
0113     uint32_t ValidEntries;
0114     struct SL_WH_EVENT_TRIGGER_T EventTriggerEntry[NUM_VALID_ENTRIES];
0115 };
0116 
0117 /**
0118  * struct SL_WH_SCSI_TRIGGER_T -  Definition of a SCSI trigger element
0119  * @ASCQ: Additional Sense Code Qualifier.  Can be specific or 0xFF for
0120  *     wildcard.
0121  * @ASC: Additional Sense Code.  Can be specific or 0xFF for wildcard
0122  * @SenseKey: SCSI Sense Key
0123  *
0124  * Defines a sense key (single or many variants) that should induce a
0125  * DIAG_TRIGGER driver event if observed.
0126  */
0127 struct SL_WH_SCSI_TRIGGER_T {
0128     U8 ASCQ;
0129     U8 ASC;
0130     U8 SenseKey;
0131     U8 Reserved;
0132 };
0133 
0134 /**
0135  * struct SL_WH_SCSI_TRIGGERS_T -  Structure passed to/from sysfs containing a
0136  *    list of SCSI sense codes that should trigger a DIAG_SERVICE event when
0137  *    observed.
0138  * @ValidEntries: Number of _SL_WH_SCSI_TRIGGER_T structures contained in this
0139  *    structure.
0140  * @SCSITriggerEntry: List of SCSI Sense Code trigger elements.
0141  *
0142  * This binary structure is transferred via sysfs to get/set SCSI Sense Code
0143  * Triggers in the Linux Driver.
0144  */
0145 struct SL_WH_SCSI_TRIGGERS_T {
0146     uint32_t ValidEntries;
0147     struct SL_WH_SCSI_TRIGGER_T SCSITriggerEntry[NUM_VALID_ENTRIES];
0148 };
0149 
0150 /**
0151  * struct SL_WH_MPI_TRIGGER_T -  Definition of an MPI trigger element
0152  * @IOCStatus: MPI IOCStatus
0153  * @IocLogInfo: MPI IocLogInfo.  Can be specific or 0xFFFFFFFF for wildcard
0154  *
0155  * Defines a MPI IOCStatus/IocLogInfo pair that should induce a DIAG_TRIGGER
0156  * driver event if observed.
0157  */
0158 struct SL_WH_MPI_TRIGGER_T {
0159     uint16_t IOCStatus;
0160     uint16_t Reserved;
0161     uint32_t IocLogInfo;
0162 };
0163 
0164 /**
0165  * struct SL_WH_MPI_TRIGGERS_T -  Structure passed to/from sysfs containing a
0166  *    list of MPI IOCStatus/IocLogInfo pairs that should trigger a DIAG_SERVICE
0167  *    event when observed.
0168  * @ValidEntries: Number of _SL_WH_MPI_TRIGGER_T structures contained in this
0169  *    structure.
0170  * @MPITriggerEntry: List of MPI IOCStatus/IocLogInfo trigger elements.
0171  *
0172  * This binary structure is transferred via sysfs to get/set MPI Error Triggers
0173  * in the Linux Driver.
0174  */
0175 struct SL_WH_MPI_TRIGGERS_T {
0176     uint32_t ValidEntries;
0177     struct SL_WH_MPI_TRIGGER_T MPITriggerEntry[NUM_VALID_ENTRIES];
0178 };
0179 
0180 /**
0181  * struct SL_WH_TRIGGERS_EVENT_DATA_T -  event data for trigger
0182  * @trigger_type: trigger type (see MPT3SAS_TRIGGER_XXXX)
0183  * @u: trigger condition that caused trigger to be sent
0184  */
0185 struct SL_WH_TRIGGERS_EVENT_DATA_T {
0186     uint32_t trigger_type;
0187     union {
0188         struct SL_WH_MASTER_TRIGGER_T master;
0189         struct SL_WH_EVENT_TRIGGER_T event;
0190         struct SL_WH_SCSI_TRIGGER_T scsi;
0191         struct SL_WH_MPI_TRIGGER_T mpi;
0192     } u;
0193 };
0194 #endif /* MPT3SAS_TRIGGER_DIAG_H_INCLUDED */