xref: /openbmc/linux/drivers/gpu/drm/nouveau/include/nvfw/pmu.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
186ce2a71SBen Skeggs #ifndef __NVFW_PMU_H__
286ce2a71SBen Skeggs #define __NVFW_PMU_H__
386ce2a71SBen Skeggs 
47a4dde71SBen Skeggs struct nv_pmu_args {
57a4dde71SBen Skeggs 	u32 reserved;
67a4dde71SBen Skeggs 	u32 freq_hz;
77a4dde71SBen Skeggs 	u32 trace_size;
87a4dde71SBen Skeggs 	u32 trace_dma_base;
97a4dde71SBen Skeggs 	u16 trace_dma_base1;
107a4dde71SBen Skeggs 	u8 trace_dma_offset;
117a4dde71SBen Skeggs 	u32 trace_dma_idx;
127a4dde71SBen Skeggs 	bool secure_mode;
137a4dde71SBen Skeggs 	bool raise_priv_sec;
147a4dde71SBen Skeggs 	struct {
157a4dde71SBen Skeggs 		u32 dma_base;
167a4dde71SBen Skeggs 		u16 dma_base1;
177a4dde71SBen Skeggs 		u8 dma_offset;
187a4dde71SBen Skeggs 		u16 fb_size;
197a4dde71SBen Skeggs 		u8 dma_idx;
207a4dde71SBen Skeggs 	} gc6_ctx;
217a4dde71SBen Skeggs 	u8 pad;
227a4dde71SBen Skeggs };
237a4dde71SBen Skeggs 
24d114a139SBen Skeggs #define NV_PMU_UNIT_INIT                                                   0x07
2586ce2a71SBen Skeggs #define NV_PMU_UNIT_ACR                                                    0x0a
2686ce2a71SBen Skeggs 
27d114a139SBen Skeggs struct nv_pmu_init_msg {
28*b448a266STimur Tabi 	struct nvfw_falcon_msg hdr;
29d114a139SBen Skeggs #define NV_PMU_INIT_MSG_INIT                                               0x00
30d114a139SBen Skeggs 	u8 msg_type;
31d114a139SBen Skeggs 
32d114a139SBen Skeggs 	u8 pad;
33d114a139SBen Skeggs 	u16 os_debug_entry_point;
34d114a139SBen Skeggs 
35d114a139SBen Skeggs 	struct {
36d114a139SBen Skeggs 		u16 size;
37d114a139SBen Skeggs 		u16 offset;
38d114a139SBen Skeggs 		u8 index;
39d114a139SBen Skeggs 		u8 pad;
40d114a139SBen Skeggs 	} queue_info[5];
41d114a139SBen Skeggs 
42d114a139SBen Skeggs 	u16 sw_managed_area_offset;
43d114a139SBen Skeggs 	u16 sw_managed_area_size;
44d114a139SBen Skeggs };
45d114a139SBen Skeggs 
4686ce2a71SBen Skeggs struct nv_pmu_acr_cmd {
47*b448a266STimur Tabi 	struct nvfw_falcon_cmd hdr;
4886ce2a71SBen Skeggs #define NV_PMU_ACR_CMD_INIT_WPR_REGION                                     0x00
4986ce2a71SBen Skeggs #define NV_PMU_ACR_CMD_BOOTSTRAP_FALCON                                    0x01
5086ce2a71SBen Skeggs #define NV_PMU_ACR_CMD_BOOTSTRAP_MULTIPLE_FALCONS                          0x03
5186ce2a71SBen Skeggs 	u8 cmd_type;
5286ce2a71SBen Skeggs };
5386ce2a71SBen Skeggs 
5486ce2a71SBen Skeggs struct nv_pmu_acr_msg {
55*b448a266STimur Tabi 	struct nvfw_falcon_cmd hdr;
5686ce2a71SBen Skeggs 	u8 msg_type;
5786ce2a71SBen Skeggs };
5886ce2a71SBen Skeggs 
59d114a139SBen Skeggs struct nv_pmu_acr_init_wpr_region_cmd {
60d114a139SBen Skeggs 	struct nv_pmu_acr_cmd cmd;
61d114a139SBen Skeggs 	u32 region_id;
62d114a139SBen Skeggs 	u32 wpr_offset;
63d114a139SBen Skeggs };
64d114a139SBen Skeggs 
65d114a139SBen Skeggs struct nv_pmu_acr_init_wpr_region_msg {
66d114a139SBen Skeggs 	struct nv_pmu_acr_msg msg;
67d114a139SBen Skeggs 	u32 error_code;
68d114a139SBen Skeggs };
69d114a139SBen Skeggs 
7086ce2a71SBen Skeggs struct nv_pmu_acr_bootstrap_falcon_cmd {
7186ce2a71SBen Skeggs 	struct nv_pmu_acr_cmd cmd;
7286ce2a71SBen Skeggs #define NV_PMU_ACR_BOOTSTRAP_FALCON_FLAGS_RESET_YES                  0x00000000
7386ce2a71SBen Skeggs #define NV_PMU_ACR_BOOTSTRAP_FALCON_FLAGS_RESET_NO                   0x00000001
7486ce2a71SBen Skeggs 	u32 flags;
7586ce2a71SBen Skeggs 	u32 falcon_id;
7686ce2a71SBen Skeggs };
7786ce2a71SBen Skeggs 
7886ce2a71SBen Skeggs struct nv_pmu_acr_bootstrap_falcon_msg {
7986ce2a71SBen Skeggs 	struct nv_pmu_acr_msg msg;
8086ce2a71SBen Skeggs 	u32 falcon_id;
8186ce2a71SBen Skeggs };
8286ce2a71SBen Skeggs 
8386ce2a71SBen Skeggs struct nv_pmu_acr_bootstrap_multiple_falcons_cmd {
8486ce2a71SBen Skeggs 	struct nv_pmu_acr_cmd cmd;
8586ce2a71SBen Skeggs #define NV_PMU_ACR_BOOTSTRAP_MULTIPLE_FALCONS_FLAGS_RESET_YES        0x00000000
8686ce2a71SBen Skeggs #define NV_PMU_ACR_BOOTSTRAP_MULTIPLE_FALCONS_FLAGS_RESET_NO         0x00000001
8786ce2a71SBen Skeggs 	u32 flags;
8886ce2a71SBen Skeggs 	u32 falcon_mask;
8986ce2a71SBen Skeggs 	u32 use_va_mask;
9086ce2a71SBen Skeggs 	u32 wpr_lo;
9186ce2a71SBen Skeggs 	u32 wpr_hi;
9286ce2a71SBen Skeggs };
9386ce2a71SBen Skeggs 
9486ce2a71SBen Skeggs struct nv_pmu_acr_bootstrap_multiple_falcons_msg {
9586ce2a71SBen Skeggs 	struct nv_pmu_acr_msg msg;
9686ce2a71SBen Skeggs 	u32 falcon_mask;
9786ce2a71SBen Skeggs };
9886ce2a71SBen Skeggs #endif
99