aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/mali/common/mali_kernel_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/arm/mali/common/mali_kernel_core.c')
-rwxr-xr-xdrivers/gpu/arm/mali/common/mali_kernel_core.c79
1 files changed, 60 insertions, 19 deletions
diff --git a/drivers/gpu/arm/mali/common/mali_kernel_core.c b/drivers/gpu/arm/mali/common/mali_kernel_core.c
index f3603cc7d0c..d4d0f5013fb 100755
--- a/drivers/gpu/arm/mali/common/mali_kernel_core.c
+++ b/drivers/gpu/arm/mali/common/mali_kernel_core.c
@@ -21,6 +21,9 @@
#if defined USING_MALI400_L2_CACHE
#include "mali_kernel_l2_cache.h"
#endif
+#if USING_MALI_PMM
+#include "mali_pmm.h"
+#endif /* USING_MALI_PMM */
/* platform specific set up */
#include "mali_platform.h"
@@ -49,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
@@ -95,6 +99,9 @@ static struct mali_kernel_subsystem mali_subsystem_core =
mali_kernel_subsystem_core_session_begin, /* session_begin */
NULL, /* session_end */
NULL, /* broadcast_notification */
+#if MALI_STATE_TRACKING
+ NULL, /* dump_state */
+#endif
};
static struct mali_kernel_subsystem * subsystems[] =
@@ -298,6 +305,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)
@@ -335,6 +345,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)
{
@@ -400,25 +434,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);
@@ -865,3 +881,28 @@ _mali_osk_errcode_t mali_core_signal_power_down( mali_pmm_core_id core, mali_boo
}
#endif
+
+
+#if MALI_STATE_TRACKING
+u32 _mali_kernel_core_dump_state(char* buf, u32 size)
+{
+ int i, n;
+ char *original_buf = buf;
+ for (i = 0; i < SUBSYSTEMS_COUNT; ++i)
+ {
+ if (NULL != subsystems[i]->dump_state)
+ {
+ n = subsystems[i]->dump_state(buf, size);
+ size -= n;
+ buf += n;
+ }
+ }
+#if USING_MALI_PMM
+ 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