[Sound-open-firmware] [PATCH] cache: bdw: cache writeback/invalidate not needed on HSW/BDW
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/include/arch/cache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/arch/xtensa/include/arch/cache.h b/src/arch/xtensa/include/arch/cache.h index f3e8062..6a1320e 100644 --- a/src/arch/xtensa/include/arch/cache.h +++ b/src/arch/xtensa/include/arch/cache.h @@ -35,7 +35,8 @@ #include <stddef.h> #include <xtensa/hal.h>
-#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL +#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL ||\ + defined CONFIG_HASWELL || defined CONFIG_BROADWELL
static inline void dcache_writeback_region(void *addr, size_t size) {} static inline void dcache_invalidate_region(void *addr, size_t size) {}
Don't try and dump data outside of the stack.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/reef/debug.h b/src/include/reef/debug.h index 9ffc6a8..6554a51 100644 --- a/src/include/reef/debug.h +++ b/src/include/reef/debug.h @@ -133,7 +133,7 @@ static inline void dump_stack(uint32_t p, void *addr, size_t offset, { extern void *__stack; extern void *_stack_sentry; - void *stack_bottom = (void *)&__stack; + void *stack_bottom = (void *)&__stack - sizeof(void *); void *stack_limit = (void *)&_stack_sentry; void *stack_top = arch_get_stack_ptr() + offset; size_t size = stack_bottom - stack_top;
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- scripts/rimage-build.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 scripts/rimage-build.sh
diff --git a/scripts/rimage-build.sh b/scripts/rimage-build.sh new file mode 100755 index 0000000..a2a2e86 --- /dev/null +++ b/scripts/rimage-build.sh @@ -0,0 +1,4 @@ +./autogen.sh +./configure --enable-rimage +make +
Change the panic code is stack has been smashed. This allows platform specific handlers to send new panic code to host if stack is smashed.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/debug.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/include/reef/debug.h b/src/include/reef/debug.h index 6554a51..672fa5b 100644 --- a/src/include/reef/debug.h +++ b/src/include/reef/debug.h @@ -128,7 +128,7 @@ #endif
/* dump stack as part of panic */ -static inline void dump_stack(uint32_t p, void *addr, size_t offset, +static inline uint32_t dump_stack(uint32_t p, void *addr, size_t offset, size_t limit) { extern void *__stack; @@ -142,7 +142,7 @@ static inline void dump_stack(uint32_t p, void *addr, size_t offset, if (stack_top - offset <= stack_limit) { stack_bottom = stack_limit; p = SOF_IPC_PANIC_STACK; - platform_panic(p); + return p; }
/* make sure stack size won't overflow dump area */ @@ -152,6 +152,7 @@ static inline void dump_stack(uint32_t p, void *addr, size_t offset, /* copy stack contents and writeback */ rmemcpy(addr, stack_top, size - sizeof(void *)); dcache_writeback_region(addr, size - sizeof(void *)); + return p; }
#endif
Initialise DMA trace prior to platform initialisation so that more users may use trace as part of init.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com
dma trace fix --- src/include/reef/dma-trace.h | 2 +- src/include/reef/ipc.h | 2 +- src/include/reef/reef.h | 3 +++ src/init/init.c | 1 + src/ipc/intel-ipc.c | 9 +++++---- src/ipc/ipc.c | 1 + src/lib/dma-trace.c | 18 ++++++++---------- src/lib/trace.c | 4 ++++ src/platform/baytrail/platform.c | 4 +--- src/platform/haswell/platform.c | 4 +--- 10 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index ab9c112..dcbd491 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -66,7 +66,7 @@ struct dma_trace_data { spinlock_t lock; };
-int dma_trace_init_early(struct dma_trace_data *d); +int dma_trace_init_early(struct reef *reef); int dma_trace_init_complete(struct dma_trace_data *d); int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); diff --git a/src/include/reef/ipc.h b/src/include/reef/ipc.h index bb814be..9261add 100644 --- a/src/include/reef/ipc.h +++ b/src/include/reef/ipc.h @@ -101,7 +101,7 @@ struct ipc { struct list_item comp_list; /* list of component devices */
/* DMA for Trace*/ - struct dma_trace_data dmat; + struct dma_trace_data *dmat;
void *private; }; diff --git a/src/include/reef/reef.h b/src/include/reef/reef.h index c872acc..e0df031 100644 --- a/src/include/reef/reef.h +++ b/src/include/reef/reef.h @@ -68,6 +68,9 @@ struct reef { /* system agent */ struct sa *sa;
+ /* DMA for Trace*/ + struct dma_trace_data *dmat; + /* private data */ void *arch_private; void *plat_private; diff --git a/src/init/init.c b/src/init/init.c index 03ac662..d847e11 100644 --- a/src/init/init.c +++ b/src/init/init.c @@ -41,6 +41,7 @@ #include <reef/work.h> #include <reef/trace.h> #include <reef/schedule.h> +#include <reef/dma-trace.h> #include <platform/platform.h>
/* main firmware context */ diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index fac3371..0cfec42 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -56,6 +56,7 @@ #include <reef/audio/pipeline.h> #include <uapi/ipc.h> #include <reef/intel-ipc.h> +#include <reef/dma-trace.h> #include <config.h>
#define iGS(x) ((x >> SOF_GLB_TYPE_SHIFT) & 0xf) @@ -626,7 +627,7 @@ static int ipc_dma_trace_config(uint32_t header) #endif trace_ipc("DAp");
- err = dma_trace_enable(&_ipc->dmat); + err = dma_trace_enable(_ipc->dmat); if (err < 0) goto error;
@@ -649,9 +650,9 @@ int ipc_dma_trace_send_position(void) struct sof_ipc_dma_trace_posn posn;
posn.rhdr.hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_POSITION; - posn.host_offset = _ipc->dmat.host_offset; - posn.overflow = _ipc->dmat.overflow; - posn.messages = _ipc->dmat.messages; + posn.host_offset = _ipc->dmat->host_offset; + posn.overflow = _ipc->dmat->overflow; + posn.messages = _ipc->dmat->messages; posn.rhdr.hdr.size = sizeof(posn);
return ipc_queue_host_message(_ipc, posn.rhdr.hdr.cmd, &posn, diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index 61b0cf2..b753efd 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -350,6 +350,7 @@ int ipc_init(struct reef *reef) /* init ipc data */ reef->ipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*reef->ipc)); reef->ipc->comp_data = rzalloc(RZONE_SYS, RFLAGS_NONE, SOF_IPC_MSG_MAX_SIZE); + reef->ipc->dmat = reef->dmat;
list_init(&reef->ipc->comp_list);
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 429c7b6..c72c55b 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -124,9 +124,12 @@ out: return DMA_TRACE_PERIOD; }
-int dma_trace_init_early(struct dma_trace_data *d) +int dma_trace_init_early(struct reef *reef) { - struct dma_trace_buf *buffer = &d->dmatb; + struct dma_trace_buf *buffer; + + trace_data = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*trace_data)); + buffer = &trace_data->dmatb;
/* allocate new buffer */ buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, DMA_TRACE_LOCAL_SIZE); @@ -142,15 +145,10 @@ int dma_trace_init_early(struct dma_trace_data *d) buffer->w_ptr = buffer->r_ptr = buffer->addr; buffer->end_addr = buffer->addr + buffer->size; buffer->avail = 0; - d->host_offset = 0; - d->overflow = 0; - d->messages = 0; - d->enabled = 0; - d->copy_in_progress = 0;
- list_init(&d->config.elem_list); - spinlock_init(&d->lock); - trace_data = d; + list_init(&trace_data->config.elem_list); + spinlock_init(&trace_data->lock); + reef->dmat = trace_data;
return 0; } diff --git a/src/lib/trace.c b/src/lib/trace.c index 859bc0e..bfac6d3 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -208,6 +208,10 @@ void trace_off(void)
void trace_init(struct reef *reef) { + +#if defined(CONFIG_DMA_TRACE) + dma_trace_init_early(reef); +#endif trace.enable = 1; trace.pos = 0; spinlock_init(&trace.lock); diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 3114ac1..11ea731 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -301,8 +301,6 @@ int platform_init(struct reef *reef) trace_point(TRACE_BOOT_PLATFORM_IPC); ipc_init(reef);
- dma_trace_init_early(&reef->ipc->dmat); - /* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); dmac0 = dma_get(DMA_ID_DMAC0); @@ -365,7 +363,7 @@ int platform_init(struct reef *reef) #endif
/* Initialize DMA for Trace*/ - dma_trace_init_complete(&reef->ipc->dmat); + dma_trace_init_complete(reef->dmat);
return 0; } diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index b83e5fb..0b9274f 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -207,8 +207,6 @@ int platform_init(struct reef *reef) trace_point(TRACE_BOOT_PLATFORM_IPC); ipc_init(reef);
- dma_trace_init_early(&reef->ipc->dmat); - /* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); dmac0 = dma_get(DMA_ID_DMAC0); @@ -242,7 +240,7 @@ int platform_init(struct reef *reef) dai_probe(ssp1);
/* Initialize DMA for Trace*/ - dma_trace_init_complete(&reef->ipc->dmat); + dma_trace_init_complete(reef->dmat);
return 0; }
Fill all available stack dump space with frames if available and update any panic code to include passed value.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/panic.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/include/reef/panic.h b/src/include/reef/panic.h index 6466cc8..e8b4ae2 100644 --- a/src/include/reef/panic.h +++ b/src/include/reef/panic.h @@ -43,16 +43,19 @@ static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames) { void *ext_offset; + size_t count;
/* disable all IRQs */ interrupt_global_disable();
/* dump DSP core registers */ ext_offset = arch_dump_regs(); + count = MAILBOX_EXCEPTION_SIZE - + (size_t)(ext_offset - mailbox_get_exception_base());
/* dump stack frames */ - dump_stack(SOF_IPC_PANIC_EXCEPTION, ext_offset, stack_rewind_frames, - ARCH_STACK_DUMP_FRAMES * sizeof(uint32_t)); + p = dump_stack(p, ext_offset, stack_rewind_frames, + count * sizeof(uint32_t));
/* TODO: send IPC oops message to host */
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/include/platform/interrupt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/haswell/include/platform/interrupt.h b/src/platform/haswell/include/platform/interrupt.h index bc5aeab..f206491 100644 --- a/src/platform/haswell/include/platform/interrupt.h +++ b/src/platform/haswell/include/platform/interrupt.h @@ -64,7 +64,7 @@ #define IRQ_MASK_TIMER2 (1 << IRQ_NUM_TIMER2) #define IRQ_MASK_SOFTWARE2 (1 << IRQ_NUM_SOFTWARE2) #define IRQ_MASK_EXT_PARITY (1 << IRQ_NUM_EXT_PARITY) -#define IRQ_MASK_TIMER2 (1 << IRQ_NUM_TIMER2) +#define IRQ_MASK_TIMER3 (1 << IRQ_NUM_TIMER3)
static inline void platform_interrupt_init(void) {}
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/include/platform/memory.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/platform/haswell/include/platform/memory.h b/src/platform/haswell/include/platform/memory.h index c5ada16..83d11a5 100644 --- a/src/platform/haswell/include/platform/memory.h +++ b/src/platform/haswell/include/platform/memory.h @@ -53,7 +53,6 @@ #if CONFIG_BROADWELL #define DRAM0_SIZE 0x000A0000 #define SHIM_BASE 0xFFFFB000 -#define MAILBOX_BASE 0x0049E000 #define DMA0_BASE 0xFFFFE000 #define DMA1_BASE 0xFFFFF000 #define SSP0_BASE 0xFFFFC000 @@ -62,7 +61,6 @@ #else /* HASWELL */ #define DRAM0_SIZE 0x00080000 #define SHIM_BASE 0xFFFE7000 -#define MAILBOX_BASE 0x0047E000 #define DMA0_BASE 0xFFFF0000 #define DMA1_BASE 0xFFFF8000 #define SSP0_BASE 0xFFFE8000 @@ -86,6 +84,8 @@ * +---------------------+----------------+-----------------------------------+ * | HEAP_BUFFER_BASE | Module Buffers | HEAP_BUFFER_SIZE | * +---------------------+----------------+-----------------------------------+ + * | MAILBOX_BASE | Mailbox | MAILBOX_SIZE | + * +---------------------+----------------+-----------------------------------+ * | REEF_STACK_END | Stack | REEF_STACK_SIZE | * +---------------------+----------------+-----------------------------------+ * | REEF_STACK_BASE | | | @@ -119,7 +119,7 @@ #define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE) #define HEAP_BUFFER_SIZE \ (DRAM0_SIZE - HEAP_RUNTIME_SIZE - REEF_STACK_SIZE -\ - HEAP_SYSTEM_SIZE - REEF_DATA_SIZE) + HEAP_SYSTEM_SIZE - REEF_DATA_SIZE - MAILBOX_SIZE)
#define HEAP_BUFFER_BLOCK_SIZE 0x180 #define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) @@ -135,6 +135,8 @@ #define REEF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE) #define REEF_STACK_END (REEF_STACK_BASE - REEF_STACK_SIZE)
+#define MAILBOX_BASE (REEF_STACK_END - MAILBOX_SIZE) + /* Vector and literal sizes - not in core-isa.h */ #define REEF_MEM_VECT_LIT_SIZE 0x4 #define REEF_MEM_VECT_TEXT_SIZE 0x1c
Refactor so other DMACs can be used for IPC purposes.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/reef/intel-ipc.h | 2 +- src/ipc/apl-ipc.c | 2 +- src/ipc/byt-ipc.c | 3 +-- src/ipc/cnl-ipc.c | 2 +- src/ipc/hsw-ipc.c | 2 +- src/ipc/intel-ipc.c | 6 +++--- src/platform/haswell/include/platform/platform.h | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/include/reef/intel-ipc.h b/src/include/reef/intel-ipc.h index c884e44..f89e9b5 100644 --- a/src/include/reef/intel-ipc.h +++ b/src/include/reef/intel-ipc.h @@ -36,7 +36,7 @@ /* private data for IPC */ struct intel_ipc_data { /* DMA */ - struct dma *dmac0; + struct dma *dmac; uint8_t *page_table; completion_t complete;
diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c index 1332639..167423b 100644 --- a/src/ipc/apl-ipc.c +++ b/src/ipc/apl-ipc.c @@ -198,7 +198,7 @@ int platform_ipc_init(struct ipc *ipc) bzero(iipc->page_table, HOST_PAGE_SIZE);
/* dma */ - iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0); + iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c index e7c1d78..91d8f1b 100644 --- a/src/ipc/byt-ipc.c +++ b/src/ipc/byt-ipc.c @@ -86,7 +86,6 @@ out: shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) & ~SHIM_IMRD_DONE); }
-/* test code to check working IRQ */ static void irq_handler(void *arg) { uint32_t isr; @@ -226,7 +225,7 @@ int platform_ipc_init(struct ipc *ipc) bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
/* dma */ - iipc->dmac0 = dma_get(DMA_ID_DMAC0); + iipc->dmac = dma_get(DMA_ID_DMAC0);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c index 5ccc345..0fcc5be 100644 --- a/src/ipc/cnl-ipc.c +++ b/src/ipc/cnl-ipc.c @@ -198,7 +198,7 @@ int platform_ipc_init(struct ipc *ipc) bzero(iipc->page_table, HOST_PAGE_SIZE);
/* dma */ - iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0); + iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/hsw-ipc.c b/src/ipc/hsw-ipc.c index 7a1dd72..6867be4 100644 --- a/src/ipc/hsw-ipc.c +++ b/src/ipc/hsw-ipc.c @@ -215,7 +215,7 @@ int platform_ipc_init(struct ipc *ipc) bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
/* dma */ - iipc->dmac0 = dma_get(DMA_ID_DMAC0); + iipc->dmac = dma_get(DMA_ID_DMAC1);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 0cfec42..5e14653 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -104,13 +104,13 @@ static int get_page_descriptors(struct intel_ipc_data *iipc, int chan; int ret = 0;
- /* get DMA channel from DMAC0 */ - chan = dma_channel_get(iipc->dmac0, 0); + /* get DMA channel from DMAC */ + chan = dma_channel_get(iipc->dmac, 0); if (chan < 0) { trace_ipc_error("ePC"); return chan; } - dma = iipc->dmac0; + dma = iipc->dmac;
/* set up DMA configuration */ config.direction = DMA_DIR_HMEM_TO_LMEM; diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index 8475e31..2d9315e 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -91,7 +91,7 @@ struct reef; #define DMA_TRACE_RESCHEDULE_TIME 5000
/* DMAC used for trace DMA */ -#define PLATFORM_TRACE_DMAC DMA_ID_DMAC0 +#define PLATFORM_TRACE_DMAC DMA_ID_DMAC1
/* DSP should be idle in this time frame */ #define PLATFORM_IDLE_TIME 750000
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/haswell/clk.c b/src/platform/haswell/clk.c index 0d4449d..76d18d1 100644 --- a/src/platform/haswell/clk.c +++ b/src/platform/haswell/clk.c @@ -195,7 +195,7 @@ uint64_t clock_time_elapsed(int clock, uint64_t previous, uint64_t *current)
void init_platform_clocks(void) { - clk_pdata = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*clk_pdata)); + clk_pdata = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock); spinlock_init(&clk_pdata->clk[1].lock);
Fix HSW handler so that it checks host_pending flag and aligns with BYT IPC handler wrt trace messages.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/ipc/hsw-ipc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/ipc/hsw-ipc.c b/src/ipc/hsw-ipc.c index 6867be4..5f350c1 100644 --- a/src/ipc/hsw-ipc.c +++ b/src/ipc/hsw-ipc.c @@ -48,6 +48,7 @@ #include <platform/platform.h> #include <reef/audio/component.h> #include <reef/audio/pipeline.h> +#include <reef/panic.h> #include <uapi/ipc.h> #include <reef/intel-ipc.h>
@@ -85,7 +86,6 @@ out: shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) & ~SHIM_IMRD_DONE); }
-/* test code to check working IRQ */ static void irq_handler(void *arg) { uint32_t isr; @@ -109,7 +109,11 @@ static void irq_handler(void *arg) shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) | SHIM_IMRD_BUSY); interrupt_clear(PLATFORM_IPC_INTERUPT);
- /* place message in Q and process later */ + /* TODO: place message in Q and process later */ + /* It's not Q ATM, may overwrite */ + if (_ipc->host_pending) + trace_ipc_error("Pen"); + _ipc->host_msg = shim_read(SHIM_IPCX); _ipc->host_pending = 1; } @@ -139,6 +143,7 @@ void ipc_platform_do_cmd(struct ipc *ipc) mailbox_hostbox_write(0, &reply, sizeof(reply));
done: + ipc->host_pending = 0;
/* clear BUSY bit and set DONE bit - accept new messages */ ipcx = shim_read(SHIM_IPCX); @@ -146,15 +151,19 @@ done: ipcx |= SHIM_IPCX_DONE; shim_write(SHIM_IPCX, ipcx);
+ /* unmask busy interrupt */ + shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) & ~SHIM_IMRD_BUSY); + // TODO: signal audio work to enter D3 in normal context /* are we about to enter D3 ? */ if (iipc->pm_prepare_D3) { - while (1) + while (1) { + trace_ipc("pme"); wait_for_interrupt(0); + } }
- /* unmask busy interrupt */ - shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) & ~SHIM_IMRD_BUSY); + tracev_ipc("CmD"); }
void ipc_platform_send_msg(struct ipc *ipc) @@ -205,6 +214,7 @@ int platform_ipc_init(struct ipc *ipc) list_init(&ipc->empty_list); list_init(&ipc->msg_list); spinlock_init(&ipc->lock); + for (i = 0; i < MSG_QUEUE_SIZE; i++) list_item_prepend(&ipc->message[i].list, &ipc->empty_list);
Timer 3 has highest priority.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index 0b9274f..16b16c7 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -75,8 +75,8 @@ static const struct sof_ipc_fw_ready ready = {
static struct work_queue_timesource platform_generic_queue = { .timer = { - .id = TIMER0, /* external timer using SSP */ - .irq = IRQ_NUM_TIMER1, + .id = TIMER2, /* external timer using SSP */ + .irq = IRQ_NUM_TIMER3, }, .clk = CLK_CPU, .notifier = NOTIFIER_ID_CPU_FREQ,
Work queue depends on clocks.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/baytrail/platform.c | 6 +++--- src/platform/haswell/platform.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 11ea731..4709fcd 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -275,6 +275,9 @@ int platform_init(struct reef *reef) /* init PMC IPC */ platform_ipc_pmc_init();
+ trace_point(TRACE_BOOT_PLATFORM_CLOCK); + init_platform_clocks(); + /* init work queues and clocks */ trace_point(TRACE_BOOT_SYS_WORK); init_system_workq(&platform_generic_queue); @@ -282,9 +285,6 @@ int platform_init(struct reef *reef) trace_point(TRACE_BOOT_PLATFORM_TIMER); platform_timer_start(platform_timer);
- trace_point(TRACE_BOOT_PLATFORM_CLOCK); - init_platform_clocks(); - /* init the system agent */ sa_init(reef);
diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index 16b16c7..5f56a05 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -182,6 +182,9 @@ int platform_init(struct reef *reef)
trace_point(TRACE_BOOT_PLATFORM_SHIM);
+ trace_point(TRACE_BOOT_PLATFORM_CLOCK); + init_platform_clocks(); + /* init work queues and clocks */ trace_point(TRACE_BOOT_SYS_WORK); init_system_workq(&platform_generic_queue); @@ -189,9 +192,6 @@ int platform_init(struct reef *reef) trace_point(TRACE_BOOT_PLATFORM_TIMER); platform_timer_start(platform_timer);
- trace_point(TRACE_BOOT_PLATFORM_CLOCK); - init_platform_clocks(); - /* init the system agent */ sa_init(reef);
No external SSP timer on HSW/BDW so need to use CPU clock.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/include/platform/platform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index 2d9315e..06e4335 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -64,7 +64,7 @@ struct reef; #define PLATFORM_MAX_STREAMS 5
/* clock source used by scheduler for deadline calculations */ -#define PLATFORM_SCHED_CLOCK CLK_SSP +#define PLATFORM_SCHED_CLOCK CLK_CPU
/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */ #define PLATFORM_DMA_TIMEOUT 1333 @@ -76,7 +76,7 @@ struct reef; #define PLATFORM_WORKQ_WINDOW 2000
/* platform WorkQ clock */ -#define PLATFORM_WORKQ_CLOCK CLK_SSP +#define PLATFORM_WORKQ_CLOCK CLK_CPU
/* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE
Panic uses IPCD
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/haswell/include/platform/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index 06e4335..94c4bc2 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -102,7 +102,7 @@ struct reef;
/* Platform defined trace code */ #define platform_trace_point(__x) \ - shim_write(SHIM_IPCD, ((__x) & 0x3fffffff)) + shim_write(SHIM_IPCX, ((__x) & 0x3fffffff)) /* * APIs declared here are defined for every platform and IPC mechanism. */
participants (1)
-
Liam Girdwood