1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2017 Etnaviv Project 4 */ 5 6 #ifndef __ETNAVIV_CMDBUF_H__ 7 #define __ETNAVIV_CMDBUF_H__ 8 9 #include <linux/types.h> 10 11 struct device; 12 struct etnaviv_iommu; 13 struct etnaviv_vram_mapping; 14 struct etnaviv_cmdbuf_suballoc; 15 struct etnaviv_perfmon_request; 16 17 struct etnaviv_cmdbuf { 18 /* suballocator this cmdbuf is allocated from */ 19 struct etnaviv_cmdbuf_suballoc *suballoc; 20 /* cmdbuf properties */ 21 int suballoc_offset; 22 void *vaddr; 23 u32 size; 24 u32 user_size; 25 }; 26 27 struct etnaviv_cmdbuf_suballoc * 28 etnaviv_cmdbuf_suballoc_new(struct device *dev); 29 void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc); 30 int etnaviv_cmdbuf_suballoc_map(struct etnaviv_cmdbuf_suballoc *suballoc, 31 struct etnaviv_iommu *mmu, 32 struct etnaviv_vram_mapping *mapping, 33 u32 memory_base); 34 void etnaviv_cmdbuf_suballoc_unmap(struct etnaviv_iommu *mmu, 35 struct etnaviv_vram_mapping *mapping); 36 37 38 int etnaviv_cmdbuf_init(struct etnaviv_cmdbuf_suballoc *suballoc, 39 struct etnaviv_cmdbuf *cmdbuf, u32 size); 40 void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf); 41 42 u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf, 43 struct etnaviv_vram_mapping *mapping); 44 dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf); 45 46 #endif /* __ETNAVIV_CMDBUF_H__ */ 47