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