Lines Matching refs:mmu

22 #include <nvif/mmu.h>
28 nvif_mmu_dtor(struct nvif_mmu *mmu)
30 if (!nvif_object_constructed(&mmu->object))
33 kfree(mmu->kind);
34 kfree(mmu->type);
35 kfree(mmu->heap);
36 nvif_object_dtor(&mmu->object);
41 struct nvif_mmu *mmu)
53 mmu->heap = NULL;
54 mmu->type = NULL;
55 mmu->kind = NULL;
58 &args, sizeof(args), &mmu->object);
62 mmu->dmabits = args.dmabits;
63 mmu->heap_nr = args.heap_nr;
64 mmu->type_nr = args.type_nr;
65 mmu->kind_nr = args.kind_nr;
67 ret = nvif_mclass(&mmu->object, mems);
70 mmu->mem = mems[ret].oclass;
72 mmu->heap = kmalloc_array(mmu->heap_nr, sizeof(*mmu->heap),
74 mmu->type = kmalloc_array(mmu->type_nr, sizeof(*mmu->type),
76 if (ret = -ENOMEM, !mmu->heap || !mmu->type)
79 mmu->kind = kmalloc_array(mmu->kind_nr, sizeof(*mmu->kind),
81 if (!mmu->kind && mmu->kind_nr)
84 for (i = 0; i < mmu->heap_nr; i++) {
87 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_HEAP,
92 mmu->heap[i].size = args.size;
95 for (i = 0; i < mmu->type_nr; i++) {
98 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_TYPE,
103 mmu->type[i].type = 0;
104 if (args.vram) mmu->type[i].type |= NVIF_MEM_VRAM;
105 if (args.host) mmu->type[i].type |= NVIF_MEM_HOST;
106 if (args.comp) mmu->type[i].type |= NVIF_MEM_COMP;
107 if (args.disp) mmu->type[i].type |= NVIF_MEM_DISP;
108 if (args.kind ) mmu->type[i].type |= NVIF_MEM_KIND;
109 if (args.mappable) mmu->type[i].type |= NVIF_MEM_MAPPABLE;
110 if (args.coherent) mmu->type[i].type |= NVIF_MEM_COHERENT;
111 if (args.uncached) mmu->type[i].type |= NVIF_MEM_UNCACHED;
112 mmu->type[i].heap = args.heap;
115 if (mmu->kind_nr) {
117 size_t argc = struct_size(kind, data, mmu->kind_nr);
122 kind->count = mmu->kind_nr;
124 ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_KIND,
127 memcpy(mmu->kind, kind->data, kind->count);
128 mmu->kind_inv = kind->kind_inv;
134 nvif_mmu_dtor(mmu);