195 lines · c
1/*2 * This is the Fusion MPT base driver providing common API layer interface3 * to set Diagnostic triggers for MPT (Message Passing Technology) based4 * controllers5 *6 * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h7 * Copyright (C) 2012-2014 LSI Corporation8 * Copyright (C) 2013-2014 Avago Technologies9 * (mailto: MPT-FusionLinux.pdl@avagotech.com)10 *11 * This program is free software; you can redistribute it and/or12 * modify it under the terms of the GNU General Public License13 * as published by the Free Software Foundation; either version 214 * 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 of18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19 * GNU General Public License for more details.20 *21 * NO WARRANTY22 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR23 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT24 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,25 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is26 * solely responsible for determining the appropriateness of using and27 * distributing the Program and assumes all risks associated with its28 * exercise of rights under this Agreement, including but not limited to29 * 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 LIABILITY33 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY34 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL35 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR37 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE38 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED39 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES40 41 * You should have received a copy of the GNU General Public License42 * along with this program; if not, write to the Free Software43 * 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_INCLUDED49#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED50 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 Faults80 * 2. Adapter Reset issued by driver81 * 3. TMs82 * 4. Device Remove Event sent by FW83 */84 85struct SL_WH_MASTER_TRIGGER_T {86 uint32_t MasterData;87};88 89/**90 * struct SL_WH_EVENT_TRIGGER_T - Definition of an event trigger element91 * @EventValue: Event Code to trigger on92 * @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 */96struct 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 a103 * list of Event Triggers to be monitored for.104 * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this105 * structure.106 * @EventTriggerEntry: List of Event trigger elements.107 *108 * This binary structure is transferred via sysfs to get/set Event Triggers109 * in the Linux Driver.110 */111 112struct 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 element119 * @ASCQ: Additional Sense Code Qualifier. Can be specific or 0xFF for120 * wildcard.121 * @ASC: Additional Sense Code. Can be specific or 0xFF for wildcard122 * @SenseKey: SCSI Sense Key123 *124 * Defines a sense key (single or many variants) that should induce a125 * DIAG_TRIGGER driver event if observed.126 */127struct 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 a136 * list of SCSI sense codes that should trigger a DIAG_SERVICE event when137 * observed.138 * @ValidEntries: Number of _SL_WH_SCSI_TRIGGER_T structures contained in this139 * structure.140 * @SCSITriggerEntry: List of SCSI Sense Code trigger elements.141 *142 * This binary structure is transferred via sysfs to get/set SCSI Sense Code143 * Triggers in the Linux Driver.144 */145struct 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 element152 * @IOCStatus: MPI IOCStatus153 * @IocLogInfo: MPI IocLogInfo. Can be specific or 0xFFFFFFFF for wildcard154 *155 * Defines a MPI IOCStatus/IocLogInfo pair that should induce a DIAG_TRIGGER156 * driver event if observed.157 */158struct 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 a166 * list of MPI IOCStatus/IocLogInfo pairs that should trigger a DIAG_SERVICE167 * event when observed.168 * @ValidEntries: Number of _SL_WH_MPI_TRIGGER_T structures contained in this169 * structure.170 * @MPITriggerEntry: List of MPI IOCStatus/IocLogInfo trigger elements.171 *172 * This binary structure is transferred via sysfs to get/set MPI Error Triggers173 * in the Linux Driver.174 */175struct 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 trigger182 * @trigger_type: trigger type (see MPT3SAS_TRIGGER_XXXX)183 * @u: trigger condition that caused trigger to be sent184 */185struct 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 */195