priv.h 2.1 KB
Newer Older
1 2 3 4
#ifndef __NVKM_PM_PRIV_H__
#define __NVKM_PM_PRIV_H__
#include <engine/pm.h>

5 6
struct nvkm_perfctr {
	struct nvkm_object base;
7
	struct list_head head;
8
	struct nvkm_perfsig *signal[4];
9 10 11 12 13 14
	int slot;
	u32 logic_op;
	u32 clk;
	u32 ctr;
};

15 16 17
extern struct nvkm_oclass nvkm_pm_sclass[];

#include <core/engctx.h>
18

19 20
struct nvkm_perfctx {
	struct nvkm_engctx base;
21 22
};

23
extern struct nvkm_oclass nvkm_pm_cclass;
24

25
struct nvkm_specsig {
26 27 28 29
	u8 signal;
	const char *name;
};

30
struct nvkm_perfsig {
31 32 33
	const char *name;
};

34
struct nvkm_specdom {
35
	u16 signal_nr;
36 37
	const struct nvkm_specsig *signal;
	const struct nvkm_funcdom *func;
38 39
};

40
struct nvkm_perfdom {
41 42
	struct list_head head;
	struct list_head list;
43
	const struct nvkm_funcdom *func;
44 45 46 47
	char name[32];
	u32 addr;
	u8  quad;
	u32 signal_nr;
48
	struct nvkm_perfsig signal[];
49 50
};

51 52 53 54 55 56
struct nvkm_funcdom {
	void (*init)(struct nvkm_pm *, struct nvkm_perfdom *,
		     struct nvkm_perfctr *);
	void (*read)(struct nvkm_pm *, struct nvkm_perfdom *,
		     struct nvkm_perfctr *);
	void (*next)(struct nvkm_pm *, struct nvkm_perfdom *);
57 58
};

59 60
int nvkm_perfdom_new(struct nvkm_pm *, const char *, u32, u32, u32, u32,
		     const struct nvkm_specdom *);
61

62 63 64 65 66
#define nvkm_pm_create(p,e,o,d)                                        \
	nvkm_pm_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nvkm_pm_dtor(p) ({                                             \
	struct nvkm_pm *c = (p);                                       \
	_nvkm_pm_dtor(nv_object(c));                                   \
67
})
68 69 70
#define nvkm_pm_init(p) ({                                             \
	struct nvkm_pm *c = (p);                                       \
	_nvkm_pm_init(nv_object(c));                                   \
71
})
72 73 74
#define nvkm_pm_fini(p,s) ({                                           \
	struct nvkm_pm *c = (p);                                       \
	_nvkm_pm_fini(nv_object(c), (s));                              \
75 76
})

77 78 79 80 81
int nvkm_pm_create_(struct nvkm_object *, struct nvkm_object *,
			    struct nvkm_oclass *, int, void **);
void _nvkm_pm_dtor(struct nvkm_object *);
int  _nvkm_pm_init(struct nvkm_object *);
int  _nvkm_pm_fini(struct nvkm_object *, bool);
82
#endif