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