Skip to content

Commit a2ac447

Browse files
marcinszkudlinskilgirdwood
authored andcommitted
mem: move struct vmh_heap to c file for privacy
struct vmh_heap is a private structure and should not be used outside of regions_mm.c file structure moved Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent 1ef6f66 commit a2ac447

4 files changed

Lines changed: 29 additions & 27 deletions

File tree

zephyr/include/sof/lib/regions_mm.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,6 @@
4444
*/
4545
#define DEFAULT_CONFIG_ALOCATORS_COUNT 5
4646

47-
/** @struct vmh_heap
48-
*
49-
* @brief This structure holds all information about virtual memory heap
50-
* it aggregates information about its allocations and
51-
* physical mappings.
52-
*
53-
* @var node generic list member used for list operations
54-
* @var virtual_region pointer to virtual region information, it holds its
55-
* attributes size and beginning ptr provided by zephyr.
56-
* @var physical_blocks_allocators[] a table of block allocators
57-
* each representing a virtual regions part in blocks of a given size
58-
* governed by sys_mem_blocks API.
59-
* @var allocation_sizes[] a table of bit arrays representing sizes of allocations
60-
* made in physical_blocks_allocators directly related to physical_blocks_allocators
61-
* @var core_id id of the core that heap was created on
62-
* @var allocating_continuously configuration value deciding if heap allocations
63-
* will be contiguous or single block.
64-
*/
65-
struct vmh_heap {
66-
struct list_item node;
67-
const struct sys_mm_drv_region *virtual_region;
68-
struct sys_mem_blocks *physical_blocks_allocators[MAX_MEMORY_ALLOCATORS_COUNT];
69-
struct sys_bitarray *allocation_sizes[MAX_MEMORY_ALLOCATORS_COUNT];
70-
int core_id;
71-
bool allocating_continuously;
72-
};
73-
7447
/** @struct vmh_block_bundle_descriptor
7548
*
7649
* @brief This is a struct describing one bundle of blocks

zephyr/lib/alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#if CONFIG_VIRTUAL_HEAP
2222
#include <sof/lib/regions_mm.h>
2323

24+
struct vmh_heap;
2425
struct vmh_heap *virtual_buffers_heap[CONFIG_MP_MAX_NUM_CPUS];
2526
struct k_spinlock vmh_lock;
2627

zephyr/lib/regions_mm.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@
1313
/* list of vmh_heap objects created */
1414
static struct list_item vmh_list = LIST_INIT(vmh_list);
1515

16+
/** @struct vmh_heap
17+
*
18+
* @brief This structure holds all information about virtual memory heap
19+
* it aggregates information about its allocations and
20+
* physical mappings.
21+
*
22+
* @var node generic list member used for list operations
23+
* @var virtual_region pointer to virtual region information, it holds its
24+
* attributes size and beginning ptr provided by zephyr.
25+
* @var physical_blocks_allocators[] a table of block allocators
26+
* each representing a virtual regions part in blocks of a given size
27+
* governed by sys_mem_blocks API.
28+
* @var allocation_sizes[] a table of bit arrays representing sizes of allocations
29+
* made in physical_blocks_allocators directly related to physical_blocks_allocators
30+
* @var core_id id of the core that heap was created on
31+
* @var allocating_continuously configuration value deciding if heap allocations
32+
* will be contiguous or single block.
33+
*/
34+
struct vmh_heap {
35+
struct list_item node;
36+
const struct sys_mm_drv_region *virtual_region;
37+
struct sys_mem_blocks *physical_blocks_allocators[MAX_MEMORY_ALLOCATORS_COUNT];
38+
struct sys_bitarray *allocation_sizes[MAX_MEMORY_ALLOCATORS_COUNT];
39+
int core_id;
40+
bool allocating_continuously;
41+
};
42+
1643
/**
1744
* @brief Initialize new heap
1845
*

zephyr/test/vmh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <zephyr/ztest.h>
1818

1919
LOG_MODULE_DECLARE(sof_boot_test, CONFIG_SOF_LOG_LEVEL);
20+
struct vmh_heap;
2021

2122
/* Test creating and freeing a virtual memory heap */
2223
static void test_vmh_init_and_free_heap(int memory_region_attribute,

0 commit comments

Comments
 (0)