1 /* 2 * Copyright (C) 2010-2014, 2016-2017 ARM Limited. All rights reserved. 3 * 4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2 5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. 6 * 7 * A copy of the licence is included with the program, and can also be obtained from Free Software 8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 9 */ 10 11 #ifndef __UMP_KERNEL_TYPES_H__ 12 #define __UMP_KERNEL_TYPES_H__ 13 14 #include "ump_kernel_interface.h" 15 #include "mali_osk.h" 16 17 #include <linux/rbtree.h> 18 #ifdef CONFIG_DMA_SHARED_BUFFER 19 #include <linux/dma-buf.h> 20 #endif 21 22 typedef enum { 23 UMP_USED_BY_CPU = 0, 24 UMP_USED_BY_MALI = 1, 25 UMP_USED_BY_UNKNOWN_DEVICE = 100, 26 } ump_hw_usage; 27 28 typedef enum { 29 UMP_NOT_LOCKED = 0, 30 UMP_READ = 1, 31 UMP_READ_WRITE = 3, 32 } ump_lock_usage; 33 34 /* 35 * This struct is what is "behind" a ump_dd_handle 36 */ 37 typedef struct ump_dd_mem { 38 struct rb_node node; 39 ump_secure_id secure_id; 40 _mali_osk_atomic_t ref_count; 41 unsigned long size_bytes; 42 unsigned long nr_blocks; 43 ump_dd_physical_block *block_array; 44 void (*release_func)(void *ctx, struct ump_dd_mem *descriptor); 45 void *ctx; 46 void *backend_info; 47 int is_cached; 48 ump_hw_usage hw_device; 49 ump_lock_usage lock_usage; 50 #ifdef CONFIG_DMA_SHARED_BUFFER 51 struct dma_buf_attachment *import_attach; 52 struct sg_table *sgt; 53 #endif 54 } ump_dd_mem; 55 56 57 58 #endif /* __UMP_KERNEL_TYPES_H__ */ 59