1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright(c) 2022 Intel Corporation. All rights reserved.
4  *
5  * Author: Jakub Dabek <jakub.dabek@intel.com>
6  */
7 
8 #ifndef ZEPHYR_LIB_REGIONS_MM_H_
9 #define ZEPHYR_LIB_REGIONS_MM_H_
10 
11 #include <adsp_memory.h>
12 #include <adsp_memory_regions.h>
13 #include <zephyr/drivers/mm/system_mm.h>
14 #include <zephyr/sys/mem_blocks.h>
15 #include <zephyr/init.h>
16 #include <ipc/topology.h>
17 
18 /*
19  * Struct containing information on virtual memory heap.
20  * Information about allocated physical blocks is stored in
21  * physical_blocks_allocators variable and uses zephyr memblocks api.
22  */
23 struct virtual_memory_heap {
24 	/* zephyr provided virtual region */
25 	struct sys_mm_drv_region *virtual_region;
26 	/* physical pages allocators represented in memblocks */
27 	struct sys_multi_mem_blocks physical_blocks_allocators;
28 	/* SOF memory capability */
29 	uint32_t memory_caps;
30 };
31 
32 /* Available externaly array containing all information on virtual heaps
33  * Used to control physical allocations and overall virtual to physicall
34  * mapping on sof side (zephyr handles the actual assigning physical memory
35  * sof only requests it).
36  */
37 extern struct virtual_memory_heap
38 	vm_heaps[CONFIG_MP_MAX_NUM_CPUS + VIRTUAL_REGION_COUNT];
39 
40 #endif /* ZEPHYR_LIB_REGIONS_MM_H_ */
41