Skip to content

Commit 9865247

Browse files
authored
Merge pull request #367 from xiulipan/merge12
Merge stable-1.2 into master without scheduler and task part
2 parents 84e15e7 + 1ff4a9d commit 9865247

10 files changed

Lines changed: 55 additions & 37 deletions

File tree

src/arch/xtensa/include/arch/wait.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,20 @@
2929
*/
3030

3131
#include <xtensa/xtruntime.h>
32+
#include <arch/interrupt.h>
33+
#include <sof/panic.h>
34+
3235

3336
#if defined(PLATFORM_WAITI_DELAY)
3437

3538
static inline void arch_wait_for_interrupt(int level)
3639
{
3740
int i;
3841

42+
/* can only eneter WFI when at runlevel 0 i.e. not IRQ level */
43+
if (arch_interrupt_get_level() > 0)
44+
panic(SOF_IPC_PANIC_WFI);
45+
3946
/* this sequnce must be atomic on LX6 */
4047
XTOS_SET_INTLEVEL(5);
4148

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

5663
static inline void arch_wait_for_interrupt(int level)
5764
{
58-
asm volatile("waiti 0");
65+
/* can only eneter WFI when at runlevel 0 i.e. not IRQ level */
66+
if (arch_interrupt_get_level() > 0)
67+
panic(SOF_IPC_PANIC_WFI);
68+
69+
asm volatile("waiti 0");
5970
}
6071

6172
#endif

src/drivers/intel/dw-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ static int dw_dma_stop(struct dma *dma, int channel)
508508
dw_write(dma, DW_DMA_CHAN_EN, CHAN_DISABLE(channel));
509509

510510
#if DW_USE_HW_LLI
511+
lli = p->chan[channel].lli;
511512
for (i = 0; i < p->chan[channel].desc_count; i++) {
512-
lli = p->chan[channel].lli;
513513
lli->ctrl_hi &= ~DW_CTLH_DONE(1);
514514
lli++;
515515
}

src/include/sof/list.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static inline void list_item_del(struct list_item *item)
7979
{
8080
item->next->prev = item->prev;
8181
item->prev->next = item->next;
82+
list_init(item);
8283
}
8384

8485
/* delete item from the list list iteam will be reinitialised

src/include/uapi/ipc.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,17 @@
144144
#define SOF_IPC_PANIC_MAGIC 0x0dead000
145145
#define SOF_IPC_PANIC_MAGIC_MASK 0x0ffff000
146146
#define SOF_IPC_PANIC_CODE_MASK 0x00000fff
147-
#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0)
148-
#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 1)
149-
#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 2)
150-
#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 3)
151-
#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 4)
152-
#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 5)
153-
#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 6)
154-
#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 7)
155-
#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 8)
156-
#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 9)
147+
#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0x0)
148+
#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 0x1)
149+
#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 0x2)
150+
#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 0x3)
151+
#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 0x4)
152+
#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 0x5)
153+
#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 0x6)
154+
#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 0x7)
155+
#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 0x8)
156+
#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 0x9)
157+
#define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa)
157158

158159
/*
159160
* SOF memory capabilities, add new ones at the end

src/ipc/handler.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
167167
struct sof_ipc_comp_host *host = NULL;
168168
struct list_item elem_list;
169169
struct dma_sg_elem *elem;
170-
struct list_item *plist;
170+
struct list_item *clist;
171+
struct list_item *tlist;
171172
uint32_t ring_size;
172173
#endif
173174
struct sof_ipc_pcm_params *pcm_params = _ipc->comp_data;
@@ -233,8 +234,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
233234
goto error;
234235
}
235236

236-
list_for_item(plist, &elem_list) {
237-
elem = container_of(plist, struct dma_sg_elem, list);
237+
list_for_item_safe(clist, tlist, &elem_list) {
238+
elem = container_of(clist, struct dma_sg_elem, list);
238239

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

280281
error:
281282
#ifdef CONFIG_HOST_PTABLE
282-
list_for_item(plist, &elem_list) {
283-
elem = container_of(plist, struct dma_sg_elem, list);
283+
list_for_item_safe(clist, tlist, &elem_list) {
284+
elem = container_of(clist, struct dma_sg_elem, list);
284285
list_item_del(&elem->list);
285286
rfree(elem);
286287
}
@@ -635,14 +636,14 @@ static int ipc_glb_pm_message(uint32_t header)
635636
/*
636637
* Debug IPC Operations.
637638
*/
638-
639639
static int ipc_dma_trace_config(uint32_t header)
640640
{
641641
#ifdef CONFIG_HOST_PTABLE
642642
struct intel_ipc_data *iipc = ipc_get_drvdata(_ipc);
643643
struct list_item elem_list;
644644
struct dma_sg_elem *elem;
645-
struct list_item *plist;
645+
struct list_item *clist;
646+
struct list_item *tlist;
646647
uint32_t ring_size;
647648
#endif
648649
struct sof_ipc_dma_trace_params *params = _ipc->comp_data;
@@ -681,8 +682,8 @@ static int ipc_dma_trace_config(uint32_t header)
681682
goto error;
682683
}
683684

684-
list_for_item(plist, &elem_list) {
685-
elem = container_of(plist, struct dma_sg_elem, list);
685+
list_for_item_safe(clist, tlist, &elem_list) {
686+
elem = container_of(clist, struct dma_sg_elem, list);
686687

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

716717
error:
717718
#ifdef CONFIG_HOST_PTABLE
718-
list_for_item(plist, &elem_list) {
719-
elem = container_of(plist, struct dma_sg_elem, list);
719+
list_for_item_safe(clist, tlist, &elem_list) {
720+
elem = container_of(clist, struct dma_sg_elem, list);
720721
list_item_del(&elem->list);
721722
rfree(elem);
722723
}

src/ipc/pmc-ipc.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void irq_handler(void *arg)
126126
int ipc_pmc_send_msg(uint32_t message)
127127
{
128128
uint32_t ipclpesch;
129-
uint32_t irq_mask;
129+
int try = 0;
130130

131131
trace_ipc("SMs");
132132

@@ -138,22 +138,23 @@ int ipc_pmc_send_msg(uint32_t message)
138138
return -EAGAIN;
139139
}
140140

141-
/* disable all interrupts except for SCU */
142-
irq_mask = arch_interrupt_disable_mask(~(1 << IRQ_NUM_EXT_PMC));
143-
144141
/* send the new message */
145142
shim_write(SHIM_IPCLPESCL, 0);
146143
shim_write(SHIM_IPCLPESCH, SHIM_IPCLPESCH_BUSY | message);
147144

148-
/* now wait for clock change */
149-
wait_for_interrupt(0);
150-
151-
/* enable other IRQs */
152-
arch_interrupt_enable_mask(irq_mask);
153-
154145
/* check status */
155146
ipclpesch = shim_read(SHIM_IPCLPESCH);
156147

148+
while (ipclpesch & SHIM_IPCLPESCH_BUSY) {
149+
/* now wait for clock change */
150+
idelay(PLATFORM_LPE_DELAY);
151+
ipclpesch = shim_read(SHIM_IPCLPESCH);
152+
153+
try++;
154+
if (try > 10)
155+
break;
156+
}
157+
157158
/* did command succeed */
158159
if (ipclpesch & SHIM_IPCLPESCH_BUSY) {
159160
trace_ipc_error("ePf");

src/platform/apollolake/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct sof;
107107
* the interval of reschedule DMA trace copying in special case like half
108108
* fullness of local DMA trace buffer
109109
*/
110-
#define DMA_TRACE_RESCHEDULE_TIME 5
110+
#define DMA_TRACE_RESCHEDULE_TIME 100
111111

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

src/platform/baytrail/include/platform/platform.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ struct sof;
9494
* the interval of reschedule DMA trace copying in special case like half
9595
* fullness of local DMA trace buffer
9696
*/
97-
#define DMA_TRACE_RESCHEDULE_TIME 5
97+
#define DMA_TRACE_RESCHEDULE_TIME 100
9898

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

102102
/* DSP default delay in cycles */
103103
#define PLATFORM_DEFAULT_DELAY 12
104104

105+
/* DSP LPE delay in cycles */
106+
#define PLATFORM_LPE_DELAY 2000
107+
105108
/* Platform defined panic code */
106109
static inline void platform_panic(uint32_t p)
107110
{

src/platform/cannonlake/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct sof;
113113
* the interval of reschedule DMA trace copying in special case like half
114114
* fullness of local DMA trace buffer
115115
*/
116-
#define DMA_TRACE_RESCHEDULE_TIME 5
116+
#define DMA_TRACE_RESCHEDULE_TIME 100
117117

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

src/platform/haswell/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct sof;
9393
* the interval of reschedule DMA trace copying in special case like half
9494
* fullness of local DMA trace buffer
9595
*/
96-
#define DMA_TRACE_RESCHEDULE_TIME 5
96+
#define DMA_TRACE_RESCHEDULE_TIME 100
9797

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

0 commit comments

Comments
 (0)