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
2 changes: 1 addition & 1 deletion src/drivers/intel/dw-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ static int dw_dma_stop(struct dma *dma, int channel)
dw_write(dma, DW_DMA_CHAN_EN, CHAN_DISABLE(channel));

#if DW_USE_HW_LLI
lli = p->chan[channel].lli;
for (i = 0; i < p->chan[channel].desc_count; i++) {
lli = p->chan[channel].lli;
lli->ctrl_hi &= ~DW_CTLH_DONE(1);
lli++;
}
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static inline void list_item_del(struct list_item *item)
{
item->next->prev = item->prev;
item->prev->next = item->next;
list_init(item);
}

/* delete item from the list list iteam will be reinitialised
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 @@ -144,16 +144,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
23 changes: 12 additions & 11 deletions src/ipc/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
struct sof_ipc_comp_host *host = NULL;
struct list_item elem_list;
struct dma_sg_elem *elem;
struct list_item *plist;
struct list_item *clist;
struct list_item *tlist;
uint32_t ring_size;
#endif
struct sof_ipc_pcm_params *pcm_params = _ipc->comp_data;
Expand Down Expand Up @@ -233,8 +234,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
goto error;
}

list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);

err = comp_host_buffer(cd, elem, ring_size);
if (err < 0) {
Expand Down Expand Up @@ -279,8 +280,8 @@ static int ipc_stream_pcm_params(uint32_t stream)

error:
#ifdef CONFIG_HOST_PTABLE
list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);
list_item_del(&elem->list);
rfree(elem);
}
Expand Down Expand Up @@ -635,14 +636,14 @@ static int ipc_glb_pm_message(uint32_t header)
/*
* Debug IPC Operations.
*/

static int ipc_dma_trace_config(uint32_t header)
{
#ifdef CONFIG_HOST_PTABLE
struct intel_ipc_data *iipc = ipc_get_drvdata(_ipc);
struct list_item elem_list;
struct dma_sg_elem *elem;
struct list_item *plist;
struct list_item *clist;
struct list_item *tlist;
uint32_t ring_size;
#endif
struct sof_ipc_dma_trace_params *params = _ipc->comp_data;
Expand Down Expand Up @@ -681,8 +682,8 @@ static int ipc_dma_trace_config(uint32_t header)
goto error;
}

list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);

err = dma_trace_host_buffer(_ipc->dmat, elem, ring_size);
if (err < 0) {
Expand Down Expand Up @@ -715,8 +716,8 @@ static int ipc_dma_trace_config(uint32_t header)

error:
#ifdef CONFIG_HOST_PTABLE
list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);
list_item_del(&elem->list);
rfree(elem);
}
Expand Down
21 changes: 11 additions & 10 deletions src/ipc/pmc-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void irq_handler(void *arg)
int ipc_pmc_send_msg(uint32_t message)
{
uint32_t ipclpesch;
uint32_t irq_mask;
int try = 0;

trace_ipc("SMs");

Expand All @@ -138,22 +138,23 @@ int ipc_pmc_send_msg(uint32_t message)
return -EAGAIN;
}

/* disable all interrupts except for SCU */
irq_mask = arch_interrupt_disable_mask(~(1 << IRQ_NUM_EXT_PMC));

/* send the new message */
shim_write(SHIM_IPCLPESCL, 0);
shim_write(SHIM_IPCLPESCH, SHIM_IPCLPESCH_BUSY | message);

/* now wait for clock change */
wait_for_interrupt(0);

/* enable other IRQs */
arch_interrupt_enable_mask(irq_mask);

/* check status */
ipclpesch = shim_read(SHIM_IPCLPESCH);

while (ipclpesch & SHIM_IPCLPESCH_BUSY) {
/* now wait for clock change */
idelay(PLATFORM_LPE_DELAY);
ipclpesch = shim_read(SHIM_IPCLPESCH);

try++;
if (try > 10)
break;
}

/* did command succeed */
if (ipclpesch & SHIM_IPCLPESCH_BUSY) {
trace_ipc_error("ePf");
Expand Down
2 changes: 1 addition & 1 deletion src/platform/apollolake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct sof;
* the interval of reschedule DMA trace copying in special case like half
* fullness of local DMA trace buffer
*/
#define DMA_TRACE_RESCHEDULE_TIME 5
#define DMA_TRACE_RESCHEDULE_TIME 100

/* DSP should be idle in this time frame */
#define PLATFORM_IDLE_TIME 750000
Expand Down
5 changes: 4 additions & 1 deletion src/platform/baytrail/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ struct sof;
* the interval of reschedule DMA trace copying in special case like half
* fullness of local DMA trace buffer
*/
#define DMA_TRACE_RESCHEDULE_TIME 5
#define DMA_TRACE_RESCHEDULE_TIME 100

/* DSP should be idle in this time frame */
#define PLATFORM_IDLE_TIME 750000

/* DSP default delay in cycles */
#define PLATFORM_DEFAULT_DELAY 12

/* DSP LPE delay in cycles */
#define PLATFORM_LPE_DELAY 2000

/* Platform defined panic code */
static inline void platform_panic(uint32_t p)
{
Expand Down
2 changes: 1 addition & 1 deletion src/platform/cannonlake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct sof;
* the interval of reschedule DMA trace copying in special case like half
* fullness of local DMA trace buffer
*/
#define DMA_TRACE_RESCHEDULE_TIME 5
#define DMA_TRACE_RESCHEDULE_TIME 100

/* DSP should be idle in this time frame */
#define PLATFORM_IDLE_TIME 750000
Expand Down
2 changes: 1 addition & 1 deletion src/platform/haswell/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct sof;
* the interval of reschedule DMA trace copying in special case like half
* fullness of local DMA trace buffer
*/
#define DMA_TRACE_RESCHEDULE_TIME 5
#define DMA_TRACE_RESCHEDULE_TIME 100

/* DSP should be idle in this time frame */
#define PLATFORM_IDLE_TIME 750000
Expand Down