aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
blob: 0ac8714fe0ba979c18e40de217bcfd06c9e9ab23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef __NVKM_PERFMON_PRIV_H__
#define __NVKM_PERFMON_PRIV_H__

#include <engine/perfmon.h>

struct nouveau_perfctr {
	struct nouveau_object base;
	struct list_head head;
	struct nouveau_perfsig *signal[4];
	int slot;
	u32 logic_op;
	u32 clk;
	u32 ctr;
};

extern struct nouveau_oclass nouveau_perfmon_sclass[];

struct nouveau_perfctx {
	struct nouveau_engctx base;
};

extern struct nouveau_oclass nouveau_perfmon_cclass;

struct nouveau_specsig {
	u8 signal;
	const char *name;
};

struct nouveau_perfsig {
	const char *name;
};

struct nouveau_perfdom;
struct nouveau_perfctr *
nouveau_perfsig_wrap(struct nouveau_perfmon *, const char *,
		     struct nouveau_perfdom **);

struct nouveau_specdom {
	u16 signal_nr;
	const struct nouveau_specsig *signal;
	const struct nouveau_funcdom *func;
};

extern const struct nouveau_specdom nva3_perfmon_pwr[];
extern const struct nouveau_specdom nvc0_perfmon_pwr[];
extern const struct nouveau_specdom nve0_perfmon_pwr[];

struct nouveau_perfdom {
	struct list_head head;
	struct list_head list;
	const struct nouveau_funcdom *func;
	char name[32];
	u32 addr;
	u8  quad;
	u32 signal_nr;
	struct nouveau_perfsig signal[];
};

struct nouveau_funcdom {
	void (*init)(struct nouveau_perfmon *, struct nouveau_perfdom *,
		     struct nouveau_perfctr *);
	void (*read)(struct nouveau_perfmon *, struct nouveau_perfdom *,
		     struct nouveau_perfctr *);
	void (*next)(struct nouveau_perfmon *, struct nouveau_perfdom *);
};

int nouveau_perfdom_new(struct nouveau_perfmon *, const char *, u32,
			u32, u32, u32, const struct nouveau_specdom *);

#define nouveau_perfmon_create(p,e,o,d)                                        \
	nouveau_perfmon_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_perfmon_dtor(p) ({                                             \
	struct nouveau_perfmon *c = (p);                                       \
	_nouveau_perfmon_dtor(nv_object(c));                                   \
})
#define nouveau_perfmon_init(p) ({                                             \
	struct nouveau_perfmon *c = (p);                                       \
	_nouveau_perfmon_init(nv_object(c));                                   \
})
#define nouveau_perfmon_fini(p,s) ({                                           \
	struct nouveau_perfmon *c = (p);                                       \
	_nouveau_perfmon_fini(nv_object(c), (s));                              \
})

int nouveau_perfmon_create_(struct nouveau_object *, struct nouveau_object *,
			    struct nouveau_oclass *, int, void **);
void _nouveau_perfmon_dtor(struct nouveau_object *);
int  _nouveau_perfmon_init(struct nouveau_object *);
int  _nouveau_perfmon_fini(struct nouveau_object *, bool);

#endif