| .. | .. |
|---|
| 25 | 25 | #include <nvif/if000a.h> |
|---|
| 26 | 26 | |
|---|
| 27 | 27 | int |
|---|
| 28 | | -nvif_mem_init_map(struct nvif_mmu *mmu, u8 type, u64 size, struct nvif_mem *mem) |
|---|
| 28 | +nvif_mem_ctor_map(struct nvif_mmu *mmu, const char *name, u8 type, u64 size, |
|---|
| 29 | + struct nvif_mem *mem) |
|---|
| 29 | 30 | { |
|---|
| 30 | | - int ret = nvif_mem_init(mmu, mmu->mem, NVIF_MEM_MAPPABLE | type, 0, |
|---|
| 31 | | - size, NULL, 0, mem); |
|---|
| 31 | + int ret = nvif_mem_ctor(mmu, name, mmu->mem, NVIF_MEM_MAPPABLE | type, |
|---|
| 32 | + 0, size, NULL, 0, mem); |
|---|
| 32 | 33 | if (ret == 0) { |
|---|
| 33 | 34 | ret = nvif_object_map(&mem->object, NULL, 0); |
|---|
| 34 | 35 | if (ret) |
|---|
| 35 | | - nvif_mem_fini(mem); |
|---|
| 36 | + nvif_mem_dtor(mem); |
|---|
| 36 | 37 | } |
|---|
| 37 | 38 | return ret; |
|---|
| 38 | 39 | } |
|---|
| 39 | 40 | |
|---|
| 40 | 41 | void |
|---|
| 41 | | -nvif_mem_fini(struct nvif_mem *mem) |
|---|
| 42 | +nvif_mem_dtor(struct nvif_mem *mem) |
|---|
| 42 | 43 | { |
|---|
| 43 | | - nvif_object_fini(&mem->object); |
|---|
| 44 | + nvif_object_dtor(&mem->object); |
|---|
| 44 | 45 | } |
|---|
| 45 | 46 | |
|---|
| 46 | 47 | int |
|---|
| 47 | | -nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, |
|---|
| 48 | | - u64 size, void *argv, u32 argc, struct nvif_mem *mem) |
|---|
| 48 | +nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name, s32 oclass, |
|---|
| 49 | + int type, u8 page, u64 size, void *argv, u32 argc, |
|---|
| 50 | + struct nvif_mem *mem) |
|---|
| 49 | 51 | { |
|---|
| 50 | 52 | struct nvif_mem_v0 *args; |
|---|
| 51 | 53 | u8 stack[128]; |
|---|
| .. | .. |
|---|
| 67 | 69 | args->size = size; |
|---|
| 68 | 70 | memcpy(args->data, argv, argc); |
|---|
| 69 | 71 | |
|---|
| 70 | | - ret = nvif_object_init(&mmu->object, 0, oclass, args, |
|---|
| 71 | | - sizeof(*args) + argc, &mem->object); |
|---|
| 72 | + ret = nvif_object_ctor(&mmu->object, name ? name : "nvifMem", 0, oclass, |
|---|
| 73 | + args, sizeof(*args) + argc, &mem->object); |
|---|
| 72 | 74 | if (ret == 0) { |
|---|
| 73 | 75 | mem->type = mmu->type[type].type; |
|---|
| 74 | 76 | mem->page = args->page; |
|---|
| .. | .. |
|---|
| 83 | 85 | } |
|---|
| 84 | 86 | |
|---|
| 85 | 87 | int |
|---|
| 86 | | -nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, |
|---|
| 87 | | - u64 size, void *argv, u32 argc, struct nvif_mem *mem) |
|---|
| 88 | +nvif_mem_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, u8 type, |
|---|
| 89 | + u8 page, u64 size, void *argv, u32 argc, struct nvif_mem *mem) |
|---|
| 88 | 90 | { |
|---|
| 89 | 91 | int ret = -EINVAL, i; |
|---|
| 90 | 92 | |
|---|
| .. | .. |
|---|
| 92 | 94 | |
|---|
| 93 | 95 | for (i = 0; ret && i < mmu->type_nr; i++) { |
|---|
| 94 | 96 | if ((mmu->type[i].type & type) == type) { |
|---|
| 95 | | - ret = nvif_mem_init_type(mmu, oclass, i, page, size, |
|---|
| 96 | | - argv, argc, mem); |
|---|
| 97 | + ret = nvif_mem_ctor_type(mmu, name, oclass, i, page, |
|---|
| 98 | + size, argv, argc, mem); |
|---|
| 97 | 99 | } |
|---|
| 98 | 100 | } |
|---|
| 99 | 101 | |
|---|