posix-clock: Fix return code on the poll method's error path
[linux/fpc-iii.git] / drivers / gpu / drm / nouveau / include / nvkm / subdev / fb.h
blob85ab72c7f821eff59e9021cc88d42cf4e63bc1a6
1 #ifndef __NVKM_FB_H__
2 #define __NVKM_FB_H__
3 #include <core/subdev.h>
5 #include <subdev/mmu.h>
7 /* memory type/access flags, do not match hardware values */
8 #define NV_MEM_ACCESS_RO 1
9 #define NV_MEM_ACCESS_WO 2
10 #define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
11 #define NV_MEM_ACCESS_SYS 4
12 #define NV_MEM_ACCESS_VM 8
13 #define NV_MEM_ACCESS_NOSNOOP 16
15 #define NV_MEM_TARGET_VRAM 0
16 #define NV_MEM_TARGET_PCI 1
17 #define NV_MEM_TARGET_PCI_NOSNOOP 2
18 #define NV_MEM_TARGET_VM 3
19 #define NV_MEM_TARGET_GART 4
21 #define NVKM_RAM_TYPE_VM 0x7f
22 #define NV_MEM_COMP_VM 0x03
24 struct nvkm_mem {
25 struct drm_device *dev;
27 struct nvkm_vma bar_vma;
28 struct nvkm_vma vma[2];
29 u8 page_shift;
31 struct nvkm_mm_node *tag;
32 struct list_head regions;
33 dma_addr_t *pages;
34 u32 memtype;
35 u64 offset;
36 u64 size;
37 struct sg_table *sg;
40 struct nvkm_fb_tile {
41 struct nvkm_mm_node *tag;
42 u32 addr;
43 u32 limit;
44 u32 pitch;
45 u32 zcomp;
48 struct nvkm_fb {
49 const struct nvkm_fb_func *func;
50 struct nvkm_subdev subdev;
52 struct nvkm_ram *ram;
54 struct {
55 struct nvkm_fb_tile region[16];
56 int regions;
57 } tile;
60 bool nvkm_fb_memtype_valid(struct nvkm_fb *, u32 memtype);
61 void nvkm_fb_tile_init(struct nvkm_fb *, int region, u32 addr, u32 size,
62 u32 pitch, u32 flags, struct nvkm_fb_tile *);
63 void nvkm_fb_tile_fini(struct nvkm_fb *, int region, struct nvkm_fb_tile *);
64 void nvkm_fb_tile_prog(struct nvkm_fb *, int region, struct nvkm_fb_tile *);
66 int nv04_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
67 int nv10_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
68 int nv1a_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
69 int nv20_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
70 int nv25_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
71 int nv30_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
72 int nv35_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
73 int nv36_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
74 int nv40_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
75 int nv41_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
76 int nv44_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
77 int nv46_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
78 int nv47_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
79 int nv49_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
80 int nv4e_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
81 int nv50_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
82 int g84_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
83 int gt215_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
84 int mcp77_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
85 int mcp89_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
86 int gf100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
87 int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
88 int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
89 int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
91 #include <subdev/bios.h>
92 #include <subdev/bios/ramcfg.h>
94 struct nvkm_ram_data {
95 struct list_head head;
96 struct nvbios_ramcfg bios;
97 u32 freq;
100 enum nvkm_ram_type {
101 NVKM_RAM_TYPE_UNKNOWN = 0,
102 NVKM_RAM_TYPE_STOLEN,
103 NVKM_RAM_TYPE_SGRAM,
104 NVKM_RAM_TYPE_SDRAM,
105 NVKM_RAM_TYPE_DDR1,
106 NVKM_RAM_TYPE_DDR2,
107 NVKM_RAM_TYPE_DDR3,
108 NVKM_RAM_TYPE_GDDR2,
109 NVKM_RAM_TYPE_GDDR3,
110 NVKM_RAM_TYPE_GDDR4,
111 NVKM_RAM_TYPE_GDDR5
114 struct nvkm_ram {
115 const struct nvkm_ram_func *func;
116 struct nvkm_fb *fb;
117 enum nvkm_ram_type type;
118 u64 size;
120 #define NVKM_RAM_MM_SHIFT 12
121 struct nvkm_mm vram;
122 struct nvkm_mm tags;
123 u64 stolen;
125 int ranks;
126 int parts;
127 int part_mask;
129 u32 freq;
130 u32 mr[16];
131 u32 mr1_nuts;
133 struct nvkm_ram_data *next;
134 struct nvkm_ram_data former;
135 struct nvkm_ram_data xition;
136 struct nvkm_ram_data target;
139 struct nvkm_ram_func {
140 void *(*dtor)(struct nvkm_ram *);
141 int (*init)(struct nvkm_ram *);
143 int (*get)(struct nvkm_ram *, u64 size, u32 align, u32 size_nc,
144 u32 type, struct nvkm_mem **);
145 void (*put)(struct nvkm_ram *, struct nvkm_mem **);
147 int (*calc)(struct nvkm_ram *, u32 freq);
148 int (*prog)(struct nvkm_ram *);
149 void (*tidy)(struct nvkm_ram *);
151 #endif