1 /* SPDX-License-Identifier: GPL-2.0 2 * 3 * Copyright 2016-2018 HabanaLabs, Ltd. 4 * All Rights Reserved. 5 * 6 */ 7 8 #ifndef QMAN_IF_H 9 #define QMAN_IF_H 10 11 #include <linux/types.h> 12 13 /* 14 * PRIMARY QUEUE 15 */ 16 17 struct hl_bd { 18 __le64 ptr; 19 __le32 len; 20 __le32 ctl; 21 }; 22 23 #define HL_BD_SIZE sizeof(struct hl_bd) 24 25 /* 26 * S/W CTL FIELDS. 27 * 28 * BD_CTL_REPEAT_VALID tells the CP whether the repeat field in the BD CTL is 29 * valid. 1 means the repeat field is valid, 0 means not-valid, 30 * i.e. repeat == 1 31 */ 32 #define BD_CTL_REPEAT_VALID_SHIFT 24 33 #define BD_CTL_REPEAT_VALID_MASK 0x01000000 34 35 #define BD_CTL_SHADOW_INDEX_SHIFT 0 36 #define BD_CTL_SHADOW_INDEX_MASK 0x00000FFF 37 38 /* 39 * H/W CTL FIELDS 40 */ 41 42 #define BD_CTL_COMP_OFFSET_SHIFT 16 43 #define BD_CTL_COMP_OFFSET_MASK 0x0FFF0000 44 45 #define BD_CTL_COMP_DATA_SHIFT 0 46 #define BD_CTL_COMP_DATA_MASK 0x0000FFFF 47 48 /* 49 * COMPLETION QUEUE 50 */ 51 52 struct hl_cq_entry { 53 __le32 data; 54 }; 55 56 #define HL_CQ_ENTRY_SIZE sizeof(struct hl_cq_entry) 57 58 #define CQ_ENTRY_READY_SHIFT 31 59 #define CQ_ENTRY_READY_MASK 0x80000000 60 61 #define CQ_ENTRY_SHADOW_INDEX_VALID_SHIFT 30 62 #define CQ_ENTRY_SHADOW_INDEX_VALID_MASK 0x40000000 63 64 #define CQ_ENTRY_SHADOW_INDEX_SHIFT BD_CTL_SHADOW_INDEX_SHIFT 65 #define CQ_ENTRY_SHADOW_INDEX_MASK BD_CTL_SHADOW_INDEX_MASK 66 67 68 #endif /* QMAN_IF_H */ 69