_mali_osk_errcode_t mali_core_signal_power_down( mali_pmm_core_id core, mali_bool immediate_only )
{
	switch( core )
	{
	case MALI_PMM_CORE_GP:
		MALI_CHECK_NO_ERROR(maligp_signal_power_down(immediate_only));
		break;
#if defined USING_MALI400_L2_CACHE
	case MALI_PMM_CORE_L2:
		/* Nothing to do */
		break;
#endif
	case MALI_PMM_CORE_PP0:
		MALI_CHECK_NO_ERROR(malipp_signal_power_down(0, immediate_only));
		break;
	case MALI_PMM_CORE_PP1:
		MALI_CHECK_NO_ERROR(malipp_signal_power_down(1, immediate_only));
		break;
	case MALI_PMM_CORE_PP2:
		MALI_CHECK_NO_ERROR(malipp_signal_power_down(2, immediate_only));
		break;
	case MALI_PMM_CORE_PP3:
		MALI_CHECK_NO_ERROR(malipp_signal_power_down(3, immediate_only));
		break;
	default:
		/* Unknown core */
		MALI_DEBUG_PRINT_ERROR( ("Unknown core signalled with power down: %d\n", core) );
		MALI_ERROR( _MALI_OSK_ERR_INVALID_ARGS );
	}
	
	MALI_SUCCESS;
}
static _mali_osk_errcode_t dump_mmu_page_table(struct mali_page_directory *pagedir, struct dump_info *info)
{
	MALI_DEBUG_ASSERT_POINTER(pagedir);
	MALI_DEBUG_ASSERT_POINTER(info);

	if (NULL != pagedir->page_directory_mapped) {
		int i;

		MALI_CHECK_NO_ERROR(
			mali_mmu_dump_page(pagedir->page_directory_mapped, pagedir->page_directory, info)
		);

		for (i = 0; i < 1024; i++) {
			if (NULL != pagedir->page_entries_mapped[i]) {
				MALI_CHECK_NO_ERROR(
					mali_mmu_dump_page(pagedir->page_entries_mapped[i],
							   _mali_osk_mem_ioread32(pagedir->page_directory_mapped,
									   i * sizeof(u32)) & ~MALI_MMU_FLAGS_MASK, info)
				);
			}
		}
	}

	MALI_SUCCESS;
}
_mali_osk_errcode_t _mali_ukk_dump_mmu_page_table( _mali_uk_dump_mmu_page_table_s * args )
{
	struct dump_info info = { 0, 0, 0, NULL };
	struct mali_session_data * session_data;

	MALI_DEBUG_ASSERT_POINTER(args);
	MALI_CHECK_NON_NULL(args->ctx, _MALI_OSK_ERR_INVALID_ARGS);
	MALI_CHECK_NON_NULL(args->buffer, _MALI_OSK_ERR_INVALID_ARGS);

	session_data = (struct mali_session_data *)(args->ctx);

	info.buffer_left = args->size;
	info.buffer = args->buffer;

	args->register_writes = info.buffer;
	MALI_CHECK_NO_ERROR(dump_mmu_registers(session_data->page_directory, &info));

	args->page_table_dump = info.buffer;
	MALI_CHECK_NO_ERROR(dump_mmu_page_table(session_data->page_directory, &info));

	args->register_writes_size = info.register_writes_size;
	args->page_table_dump_size = info.page_table_dump_size;

	MALI_SUCCESS;
}
static _mali_osk_errcode_t dump_mmu_registers(struct mali_page_directory *pagedir, struct dump_info *info)
{
	MALI_CHECK_NO_ERROR(writereg(0x00000000, pagedir->page_directory,
				     "set the page directory address", info));
	MALI_CHECK_NO_ERROR(writereg(0x00000008, 4, "zap???", info));
	MALI_CHECK_NO_ERROR(writereg(0x00000008, 0, "enable paging", info));
	MALI_SUCCESS;
}
_mali_osk_errcode_t _mali_ukk_query_mmu_page_table_dump_size(_mali_uk_query_mmu_page_table_dump_size_s *args)
{
	struct dump_info info = { 0, 0, 0, NULL };
	struct mali_session_data *session_data;

	session_data = (struct mali_session_data *)(uintptr_t)(args->ctx);
	MALI_DEBUG_ASSERT_POINTER(session_data);
	MALI_DEBUG_ASSERT_POINTER(args);

	MALI_CHECK_NO_ERROR(dump_mmu_registers(session_data->page_directory, &info));
	MALI_CHECK_NO_ERROR(dump_mmu_page_table(session_data->page_directory, &info));
	args->size = info.register_writes_size + info.page_table_dump_size;
	MALI_SUCCESS;
}
static _mali_osk_errcode_t mali_kernel_subsystem_core_setup(mali_kernel_subsystem_identifier id)
{
    mali_subsystem_core_id = id;

	/* Register our own resources */
	MALI_CHECK_NO_ERROR(_mali_kernel_core_register_resource_handler(MEM_VALIDATION, mali_kernel_core_resource_mem_validation));

    /* parse the arch resource definition and tell all the subsystems */
	/* this is why the core subsystem has to be specified last in the subsystem array */
    MALI_CHECK_NO_ERROR(_mali_osk_resources_init(&arch_configuration, &num_resources));

    MALI_CHECK_NO_ERROR(register_resources(&arch_configuration, num_resources));

    /* resource parsing succeeded and the subsystem have corretly accepted their resources */
	MALI_SUCCESS;
}
_mali_osk_errcode_t register_resources( _mali_osk_resource_t **arch_configuration, u32 num_resources )
{
	_mali_osk_resource_t *arch_resource = *arch_configuration;
	u32 i;
#if USING_MALI_PMM
	u32 is_pmu_first_resource = 1;
#endif /* USING_MALI_PMM */

	/* loop over arch configuration */
	for (i = 0; i < num_resources; ++i, arch_resource++)
	{
		if (  (arch_resource->type >= RESOURCE_TYPE_FIRST) &&
		      (arch_resource->type < RESOURCE_TYPE_COUNT) &&
		      (NULL != resource_handler[arch_resource->type])
		   )
		{	
#if USING_MALI_PMM
			if((arch_resource->type != PMU) && (is_pmu_first_resource == 1))
			{
				_mali_osk_resource_t mali_pmu_virtual_resource;
				mali_pmu_virtual_resource.type = PMU;
				mali_pmu_virtual_resource.description = "Virtual PMU";
				mali_pmu_virtual_resource.base = 0x00000000;
				mali_pmu_virtual_resource.cpu_usage_adjust = 0;
				mali_pmu_virtual_resource.size = 0;
				mali_pmu_virtual_resource.irq = 0;
				mali_pmu_virtual_resource.flags = 0;
				mali_pmu_virtual_resource.mmu_id = 0;
				mali_pmu_virtual_resource.alloc_order = 0;
				MALI_CHECK_NO_ERROR(resource_handler[mali_pmu_virtual_resource.type](&mali_pmu_virtual_resource));
			}
			is_pmu_first_resource = 0;
#endif /* USING_MALI_PMM */

			MALI_CHECK_NO_ERROR(resource_handler[arch_resource->type](arch_resource));
			/* the subsystem shutdown process will release all the resources already registered */
		}
		else
		{
			MALI_DEBUG_PRINT(1, ("No handler installed for resource %s, type %d\n", arch_resource->description, arch_resource->type));
			MALI_ERROR(_MALI_OSK_ERR_INVALID_ARGS);
		}
	}

	MALI_SUCCESS;
}
static _mali_osk_errcode_t mali200_subsystem_startup(mali_kernel_subsystem_identifier id)
{
	mali_core_subsystem * subsystem;

	MALI_DEBUG_PRINT(3, ("Mali PP: mali200_subsystem_startup\n") ) ;

    mali_subsystem_mali200_id = id;

	/* All values get 0 as default */
	_mali_osk_memset(&subsystem_mali200, 0, sizeof(subsystem_mali200));

	subsystem = &subsystem_mali200;
	subsystem->start_job = &subsystem_mali200_start_job;
	subsystem->irq_handler_upper_half = &subsystem_mali200_irq_handler_upper_half;
	subsystem->irq_handler_bottom_half = &subsystem_mali200_irq_handler_bottom_half;
	subsystem->get_new_job_from_user = &subsystem_mali200_get_new_job_from_user;
	subsystem->return_job_to_user = &subsystem_mali200_return_job_to_user;
	subsystem->renderunit_delete = &subsystem_mali200_renderunit_delete;
	subsystem->reset_core = &subsystem_mali200_renderunit_reset_core;
	subsystem->stop_bus = &subsystem_mali200_renderunit_stop_bus;
	subsystem->probe_core_irq_trigger = &subsystem_mali200_renderunit_probe_core_irq_trigger;
	subsystem->probe_core_irq_acknowledge = &subsystem_mali200_renderunit_probe_core_irq_finished;

	/* Setting variables in the general core part of the subsystem.*/
	subsystem->name = MALI_PP_SUBSYSTEM_NAME;
	subsystem->core_type = MALI_PP_CORE_TYPE;
	subsystem->id = id;

	/* Initiates the rest of the general core part of the subsystem */
    MALI_CHECK_NO_ERROR(mali_core_subsystem_init( subsystem ));

	/* This will register the function for adding MALI200 cores to the subsystem */
#if defined(USING_MALI200)
	MALI_CHECK_NO_ERROR(_mali_kernel_core_register_resource_handler(MALI200, mali200_renderunit_create));
#endif
#if defined(USING_MALI400)
	MALI_CHECK_NO_ERROR(_mali_kernel_core_register_resource_handler(MALI400PP, mali200_renderunit_create));
#endif

	MALI_DEBUG_PRINT(6, ("Mali PP: mali200_subsystem_startup\n") ) ;

	MALI_SUCCESS;
}
_mali_osk_errcode_t mali_kernel_core_translate_cpu_to_mali_phys_range( u32 *phys_base, u32 size )
{
	u32 mali_phys_base;

	mali_phys_base = *phys_base - mem_validator.cpu_usage_adjust;

	MALI_CHECK( 0 == ( mali_phys_base & (~_MALI_OSK_CPU_PAGE_MASK)), _MALI_OSK_ERR_FAULT );
	MALI_CHECK( 0 == ( size & (~_MALI_OSK_CPU_PAGE_MASK)), _MALI_OSK_ERR_FAULT );

	MALI_CHECK_NO_ERROR( mali_kernel_core_validate_mali_phys_range( mali_phys_base, size ) );

	*phys_base = mali_phys_base;
	MALI_SUCCESS;
}
_mali_osk_errcode_t mali_core_signal_power_up( mali_pmm_core_id core, mali_bool queue_only )
{
	switch( core )
	{
	case MALI_PMM_CORE_GP:
		MALI_CHECK_NO_ERROR(maligp_signal_power_up(queue_only));
		break;
#if defined USING_MALI400_L2_CACHE
	case MALI_PMM_CORE_L2:
		if( !queue_only )
		{
			/* Enable L2 cache due to power up */			
			mali_kernel_l2_cache_do_enable();

			/* Invalidate the cache on power up */
			MALI_DEBUG_PRINT(5, ("L2 Cache: Invalidate all\n"));
			MALI_CHECK_NO_ERROR(mali_kernel_l2_cache_invalidate_all());
		}
		break;
#endif
	case MALI_PMM_CORE_PP0:
		MALI_CHECK_NO_ERROR(malipp_signal_power_up(0, queue_only));
		break;
	case MALI_PMM_CORE_PP1:
		MALI_CHECK_NO_ERROR(malipp_signal_power_up(1, queue_only));
		break;
	case MALI_PMM_CORE_PP2:
		MALI_CHECK_NO_ERROR(malipp_signal_power_up(2, queue_only));
		break;
	case MALI_PMM_CORE_PP3:
		MALI_CHECK_NO_ERROR(malipp_signal_power_up(3, queue_only));
		break;
	default:
		/* Unknown core */
		MALI_DEBUG_PRINT_ERROR( ("Unknown core signalled with power up: %d\n", core) );
		MALI_ERROR( _MALI_OSK_ERR_INVALID_ARGS );
	}
	
	MALI_SUCCESS;
}
Exemple #11
0
_mali_osk_errcode_t malipmm_kernel_subsystem_start( mali_kernel_subsystem_identifier id )
{
	mali_subsystem_pmm_id = id;
	MALI_CHECK_NO_ERROR(_mali_kernel_core_register_resource_handler(PMU, malipmm_create));
	MALI_SUCCESS;
}