From 4409a5eef6d1d669caad1bfe3fbefee87ea7734e Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 6 May 2013 12:20:52 -0500 Subject: coreboot: add thread cooperative multitasking The cooperative multitasking support allows the boot state machine to be ran cooperatively with other threads of work. The main thread still continues to run the boot state machine (src/lib/hardwaremain.c). All callbacks from the state machine are still ran synchronously from within the main thread's context. Without any other code added the only change to the boot sequence when cooperative multitasking is enabled is the queueing of an idlle thread. The idle thread is responsible for ensuring progress is made by calling timer callbacks. The main thread can yield to any other threads in the system. That means that anyone that spins up a thread must ensure no shared resources are used from 2 or more execution contexts. The support is originally intentioned to allow for long work itesm with busy loops to occur in parallel during a boot. Note that the intention on when to yield a thread will be on calls to udelay(). Change-Id: Ia4d67a38665b12ce2643474843a93babd8a40c77 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/3206 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/arch/armv7/include/arch/cpu.h | 5 +++++ src/arch/x86/include/arch/cpu.h | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/arch') diff --git a/src/arch/armv7/include/arch/cpu.h b/src/arch/armv7/include/arch/cpu.h index 20a12c929e..5621aeda55 100644 --- a/src/arch/armv7/include/arch/cpu.h +++ b/src/arch/armv7/include/arch/cpu.h @@ -30,9 +30,14 @@ struct cpu_driver { struct cpu_device_id *id_table; }; +struct thread; + struct cpu_info { device_t cpu; unsigned long index; +#if CONFIG_COOP_MULTITASKING + struct thread *thread; +#endif }; struct cpuinfo_arm { diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 890c77f4f1..1fe12e5230 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -159,9 +159,14 @@ struct cpu_driver { struct cpu_driver *find_cpu_driver(struct device *cpu); +struct thread; + struct cpu_info { device_t cpu; unsigned int index; +#if CONFIG_COOP_MULTITASKING + struct thread *thread; +#endif }; static inline struct cpu_info *cpu_info(void) -- cgit v1.2.3