Skip to content

Commit

Permalink
zephyr: use system cache APIs instead of custom soc calls
Browse files Browse the repository at this point in the history
Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Jan 26, 2024
1 parent c698a57 commit d406826
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static inline uintptr_t get_l3_heap_start(void)
* - main_fw_load_offset
* - main fw size in manifest
*/
return (uintptr_t)z_soc_uncached_ptr((__sparse_force void __sparse_cache *)
return (uintptr_t)sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)
ROUND_UP(IMR_L3_HEAP_BASE, L3_MEM_PAGE_SIZE));
}

Expand Down Expand Up @@ -146,7 +146,7 @@ static bool is_l3_heap_pointer(void *ptr)
uintptr_t l3_heap_end = l3_heap_start + get_l3_heap_size();

if (is_cached(ptr))
ptr = z_soc_uncached_ptr((__sparse_force void __sparse_cache *)ptr);
ptr = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)ptr);

if ((POINTER_TO_UINT(ptr) >= l3_heap_start) && (POINTER_TO_UINT(ptr) < l3_heap_end))
return true;
Expand Down Expand Up @@ -199,7 +199,7 @@ static void __sparse_cache *heap_alloc_aligned_cached(struct k_heap *h,

#ifdef CONFIG_SOF_ZEPHYR_HEAP_CACHED
if (ptr)
ptr = z_soc_cached_ptr((__sparse_force void *)ptr);
ptr = sys_cache_cached_ptr_get((__sparse_force void *)ptr);
#endif

return ptr;
Expand All @@ -212,7 +212,7 @@ static void heap_free(struct k_heap *h, void *mem)
void *mem_uncached;

if (is_cached(mem)) {
mem_uncached = z_soc_uncached_ptr((__sparse_force void __sparse_cache *)mem);
mem_uncached = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)mem);
sys_cache_data_flush_and_invd_range(mem,
sys_heap_usable_size(&h->heap, mem_uncached));

Expand Down

0 comments on commit d406826

Please sign in to comment.