1 /* SPDX-License-Identifier: GPL-2.0 */
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 	int (*init_page)(struct nvkm_fb *);
15 	void (*init_unkn)(struct nvkm_fb *);
16 	void (*intr)(struct nvkm_fb *);
17 
18 	struct {
19 		int regions;
20 		void (*init)(struct nvkm_fb *, int i, u32 addr, u32 size,
21 			     u32 pitch, u32 flags, struct nvkm_fb_tile *);
22 		void (*comp)(struct nvkm_fb *, int i, u32 size, u32 flags,
23 			     struct nvkm_fb_tile *);
24 		void (*fini)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
25 		void (*prog)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
26 	} tile;
27 
28 	int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
29 
30 	u8 default_bigpage;
31 	const struct nvkm_therm_clkgate_pack *clkgate_pack;
32 };
33 
34 void nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
35 		  int index, struct nvkm_fb *);
36 int nvkm_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *device,
37 		 int index, struct nvkm_fb **);
38 int nvkm_fb_bios_memtype(struct nvkm_bios *);
39 
40 void nv10_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
41 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
42 void nv10_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
43 void nv10_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
44 
45 u32 nv20_fb_tags(struct nvkm_fb *);
46 void nv20_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
47 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
48 void nv20_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
49 void nv20_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
50 
51 void nv30_fb_init(struct nvkm_fb *);
52 void nv30_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
53 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
54 
55 void nv40_fb_tile_comp(struct nvkm_fb *, int i, u32 size, u32 flags,
56 		       struct nvkm_fb_tile *);
57 
58 void nv41_fb_init(struct nvkm_fb *);
59 void nv41_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
60 
61 void nv44_fb_init(struct nvkm_fb *);
62 void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
63 
64 void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
65 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
66 
67 int gf100_fb_oneinit(struct nvkm_fb *);
68 int gf100_fb_init_page(struct nvkm_fb *);
69 
70 int gm200_fb_init_page(struct nvkm_fb *);
71 #endif
72