brintos

brintos / linux-shallow public Read only

0
0
Text · 1.4 KiB · 2035ef1 Raw
59 lines · c
1#ifndef __NVIF_MMU_H__2#define __NVIF_MMU_H__3#include <nvif/object.h>4 5struct 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;13 14	struct {15		u64 size;16	} *heap;17 18	struct {19#define NVIF_MEM_VRAM                                                      0x0120#define NVIF_MEM_HOST                                                      0x0221#define NVIF_MEM_COMP                                                      0x0422#define NVIF_MEM_DISP                                                      0x0823#define NVIF_MEM_KIND                                                      0x1024#define NVIF_MEM_MAPPABLE                                                  0x2025#define NVIF_MEM_COHERENT                                                  0x4026#define NVIF_MEM_UNCACHED                                                  0x8027		u8 type;28		u8 heap;29	} *type;30 31	u8 *kind;32};33 34int nvif_mmu_ctor(struct nvif_object *, const char *name, s32 oclass,35		  struct nvif_mmu *);36void nvif_mmu_dtor(struct nvif_mmu *);37 38static inline bool39nvif_mmu_kind_valid(struct nvif_mmu *mmu, u8 kind)40{41	if (kind) {42		if (kind >= mmu->kind_nr || mmu->kind[kind] == mmu->kind_inv)43			return false;44	}45	return true;46}47 48static inline int49nvif_mmu_type(struct nvif_mmu *mmu, u8 mask)50{51	int i;52	for (i = 0; i < mmu->type_nr; i++) {53		if ((mmu->type[i].type & mask) == mask)54			return i;55	}56	return -EINVAL;57}58#endif59