1 #ifndef __NOUVEAU_MM_H__
2 #define __NOUVEAU_MM_H__
3
4 struct nouveau_mm_node {
5 struct list_head nl_entry;
6 struct list_head fl_entry;
7 struct list_head rl_entry;
8
9 #define NVKM_MM_HEAP_ANY 0x00
10 u8 heap;
11 #define NVKM_MM_TYPE_NONE 0x00
12 #define NVKM_MM_TYPE_HOLE 0xff
13 u8 type;
14 u32 offset;
15 u32 length;
16 };
17
18 struct nouveau_mm {
19 struct list_head nodes;
20 struct list_head free;
21
22 u32 block_size;
23 int heap_nodes;
24 };
25
26 static inline bool
nouveau_mm_initialised(struct nouveau_mm * mm)27 nouveau_mm_initialised(struct nouveau_mm *mm)
28 {
29 return mm->block_size != 0;
30 }
31
32 int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
33 int nouveau_mm_fini(struct nouveau_mm *);
34 int nouveau_mm_head(struct nouveau_mm *, u8 heap, u8 type, u32 size_max,
35 u32 size_min, u32 align, struct nouveau_mm_node **);
36 int nouveau_mm_tail(struct nouveau_mm *, u8 heap, u8 type, u32 size_max,
37 u32 size_min, u32 align, struct nouveau_mm_node **);
38 void nouveau_mm_free(struct nouveau_mm *, struct nouveau_mm_node **);
39
40 #endif
41