[Sound-open-firmware] [PATCH] memory: allocator: Remove RFLAGS_NONE/USED and use caps
Liam Girdwood
liam.r.girdwood at linux.intel.com
Thu Mar 1 17:15:10 CET 2018
Dont use RFLAGS_NONE, but use the new memory capabilities flags instead.
Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
src/audio/buffer.c | 4 ++--
src/audio/component.c | 2 +-
src/audio/dai.c | 10 ++++++----
src/audio/eq_fir.c | 8 ++++----
src/audio/eq_iir.c | 8 ++++----
src/audio/host.c | 14 +++++++-------
src/audio/mixer.c | 4 ++--
src/audio/pipeline.c | 5 +++--
src/audio/src.c | 7 ++++---
src/audio/tone.c | 4 ++--
src/audio/volume.c | 4 ++--
src/drivers/apl-ssp.c | 2 +-
src/drivers/dw-dma.c | 10 ++++++----
src/drivers/hda-dma.c | 2 +-
src/drivers/ssp.c | 2 +-
src/include/reef/alloc.h | 8 +-------
src/include/uapi/ipc.h | 2 +-
src/ipc/apl-ipc.c | 5 +++--
src/ipc/byt-ipc.c | 5 +++--
src/ipc/cnl-ipc.c | 5 +++--
src/ipc/hsw-ipc.c | 5 +++--
src/ipc/ipc.c | 13 ++++++++-----
src/ipc/pmc-ipc.c | 3 ++-
src/lib/agent.c | 2 +-
src/lib/alloc.c | 12 ++++++------
src/lib/dma-trace.c | 7 ++++---
src/lib/interrupt.c | 3 ++-
src/lib/schedule.c | 2 +-
src/lib/work.c | 2 +-
src/platform/apollolake/clk.c | 2 +-
src/platform/baytrail/clk.c | 2 +-
src/platform/cannonlake/clk.c | 3 ++-
src/platform/haswell/clk.c | 2 +-
33 files changed, 90 insertions(+), 79 deletions(-)
diff --git a/src/audio/buffer.c b/src/audio/buffer.c
index 6ae7d92..360ad6b 100644
--- a/src/audio/buffer.c
+++ b/src/audio/buffer.c
@@ -60,13 +60,13 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)
}
/* allocate new buffer */
- buffer = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*buffer));
+ buffer = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*buffer));
if (buffer == NULL) {
trace_buffer_error("ebN");
return NULL;
}
- buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, desc->size);
+ buffer->addr = rballoc(RZONE_RUNTIME, desc->caps, desc->size);
if (buffer->addr == NULL) {
rfree(buffer);
trace_buffer_error("ebm");
diff --git a/src/audio/component.c b/src/audio/component.c
index 54a7da8..f27f350 100644
--- a/src/audio/component.c
+++ b/src/audio/component.c
@@ -189,7 +189,7 @@ int comp_set_state(struct comp_dev *dev, int cmd)
void sys_comp_init(void)
{
- cd = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*cd));
list_init(&cd->list);
spinlock_init(&cd->lock);
}
diff --git a/src/audio/dai.c b/src/audio/dai.c
index 713ab4e..061af5e 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -184,7 +184,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
trace_dai("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_dai));
if (dev == NULL)
return NULL;
@@ -192,7 +192,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
dai = (struct sof_ipc_comp_dai *)&dev->comp;
memcpy(dai, ipc_dai, sizeof(struct sof_ipc_comp_dai));
- dd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dd));
+ dd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*dd));
if (dd == NULL) {
rfree(dev);
return NULL;
@@ -289,7 +289,8 @@ static int dai_playback_params(struct comp_dev *dev)
/* set up cyclic list of DMA elems */
for (i = 0; i < source_config->periods_sink; i++) {
- elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem));
+ elem = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(*elem));
if (elem == NULL)
goto err_unwind;
@@ -356,7 +357,8 @@ static int dai_capture_params(struct comp_dev *dev)
/* set up cyclic list of DMA elems */
for (i = 0; i < sink_config->periods_source; i++) {
- elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem));
+ elem = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(*elem));
if (elem == NULL)
goto err_unwind;
diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c
index a723cf0..b6ec58f 100644
--- a/src/audio/eq_fir.c
+++ b/src/audio/eq_fir.c
@@ -205,7 +205,7 @@ static int eq_fir_setup(struct fir_state_32x16 fir[],
}
/* Allocate all FIR channels data in a big chunk and clear it */
- fir_data = rballoc(RZONE_SYS, RFLAGS_NONE,
+ fir_data = rballoc(RZONE_SYS, SOF_MEM_CAPS_RAM,
length_sum * sizeof(int32_t));
if (fir_data == NULL)
return -ENOMEM;
@@ -253,7 +253,7 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)
trace_eq("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_eq_fir));
if (dev == NULL)
return NULL;
@@ -261,7 +261,7 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)
eq_fir = (struct sof_ipc_comp_eq_fir *) &dev->comp;
memcpy(eq_fir, ipc_eq_fir, sizeof(struct sof_ipc_comp_eq_fir));
- cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (cd == NULL) {
rfree(dev);
return NULL;
@@ -401,7 +401,7 @@ static int fir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat
if ((bs > SOF_EQ_FIR_MAX_SIZE) || (bs < 1))
return -EINVAL;
- cd->config = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, bs);
+ cd->config = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, bs);
if (cd->config == NULL)
return -EINVAL;
diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c
index eb464af..2a1dd59 100644
--- a/src/audio/eq_iir.c
+++ b/src/audio/eq_iir.c
@@ -211,7 +211,7 @@ static int eq_iir_setup(struct iir_state_df2t iir[],
}
/* Allocate all IIR channels data in a big chunk and clear it */
- iir_delay = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, size_sum);
+ iir_delay = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, size_sum);
if (iir_delay == NULL)
return -ENOMEM;
@@ -256,14 +256,14 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
trace_eq_iir("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_eq_iir));
if (dev == NULL)
return NULL;
memcpy(&dev->comp, comp, sizeof(struct sof_ipc_comp_eq_iir));
- cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (cd == NULL) {
rfree(dev);
return NULL;
@@ -397,7 +397,7 @@ static int iir_cmd_set_data(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdat
return -EINVAL;
/* Allocate and make a copy of the blob and setup IIR */
- cd->config = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, bs);
+ cd->config = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, bs);
if (cd->config == NULL)
return -EINVAL;
diff --git a/src/audio/host.c b/src/audio/host.c
index 6d60902..a76e340 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -244,7 +244,7 @@ static int create_local_elems(struct comp_dev *dev)
/* TODO: simplify elem storage by using an array */
for (i = 0; i < hd->period_count; i++) {
/* allocate new host DMA elem and add it to our list */
- e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e));
+ e = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*e));
if (e == NULL)
goto unwind;
@@ -396,7 +396,7 @@ static int create_local_elems(struct comp_dev *dev)
/* TODO: simplify elem storage by using an array */
for (i = 0; i < hd->period_count; i++) {
/* allocate new host DMA elem and add it to our list */
- e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e));
+ e = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*e));
if (e == NULL)
goto unwind;
@@ -422,7 +422,7 @@ static int create_local_elems(struct comp_dev *dev)
continue;
/* allocate new host DMA elem and add it to our list */
- ec = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*ec));
+ ec = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*ec));
if (!ec)
goto unwind;
@@ -500,7 +500,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
trace_host("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_host));
if (dev == NULL)
return NULL;
@@ -508,13 +508,13 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
host = (struct sof_ipc_comp_host *)&dev->comp;
memcpy(host, ipc_host, sizeof(struct sof_ipc_comp_host));
- hd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*hd));
+ hd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*hd));
if (hd == NULL) {
rfree(dev);
return NULL;
}
- elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem));
+ elem = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*elem));
if (elem == NULL) {
rfree(dev);
rfree(hd);
@@ -776,7 +776,7 @@ static int host_buffer(struct comp_dev *dev, struct dma_sg_elem *elem,
struct dma_sg_elem *e;
/* allocate new host DMA elem and add it to our list */
- e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e));
+ e = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*e));
if (e == NULL)
return -ENOMEM;
diff --git a/src/audio/mixer.c b/src/audio/mixer.c
index e3611d4..abc8881 100644
--- a/src/audio/mixer.c
+++ b/src/audio/mixer.c
@@ -87,7 +87,7 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp)
struct mixer_data *md;
trace_mixer("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_mixer));
if (dev == NULL)
return NULL;
@@ -95,7 +95,7 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp)
mixer = (struct sof_ipc_comp_mixer *)&dev->comp;
memcpy(mixer, ipc_mixer, sizeof(struct sof_ipc_comp_mixer));
- md = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*md));
+ md = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*md));
if (md == NULL) {
rfree(dev);
return NULL;
diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c
index 94d91b5..728b64d 100644
--- a/src/audio/pipeline.c
+++ b/src/audio/pipeline.c
@@ -240,7 +240,7 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc,
trace_pipe("new");
/* allocate new pipeline */
- p = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*p));
+ p = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*p));
if (p == NULL) {
trace_pipe_error("ePN");
return NULL;
@@ -1146,7 +1146,8 @@ int pipeline_init(void)
{
trace_pipe("PIn");
- pipe_data = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*pipe_data));
+ pipe_data = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(*pipe_data));
spinlock_init(&pipe_data->lock);
return 0;
diff --git a/src/audio/src.c b/src/audio/src.c
index d494d96..c7ac649 100644
--- a/src/audio/src.c
+++ b/src/audio/src.c
@@ -274,7 +274,7 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp)
return NULL;
}
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_src));
if (dev == NULL)
return NULL;
@@ -282,7 +282,7 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp)
src = (struct sof_ipc_comp_src *) &dev->comp;
memcpy(src, ipc_src, sizeof(struct sof_ipc_comp_src));
- cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (cd == NULL) {
rfree(dev);
return NULL;
@@ -386,7 +386,8 @@ static int src_params(struct comp_dev *dev)
if (cd->delay_lines != NULL)
rfree(cd->delay_lines);
- cd->delay_lines = rballoc(RZONE_RUNTIME, RFLAGS_NONE, delay_lines_size);
+ cd->delay_lines = rballoc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ delay_lines_size);
if (cd->delay_lines == NULL) {
trace_src_error("sr3");
trace_value(delay_lines_size);
diff --git a/src/audio/tone.c b/src/audio/tone.c
index 581f87e..5308af0 100644
--- a/src/audio/tone.c
+++ b/src/audio/tone.c
@@ -405,7 +405,7 @@ static struct comp_dev *tone_new(struct sof_ipc_comp *comp)
trace_tone("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_tone));
if (dev == NULL)
return NULL;
@@ -413,7 +413,7 @@ static struct comp_dev *tone_new(struct sof_ipc_comp *comp)
tone = (struct sof_ipc_comp_tone *) &dev->comp;
memcpy(tone, ipc_tone, sizeof(struct sof_ipc_comp_tone));
- cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (cd == NULL) {
rfree(dev);
return NULL;
diff --git a/src/audio/volume.c b/src/audio/volume.c
index 8e54607..ee9b361 100644
--- a/src/audio/volume.c
+++ b/src/audio/volume.c
@@ -364,7 +364,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
trace_volume("new");
- dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_volume));
if (dev == NULL)
return NULL;
@@ -372,7 +372,7 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
vol = (struct sof_ipc_comp_volume *)&dev->comp;
memcpy(vol, ipc_vol, sizeof(struct sof_ipc_comp_volume));
- cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd));
+ cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (cd == NULL) {
rfree(dev);
return NULL;
diff --git a/src/drivers/apl-ssp.c b/src/drivers/apl-ssp.c
index f0faba9..a726f3c 100644
--- a/src/drivers/apl-ssp.c
+++ b/src/drivers/apl-ssp.c
@@ -523,7 +523,7 @@ static int ssp_probe(struct dai *dai)
struct ssp_pdata *ssp;
/* allocate private data */
- ssp = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*ssp));
+ ssp = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*ssp));
dai_set_drvdata(dai, ssp);
spinlock_init(&ssp->lock);
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c
index be19e12..b47da0e 100644
--- a/src/drivers/dw-dma.c
+++ b/src/drivers/dw-dma.c
@@ -552,7 +552,8 @@ static int dw_dma_set_config(struct dma *dma, int channel,
/* allocate descriptors for channel */
if (p->chan[channel].lli)
rfree(p->chan[channel].lli);
- p->chan[channel].lli = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ p->chan[channel].lli = rzalloc(RZONE_RUNTIME,
+ SOF_MEM_CAPS_RAM | SOF_MEM_CAPS_DMA,
sizeof(struct dw_lli2) * p->chan[channel].desc_count);
if (p->chan[channel].lli == NULL) {
trace_dma_error("eD1");
@@ -997,7 +998,7 @@ static int dw_dma_probe(struct dma *dma)
int i;
/* allocate private data */
- dw_pdata = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*dw_pdata));
+ dw_pdata = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*dw_pdata));
dma_set_drvdata(dma, dw_pdata);
spinlock_init(&dma->lock);
@@ -1010,7 +1011,7 @@ static int dw_dma_probe(struct dma *dma)
dw_pdata->chan[i].channel = i;
dw_pdata->chan[i].status = COMP_STATE_INIT;
- dma_int[i] = rzalloc(RZONE_SYS, RFLAGS_NONE,
+ dma_int[i] = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
sizeof(struct dma_int));
dma_int[i]->dma = dma;
@@ -1150,7 +1151,8 @@ static int dw_dma_probe(struct dma *dma)
#endif
{
/* allocate private data */
- dw_pdata = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*dw_pdata));
+ dw_pdata = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(*dw_pdata));
dma_set_drvdata(dmac, dw_pdata);
spinlock_init(&dmac->lock);
diff --git a/src/drivers/hda-dma.c b/src/drivers/hda-dma.c
index 6526b74..87221a8 100644
--- a/src/drivers/hda-dma.c
+++ b/src/drivers/hda-dma.c
@@ -391,7 +391,7 @@ static int hda_dma_probe(struct dma *dma)
int i;
/* allocate private data */
- hda_pdata = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*hda_pdata));
+ hda_pdata = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*hda_pdata));
dma_set_drvdata(dma, hda_pdata);
spinlock_init(&dma->lock);
diff --git a/src/drivers/ssp.c b/src/drivers/ssp.c
index 0ed570c..4b195ec 100644
--- a/src/drivers/ssp.c
+++ b/src/drivers/ssp.c
@@ -586,7 +586,7 @@ static int ssp_probe(struct dai *dai)
struct ssp_pdata *ssp;
/* allocate private data */
- ssp = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*ssp));
+ ssp = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*ssp));
dai_set_drvdata(dai, ssp);
spinlock_init(&ssp->lock);
diff --git a/src/include/reef/alloc.h b/src/include/reef/alloc.h
index 6b61b04..a2b0c9b 100644
--- a/src/include/reef/alloc.h
+++ b/src/include/reef/alloc.h
@@ -57,12 +57,6 @@ struct reef;
#define RZONE_RUNTIME 1
#define RZONE_BUFFER 2
-/*
- * Heap allocation memory flags.
- */
-#define RFLAGS_NONE 0
-#define RFLAGS_USED 1
-
struct mm_info {
uint32_t used;
uint32_t free;
@@ -70,7 +64,7 @@ struct mm_info {
struct block_hdr {
uint16_t size; /* size in blocks for continuous allocation */
- uint16_t flags; /* usage flags for page */
+ uint16_t used; /* usage flags for page */
} __attribute__ ((packed));
struct block_map {
diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h
index dec8abd..0c34013 100644
--- a/src/include/uapi/ipc.h
+++ b/src/include/uapi/ipc.h
@@ -572,7 +572,7 @@ struct sof_ipc_comp {
struct sof_ipc_buffer {
struct sof_ipc_comp comp;
uint32_t size; /* buffer size in bytes */
- uint32_t type; /* SOF_MEM_CAPS_ */
+ uint32_t caps; /* SOF_MEM_CAPS_ */
} __attribute__((packed));
diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c
index 167423b..4b8ee6b 100644
--- a/src/ipc/apl-ipc.c
+++ b/src/ipc/apl-ipc.c
@@ -182,7 +182,8 @@ int platform_ipc_init(struct ipc *ipc)
_ipc = ipc;
/* init ipc data */
- iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data));
+ iipc = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct intel_ipc_data));
ipc_set_drvdata(_ipc, iipc);
_ipc->dsp_msg = NULL;
list_init(&ipc->empty_list);
@@ -192,7 +193,7 @@ int platform_ipc_init(struct ipc *ipc)
list_item_prepend(&ipc->message[i].list, &ipc->empty_list);
/* allocate page table buffer */
- iipc->page_table = rballoc(RZONE_SYS, RFLAGS_NONE,
+ iipc->page_table = rballoc(RZONE_SYS, SOF_MEM_CAPS_RAM,
HOST_PAGE_SIZE);
if (iipc->page_table)
bzero(iipc->page_table, HOST_PAGE_SIZE);
diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c
index 91d8f1b..3ab6319 100644
--- a/src/ipc/byt-ipc.c
+++ b/src/ipc/byt-ipc.c
@@ -208,7 +208,8 @@ int platform_ipc_init(struct ipc *ipc)
_ipc = ipc;
/* init ipc data */
- iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data));
+ iipc = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct intel_ipc_data));
ipc_set_drvdata(_ipc, iipc);
_ipc->dsp_msg = NULL;
list_init(&ipc->empty_list);
@@ -219,7 +220,7 @@ int platform_ipc_init(struct ipc *ipc)
list_item_prepend(&ipc->message[i].list, &ipc->empty_list);
/* allocate page table buffer */
- iipc->page_table = rzalloc(RZONE_SYS, RFLAGS_NONE,
+ iipc->page_table = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
PLATFORM_PAGE_TABLE_SIZE);
if (iipc->page_table)
bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c
index 0fcc5be..15687fc 100644
--- a/src/ipc/cnl-ipc.c
+++ b/src/ipc/cnl-ipc.c
@@ -182,7 +182,8 @@ int platform_ipc_init(struct ipc *ipc)
_ipc = ipc;
/* init ipc data */
- iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data));
+ iipc = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct intel_ipc_data));
ipc_set_drvdata(_ipc, iipc);
_ipc->dsp_msg = NULL;
list_init(&ipc->empty_list);
@@ -192,7 +193,7 @@ int platform_ipc_init(struct ipc *ipc)
list_item_prepend(&ipc->message[i].list, &ipc->empty_list);
/* allocate page table buffer */
- iipc->page_table = rballoc(RZONE_SYS, RFLAGS_NONE,
+ iipc->page_table = rballoc(RZONE_SYS, SOF_MEM_CAPS_RAM,
HOST_PAGE_SIZE);
if (iipc->page_table)
bzero(iipc->page_table, HOST_PAGE_SIZE);
diff --git a/src/ipc/hsw-ipc.c b/src/ipc/hsw-ipc.c
index 5f350c1..5bfdf93 100644
--- a/src/ipc/hsw-ipc.c
+++ b/src/ipc/hsw-ipc.c
@@ -208,7 +208,8 @@ int platform_ipc_init(struct ipc *ipc)
_ipc = ipc;
/* init ipc data */
- iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data));
+ iipc = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct intel_ipc_data));
ipc_set_drvdata(_ipc, iipc);
_ipc->dsp_msg = NULL;
list_init(&ipc->empty_list);
@@ -219,7 +220,7 @@ int platform_ipc_init(struct ipc *ipc)
list_item_prepend(&ipc->message[i].list, &ipc->empty_list);
/* allocate page table buffer */
- iipc->page_table = rzalloc(RZONE_SYS, RFLAGS_NONE,
+ iipc->page_table = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
PLATFORM_PAGE_TABLE_SIZE);
if (iipc->page_table)
bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c
index b753efd..4aebfb7 100644
--- a/src/ipc/ipc.c
+++ b/src/ipc/ipc.c
@@ -99,7 +99,8 @@ int ipc_comp_new(struct ipc *ipc, struct sof_ipc_comp *comp)
}
/* allocate the IPC component container */
- icd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct ipc_comp_dev));
+ icd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(struct ipc_comp_dev));
if (icd == NULL) {
trace_ipc_error("eCm");
rfree(cd);
@@ -152,7 +153,8 @@ int ipc_buffer_new(struct ipc *ipc, struct sof_ipc_buffer *desc)
return -ENOMEM;
}
- ibd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct ipc_comp_dev));
+ ibd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(struct ipc_comp_dev));
if (ibd == NULL) {
rfree(buffer);
return -ENOMEM;
@@ -256,7 +258,7 @@ int ipc_pipeline_new(struct ipc *ipc,
}
/* allocate the IPC pipeline container */
- ipc_pipe = rzalloc(RZONE_RUNTIME, RFLAGS_NONE,
+ ipc_pipe = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
sizeof(struct ipc_comp_dev));
if (ipc_pipe == NULL) {
pipeline_free(pipe);
@@ -348,8 +350,9 @@ int ipc_init(struct reef *reef)
trace_ipc("IPI");
/* 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 = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*reef->ipc));
+ reef->ipc->comp_data = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ SOF_IPC_MSG_MAX_SIZE);
reef->ipc->dmat = reef->dmat;
list_init(&reef->ipc->comp_list);
diff --git a/src/ipc/pmc-ipc.c b/src/ipc/pmc-ipc.c
index fdb8d4b..b99e368 100644
--- a/src/ipc/pmc-ipc.c
+++ b/src/ipc/pmc-ipc.c
@@ -168,7 +168,8 @@ int platform_ipc_pmc_init(void)
uint32_t imrlpesc;
/* init ipc data */
- _pmc = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_pmc_data));
+ _pmc = rmalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct intel_ipc_pmc_data));
/* configure interrupt */
interrupt_register(IRQ_NUM_EXT_PMC, irq_handler, NULL);
diff --git a/src/lib/agent.c b/src/lib/agent.c
index 0a1ad42..2c61cb1 100644
--- a/src/lib/agent.c
+++ b/src/lib/agent.c
@@ -83,7 +83,7 @@ void sa_init(struct reef *reef)
trace_sa("ini");
- sa = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*sa));
+ sa = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*sa));
reef->sa = sa;
/* set default tick timout */
diff --git a/src/lib/alloc.c b/src/lib/alloc.c
index bbc32a3..6221d26 100644
--- a/src/lib/alloc.c
+++ b/src/lib/alloc.c
@@ -132,7 +132,7 @@ static void *alloc_block(struct mm_heap *heap, int level,
map->free_count--;
ptr = (void *)(map->base + map->first_free * map->block_size);
hdr->size = 1;
- hdr->flags = RFLAGS_USED;
+ hdr->used = 1;
heap->info.used += map->block_size;
heap->info.free -= map->block_size;
@@ -141,7 +141,7 @@ static void *alloc_block(struct mm_heap *heap, int level,
hdr = &map->block[i];
- if (hdr->flags == 0) {
+ if (hdr->used == 0) {
map->first_free = i;
break;
}
@@ -180,7 +180,7 @@ static void *alloc_cont_blocks(struct mm_heap *heap, int level,
hdr = &map->block[current];
/* is block used */
- if (hdr->flags == RFLAGS_USED)
+ if (hdr->used)
break;
}
@@ -205,7 +205,7 @@ found:
/* allocate each block */
for (current = start; current < end; current++) {
hdr = &map->block[current];
- hdr->flags = RFLAGS_USED;
+ hdr->used = 1;
}
/* do we need to find a new first free block ? */
@@ -216,7 +216,7 @@ found:
hdr = &map->block[i];
- if (hdr->flags == 0) {
+ if (hdr->used == 0) {
map->first_free = i;
break;
}
@@ -330,7 +330,7 @@ found:
for (i = block; i < block + hdr->size; i++) {
hdr = &block_map->block[i];
hdr->size = 0;
- hdr->flags = 0;
+ hdr->used = 0;
block_map->free_count++;
heap->info.used -= block_map->block_size;
heap->info.free += block_map->block_size;
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c
index c72c55b..211f34f 100644
--- a/src/lib/dma-trace.c
+++ b/src/lib/dma-trace.c
@@ -128,11 +128,12 @@ int dma_trace_init_early(struct reef *reef)
{
struct dma_trace_buf *buffer;
- trace_data = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*trace_data));
+ trace_data = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*trace_data));
buffer = &trace_data->dmatb;
/* allocate new buffer */
- buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, DMA_TRACE_LOCAL_SIZE);
+ buffer->addr = rballoc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ DMA_TRACE_LOCAL_SIZE);
if (buffer->addr == NULL) {
trace_buffer_error("ebm");
return -ENOMEM;
@@ -179,7 +180,7 @@ int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem,
struct dma_sg_elem *e;
/* allocate new host DMA elem and add it to our list */
- e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e));
+ e = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*e));
if (e == NULL)
return -ENOMEM;
diff --git a/src/lib/interrupt.c b/src/lib/interrupt.c
index 4516cf3..32b6235 100644
--- a/src/lib/interrupt.c
+++ b/src/lib/interrupt.c
@@ -56,7 +56,8 @@ int irq_register_child(struct irq_parent *parent, int irq,
/* init child */
parent->child[REEF_IRQ_BIT(irq)] =
- rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct irq_child));
+ rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM,
+ sizeof(struct irq_child));
parent->child[REEF_IRQ_BIT(irq)]->enabled = 0;
parent->child[REEF_IRQ_BIT(irq)]->handler = handler;
parent->child[REEF_IRQ_BIT(irq)]->handler_arg = arg;
diff --git a/src/lib/schedule.c b/src/lib/schedule.c
index bfbb1b9..7728419 100644
--- a/src/lib/schedule.c
+++ b/src/lib/schedule.c
@@ -372,7 +372,7 @@ int scheduler_init(struct reef *reef)
{
trace_pipe("ScI");
- sch = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*sch));
+ sch = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*sch));
list_init(&sch->list);
spinlock_init(&sch->lock);
sch->clock = PLATFORM_SCHED_CLOCK;
diff --git a/src/lib/work.c b/src/lib/work.c
index 18d743c..eb7b223 100644
--- a/src/lib/work.c
+++ b/src/lib/work.c
@@ -444,7 +444,7 @@ struct work_queue *work_new_queue(struct work_queue_timesource *ts)
struct work_queue *queue;
/* init work queue */
- queue = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*queue_));
+ queue = rmalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*queue_));
list_init(&queue->work);
spinlock_init(&queue->lock);
diff --git a/src/platform/apollolake/clk.c b/src/platform/apollolake/clk.c
index 72d2e9f..32d3236 100644
--- a/src/platform/apollolake/clk.c
+++ b/src/platform/apollolake/clk.c
@@ -197,7 +197,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 = rmalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock);
spinlock_init(&clk_pdata->clk[1].lock);
diff --git a/src/platform/baytrail/clk.c b/src/platform/baytrail/clk.c
index 99e1bfd..fc1cd9d 100644
--- a/src/platform/baytrail/clk.c
+++ b/src/platform/baytrail/clk.c
@@ -260,7 +260,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 = rmalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock);
spinlock_init(&clk_pdata->clk[1].lock);
diff --git a/src/platform/cannonlake/clk.c b/src/platform/cannonlake/clk.c
index dcfe4b3..f27e691 100644
--- a/src/platform/cannonlake/clk.c
+++ b/src/platform/cannonlake/clk.c
@@ -191,7 +191,8 @@ uint64_t clock_time_elapsed(int clock, uint64_t previous, uint64_t *current)
void init_platform_clocks(void)
{
- clk_pdata = rmalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*clk_pdata));
+ clk_pdata = rmalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
+ sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock);
spinlock_init(&clk_pdata->clk[1].lock);
diff --git a/src/platform/haswell/clk.c b/src/platform/haswell/clk.c
index 76d18d1..8a724a8 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 = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*clk_pdata));
+ clk_pdata = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock);
spinlock_init(&clk_pdata->clk[1].lock);
--
2.14.1
More information about the Sound-open-firmware
mailing list