diff options
author | Kevin Huang <kevinh@nvidia.com> | 2014-03-26 11:49:04 -0700 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2014-03-31 04:01:39 -0700 |
commit | e6792ccac118d6b087df4ae425129323e19e00a3 (patch) | |
tree | e54bdf516d26909acc652d56df534237a8d2aab9 /drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | |
parent | 2ac28aa128a04f9bfa16ed27106be0dc544de741 (diff) |
video: tegra: host: flexible to select fw per chip
Decouple the firmware selection of different gpu architecture.
Change-Id: I62bf6b3bc51a8606c5973e475988cd5987a65a1a
Signed-off-by: Kevin Huang <kevinh@nvidia.com>
Reviewed-on: http://git-master/r/389793
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c index 59404f1d8868..478bc0730b3a 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c @@ -96,6 +96,15 @@ static int gr_gk20a_get_netlist_name(int index, char *name) return -1; } +bool gr_gk20a_is_firmware_defined(void) +{ +#ifdef GK20A_NETLIST_IMAGE_FW_NAME + return true; +#else + return false; +#endif +} + static int gr_gk20a_init_ctx_vars_fw(struct gk20a *g, struct gr_gk20a *gr) { struct device *d = dev_from_gk20a(g); @@ -107,21 +116,21 @@ static int gr_gk20a_init_ctx_vars_fw(struct gk20a *g, struct gr_gk20a *gr) gk20a_dbg_fn(""); -#ifdef GK20A_NETLIST_IMAGE_FW_NAME - net = NETLIST_FINAL; - max = 0; - major_v_hw = ~0; - g->gr.ctx_vars.dynamic = false; -#else - net = NETLIST_SLOT_A; - max = MAX_NETLIST; - major_v_hw = gk20a_readl(g, gr_fecs_ctx_state_store_major_rev_id_r()); - g->gr.ctx_vars.dynamic = true; -#endif + if (g->ops.gr_ctx.is_fw_defined()) { + net = NETLIST_FINAL; + max = 0; + major_v_hw = ~0; + g->gr.ctx_vars.dynamic = false; + } else { + net = NETLIST_SLOT_A; + max = MAX_NETLIST; + major_v_hw = gk20a_readl(g, + gr_fecs_ctx_state_store_major_rev_id_r()); + g->gr.ctx_vars.dynamic = true; + } for (; net < max; net++) { - - if (gr_gk20a_get_netlist_name(net, name) != 0) { + if (g->ops.gr_ctx.get_netlist_name(net, name) != 0) { gk20a_warn(d, "invalid netlist index %d", net); continue; } @@ -331,3 +340,9 @@ int gr_gk20a_init_ctx_vars(struct gk20a *g, struct gr_gk20a *gr) else return gr_gk20a_init_ctx_vars_fw(g, gr); } + +void gk20a_init_gr_ctx(struct gpu_ops *gops) +{ + gops->gr_ctx.get_netlist_name = gr_gk20a_get_netlist_name; + gops->gr_ctx.is_fw_defined = gr_gk20a_is_firmware_defined; +} |