diff options
author | Kevin Huang <kevinh@nvidia.com> | 2014-03-26 14:49:04 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:08:54 -0400 |
commit | b5acc421ee159c932e9e95adaa6d89a0c2141b38 (patch) | |
tree | 62ddee386d8da27e1e8f7519d739862137277a9d /drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | |
parent | a9785995d5f22aaeb659285f8aeb64d8b56982e0 (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 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) | |||
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
99 | bool gr_gk20a_is_firmware_defined(void) | ||
100 | { | ||
101 | #ifdef GK20A_NETLIST_IMAGE_FW_NAME | ||
102 | return true; | ||
103 | #else | ||
104 | return false; | ||
105 | #endif | ||
106 | } | ||
107 | |||
99 | static int gr_gk20a_init_ctx_vars_fw(struct gk20a *g, struct gr_gk20a *gr) | 108 | static int gr_gk20a_init_ctx_vars_fw(struct gk20a *g, struct gr_gk20a *gr) |
100 | { | 109 | { |
101 | struct device *d = dev_from_gk20a(g); | 110 | 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) | |||
107 | 116 | ||
108 | gk20a_dbg_fn(""); | 117 | gk20a_dbg_fn(""); |
109 | 118 | ||
110 | #ifdef GK20A_NETLIST_IMAGE_FW_NAME | 119 | if (g->ops.gr_ctx.is_fw_defined()) { |
111 | net = NETLIST_FINAL; | 120 | net = NETLIST_FINAL; |
112 | max = 0; | 121 | max = 0; |
113 | major_v_hw = ~0; | 122 | major_v_hw = ~0; |
114 | g->gr.ctx_vars.dynamic = false; | 123 | g->gr.ctx_vars.dynamic = false; |
115 | #else | 124 | } else { |
116 | net = NETLIST_SLOT_A; | 125 | net = NETLIST_SLOT_A; |
117 | max = MAX_NETLIST; | 126 | max = MAX_NETLIST; |
118 | major_v_hw = gk20a_readl(g, gr_fecs_ctx_state_store_major_rev_id_r()); | 127 | major_v_hw = gk20a_readl(g, |
119 | g->gr.ctx_vars.dynamic = true; | 128 | gr_fecs_ctx_state_store_major_rev_id_r()); |
120 | #endif | 129 | g->gr.ctx_vars.dynamic = true; |
130 | } | ||
121 | 131 | ||
122 | for (; net < max; net++) { | 132 | for (; net < max; net++) { |
123 | 133 | if (g->ops.gr_ctx.get_netlist_name(net, name) != 0) { | |
124 | if (gr_gk20a_get_netlist_name(net, name) != 0) { | ||
125 | gk20a_warn(d, "invalid netlist index %d", net); | 134 | gk20a_warn(d, "invalid netlist index %d", net); |
126 | continue; | 135 | continue; |
127 | } | 136 | } |
@@ -331,3 +340,9 @@ int gr_gk20a_init_ctx_vars(struct gk20a *g, struct gr_gk20a *gr) | |||
331 | else | 340 | else |
332 | return gr_gk20a_init_ctx_vars_fw(g, gr); | 341 | return gr_gk20a_init_ctx_vars_fw(g, gr); |
333 | } | 342 | } |
343 | |||
344 | void gk20a_init_gr_ctx(struct gpu_ops *gops) | ||
345 | { | ||
346 | gops->gr_ctx.get_netlist_name = gr_gk20a_get_netlist_name; | ||
347 | gops->gr_ctx.is_fw_defined = gr_gk20a_is_firmware_defined; | ||
348 | } | ||