File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ void rfree(void *ptr);
106106 */
107107void l3_heap_save (void );
108108
109+ void * sof_heap_alloc (struct k_heap * heap , uint32_t flags , size_t bytes ,
110+ size_t alignment );
111+ void sof_heap_free (struct k_heap * heap , void * addr );
112+
109113/* TODO: remove - debug only - only needed for linking */
110114static inline void heap_trace_all (int force ) {}
111115
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ static void __sparse_cache *heap_alloc_aligned_cached(struct k_heap *h,
353353 */
354354#ifdef CONFIG_SOF_ZEPHYR_HEAP_CACHED
355355 min_align = MAX (PLATFORM_DCACHE_ALIGN , min_align );
356- bytes = ALIGN_UP (bytes , min_align );
356+ bytes = ALIGN_UP (bytes , PLATFORM_DCACHE_ALIGN );
357357#endif
358358
359359 ptr = (__sparse_force void __sparse_cache * )heap_alloc_aligned (h , min_align , bytes );
@@ -533,6 +533,30 @@ void rfree(void *ptr)
533533}
534534EXPORT_SYMBOL (rfree );
535535
536+ /*
537+ * To match the fall-back SOF main heap all private heaps should also be in the
538+ * uncached address range.
539+ */
540+ void * sof_heap_alloc (struct k_heap * heap , uint32_t flags , size_t bytes ,
541+ size_t alignment )
542+ {
543+ if (!heap )
544+ heap = & sof_heap ;
545+
546+ if (flags & SOF_MEM_FLAG_COHERENT )
547+ return heap_alloc_aligned (heap , alignment , bytes );
548+
549+ return (__sparse_force void * )heap_alloc_aligned_cached (heap , alignment , bytes );
550+ }
551+
552+ void sof_heap_free (struct k_heap * heap , void * addr )
553+ {
554+ if (!heap )
555+ heap = & sof_heap ;
556+
557+ heap_free (heap , addr );
558+ }
559+
536560static int heap_init (void )
537561{
538562 sys_heap_init (& sof_heap .heap , heapmem , HEAPMEM_SIZE );
You can’t perform that action at this time.
0 commit comments