summaryrefslogtreecommitdiff
path: root/core/arch/arm/mm/mobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/arch/arm/mm/mobj.c')
-rw-r--r--core/arch/arm/mm/mobj.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/core/arch/arm/mm/mobj.c b/core/arch/arm/mm/mobj.c
index 5458638..6daef50 100644
--- a/core/arch/arm/mm/mobj.c
+++ b/core/arch/arm/mm/mobj.c
@@ -114,12 +114,13 @@ static bool mobj_phys_matches(struct mobj *mobj, enum buf_is_attr attr)
switch (attr) {
case CORE_MEM_SEC:
return a == CORE_MEM_SEC || a == CORE_MEM_TEE_RAM ||
- a == CORE_MEM_TA_RAM;
+ a == CORE_MEM_TA_RAM || a == CORE_MEM_SDP_MEM;
case CORE_MEM_NON_SEC:
return a == CORE_MEM_NSEC_SHM;
case CORE_MEM_TEE_RAM:
case CORE_MEM_TA_RAM:
case CORE_MEM_NSEC_SHM:
+ case CORE_MEM_SDP_MEM:
return attr == a;
default:
return false;
@@ -151,6 +152,7 @@ struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
enum buf_is_attr battr)
{
struct mobj_phys *moph;
+ enum teecore_memtypes area_type;
void *va;
if ((pa & CORE_MMU_USER_PARAM_MASK) ||
@@ -159,8 +161,27 @@ struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
return NULL;
}
- va = phys_to_virt(pa, battr);
- if (!va)
+ switch (battr) {
+ case CORE_MEM_TEE_RAM:
+ area_type = MEM_AREA_TEE_RAM;
+ break;
+ case CORE_MEM_TA_RAM:
+ area_type = MEM_AREA_TA_RAM;
+ break;
+ case CORE_MEM_NSEC_SHM:
+ area_type = MEM_AREA_NSEC_SHM;
+ break;
+ case CORE_MEM_SDP_MEM:
+ area_type = MEM_AREA_SDP_MEM;
+ break;
+ default:
+ DMSG("can't allocate with specified attribute");
+ return NULL;
+ }
+
+ /* Only SDP memory may not have a virtual address */
+ va = phys_to_virt(pa, area_type);
+ if (!va && battr != CORE_MEM_SDP_MEM)
return NULL;
moph = calloc(1, sizeof(*moph));