1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_FB_PRIV_H__
3 #define __NVKM_FB_PRIV_H__
4 #define nvkm_fb(p) container_of((p), struct nvkm_fb, subdev)
5 #include <subdev/fb.h>
6 #include <subdev/therm.h>
7 struct nvkm_bios;
8 
9 struct nvkm_fb_func {
10 	void *(*dtor)(struct nvkm_fb *);
11 	u32 (*tags)(struct nvkm_fb *);
12 	int (*oneinit)(struct nvkm_fb *);
13 	void (*init)(struct nvkm_fb *);
14 	void (*init_remapper)(struct nvkm_fb *);
15 	int (*init_page)(struct nvkm_fb *);
16 	void (*init_unkn)(struct nvkm_fb *);
17 	void (*intr)(struct nvkm_fb *);
18 
19 	struct nvkm_fb_func_sysmem {
20 		void (*flush_page_init)(struct nvkm_fb *);
21 	} sysmem;
22 
23 	struct nvkm_fb_func_vidmem {
24 		u64 (*size)(struct nvkm_fb *);
25 	} vidmem;
26 
27 	struct {
28 		bool (*scrub_required)(struct nvkm_fb *);
29 		int (*scrub)(struct nvkm_fb *);
30 	} vpr;
31 
32 	struct {
33 		int regions;
34 		void (*init)(struct nvkm_fb *, int i, u32 addr, u32 size,
35 			     u32 pitch, u32 flags, struct nvkm_fb_tile *);
36 		void (*comp)(struct nvkm_fb *, int i, u32 size, u32 flags,
37 			     struct nvkm_fb_tile *);
38 		void (*fini)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
39 		void (*prog)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
40 	} tile;
41 
42 	int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
43 
44 	u8 default_bigpage;
45 	const struct nvkm_therm_clkgate_pack *clkgate_pack;
46 };
47 
48 int nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
49 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb *);
50 int nvkm_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *device,
51 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb **);
52 int nvkm_fb_bios_memtype(struct nvkm_bios *);
53 
54 void nv10_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
55 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
56 void nv10_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
57 void nv10_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
58 
59 u32 nv20_fb_tags(struct nvkm_fb *);
60 void nv20_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
61 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
62 void nv20_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
63 void nv20_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
64 
65 void nv30_fb_init(struct nvkm_fb *);
66 void nv30_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
67 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
68 
69 void nv40_fb_tile_comp(struct nvkm_fb *, int i, u32 size, u32 flags,
70 		       struct nvkm_fb_tile *);
71 
72 void nv41_fb_init(struct nvkm_fb *);
73 void nv41_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
74 
75 void nv44_fb_init(struct nvkm_fb *);
76 void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
77 
78 void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
79 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
80 
81 int gf100_fb_oneinit(struct nvkm_fb *);
82 int gf100_fb_init_page(struct nvkm_fb *);
83 void gf100_fb_sysmem_flush_page_init(struct nvkm_fb *);
84 
85 int gm200_fb_init_page(struct nvkm_fb *);
86 
87 void gp100_fb_init_remapper(struct nvkm_fb *);
88 void gp100_fb_init_unkn(struct nvkm_fb *);
89 
90 int gp102_fb_oneinit(struct nvkm_fb *);
91 u64 gp102_fb_vidmem_size(struct nvkm_fb *);
92 bool gp102_fb_vpr_scrub_required(struct nvkm_fb *);
93 int gp102_fb_vpr_scrub(struct nvkm_fb *);
94 
95 int gv100_fb_init_page(struct nvkm_fb *);
96 
97 bool tu102_fb_vpr_scrub_required(struct nvkm_fb *);
98 #endif
99