Lines Matching refs:mobj

24 struct mobj *mobj_tee_ram_rx;
25 struct mobj *mobj_tee_ram_rw;
32 struct mobj mobj; member
40 static struct mobj_phys *to_mobj_phys(struct mobj *mobj);
42 static void *mobj_phys_get_va(struct mobj *mobj, size_t offset, size_t len) in mobj_phys_get_va() argument
44 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_get_va()
46 if (!moph->va || !mobj_check_offset_and_len(mobj, offset, len)) in mobj_phys_get_va()
52 static TEE_Result mobj_phys_get_pa(struct mobj *mobj, size_t offs, in mobj_phys_get_pa() argument
55 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_get_pa()
75 static TEE_Result mobj_phys_get_mem_type(struct mobj *mobj, uint32_t *mem_type) in mobj_phys_get_mem_type() argument
77 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_get_mem_type()
86 static bool mobj_phys_matches(struct mobj *mobj, enum buf_is_attr attr) in mobj_phys_matches() argument
88 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_matches()
108 static void mobj_phys_free(struct mobj *mobj) in mobj_phys_free() argument
110 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_free()
129 static struct mobj_phys *to_mobj_phys(struct mobj *mobj) in to_mobj_phys() argument
131 assert(mobj->ops == &mobj_phys_ops); in to_mobj_phys()
132 return container_of(mobj, struct mobj_phys, mobj); in to_mobj_phys()
135 static struct mobj *mobj_phys_init(paddr_t pa, size_t size, uint32_t mem_type, in mobj_phys_init()
170 moph->mobj.size = size; in mobj_phys_init()
171 moph->mobj.ops = &mobj_phys_ops; in mobj_phys_init()
172 refcount_set(&moph->mobj.refc, 1); in mobj_phys_init()
176 return &moph->mobj; in mobj_phys_init()
179 struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t mem_type, in mobj_phys_alloc()
203 static void mobj_virt_assert_type(struct mobj *mobj);
205 static void *mobj_virt_get_va(struct mobj *mobj, size_t offset, in mobj_virt_get_va() argument
208 mobj_virt_assert_type(mobj); in mobj_virt_get_va()
209 assert(mobj_check_offset_and_len(mobj, offset, len)); in mobj_virt_get_va()
223 static void mobj_virt_assert_type(struct mobj *mobj __maybe_unused) in mobj_virt_assert_type()
225 assert(mobj->ops == &mobj_virt_ops); in mobj_virt_assert_type()
228 struct mobj mobj_virt = { .ops = &mobj_virt_ops, .size = SIZE_MAX };
239 struct mobj mobj; member
244 static struct mobj_shm *to_mobj_shm(struct mobj *mobj);
246 static void *mobj_shm_get_va(struct mobj *mobj, size_t offset, size_t len) in mobj_shm_get_va() argument
248 struct mobj_shm *m = to_mobj_shm(mobj); in mobj_shm_get_va()
250 if (!mobj_check_offset_and_len(mobj, offset, len)) in mobj_shm_get_va()
254 mobj->size - offset); in mobj_shm_get_va()
257 static TEE_Result mobj_shm_get_pa(struct mobj *mobj, size_t offs, in mobj_shm_get_pa() argument
260 struct mobj_shm *m = to_mobj_shm(mobj); in mobj_shm_get_pa()
263 if (!pa || offs >= mobj->size) in mobj_shm_get_pa()
280 static size_t mobj_shm_get_phys_offs(struct mobj *mobj, size_t granule) in mobj_shm_get_phys_offs() argument
283 return to_mobj_shm(mobj)->pa & (granule - 1); in mobj_shm_get_phys_offs()
286 static bool mobj_shm_matches(struct mobj *mobj __unused, enum buf_is_attr attr) in mobj_shm_matches()
291 static TEE_Result mobj_shm_get_mem_type(struct mobj *mobj __unused, in mobj_shm_get_mem_type()
302 static void mobj_shm_free(struct mobj *mobj) in mobj_shm_free() argument
304 struct mobj_shm *m = to_mobj_shm(mobj); in mobj_shm_free()
309 static uint64_t mobj_shm_get_cookie(struct mobj *mobj) in mobj_shm_get_cookie() argument
311 return to_mobj_shm(mobj)->cookie; in mobj_shm_get_cookie()
329 static struct mobj_shm *to_mobj_shm(struct mobj *mobj) in to_mobj_shm() argument
331 assert(mobj->ops == &mobj_shm_ops); in to_mobj_shm()
332 return container_of(mobj, struct mobj_shm, mobj); in to_mobj_shm()
335 struct mobj *mobj_shm_alloc(paddr_t pa, size_t size, uint64_t cookie) in mobj_shm_alloc()
346 m->mobj.size = size; in mobj_shm_alloc()
347 m->mobj.ops = &mobj_shm_ops; in mobj_shm_alloc()
348 m->mobj.phys_granule = SMALL_PAGE_SIZE; in mobj_shm_alloc()
349 refcount_set(&m->mobj.refc, 1); in mobj_shm_alloc()
353 return &m->mobj; in mobj_shm_alloc()
359 struct mobj mobj; member
365 struct mobj *mobj_with_fobj_alloc(struct fobj *fobj, struct file *file, in mobj_with_fobj_alloc()
381 m->mobj.ops = &mobj_with_fobj_ops; in mobj_with_fobj_alloc()
382 refcount_set(&m->mobj.refc, 1); in mobj_with_fobj_alloc()
383 m->mobj.size = fobj->num_pages * SMALL_PAGE_SIZE; in mobj_with_fobj_alloc()
384 m->mobj.phys_granule = SMALL_PAGE_SIZE; in mobj_with_fobj_alloc()
389 return &m->mobj; in mobj_with_fobj_alloc()
392 static struct mobj_with_fobj *to_mobj_with_fobj(struct mobj *mobj) in to_mobj_with_fobj() argument
394 assert(mobj && mobj->ops == &mobj_with_fobj_ops); in to_mobj_with_fobj()
396 return container_of(mobj, struct mobj_with_fobj, mobj); in to_mobj_with_fobj()
399 static bool mobj_with_fobj_matches(struct mobj *mobj __maybe_unused, in mobj_with_fobj_matches()
402 assert(to_mobj_with_fobj(mobj)); in mobj_with_fobj_matches()
413 static void mobj_with_fobj_free(struct mobj *mobj) in mobj_with_fobj_free() argument
415 struct mobj_with_fobj *m = to_mobj_with_fobj(mobj); in mobj_with_fobj_free()
422 static struct fobj *mobj_with_fobj_get_fobj(struct mobj *mobj) in mobj_with_fobj_get_fobj() argument
424 return fobj_get(to_mobj_with_fobj(mobj)->fobj); in mobj_with_fobj_get_fobj()
427 static TEE_Result mobj_with_fobj_get_mem_type(struct mobj *mobj, in mobj_with_fobj_get_mem_type() argument
430 struct mobj_with_fobj *m = to_mobj_with_fobj(mobj); in mobj_with_fobj_get_mem_type()
440 static TEE_Result mobj_with_fobj_get_pa(struct mobj *mobj, size_t offs, in mobj_with_fobj_get_pa() argument
443 struct mobj_with_fobj *f = to_mobj_with_fobj(mobj); in mobj_with_fobj_get_pa()
447 assert(mobj_is_paged(mobj)); in mobj_with_fobj_get_pa()
481 bool mobj_is_paged(struct mobj *mobj) in mobj_is_paged() argument
483 if (mobj->ops == &mobj_with_fobj_ops && in mobj_is_paged()
484 !to_mobj_with_fobj(mobj)->fobj->ops->get_pa) in mobj_is_paged()