1 #ifndef __NV50_KMS_CORE_H__
2 #define __NV50_KMS_CORE_H__
3 #include "disp.h"
4 #include "atom.h"
5 #include "crc.h"
6 #include <nouveau_encoder.h>
7 
8 struct nv50_core {
9 	const struct nv50_core_func *func;
10 	struct nv50_dmac chan;
11 	bool assign_windows;
12 };
13 
14 int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
15 void nv50_core_del(struct nv50_core **);
16 
17 struct nv50_core_func {
18 	int (*init)(struct nv50_core *);
19 	void (*ntfy_init)(struct nouveau_bo *, u32 offset);
20 	int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
21 	int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
22 			      struct nvif_device *);
23 	int (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
24 
25 	struct {
26 		int (*owner)(struct nv50_core *);
27 	} wndw;
28 
29 	const struct nv50_head_func *head;
30 #if IS_ENABLED(CONFIG_DEBUG_FS)
31 	const struct nv50_crc_func *crc;
32 #endif
33 	const struct nv50_outp_func {
34 		int (*ctrl)(struct nv50_core *, int or, u32 ctrl,
35 			     struct nv50_head_atom *);
36 		/* XXX: Only used by SORs and PIORs for now */
37 		void (*get_caps)(struct nv50_disp *,
38 				 struct nouveau_encoder *, int or);
39 	} *dac, *pior, *sor;
40 };
41 
42 int core507d_new(struct nouveau_drm *, s32, struct nv50_core **);
43 int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
44 		  struct nv50_core **);
45 int core507d_init(struct nv50_core *);
46 void core507d_ntfy_init(struct nouveau_bo *, u32);
47 int core507d_read_caps(struct nv50_disp *disp);
48 int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
49 int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
50 int core507d_update(struct nv50_core *, u32 *, bool);
51 
52 extern const struct nv50_outp_func dac507d;
53 extern const struct nv50_outp_func sor507d;
54 extern const struct nv50_outp_func pior507d;
55 
56 int core827d_new(struct nouveau_drm *, s32, struct nv50_core **);
57 
58 int core907d_new(struct nouveau_drm *, s32, struct nv50_core **);
59 int core907d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp);
60 extern const struct nv50_outp_func dac907d;
61 extern const struct nv50_outp_func sor907d;
62 
63 int core917d_new(struct nouveau_drm *, s32, struct nv50_core **);
64 
65 int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **);
66 int corec37d_caps_init(struct nouveau_drm *, struct nv50_disp *);
67 int corec37d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
68 int corec37d_update(struct nv50_core *, u32 *, bool);
69 int corec37d_wndw_owner(struct nv50_core *);
70 extern const struct nv50_outp_func sorc37d;
71 
72 int corec57d_new(struct nouveau_drm *, s32, struct nv50_core **);
73 #endif
74