1 /* SPDX-License-Identifier: MIT */ 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 #include <core/object.h> 72 73 struct nvkm_perfdom { 74 struct nvkm_object object; 75 struct nvkm_perfmon *perfmon; 76 struct list_head head; 77 struct list_head list; 78 const struct nvkm_funcdom *func; 79 struct nvkm_perfctr *ctr[4]; 80 char name[32]; 81 u32 addr; 82 u8 mode; 83 u32 clk; 84 u16 signal_nr; 85 struct nvkm_perfsig signal[]; 86 }; 87 88 struct nvkm_funcdom { 89 void (*init)(struct nvkm_pm *, struct nvkm_perfdom *, 90 struct nvkm_perfctr *); 91 void (*read)(struct nvkm_pm *, struct nvkm_perfdom *, 92 struct nvkm_perfctr *); 93 void (*next)(struct nvkm_pm *, struct nvkm_perfdom *); 94 }; 95 96 int nvkm_perfdom_new(struct nvkm_pm *, const char *, u32, u32, u32, u32, 97 const struct nvkm_specdom *); 98 99 #define nvkm_perfmon(p) container_of((p), struct nvkm_perfmon, object) 100 101 struct nvkm_perfmon { 102 struct nvkm_object object; 103 struct nvkm_pm *pm; 104 }; 105 #endif 106