18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __MM_CMA_H__ 38c2ecf20Sopenharmony_ci#define __MM_CMA_H__ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/debugfs.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cistruct cma { 88c2ecf20Sopenharmony_ci unsigned long base_pfn; 98c2ecf20Sopenharmony_ci unsigned long count; 108c2ecf20Sopenharmony_ci unsigned long *bitmap; 118c2ecf20Sopenharmony_ci unsigned int order_per_bit; /* Order of pages represented by one bit */ 128c2ecf20Sopenharmony_ci struct mutex lock; 138c2ecf20Sopenharmony_ci#ifdef CONFIG_CMA_DEBUGFS 148c2ecf20Sopenharmony_ci struct hlist_head mem_head; 158c2ecf20Sopenharmony_ci spinlock_t mem_head_lock; 168c2ecf20Sopenharmony_ci struct debugfs_u32_array dfs_bitmap; 178c2ecf20Sopenharmony_ci#endif 188c2ecf20Sopenharmony_ci char name[CMA_MAX_NAME]; 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciextern struct cma cma_areas[MAX_CMA_AREAS]; 228c2ecf20Sopenharmony_ciextern unsigned cma_area_count; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic inline unsigned long cma_bitmap_maxno(struct cma *cma) 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci return cma->count >> cma->order_per_bit; 278c2ecf20Sopenharmony_ci} 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#endif 30