[Sound-open-firmware] [PATCH] build: fix generation of commit ID and build number
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- .gitignore | 2 ++ Makefile.am | 5 ++++- configure.ac | 2 +- git-version.sh | 16 ++++++++++++++-- src/ipc/intel-ipc.c | 3 +-- 5 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/.gitignore b/.gitignore index 9223f60..c8a8ab0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ *.man .version .tarball-version +*.x +.build
Makefile Makefile.in diff --git a/Makefile.am b/Makefile.am index c47580e..362e2bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,13 @@ export PLATFORM_INCDIR = \
BUILT_SOURCES = $(top_srcdir)/src/include/version.h
-$(top_srcdir)/src/include/version.h: +$(top_srcdir)/src/include/version.h: Makefile ./git-version.sh
dist-hook: ./git-version.sh cat .version > $(distdir)/.tarball-version cat .version > $(distdir)/.version + +all-local: + rm -f $(top_srcdir)/src/include/version.h diff --git a/configure.ac b/configure.ac index 7c1acf4..f085a73 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@
AC_PREREQ([2.69]) -AC_INIT([Reef],[m4_esyscmd(./git-version.sh)],[sound-open-firmware@alsa-project.org]) +AC_INIT([Reef],[m4_esyscmd(./git-version.sh), m4_esyscmd(rm -f .build)],[sound-open-firmware@alsa-project.org]) AC_CONFIG_SRCDIR([src/init/init.c]) AC_CONFIG_HEADERS([src/include/config.h]) AC_CONFIG_MACRO_DIRS([m4]) diff --git a/git-version.sh b/git-version.sh index f8f1e58..c6beb40 100755 --- a/git-version.sh +++ b/git-version.sh @@ -1,10 +1,22 @@
# version for configure -echo -n `git describe --abbrev=4` +# echo -n `git describe --abbrev=4`
# version for make dist git describe --abbrev=4 > .version git describe --abbrev=4 > .tarball-version
# git commit for IPC -echo "#define REEF_BUILD "`git describe --abbrev=4 | cut -d- -f3`"" > src/include/version.h +echo "#define REEF_TAG "`git describe --abbrev=4 | cut -d- -f3`"" > src/include/version.h + +# build counter +if [ -e .build ]; then + num=$((`cat .build` + 1)) +else + num=0 +fi + +# save and insert build counter +echo $num > .build +echo "#define REEF_BUILD $num" >> src/include/version.h + diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 7db4179..e0ab4f7 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -120,11 +120,10 @@ static inline uint32_t msg_get_stage_type(uint32_t msg)
/* TODO: add build count */ static const struct ipc_intel_ipc_fw_version fw_version = { - .build = 0, + .build = REEF_BUILD, .minor = REEF_MINOR, .major = REEF_MAJOR, .type = 0, - .fw_build_hash = REEF_BUILD, .fw_log_providers_hash = 0, };
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- build-all.sh | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/build-all.sh b/build-all.sh index 38d894b..83b0aa8 100755 --- a/build-all.sh +++ b/build-all.sh @@ -1,3 +1,9 @@ +# fail on any errors +set -e + +# run autogen.sh +./autogen.sh + # build all images for all targets. pwd=`pwd`
The allocator currently has different methods to allocate heap memory depending on memory size requested. The heap also has to be defined in two places atm i.e in memory.h and baytrail.x
This patch aligns the heap macros with the linker script and introduces new flags to specify the allocation type.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/Makefile.am | 12 + src/audio/component.c | 2 +- src/audio/dai.c | 24 +- src/audio/host.c | 34 +-- src/audio/mixer.c | 10 +- src/audio/pipeline.c | 22 +- src/audio/volume.c | 10 +- src/drivers/dw-dma.c | 8 +- src/drivers/ssp.c | 2 +- src/include/reef/alloc.h | 34 ++- src/ipc/byt-ipc.c | 4 +- src/ipc/ipc.c | 18 +- src/ipc/pmc-ipc.c | 2 +- src/lib/alloc.c | 261 +++++++++--------- src/lib/work.c | 2 +- .../baytrail/{baytrail.x => baytrail.x.in} | 305 +++++++++++++-------- src/platform/baytrail/clk.c | 2 +- src/platform/baytrail/include/platform/memory.h | 100 +++++-- 18 files changed, 494 insertions(+), 358 deletions(-) rename src/platform/baytrail/{baytrail.x => baytrail.x.in} (55%)
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index fb48280..2a4c5ce 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -3,6 +3,18 @@ SUBDIRS = hal xtos include bin_PROGRAMS = \ reef
+# generate linker script from platform headers +LINK_SCRIPT = ../../platform/$(PLATFORM)/$(PLATFORM_LDSCRIPT) +LINK_DEPS = \ + ../../platform/$(PLATFORM)/include/platform/memory.h \ + ../../platform/$(PLATFORM)/include/xtensa/config/core-isa* + +nodist_reef_SOURCES = $(LINK_SCRIPT).in +BUILT_SOURCES = $(LINK_SCRIPT) +CLEANFILES = $(LINK_SCRIPT) +$(LINK_SCRIPT): Makefile $(LINK_SCRIPT).in $(LINK_DEPS) + cat $(LINK_SCRIPT).in | $(CPP) -P $(PLATFORM_INCDIR) $(REEF_INCDIR) - >$@ + noinst_LIBRARIES = \ libreset.a
diff --git a/src/audio/component.c b/src/audio/component.c index e241f03..7c9387c 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -105,7 +105,7 @@ void comp_unregister(struct comp_driver *drv)
void sys_comp_init(void) { - cd = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(*cd)); + cd = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*cd)); list_init(&cd->list); spinlock_init(&cd->lock); } diff --git a/src/audio/dai.c b/src/audio/dai.c index 75f9acf..028c71f 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -175,13 +175,13 @@ static struct comp_dev *dai_new_ssp(uint32_t type, uint32_t index, struct comp_dev *dev; struct dai_data *dd;
- dev = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*dev)); + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev)); if (dev == NULL) return NULL;
- dd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*dd)); + dd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dd)); if (dd == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dev); return NULL; }
@@ -214,8 +214,8 @@ static struct comp_dev *dai_new_ssp(uint32_t type, uint32_t index, return dev;
error: - rfree(RZONE_MODULE, RMOD_SYS, dd); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dd); + rfree(dev); return NULL; }
@@ -231,8 +231,8 @@ static void dai_free(struct comp_dev *dev)
dma_channel_put(dd->dma, dd->chan);
- rfree(RZONE_MODULE, RMOD_SYS, dd); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dd); + rfree(dev); }
/* set component audio SSP and DMA configuration */ @@ -269,7 +269,7 @@ static int dai_playback_params(struct comp_dev *dev, /* set up cyclic list of DMA elems */ for (i = 0; i < dma_period_desc->number; i++) {
- elem = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*elem)); + elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem)); if (elem == NULL) goto err_unwind;
@@ -292,7 +292,7 @@ err_unwind: list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); list_item_del(&elem->list); - rfree(RZONE_MODULE, RMOD_SYS, elem); + rfree(elem); } return -ENOMEM; } @@ -330,7 +330,7 @@ static int dai_capture_params(struct comp_dev *dev, /* set up cyclic list of DMA elems */ for (i = 0; i < dma_period_desc->number; i++) {
- elem = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*elem)); + elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem)); if (elem == NULL) goto err_unwind;
@@ -351,7 +351,7 @@ err_unwind: list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); list_item_del(&elem->list); - rfree(RZONE_MODULE, RMOD_SYS, elem); + rfree(elem); } return -ENOMEM; } @@ -406,7 +406,7 @@ static int dai_reset(struct comp_dev *dev) list_for_item_safe(elist, tlist, &config->elem_list) { elem = container_of(elist, struct dma_sg_elem, list); list_item_del(&elem->list); - rfree(RZONE_MODULE, RMOD_SYS, elem); + rfree(elem); }
dev->state = COMP_STATE_INIT; diff --git a/src/audio/host.c b/src/audio/host.c index 3dba01d..3ecd1f3 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -222,20 +222,20 @@ static struct comp_dev *host_new(uint32_t type, uint32_t index, struct host_data *hd; struct dma_sg_elem *elem;
- dev = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*dev)); + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev)); if (dev == NULL) return NULL;
- hd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*hd)); + hd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*hd)); if (hd == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dev); return NULL; }
- elem = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*elem)); + elem = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*elem)); if (elem == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, dev); - rfree(RZONE_MODULE, RMOD_SYS, hd); + rfree(dev); + rfree(hd); return NULL; }
@@ -262,9 +262,9 @@ static struct comp_dev *host_new(uint32_t type, uint32_t index, return dev;
error: - rfree(RZONE_MODULE, RMOD_SYS, elem); - rfree(RZONE_MODULE, RMOD_SYS, hd); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(elem); + rfree(hd); + rfree(dev); return NULL; }
@@ -277,9 +277,9 @@ static void host_free(struct comp_dev *dev) struct dma_sg_elem, list); dma_channel_put(hd->dma, hd->chan);
- rfree(RZONE_MODULE, RMOD_SYS, elem); - rfree(RZONE_MODULE, RMOD_SYS, hd); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(elem); + rfree(hd); + rfree(dev); }
static int create_local_elems(struct comp_dev *dev, @@ -292,7 +292,7 @@ static int create_local_elems(struct comp_dev *dev,
for (i = 0; i < hd->period->number; i++) { /* allocate new host DMA elem and add it to our list */ - e = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*e)); + e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e)); if (e == NULL) goto unwind;
@@ -315,7 +315,7 @@ unwind:
e = container_of(elist, struct dma_sg_elem, list); list_item_del(&e->list); - rfree(RZONE_MODULE, RMOD_SYS, e); + rfree(e); } return -ENOMEM; } @@ -560,7 +560,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_MODULE, RMOD_SYS, sizeof(*e)); + e = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*e)); if (e == NULL) return -ENOMEM;
@@ -582,7 +582,7 @@ static int host_reset(struct comp_dev *dev)
e = container_of(elist, struct dma_sg_elem, list); list_item_del(&e->list); - rfree(RZONE_MODULE, RMOD_SYS, e); + rfree(e); }
/* free all local DMA elements */ @@ -590,7 +590,7 @@ static int host_reset(struct comp_dev *dev)
e = container_of(elist, struct dma_sg_elem, list); list_item_del(&e->list); - rfree(RZONE_MODULE, RMOD_SYS, e); + rfree(e); }
host_pointer_reset(dev); diff --git a/src/audio/mixer.c b/src/audio/mixer.c index 740ccaf..fbaf559 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -88,13 +88,13 @@ static struct comp_dev *mixer_new(uint32_t type, uint32_t index, struct mixer_data *md;
trace_mixer("MNw"); - dev = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*dev)); + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev)); if (dev == NULL) return NULL;
- md = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*md)); + md = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*md)); if (md == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dev); return NULL; }
@@ -109,8 +109,8 @@ static void mixer_free(struct comp_dev *dev) { struct mixer_data *md = comp_get_drvdata(dev);
- rfree(RZONE_MODULE, RMOD_SYS, md); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(md); + rfree(dev); }
/* set component audio stream paramters */ diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 5c03659..9d31460 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -128,7 +128,7 @@ struct pipeline *pipeline_new(uint32_t id)
trace_pipe("PNw");
- p = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*p)); + p = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*p)); if (p == NULL) { trace_pipe_error("ePN"); return NULL; @@ -172,15 +172,13 @@ void pipeline_free(struct pipeline *p) struct comp_buffer *buffer;
buffer = container_of(clist, struct comp_buffer, pipeline_list); - rfree(RZONE_MODULE, RMOD(buffer->source->drv->module_id), - buffer->addr); - rfree(RZONE_MODULE, RMOD(buffer->source->drv->module_id), - buffer); + rfree(buffer->addr); + rfree(buffer); }
/* now free the pipeline */ list_item_del(&p->list); - rfree(RZONE_MODULE, RMOD_SYS, p); + rfree(p); spin_unlock(&pipe_data->lock); }
@@ -239,15 +237,15 @@ struct comp_buffer *pipeline_buffer_new(struct pipeline *p, trace_pipe("BNw");
/* allocate buffer */ - buffer = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*buffer)); + buffer = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*buffer)); if (buffer == NULL) { trace_pipe_error("eBm"); return NULL; }
- buffer->addr = rballoc(RZONE_MODULE, RMOD_SYS, desc->size); + buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, desc->size); if (buffer->addr == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, buffer); + rfree(buffer); trace_pipe_error("ebm"); return NULL; } @@ -274,8 +272,8 @@ int pipeline_buffer_free(struct pipeline *p, struct comp_buffer *buffer)
spin_lock(&p->lock); list_item_del(&buffer->pipeline_list); - rfree(RZONE_MODULE, RMOD_SYS, buffer->addr); - rfree(RZONE_MODULE, RMOD_SYS, buffer); + rfree(buffer->addr); + rfree(buffer); spin_unlock(&p->lock); return 0; } @@ -805,7 +803,7 @@ int pipeline_init(void) { trace_pipe("PIn");
- pipe_data = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(*pipe_data)); + pipe_data = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*pipe_data)); list_init(&pipe_data->pipeline_list); list_init(&pipe_data->schedule_list); pipe_data->next_id = 0; diff --git a/src/audio/volume.c b/src/audio/volume.c index bdaf87f..94d4487 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -306,13 +306,13 @@ static struct comp_dev *volume_new(uint32_t type, uint32_t index, struct comp_data *cd; int i;
- dev = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*dev)); + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*dev)); if (dev == NULL) return NULL;
- cd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*cd)); + cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd)); if (cd == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(dev); return NULL; }
@@ -334,8 +334,8 @@ static void volume_free(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev);
- rfree(RZONE_MODULE, RMOD_SYS, cd); - rfree(RZONE_MODULE, RMOD_SYS, dev); + rfree(cd); + rfree(dev); }
/* set component audio stream paramters */ diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index 43ba230..16f59d1 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -284,7 +284,7 @@ static void dw_dma_channel_put_unlocked(struct dma *dma, int channel)
/* free the lli allocated by set_config*/ if (p->chan[channel].lli) { - rfree(RZONE_MODULE, RMOD_SYS, p->chan[channel].lli); + rfree(p->chan[channel].lli); p->chan[channel].lli = NULL; }
@@ -587,8 +587,8 @@ static int dw_dma_set_config(struct dma *dma, int channel,
/* allocate descriptors for channel */ if (p->chan[channel].lli) - rfree(RZONE_MODULE, RMOD_SYS, p->chan[channel].lli); - p->chan[channel].lli = rzalloc(RZONE_MODULE, RMOD_SYS, + rfree(p->chan[channel].lli); + p->chan[channel].lli = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct dw_lli2) * p->chan[channel].desc_count); if (p->chan[channel].lli == NULL) { trace_dma_error("eDm"); @@ -903,7 +903,7 @@ static int dw_dma_probe(struct dma *dma) int i;
/* allocate private data */ - dw_pdata = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(*dw_pdata)); + dw_pdata = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*dw_pdata)); dma_set_drvdata(dma, dw_pdata);
spinlock_init(&dma->lock); diff --git a/src/drivers/ssp.c b/src/drivers/ssp.c index 946c0c5..6ef5e26 100644 --- a/src/drivers/ssp.c +++ b/src/drivers/ssp.c @@ -488,7 +488,7 @@ static int ssp_probe(struct dai *dai) struct ssp_pdata *ssp;
/* allocate private data */ - ssp = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(*ssp)); + ssp = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*ssp)); dai_set_drvdata(dai, ssp);
work_init(&ssp->work, ssp_drain_work, dai, WORK_ASYNC); diff --git a/src/include/reef/alloc.h b/src/include/reef/alloc.h index 23fe0d3..209203f 100644 --- a/src/include/reef/alloc.h +++ b/src/include/reef/alloc.h @@ -38,22 +38,30 @@
/* Heap Memory Zones * - * The heap has two different zones from where memory can be allocated :- + * The heap has three different zones from where memory can be allocated :- * - * 1) Device Zone. Fixed size heap where alloc always succeeds and is never + * 1) System Zone. Fixed size heap where alloc always succeeds and is never * freed. Used by any init code that will never give up the memory. * - * 2) Module Zone. Main and larger heap zone where allocs are not guaranteed to + * 2) Runtime Zone. Main and larger heap zone where allocs are not guaranteed to * succeed. Memory can be freed here. * + * 3) Buffer Zone. Largest heap zone intended for audio buffers. + * * See platform/memory.h for heap size configuration and mappings. */ -#define RZONE_DEV 0 -#define RZONE_MODULE 1 +#define RZONE_SYS 0 +#define RZONE_RUNTIME 1 +#define RZONE_BUFFER 2
-/* Modules identifier used for tracking memory resource ownership */ -#define RMOD_SYS 0 /* system module is owner */ -#define RMOD(m) (m + 16) /* owned by other modules */ +/* + * Heap allocation memory flags. + */ +#define RFLAGS_NONE 0 +#define RFLAGS_USED 1 +#define RFLAGS_ATOMIC 2 /* allocation with IRQs off */ +#define RFLAGS_DMA 4 /* DMA-able memory */ +#define RFLAGS_POWER 8 /* low power memory */
struct mm_info { uint32_t used; @@ -61,13 +69,13 @@ struct mm_info { };
/* heap allocation and free */ -void *rmalloc(int zone, int module, size_t bytes); -void *rzalloc(int zone, int module, size_t bytes); -void rfree(int zone, int module, void *ptr); +void *rmalloc(int zone, int flags, size_t bytes); +void *rzalloc(int zone, int flags, size_t bytes); +void rfree(void *ptr);
/* heap allocation and free for buffers on 1k boundary */ -void *rballoc(int zone, int module, size_t bytes); -void rbfree(int zone, int module, void *ptr); +void *rballoc(int zone, int flags, size_t bytes); +void rbfree(void *ptr);
/* utility */ void bzero(void *s, size_t n); diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c index b1bec23..f36eddb 100644 --- a/src/ipc/byt-ipc.c +++ b/src/ipc/byt-ipc.c @@ -187,7 +187,7 @@ int platform_ipc_init(struct ipc *ipc) _ipc = ipc;
/* init ipc data */ - iipc = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(struct intel_ipc_data)); + iipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_data)); ipc_set_drvdata(_ipc, iipc); _ipc->dsp_msg = NULL; list_init(&ipc->empty_list); @@ -197,7 +197,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_DEV, RMOD_SYS, + iipc->page_table = rballoc(RZONE_SYS, RFLAGS_NONE, IPC_INTEL_PAGE_TABLE_SIZE); if (iipc->page_table) bzero(iipc->page_table, IPC_INTEL_PAGE_TABLE_SIZE); diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c index a582f60..edf3f58 100644 --- a/src/ipc/ipc.c +++ b/src/ipc/ipc.c @@ -92,13 +92,13 @@ int ipc_comp_new(int pipeline_id, uint32_t type, uint32_t index, switch (type) { case COMP_TYPE_DAI_SSP: case COMP_TYPE_DAI_HDA: - icd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(struct ipc_dai_dev)); + icd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct ipc_dai_dev)); break; case COMP_TYPE_HOST: - icd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(struct ipc_pcm_dev)); + icd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct ipc_pcm_dev)); break; default: - icd = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(*icd)); + icd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*icd)); break; } if (icd == NULL) @@ -107,7 +107,7 @@ int ipc_comp_new(int pipeline_id, uint32_t type, uint32_t index, /* register component with piepline */ icd->cd = pipeline_comp_new(p, type, index, direction); if (icd->cd == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, icd); + rfree(icd); return -ENOMEM; }
@@ -128,7 +128,7 @@ void ipc_comp_free(uint32_t comp_id)
pipeline_comp_free(icd->p, icd->cd); list_item_del(&icd->list); - rfree(RZONE_MODULE, RMOD_SYS, icd); + rfree(icd); }
int ipc_buffer_new(int pipeline_id, struct buffer_desc *desc) @@ -139,14 +139,14 @@ int ipc_buffer_new(int pipeline_id, struct buffer_desc *desc) if (p == NULL) return -EINVAL;
- icb = rzalloc(RZONE_MODULE, RMOD_SYS, sizeof(struct ipc_buffer_dev)); + icb = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(struct ipc_buffer_dev)); if (icb == NULL) return -ENOMEM;
/* register buffer with piepline */ icb->cb = pipeline_buffer_new(p, desc); if (icb->cb == NULL) { - rfree(RZONE_MODULE, RMOD_SYS, icb); + rfree(icb); return -ENOMEM; }
@@ -167,7 +167,7 @@ void ipc_buffer_free(uint32_t comp_id)
pipeline_buffer_free(icb->dev.p, icb->dev.cb); list_item_del(&icb->dev.list); - rfree(RZONE_MODULE, RMOD_SYS, icb); + rfree(icb); }
int ipc_comp_connect(uint32_t source_id, uint32_t sink_id, uint32_t buffer_id) @@ -191,7 +191,7 @@ int ipc_comp_connect(uint32_t source_id, uint32_t sink_id, uint32_t buffer_id) int ipc_init(void) { /* init ipc data */ - _ipc = rzalloc(RZONE_DEV, RMOD_SYS, sizeof(*_ipc)); + _ipc = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*_ipc)); list_init(&_ipc->comp_list); list_init(&_ipc->buffer_list); _ipc->host_pending = 0; diff --git a/src/ipc/pmc-ipc.c b/src/ipc/pmc-ipc.c index 4da7abb..a5aecdd 100644 --- a/src/ipc/pmc-ipc.c +++ b/src/ipc/pmc-ipc.c @@ -165,7 +165,7 @@ int platform_ipc_pmc_init(void) uint32_t imrlpesc;
/* init ipc data */ - _pmc = rmalloc(RZONE_DEV, RMOD_SYS, sizeof(struct intel_ipc_pmc_data)); + _pmc = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(struct intel_ipc_pmc_data));
/* configure interrupt */ interrupt_register(IRQ_NUM_EXT_PMC, irq_handler, NULL); diff --git a/src/lib/alloc.c b/src/lib/alloc.c index 39d85fe..b77fbf8 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -54,27 +54,21 @@
#define trace_mem_error(__e) trace_error(TRACE_CLASS_MEM, __e)
-/* block status */ -#define BLOCK_FREE 0 -#define BLOCK_USED 1 - /* We have 3 memory pools * * 1) System memory pool does not have a map and it's size is fixed at build * time. Memory cannot be freed from this pool. Used by device drivers * and any system core. Saved as part of PM context. - * 2) Module memory pool has variable size allocation map and memory is freed - * on module or calls to rfree(). Saved as part of PM context. Global size + * 2) Runtime memory pool has variable size allocation map and memory is freed + * on calls to rfree(). Saved as part of PM context. Global size * set at build time. * 3) Buffer memory pool has fixed size allocation map and can be freed on * module removal or calls to rfree(). Saved as part of PM context. */
struct block_hdr { - uint8_t module; /* module that owns this page */ - uint8_t size; /* size in blocks of this continious allocation */ - uint8_t flags; /* usage flags for page */ - uint8_t instance; /* module instance ID */ + uint16_t size; /* size in blocks of this continuous allocation */ + uint16_t flags; /* usage flags for page */ } __attribute__ ((packed));
struct block_map { @@ -90,82 +84,96 @@ struct block_map { {.block_size = sz, .count = cnt, .free_count = cnt, .block = hdr}
/* Heap blocks for modules */ -//static struct block_hdr mod_block8[HEAP_MOD_COUNT8]; -static struct block_hdr mod_block16[HEAP_MOD_COUNT16]; -static struct block_hdr mod_block32[HEAP_MOD_COUNT32]; -static struct block_hdr mod_block64[HEAP_MOD_COUNT64]; -static struct block_hdr mod_block128[HEAP_MOD_COUNT128]; -static struct block_hdr mod_block256[HEAP_MOD_COUNT256]; -static struct block_hdr mod_block512[HEAP_MOD_COUNT512]; -static struct block_hdr mod_block1024[HEAP_MOD_COUNT1024]; +//static struct block_hdr mod_block8[HEAP_RT_COUNT8]; +static struct block_hdr mod_block16[HEAP_RT_COUNT16]; +static struct block_hdr mod_block32[HEAP_RT_COUNT32]; +static struct block_hdr mod_block64[HEAP_RT_COUNT64]; +static struct block_hdr mod_block128[HEAP_RT_COUNT128]; +static struct block_hdr mod_block256[HEAP_RT_COUNT256]; +static struct block_hdr mod_block512[HEAP_RT_COUNT512]; +static struct block_hdr mod_block1024[HEAP_RT_COUNT1024];
/* Heap memory map for modules */ -static struct block_map mod_heap_map[] = { -/* BLOCK_DEF(8, HEAP_MOD_COUNT8, mod_block8), */ - BLOCK_DEF(16, HEAP_MOD_COUNT16, mod_block16), - BLOCK_DEF(32, HEAP_MOD_COUNT32, mod_block32), - BLOCK_DEF(64, HEAP_MOD_COUNT64, mod_block64), - BLOCK_DEF(128, HEAP_MOD_COUNT128, mod_block128), - BLOCK_DEF(256, HEAP_MOD_COUNT256, mod_block256), - BLOCK_DEF(512, HEAP_MOD_COUNT512, mod_block512), - BLOCK_DEF(1024, HEAP_MOD_COUNT1024, mod_block1024), +static struct block_map rt_heap_map[] = { +/* BLOCK_DEF(8, HEAP_RT_COUNT8, mod_block8), */ + BLOCK_DEF(16, HEAP_RT_COUNT16, mod_block16), + BLOCK_DEF(32, HEAP_RT_COUNT32, mod_block32), + BLOCK_DEF(64, HEAP_RT_COUNT64, mod_block64), + BLOCK_DEF(128, HEAP_RT_COUNT128, mod_block128), + BLOCK_DEF(256, HEAP_RT_COUNT256, mod_block256), + BLOCK_DEF(512, HEAP_RT_COUNT512, mod_block512), + BLOCK_DEF(1024, HEAP_RT_COUNT1024, mod_block1024), };
/* Heap blocks for buffers */ -static struct block_hdr buf_block1024[HEAP_BUF_COUNT]; +static struct block_hdr buf_block[HEAP_BUFFER_COUNT];
/* Heap memory map for buffers */ static struct block_map buf_heap_map[] = { - BLOCK_DEF(1024, HEAP_BUF_COUNT, buf_block1024), + BLOCK_DEF(HEAP_BUFFER_BLOCK_SIZE, HEAP_BUFFER_COUNT, buf_block), };
-/* memory heap start locations from linker */ -extern uint32_t _system_heap; -extern uint32_t _module_heap; -extern uint32_t _buffer_heap; -extern uint32_t _stack_sentry; +#if (HEAP_DMA_BUFFER_SIZE > 0) +/* Heap memory map for DMA buffers - only used for HW with special DMA memories */ +static struct block_map dma_buf_heap_map[] = { + BLOCK_DEF(HEAP_DMA_BUFFER_BLOCK_SIZE, HEAP_DMA_BUFFER_COUNT, buf_block), +}; +#endif
struct mm_heap { uint32_t blocks; struct block_map *map; uint32_t heap; - uint32_t heap_end; + uint32_t size; struct mm_info info; };
/* heap block memory map */ struct mm { - - struct mm_heap module; /* general heap for components */ - struct mm_heap system; /* general component buffer heap */ - struct mm_heap buffer; /* system heap - used during init cannot be freed */ + struct mm_heap runtime; /* general heap for components */ + struct mm_heap system; /* system heap - used during init cannot be freed */ + struct mm_heap buffer; /* general component buffer heap */ +#if (HEAP_DMA_BUFFER_SIZE > 0) + struct mm_heap dma; /* general component DMA buffer heap */ +#endif struct mm_info total; spinlock_t lock; /* all allocs and frees are atomic */ };
struct mm memmap = { .system = { - .heap = (uint32_t)&_system_heap, - .heap_end = (uint32_t)&_module_heap, - .info = {.free = SYSTEM_MEM,}, + .heap = HEAP_SYSTEM_BASE, + .size = HEAP_SYSTEM_SIZE, + .info = {.free = HEAP_SYSTEM_SIZE,}, },
- .module = { - .blocks = ARRAY_SIZE(mod_heap_map), - .map = mod_heap_map, - .heap = (uint32_t)&_module_heap, - .heap_end = (uint32_t)&_buffer_heap, - .info = {.free = HEAP_MOD_SIZE,}, + .runtime = { + .blocks = ARRAY_SIZE(rt_heap_map), + .map = rt_heap_map, + .heap = HEAP_RUNTIME_BASE, + .size = HEAP_RUNTIME_SIZE, + .info = {.free = HEAP_RUNTIME_SIZE,}, },
.buffer = { .blocks = ARRAY_SIZE(buf_heap_map), .map = buf_heap_map, - .heap = (uint32_t)&_buffer_heap, - .heap_end = (uint32_t)&_stack_sentry, - .info = {.free = HEAP_BUF_SIZE,}, + .heap = HEAP_BUFFER_BASE, + .size = HEAP_BUFFER_SIZE, + .info = {.free = HEAP_BUFFER_SIZE,}, + }, + +#if (HEAP_DMA_BUFFER_SIZE > 0) + .dma = { + .blocks = ARRAY_SIZE(dma_buf_heap_map), + .map = dma_buf_heap_map, + .heap = HEAP_DMA_BUFFER_BASE, + .size = HEAP_DMA_BUFFER_SIZE, + .info = {.free = HEAP_DMA_BUFFER_SIZE,}, }, - .total = {.free = SYSTEM_MEM + HEAP_MOD_SIZE + HEAP_BUF_SIZE,}, +#endif + .total = {.free = HEAP_SYSTEM_SIZE + HEAP_RUNTIME_SIZE + + HEAP_BUFFER_SIZE + HEAP_DMA_BUFFER_SIZE,}, };
/* total size of block */ @@ -200,13 +208,13 @@ static void alloc_memset_region(void *ptr, uint32_t bytes, uint32_t val) #endif
/* allocate from system memory pool */ -static void *rmalloc_dev(size_t bytes) +static void *rmalloc_sys(size_t bytes) { void *ptr = (void *)memmap.system.heap;
- /* always suceeds or panics */ + /* always succeeds or panics */ memmap.system.heap += bytes; - if (memmap.system.heap >= memmap.system.heap_end) { + if (memmap.system.heap >= HEAP_SYSTEM_BASE + HEAP_SYSTEM_SIZE) { trace_mem_error("eMd"); panic(PANIC_MEM); } @@ -219,7 +227,7 @@ static void *rmalloc_dev(size_t bytes) }
/* allocate single block */ -static void *alloc_block(struct mm_heap *heap, int level, int module) +static void *alloc_block(struct mm_heap *heap, int level, int bflags) { struct block_map *map = &heap->map[level]; struct block_hdr *hdr = &map->block[map->first_free]; @@ -228,9 +236,8 @@ static void *alloc_block(struct mm_heap *heap, int level, int module)
map->free_count--; ptr = (void *)(map->base + map->first_free * map->block_size); - hdr->module = module; hdr->size = 1; - hdr->flags = BLOCK_USED; + hdr->flags = RFLAGS_USED | bflags; heap->info.used += map->block_size; heap->info.free -= map->block_size;
@@ -239,7 +246,7 @@ static void *alloc_block(struct mm_heap *heap, int level, int module)
hdr = &map->block[i];
- if (hdr->flags == BLOCK_FREE) { + if (hdr->flags == 0) { map->first_free = i; break; } @@ -253,7 +260,8 @@ static void *alloc_block(struct mm_heap *heap, int level, int module) }
/* allocates continious blocks */ -static void *alloc_cont_blocks(struct mm_heap *heap, int level, int module, size_t bytes) +static void *alloc_cont_blocks(struct mm_heap *heap, int level, int bflags, + size_t bytes) { struct block_map *map = &heap->map[level]; struct block_hdr *hdr = &map->block[map->first_free]; @@ -272,8 +280,8 @@ static void *alloc_cont_blocks(struct mm_heap *heap, int level, int module, size for (current = start; current < end; current++) { hdr = &map->block[current];
- /* is block free */ - if (hdr->flags == BLOCK_USED) + /* is block used */ + if (hdr->flags == RFLAGS_USED) break; }
@@ -298,8 +306,7 @@ found: /* allocate each block */ for (current = start; current < end; current++) { hdr = &map->block[current]; - hdr->module = module; - hdr->flags = BLOCK_USED; + hdr->flags = RFLAGS_USED | bflags; }
/* do we need to find a new first free block ? */ @@ -310,7 +317,7 @@ found:
hdr = &map->block[i];
- if (hdr->flags == BLOCK_FREE) { + if (hdr->flags == 0) { map->first_free = i; break; } @@ -325,7 +332,7 @@ found: }
/* free block(s) */ -static void free_block(struct mm_heap *heap, int module, void *ptr) +static void free_block(struct mm_heap *heap, void *ptr) { struct block_map *map; struct block_hdr *hdr; @@ -336,11 +343,11 @@ static void free_block(struct mm_heap *heap, int module, void *ptr) return;
/* find block that ptr belongs to */ - for (i = 0; i < ARRAY_SIZE(mod_heap_map) - 1; i ++) { + for (i = 0; i < ARRAY_SIZE(rt_heap_map) - 1; i ++) {
/* is ptr in this block */ - if ((uint32_t)ptr >= mod_heap_map[i].base && - (uint32_t)ptr < mod_heap_map[i + 1].base) + if ((uint32_t)ptr >= rt_heap_map[i].base && + (uint32_t)ptr < rt_heap_map[i + 1].base) goto found; }
@@ -350,16 +357,15 @@ static void free_block(struct mm_heap *heap, int module, void *ptr)
found: /* calculate block header */ - map = &mod_heap_map[i]; + map = &rt_heap_map[i]; block = ((uint32_t)ptr - map->base) / map->block_size; hdr = &map->block[block];
/* free block header and continious blocks */ for (i = block; i < block + hdr->size; i++) { hdr = &map->block[i]; - hdr->module = 0; hdr->size = 0; - hdr->flags = BLOCK_FREE; + hdr->flags = 0; map->free_count++; heap->info.used -= map->block_size; heap->info.free += map->block_size; @@ -374,30 +380,32 @@ found: #endif }
-/* allocate single block for module */ -static void *rmalloc_mod(int module, size_t bytes) +/* allocate single block for runtime */ +static void *rmalloc_runtime(int bflags, size_t bytes) { int i;
- for (i = 0; i < ARRAY_SIZE(mod_heap_map); i ++) { + for (i = 0; i < ARRAY_SIZE(rt_heap_map); i ++) {
/* is block big enough */ - if (mod_heap_map[i].block_size < bytes) + if (rt_heap_map[i].block_size < bytes) continue;
/* does block have free space */ - if (mod_heap_map[i].free_count == 0) + if (rt_heap_map[i].free_count == 0) continue;
/* free block space exists */ - return alloc_block(&memmap.module, i, module); + return alloc_block(&memmap.runtime, i, bflags); }
trace_mem_error("eMm"); + trace_value(bytes); + trace_value(bflags); return NULL; }
-void *rmalloc(int zone, int module, size_t bytes) +void *rmalloc(int zone, int bflags, size_t bytes) { uint32_t flags; void *ptr = NULL; @@ -405,11 +413,11 @@ void *rmalloc(int zone, int module, size_t bytes) spin_lock_irq(&memmap.lock, flags);
switch (zone) { - case RZONE_DEV: - ptr = rmalloc_dev(bytes); + case RZONE_SYS: + ptr = rmalloc_sys(bytes); break; - case RZONE_MODULE: - ptr = rmalloc_mod(module, bytes); + case RZONE_RUNTIME: + ptr = rmalloc_runtime(bflags, bytes); break; default: trace_mem_error("eMz"); @@ -420,11 +428,11 @@ void *rmalloc(int zone, int module, size_t bytes) return ptr; }
-void *rzalloc(int zone, int module, size_t bytes) +void *rzalloc(int zone, int bflags, size_t bytes) { void *ptr = NULL;
- ptr = rmalloc(zone, module, bytes); + ptr = rmalloc(zone, bflags, bytes); if (ptr != NULL) { bzero(ptr, bytes); } @@ -433,7 +441,7 @@ void *rzalloc(int zone, int module, size_t bytes) }
/* allocates continuous buffer on 1k boundary */ -void *rballoc(int zone, int module, size_t bytes) +void *rballoc(int zone, int bflags, size_t bytes) { uint32_t flags; void *ptr = NULL; @@ -453,7 +461,7 @@ void *rballoc(int zone, int module, size_t bytes) continue;
/* allocate block */ - ptr = alloc_block(&memmap.buffer, i, module); + ptr = alloc_block(&memmap.buffer, i, bflags); goto out; }
@@ -461,7 +469,7 @@ void *rballoc(int zone, int module, size_t bytes)
/* only 1 choice for block size */ if (ARRAY_SIZE(buf_heap_map) == 1) { - ptr = alloc_cont_blocks(&memmap.buffer, 0, module, bytes); + ptr = alloc_cont_blocks(&memmap.buffer, 0, bflags, bytes); goto out; } else {
@@ -470,60 +478,34 @@ void *rballoc(int zone, int module, size_t bytes)
/* allocate is block size smaller than request */ if (buf_heap_map[i].block_size < bytes) - alloc_cont_blocks(&memmap.buffer, i, module, + alloc_cont_blocks(&memmap.buffer, i, bflags, bytes); } }
ptr = alloc_cont_blocks(&memmap.buffer, ARRAY_SIZE(buf_heap_map) - 1, - module, bytes); + bflags, bytes);
out: spin_unlock_irq(&memmap.lock, flags); return ptr; }
-void rfree(int zone, int module, void *ptr) +void rfree(void *ptr) { uint32_t flags;
spin_lock_irq(&memmap.lock, flags); - - switch (zone) { - case RZONE_DEV: - trace_mem_error("eMF"); - panic(PANIC_MEM); - break; - case RZONE_MODULE: - free_block(&memmap.module, module, ptr); - break; - default: - trace_mem_error("eMf"); - break; - } - + free_block(&memmap.runtime, ptr); spin_unlock_irq(&memmap.lock, flags); }
-void rbfree(int zone, int module, void *ptr) +void rbfree(void *ptr) { uint32_t flags;
spin_lock_irq(&memmap.lock, flags); - - switch (zone) { - case RZONE_DEV: - trace_mem_error("eMF"); - panic(PANIC_MEM); - break; - case RZONE_MODULE: - free_block(&memmap.buffer, module, ptr); - break; - default: - trace_mem_error("eMf"); - break; - } - + free_block(&memmap.buffer, ptr); spin_unlock_irq(&memmap.lock, flags); }
@@ -533,19 +515,19 @@ uint32_t mm_pm_context_size(void)
/* calc context size for each area */ size = memmap.buffer.info.used; - size += memmap.module.info.used; + size += memmap.runtime.info.used; size += memmap.system.info.used;
/* add memory maps */ size += heap_get_size(&memmap.buffer); - size += heap_get_size(&memmap.module); + size += heap_get_size(&memmap.runtime); size += heap_get_size(&memmap.system);
/* recalc totals */ memmap.total.free = memmap.buffer.info.free + - memmap.module.info.free + memmap.system.info.free; + memmap.runtime.info.free + memmap.system.info.free; memmap.total.used = memmap.buffer.info.used + - memmap.module.info.used + memmap.system.info.used; + memmap.runtime.info.used + memmap.system.info.used;
return size; } @@ -573,8 +555,7 @@ int mm_pm_context_save(struct dma_sg_config *sg)
/* copy system memory contents to SG */ ret = dma_copy_to_host(sg, offset + ret, - (void *)memmap.system.heap, - (int32_t)(memmap.system.heap_end - memmap.system.heap)); + (void *)memmap.system.heap, (int32_t)(memmap.system.size)); if (ret < 0) return ret;
@@ -605,8 +586,7 @@ int mm_pm_context_restore(struct dma_sg_config *sg)
/* copy system memory contents from SG */ ret = dma_copy_to_host(sg, offset + ret, - (void *)memmap.system.heap, - (int32_t)(memmap.system.heap_end - memmap.system.heap)); + (void *)memmap.system.heap, (int32_t)(memmap.system.size)); if (ret < 0) return ret;
@@ -640,14 +620,27 @@ void init_heap(void) current_map = &buf_heap_map[i]; }
- /* initialise module map */ - current_map = &mod_heap_map[0]; - current_map->base = memmap.module.heap; + /* initialise runtime map */ + current_map = &rt_heap_map[0]; + current_map->base = memmap.runtime.heap; + + for (i = 1; i < ARRAY_SIZE(rt_heap_map); i++) { + next_map = &rt_heap_map[i]; + next_map->base = current_map->base + + current_map->block_size * current_map->count; + current_map = &rt_heap_map[i]; + } + +#if (HEAP_DMA_BUFFER_SIZE > 0) + /* initialise DMA map */ + current_map = &dma_buf_heap_map[0]; + current_map->base = memmap.dma.heap;
- for (i = 1; i < ARRAY_SIZE(mod_heap_map); i++) { - next_map = &mod_heap_map[i]; + for (i = 1; i < ARRAY_SIZE(dma_buf_heap_map); i++) { + next_map = &dma_buf_heap_map[i]; next_map->base = current_map->base + current_map->block_size * current_map->count; - current_map = &mod_heap_map[i]; + current_map = &dma_buf_heap_map[i]; } +#endif } diff --git a/src/lib/work.c b/src/lib/work.c index 7da6f68..3172710 100644 --- a/src/lib/work.c +++ b/src/lib/work.c @@ -412,7 +412,7 @@ struct work_queue *work_new_queue(struct work_queue_timesource *ts) struct work_queue *queue;
/* init work queue */ - queue = rmalloc(RZONE_DEV, RMOD_SYS, sizeof(*queue_)); + queue = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*queue_));
list_init(&queue->work); spinlock_init(&queue->lock); diff --git a/src/platform/baytrail/baytrail.x b/src/platform/baytrail/baytrail.x.in similarity index 55% rename from src/platform/baytrail/baytrail.x rename to src/platform/baytrail/baytrail.x.in index 55bb031..aed7868 100755 --- a/src/platform/baytrail/baytrail.x +++ b/src/platform/baytrail/baytrail.x.in @@ -1,73 +1,145 @@ -/* Linker Script for baytrail - TODO: this should be run through the GCC - pre-processor to align heap and stack variables */ +/* + * Linker Script for Baytrail. + * + * This script is run through the GNU C preprocessor to align the memory + * offsets with headers. + * + * Use spaces for formatting as cpp ignore tab sizes. + */ + +#include <platform/memory.h> +#include <xtensa/config/core-isa.h>
OUTPUT_ARCH(xtensa)
MEMORY { - iram0_0_seg : org = 0xFF2C0000, len = 0x2E0 - iram0_1_seg : org = 0xFF2C02E0, len = 0x120 - iram0_2_seg : org = 0xFF2C0400, len = 0x178 - iram0_3_seg : org = 0xFF2C0578, len = 0x4 - iram0_4_seg : org = 0xFF2C057C, len = 0x1C - iram0_5_seg : org = 0xFF2C0598, len = 0x4 - iram0_6_seg : org = 0xFF2C059C, len = 0x1C - iram0_7_seg : org = 0xFF2C05B8, len = 0x4 - iram0_8_seg : org = 0xFF2C05BC, len = 0x1C - iram0_9_seg : org = 0xFF2C05D8, len = 0x4 - iram0_10_seg : org = 0xFF2C05DC, len = 0x1C - iram0_11_seg : org = 0xFF2C05F8, len = 0x4 - iram0_12_seg : org = 0xFF2C05FC, len = 0x1C - iram0_13_seg : org = 0xFF2C0618, len = 0x4 - iram0_14_seg : org = 0xFF2C061C, len = 0x1C - iram0_15_seg : org = 0xFF2C0638, len = 0x4 - iram0_16_seg : org = 0xFF2C063C, len = 0x1C - iram0_17_seg : org = 0xFF2C0658, len = 0x4 - iram0_18_seg : org = 0xFF2C065C, len = 0x1C - iram0_19_seg : org = 0xFF2C0678, len = 0x4 - iram0_20_seg : org = 0xFF2C067C, len = 0x1C - iram0_21_seg : org = 0xFF2C0698, len = 0x13968 - dram0_0_seg : org = 0xFF300000, len = 0x8 - dram0_1_seg : org = 0xFF300008, len = 0x26FF8 + vector_reset_text : + org = XCHAL_RESET_VECTOR0_PADDR, + len = REEF_MEM_RESET_TEXT_SIZE + vector_reset_lit : + org = XCHAL_RESET_VECTOR0_PADDR + REEF_MEM_RESET_TEXT_SIZE, + len = REEF_MEM_RESET_LIT_SIZE + vector_base_text : + org = XCHAL_VECBASE_RESET_PADDR, + len = REEF_MEM_VECBASE_LIT_SIZE + vector_int2_lit : + org = XCHAL_INTLEVEL2_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int2_text : + org = XCHAL_INTLEVEL2_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int3_lit : + org = XCHAL_INTLEVEL3_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int3_text : + org = XCHAL_INTLEVEL3_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int4_lit : + org = XCHAL_INTLEVEL4_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int4_text : + org = XCHAL_INTLEVEL4_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int5_lit : + org = XCHAL_INTLEVEL5_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int5_text : + org = XCHAL_INTLEVEL5_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int6_lit : + org = XCHAL_INTLEVEL6_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int6_text : + org = XCHAL_INTLEVEL6_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_int7_lit : + org = XCHAL_INTLEVEL7_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_int7_text : + org = XCHAL_INTLEVEL7_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_kernel_lit : + org = XCHAL_KERNEL_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_kernel_text : + org = XCHAL_KERNEL_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_user_lit : + org = XCHAL_USER_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_user_text : + org = XCHAL_USER_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + vector_double_lit : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR - REEF_MEM_VECT_LIT_SIZE, + len = REEF_MEM_VECT_LIT_SIZE + vector_double_text : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR, + len = REEF_MEM_VECT_TEXT_SIZE + reef_text_start : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR + REEF_MEM_VECT_SIZE, + len = (IRAM_BASE + IRAM_SIZE) - (XCHAL_DOUBLEEXC_VECTOR_PADDR + REEF_MEM_VECT_SIZE) + reef_data_ro : + org = DRAM0_BASE, + len = REEF_MEM_RO_SIZE + reef_data : + org = DRAM0_BASE + REEF_MEM_RO_SIZE, + len = HEAP_SYSTEM_BASE - (DRAM0_BASE + REEF_MEM_RO_SIZE) + system_heap : + org = HEAP_SYSTEM_BASE, + len = HEAP_SYSTEM_SIZE + runtime_heap : + org = HEAP_RUNTIME_BASE, + len = HEAP_RUNTIME_SIZE + buffer_heap : + org = HEAP_BUFFER_BASE, + len = HEAP_BUFFER_SIZE + reef_stack : + org = REEF_STACK_END, + len = REEF_STACK_BASE - REEF_STACK_END }
PHDRS { - iram0_0_phdr PT_LOAD; - iram0_1_phdr PT_LOAD; - iram0_2_phdr PT_LOAD; - iram0_3_phdr PT_LOAD; - iram0_4_phdr PT_LOAD; - iram0_5_phdr PT_LOAD; - iram0_6_phdr PT_LOAD; - iram0_7_phdr PT_LOAD; - iram0_8_phdr PT_LOAD; - iram0_9_phdr PT_LOAD; - iram0_10_phdr PT_LOAD; - iram0_11_phdr PT_LOAD; - iram0_12_phdr PT_LOAD; - iram0_13_phdr PT_LOAD; - iram0_14_phdr PT_LOAD; - iram0_15_phdr PT_LOAD; - iram0_16_phdr PT_LOAD; - iram0_17_phdr PT_LOAD; - iram0_18_phdr PT_LOAD; - iram0_19_phdr PT_LOAD; - iram0_20_phdr PT_LOAD; - iram0_21_phdr PT_LOAD; - dram0_0_phdr PT_LOAD; - dram0_1_phdr PT_LOAD; - dram0_1_bss_phdr PT_LOAD; - dram0_2_phdr PT_LOAD; + vector_reset_text_phdr PT_LOAD; + vector_reset_lit_phdr PT_LOAD; + vector_base_text_phdr PT_LOAD; + vector_base_lit_phdr PT_LOAD; + vector_int2_text_phdr PT_LOAD; + vector_int2_lit_phdr PT_LOAD; + vector_int3_text_phdr PT_LOAD; + vector_int3_lit_phdr PT_LOAD; + vector_int4_text_phdr PT_LOAD; + vector_int4_lit_phdr PT_LOAD; + vector_int5_text_phdr PT_LOAD; + vector_int5_lit_phdr PT_LOAD; + vector_int6_text_phdr PT_LOAD; + vector_int6_lit_phdr PT_LOAD; + vector_int7_text_phdr PT_LOAD; + vector_int7_lit_phdr PT_LOAD; + vector_kernel_text_phdr PT_LOAD; + vector_kernel_lit_phdr PT_LOAD; + vector_user_text_phdr PT_LOAD; + vector_user_lit_phdr PT_LOAD; + vector_double_text_phdr PT_LOAD; + vector_double_lit_phdr PT_LOAD; + reef_text_start_phdr PT_LOAD; + reef_data_ro_phdr PT_LOAD; + reef_data_phdr PT_LOAD; + reef_data_bss_phdr PT_LOAD; + system_heap_phdr PT_LOAD; + runtime_heap_phdr PT_LOAD; + buffer_heap_phdr PT_LOAD; + reef_stack_phdr PT_LOAD; }
- /* Default entry point: */ ENTRY(_ResetVector) _rom_store_table = 0;
/* ABI0 does not use Window base */ -PROVIDE(_memmap_vecbase_reset = 0xff2c0400); +PROVIDE(_memmap_vecbase_reset = XCHAL_VECBASE_RESET_PADDR);
/* Various memory-map dependent cache attribute settings: */ _memmap_cacheattr_wb_base = 0x44024000; @@ -94,147 +166,147 @@ SECTIONS _ResetVector_text_start = ABSOLUTE(.); KEEP (*(.ResetVector.text)) _ResetVector_text_end = ABSOLUTE(.); - } >iram0_0_seg :iram0_0_phdr + } >vector_reset_text :vector_reset_text_phdr
.ResetVector.literal : ALIGN(4) { _ResetVector_literal_start = ABSOLUTE(.); *(.ResetVector.literal) _ResetVector_literal_end = ABSOLUTE(.); - } >iram0_1_seg :iram0_1_phdr + } >vector_reset_lit :vector_reset_lit_phdr
.WindowVectors.text : ALIGN(4) { _WindowVectors_text_start = ABSOLUTE(.); KEEP (*(.WindowVectors.text)) _WindowVectors_text_end = ABSOLUTE(.); - } >iram0_2_seg :iram0_2_phdr + } >vector_base_text :vector_base_text_phdr
.Level2InterruptVector.literal : ALIGN(4) { _Level2InterruptVector_literal_start = ABSOLUTE(.); *(.Level2InterruptVector.literal) _Level2InterruptVector_literal_end = ABSOLUTE(.); - } >iram0_3_seg :iram0_3_phdr + } >vector_int2_lit :vector_int2_lit_phdr
.Level2InterruptVector.text : ALIGN(4) { _Level2InterruptVector_text_start = ABSOLUTE(.); KEEP (*(.Level2InterruptVector.text)) _Level2InterruptVector_text_end = ABSOLUTE(.); - } >iram0_4_seg :iram0_4_phdr + } >vector_int2_text :vector_int2_text_phdr
.Level3InterruptVector.literal : ALIGN(4) { _Level3InterruptVector_literal_start = ABSOLUTE(.); *(.Level3InterruptVector.literal) _Level3InterruptVector_literal_end = ABSOLUTE(.); - } >iram0_5_seg :iram0_5_phdr + } >vector_int3_lit :vector_int3_lit_phdr
.Level3InterruptVector.text : ALIGN(4) { _Level3InterruptVector_text_start = ABSOLUTE(.); KEEP (*(.Level3InterruptVector.text)) _Level3InterruptVector_text_end = ABSOLUTE(.); - } >iram0_6_seg :iram0_6_phdr + } >vector_int3_text :vector_int3_text_phdr
.Level4InterruptVector.literal : ALIGN(4) { _Level4InterruptVector_literal_start = ABSOLUTE(.); *(.Level4InterruptVector.literal) _Level4InterruptVector_literal_end = ABSOLUTE(.); - } >iram0_7_seg :iram0_7_phdr + } >vector_int4_lit :vector_int4_lit_phdr
.Level4InterruptVector.text : ALIGN(4) { _Level4InterruptVector_text_start = ABSOLUTE(.); KEEP (*(.Level4InterruptVector.text)) _Level4InterruptVector_text_end = ABSOLUTE(.); - } >iram0_8_seg :iram0_8_phdr + } >vector_int4_text :vector_int4_text_phdr
.Level5InterruptVector.literal : ALIGN(4) { _Level5InterruptVector_literal_start = ABSOLUTE(.); *(.Level5InterruptVector.literal) _Level5InterruptVector_literal_end = ABSOLUTE(.); - } >iram0_9_seg :iram0_9_phdr + } >vector_int5_lit :vector_int5_lit_phdr
.Level5InterruptVector.text : ALIGN(4) { _Level5InterruptVector_text_start = ABSOLUTE(.); KEEP (*(.Level5InterruptVector.text)) _Level5InterruptVector_text_end = ABSOLUTE(.); - } >iram0_10_seg :iram0_10_phdr + } >vector_int5_text :vector_int5_text_phdr
.DebugExceptionVector.literal : ALIGN(4) { _DebugExceptionVector_literal_start = ABSOLUTE(.); *(.DebugExceptionVector.literal) _DebugExceptionVector_literal_end = ABSOLUTE(.); - } >iram0_11_seg :iram0_11_phdr + } >vector_int6_lit :vector_int6_lit_phdr
.DebugExceptionVector.text : ALIGN(4) { _DebugExceptionVector_text_start = ABSOLUTE(.); KEEP (*(.DebugExceptionVector.text)) _DebugExceptionVector_text_end = ABSOLUTE(.); - } >iram0_12_seg :iram0_12_phdr + } >vector_int6_text :vector_int6_text_phdr
.NMIExceptionVector.literal : ALIGN(4) { _NMIExceptionVector_literal_start = ABSOLUTE(.); *(.NMIExceptionVector.literal) _NMIExceptionVector_literal_end = ABSOLUTE(.); - } >iram0_13_seg :iram0_13_phdr + } >vector_int7_lit :vector_int7_lit_phdr
.NMIExceptionVector.text : ALIGN(4) { _NMIExceptionVector_text_start = ABSOLUTE(.); KEEP (*(.NMIExceptionVector.text)) _NMIExceptionVector_text_end = ABSOLUTE(.); - } >iram0_14_seg :iram0_14_phdr + } >vector_int7_text :vector_int7_text_phdr
.KernelExceptionVector.literal : ALIGN(4) { _KernelExceptionVector_literal_start = ABSOLUTE(.); *(.KernelExceptionVector.literal) _KernelExceptionVector_literal_end = ABSOLUTE(.); - } >iram0_15_seg :iram0_15_phdr + } >vector_kernel_lit :vector_kernel_lit_phdr
.KernelExceptionVector.text : ALIGN(4) { _KernelExceptionVector_text_start = ABSOLUTE(.); KEEP (*(.KernelExceptionVector.text)) _KernelExceptionVector_text_end = ABSOLUTE(.); - } >iram0_16_seg :iram0_16_phdr + } >vector_kernel_text :vector_kernel_text_phdr
.UserExceptionVector.literal : ALIGN(4) { _UserExceptionVector_literal_start = ABSOLUTE(.); *(.UserExceptionVector.literal) _UserExceptionVector_literal_end = ABSOLUTE(.); - } >iram0_17_seg :iram0_17_phdr + } >vector_user_lit :vector_user_lit_phdr
.UserExceptionVector.text : ALIGN(4) { _UserExceptionVector_text_start = ABSOLUTE(.); KEEP (*(.UserExceptionVector.text)) _UserExceptionVector_text_end = ABSOLUTE(.); - } >iram0_18_seg :iram0_18_phdr + } >vector_user_text :vector_user_text_phdr
.DoubleExceptionVector.literal : ALIGN(4) { _DoubleExceptionVector_literal_start = ABSOLUTE(.); *(.DoubleExceptionVector.literal) _DoubleExceptionVector_literal_end = ABSOLUTE(.); - } >iram0_19_seg :iram0_19_phdr + } >vector_double_lit :vector_double_lit_phdr
.DoubleExceptionVector.text : ALIGN(4) { _DoubleExceptionVector_text_start = ABSOLUTE(.); KEEP (*(.DoubleExceptionVector.text)) _DoubleExceptionVector_text_end = ABSOLUTE(.); - } >iram0_20_seg :iram0_20_phdr + } >vector_double_text :vector_double_text_phdr
.text : ALIGN(4) { @@ -249,14 +321,14 @@ SECTIONS *(.gnu.version) _text_end = ABSOLUTE(.); _etext = .; - } >iram0_21_seg :iram0_21_phdr + } >reef_text_start :reef_text_start_phdr
.reset.rodata : ALIGN(4) { _reset_rodata_start = ABSOLUTE(.); *(.reset.rodata) _reset_rodata_end = ABSOLUTE(.); - } >dram0_0_seg :dram0_0_phdr + } >reef_data_ro :reef_data_ro_phdr
.rodata : ALIGN(4) { @@ -294,7 +366,7 @@ SECTIONS LONG(_bss_end) _bss_table_end = ABSOLUTE(.); _rodata_end = ABSOLUTE(.); - } >dram0_1_seg :dram0_1_phdr + } >reef_data :reef_data_phdr
.data : ALIGN(4) { @@ -312,7 +384,7 @@ SECTIONS *(.gnu.linkonce.s2.*) KEEP(*(.jcr)) _data_end = ABSOLUTE(.); - } >dram0_1_seg :dram0_1_phdr + } >reef_data :reef_data_phdr
.lit4 : ALIGN(4) { @@ -321,8 +393,7 @@ SECTIONS *(.lit4.*) *(.gnu.linkonce.lit4.*) _lit4_end = ABSOLUTE(.); - } >dram0_1_seg :dram0_1_phdr - + } >reef_data :reef_data_phdr
.bss (NOLOAD) : ALIGN(8) { @@ -343,40 +414,13 @@ SECTIONS *(COMMON) . = ALIGN (8); _bss_end = ABSOLUTE(.); - } >dram0_1_seg :dram0_1_bss_phdr - -/* TODO: need to clean up what we are using/not using here */ -/* TODO: need to run the pre-processor on this to align with C headers */ - - _end = 0xff327000; - PROVIDE(end = 0xff327000); - _stack_sentry = 0xff327000; - __stack = 0xff328000; - _heap_sentry = 0xff328000; - - /* The Heap and stack are organised like this :- - * - * DRAM start -------- - * RO Data - * Data - * BSS - * System Heap - * Module Heap - * Module Buffers - * Stack - * DRAM End --------- - */ + } >reef_data :reef_data_bss_phdr
- /* System Heap */ - _system_heap = 0xff304000; - - - /* module heap */ - _module_heap = 0xff305000; - - /* buffer heap */ - _buffer_heap = 0xff30c000; - _buffer_heap_end = _stack_sentry; + /* stack */ + _end = REEF_STACK_END; + PROVIDE(end = REEF_STACK_END); + _stack_sentry = REEF_STACK_END; + __stack = REEF_STACK_BASE;
.debug 0 : { *(.debug) } .line 0 : { *(.line) } @@ -395,6 +439,7 @@ SECTIONS .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } + .xt.insn 0 : { KEEP (*(.xt.insn)) @@ -427,5 +472,37 @@ SECTIONS KEEP (*(.xt.profile_files)) KEEP (*(.gnu.linkonce.xt.profile_files.*)) } + + .system_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_SYSTEM_SIZE; + _system_heap_end = ABSOLUTE(.); + } >system_heap :system_heap_phdr + + .runtime_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _runtime_heap_start = ABSOLUTE(.); + . = . + HEAP_RUNTIME_SIZE; + _runtime_heap_end = ABSOLUTE(.); + } >runtime_heap :runtime_heap_phdr + + .buffer_heap (NOLOAD) : ALIGN(8) + { + . = ALIGN (32); + _system_heap_start = ABSOLUTE(.); + . = . + HEAP_BUFFER_SIZE; + _system_heap_end = ABSOLUTE(.); + } >buffer_heap :buffer_heap_phdr + + .reef_stack (NOLOAD) : ALIGN(8) + { + . = ALIGN (4096); + _reef_stack_start = ABSOLUTE(.); + . = . + REEF_STACK_SIZE; + _reef_stack_end = ABSOLUTE(.); + } >reef_stack :reef_stack_phdr }
diff --git a/src/platform/baytrail/clk.c b/src/platform/baytrail/clk.c index 1d6ed6d..5d8a73a 100644 --- a/src/platform/baytrail/clk.c +++ b/src/platform/baytrail/clk.c @@ -258,7 +258,7 @@ uint32_t clock_time_elapsed(int clock, uint32_t previous, uint32_t *current)
void init_platform_clocks(void) { - clk_pdata = rmalloc(RZONE_DEV, RMOD_SYS, sizeof(*clk_pdata)); + clk_pdata = rmalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*clk_pdata));
spinlock_init(&clk_pdata->clk[0].lock); spinlock_init(&clk_pdata->clk[1].lock); diff --git a/src/platform/baytrail/include/platform/memory.h b/src/platform/baytrail/include/platform/memory.h index 471914e..80d7197 100644 --- a/src/platform/baytrail/include/platform/memory.h +++ b/src/platform/baytrail/include/platform/memory.h @@ -31,6 +31,8 @@ #ifndef __PLATFORM_MEMORY_H__ #define __PLATFORM_MEMORY_H__
+#include <config.h> + /* physical DSP addresses */
#define SHIM_BASE 0xFF340000 @@ -73,33 +75,79 @@ #define SSP5_BASE 0xFF2A6000 #define SSP5_SIZE 0x00001000
-/* HEAP Constants - WARNING this MUST be aligned with the linker script */ -/* TODO:preproces linker script with this header to align automatically. */ +/* + * The Heap and Stack on Baytrail are organised like this :- + * + * +--------------------------------------------------------------------------+ + * | Offset | Region | Size | + * +---------------------+----------------+-----------------------------------+ + * | DRAM0_BASE | RO Data | REEF_DATA_SIZE | + * | | Data | | + * | | BSS | | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_SYSTEM_BASE | System Heap | HEAP_SYSTEM_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_RUNTIME_BASE | Runtime Heap | HEAP_RUNTIME_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | HEAP_BUFFER_BASE | Module Buffers | HEAP_BUFFER_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_END | Stack | REEF_STACK_SIZE | + * +---------------------+----------------+-----------------------------------+ + * | REEF_STACK_BASE | | | + * +---------------------+----------------+-----------------------------------+ + */ +
/* Heap section sizes for module pool */ -#define HEAP_MOD_COUNT8 0 -#define HEAP_MOD_COUNT16 256 -#define HEAP_MOD_COUNT32 128 -#define HEAP_MOD_COUNT64 64 -#define HEAP_MOD_COUNT128 32 -#define HEAP_MOD_COUNT256 16 -#define HEAP_MOD_COUNT512 8 -#define HEAP_MOD_COUNT1024 4 - -/* total Heap for modules - must be aligned with linker script !!! */ -#define HEAP_MOD_SIZE \ - (HEAP_MOD_COUNT8 * 8 + HEAP_MOD_COUNT16 * 16 + \ - HEAP_MOD_COUNT32 * 32 + HEAP_MOD_COUNT64 * 64 + \ - HEAP_MOD_COUNT128 * 128 + HEAP_MOD_COUNT256 * 256 + \ - HEAP_MOD_COUNT512 * 512 + HEAP_MOD_COUNT1024 * 1024) - -/* Heap for buffers */ -#define HEAP_BUF_BLOCK_SIZE 1024 -#define HEAP_BUF_COUNT 111 -#define HEAP_BUF_SIZE (HEAP_BUF_BLOCK_SIZE * HEAP_BUF_COUNT) - -/* Remaining DRAM for Stack, data and BSS. TODO: verify no overflow during build */ -#define SYSTEM_MEM \ - (DRAM0_SIZE - HEAP_MOD_SIZE - HEAP_BUF_SIZE) +#define HEAP_RT_COUNT8 0 +#define HEAP_RT_COUNT16 256 +#define HEAP_RT_COUNT32 128 +#define HEAP_RT_COUNT64 64 +#define HEAP_RT_COUNT128 32 +#define HEAP_RT_COUNT256 16 +#define HEAP_RT_COUNT512 8 +#define HEAP_RT_COUNT1024 4 + +/* Heap configuration */ +#define REEF_DATA_SIZE 0x4000 + +#define HEAP_SYSTEM_BASE (DRAM0_BASE + REEF_DATA_SIZE) +#define HEAP_SYSTEM_SIZE 0x2000 + +#define HEAP_RUNTIME_BASE (HEAP_SYSTEM_BASE + HEAP_SYSTEM_SIZE) +#define HEAP_RUNTIME_SIZE \ + (HEAP_RT_COUNT8 * 8 + HEAP_RT_COUNT16 * 16 + \ + HEAP_RT_COUNT32 * 32 + HEAP_RT_COUNT64 * 64 + \ + HEAP_RT_COUNT128 * 128 + HEAP_RT_COUNT256 * 256 + \ + HEAP_RT_COUNT512 * 512 + HEAP_RT_COUNT1024 * 1024) + +#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) + +#define HEAP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) + +/* DMA buffer heap is the same physical memory as buffer heap on baytrail */ +#define HEAP_DMA_BUFFER_BASE 0 +#define HEAP_DMA_BUFFER_SIZE 0 +#define HEAP_DMA_BUFFER_BLOCK_SIZE 0 +#define HEAP_DMA_BUFFER_COUNT 0 + +/* Stack configuration */ +#define REEF_STACK_SIZE 0x1000 +#define REEF_STACK_BASE (DRAM0_BASE + DRAM0_SIZE) +#define REEF_STACK_END (REEF_STACK_BASE - REEF_STACK_SIZE) + +/* Vector and literal sizes - not in core-isa.h */ +#define REEF_MEM_VECT_LIT_SIZE 0x4 +#define REEF_MEM_VECT_TEXT_SIZE 0x1c +#define REEF_MEM_VECT_SIZE (REEF_MEM_VECT_TEXT_SIZE + REEF_MEM_VECT_LIT_SIZE) + +#define REEF_MEM_RESET_TEXT_SIZE 0x2e0 +#define REEF_MEM_RESET_LIT_SIZE 0x120 +#define REEF_MEM_VECBASE_LIT_SIZE 0x178 + +#define REEF_MEM_RO_SIZE 0x8
#endif
Add Cherrytrail SSP handshake IDs and extra DMAC
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/platform/baytrail/include/platform/dma.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/platform/baytrail/include/platform/dma.h b/src/platform/baytrail/include/platform/dma.h index 8a1a806..eec501a 100644 --- a/src/platform/baytrail/include/platform/dma.h +++ b/src/platform/baytrail/include/platform/dma.h @@ -36,6 +36,7 @@
#define DMA_ID_DMAC0 0 #define DMA_ID_DMAC1 1 +#define DMA_ID_DMAC2 2
#define DMA_HANDSHAKE_SSP0_RX 0 #define DMA_HANDSHAKE_SSP0_TX 1 @@ -48,6 +49,8 @@ #define DMA_HANDSHAKE_SSP4_RX 8 #define DMA_HANDSHAKE_SSP4_TX 9 #define DMA_HANDSHAKE_SSP5_RX 10 -#define DMA_HANDSHAKE_SSP6_TX 11 +#define DMA_HANDSHAKE_SSP5_TX 11 +#define DMA_HANDSHAKE_SSP6_RX 12 +#define DMA_HANDSHAKE_SSP6_TX 13
#endif
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/arch/xtensa/Makefile.am | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index 2a4c5ce..c998c31 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -74,3 +74,5 @@ bin-local: reef vminstall-local: scp -P 5555 reef-*.ri root@localhost:/lib/firmware/intel/
+clean-local: + rm -f reef-*.bin
participants (1)
-
Liam Girdwood