| 1 |
/* |
| 2 |
* This is the Fusion MPT base driver providing common API layer interface |
| 3 |
* to set Diagnostic triggers for MPT (Message Passing Technology) based |
| 4 |
* controllers |
| 5 |
* |
| 6 |
* This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h |
| 7 |
* Copyright (C) 2012-2014 LSI Corporation |
| 8 |
* Copyright (C) 2013-2014 Avago Technologies |
| 9 |
* (mailto: [email protected]) |
| 10 |
* |
| 11 |
* This program is free software; you can redistribute it and/or |
| 12 |
* modify it under the terms of the GNU General Public License |
| 13 |
* as published by the Free Software Foundation; either version 2 |
| 14 |
* of the License, or (at your option) any later version. |
| 15 |
* |
| 16 |
* This program is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* NO WARRANTY |
| 22 |
* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 23 |
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT |
| 24 |
* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, |
| 25 |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is |
| 26 |
* solely responsible for determining the appropriateness of using and |
| 27 |
* distributing the Program and assumes all risks associated with its |
| 28 |
* exercise of rights under this Agreement, including but not limited to |
| 29 |
* the risks and costs of program errors, damage to or loss of data, |
| 30 |
* programs or equipment, and unavailability or interruption of operations. |
| 31 |
|
| 32 |
* DISCLAIMER OF LIABILITY |
| 33 |
* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY |
| 34 |
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 35 |
* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND |
| 36 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 37 |
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 38 |
* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED |
| 39 |
* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES |
| 40 |
|
| 41 |
* You should have received a copy of the GNU General Public License |
| 42 |
* along with this program; if not, write to the Free Software |
| 43 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 44 |
* USA. |
| 45 |
*/ |
| 46 |
/* Diagnostic Trigger Configuration Data Structures */ |
| 47 |
|
| 48 |
#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED |
| 49 |
#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED |
| 50 |
|
| 51 |
/* limitation on number of entries */ |
| 52 |
#define NUM_VALID_ENTRIES (20) |
| 53 |
|
| 54 |
/* trigger types */ |
| 55 |
#define MPT3SAS_TRIGGER_MASTER (1) |
| 56 |
#define MPT3SAS_TRIGGER_EVENT (2) |
| 57 |
#define MPT3SAS_TRIGGER_SCSI (3) |
| 58 |
#define MPT3SAS_TRIGGER_MPI (4) |
| 59 |
|
| 60 |
/* trigger names */ |
| 61 |
#define MASTER_TRIGGER_FILE_NAME "diag_trigger_master" |
| 62 |
#define EVENT_TRIGGERS_FILE_NAME "diag_trigger_event" |
| 63 |
#define SCSI_TRIGGERS_FILE_NAME "diag_trigger_scsi" |
| 64 |
#define MPI_TRIGGER_FILE_NAME "diag_trigger_mpi" |
| 65 |
|
| 66 |
/* master trigger bitmask */ |
| 67 |
#define MASTER_TRIGGER_FW_FAULT (0x00000001) |
| 68 |
#define MASTER_TRIGGER_ADAPTER_RESET (0x00000002) |
| 69 |
#define MASTER_TRIGGER_TASK_MANAGMENT (0x00000004) |
| 70 |
#define MASTER_TRIGGER_DEVICE_REMOVAL (0x00000008) |
| 71 |
|
| 72 |
/* fake firmware event for trigger */ |
| 73 |
#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED (0x6E) |
| 74 |
|
| 75 |
/** |
| 76 |
* MasterTrigger is a single U32 passed to/from sysfs. |
| 77 |
* |
| 78 |
* Bit Flags (enables) include: |
| 79 |
* 1. FW Faults |
| 80 |
* 2. Adapter Reset issued by driver |
| 81 |
* 3. TMs |
| 82 |
* 4. Device Remove Event sent by FW |
| 83 |
*/ |
| 84 |
|
| 85 |
struct SL_WH_MASTER_TRIGGER_T { |
| 86 |
uint32_t MasterData; |
| 87 |
}; |
| 88 |
|
| 89 |
/** |
| 90 |
* struct SL_WH_EVENT_TRIGGER_T - Definition of an event trigger element |
| 91 |
* @EventValue: Event Code to trigger on |
| 92 |
* @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event only) |
| 93 |
* |
| 94 |
* Defines an event that should induce a DIAG_TRIGGER driver event if observed. |
| 95 |
*/ |
| 96 |
struct SL_WH_EVENT_TRIGGER_T { |
| 97 |
uint16_t EventValue; |
| 98 |
uint16_t LogEntryQualifier; |
| 99 |
}; |
| 100 |
|
| 101 |
/** |
| 102 |
* struct SL_WH_EVENT_TRIGGERS_T - Structure passed to/from sysfs containing a |
| 103 |
* list of Event Triggers to be monitored for. |
| 104 |
* @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this |
| 105 |
* structure. |
| 106 |
* @EventTriggerEntry: List of Event trigger elements. |
| 107 |
* |
| 108 |
* This binary structure is transferred via sysfs to get/set Event Triggers |
| 109 |
* in the Linux Driver. |
| 110 |
*/ |
| 111 |
|
| 112 |
struct SL_WH_EVENT_TRIGGERS_T { |
| 113 |
uint32_t ValidEntries; |
| 114 |
struct SL_WH_EVENT_TRIGGER_T EventTriggerEntry[NUM_VALID_ENTRIES]; |
| 115 |
}; |
| 116 |
|
| 117 |
/** |
| 118 |
* struct SL_WH_SCSI_TRIGGER_T - Definition of a SCSI trigger element |
| 119 |
* @ASCQ: Additional Sense Code Qualifier. Can be specific or 0xFF for |
| 120 |
* wildcard. |
| 121 |
* @ASC: Additional Sense Code. Can be specific or 0xFF for wildcard |
| 122 |
* @SenseKey: SCSI Sense Key |
| 123 |
* |
| 124 |
* Defines a sense key (single or many variants) that should induce a |
| 125 |
* DIAG_TRIGGER driver event if observed. |
| 126 |
*/ |
| 127 |
struct SL_WH_SCSI_TRIGGER_T { |
| 128 |
U8 ASCQ; |
| 129 |
U8 ASC; |
| 130 |
U8 SenseKey; |
| 131 |
U8 Reserved; |
| 132 |
}; |
| 133 |
|
| 134 |
/** |
| 135 |
* struct SL_WH_SCSI_TRIGGERS_T - Structure passed to/from sysfs containing a |
| 136 |
* list of SCSI sense codes that should trigger a DIAG_SERVICE event when |
| 137 |
* observed. |
| 138 |
* @ValidEntries: Number of _SL_WH_SCSI_TRIGGER_T structures contained in this |
| 139 |
* structure. |
| 140 |
* @SCSITriggerEntry: List of SCSI Sense Code trigger elements. |
| 141 |
* |
| 142 |
* This binary structure is transferred via sysfs to get/set SCSI Sense Code |
| 143 |
* Triggers in the Linux Driver. |
| 144 |
*/ |
| 145 |
struct SL_WH_SCSI_TRIGGERS_T { |
| 146 |
uint32_t ValidEntries; |
| 147 |
struct SL_WH_SCSI_TRIGGER_T SCSITriggerEntry[NUM_VALID_ENTRIES]; |
| 148 |
}; |
| 149 |
|
| 150 |
/** |
| 151 |
* struct SL_WH_MPI_TRIGGER_T - Definition of an MPI trigger element |
| 152 |
* @IOCStatus: MPI IOCStatus |
| 153 |
* @IocLogInfo: MPI IocLogInfo. Can be specific or 0xFFFFFFFF for wildcard |
| 154 |
* |
| 155 |
* Defines a MPI IOCStatus/IocLogInfo pair that should induce a DIAG_TRIGGER |
| 156 |
* driver event if observed. |
| 157 |
*/ |
| 158 |
struct SL_WH_MPI_TRIGGER_T { |
| 159 |
uint16_t IOCStatus; |
| 160 |
uint16_t Reserved; |
| 161 |
uint32_t IocLogInfo; |
| 162 |
}; |
| 163 |
|
| 164 |
/** |
| 165 |
* struct SL_WH_MPI_TRIGGERS_T - Structure passed to/from sysfs containing a |
| 166 |
* list of MPI IOCStatus/IocLogInfo pairs that should trigger a DIAG_SERVICE |
| 167 |
* event when observed. |
| 168 |
* @ValidEntries: Number of _SL_WH_MPI_TRIGGER_T structures contained in this |
| 169 |
* structure. |
| 170 |
* @MPITriggerEntry: List of MPI IOCStatus/IocLogInfo trigger elements. |
| 171 |
* |
| 172 |
* This binary structure is transferred via sysfs to get/set MPI Error Triggers |
| 173 |
* in the Linux Driver. |
| 174 |
*/ |
| 175 |
struct SL_WH_MPI_TRIGGERS_T { |
| 176 |
uint32_t ValidEntries; |
| 177 |
struct SL_WH_MPI_TRIGGER_T MPITriggerEntry[NUM_VALID_ENTRIES]; |
| 178 |
}; |
| 179 |
|
| 180 |
/** |
| 181 |
* struct SL_WH_TRIGGERS_EVENT_DATA_T - event data for trigger |
| 182 |
* @trigger_type: trigger type (see MPT3SAS_TRIGGER_XXXX) |
| 183 |
* @u: trigger condition that caused trigger to be sent |
| 184 |
*/ |
| 185 |
struct SL_WH_TRIGGERS_EVENT_DATA_T { |
| 186 |
uint32_t trigger_type; |
| 187 |
union { |
| 188 |
struct SL_WH_MASTER_TRIGGER_T master; |
| 189 |
struct SL_WH_EVENT_TRIGGER_T event; |
| 190 |
struct SL_WH_SCSI_TRIGGER_T scsi; |
| 191 |
struct SL_WH_MPI_TRIGGER_T mpi; |
| 192 |
} u; |
| 193 |
}; |
| 194 |
#endif /* MPT3SAS_TRIGGER_DIAG_H_INCLUDED */ |