1 #ifndef __NVKM_PM_PRIV_H__
2 #define __NVKM_PM_PRIV_H__
3 #define nvkm_pm(p) container_of((p), struct nvkm_pm, engine)
4 #include <engine/pm.h>
5 
6 int nvkm_pm_ctor(const struct nvkm_pm_func *, struct nvkm_device *,
7 		 int index, struct nvkm_pm *);
8 
9 struct nvkm_pm_func {
10 	void (*fini)(struct nvkm_pm *);
11 };
12 
13 struct nvkm_perfctr {
14 	struct list_head head;
15 	u8 domain;
16 	u8  signal[4];
17 	u64 source[4][8];
18 	int slot;
19 	u32 logic_op;
20 	u32 ctr;
21 };
22 
23 struct nvkm_specmux {
24 	u32 mask;
25 	u8 shift;
26 	const char *name;
27 	bool enable;
28 };
29 
30 struct nvkm_specsrc {
31 	u32 addr;
32 	const struct nvkm_specmux *mux;
33 	const char *name;
34 };
35 
36 struct nvkm_perfsrc {
37 	struct list_head head;
38 	char *name;
39 	u32 addr;
40 	u32 mask;
41 	u8 shift;
42 	bool enable;
43 };
44 
45 extern const struct nvkm_specsrc nv50_zcull_sources[];
46 extern const struct nvkm_specsrc nv50_zrop_sources[];
47 extern const struct nvkm_specsrc g84_vfetch_sources[];
48 extern const struct nvkm_specsrc gt200_crop_sources[];
49 extern const struct nvkm_specsrc gt200_prop_sources[];
50 extern const struct nvkm_specsrc gt200_tex_sources[];
51 
52 struct nvkm_specsig {
53 	u8 signal;
54 	const char *name;
55 	const struct nvkm_specsrc *source;
56 };
57 
58 struct nvkm_perfsig {
59 	const char *name;
60 	u8 source[8];
61 };
62 
63 struct nvkm_specdom {
64 	u16 signal_nr;
65 	const struct nvkm_specsig *signal;
66 	const struct nvkm_funcdom *func;
67 };
68 
69 #define nvkm_perfdom(p) container_of((p), struct nvkm_perfdom, object)
70 
71 struct nvkm_perfdom {
72 	struct nvkm_object object;
73 	struct nvkm_perfmon *perfmon;
74 	struct list_head head;
75 	struct list_head list;
76 	const struct nvkm_funcdom *func;
77 	struct nvkm_perfctr *ctr[4];
78 	char name[32];
79 	u32 addr;
80 	u8  mode;
81 	u32 clk;
82 	u16 signal_nr;
83 	struct nvkm_perfsig signal[];
84 };
85 
86 struct nvkm_funcdom {
87 	void (*init)(struct nvkm_pm *, struct nvkm_perfdom *,
88 		     struct nvkm_perfctr *);
89 	void (*read)(struct nvkm_pm *, struct nvkm_perfdom *,
90 		     struct nvkm_perfctr *);
91 	void (*next)(struct nvkm_pm *, struct nvkm_perfdom *);
92 };
93 
94 int nvkm_perfdom_new(struct nvkm_pm *, const char *, u32, u32, u32, u32,
95 		     const struct nvkm_specdom *);
96 
97 #define nvkm_perfmon(p) container_of((p), struct nvkm_perfmon, object)
98 
99 struct nvkm_perfmon {
100 	struct nvkm_object object;
101 	struct nvkm_pm *pm;
102 };
103 #endif
104