summaryrefslogtreecommitdiff
path: root/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c')
-rw-r--r--drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c83
1 files changed, 51 insertions, 32 deletions
diff --git a/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c
index a40808bd2d8..f8ca4030fd8 100644
--- a/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c
+++ b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.c
@@ -52,6 +52,7 @@ static _mali_osk_errcode_t mali_kernel_subsystem_core_system_info_fill(_mali_sys
static _mali_osk_errcode_t mali_kernel_subsystem_core_session_begin(struct mali_session_data * mali_session_data, mali_kernel_subsystem_session_slot * slot, _mali_osk_notification_queue_t * queue);
static _mali_osk_errcode_t build_system_info(void);
+static void cleanup_system_info(_mali_system_info *cleanup);
/**
* @brief handler for MEM_VALIDATION resources
@@ -105,15 +106,15 @@ static struct mali_kernel_subsystem mali_subsystem_core =
static struct mali_kernel_subsystem * subsystems[] =
{
- /* always initialize the hw subsystems first */
- /* always included */
- &mali_subsystem_memory,
#if USING_MALI_PMM
/* The PMM must be initialized before any cores - including L2 cache */
&mali_subsystem_pmm,
#endif
+ /* always included */
+ &mali_subsystem_memory,
+
/* The rendercore subsystem must be initialized before any subsystem based on the
* rendercores is started e.g. mali_subsystem_mali200 and mali_subsystem_gp2 */
&mali_subsystem_rendercore,
@@ -154,7 +155,7 @@ _mali_osk_errcode_t mali_kernel_constructor( void )
{
_mali_osk_errcode_t err;
- err = mali_platform_init(NULL);
+ err = mali_platform_init();
if (_MALI_OSK_ERR_OK != err) goto error1;
err = _mali_osk_init();
@@ -177,7 +178,7 @@ error3:
_mali_osk_term();
error2:
MALI_PRINT(("Mali device driver init failed\n"));
- if (_MALI_OSK_ERR_OK != mali_platform_deinit(NULL))
+ if (_MALI_OSK_ERR_OK != mali_platform_deinit())
{
MALI_PRINT(("Failed to deinit platform\n"));
}
@@ -191,10 +192,13 @@ void mali_kernel_destructor( void )
{
MALI_DEBUG_PRINT(2, ("\n"));
MALI_DEBUG_PRINT(2, ("Unloading Mali v%d device driver.\n",_MALI_API_VERSION));
+#if USING_MALI_PMM
+ malipmm_force_powerup();
+#endif
terminate_subsystems(); /* subsystems are responsible for their registered resources */
_mali_osk_term();
- if (_MALI_OSK_ERR_OK != mali_platform_deinit(NULL))
+ if (_MALI_OSK_ERR_OK != mali_platform_deinit())
{
MALI_PRINT(("Failed to deinit platform\n"));
}
@@ -304,6 +308,9 @@ static void terminate_subsystems(void)
if (NULL != subsystems[i]->shutdown) subsystems[i]->shutdown(i);
}
if (system_info_lock) _mali_osk_lock_term( system_info_lock );
+
+ /* Free _mali_system_info struct */
+ cleanup_system_info(system_info);
}
void _mali_kernel_core_broadcast_subsystem_message(mali_core_notification_message message, u32 data)
@@ -341,6 +348,30 @@ static void mali_kernel_subsystem_core_cleanup(mali_kernel_subsystem_identifier
_mali_osk_resources_term(&arch_configuration, num_resources);
}
+static void cleanup_system_info(_mali_system_info *cleanup)
+{
+ _mali_core_info * current_core;
+ _mali_mem_info * current_mem;
+
+ /* delete all the core info structs */
+ while (NULL != cleanup->core_info)
+ {
+ current_core = cleanup->core_info;
+ cleanup->core_info = cleanup->core_info->next;
+ _mali_osk_free(current_core);
+ }
+
+ /* delete all the mem info struct */
+ while (NULL != cleanup->mem_info)
+ {
+ current_mem = cleanup->mem_info;
+ cleanup->mem_info = cleanup->mem_info->next;
+ _mali_osk_free(current_mem);
+ }
+
+ /* delete the system info struct itself */
+ _mali_osk_free(cleanup);
+}
static _mali_osk_errcode_t build_system_info(void)
{
@@ -406,25 +437,7 @@ error_exit:
if (NULL == cleanup) MALI_ERROR((_mali_osk_errcode_t)err); /* no cleanup needed, return what err contains */
/* cleanup */
-
- /* delete all the core info structs */
- while (NULL != cleanup->core_info)
- {
- current_core = cleanup->core_info;
- cleanup->core_info = cleanup->core_info->next;
- _mali_osk_free(current_core);
- }
-
- /* delete all the mem info struct */
- while (NULL != cleanup->mem_info)
- {
- current_mem = cleanup->mem_info;
- cleanup->mem_info = cleanup->mem_info->next;
- _mali_osk_free(current_mem);
- }
-
- /* delete the system info struct itself */
- _mali_osk_free(cleanup);
+ cleanup_system_info(cleanup);
/* return whatever err is, we could end up here in both the error and success cases */
MALI_ERROR((_mali_osk_errcode_t)err);
@@ -873,20 +886,26 @@ _mali_osk_errcode_t mali_core_signal_power_down( mali_pmm_core_id core, mali_boo
#endif
-
#if MALI_STATE_TRACKING
-void _mali_kernel_core_dump_state(void)
+u32 _mali_kernel_core_dump_state(char* buf, u32 size)
{
- int i;
+ int i, n;
+ char *original_buf = buf;
for (i = 0; i < SUBSYSTEMS_COUNT; ++i)
- {
+ {
if (NULL != subsystems[i]->dump_state)
{
- subsystems[i]->dump_state();
+ n = subsystems[i]->dump_state(buf, size);
+ size -= n;
+ buf += n;
}
- }
+ }
#if USING_MALI_PMM
- mali_pmm_dump_os_thread_state();
+ n = mali_pmm_dump_os_thread_state(buf, size);
+ size -= n;
+ buf += n;
#endif
+ /* Return number of bytes written to buf */
+ return (u32)(buf - original_buf);
}
#endif