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
25 struct drm_device
*dev
;
27 struct nvkm_vma bar_vma
;
28 struct nvkm_vma vma
[2];
31 struct nvkm_mm_node
*tag
;
32 struct list_head regions
;
41 struct nvkm_mm_node
*tag
;
49 const struct nvkm_fb_func
*func
;
50 struct nvkm_subdev subdev
;
55 struct nvkm_fb_tile region
[16];
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
;
101 NVKM_RAM_TYPE_UNKNOWN
= 0,
102 NVKM_RAM_TYPE_STOLEN
,
115 const struct nvkm_ram_func
*func
;
117 enum nvkm_ram_type type
;
120 #define NVKM_RAM_MM_SHIFT 12
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
*);