summaryrefslogtreecommitdiff
path: root/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
blob: 6586a463bea9730f14820ccc5bf2919ce605bb94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
 * This is the Fusion MPT base driver providing common API layer interface
 * to set Diagnostic triggers for MPT (Message Passing Technology) based
 * controllers
 *
 * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
 * Copyright (C) 2012-2014  LSI Corporation
 * Copyright (C) 2013-2014 Avago Technologies
 *  (mailto: MPT-FusionLinux.pdl@avagotech.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * NO WARRANTY
 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
 * solely responsible for determining the appropriateness of using and
 * distributing the Program and assumes all risks associated with its
 * exercise of rights under this Agreement, including but not limited to
 * the risks and costs of program errors, damage to or loss of data,
 * programs or equipment, and unavailability or interruption of operations.

 * DISCLAIMER OF LIABILITY
 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA.
 */
  /* Diagnostic Trigger Configuration Data Structures */

#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED
#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED

/* limitation on number of entries */
#define NUM_VALID_ENTRIES               (20)

/* trigger types */
#define MPT3SAS_TRIGGER_MASTER          (1)
#define MPT3SAS_TRIGGER_EVENT           (2)
#define MPT3SAS_TRIGGER_SCSI            (3)
#define MPT3SAS_TRIGGER_MPI             (4)

/* trigger names */
#define MASTER_TRIGGER_FILE_NAME        "diag_trigger_master"
#define EVENT_TRIGGERS_FILE_NAME        "diag_trigger_event"
#define SCSI_TRIGGERS_FILE_NAME         "diag_trigger_scsi"
#define MPI_TRIGGER_FILE_NAME           "diag_trigger_mpi"

/* master trigger bitmask */
#define MASTER_TRIGGER_FW_FAULT         (0x00000001)
#define MASTER_TRIGGER_ADAPTER_RESET    (0x00000002)
#define MASTER_TRIGGER_TASK_MANAGMENT   (0x00000004)
#define MASTER_TRIGGER_DEVICE_REMOVAL   (0x00000008)

/* fake firmware event for tigger */
#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED	(0x6E)

/**
 * MasterTrigger is a single U32 passed to/from sysfs.
 *
 * Bit Flags (enables) include:
 * 1. FW Faults
 * 2. Adapter Reset issued by driver
 * 3. TMs
 * 4. Device Remove Event sent by FW
 */

struct SL_WH_MASTER_TRIGGER_T {
	uint32_t MasterData;
};

/**
 * struct SL_WH_EVENT_TRIGGER_T -  Definition of an event trigger element
 * @EventValue: Event Code to trigger on
 * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event only)
 *
 * Defines an event that should induce a DIAG_TRIGGER driver event if observed.
 */
struct SL_WH_EVENT_TRIGGER_T {
	uint16_t EventValue;
	uint16_t LogEntryQualifier;
};

/**
 * struct SL_WH_EVENT_TRIGGERS_T -  Structure passed to/from sysfs containing a
 *    list of Event Triggers to be monitored for.
 * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this
 *    structure.
 * @EventTriggerEntry: List of Event trigger elements.
 *
 * This binary structure is transferred via sysfs to get/set Event Triggers
 * in the Linux Driver.
 */

struct SL_WH_EVENT_TRIGGERS_T {
	uint32_t ValidEntries;
	struct SL_WH_EVENT_TRIGGER_T EventTriggerEntry[NUM_VALID_ENTRIES];
};

/**
 * struct SL_WH_SCSI_TRIGGER_T -  Definition of a SCSI trigger element
 * @ASCQ: Additional Sense Code Qualifier.  Can be specific or 0xFF for
 *     wildcard.
 * @ASC: Additional Sense Code.  Can be specific or 0xFF for wildcard
 * @SenseKey: SCSI Sense Key
 *
 * Defines a sense key (single or many variants) that should induce a
 * DIAG_TRIGGER driver event if observed.
 */
struct SL_WH_SCSI_TRIGGER_T {
	U8 ASCQ;
	U8 ASC;
	U8 SenseKey;
	U8 Reserved;
};

/**
 * struct SL_WH_SCSI_TRIGGERS_T -  Structure passed to/from sysfs containing a
 *    list of SCSI sense codes that should trigger a DIAG_SERVICE event when
 *    observed.
 * @ValidEntries: Number of _SL_WH_SCSI_TRIGGER_T structures contained in this
 *    structure.
 * @SCSITriggerEntry: List of SCSI Sense Code trigger elements.
 *
 * This binary structure is transferred via sysfs to get/set SCSI Sense Code
 * Triggers in the Linux Driver.
 */
struct SL_WH_SCSI_TRIGGERS_T {
	uint32_t ValidEntries;
	struct SL_WH_SCSI_TRIGGER_T SCSITriggerEntry[NUM_VALID_ENTRIES];
};

/**
 * struct SL_WH_MPI_TRIGGER_T -  Definition of an MPI trigger element
 * @IOCStatus: MPI IOCStatus
 * @IocLogInfo: MPI IocLogInfo.  Can be specific or 0xFFFFFFFF for wildcard
 *
 * Defines a MPI IOCStatus/IocLogInfo pair that should induce a DIAG_TRIGGER
 * driver event if observed.
 */
struct SL_WH_MPI_TRIGGER_T {
	uint16_t IOCStatus;
	uint16_t Reserved;
	uint32_t IocLogInfo;
};

/**
 * struct SL_WH_MPI_TRIGGERS_T -  Structure passed to/from sysfs containing a
 *    list of MPI IOCStatus/IocLogInfo pairs that should trigger a DIAG_SERVICE
 *    event when observed.
 * @ValidEntries: Number of _SL_WH_MPI_TRIGGER_T structures contained in this
 *    structure.
 * @MPITriggerEntry: List of MPI IOCStatus/IocLogInfo trigger elements.
 *
 * This binary structure is transferred via sysfs to get/set MPI Error Triggers
 * in the Linux Driver.
 */
struct SL_WH_MPI_TRIGGERS_T {
	uint32_t ValidEntries;
	struct SL_WH_MPI_TRIGGER_T MPITriggerEntry[NUM_VALID_ENTRIES];
};

/**
 * struct SL_WH_TRIGGERS_EVENT_DATA_T -  event data for trigger
 * @trigger_type: trigger type (see MPT3SAS_TRIGGER_XXXX)
 * @u: trigger condition that caused trigger to be sent
 */
struct SL_WH_TRIGGERS_EVENT_DATA_T {
	uint32_t trigger_type;
	union {
		struct SL_WH_MASTER_TRIGGER_T master;
		struct SL_WH_EVENT_TRIGGER_T event;
		struct SL_WH_SCSI_TRIGGER_T scsi;
		struct SL_WH_MPI_TRIGGER_T mpi;
	} u;
};
#endif /* MPT3SAS_TRIGGER_DIAG_H_INCLUDED */