162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This is the Fusion MPT base driver providing common API layer interface 362306a36Sopenharmony_ci * to set Diagnostic triggers for MPT (Message Passing Technology) based 462306a36Sopenharmony_ci * controllers 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h 762306a36Sopenharmony_ci * Copyright (C) 2012-2014 LSI Corporation 862306a36Sopenharmony_ci * Copyright (C) 2013-2014 Avago Technologies 962306a36Sopenharmony_ci * (mailto: MPT-FusionLinux.pdl@avagotech.com) 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or 1262306a36Sopenharmony_ci * modify it under the terms of the GNU General Public License 1362306a36Sopenharmony_ci * as published by the Free Software Foundation; either version 2 1462306a36Sopenharmony_ci * of the License, or (at your option) any later version. 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, 1762306a36Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 1862306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1962306a36Sopenharmony_ci * GNU General Public License for more details. 2062306a36Sopenharmony_ci * 2162306a36Sopenharmony_ci * NO WARRANTY 2262306a36Sopenharmony_ci * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 2362306a36Sopenharmony_ci * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 2462306a36Sopenharmony_ci * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 2562306a36Sopenharmony_ci * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 2662306a36Sopenharmony_ci * solely responsible for determining the appropriateness of using and 2762306a36Sopenharmony_ci * distributing the Program and assumes all risks associated with its 2862306a36Sopenharmony_ci * exercise of rights under this Agreement, including but not limited to 2962306a36Sopenharmony_ci * the risks and costs of program errors, damage to or loss of data, 3062306a36Sopenharmony_ci * programs or equipment, and unavailability or interruption of operations. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci * DISCLAIMER OF LIABILITY 3362306a36Sopenharmony_ci * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 3462306a36Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3562306a36Sopenharmony_ci * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 3662306a36Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 3762306a36Sopenharmony_ci * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 3862306a36Sopenharmony_ci * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 3962306a36Sopenharmony_ci * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 4262306a36Sopenharmony_ci * along with this program; if not, write to the Free Software 4362306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 4462306a36Sopenharmony_ci * USA. 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci /* Diagnostic Trigger Configuration Data Structures */ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED 4962306a36Sopenharmony_ci#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* limitation on number of entries */ 5262306a36Sopenharmony_ci#define NUM_VALID_ENTRIES (20) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* trigger types */ 5562306a36Sopenharmony_ci#define MPT3SAS_TRIGGER_MASTER (1) 5662306a36Sopenharmony_ci#define MPT3SAS_TRIGGER_EVENT (2) 5762306a36Sopenharmony_ci#define MPT3SAS_TRIGGER_SCSI (3) 5862306a36Sopenharmony_ci#define MPT3SAS_TRIGGER_MPI (4) 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* trigger names */ 6162306a36Sopenharmony_ci#define MASTER_TRIGGER_FILE_NAME "diag_trigger_master" 6262306a36Sopenharmony_ci#define EVENT_TRIGGERS_FILE_NAME "diag_trigger_event" 6362306a36Sopenharmony_ci#define SCSI_TRIGGERS_FILE_NAME "diag_trigger_scsi" 6462306a36Sopenharmony_ci#define MPI_TRIGGER_FILE_NAME "diag_trigger_mpi" 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* master trigger bitmask */ 6762306a36Sopenharmony_ci#define MASTER_TRIGGER_FW_FAULT (0x00000001) 6862306a36Sopenharmony_ci#define MASTER_TRIGGER_ADAPTER_RESET (0x00000002) 6962306a36Sopenharmony_ci#define MASTER_TRIGGER_TASK_MANAGMENT (0x00000004) 7062306a36Sopenharmony_ci#define MASTER_TRIGGER_DEVICE_REMOVAL (0x00000008) 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci/* fake firmware event for trigger */ 7362306a36Sopenharmony_ci#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED (0x6E) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci/** 7662306a36Sopenharmony_ci * MasterTrigger is a single U32 passed to/from sysfs. 7762306a36Sopenharmony_ci * 7862306a36Sopenharmony_ci * Bit Flags (enables) include: 7962306a36Sopenharmony_ci * 1. FW Faults 8062306a36Sopenharmony_ci * 2. Adapter Reset issued by driver 8162306a36Sopenharmony_ci * 3. TMs 8262306a36Sopenharmony_ci * 4. Device Remove Event sent by FW 8362306a36Sopenharmony_ci */ 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_cistruct SL_WH_MASTER_TRIGGER_T { 8662306a36Sopenharmony_ci uint32_t MasterData; 8762306a36Sopenharmony_ci}; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci/** 9062306a36Sopenharmony_ci * struct SL_WH_EVENT_TRIGGER_T - Definition of an event trigger element 9162306a36Sopenharmony_ci * @EventValue: Event Code to trigger on 9262306a36Sopenharmony_ci * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event only) 9362306a36Sopenharmony_ci * 9462306a36Sopenharmony_ci * Defines an event that should induce a DIAG_TRIGGER driver event if observed. 9562306a36Sopenharmony_ci */ 9662306a36Sopenharmony_cistruct SL_WH_EVENT_TRIGGER_T { 9762306a36Sopenharmony_ci uint16_t EventValue; 9862306a36Sopenharmony_ci uint16_t LogEntryQualifier; 9962306a36Sopenharmony_ci}; 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/** 10262306a36Sopenharmony_ci * struct SL_WH_EVENT_TRIGGERS_T - Structure passed to/from sysfs containing a 10362306a36Sopenharmony_ci * list of Event Triggers to be monitored for. 10462306a36Sopenharmony_ci * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this 10562306a36Sopenharmony_ci * structure. 10662306a36Sopenharmony_ci * @EventTriggerEntry: List of Event trigger elements. 10762306a36Sopenharmony_ci * 10862306a36Sopenharmony_ci * This binary structure is transferred via sysfs to get/set Event Triggers 10962306a36Sopenharmony_ci * in the Linux Driver. 11062306a36Sopenharmony_ci */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_cistruct SL_WH_EVENT_TRIGGERS_T { 11362306a36Sopenharmony_ci uint32_t ValidEntries; 11462306a36Sopenharmony_ci struct SL_WH_EVENT_TRIGGER_T EventTriggerEntry[NUM_VALID_ENTRIES]; 11562306a36Sopenharmony_ci}; 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci/** 11862306a36Sopenharmony_ci * struct SL_WH_SCSI_TRIGGER_T - Definition of a SCSI trigger element 11962306a36Sopenharmony_ci * @ASCQ: Additional Sense Code Qualifier. Can be specific or 0xFF for 12062306a36Sopenharmony_ci * wildcard. 12162306a36Sopenharmony_ci * @ASC: Additional Sense Code. Can be specific or 0xFF for wildcard 12262306a36Sopenharmony_ci * @SenseKey: SCSI Sense Key 12362306a36Sopenharmony_ci * 12462306a36Sopenharmony_ci * Defines a sense key (single or many variants) that should induce a 12562306a36Sopenharmony_ci * DIAG_TRIGGER driver event if observed. 12662306a36Sopenharmony_ci */ 12762306a36Sopenharmony_cistruct SL_WH_SCSI_TRIGGER_T { 12862306a36Sopenharmony_ci U8 ASCQ; 12962306a36Sopenharmony_ci U8 ASC; 13062306a36Sopenharmony_ci U8 SenseKey; 13162306a36Sopenharmony_ci U8 Reserved; 13262306a36Sopenharmony_ci}; 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci/** 13562306a36Sopenharmony_ci * struct SL_WH_SCSI_TRIGGERS_T - Structure passed to/from sysfs containing a 13662306a36Sopenharmony_ci * list of SCSI sense codes that should trigger a DIAG_SERVICE event when 13762306a36Sopenharmony_ci * observed. 13862306a36Sopenharmony_ci * @ValidEntries: Number of _SL_WH_SCSI_TRIGGER_T structures contained in this 13962306a36Sopenharmony_ci * structure. 14062306a36Sopenharmony_ci * @SCSITriggerEntry: List of SCSI Sense Code trigger elements. 14162306a36Sopenharmony_ci * 14262306a36Sopenharmony_ci * This binary structure is transferred via sysfs to get/set SCSI Sense Code 14362306a36Sopenharmony_ci * Triggers in the Linux Driver. 14462306a36Sopenharmony_ci */ 14562306a36Sopenharmony_cistruct SL_WH_SCSI_TRIGGERS_T { 14662306a36Sopenharmony_ci uint32_t ValidEntries; 14762306a36Sopenharmony_ci struct SL_WH_SCSI_TRIGGER_T SCSITriggerEntry[NUM_VALID_ENTRIES]; 14862306a36Sopenharmony_ci}; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/** 15162306a36Sopenharmony_ci * struct SL_WH_MPI_TRIGGER_T - Definition of an MPI trigger element 15262306a36Sopenharmony_ci * @IOCStatus: MPI IOCStatus 15362306a36Sopenharmony_ci * @IocLogInfo: MPI IocLogInfo. Can be specific or 0xFFFFFFFF for wildcard 15462306a36Sopenharmony_ci * 15562306a36Sopenharmony_ci * Defines a MPI IOCStatus/IocLogInfo pair that should induce a DIAG_TRIGGER 15662306a36Sopenharmony_ci * driver event if observed. 15762306a36Sopenharmony_ci */ 15862306a36Sopenharmony_cistruct SL_WH_MPI_TRIGGER_T { 15962306a36Sopenharmony_ci uint16_t IOCStatus; 16062306a36Sopenharmony_ci uint16_t Reserved; 16162306a36Sopenharmony_ci uint32_t IocLogInfo; 16262306a36Sopenharmony_ci}; 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci/** 16562306a36Sopenharmony_ci * struct SL_WH_MPI_TRIGGERS_T - Structure passed to/from sysfs containing a 16662306a36Sopenharmony_ci * list of MPI IOCStatus/IocLogInfo pairs that should trigger a DIAG_SERVICE 16762306a36Sopenharmony_ci * event when observed. 16862306a36Sopenharmony_ci * @ValidEntries: Number of _SL_WH_MPI_TRIGGER_T structures contained in this 16962306a36Sopenharmony_ci * structure. 17062306a36Sopenharmony_ci * @MPITriggerEntry: List of MPI IOCStatus/IocLogInfo trigger elements. 17162306a36Sopenharmony_ci * 17262306a36Sopenharmony_ci * This binary structure is transferred via sysfs to get/set MPI Error Triggers 17362306a36Sopenharmony_ci * in the Linux Driver. 17462306a36Sopenharmony_ci */ 17562306a36Sopenharmony_cistruct SL_WH_MPI_TRIGGERS_T { 17662306a36Sopenharmony_ci uint32_t ValidEntries; 17762306a36Sopenharmony_ci struct SL_WH_MPI_TRIGGER_T MPITriggerEntry[NUM_VALID_ENTRIES]; 17862306a36Sopenharmony_ci}; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci/** 18162306a36Sopenharmony_ci * struct SL_WH_TRIGGERS_EVENT_DATA_T - event data for trigger 18262306a36Sopenharmony_ci * @trigger_type: trigger type (see MPT3SAS_TRIGGER_XXXX) 18362306a36Sopenharmony_ci * @u: trigger condition that caused trigger to be sent 18462306a36Sopenharmony_ci */ 18562306a36Sopenharmony_cistruct SL_WH_TRIGGERS_EVENT_DATA_T { 18662306a36Sopenharmony_ci uint32_t trigger_type; 18762306a36Sopenharmony_ci union { 18862306a36Sopenharmony_ci struct SL_WH_MASTER_TRIGGER_T master; 18962306a36Sopenharmony_ci struct SL_WH_EVENT_TRIGGER_T event; 19062306a36Sopenharmony_ci struct SL_WH_SCSI_TRIGGER_T scsi; 19162306a36Sopenharmony_ci struct SL_WH_MPI_TRIGGER_T mpi; 19262306a36Sopenharmony_ci } u; 19362306a36Sopenharmony_ci}; 19462306a36Sopenharmony_ci#endif /* MPT3SAS_TRIGGER_DIAG_H_INCLUDED */ 195