| 1 | #ifndef __NVKM_PERFMON_PRIV_H__ |
| 2 | #define __NVKM_PERFMON_PRIV_H__ |
| 3 | |
| 4 | #include <engine/perfmon.h> |
| 5 | |
| 6 | struct nouveau_perfctr { |
| 7 | struct nouveau_object base; |
| 8 | struct list_head head; |
| 9 | struct nouveau_perfsig *signal[4]; |
| 10 | int slot; |
| 11 | u32 logic_op; |
| 12 | u32 clk; |
| 13 | u32 ctr; |
| 14 | }; |
| 15 | |
| 16 | extern struct nouveau_oclass nouveau_perfmon_sclass[]; |
| 17 | |
| 18 | struct nouveau_perfctx { |
| 19 | struct nouveau_engctx base; |
| 20 | }; |
| 21 | |
| 22 | extern struct nouveau_oclass nouveau_perfmon_cclass; |
| 23 | |
| 24 | struct nouveau_specsig { |
| 25 | u8 signal; |
| 26 | const char *name; |
| 27 | }; |
| 28 | |
| 29 | struct nouveau_perfsig { |
| 30 | const char *name; |
| 31 | }; |
| 32 | |
| 33 | struct nouveau_perfdom; |
| 34 | struct nouveau_perfctr * |
| 35 | nouveau_perfsig_wrap(struct nouveau_perfmon *, const char *, |
| 36 | struct nouveau_perfdom **); |
| 37 | |
| 38 | struct nouveau_specdom { |
| 39 | u16 signal_nr; |
| 40 | const struct nouveau_specsig *signal; |
| 41 | const struct nouveau_funcdom *func; |
| 42 | }; |
| 43 | |
| 44 | extern const struct nouveau_specdom nva3_perfmon_pwr[]; |
| 45 | extern const struct nouveau_specdom nvc0_perfmon_pwr[]; |
| 46 | extern const struct nouveau_specdom nve0_perfmon_pwr[]; |
| 47 | |
| 48 | struct nouveau_perfdom { |
| 49 | struct list_head head; |
| 50 | struct list_head list; |
| 51 | const struct nouveau_funcdom *func; |
| 52 | char name[32]; |
| 53 | u32 addr; |
| 54 | u8 quad; |
| 55 | u32 signal_nr; |
| 56 | struct nouveau_perfsig signal[]; |
| 57 | }; |
| 58 | |
| 59 | struct nouveau_funcdom { |
| 60 | void (*init)(struct nouveau_perfmon *, struct nouveau_perfdom *, |
| 61 | struct nouveau_perfctr *); |
| 62 | void (*read)(struct nouveau_perfmon *, struct nouveau_perfdom *, |
| 63 | struct nouveau_perfctr *); |
| 64 | void (*next)(struct nouveau_perfmon *, struct nouveau_perfdom *); |
| 65 | }; |
| 66 | |
| 67 | int nouveau_perfdom_new(struct nouveau_perfmon *, const char *, u32, |
| 68 | u32, u32, u32, const struct nouveau_specdom *); |
| 69 | |
| 70 | #define nouveau_perfmon_create(p,e,o,d) \ |
| 71 | nouveau_perfmon_create_((p), (e), (o), sizeof(**d), (void **)d) |
| 72 | #define nouveau_perfmon_dtor(p) ({ \ |
| 73 | struct nouveau_perfmon *c = (p); \ |
| 74 | _nouveau_perfmon_dtor(nv_object(c)); \ |
| 75 | }) |
| 76 | #define nouveau_perfmon_init(p) ({ \ |
| 77 | struct nouveau_perfmon *c = (p); \ |
| 78 | _nouveau_perfmon_init(nv_object(c)); \ |
| 79 | }) |
| 80 | #define nouveau_perfmon_fini(p,s) ({ \ |
| 81 | struct nouveau_perfmon *c = (p); \ |
| 82 | _nouveau_perfmon_fini(nv_object(c), (s)); \ |
| 83 | }) |
| 84 | |
| 85 | int nouveau_perfmon_create_(struct nouveau_object *, struct nouveau_object *, |
| 86 | struct nouveau_oclass *, int, void **); |
| 87 | void _nouveau_perfmon_dtor(struct nouveau_object *); |
| 88 | int _nouveau_perfmon_init(struct nouveau_object *); |
| 89 | int _nouveau_perfmon_fini(struct nouveau_object *, bool); |
| 90 | |
| 91 | #endif |
| 92 | |