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
2 changes: 1 addition & 1 deletion src/arch/xtensa/include/arch/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static inline void exception(void)
{
/* now panic and rewind 8 stack frames. */
/* TODO: we could invoke a GDB stub here */
panic_rewind(SOF_IPC_PANIC_EXCEPTION, 8 * sizeof(uint32_t));
panic_rewind(SOF_IPC_PANIC_EXCEPTION, 8 * sizeof(uint32_t), NULL);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/arch/xtensa/include/arch/sof.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static inline void *arch_get_stack_ptr(void)
return ptr;
}

static inline void *arch_dump_regs(void)
static inline void *arch_dump_regs(uint32_t ps)
{
struct sof_ipc_dsp_oops_xtensa *x =
(struct sof_ipc_dsp_oops_xtensa *) mailbox_get_exception_base();
Expand All @@ -62,7 +62,7 @@ static inline void *arch_dump_regs(void)
/* Exception Vector address - 0x4 */
__asm__ __volatile__ ("rsr %0, EXCVADDR" : "=a" (x->excvaddr) : : "memory");
/* Exception Processor State - 0x8 */
__asm__ __volatile__ ("rsr %0, PS" : "=a" (x->ps) : : "memory");
x->ps = ps;
/* Level 1 Exception PC - 0xc */
__asm__ __volatile__ ("rsr %0, EPC1" : "=a" (x->epc1) : : "memory");
/* Level 2 Exception PC - 0x10 */
Expand Down
1 change: 1 addition & 0 deletions src/drivers/intel/baytrail/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/

#include <sof/drivers/clk.h>
#include <sof/drivers/timer.h>
#include <sof/clock.h>
#include <sof/io.h>
#include <sof/sof.h>
Expand Down
1 change: 1 addition & 0 deletions src/drivers/intel/cavs/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/

#include <sof/drivers/clk.h>
#include <sof/drivers/timer.h>
#include <sof/clock.h>
#include <sof/io.h>
#include <sof/sof.h>
Expand Down
1 change: 1 addition & 0 deletions src/drivers/intel/haswell/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

#include <sof/drivers/clk.h>
#include <sof/drivers/timer.h>
#include <sof/clock.h>
#include <sof/io.h>
#include <sof/sof.h>
Expand Down
13 changes: 5 additions & 8 deletions src/include/sof/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include <string.h>
#include <stdint.h>
#include <sof/bit.h>
#include <sof/dma.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • alloc: fix some build issues in alloc

In file included from ../../src/include/sof/alloc.h:38,
from ../../src/include/sof/panic.h:35,
from /home/pxl/work/sof/sof/src/arch/xtensa/include/arch/wait.h:33,
from ../../src/include/sof/wait.h:38,
from ../../src/include/sof/schedule.h:41,
from /home/pxl/work/sof/sof/src/arch/xtensa/include/arch/task.h:41,
from ../../src/include/sof/task.h:34,
from init.c:36:
../../src/include/sof/dma.h:291:2: error: unknown type name 'completion_t'
completion_t complete;

#include <sof/platform.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../../src/include/sof/alloc.h:89:31: error: 'PLATFORM_DCACHE_ALIGN' undeclared here (not in a function); did you mean 'PLATFORM_HEAP_RUNTIME'?
} attribute ((aligned(PLATFORM_DCACHE_ALIGN)));
^~~~~~~~~~~~~~~~~~~~~
PLATFORM_HEAP_RUNTIME

PLATFORM_DCACHE_ALIGN is defined in sof/platform.h

#include <platform/memory.h>
#include <arch/spinlock.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../../src/include/sof/alloc.h:113:2: error: unknown type name 'spinlock_t'
spinlock_t lock; /* all allocs and frees are atomic */
spinlock_t is defined in arch/spinlock.h


struct sof;

Expand Down Expand Up @@ -66,6 +67,9 @@ struct sof;
#define RZONE_TYPE_MASK 0xf
#define RZONE_FLAG_MASK 0xf0

struct dma_copy;
struct dma_sg_config;

struct mm_info {
uint32_t used;
uint32_t free;
Expand Down Expand Up @@ -135,11 +139,4 @@ void init_heap(struct sof *sof);
/* frees entire heap (supported for slave core system heap atm) */
void free_heap(int zone);

/* flush block map from cache to sram */
static inline void flush_block_map(struct block_map *map)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error, please include error this fixes in commit message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be very long list.
Since I add
#include <sof/alloc.h>
in panic.h
I just fixed the related header to have these patches.
I will list the errors later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiulipan I dont need a list of errors, but just something similar to "fixes build error for target X caused by missing header Y" will do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood
So I need to modify the comments?

{
dcache_writeback_invalidate_region(map->block,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../../src/include/sof/alloc.h: In function 'flush_block_map':
../../src/include/sof/alloc.h:144:2: error: implicit declaration of function 'dcache_writeback_invalidate_region' [-Werror=implicit-function-declaration]
dcache_writeback_invalidate_region(map->block,

This function is only a helper function for alloc.c
No need to be in header.

sizeof(*map->block) * map->count);
dcache_writeback_invalidate_region(map, sizeof(*map));
}
#endif
41 changes: 33 additions & 8 deletions src/include/sof/panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define __INCLUDE_SOF_IPC_PANIC__

#include <sof/sof.h>
#include <sof/alloc.h>
#include <sof/mailbox.h>
#include <sof/interrupt.h>
#include <sof/trace.h>
Expand All @@ -40,23 +41,37 @@
#include <stdint.h>
#include <stdlib.h>

static inline void dump_panicinfo(void *addr,
struct sof_ipc_panic_info *panic_info)
{
if (!panic_info)
return;
rmemcpy(addr, panic_info, sizeof(struct sof_ipc_panic_info));
dcache_writeback_region(addr, sizeof(struct sof_ipc_panic_info));
}

/* panic and rewind stack */
static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames)
static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames,
struct sof_ipc_panic_info *panic_info)
{
void *ext_offset;
size_t count;
uint32_t oldps;

/* disable all IRQs */
interrupt_global_disable();
oldps = interrupt_global_disable();

/* dump DSP core registers */
ext_offset = arch_dump_regs();
ext_offset = arch_dump_regs(oldps);

/* dump panic info, filename ane linenum */
dump_panicinfo(ext_offset, panic_info);
ext_offset += sizeof(struct sof_ipc_panic_info);

count = MAILBOX_EXCEPTION_SIZE -
(size_t)(ext_offset - mailbox_get_exception_base());

/* dump stack frames */
p = dump_stack(p, ext_offset, stack_rewind_frames,
count * sizeof(uint32_t));
p = dump_stack(p, ext_offset, stack_rewind_frames, count);

/* panic - send IPC oops message to host */
platform_panic(p);
Expand All @@ -68,9 +83,19 @@ static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames)
while (1) {};
}

static inline void panic(uint32_t p)
/* panic dump filename and linenumber of the call */
#define panic(x) __panic((x), (__FILE__), (__LINE__))

static inline void __panic(uint32_t p, char *filename, uint32_t linenum)
{
panic_rewind(p, 0);
struct sof_ipc_panic_info panicinfo;
int strlen;

strlen = rstrlen(filename);
panicinfo.linenum = linenum;
rmemcpy(panicinfo.filename, filename, strlen + 1);

panic_rewind(p, 0, &panicinfo);
}

#endif
6 changes: 0 additions & 6 deletions src/include/sof/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ int platform_boot_complete(uint32_t boot_message);
*/
int platform_init(struct sof *sof);

/**
* \brief Called by the panic handler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../../src/include/sof/platform.h:76:20: error: 'platform_panic' declared 'static' but never defined [-Werror=unused-function]
static inline void platform_panic(uint32_t p);

platform_panic is defined in platform/platform.h
Redeclared here

* \param[in] p Panic cause, one of SOF_IPC_PANIC_... codes (see ipc.h).
*/
static inline void platform_panic(uint32_t p);

/** @}*/

#endif
1 change: 1 addition & 0 deletions src/include/sof/pm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <sof/lock.h>
#include <sof/trace.h>
#include <sof/wait.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/home/pxl/work/sof/sof/src/platform/intel/include/platform/cavs/pm_runtime.h:57:3: error: implicit declaration of function 'wait_delay'; did you mean 'init_heap'? [-Werror=implicit-function-declaration]
wait_delay(PLATFORM_FORCE_L1_EXIT_TIME);

wait_delay is defined in sof/wait.h


/** \brief Power management trace function. */
#define trace_pm(__e) trace_event(TRACE_CLASS_POWER, __e)
Expand Down
10 changes: 10 additions & 0 deletions src/include/uapi/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,16 @@ struct sof_ipc_dsp_oops_xtensa {
uint32_t stack;
} __attribute__((packed));

/*
* Commom debug
*/

/* panic info include filename and line number */
struct sof_ipc_panic_info {
char filename[32];
uint32_t linenum;
} __attribute__((packed));

/** @}*/

#endif
1 change: 1 addition & 0 deletions src/lib/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <platform/timer.h>
#include <platform/platform.h>
#include <platform/clk.h>
#include <sof/drivers/timer.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agent.c:58:18: error: implicit declaration of function 'platform_timer_get'; did you mean 'platform_init'? [-Werror=implicit-function-declaration]
sa->last_idle = platform_timer_get(platform_timer);

platform_timer_get is defined in sof/drivers/timer.h


#define trace_sa(__e) trace_event_atomic(TRACE_CLASS_SA, __e)
#define trace_sa_value(__e) trace_value_atomic(__e)
Expand Down
8 changes: 8 additions & 0 deletions src/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ extern struct mm memmap;
*/


/* flush block map from cache to sram */
static inline void flush_block_map(struct block_map *map)
{
dcache_writeback_invalidate_region(map->block,
sizeof(*map->block) * map->count);
dcache_writeback_invalidate_region(map, sizeof(*map));
}

/* total size of block */
static inline uint32_t block_get_size(struct block_map *map)
{
Expand Down