1#ifndef __NVKM_FB_PRIV_H__
2#define __NVKM_FB_PRIV_H__
3#include <subdev/fb.h>
4struct nvkm_bios;
5
6#define nvkm_ram_create(p,e,o,d)                                            \
7	nvkm_object_create_((p), (e), (o), 0, sizeof(**d), (void **)d)
8#define nvkm_ram_destroy(p)                                                 \
9	nvkm_object_destroy(&(p)->base)
10#define nvkm_ram_init(p)                                                    \
11	nvkm_object_init(&(p)->base)
12#define nvkm_ram_fini(p,s)                                                  \
13	nvkm_object_fini(&(p)->base, (s))
14
15#define nvkm_ram_create_(p,e,o,s,d)                                         \
16	nvkm_object_create_((p), (e), (o), 0, (s), (void **)d)
17#define _nvkm_ram_dtor nvkm_object_destroy
18#define _nvkm_ram_init nvkm_object_init
19#define _nvkm_ram_fini nvkm_object_fini
20
21extern struct nvkm_oclass nv04_ram_oclass;
22extern struct nvkm_oclass nv10_ram_oclass;
23extern struct nvkm_oclass nv1a_ram_oclass;
24extern struct nvkm_oclass nv20_ram_oclass;
25extern struct nvkm_oclass nv40_ram_oclass;
26extern struct nvkm_oclass nv41_ram_oclass;
27extern struct nvkm_oclass nv44_ram_oclass;
28extern struct nvkm_oclass nv49_ram_oclass;
29extern struct nvkm_oclass nv4e_ram_oclass;
30extern struct nvkm_oclass nv50_ram_oclass;
31extern struct nvkm_oclass gt215_ram_oclass;
32extern struct nvkm_oclass mcp77_ram_oclass;
33extern struct nvkm_oclass gf100_ram_oclass;
34extern struct nvkm_oclass gk104_ram_oclass;
35extern struct nvkm_oclass gm107_ram_oclass;
36
37int nvkm_sddr2_calc(struct nvkm_ram *ram);
38int nvkm_sddr3_calc(struct nvkm_ram *ram);
39int nvkm_gddr3_calc(struct nvkm_ram *ram);
40int nvkm_gddr5_calc(struct nvkm_ram *ram, bool nuts);
41
42#define nvkm_fb_create(p,e,c,d)                                             \
43	nvkm_fb_create_((p), (e), (c), sizeof(**d), (void **)d)
44#define nvkm_fb_destroy(p) ({                                               \
45	struct nvkm_fb *pfb = (p);                                          \
46	_nvkm_fb_dtor(nv_object(pfb));                                      \
47})
48#define nvkm_fb_init(p) ({                                                  \
49	struct nvkm_fb *pfb = (p);                                          \
50	_nvkm_fb_init(nv_object(pfb));                                      \
51})
52#define nvkm_fb_fini(p,s) ({                                                \
53	struct nvkm_fb *pfb = (p);                                          \
54	_nvkm_fb_fini(nv_object(pfb), (s));                                 \
55})
56
57int nvkm_fb_create_(struct nvkm_object *, struct nvkm_object *,
58		       struct nvkm_oclass *, int, void **);
59void _nvkm_fb_dtor(struct nvkm_object *);
60int  _nvkm_fb_init(struct nvkm_object *);
61int  _nvkm_fb_fini(struct nvkm_object *, bool);
62
63struct nvkm_fb_impl {
64	struct nvkm_oclass base;
65	struct nvkm_oclass *ram;
66	bool (*memtype)(struct nvkm_fb *, u32);
67};
68
69bool nv04_fb_memtype_valid(struct nvkm_fb *, u32 memtype);
70bool nv50_fb_memtype_valid(struct nvkm_fb *, u32 memtype);
71
72int  nvkm_fb_bios_memtype(struct nvkm_bios *);
73#endif
74