mpt3sas_trigger_diag.h 6.7 KB

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