Home | History | Annotate | Line # | Download | only in pmu
      1 /*	$NetBSD: priv.h,v 1.3 2021/12/18 23:45:41 riastradh Exp $	*/
      2 
      3 /* SPDX-License-Identifier: MIT */
      4 #ifndef __NVKM_PMU_PRIV_H__
      5 #define __NVKM_PMU_PRIV_H__
      6 #define nvkm_pmu(p) container_of((p), struct nvkm_pmu, subdev)
      7 #include <subdev/pmu.h>
      8 #include <subdev/pmu/fuc/os.h>
      9 enum nvkm_acr_lsf_id;
     10 struct nvkm_acr_lsfw;
     11 
     12 struct nvkm_pmu_func {
     13 	const struct nvkm_falcon_func *flcn;
     14 
     15 	struct {
     16 		u32 *data;
     17 		u32  size;
     18 	} code;
     19 
     20 	struct {
     21 		u32 *data;
     22 		u32  size;
     23 	} data;
     24 
     25 	bool (*enabled)(struct nvkm_pmu *);
     26 	void (*reset)(struct nvkm_pmu *);
     27 	int (*init)(struct nvkm_pmu *);
     28 	void (*fini)(struct nvkm_pmu *);
     29 	void (*intr)(struct nvkm_pmu *);
     30 	int (*send)(struct nvkm_pmu *, u32 reply[2], u32 process,
     31 		    u32 message, u32 data0, u32 data1);
     32 	void (*recv)(struct nvkm_pmu *);
     33 	int (*initmsg)(struct nvkm_pmu *);
     34 	void (*pgob)(struct nvkm_pmu *, bool);
     35 };
     36 
     37 extern const struct nvkm_falcon_func gt215_pmu_flcn;
     38 int gt215_pmu_init(struct nvkm_pmu *);
     39 void gt215_pmu_fini(struct nvkm_pmu *);
     40 void gt215_pmu_intr(struct nvkm_pmu *);
     41 void gt215_pmu_recv(struct nvkm_pmu *);
     42 int gt215_pmu_send(struct nvkm_pmu *, u32[2], u32, u32, u32, u32);
     43 
     44 bool gf100_pmu_enabled(struct nvkm_pmu *);
     45 void gf100_pmu_reset(struct nvkm_pmu *);
     46 
     47 void gk110_pmu_pgob(struct nvkm_pmu *, bool);
     48 
     49 void gm20b_pmu_acr_bld_patch(struct nvkm_acr *, u32, s64);
     50 void gm20b_pmu_acr_bld_write(struct nvkm_acr *, u32, struct nvkm_acr_lsfw *);
     51 int gm20b_pmu_acr_boot(struct nvkm_falcon *);
     52 int gm20b_pmu_acr_bootstrap_falcon(struct nvkm_falcon *, enum nvkm_acr_lsf_id);
     53 void gm20b_pmu_recv(struct nvkm_pmu *);
     54 int gm20b_pmu_initmsg(struct nvkm_pmu *);
     55 
     56 struct nvkm_pmu_fwif {
     57 	int version;
     58 	int (*load)(struct nvkm_pmu *, int ver, const struct nvkm_pmu_fwif *);
     59 	const struct nvkm_pmu_func *func;
     60 	const struct nvkm_acr_lsf_func *acr;
     61 };
     62 
     63 int gf100_pmu_nofw(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
     64 int gm20b_pmu_load(struct nvkm_pmu *, int, const struct nvkm_pmu_fwif *);
     65 
     66 int nvkm_pmu_ctor(const struct nvkm_pmu_fwif *, struct nvkm_device *,
     67 		  int index, struct nvkm_pmu *);
     68 int nvkm_pmu_new_(const struct nvkm_pmu_fwif *, struct nvkm_device *,
     69 		  int index, struct nvkm_pmu **);
     70 #endif
     71