Skip to content

Commit 5fca99e

Browse files
committed
cpu: implement cpu_is_core_enabled function
Adds cpu_is_core_enabled function to check for active cores. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
1 parent 20752b7 commit 5fca99e

4 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/arch/xtensa/include/arch/cpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ void arch_cpu_enable_core(int id);
3939

4040
void arch_cpu_disable_core(int id);
4141

42+
int arch_cpu_is_core_enabled(int id);
43+
4244
static inline int arch_cpu_get_id(void)
4345
{
4446
int prid;

src/arch/xtensa/smp/cpu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ void arch_cpu_disable_core(int id)
8686
spin_unlock_irq(&lock, flags);
8787
}
8888

89+
int arch_cpu_is_core_enabled(int id)
90+
{
91+
return active_cores_mask & (1 << id);
92+
}
93+
8994
void cpu_power_down_core(void)
9095
{
9196
arch_interrupt_global_disable();

src/arch/xtensa/up/cpu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@
4040
void arch_cpu_enable_core(int id) { }
4141

4242
void arch_cpu_disable_core(int id) { }
43+
44+
int arch_cpu_is_core_enabled(int id) { return 1; }

src/include/sof/cpu.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ static inline void cpu_disable_core(int id)
5454
arch_cpu_disable_core(id);
5555
}
5656

57+
static inline int cpu_is_core_enabled(int id)
58+
{
59+
return arch_cpu_is_core_enabled(id);
60+
}
61+
5762
#endif

0 commit comments

Comments
 (0)