Repository navigation
Expand file tree
/
Copy pathmemory.h
More file actions
193 lines (145 loc) · 5.25 KB
/
Copy pathmemory.h
File metadata and controls
193 lines (145 loc) · 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/
#ifdef __SOF_LIB_MEMORY_H__
#ifndef __PLATFORM_LIB_MEMORY_H__
#define __PLATFORM_LIB_MEMORY_H__
#include <inttypes.h>
#include <stddef.h>
/* prioritize definitions in Zephyr SoC layer */
#ifdef __ZEPHYR__
#include <adsp_memory.h>
#endif
struct sof;
#define PLATFORM_DCACHE_ALIGN sizeof(void *)
#define SOF_STACK_SIZE (CONFIG_SOF_STACK_SIZE)
uint8_t *get_library_mailbox(void);
#define MAILBOX_BASE get_library_mailbox()
#define PLATFORM_HEAP_SYSTEM 2
#define PLATFORM_HEAP_SYSTEM_RUNTIME CONFIG_CORE_COUNT
#define PLATFORM_HEAP_RUNTIME 1
#define PLATFORM_HEAP_BUFFER 2
#define PLATFORM_HEAP_SYSTEM_SHARED 1
#define PLATFORM_HEAP_RUNTIME_SHARED 1
#define SHARED_DATA
static inline void *platform_shared_get(void *ptr, int bytes)
{
return ptr;
}
void platform_init_memmap(struct sof *sof);
static inline void *platform_rfree_prepare(void *ptr)
{
return ptr;
}
#define uncache_to_cache(address) address
#define cache_to_uncache(address) address
#define is_uncached(address) 1
#define cache_to_uncache_init(address) address
#define ARCH_OOPS_SIZE 0
static inline void *arch_get_stack_entry(void)
{
return NULL;
}
static inline uint32_t arch_get_stack_size(void)
{
return 0;
}
/* NOTE - FAKE Memory configurations are used by UT's to test allocator */
#define SRAM_BANK_SIZE 0x10000
#define LP_SRAM_SIZE SRAM_BANK_SIZE
/* use big enough HP_SRAM_SIZE to build all components for the test bench at once */
#define HP_SRAM_SIZE (SRAM_BANK_SIZE * 47)
#define HP_SRAM_BASE 0xBE000000
#ifndef LP_SRAM_BASE
#define LP_SRAM_BASE 0xBE800000
#endif
#define SOF_FW_END (HP_SRAM_BASE + HP_SRAM_SIZE)
/* Heap section sizes for system runtime heap for primary core */
#define HEAP_SYS_RT_0_COUNT64 128
#define HEAP_SYS_RT_0_COUNT512 16
#define HEAP_SYS_RT_0_COUNT1024 4
/* Heap section sizes for system runtime heap for secondary core */
#define HEAP_SYS_RT_X_COUNT64 64
#define HEAP_SYS_RT_X_COUNT512 8
#define HEAP_SYS_RT_X_COUNT1024 4
/* Heap section sizes for module pool */
#define HEAP_COUNT64 128
#define HEAP_COUNT128 64
#define HEAP_COUNT256 128
#define HEAP_COUNT512 8
#define HEAP_COUNT1024 4
#define HEAP_COUNT2048 1
#define HEAP_COUNT4096 1
/* Heap configuration */
#define HEAP_RUNTIME_SIZE \
(HEAP_COUNT64 * 64 + HEAP_COUNT128 * 128 + \
HEAP_COUNT256 * 256 + HEAP_COUNT512 * 512 + \
HEAP_COUNT1024 * 1024 + HEAP_COUNT2048 * 2048 + \
HEAP_COUNT4096 * 4096)
/* Heap section sizes for runtime shared heap */
#define HEAP_RUNTIME_SHARED_COUNT64 (64 + 32 * CONFIG_CORE_COUNT)
#define HEAP_RUNTIME_SHARED_COUNT128 64
#define HEAP_RUNTIME_SHARED_COUNT256 4
#define HEAP_RUNTIME_SHARED_COUNT512 16
#define HEAP_RUNTIME_SHARED_COUNT1024 4
#define HEAP_RUNTIME_SHARED_SIZE \
(HEAP_RUNTIME_SHARED_COUNT64 * 64 + HEAP_RUNTIME_SHARED_COUNT128 * 128 + \
HEAP_RUNTIME_SHARED_COUNT256 * 256 + HEAP_RUNTIME_SHARED_COUNT512 * 512 + \
HEAP_RUNTIME_SHARED_COUNT1024 * 1024)
/* Heap section sizes for system shared heap */
#define HEAP_SYSTEM_SHARED_SIZE 0x1500
#define HEAP_BUFFER_BLOCK_SIZE 0x100
#define HEAP_BUFFER_COUNT_MAX (HP_SRAM_SIZE / HEAP_BUFFER_BLOCK_SIZE)
#define HEAP_SYSTEM_M_SIZE 0x4000 /* heap primary core size */
#define HEAP_SYSTEM_S_SIZE 0x3000 /* heap secondary core size */
#define HEAP_SYSTEM_T_SIZE \
(HEAP_SYSTEM_M_SIZE + ((CONFIG_CORE_COUNT - 1) * HEAP_SYSTEM_S_SIZE))
#define HEAP_SYS_RUNTIME_M_SIZE \
(HEAP_SYS_RT_0_COUNT64 * 64 + HEAP_SYS_RT_0_COUNT512 * 512 + \
HEAP_SYS_RT_0_COUNT1024 * 1024)
#define HEAP_SYS_RUNTIME_S_SIZE \
(HEAP_SYS_RT_X_COUNT64 * 64 + HEAP_SYS_RT_X_COUNT512 * 512 + \
HEAP_SYS_RT_X_COUNT1024 * 1024)
#define HEAP_SYS_RUNTIME_T_SIZE \
(HEAP_SYS_RUNTIME_M_SIZE + ((CONFIG_CORE_COUNT - 1) * \
HEAP_SYS_RUNTIME_S_SIZE))
/* Heap section sizes for module pool */
#define HEAP_RT_LP_COUNT8 0
#define HEAP_RT_LP_COUNT16 256
#define HEAP_RT_LP_COUNT32 128
#define HEAP_RT_LP_COUNT64 64
#define HEAP_RT_LP_COUNT128 64
#define HEAP_RT_LP_COUNT256 96
#define HEAP_RT_LP_COUNT512 8
#define HEAP_RT_LP_COUNT1024 4
/* Heap configuration */
#define SOF_LP_DATA_SIZE 0x4000
#define HEAP_LP_SYSTEM_BASE (LP_SRAM_BASE + SOF_LP_DATA_SIZE)
#define HEAP_LP_SYSTEM_SIZE 0x1000
#define HEAP_LP_RUNTIME_BASE \
(HEAP_LP_SYSTEM_BASE + HEAP_LP_SYSTEM_SIZE)
#define HEAP_LP_RUNTIME_SIZE \
(HEAP_RT_LP_COUNT8 * 8 + HEAP_RT_LP_COUNT16 * 16 + \
HEAP_RT_LP_COUNT32 * 32 + HEAP_RT_LP_COUNT64 * 64 + \
HEAP_RT_LP_COUNT128 * 128 + HEAP_RT_LP_COUNT256 * 256 + \
HEAP_RT_LP_COUNT512 * 512 + HEAP_RT_LP_COUNT1024 * 1024)
#define HEAP_LP_BUFFER_BLOCK_SIZE 0x180
#define HEAP_LP_BUFFER_COUNT \
(HEAP_LP_BUFFER_SIZE / HEAP_LP_BUFFER_BLOCK_SIZE)
#define HEAP_LP_BUFFER_BASE LP_SRAM_BASE
#define HEAP_LP_BUFFER_SIZE LP_SRAM_SIZE
/* SOF Core S configuration */
#define SOF_CORE_S_SIZE \
ALIGN((HEAP_SYSTEM_S_SIZE + HEAP_SYS_RUNTIME_S_SIZE + SOF_STACK_SIZE),\
SRAM_BANK_SIZE)
#define SOF_CORE_S_T_SIZE ((CONFIG_CORE_COUNT - 1) * SOF_CORE_S_SIZE)
#define host_to_local(addr) (addr)
#define local_to_host(addr) (addr)
#define IMR_BOOT_LDR_MANIFEST_BASE NULL
#endif /* __PLATFORM_LIB_MEMORY_H__ */
#else
#error "This file shouldn't be included from outside of sof/lib/memory.h"
#endif /* __SOF_LIB_MEMORY_H__ */