From b5acc421ee159c932e9e95adaa6d89a0c2141b38 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Wed, 26 Mar 2014 11:49:04 -0700 Subject: 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 Reviewed-on: http://git-master/r/389793 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | 41 +++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c index 59404f1d..478bc073 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; +} -- cgit v1.2.2