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