xref: /freebsd/sys/dev/isci/scil/scu_event_codes.h (revision 8aac90f18aef7c9eea906c3ff9a001ca7b94f375)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * This file is provided under a dual BSD/GPLv2 license.  When using or
5  * redistributing this file, you may do so under either license.
6  *
7  * GPL LICENSE SUMMARY
8  *
9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23  * The full GNU General Public License is included in this distribution
24  * in the file called LICENSE.GPL.
25  *
26  * BSD LICENSE
27  *
28  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
35  *   * Redistributions of source code must retain the above copyright
36  *     notice, this list of conditions and the following disclaimer.
37  *   * Redistributions in binary form must reproduce the above copyright
38  *     notice, this list of conditions and the following disclaimer in
39  *     the documentation and/or other materials provided with the
40  *     distribution.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 #ifndef __SCU_EVENT_CODES_HEADER__
55 #define __SCU_EVENT_CODES_HEADER__
56 
57 /**
58  * @file
59  *
60  * @brief This file contains the constants and macros for the SCU event codes.
61  */
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif // __cplusplus
66 
67 #define SCU_EVENT_TYPE_CODE_SHIFT      24
68 #define SCU_EVENT_TYPE_CODE_MASK       0x0F000000
69 
70 #define SCU_EVENT_SPECIFIC_CODE_SHIFT  18
71 #define SCU_EVENT_SPECIFIC_CODE_MASK   0x00FC0000
72 
73 #define SCU_EVENT_CODE_MASK \
74    (SCU_EVENT_TYPE_CODE_MASK | SCU_EVENT_SPECIFIC_CODE_MASK)
75 
76 /**
77  * This macro constructs an SCU event type from the type value.
78  */
79 #define SCU_EVENT_TYPE(type) \
80    ((U32)(type) << SCU_EVENT_TYPE_CODE_SHIFT)
81 
82 /**
83  * This macro constructs an SCU event specifier from the code value.
84  */
85 #define SCU_EVENT_SPECIFIC(code) \
86    ((U32)(code) << SCU_EVENT_SPECIFIC_CODE_SHIFT)
87 
88 /**
89  * This macro constructs a combines an SCU event type and SCU event specifier
90  * from the type and code values.
91  */
92 #define SCU_EVENT_MESSAGE(type, code) \
93    ((type) | SCU_EVENT_SPECIFIC(code))
94 
95 /**
96  * @name SCU_EVENT_TYPES
97  */
98 /*@{*/
99 #define SCU_EVENT_TYPE_SMU_COMMAND_ERROR  SCU_EVENT_TYPE(0x08)
100 #define SCU_EVENT_TYPE_SMU_PCQ_ERROR      SCU_EVENT_TYPE(0x09)
101 #define SCU_EVENT_TYPE_SMU_ERROR          SCU_EVENT_TYPE(0x00)
102 #define SCU_EVENT_TYPE_TRANSPORT_ERROR    SCU_EVENT_TYPE(0x01)
103 #define SCU_EVENT_TYPE_BROADCAST_CHANGE   SCU_EVENT_TYPE(0x02)
104 #define SCU_EVENT_TYPE_OSSP_EVENT         SCU_EVENT_TYPE(0x03)
105 #define SCU_EVENT_TYPE_FATAL_MEMORY_ERROR SCU_EVENT_TYPE(0x0F)
106 #define SCU_EVENT_TYPE_RNC_SUSPEND_TX     SCU_EVENT_TYPE(0x04)
107 #define SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX  SCU_EVENT_TYPE(0x05)
108 #define SCU_EVENT_TYPE_RNC_OPS_MISC       SCU_EVENT_TYPE(0x06)
109 #define SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT SCU_EVENT_TYPE(0x07)
110 #define SCU_EVENT_TYPE_ERR_CNT_EVENT      SCU_EVENT_TYPE(0x0A)
111 /*@}*/
112 
113 /**
114  * @name SCU_EVENT_SPECIFIERS
115  */
116 /*@{*/
117 #define SCU_EVENT_SPECIFIER_DRIVER_SUSPEND 0x20
118 #define SCU_EVENT_SPECIFIER_RNC_RELEASE    0x00
119 /*@}*/
120 
121 /**
122  * @name SMU_COMMAND_EVENTS
123  */
124 /*@{*/
125 #define SCU_EVENT_INVALID_CONTEXT_COMMAND \
126    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_COMMAND_ERROR, 0x00)
127 /*@}*/
128 
129 /**
130  * @name SMU_PCQ_EVENTS
131  */
132 /*@{*/
133 #define SCU_EVENT_UNCORRECTABLE_PCQ_ERROR \
134    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_PCQ_ERROR, 0x00)
135 /*@}*/
136 
137 /**
138  *  @name SMU_EVENTS
139  */
140 /*@{*/
141 #define SCU_EVENT_UNCORRECTABLE_REGISTER_WRITE \
142    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x02)
143 #define SCU_EVENT_UNCORRECTABLE_REGISTER_READ \
144    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x03)
145 #define SCU_EVENT_PCIE_INTERFACE_ERROR \
146    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x04)
147 #define SCU_EVENT_FUNCTION_LEVEL_RESET \
148    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x05)
149 /*@}*/
150 
151 /**
152  * @name TRANSPORT_LEVEL_ERRORS
153  */
154 /*@{*/
155 #define SCU_EVENT_ACK_NAK_TIMEOUT_ERROR \
156    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_TRANSPORT_ERROR, 0x00)
157 /*@}*/
158 
159 /**
160  * @name BROADCAST_CHANGE_EVENTS
161  */
162 /*@{*/
163 #define SCU_EVENT_BROADCAST_CHANGE \
164    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x01)
165 #define SCU_EVENT_BROADCAST_RESERVED0 \
166    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x02)
167 #define SCU_EVENT_BROADCAST_RESERVED1 \
168    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x03)
169 #define SCU_EVENT_BROADCAST_SES \
170    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x04)
171 #define SCU_EVENT_BROADCAST_EXPANDER \
172    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x05)
173 #define SCU_EVENT_BROADCAST_AEN \
174    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x06)
175 #define SCU_EVENT_BROADCAST_RESERVED3 \
176    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x07)
177 #define SCU_EVENT_BROADCAST_RESERVED4 \
178    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x08)
179 #define SCU_EVENT_PE_SUSPENDED \
180    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x09)
181 /*@}*/
182 
183 /**
184  * @name OSSP_EVENTS
185  */
186 /*@{*/
187 #define SCU_EVENT_PORT_SELECTOR_DETECTED \
188    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x10)
189 #define SCU_EVENT_SENT_PORT_SELECTION \
190    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x11)
191 #define SCU_EVENT_HARD_RESET_TRANSMITTED \
192    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x12)
193 #define SCU_EVENT_HARD_RESET_RECEIVED \
194    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x13)
195 #define SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT \
196    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x15)
197 #define SCU_EVENT_LINK_FAILURE \
198    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x16)
199 #define SCU_EVENT_SATA_SPINUP_HOLD \
200    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x17)
201 #define SCU_EVENT_SAS_15_SSC \
202    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x18)
203 #define SCU_EVENT_SAS_15 \
204    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x19)
205 #define SCU_EVENT_SAS_30_SSC \
206    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1A)
207 #define SCU_EVENT_SAS_30 \
208    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1B)
209 #define SCU_EVENT_SAS_60_SSC \
210    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1C)
211 #define SCU_EVENT_SAS_60 \
212    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1D)
213 #define SCU_EVENT_SATA_15_SSC \
214    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1E)
215 #define SCU_EVENT_SATA_15 \
216    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1F)
217 #define SCU_EVENT_SATA_30_SSC \
218    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x20)
219 #define SCU_EVENT_SATA_30 \
220    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x21)
221 #define SCU_EVENT_SATA_60_SSC \
222    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x22)
223 #define SCU_EVENT_SATA_60 \
224    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x23)
225 #define SCU_EVENT_SAS_PHY_DETECTED \
226    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x24)
227 #define SCU_EVENT_SATA_PHY_DETECTED \
228    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x25)
229 /*@}*/
230 
231 /**
232  * @name FATAL_INTERNAL_MEMORY_ERROR_EVENTS
233  */
234 /*@{*/
235 #define SCU_EVENT_TSC_RNSC_UNCORRECTABLE_ERROR \
236    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x00)
237 #define SCU_EVENT_TC_RNC_UNCORRECTABLE_ERROR \
238    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x01)
239 #define SCU_EVENT_ZPT_UNCORRECTABLE_ERROR \
240    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x02)
241 /*@}*/
242 
243 /**
244  * @name REMOTE_NODE_SUSPEND_EVENTS
245  */
246 /*@{*/
247 #define SCU_EVENT_TL_RNC_SUSPEND_TX \
248    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x00)
249 #define SCU_EVENT_TL_RNC_SUSPEND_TX_RX \
250    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x00)
251 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DATA_LEN_ERR \
252    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x1A)
253 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_OFFSET_ERR \
254    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x20)
255 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DMASETUP_DIERR \
256    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x27)
257 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_XFERCNT_ERR \
258    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x28)
259 #define SCU_EVENT_TL_RNC_SUSPEND_TX_RX_DONE_PLD_LEN_ERR \
260    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x21)
261 #define SCU_EVENT_DRIVER_POST_RNC_SUSPEND_TX \
262    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x20)
263 #define SCU_EVENT_DRIVER_POST_RNC_SUSPEND_TX_RX \
264    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x20)
265 /*@}*/
266 
267 /**
268  * @name REMOTE_NODE_MISC_EVENTS
269  */
270 /*@{*/
271 #define SCU_EVENT_POST_RCN_RELEASE \
272    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC,SCU_EVENT_SPECIFIER_RNC_RELEASE)
273 #define SCU_EVENT_POST_IT_NEXUS_LOSS_TIMER_ENABLE \
274    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x01)
275 #define SCU_EVENT_POST_IT_NEXUS_LOSS_TIMER_DISABLE \
276    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x02)
277 #define SCU_EVENT_POST_RNC_COMPLETE \
278    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x03)
279 #define SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE \
280    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x04)
281 /*@}*/
282 
283 /**
284  * @name ERROR_COUNT_EVENT
285  */
286 /*@{*/
287 #define SCU_ERR_CNT_RX_CREDIT_BLOCKED_RECEIVED_INDEX  0x00
288 #define SCU_ERR_CNT_TX_DONE_CREDIT_TIMEOUT_INDEX      0x01
289 #define SCU_ERR_CNT_RX_DONE_CREDIT_TIMEOUT_INDEX      0x02
290 #define SCU_ERR_CNT_INACTIVITY_TIMER_EXPIRED_INDEX    0x03
291 #define SCU_ERR_CNT_TX_DONE_ACK_NAK_TIMEOUT_INDEX     0x04
292 #define SCU_ERR_CNT_RX_DONE_ACK_NAK_TIMEOUT_INDEX     0x05
293 #define SCU_ERR_CNT_MAX_INDEX                         0x06
294 
295 #define SCU_EVENT_ERR_CNT(name) \
296    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_ERR_CNT_EVENT, SCU_ERR_CNT_ ## name ## _INDEX)
297 /*@}*/
298 
299 /**
300  * This macro returns the SCU event type from the event code.
301  */
302 #define scu_get_event_type(event_code) \
303    ((event_code) & SCU_EVENT_TYPE_CODE_MASK)
304 
305 /**
306  * This macro returns the SCU event specifier from the event code.
307  */
308 #define scu_get_event_specifier(event_code) \
309    ((event_code) & SCU_EVENT_SPECIFIC_CODE_MASK)
310 
311 /**
312  * This macro returns the combined SCU event type and SCU event specifier from
313  * the event code.
314  */
315 #define scu_get_event_code(event_code) \
316    ((event_code) & SCU_EVENT_CODE_MASK)
317 
318 
319 /**
320  * @name PTS_SCHEDULE_EVENT
321  */
322 /*@{*/
323 #define SCU_EVENT_SMP_RESPONSE_NO_PE \
324    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x00)
325 #define SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE \
326    scu_get_event_specifier(SCU_EVENT_SMP_RESPONSE_NO_PE)
327 
328 #define SCU_EVENT_TASK_TIMEOUT \
329    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x01)
330 #define SCU_EVENT_SPECIFIC_TASK_TIMEOUT \
331    scu_get_event_specifier(SCU_EVENT_TASK_TIMEOUT)
332 
333 #define SCU_EVENT_IT_NEXUS_TIMEOUT \
334    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x02)
335 #define SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT \
336    scu_get_event_specifier(SCU_EVENT_IT_NEXUS_TIMEOUT)
337 /*@}*/
338 
339 #ifdef __cplusplus
340 }
341 #endif // __cplusplus
342 
343 #endif // __SCU_EVENT_CODES_HEADER__
344