_mali_osk_errcode_t mali_mmu_initialize(void)
{
	/* allocate the helper pages */
	mali_empty_page_directory_phys = mali_allocate_empty_page(&mali_empty_page_directory_virt);
	if (0 == mali_empty_page_directory_phys) {
		MALI_DEBUG_PRINT_ERROR(("Mali MMU: Could not allocate empty page directory.\n"));
		mali_empty_page_directory_phys = MALI_INVALID_PAGE;
		return _MALI_OSK_ERR_NOMEM;
	}

	if (_MALI_OSK_ERR_OK != mali_create_fault_flush_pages(&mali_page_fault_flush_page_directory,
			&mali_page_fault_flush_page_directory_mapping,
			&mali_page_fault_flush_page_table,
			&mali_page_fault_flush_page_table_mapping,
			&mali_page_fault_flush_data_page,
			&mali_page_fault_flush_data_page_mapping)) {
		MALI_DEBUG_PRINT_ERROR(("Mali MMU: Could not allocate fault flush pages\n"));
		mali_free_empty_page(mali_empty_page_directory_phys, mali_empty_page_directory_virt);
		mali_empty_page_directory_phys = MALI_INVALID_PAGE;
		mali_empty_page_directory_virt = NULL;
		return _MALI_OSK_ERR_NOMEM;
	}

	return _MALI_OSK_ERR_OK;
}
示例#2
0
_mali_osk_errcode_t mali_mmu_initialize(void)
{
	/* allocate the helper pages */
	mali_empty_page_directory = mali_allocate_empty_page();
	if(0 == mali_empty_page_directory)
	{
		mali_empty_page_directory = MALI_INVALID_PAGE;
		return _MALI_OSK_ERR_NOMEM;
	}

	if (_MALI_OSK_ERR_OK != mali_create_fault_flush_pages(&mali_page_fault_flush_page_directory,
	                                &mali_page_fault_flush_page_table, &mali_page_fault_flush_data_page))
	{
		mali_free_empty_page(mali_empty_page_directory);
		return _MALI_OSK_ERR_FAULT;
	}

	return _MALI_OSK_ERR_OK;
}