1 /* SPDX-License-Identifier: GPL-2.0
3 * Copyright 2017-2020 HabanaLabs, Ltd.
8 #ifndef GAUDI_PACKETS_H
9 #define GAUDI_PACKETS_H
11 #include <linux/types.h>
13 #define PACKET_HEADER_PACKET_ID_SHIFT 56
14 #define PACKET_HEADER_PACKET_ID_MASK 0x1F00000000000000ull
18 PACKET_WREG_BULK
= 0x2,
19 PACKET_MSG_LONG
= 0x3,
20 PACKET_MSG_SHORT
= 0x4,
23 PACKET_MSG_PROT
= 0x7,
28 PACKET_ARB_POINT
= 0xC,
30 PACKET_LOAD_AND_EXE
= 0xF,
31 MAX_PACKET_ID
= (PACKET_HEADER_PACKET_ID_MASK
>>
32 PACKET_HEADER_PACKET_ID_SHIFT
) + 1
35 #define GAUDI_PKT_CTL_OPCODE_SHIFT 24
36 #define GAUDI_PKT_CTL_OPCODE_MASK 0x1F000000
38 #define GAUDI_PKT_CTL_EB_SHIFT 29
39 #define GAUDI_PKT_CTL_EB_MASK 0x20000000
41 #define GAUDI_PKT_CTL_RB_SHIFT 30
42 #define GAUDI_PKT_CTL_RB_MASK 0x40000000
44 #define GAUDI_PKT_CTL_MB_SHIFT 31
45 #define GAUDI_PKT_CTL_MB_MASK 0x80000000
47 /* All packets have, at least, an 8-byte header, which contains
48 * the packet type. The kernel driver uses the packet header for packet
49 * validation and to perform any necessary required preparation before
50 * sending them off to the hardware.
54 /* The rest of the packet data follows. Use the corresponding
55 * packet_XXX struct to deference the data, based on packet type
70 struct packet_wreg32
{
75 struct packet_wreg_bulk
{
78 __le64 values
[]; /* data starts here */
81 #define GAUDI_PKT_LONG_CTL_OP_SHIFT 20
82 #define GAUDI_PKT_LONG_CTL_OP_MASK 0x00300000
84 struct packet_msg_long
{
90 #define GAUDI_PKT_SHORT_VAL_SOB_SYNC_VAL_SHIFT 0
91 #define GAUDI_PKT_SHORT_VAL_SOB_SYNC_VAL_MASK 0x00007FFF
93 #define GAUDI_PKT_SHORT_VAL_SOB_MOD_SHIFT 31
94 #define GAUDI_PKT_SHORT_VAL_SOB_MOD_MASK 0x80000000
96 #define GAUDI_PKT_SHORT_VAL_MON_SYNC_GID_SHIFT 0
97 #define GAUDI_PKT_SHORT_VAL_MON_SYNC_GID_MASK 0x000000FF
99 #define GAUDI_PKT_SHORT_VAL_MON_MASK_SHIFT 8
100 #define GAUDI_PKT_SHORT_VAL_MON_MASK_MASK 0x0000FF00
102 #define GAUDI_PKT_SHORT_VAL_MON_MODE_SHIFT 16
103 #define GAUDI_PKT_SHORT_VAL_MON_MODE_MASK 0x00010000
105 #define GAUDI_PKT_SHORT_VAL_MON_SYNC_VAL_SHIFT 17
106 #define GAUDI_PKT_SHORT_VAL_MON_SYNC_VAL_MASK 0xFFFE0000
108 #define GAUDI_PKT_SHORT_CTL_ADDR_SHIFT 0
109 #define GAUDI_PKT_SHORT_CTL_ADDR_MASK 0x0000FFFF
111 #define GAUDI_PKT_SHORT_CTL_OP_SHIFT 20
112 #define GAUDI_PKT_SHORT_CTL_OP_MASK 0x00300000
114 #define GAUDI_PKT_SHORT_CTL_BASE_SHIFT 22
115 #define GAUDI_PKT_SHORT_CTL_BASE_MASK 0x00C00000
117 struct packet_msg_short
{
122 struct packet_msg_prot
{
128 #define GAUDI_PKT_FENCE_CFG_DEC_VAL_SHIFT 0
129 #define GAUDI_PKT_FENCE_CFG_DEC_VAL_MASK 0x0000000F
131 #define GAUDI_PKT_FENCE_CFG_TARGET_VAL_SHIFT 16
132 #define GAUDI_PKT_FENCE_CFG_TARGET_VAL_MASK 0x00FF0000
134 #define GAUDI_PKT_FENCE_CFG_ID_SHIFT 30
135 #define GAUDI_PKT_FENCE_CFG_ID_MASK 0xC0000000
137 #define GAUDI_PKT_FENCE_CTL_PRED_SHIFT 0
138 #define GAUDI_PKT_FENCE_CTL_PRED_MASK 0x0000001F
140 struct packet_fence
{
145 #define GAUDI_PKT_LIN_DMA_CTL_WRCOMP_EN_SHIFT 0
146 #define GAUDI_PKT_LIN_DMA_CTL_WRCOMP_EN_MASK 0x00000001
148 #define GAUDI_PKT_LIN_DMA_CTL_LIN_SHIFT 3
149 #define GAUDI_PKT_LIN_DMA_CTL_LIN_MASK 0x00000008
151 #define GAUDI_PKT_LIN_DMA_CTL_MEMSET_SHIFT 4
152 #define GAUDI_PKT_LIN_DMA_CTL_MEMSET_MASK 0x00000010
154 #define GAUDI_PKT_LIN_DMA_DST_ADDR_SHIFT 0
155 #define GAUDI_PKT_LIN_DMA_DST_ADDR_MASK 0x00FFFFFFFFFFFFFFull
157 struct packet_lin_dma
{
164 struct packet_arb_point
{
169 struct packet_repeat
{
179 #define GAUDI_PKT_LOAD_AND_EXE_CFG_DST_SHIFT 0
180 #define GAUDI_PKT_LOAD_AND_EXE_CFG_DST_MASK 0x00000001
182 struct packet_load_and_exe
{
188 struct packet_cp_dma
{
194 #endif /* GAUDI_PACKETS_H */