mpt3sas_trigger_diag.h 6.8 KB

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