xref: /freebsd/sys/dev/isci/scil/scu_event_codes.h (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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  * $FreeBSD$
55  */
56 #ifndef __SCU_EVENT_CODES_HEADER__
57 #define __SCU_EVENT_CODES_HEADER__
58 
59 /**
60  * @file
61  *
62  * @brief This file contains the constants and macros for the SCU event codes.
63  */
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif // __cplusplus
68 
69 #define SCU_EVENT_TYPE_CODE_SHIFT      24
70 #define SCU_EVENT_TYPE_CODE_MASK       0x0F000000
71 
72 #define SCU_EVENT_SPECIFIC_CODE_SHIFT  18
73 #define SCU_EVENT_SPECIFIC_CODE_MASK   0x00FC0000
74 
75 #define SCU_EVENT_CODE_MASK \
76    (SCU_EVENT_TYPE_CODE_MASK | SCU_EVENT_SPECIFIC_CODE_MASK)
77 
78 /**
79  * This macro constructs an SCU event type from the type value.
80  */
81 #define SCU_EVENT_TYPE(type) \
82    ((U32)(type) << SCU_EVENT_TYPE_CODE_SHIFT)
83 
84 /**
85  * This macro constructs an SCU event specifier from the code value.
86  */
87 #define SCU_EVENT_SPECIFIC(code) \
88    ((U32)(code) << SCU_EVENT_SPECIFIC_CODE_SHIFT)
89 
90 /**
91  * This macro constructs a combines an SCU event type and SCU event specifier
92  * from the type and code values.
93  */
94 #define SCU_EVENT_MESSAGE(type, code) \
95    ((type) | SCU_EVENT_SPECIFIC(code))
96 
97 /**
98  * @name SCU_EVENT_TYPES
99  */
100 /*@{*/
101 #define SCU_EVENT_TYPE_SMU_COMMAND_ERROR  SCU_EVENT_TYPE(0x08)
102 #define SCU_EVENT_TYPE_SMU_PCQ_ERROR      SCU_EVENT_TYPE(0x09)
103 #define SCU_EVENT_TYPE_SMU_ERROR          SCU_EVENT_TYPE(0x00)
104 #define SCU_EVENT_TYPE_TRANSPORT_ERROR    SCU_EVENT_TYPE(0x01)
105 #define SCU_EVENT_TYPE_BROADCAST_CHANGE   SCU_EVENT_TYPE(0x02)
106 #define SCU_EVENT_TYPE_OSSP_EVENT         SCU_EVENT_TYPE(0x03)
107 #define SCU_EVENT_TYPE_FATAL_MEMORY_ERROR SCU_EVENT_TYPE(0x0F)
108 #define SCU_EVENT_TYPE_RNC_SUSPEND_TX     SCU_EVENT_TYPE(0x04)
109 #define SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX  SCU_EVENT_TYPE(0x05)
110 #define SCU_EVENT_TYPE_RNC_OPS_MISC       SCU_EVENT_TYPE(0x06)
111 #define SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT SCU_EVENT_TYPE(0x07)
112 #define SCU_EVENT_TYPE_ERR_CNT_EVENT      SCU_EVENT_TYPE(0x0A)
113 /*@}*/
114 
115 /**
116  * @name SCU_EVENT_SPECIFIERS
117  */
118 /*@{*/
119 #define SCU_EVENT_SPECIFIER_DRIVER_SUSPEND 0x20
120 #define SCU_EVENT_SPECIFIER_RNC_RELEASE    0x00
121 /*@}*/
122 
123 /**
124  * @name SMU_COMMAND_EVENTS
125  */
126 /*@{*/
127 #define SCU_EVENT_INVALID_CONTEXT_COMMAND \
128    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_COMMAND_ERROR, 0x00)
129 /*@}*/
130 
131 /**
132  * @name SMU_PCQ_EVENTS
133  */
134 /*@{*/
135 #define SCU_EVENT_UNCORRECTABLE_PCQ_ERROR \
136    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_PCQ_ERROR, 0x00)
137 /*@}*/
138 
139 /**
140  *  @name SMU_EVENTS
141  */
142 /*@{*/
143 #define SCU_EVENT_UNCORRECTABLE_REGISTER_WRITE \
144    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x02)
145 #define SCU_EVENT_UNCORRECTABLE_REGISTER_READ \
146    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x03)
147 #define SCU_EVENT_PCIE_INTERFACE_ERROR \
148    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x04)
149 #define SCU_EVENT_FUNCTION_LEVEL_RESET \
150    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_SMU_ERROR, 0x05)
151 /*@}*/
152 
153 /**
154  * @name TRANSPORT_LEVEL_ERRORS
155  */
156 /*@{*/
157 #define SCU_EVENT_ACK_NAK_TIMEOUT_ERROR \
158    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_TRANSPORT_ERROR, 0x00)
159 /*@}*/
160 
161 /**
162  * @name BROADCAST_CHANGE_EVENTS
163  */
164 /*@{*/
165 #define SCU_EVENT_BROADCAST_CHANGE \
166    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x01)
167 #define SCU_EVENT_BROADCAST_RESERVED0 \
168    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x02)
169 #define SCU_EVENT_BROADCAST_RESERVED1 \
170    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x03)
171 #define SCU_EVENT_BROADCAST_SES \
172    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x04)
173 #define SCU_EVENT_BROADCAST_EXPANDER \
174    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x05)
175 #define SCU_EVENT_BROADCAST_AEN \
176    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x06)
177 #define SCU_EVENT_BROADCAST_RESERVED3 \
178    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x07)
179 #define SCU_EVENT_BROADCAST_RESERVED4 \
180    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x08)
181 #define SCU_EVENT_PE_SUSPENDED \
182    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_BROADCAST_CHANGE, 0x09)
183 /*@}*/
184 
185 /**
186  * @name OSSP_EVENTS
187  */
188 /*@{*/
189 #define SCU_EVENT_PORT_SELECTOR_DETECTED \
190    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x10)
191 #define SCU_EVENT_SENT_PORT_SELECTION \
192    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x11)
193 #define SCU_EVENT_HARD_RESET_TRANSMITTED \
194    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x12)
195 #define SCU_EVENT_HARD_RESET_RECEIVED \
196    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x13)
197 #define SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT \
198    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x15)
199 #define SCU_EVENT_LINK_FAILURE \
200    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x16)
201 #define SCU_EVENT_SATA_SPINUP_HOLD \
202    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x17)
203 #define SCU_EVENT_SAS_15_SSC \
204    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x18)
205 #define SCU_EVENT_SAS_15 \
206    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x19)
207 #define SCU_EVENT_SAS_30_SSC \
208    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1A)
209 #define SCU_EVENT_SAS_30 \
210    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1B)
211 #define SCU_EVENT_SAS_60_SSC \
212    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1C)
213 #define SCU_EVENT_SAS_60 \
214    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1D)
215 #define SCU_EVENT_SATA_15_SSC \
216    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1E)
217 #define SCU_EVENT_SATA_15 \
218    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x1F)
219 #define SCU_EVENT_SATA_30_SSC \
220    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x20)
221 #define SCU_EVENT_SATA_30 \
222    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x21)
223 #define SCU_EVENT_SATA_60_SSC \
224    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x22)
225 #define SCU_EVENT_SATA_60 \
226    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x23)
227 #define SCU_EVENT_SAS_PHY_DETECTED \
228    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x24)
229 #define SCU_EVENT_SATA_PHY_DETECTED \
230    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_OSSP_EVENT, 0x25)
231 /*@}*/
232 
233 /**
234  * @name FATAL_INTERNAL_MEMORY_ERROR_EVENTS
235  */
236 /*@{*/
237 #define SCU_EVENT_TSC_RNSC_UNCORRECTABLE_ERROR \
238    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x00)
239 #define SCU_EVENT_TC_RNC_UNCORRECTABLE_ERROR \
240    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x01)
241 #define SCU_EVENT_ZPT_UNCORRECTABLE_ERROR \
242    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_FATAL_MEMORY_ERROR,  0x02)
243 /*@}*/
244 
245 /**
246  * @name REMOTE_NODE_SUSPEND_EVENTS
247  */
248 /*@{*/
249 #define SCU_EVENT_TL_RNC_SUSPEND_TX \
250    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x00)
251 #define SCU_EVENT_TL_RNC_SUSPEND_TX_RX \
252    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x00)
253 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DATA_LEN_ERR \
254    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x1A)
255 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_OFFSET_ERR \
256    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x20)
257 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_DMASETUP_DIERR \
258    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x27)
259 #define SCU_EVENT_TL_RNC_SUSPEND_TX_DONE_XFERCNT_ERR \
260    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x28)
261 #define SCU_EVENT_TL_RNC_SUSPEND_TX_RX_DONE_PLD_LEN_ERR \
262    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x21)
263 #define SCU_EVENT_DRIVER_POST_RNC_SUSPEND_TX \
264    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX, 0x20)
265 #define SCU_EVENT_DRIVER_POST_RNC_SUSPEND_TX_RX \
266    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX, 0x20)
267 /*@}*/
268 
269 /**
270  * @name REMOTE_NODE_MISC_EVENTS
271  */
272 /*@{*/
273 #define SCU_EVENT_POST_RCN_RELEASE \
274    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC,SCU_EVENT_SPECIFIER_RNC_RELEASE)
275 #define SCU_EVENT_POST_IT_NEXUS_LOSS_TIMER_ENABLE \
276    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x01)
277 #define SCU_EVENT_POST_IT_NEXUS_LOSS_TIMER_DISABLE \
278    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x02)
279 #define SCU_EVENT_POST_RNC_COMPLETE \
280    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x03)
281 #define SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE \
282    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_RNC_OPS_MISC, 0x04)
283 /*@}*/
284 
285 /**
286  * @name ERROR_COUNT_EVENT
287  */
288 /*@{*/
289 #define SCU_ERR_CNT_RX_CREDIT_BLOCKED_RECEIVED_INDEX  0x00
290 #define SCU_ERR_CNT_TX_DONE_CREDIT_TIMEOUT_INDEX      0x01
291 #define SCU_ERR_CNT_RX_DONE_CREDIT_TIMEOUT_INDEX      0x02
292 #define SCU_ERR_CNT_INACTIVITY_TIMER_EXPIRED_INDEX    0x03
293 #define SCU_ERR_CNT_TX_DONE_ACK_NAK_TIMEOUT_INDEX     0x04
294 #define SCU_ERR_CNT_RX_DONE_ACK_NAK_TIMEOUT_INDEX     0x05
295 #define SCU_ERR_CNT_MAX_INDEX                         0x06
296 
297 #define SCU_EVENT_ERR_CNT(name) \
298    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_ERR_CNT_EVENT, SCU_ERR_CNT_ ## name ## _INDEX)
299 /*@}*/
300 
301 /**
302  * This macro returns the SCU event type from the event code.
303  */
304 #define scu_get_event_type(event_code) \
305    ((event_code) & SCU_EVENT_TYPE_CODE_MASK)
306 
307 /**
308  * This macro returns the SCU event specifier from the event code.
309  */
310 #define scu_get_event_specifier(event_code) \
311    ((event_code) & SCU_EVENT_SPECIFIC_CODE_MASK)
312 
313 /**
314  * This macro returns the combined SCU event type and SCU event specifier from
315  * the event code.
316  */
317 #define scu_get_event_code(event_code) \
318    ((event_code) & SCU_EVENT_CODE_MASK)
319 
320 
321 /**
322  * @name PTS_SCHEDULE_EVENT
323  */
324 /*@{*/
325 #define SCU_EVENT_SMP_RESPONSE_NO_PE \
326    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x00)
327 #define SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE \
328    scu_get_event_specifier(SCU_EVENT_SMP_RESPONSE_NO_PE)
329 
330 #define SCU_EVENT_TASK_TIMEOUT \
331    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x01)
332 #define SCU_EVENT_SPECIFIC_TASK_TIMEOUT \
333    scu_get_event_specifier(SCU_EVENT_TASK_TIMEOUT)
334 
335 #define SCU_EVENT_IT_NEXUS_TIMEOUT \
336    SCU_EVENT_MESSAGE(SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT, 0x02)
337 #define SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT \
338    scu_get_event_specifier(SCU_EVENT_IT_NEXUS_TIMEOUT)
339 /*@}*/
340 
341 #ifdef __cplusplus
342 }
343 #endif // __cplusplus
344 
345 #endif // __SCU_EVENT_CODES_HEADER__
346