diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/acr_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index 4fa1b313..2e904fdf 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c | |||
@@ -51,11 +51,6 @@ typedef int (*get_ucode_details)(struct gk20a *g, struct flcn_ucode_img *udata); | |||
51 | static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); | 51 | static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); |
52 | static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); | 52 | static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); |
53 | static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); | 53 | static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img); |
54 | static int gm20b_bootstrap_hs_flcn(struct gk20a *g); | ||
55 | static int pmu_wait_for_halt(struct gk20a *g, unsigned int timeout); | ||
56 | static int clear_halt_interrupt_status(struct gk20a *g, unsigned int timeout); | ||
57 | static int gm20b_init_pmu_setup_hw1(struct gk20a *g, | ||
58 | void *desc, u32 bl_sz); | ||
59 | static int lsfm_discover_ucode_images(struct gk20a *g, | 54 | static int lsfm_discover_ucode_images(struct gk20a *g, |
60 | struct ls_flcn_mgr *plsfm); | 55 | struct ls_flcn_mgr *plsfm); |
61 | static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, | 56 | static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, |
@@ -68,15 +63,6 @@ static int lsf_gen_wpr_requirements(struct gk20a *g, struct ls_flcn_mgr *plsfm); | |||
68 | static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm, | 63 | static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm, |
69 | struct nvgpu_mem *nonwpr); | 64 | struct nvgpu_mem *nonwpr); |
70 | static void free_acr_resources(struct gk20a *g, struct ls_flcn_mgr *plsfm); | 65 | static void free_acr_resources(struct gk20a *g, struct ls_flcn_mgr *plsfm); |
71 | static int gm20b_pmu_populate_loader_cfg(struct gk20a *g, | ||
72 | void *lsfm, u32 *p_bl_gen_desc_size); | ||
73 | static int gm20b_flcn_populate_bl_dmem_desc(struct gk20a *g, | ||
74 | void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid); | ||
75 | static int gm20b_alloc_blob_space(struct gk20a *g, | ||
76 | size_t size, struct nvgpu_mem *mem); | ||
77 | static bool gm20b_is_priv_load(u32 falcon_id); | ||
78 | static bool gm20b_is_lazy_bootstrap(u32 falcon_id); | ||
79 | static void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf); | ||
80 | 66 | ||
81 | /*Globals*/ | 67 | /*Globals*/ |
82 | static get_ucode_details pmu_acr_supp_ucode_list[] = { | 68 | static get_ucode_details pmu_acr_supp_ucode_list[] = { |
@@ -97,7 +83,7 @@ static void start_gm20b_pmu(struct gk20a *g) | |||
97 | pwr_falcon_cpuctl_startcpu_f(1)); | 83 | pwr_falcon_cpuctl_startcpu_f(1)); |
98 | } | 84 | } |
99 | 85 | ||
100 | static void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf) | 86 | void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf) |
101 | { | 87 | { |
102 | struct mc_carveout_info mem_inf; | 88 | struct mc_carveout_info mem_inf; |
103 | 89 | ||
@@ -108,29 +94,11 @@ static void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf) | |||
108 | inf->size = mem_inf.size; | 94 | inf->size = mem_inf.size; |
109 | } | 95 | } |
110 | 96 | ||
111 | static bool gm20b_is_pmu_supported(struct gk20a *g) | 97 | bool gm20b_is_pmu_supported(struct gk20a *g) |
112 | { | 98 | { |
113 | return true; | 99 | return true; |
114 | } | 100 | } |
115 | 101 | ||
116 | void gm20b_init_secure_pmu(struct gpu_ops *gops) | ||
117 | { | ||
118 | gops->pmu.is_pmu_supported = gm20b_is_pmu_supported; | ||
119 | gops->pmu.prepare_ucode = prepare_ucode_blob; | ||
120 | gops->pmu.pmu_setup_hw_and_bootstrap = gm20b_bootstrap_hs_flcn; | ||
121 | gops->pmu.is_lazy_bootstrap = gm20b_is_lazy_bootstrap; | ||
122 | gops->pmu.is_priv_load = gm20b_is_priv_load; | ||
123 | gops->pmu.get_wpr = gm20b_wpr_info; | ||
124 | gops->pmu.alloc_blob_space = gm20b_alloc_blob_space; | ||
125 | gops->pmu.pmu_populate_loader_cfg = gm20b_pmu_populate_loader_cfg; | ||
126 | gops->pmu.flcn_populate_bl_dmem_desc = gm20b_flcn_populate_bl_dmem_desc; | ||
127 | gops->pmu.falcon_wait_for_halt = pmu_wait_for_halt; | ||
128 | gops->pmu.falcon_clear_halt_interrupt_status = | ||
129 | clear_halt_interrupt_status; | ||
130 | gops->pmu.init_falcon_setup_hw = gm20b_init_pmu_setup_hw1; | ||
131 | } | ||
132 | /* TODO - check if any free blob res needed*/ | ||
133 | |||
134 | static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | 102 | static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) |
135 | { | 103 | { |
136 | struct nvgpu_firmware *pmu_fw, *pmu_desc, *pmu_sig; | 104 | struct nvgpu_firmware *pmu_fw, *pmu_desc, *pmu_sig; |
@@ -334,7 +302,7 @@ rel_sig: | |||
334 | return err; | 302 | return err; |
335 | } | 303 | } |
336 | 304 | ||
337 | static bool gm20b_is_lazy_bootstrap(u32 falcon_id) | 305 | bool gm20b_is_lazy_bootstrap(u32 falcon_id) |
338 | { | 306 | { |
339 | bool enable_status = false; | 307 | bool enable_status = false; |
340 | 308 | ||
@@ -352,7 +320,7 @@ static bool gm20b_is_lazy_bootstrap(u32 falcon_id) | |||
352 | return enable_status; | 320 | return enable_status; |
353 | } | 321 | } |
354 | 322 | ||
355 | static bool gm20b_is_priv_load(u32 falcon_id) | 323 | bool gm20b_is_priv_load(u32 falcon_id) |
356 | { | 324 | { |
357 | bool enable_status = false; | 325 | bool enable_status = false; |
358 | 326 | ||
@@ -370,7 +338,7 @@ static bool gm20b_is_priv_load(u32 falcon_id) | |||
370 | return enable_status; | 338 | return enable_status; |
371 | } | 339 | } |
372 | 340 | ||
373 | static int gm20b_alloc_blob_space(struct gk20a *g, | 341 | int gm20b_alloc_blob_space(struct gk20a *g, |
374 | size_t size, struct nvgpu_mem *mem) | 342 | size_t size, struct nvgpu_mem *mem) |
375 | { | 343 | { |
376 | int err; | 344 | int err; |
@@ -554,7 +522,7 @@ static int lsfm_discover_ucode_images(struct gk20a *g, | |||
554 | } | 522 | } |
555 | 523 | ||
556 | 524 | ||
557 | static int gm20b_pmu_populate_loader_cfg(struct gk20a *g, | 525 | int gm20b_pmu_populate_loader_cfg(struct gk20a *g, |
558 | void *lsfm, u32 *p_bl_gen_desc_size) | 526 | void *lsfm, u32 *p_bl_gen_desc_size) |
559 | { | 527 | { |
560 | struct wpr_carveout_info wpr_inf; | 528 | struct wpr_carveout_info wpr_inf; |
@@ -626,7 +594,7 @@ static int gm20b_pmu_populate_loader_cfg(struct gk20a *g, | |||
626 | return 0; | 594 | return 0; |
627 | } | 595 | } |
628 | 596 | ||
629 | static int gm20b_flcn_populate_bl_dmem_desc(struct gk20a *g, | 597 | int gm20b_flcn_populate_bl_dmem_desc(struct gk20a *g, |
630 | void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid) | 598 | void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid) |
631 | { | 599 | { |
632 | struct wpr_carveout_info wpr_inf; | 600 | struct wpr_carveout_info wpr_inf; |
@@ -1066,7 +1034,7 @@ static int lsf_gen_wpr_requirements(struct gk20a *g, struct ls_flcn_mgr *plsfm) | |||
1066 | 1034 | ||
1067 | /*Loads ACR bin to FB mem and bootstraps PMU with bootloader code | 1035 | /*Loads ACR bin to FB mem and bootstraps PMU with bootloader code |
1068 | * start and end are addresses of ucode blob in non-WPR region*/ | 1036 | * start and end are addresses of ucode blob in non-WPR region*/ |
1069 | static int gm20b_bootstrap_hs_flcn(struct gk20a *g) | 1037 | int gm20b_bootstrap_hs_flcn(struct gk20a *g) |
1070 | { | 1038 | { |
1071 | struct mm_gk20a *mm = &g->mm; | 1039 | struct mm_gk20a *mm = &g->mm; |
1072 | struct vm_gk20a *vm = mm->pmu.vm; | 1040 | struct vm_gk20a *vm = mm->pmu.vm; |
@@ -1291,7 +1259,7 @@ int gm20b_init_nspmu_setup_hw1(struct gk20a *g) | |||
1291 | return err; | 1259 | return err; |
1292 | } | 1260 | } |
1293 | 1261 | ||
1294 | static int gm20b_init_pmu_setup_hw1(struct gk20a *g, | 1262 | int gm20b_init_pmu_setup_hw1(struct gk20a *g, |
1295 | void *desc, u32 bl_sz) | 1263 | void *desc, u32 bl_sz) |
1296 | { | 1264 | { |
1297 | 1265 | ||
@@ -1461,7 +1429,7 @@ err_done: | |||
1461 | * @param[in] timeout_ms Timeout in msec for PMU to halt | 1429 | * @param[in] timeout_ms Timeout in msec for PMU to halt |
1462 | * @return '0' if PMU halts | 1430 | * @return '0' if PMU halts |
1463 | */ | 1431 | */ |
1464 | static int pmu_wait_for_halt(struct gk20a *g, unsigned int timeout_ms) | 1432 | int pmu_wait_for_halt(struct gk20a *g, unsigned int timeout_ms) |
1465 | { | 1433 | { |
1466 | struct nvgpu_pmu *pmu = &g->pmu; | 1434 | struct nvgpu_pmu *pmu = &g->pmu; |
1467 | u32 data = 0; | 1435 | u32 data = 0; |
@@ -1490,7 +1458,7 @@ static int pmu_wait_for_halt(struct gk20a *g, unsigned int timeout_ms) | |||
1490 | * @param[in] timeout_ms Timeout in msec for halt to clear | 1458 | * @param[in] timeout_ms Timeout in msec for halt to clear |
1491 | * @return '0' if PMU halt irq status is clear | 1459 | * @return '0' if PMU halt irq status is clear |
1492 | */ | 1460 | */ |
1493 | static int clear_halt_interrupt_status(struct gk20a *g, unsigned int timeout_ms) | 1461 | int clear_halt_interrupt_status(struct gk20a *g, unsigned int timeout_ms) |
1494 | { | 1462 | { |
1495 | struct nvgpu_pmu *pmu = &g->pmu; | 1463 | struct nvgpu_pmu *pmu = &g->pmu; |
1496 | int status = 0; | 1464 | int status = 0; |