1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2018-2021 NXP
4  *
5  * Brief   CAAM Job Ring Status definition header.
6  */
7 #ifndef __JR_STATUS_H__
8 #define __JR_STATUS_H__
9 
10 #include <util.h>
11 
12 /* Source */
13 #define BM_JRSTA_SRC SHIFT_U32(0xF, 28)
14 
15 #define JRSTA_SRC_GET(status) ((status) & BM_JRSTA_SRC)
16 #define JRSTA_SRC(src)        SHIFT_U32(JRSTA_SRC_##src, 28)
17 
18 #define JRSTA_SRC_NONE          0x0
19 #define JRSTA_SRC_CCB           0x2
20 #define JRSTA_SRC_JMP_HALT_USER 0x3
21 #define JRSTA_SRC_DECO          0x4
22 #define JRSTA_SRC_JR            0x6
23 #define JRSTA_SRC_JMP_HALT_COND 0x7
24 
25 #define JRSTA_CCB_GET_ERR(status) ((status) & SHIFT_U32(0xFF, 0))
26 #define JRSTA_CCB_CHAID_RNG       SHIFT_U32(0x5, 4)
27 #define JRSTA_CCB_ERRID_HW        SHIFT_U32(0xB, 0)
28 #define JRSTA_DECO_ERRID_FORMAT   SHIFT_U32(0x88, 0)
29 #define JRSTA_DECO_INV_SIGNATURE  SHIFT_U32(0x86, 0)
30 
31 /* Return the Halt User status else 0 if not a Jump Halt User */
32 #define JRSTA_GET_HALT_USER(status)                                            \
33 	(__extension__({                                                       \
34 		__typeof__(status) _status = (status);                         \
35 		JRSTA_SRC_GET(_status) == JRSTA_SRC(JMP_HALT_USER) ?           \
36 			_status & UINT8_MAX :                                  \
37 			0; }))
38 #endif /* __CAAM_JR_STATUS_H__ */
39