summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.com>2019-01-29 17:17:59 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-31 14:06:23 -0800
commitbb55365b98d78a09c9dcf00f3b7d144c245d6990 (patch)
treedea06c715833f2a48fd33a857e96ed6031a08ca6
parentbbb6461b154364e2f5acabe3506a358db32d50e8 (diff)
downloadchrome-ec-bb55365b98d78a09c9dcf00f3b7d144c245d6990.tar.gz
ish: move setting start_called to proper place
Some functions(like enabling interrupt) should start after scheduler is ready and they use start_called which indicates if scheduler is ready or not. Currently start_called is set by the first task but it is away after the task did many things. So this patch moves the setting start_called to the place where the scheduler is ready. BRANCH=none BUG=none TEST=verified in Atlas platform Change-Id: I24d9cec411e91b7365f46fa8daf4a02fe43287dd Reviewed-on: https://chromium-review.googlesource.com/1444792 Commit-Ready: Hyungwoo Yang <hyungwoo.yang@intel.com> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--core/minute-ia/switch.S2
-rw-r--r--core/minute-ia/task.c5
-rw-r--r--core/minute-ia/task_defs.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/core/minute-ia/switch.S b/core/minute-ia/switch.S
index b467a39c3c..52883671eb 100644
--- a/core/minute-ia/switch.S
+++ b/core/minute-ia/switch.S
@@ -29,11 +29,13 @@
.align 4
.func __task_start
__task_start:
+ movl 0x4(%esp), %ebx
movl current_task, %eax
movl (%eax), %esp
#ifdef CONFIG_FPU
frstor 20(%eax)
#endif
+ movl $0x1, (%ebx) # first task is ready. set start_called = 1
popa
iret
.endfunc
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index 7132813ac2..31d24734ec 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -386,9 +386,6 @@ void task_enable_all_tasks(void)
/* Mark all tasks as ready and table to run. */
tasks_ready = tasks_enabled = (1 << TASK_ID_COUNT) - 1;
- /* BUG: task_start() was likely already called */
- start_called = 1;
-
/* Reschedule the highest priority task. */
__schedule(0, 0);
}
@@ -628,5 +625,5 @@ int task_start(void)
#ifdef CONFIG_TASK_PROFILING
task_start_time = exc_end_time = get_time().val;
#endif
- return __task_start();
+ return __task_start(&start_called);
}
diff --git a/core/minute-ia/task_defs.h b/core/minute-ia/task_defs.h
index 6237f8aabd..2ec33e5c98 100644
--- a/core/minute-ia/task_defs.h
+++ b/core/minute-ia/task_defs.h
@@ -26,7 +26,7 @@ typedef union {
};
} task_;
-int __task_start(void);
+int __task_start(int *start_called);
void __switchto(void);
/* Only the IF bit is set so tasks start with interrupts enabled. */