mirror of https://github.com/thesofproject/sof.git
Merge pull request #614 from tlauda/topic/fix-alloc-free
alloc: fix freeing of uncached pointers
This commit is contained in:
commit
105dd406c6
|
@ -547,6 +547,10 @@ void rfree(void *ptr)
|
|||
if (!ptr)
|
||||
return;
|
||||
|
||||
/* operate only on cached addresses */
|
||||
if (is_uncached(ptr))
|
||||
ptr = uncache_to_cache(ptr);
|
||||
|
||||
/* use the heap dedicated for the selected core */
|
||||
cpu_heap = cache_to_uncache(memmap.system + cpu_get_id());
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@
|
|||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define HP_SRAM_BASE 0xBE000000
|
||||
#define HP_SRAM_SIZE 0x00080000
|
||||
#define HP_SRAM_MASK 0xFF000000
|
||||
|
||||
/* HP SRAM Heap */
|
||||
#define HEAP_HP_BUFFER_BASE HP_SRAM_BASE
|
||||
|
@ -373,10 +374,11 @@
|
|||
/** \brief Manifest size (seems unused). */
|
||||
#define IMR_BOOT_LDR_MANIFEST_SIZE 0x6000
|
||||
|
||||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define uncache_to_cache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) + SRAM_ALIAS_OFFSET))
|
||||
#define cache_to_uncache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) - SRAM_ALIAS_OFFSET))
|
||||
#define is_uncached(address) \
|
||||
(((uint32_t)(address) & HP_SRAM_MASK) != HP_SRAM_BASE)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -158,5 +158,6 @@
|
|||
|
||||
#define uncache_to_cache(address) address
|
||||
#define cache_to_uncache(address) address
|
||||
#define is_uncached(address) 0
|
||||
|
||||
#endif
|
||||
|
|
|
@ -173,6 +173,7 @@
|
|||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define HP_SRAM_BASE 0xBE000000
|
||||
#define HP_SRAM_SIZE 0x002F0000
|
||||
#define HP_SRAM_MASK 0xFF000000
|
||||
|
||||
/* HP SRAM Base */
|
||||
#define HP_SRAM_VECBASE_RESET (HP_SRAM_BASE + 0x40000)
|
||||
|
@ -383,10 +384,11 @@
|
|||
#define IMR_BOOT_LDR_BSS_BASE 0xB0100000
|
||||
#define IMR_BOOT_LDR_BSS_SIZE 0x10000
|
||||
|
||||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define uncache_to_cache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) + SRAM_ALIAS_OFFSET))
|
||||
#define cache_to_uncache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) - SRAM_ALIAS_OFFSET))
|
||||
#define is_uncached(address) \
|
||||
(((uint32_t)(address) & HP_SRAM_MASK) != HP_SRAM_BASE)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -155,5 +155,6 @@
|
|||
|
||||
#define uncache_to_cache(address) address
|
||||
#define cache_to_uncache(address) address
|
||||
#define is_uncached(address) 0
|
||||
|
||||
#endif
|
||||
|
|
|
@ -173,6 +173,7 @@
|
|||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define HP_SRAM_BASE 0xBE000000
|
||||
#define HP_SRAM_SIZE 0x002F0000
|
||||
#define HP_SRAM_MASK 0xFF000000
|
||||
|
||||
/* HP SRAM Base */
|
||||
#define HP_SRAM_VECBASE_RESET (HP_SRAM_BASE + 0x40000)
|
||||
|
@ -383,10 +384,11 @@
|
|||
#define IMR_BOOT_LDR_BSS_BASE 0xB0100000
|
||||
#define IMR_BOOT_LDR_BSS_SIZE 0x10000
|
||||
|
||||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define uncache_to_cache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) + SRAM_ALIAS_OFFSET))
|
||||
#define cache_to_uncache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) - SRAM_ALIAS_OFFSET))
|
||||
#define is_uncached(address) \
|
||||
(((uint32_t)(address) & HP_SRAM_MASK) != HP_SRAM_BASE)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -161,6 +161,7 @@
|
|||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define HP_SRAM_BASE 0xBE000000
|
||||
#define HP_SRAM_SIZE 0x002F0000 /* Should be 48 * 64 - 0x300000 ?? */
|
||||
#define HP_SRAM_MASK 0xFF000000
|
||||
|
||||
/* HP SRAM Base */
|
||||
#define HP_SRAM_VECBASE_RESET (HP_SRAM_BASE + 0x40000)
|
||||
|
@ -349,10 +350,11 @@
|
|||
#define SRAM_VECBASE_RESET (BOOT_LDR_BSS_BASE + BOOT_LDR_BSS_SIZE)
|
||||
|
||||
//TODO: confirm mapping
|
||||
#define SRAM_ALIAS_OFFSET 0x20000000
|
||||
#define uncache_to_cache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) + SRAM_ALIAS_OFFSET))
|
||||
#define cache_to_uncache(address) \
|
||||
((__typeof__((address)))((uint32_t)((address)) - SRAM_ALIAS_OFFSET))
|
||||
#define is_uncached(address) \
|
||||
(((uint32_t)(address) & HP_SRAM_MASK) != HP_SRAM_BASE)
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue