diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 5d973938..4471b0f1 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -201,15 +201,18 @@ static void set_pmu_cmdline_args_falctracesize_v1( | |||
201 | pmu->args_v1.falc_trace_size = size; | 201 | pmu->args_v1.falc_trace_size = size; |
202 | } | 202 | } |
203 | 203 | ||
204 | static int find_hex_in_string(char *strings, struct gk20a *g) | 204 | static bool find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos) |
205 | { | 205 | { |
206 | u32 i = 0, j = strlen(strings); | 206 | u32 i = 0, j = strlen(strings); |
207 | for (; i < j; i++) { | 207 | for (; i < j; i++) { |
208 | if (strings[i] == '%') | 208 | if (strings[i] == '%') |
209 | if (strings[i + 1] == 'x' || strings[i + 1] == 'X') | 209 | if (strings[i + 1] == 'x' || strings[i + 1] == 'X') { |
210 | return i; | 210 | *hex_pos = i; |
211 | return true; | ||
212 | } | ||
211 | } | 213 | } |
212 | return 0xFF; | 214 | *hex_pos = -1; |
215 | return false; | ||
213 | } | 216 | } |
214 | 217 | ||
215 | static void printtrace(struct pmu_gk20a *pmu) | 218 | static void printtrace(struct pmu_gk20a *pmu) |
@@ -227,17 +230,17 @@ static void printtrace(struct pmu_gk20a *pmu) | |||
227 | if (j == 0x40) | 230 | if (j == 0x40) |
228 | return; | 231 | return; |
229 | count = scnprintf(buf, 0x40, "Index %x: ", trace1[(i / 4)]); | 232 | count = scnprintf(buf, 0x40, "Index %x: ", trace1[(i / 4)]); |
230 | k = find_hex_in_string((trace+i+20), g); | ||
231 | l = 0; | 233 | l = 0; |
232 | m = 0; | 234 | m = 0; |
233 | while (k < 0xFF) { | 235 | while (find_hex_in_string((trace+i+20+m), g, &k)) { |
236 | if (k >= 40) | ||
237 | break; | ||
234 | strncpy(part_str, (trace+i+20+m), k); | 238 | strncpy(part_str, (trace+i+20+m), k); |
235 | part_str[k] = 0; | 239 | part_str[k] = 0; |
236 | count += scnprintf((buf + count), 0x40, "%s0x%x", | 240 | count += scnprintf((buf + count), 0x40, "%s0x%x", |
237 | part_str, trace1[(i / 4) + 1 + l]); | 241 | part_str, trace1[(i / 4) + 1 + l]); |
238 | l++; | 242 | l++; |
239 | m += k + 2; | 243 | m += k + 2; |
240 | k = find_hex_in_string((trace+i+20+m), g); | ||
241 | } | 244 | } |
242 | count += scnprintf((buf + count), 0x40, "%s", (trace+i+20+m)); | 245 | count += scnprintf((buf + count), 0x40, "%s", (trace+i+20+m)); |
243 | gk20a_err(dev_from_gk20a(g), "%s", buf); | 246 | gk20a_err(dev_from_gk20a(g), "%s", buf); |
@@ -4096,17 +4099,17 @@ static int falc_trace_show(struct seq_file *s, void *data) | |||
4096 | if (j == 0x40) | 4099 | if (j == 0x40) |
4097 | return 0; | 4100 | return 0; |
4098 | seq_printf(s, "Index %x: ", trace1[(i / 4)]); | 4101 | seq_printf(s, "Index %x: ", trace1[(i / 4)]); |
4099 | k = find_hex_in_string((trace+i+20), g); | ||
4100 | l = 0; | 4102 | l = 0; |
4101 | m = 0; | 4103 | m = 0; |
4102 | while (k < 0xFF) { | 4104 | while (find_hex_in_string((trace+i+20+m), g, &k)) { |
4105 | if (k >= 40) | ||
4106 | break; | ||
4103 | strncpy(part_str, (trace+i+20+m), k); | 4107 | strncpy(part_str, (trace+i+20+m), k); |
4104 | part_str[k] = 0; | 4108 | part_str[k] = 0; |
4105 | seq_printf(s, "%s0x%x", part_str, | 4109 | seq_printf(s, "%s0x%x", part_str, |
4106 | trace1[(i / 4) + 1 + l]); | 4110 | trace1[(i / 4) + 1 + l]); |
4107 | l++; | 4111 | l++; |
4108 | m += k + 2; | 4112 | m += k + 2; |
4109 | k = find_hex_in_string((trace+i+20+m), g); | ||
4110 | } | 4113 | } |
4111 | seq_printf(s, "%s", (trace+i+20+m)); | 4114 | seq_printf(s, "%s", (trace+i+20+m)); |
4112 | } | 4115 | } |