STATIC int balong_ion_free_mem_to_buddy(void) { int i; u32 fb_heap_phy = 0; struct ion_heap_info_data mem_data; if (0 != hisi_ion_get_heap_info(ION_FB_HEAP_ID, &mem_data)) { balongfb_loge("fail to get ION_FB_HEAP_ID\n"); return -EINVAL; } if (0 == mem_data.heap_size) { balongfb_loge("fb reserved size 0\n"); return -EINVAL; } fb_heap_phy = mem_data.heap_phy; for(i = 0; i < ((mem_data.heap_size)/PAGE_SIZE); i++){ free_reserved_page(phys_to_page(mem_data.heap_phy)); #ifdef CONFIG_HIGHMEM if (PageHighMem(phys_to_page(mem_data.heap_phy))) totalhigh_pages += 1; #endif mem_data.heap_phy += PAGE_SIZE; } memblock_free(fb_heap_phy, mem_data.heap_size); return 0; }
/* init the config.h with dynamic mem of hisi */ void mali_hisi_mem_init(void) { struct ion_heap_info_data mem_data; if (0 != hisi_ion_get_heap_info(ION_FB_HEAP_ID, &mem_data)) { MALI_PRINT( ("MALI Error : failed to get ION_FB_HEAP_ID \n")); return; } if (0 == mem_data.heap_size) { MALI_PRINT( ("MALI Error : fb size is 0! \n")); return; } mali_gpu_data.fb_size = mem_data.heap_size;//PLAT_MEM_FB_SIZE; mali_gpu_data.fb_start = (unsigned long)(mem_data.heap_phy);//hisi_reserved_fb_phymem; MALI_DEBUG_PRINT(2, ("mali_hisi_mem_init(): fb_size 0x%x, mali_gpu_data.fb_start 0x%x\n", mali_gpu_data.fb_size,mali_gpu_data.fb_start)); }