Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/arch/xtensa/include/arch/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@
*/

#include <xtensa/xtruntime.h>
#include <arch/interrupt.h>
#include <sof/panic.h>


#if defined(PLATFORM_WAITI_DELAY)

static inline void arch_wait_for_interrupt(int level)
{
int i;

/* can only eneter WFI when at runlevel 0 i.e. not IRQ level */
if (arch_interrupt_get_level() > 0)
panic(SOF_IPC_PANIC_WFI);

/* this sequnce must be atomic on LX6 */
XTOS_SET_INTLEVEL(5);

Expand All @@ -55,7 +62,11 @@ static inline void arch_wait_for_interrupt(int level)

static inline void arch_wait_for_interrupt(int level)
{
asm volatile("waiti 0");
/* can only eneter WFI when at runlevel 0 i.e. not IRQ level */
if (arch_interrupt_get_level() > 0)
panic(SOF_IPC_PANIC_WFI);

asm volatile("waiti 0");
}

#endif
Expand Down
21 changes: 11 additions & 10 deletions src/include/uapi/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,17 @@
#define SOF_IPC_PANIC_MAGIC 0x0dead000
#define SOF_IPC_PANIC_MAGIC_MASK 0x0ffff000
#define SOF_IPC_PANIC_CODE_MASK 0x00000fff
#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0)
#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 1)
#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 2)
#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 3)
#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 4)
#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 5)
#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 6)
#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 7)
#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 8)
#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 9)
#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0x0)
#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 0x1)
#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 0x2)
#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 0x3)
#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 0x4)
#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 0x5)
#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 0x6)
#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 0x7)
#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 0x8)
#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 0x9)
#define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa)

/*
* SOF memory capabilities, add new ones at the end
Expand Down