Lines Matching defs:mm
29 #include <core/mm.h>
31 #define node(root, dir) ((root)->nl_entry.dir == &mm->nodes) ? NULL : \
35 nvkm_mm_dump(struct nvkm_mm *mm, const char *header)
41 list_for_each_entry(node, &mm->nodes, nl_entry) {
46 list_for_each_entry(node, &mm->free, fl_entry) {
53 nvkm_mm_free(struct nvkm_mm *mm, struct nvkm_mm_node **pthis)
77 list_for_each_entry(prev, &mm->free, fl_entry) {
91 region_head(struct nvkm_mm *mm, struct nvkm_mm_node *a, u32 size)
116 nvkm_mm_head(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min,
126 list_for_each_entry(this, &mm->free, fl_entry) {
136 s = roundup(s, mm->block_size);
140 e = rounddown(e, mm->block_size);
148 if (splitoff && !region_head(mm, this, splitoff))
151 this = region_head(mm, this, min(size_max, e - s));
166 region_tail(struct nvkm_mm *mm, struct nvkm_mm_node *a, u32 size)
191 nvkm_mm_tail(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min,
199 list_for_each_entry_reverse(this, &mm->free, fl_entry) {
210 s = roundup(s, mm->block_size);
214 e = rounddown(e, mm->block_size);
227 if (c && !region_tail(mm, this, c))
230 this = region_tail(mm, this, a);
245 nvkm_mm_init(struct nvkm_mm *mm, u8 heap, u32 offset, u32 length, u32 block)
250 if (nvkm_mm_initialised(mm)) {
251 prev = list_last_entry(&mm->nodes, typeof(*node), nl_entry);
260 list_add_tail(&node->nl_entry, &mm->nodes);
262 BUG_ON(block != mm->block_size);
264 INIT_LIST_HEAD(&mm->nodes);
265 INIT_LIST_HEAD(&mm->free);
266 mm->block_size = block;
267 mm->heap_nodes = 0;
275 node->offset = roundup(offset, mm->block_size);
276 node->length = rounddown(offset + length, mm->block_size);
280 list_add_tail(&node->nl_entry, &mm->nodes);
281 list_add_tail(&node->fl_entry, &mm->free);
283 mm->heap_nodes++;
288 nvkm_mm_fini(struct nvkm_mm *mm)
293 if (!nvkm_mm_initialised(mm))
296 list_for_each_entry(node, &mm->nodes, nl_entry) {
298 if (++nodes > mm->heap_nodes) {
299 nvkm_mm_dump(mm, "mm not clean!");
305 list_for_each_entry_safe(node, temp, &mm->nodes, nl_entry) {
310 mm->heap_nodes = 0;