1 //////////////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2006-2007 MStar Semiconductor, Inc. 4 // All rights reserved. 5 // 6 // Unless otherwise stipulated in writing, any and all information contained 7 // herein regardless in any format shall remain the sole proprietary of 8 // MStar Semiconductor Inc. and be kept in strict confidence 9 // (��MStar Confidential Information��) by the recipient. 10 // Any unauthorized act including without limitation unauthorized disclosure, 11 // copying, use, reproduction, sale, distribution, modification, disassembling, 12 // reverse engineering and compiling of the contents of MStar Confidential 13 // Information is unlawful and strictly prohibited. MStar hereby reserves the 14 // rights to any and all damages, losses, costs and expenses resulting therefrom. 15 // 16 //////////////////////////////////////////////////////////////////////////////// 17 18 /////////////////////////////////////////////////////////////////////////////////////////////////// 19 /// 20 /// @file cma_mpool_manager.h 21 /// @brief CMA mpool Manager interface 22 /// @author MStar Semiconductor Inc. 23 /// 24 /////////////////////////////////////////////////////////////////////////////////////////////////// 25 26 #ifndef __DRV_CMA_POOL_ST_H__ 27 #define __DRV_CMA_POOL_ST_H__ 28 #define KERN_CHUNK_NUM 3 29 30 struct cma_alloc_args { 31 MS_U64 offset_in_heap; 32 MS_VIRT cpu_addr; 33 MS_SIZE length; 34 MS_U64 align; 35 MS_U32 heap_id; 36 MS_U32 flags; 37 }; 38 39 struct cma_free_args { 40 MS_U32 heap_id; 41 MS_U64 offset_in_heap; 42 MS_SIZE length; 43 }; 44 45 struct cma_heap_info { 46 MS_U32 heap_id; 47 MS_VIRT flags; 48 49 MS_U32 miu; 50 MS_U64 bus_addr; 51 MS_U64 heap_miu_start_offset; 52 MS_SIZE heap_length; 53 MS_VIRT virt_addr;//out:if need,shoud give this out put 54 }; 55 56 struct pa_in_cma_pool_args 57 { 58 MS_U64 PA;//in: PA value 59 MS_S32 miu;//out: in which miu 60 61 MS_BOOL in_heap;//out: whether in heap.If not, relative value can not get. 62 MS_S32 heap_id; //out: heap id the pa in 63 MS_U64 heap_miu_start_offset; //out: heap start offset in miu 64 MS_U64 heap_length; //out: heap leagth 65 MS_U64 pa_offset_in_heap; //out: pa location in heap 66 MS_S32 error_code; // error code when failed,not used yet 67 }; 68 69 //only kernel mode will use this 70 struct cma_get_info_from_pa { 71 MS_U64 PA;//in:phy addr that input 72 73 MS_U32 heap_id;//out:in which heap 74 MS_U32 miu;//out:in which miu 75 MS_U64 heap_miu_start_offset;//out:heap start offset in miu 76 MS_U64 heap_length;//out:heap length 77 MS_U64 pa_offset_in_heap;//out :pa offset in heap 78 }; 79 80 enum USER_VA_VALID_FLAG { 81 USER_VA_VALID = (1<<0), 82 NO_HEAP = (1<<1), 83 NO_USER_VA = (1<<2), 84 DIFFERENT_CACHE_TYPE = (1<<3), 85 }; 86 87 struct cma_heap_get_user_va { 88 MS_U32 heap_id;//in:in which heap 89 MS_U32 flags;//in:flags,such as cache or uncache 90 91 enum USER_VA_VALID_FLAG user_va_valid_flag;//out:whether vma is valid 92 MS_VIRT heap_start_user_space_virt_addr;//out:if vma is valid and alloced,get this user space virt addr. 93 }; 94 95 struct cma_mmap_user_va_page { 96 MS_U32 heap_id;//in 97 MS_U32 flags;//in 98 }; 99 100 #endif 101 102