Lines Matching refs:dh
59 struct dmm_heap *dh; in dmm_heap_find() local
62 dh = &dmm_heaps_data.dmm_heaps[idx]; in dmm_heap_find()
63 if (dh->region->dt_addr == (uintptr_t)region) { in dmm_heap_find()
64 return dh; in dmm_heap_find()
104 static size_t dmm_heap_start_get(struct dmm_heap *dh) in dmm_heap_start_get() argument
106 return ROUND_UP(dh->region->dt_allc, dh->region->dt_align); in dmm_heap_start_get()
109 static size_t dmm_heap_size_get(struct dmm_heap *dh) in dmm_heap_size_get() argument
111 return (dh->region->dt_size - (dmm_heap_start_get(dh) - dh->region->dt_addr)); in dmm_heap_size_get()
114 static void *dmm_buffer_alloc(struct dmm_heap *dh, size_t length) in dmm_buffer_alloc() argument
116 length = ROUND_UP(length, dh->region->dt_align); in dmm_buffer_alloc()
117 return sys_heap_aligned_alloc(&dh->heap, dh->region->dt_align, length); in dmm_buffer_alloc()
120 static void dmm_buffer_free(struct dmm_heap *dh, void *buffer) in dmm_buffer_free() argument
122 sys_heap_free(&dh->heap, buffer); in dmm_buffer_free()
128 struct dmm_heap *dh; in dmm_buffer_out_prepare() local
137 dh = dmm_heap_find(region); in dmm_buffer_out_prepare()
138 if (dh == NULL) { in dmm_buffer_out_prepare()
147 if (is_user_buffer_correctly_preallocated(user_buffer, user_length, dh->region)) { in dmm_buffer_out_prepare()
155 *buffer_out = dmm_buffer_alloc(dh, user_length); in dmm_buffer_out_prepare()
168 if (is_region_cacheable(dh->region)) { in dmm_buffer_out_prepare()
178 struct dmm_heap *dh; in dmm_buffer_out_release() local
182 dh = dmm_heap_find(region); in dmm_buffer_out_release()
183 if (dh == NULL) { in dmm_buffer_out_release()
190 if (is_buffer_within_region(addr, 0, dmm_heap_start_get(dh), dmm_heap_size_get(dh))) { in dmm_buffer_out_release()
192 dmm_buffer_free(dh, buffer_out); in dmm_buffer_out_release()
201 struct dmm_heap *dh; in dmm_buffer_in_prepare() local
210 dh = dmm_heap_find(region); in dmm_buffer_in_prepare()
211 if (dh == NULL) { in dmm_buffer_in_prepare()
220 if (is_user_buffer_correctly_preallocated(user_buffer, user_length, dh->region)) { in dmm_buffer_in_prepare()
227 *buffer_in = dmm_buffer_alloc(dh, user_length); in dmm_buffer_in_prepare()
238 if (is_region_cacheable(dh->region)) { in dmm_buffer_in_prepare()
248 struct dmm_heap *dh; in dmm_buffer_in_release() local
252 dh = dmm_heap_find(region); in dmm_buffer_in_release()
253 if (dh == NULL) { in dmm_buffer_in_release()
261 if (is_region_cacheable(dh->region)) { in dmm_buffer_in_release()
277 if (is_buffer_within_region(addr, 0, dmm_heap_start_get(dh), dmm_heap_size_get(dh))) { in dmm_buffer_in_release()
279 dmm_buffer_free(dh, buffer_in); in dmm_buffer_in_release()
288 struct dmm_heap *dh; in dmm_init() local
291 dh = &dmm_heaps_data.dmm_heaps[idx]; in dmm_init()
292 dh->region = &dmm_regions[idx]; in dmm_init()
293 sys_heap_init(&dh->heap, (void *)dmm_heap_start_get(dh), dmm_heap_size_get(dh)); in dmm_init()