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
8 changes: 4 additions & 4 deletions src/arch/xtensa/include/arch/lib/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ static inline void arch_wait_for_interrupt(int level)
{
int i;

/* can only enter WFI when at run level 0 i.e. not IRQ level */
if (arch_interrupt_get_level() > 0)
/* need to make sure the interrupt level won't be lowered */
if (arch_interrupt_get_level() > level)
panic(SOF_IPC_PANIC_WFI);

/* this sequence must be atomic on LX6 */
Expand All @@ -43,8 +43,8 @@ static inline void arch_wait_for_interrupt(int level)

static inline void arch_wait_for_interrupt(int level)
{
/* can only enter WFI when at run level 0 i.e. not IRQ level */
if (arch_interrupt_get_level() > 0)
/* need to make sure the interrupt level won't be lowered */
if (arch_interrupt_get_level() > level)
panic(SOF_IPC_PANIC_WFI);

asm volatile("waiti 0");
Expand Down
1 change: 1 addition & 0 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ static int kpb_prepare(struct comp_dev *dev)
SOF_SCHEDULE_EDF, /* utilize EDF scheduler */
SOF_TASK_PRI_ALMOST_IDLE, /* almost idle priority */
kpb_draining_task, /* task function */
NULL, /* no complete function */
&kpb->draining_task_data, /* task private data */
0, /* core on which we should run */
SOF_SCHEDULE_FLAG_IDLE);
Expand Down
2 changes: 1 addition & 1 deletion src/audio/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc,
type = pipeline_is_timer_driven(p) ? SOF_SCHEDULE_LL :
SOF_SCHEDULE_EDF;
schedule_task_init(&p->pipe_task, type, pipe_desc->priority,
pipeline_task, p, pipe_desc->core, 0);
pipeline_task, NULL, p, pipe_desc->core, 0);

return p;
}
Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)

comp_set_drvdata(dev, cd);
schedule_task_init(&cd->volwork, SOF_SCHEDULE_LL, SOF_TASK_PRI_MED,
vol_work, dev, 0, 0);
vol_work, NULL, dev, 0, 0);

/* Set the default volumes. If IPC sets min_value or max_value to
* not-zero, use them. Otherwise set to internal limits and notify
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/dw/ssi-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ static enum task_state spi_completion_work(void *data)
dcache_invalidate_region(spi->rx_buffer, SPI_BUFFER_SIZE);
mailbox_hostbox_write(0, spi->rx_buffer, hdr->size);

_ipc->host_pending = 1;
ipc_schedule_process(_ipc);

break;
Expand Down Expand Up @@ -414,7 +413,7 @@ static int spi_slave_init(struct spi *spi)

spi->completion.private = NULL;
return schedule_task_init(&spi->completion, SOF_SCHEDULE_EDF,
SOF_TASK_PRI_MED, spi_completion_work, spi, 0, 0);
SOF_TASK_PRI_MED, spi_completion_work, NULL, spi, 0, 0);
}

int spi_probe(struct spi *spi)
Expand Down
27 changes: 11 additions & 16 deletions src/drivers/imx/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ static void do_notify(void)

static void irq_handler(void *arg)
{
uint32_t ctrl;
uint32_t status;
uint32_t msg = 0;

/* Interrupt arrived, check src */
ctrl = imx_mu_read(IMX_MU_xCR);
status = imx_mu_read(IMX_MU_xSR);

tracev_ipc("ipc: irq isr 0x%x", status);
Expand All @@ -89,20 +86,12 @@ static void irq_handler(void *arg)
imx_mu_xsr_rmw(IMX_MU_xSR_GIPn(0), 0);

interrupt_clear(PLATFORM_IPC_INTERRUPT);
/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("ipc: dropping msg 0x%x", msg);
trace_ipc_error(" isr 0x%x ctrl 0x%x ipcxh 0x%x",
status, ctrl);
} else {
_ipc->host_pending = 1;
ipc_schedule_process(_ipc);
}

ipc_schedule_process(_ipc);
}
}

void ipc_platform_do_cmd(struct ipc *ipc)
static enum task_state ipc_platform_do_cmd(void *data)
{
struct sof_ipc_cmd_hdr *hdr;
/* Use struct ipc_data *iipc = ipc_get_drvdata(ipc); if needed */
Expand All @@ -111,7 +100,12 @@ void ipc_platform_do_cmd(struct ipc *ipc)
hdr = mailbox_validate();
ipc_cmd(hdr);

ipc->host_pending = 0;
return SOF_TASK_STATE_COMPLETED;
}

static void ipc_platform_complete_cmd(void *data)
{
struct ipc *ipc = data;

/* enable GP interrupt #0 - accept new messages */
imx_mu_xcr_rmw(IMX_MU_xCR_GIEn(0), 0);
Expand Down Expand Up @@ -169,7 +163,8 @@ int platform_ipc_init(struct ipc *ipc)

/* schedule */
schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_IPC,
ipc_process_task, _ipc, 0, 0);
ipc_platform_do_cmd, ipc_platform_complete_cmd, _ipc,
0, 0);

#if CONFIG_HOST_PTABLE
/* allocate page table buffer */
Expand Down
26 changes: 11 additions & 15 deletions src/drivers/intel/baytrail/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,26 @@ static void irq_handler(void *arg)
/* Mask Busy interrupt before return */
shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) | SHIM_IMRD_BUSY);

/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("ipc: dropping msg");
trace_ipc_error(" isr 0x%x imrd 0x%x ipcxh 0x%x",
isr, shim_read(SHIM_IMRD),
shim_read(SHIM_IPCXH));
} else {
_ipc->host_pending = 1;
ipc_schedule_process(_ipc);
}
ipc_schedule_process(_ipc);
}
}

void ipc_platform_do_cmd(struct ipc *ipc)
static enum task_state ipc_platform_do_cmd(void *data)
{
struct sof_ipc_cmd_hdr *hdr;
/* Use struct ipc_data *iipc = ipc_get_drvdata(ipc); if needed */
uint32_t ipcxh;

/* perform command */
hdr = mailbox_validate();
ipc_cmd(hdr);

ipc->host_pending = 0;
return SOF_TASK_STATE_COMPLETED;
}

static void ipc_platform_complete_cmd(void *data)
{
struct ipc *ipc = data;
uint32_t ipcxh;

/* clear BUSY bit and set DONE bit - accept new messages */
ipcxh = shim_read(SHIM_IPCXH);
Expand Down Expand Up @@ -186,7 +181,8 @@ int platform_ipc_init(struct ipc *ipc)

/* schedule */
schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_IPC,
ipc_process_task, _ipc, 0, 0);
ipc_platform_do_cmd, ipc_platform_complete_cmd, _ipc,
0, 0);

#if CONFIG_HOST_PTABLE
/* allocate page table buffer */
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/intel/cavs/dmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ static int dmic_set_config(struct dai *dai, struct sof_ipc_dai_config *config)

/* Initialize start sequence handler */
schedule_task_init(&dmic->dmicwork, SOF_SCHEDULE_LL,
SOF_TASK_PRI_MED, dmic_work, dai, 0,
SOF_TASK_PRI_MED, dmic_work, NULL, dai, 0,
SOF_SCHEDULE_FLAG_ASYNC);


Expand Down
3 changes: 2 additions & 1 deletion src/drivers/intel/cavs/idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <xtos-structs.h>
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

extern struct ipc *_ipc;
Expand Down Expand Up @@ -371,7 +372,7 @@ int idc_init(void)

/* process task */
schedule_task_init(&(*idc)->idc_task, SOF_SCHEDULE_EDF,
SOF_TASK_PRI_IDC, idc_do_cmd, *idc, core, 0);
SOF_TASK_PRI_IDC, idc_do_cmd, NULL, *idc, core, 0);

/* configure interrupt */
(*idc)->irq = interrupt_get_irq(PLATFORM_IDC_INTERRUPT,
Expand Down
36 changes: 16 additions & 20 deletions src/drivers/intel/cavs/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,7 @@ static void ipc_irq_handler(void *arg)
increment_ipc_received_counter();
#endif

/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("ipc: dropping msg");
#if CAVS_VERSION == CAVS_VERSION_1_5
trace_ipc_error(" dipct 0x%x dipcie 0x%x dipcctl 0x%x",
dipct, dipcie, ipc_read(IPC_DIPCCTL));
#else
trace_ipc_error(" dipctdr 0x%x dipcida 0x%x "
"dipcctl 0x%x", dipctdr, dipcida,
ipc_read(IPC_DIPCCTL));
#endif
} else {
_ipc->host_pending = 1;
ipc_schedule_process(_ipc);
}
ipc_schedule_process(_ipc);
}

/* reply message(done) from host */
Expand Down Expand Up @@ -133,17 +118,18 @@ static void ipc_irq_handler(void *arg)
}
}

void ipc_platform_do_cmd(struct ipc *ipc)
static enum task_state ipc_platform_do_cmd(void *data)
{
#if CAVS_VERSION < CAVS_VERSION_2_0
struct ipc *ipc = data;
#endif
struct sof_ipc_cmd_hdr *hdr;

hdr = mailbox_validate();

/* perform command */
ipc_cmd(hdr);

ipc->host_pending = 0;

/* are we about to enter D3 ? */
#if CAVS_VERSION < CAVS_VERSION_2_0
if (ipc->pm_prepare_D3) {
Expand All @@ -152,6 +138,15 @@ void ipc_platform_do_cmd(struct ipc *ipc)
}
#endif

return SOF_TASK_STATE_COMPLETED;
}

static void ipc_platform_complete_cmd(void *data)
{
#if CAVS_VERSION >= CAVS_VERSION_2_0
struct ipc *ipc = data;
#endif

/* write 1 to clear busy, and trigger interrupt to host*/
#if CAVS_VERSION == CAVS_VERSION_1_5
ipc_write(IPC_DIPCT, ipc_read(IPC_DIPCT) | IPC_DIPCT_BUSY);
Expand Down Expand Up @@ -230,7 +225,8 @@ int platform_ipc_init(struct ipc *ipc)

/* schedule */
schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_IPC,
ipc_process_task, _ipc, 0, 0);
ipc_platform_do_cmd, ipc_platform_complete_cmd, _ipc,
0, 0);

/* configure interrupt */
irq = interrupt_get_irq(PLATFORM_IPC_INTERRUPT,
Expand Down
9 changes: 5 additions & 4 deletions src/drivers/intel/cavs/sue-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
extern struct ipc *_ipc;

/* No private data for IPC */
void ipc_platform_do_cmd(struct ipc *ipc)
static enum task_state ipc_platform_do_cmd(void *data)
{
struct ipc *ipc = data;
struct sof_ipc_cmd_hdr *hdr;
struct sof_ipc_reply reply;

Expand All @@ -34,14 +35,14 @@ void ipc_platform_do_cmd(struct ipc *ipc)
0, sizeof(reply));
spi_push(spi_get(SOF_SPI_INTEL_SLAVE), &reply, sizeof(reply));

ipc->host_pending = 0;

// TODO: signal audio work to enter D3 in normal context
/* are we about to enter D3 ? */
if (ipc->pm_prepare_D3) {
while (1)
wait_for_interrupt(0);
}

return SOF_TASK_STATE_COMPLETED;
}

void ipc_platform_send_msg(struct ipc *ipc)
Expand Down Expand Up @@ -81,7 +82,7 @@ int platform_ipc_init(struct ipc *ipc)

/* schedule */
schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_MED,
ipc_process_task, _ipc, 0, 0);
ipc_platform_do_cmd, NULL, _ipc, 0, 0);

return 0;
}
24 changes: 10 additions & 14 deletions src/drivers/intel/haswell/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,11 @@ static void irq_handler(void *arg)
/* Mask Busy interrupt before return */
shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) | SHIM_IMRD_BUSY);

/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("ipc: dropping msg");
trace_ipc_error(" isr 0x%x imrd 0x%x ipcx 0x%x",
isr, shim_read(SHIM_IMRD),
shim_read(SHIM_IPCX));
} else {
_ipc->host_pending = 1;
ipc_schedule_process(_ipc);
}
ipc_schedule_process(_ipc);
}
}

void ipc_platform_do_cmd(struct ipc *ipc)
static enum task_state ipc_platform_do_cmd(void *data)
{
struct sof_ipc_cmd_hdr *hdr;
/* Use struct ipc_data *iipc = ipc_get_drvdata(ipc); if needed */
Expand All @@ -105,7 +95,12 @@ void ipc_platform_do_cmd(struct ipc *ipc)
hdr = mailbox_validate();
ipc_cmd(hdr);

ipc->host_pending = 0;
return SOF_TASK_STATE_COMPLETED;
}

static void ipc_platform_complete_cmd(void *data)
{
struct ipc *ipc = data;

/* clear BUSY bit and set DONE bit - accept new messages */
shim_write(SHIM_IPCX, SHIM_IPCX_DONE);
Expand Down Expand Up @@ -176,7 +171,8 @@ int platform_ipc_init(struct ipc *ipc)

/* schedule */
schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_IPC,
ipc_process_task, _ipc, 0, 0);
ipc_platform_do_cmd, ipc_platform_complete_cmd, _ipc,
0, 0);

#if CONFIG_HOST_PTABLE
/* allocate page table buffer */
Expand Down
3 changes: 0 additions & 3 deletions src/include/sof/drivers/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ struct ipc_shared_context {
};

struct ipc {
uint32_t host_pending;
spinlock_t *lock; /* locking mechanism */
void *comp_data;

Expand Down Expand Up @@ -147,7 +146,6 @@ int platform_ipc_init(struct ipc *ipc);
void ipc_free(struct ipc *ipc);

int ipc_process_msg_queue(void);
enum task_state ipc_process_task(void *data);
void ipc_schedule_process(struct ipc *ipc);

int ipc_stream_send_position(struct comp_dev *cdev,
Expand All @@ -160,7 +158,6 @@ int ipc_stream_send_xrun(struct comp_dev *cdev,
int ipc_queue_host_message(struct ipc *ipc, uint32_t header, void *tx_data,
size_t tx_bytes, uint32_t replace);

void ipc_platform_do_cmd(struct ipc *ipc);
void ipc_platform_send_msg(struct ipc *ipc);

/**
Expand Down
Loading