treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / nouveau / include / nvif / mmu.h
blobcec1e88a0a05c7eee4cd4fc08d4a6e70f93f1139
1 #ifndef __NVIF_MMU_H__
2 #define __NVIF_MMU_H__
3 #include <nvif/object.h>
5 struct nvif_mmu {
6 struct nvif_object object;
7 u8 dmabits;
8 u8 heap_nr;
9 u8 type_nr;
10 u8 kind_inv;
11 u16 kind_nr;
12 s32 mem;
14 struct {
15 u64 size;
16 } *heap;
18 struct {
19 #define NVIF_MEM_VRAM 0x01
20 #define NVIF_MEM_HOST 0x02
21 #define NVIF_MEM_COMP 0x04
22 #define NVIF_MEM_DISP 0x08
23 #define NVIF_MEM_KIND 0x10
24 #define NVIF_MEM_MAPPABLE 0x20
25 #define NVIF_MEM_COHERENT 0x40
26 #define NVIF_MEM_UNCACHED 0x80
27 u8 type;
28 u8 heap;
29 } *type;
31 u8 *kind;
34 int nvif_mmu_init(struct nvif_object *, s32 oclass, struct nvif_mmu *);
35 void nvif_mmu_fini(struct nvif_mmu *);
37 static inline bool
38 nvif_mmu_kind_valid(struct nvif_mmu *mmu, u8 kind)
40 if (kind) {
41 if (kind >= mmu->kind_nr || mmu->kind[kind] == mmu->kind_inv)
42 return false;
44 return true;
47 static inline int
48 nvif_mmu_type(struct nvif_mmu *mmu, u8 mask)
50 int i;
51 for (i = 0; i < mmu->type_nr; i++) {
52 if ((mmu->type[i].type & mask) == mask)
53 return i;
55 return -EINVAL;
57 #endif