forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphys_mem.h
77 lines (66 loc) · 2.19 KB
/
phys_mem.h
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
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (c) 2024, Linaro Limited
*/
#ifndef __MM_PHYS_MEM_H
#define __MM_PHYS_MEM_H
#include <mm/tee_mm.h>
#include <types_ext.h>
void nex_phys_mem_init(paddr_t core_base, paddr_size_t core_size,
paddr_t ta_base, paddr_size_t ta_size);
paddr_size_t nex_phys_mem_get_ta_size(void);
paddr_t nex_phys_mem_get_ta_base(void);
tee_mm_entry_t *nex_phys_mem_mm_find(paddr_t addr);
tee_mm_entry_t *nex_phys_mem_core_alloc(size_t size);
tee_mm_entry_t *nex_phys_mem_ta_alloc(size_t size);
tee_mm_entry_t *nex_phys_mem_alloc2(paddr_t base, size_t size);
void nex_phys_mem_partial_carve_out(paddr_t base, size_t size);
#ifdef CFG_WITH_STATS
void nex_phys_mem_stats(struct pta_stats_alloc *stats, bool reset);
#endif
#ifdef CFG_NS_VIRTUALIZATION
void phys_mem_init(paddr_t core_base, paddr_size_t core_size,
paddr_t ta_base, paddr_size_t ta_size);
tee_mm_entry_t *phys_mem_mm_find(paddr_t addr);
tee_mm_entry_t *phys_mem_core_alloc(size_t size);
tee_mm_entry_t *phys_mem_ta_alloc(size_t size);
tee_mm_entry_t *phys_mem_alloc2(paddr_t base, size_t size);
#ifdef CFG_WITH_STATS
void phys_mem_stats(struct pta_stats_alloc *stats, bool reset);
#endif
#else
static inline void phys_mem_init(paddr_t core_base, paddr_size_t core_size,
paddr_t ta_base, paddr_size_t ta_size)
{
nex_phys_mem_init(core_base, core_size, ta_base, ta_size);
}
static inline tee_mm_entry_t *phys_mem_mm_find(paddr_t addr)
{
return nex_phys_mem_mm_find(addr);
}
static inline tee_mm_entry_t *phys_mem_core_alloc(size_t size)
{
return nex_phys_mem_core_alloc(size);
}
static inline tee_mm_entry_t *phys_mem_ta_alloc(size_t size)
{
return nex_phys_mem_ta_alloc(size);
}
static inline tee_mm_entry_t *phys_mem_alloc2(paddr_t base, size_t size)
{
return nex_phys_mem_alloc2(base, size);
}
#ifdef CFG_WITH_STATS
static inline void phys_mem_stats(struct pta_stats_alloc *stats, bool reset)
{
return nex_phys_mem_stats(stats, reset);
}
#endif
#endif
/*
* MAF_NEX selects nexus physical memory
* MAF_CORE_MEM selects core physical memory
* flags are passed on underlying implementation, tee_mm_alloc_flags().
*/
tee_mm_entry_t *phys_mem_alloc_flags(size_t size, uint32_t flags);
#endif /*__MM_PHYS_MEM_H*/