[FOSS_TLK]tlk: debug: add TA panic API support
Scott Long [Tue, 10 Feb 2015 08:59:36 +0000 (00:59 -0800)]
Add TA panic handler support to platform
ioctl handler.

Change-Id: I149b01ec54274064e37f7fc15a892f0416e6b77d
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/715780
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

include/debug.h
kernel/syscall.c
lib/debug/debug.c

index 4554717..8e230b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008-2012 Travis Geiselbrecht
+ * Copyright (c) 2008-2015 Travis Geiselbrecht
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
@@ -113,9 +113,10 @@ void halt(void) __NO_RETURN;
 
 void _panic(void *caller, const char *fmt, ...) __PRINTFLIKE(2, 3) __NO_RETURN;
 #define panic(x...) _panic(__GET_CALLER(), x)
-
 #define PANIC_UNIMPLEMENTED panic("%s unimplemented\n", __PRETTY_FUNCTION__)
 
+void task_panic(char *task_name, char *msg);
+
 /* spin the cpu for a period of (short) time */
 void spin(uint32_t usecs);
 
index feb9f43..0f4c9fd 100644 (file)
@@ -251,7 +251,7 @@ static int platform_ioctl_handler(u_int cmd, void *cmdbuf)
                                                        sizeof(uint32_t)))
                                return -EFAULT;
 
-                       return platform_ss_get_config(ss_config);
+                       platform_ss_get_config(ss_config);
                        break;
                }
                case OTE_IOCTL_GET_DEVICE_ID:
@@ -298,7 +298,19 @@ static int platform_ioctl_handler(u_int cmd, void *cmdbuf)
                                return -EFAULT;
                        }
 
-                       return task_request_handler (args);
+                       return task_request_handler(args);
+               }
+               case OTE_IOCTL_TASK_PANIC:
+               {
+                       te_panic_args_t *args = cmdbuf;
+                       task_t *task = current_thread->arch.task;
+
+                       /* use NULL msg if arg isn't valid for some reason */
+                       if (task_valid_address((vaddr_t)args, sizeof(*args)))
+                               task_panic(task->task_name, args->msg);
+                       else
+                               task_panic(task->task_name, NULL);
+                       break;
                }
 
                case OTE_IOCTL_REGISTER_TA_EVENT:
index 885e1bf..9d4c79e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008-2012 Travis Geiselbrecht
+ * Copyright (c) 2008-2015 Travis Geiselbrecht
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
@@ -75,6 +75,14 @@ void _panic(void *caller, const char *fmt, ...)
        halt();
 }
 
+void task_panic(char *task_name, char *msg)
+{
+       ote_logger_enabled = 0;
+
+       dprintf(ALWAYS, "panic (task %s): %s\n", task_name, msg);
+       halt();
+}
+
 #if !DISABLE_DEBUG_OUTPUT
 
 int _dputs(const char *str)