summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/regops_gm20b.c
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-07-28 21:36:52 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-02 17:43:25 -0400
commita15e110a9b790f55a5c6e257cfbf7f7235f5a334 (patch)
tree199209146e3e67927c13e2ece240de40f973e1ea /drivers/gpu/nvgpu/gm20b/regops_gm20b.c
parent43ae97000be786e4118d431637f05b1462e296c4 (diff)
gpu: nvgpu: Reorg regops HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the regops sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I7e2ccf158a8e7efa453a3326e86146660f18926f Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1530135 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/regops_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/gm20b/regops_gm20b.c65
1 files changed, 14 insertions, 51 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/regops_gm20b.c b/drivers/gpu/nvgpu/gm20b/regops_gm20b.c
index 45e7ec3d..1e5f6bfd 100644
--- a/drivers/gpu/nvgpu/gm20b/regops_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/regops_gm20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tegra GK20A GPU Debugger Driver Register Ops 2 * Tegra GK20A GPU Debugger Driver Register Ops
3 * 3 *
4 * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -377,105 +377,68 @@ static const struct regop_offset_range gm20b_qctl_whitelist_ranges[] = {
377static const u32 gm20b_qctl_whitelist_ranges_count = 377static const u32 gm20b_qctl_whitelist_ranges_count =
378 ARRAY_SIZE(gm20b_qctl_whitelist_ranges); 378 ARRAY_SIZE(gm20b_qctl_whitelist_ranges);
379 379
380static const struct regop_offset_range *gm20b_get_global_whitelist_ranges(void) 380const struct regop_offset_range *gm20b_get_global_whitelist_ranges(void)
381{ 381{
382 return gm20b_global_whitelist_ranges; 382 return gm20b_global_whitelist_ranges;
383} 383}
384 384
385static int gm20b_get_global_whitelist_ranges_count(void) 385int gm20b_get_global_whitelist_ranges_count(void)
386{ 386{
387 return gm20b_global_whitelist_ranges_count; 387 return gm20b_global_whitelist_ranges_count;
388} 388}
389 389
390static const struct regop_offset_range *gm20b_get_context_whitelist_ranges(void) 390const struct regop_offset_range *gm20b_get_context_whitelist_ranges(void)
391{ 391{
392 return gm20b_context_whitelist_ranges; 392 return gm20b_context_whitelist_ranges;
393} 393}
394 394
395static int gm20b_get_context_whitelist_ranges_count(void) 395int gm20b_get_context_whitelist_ranges_count(void)
396{ 396{
397 return gm20b_context_whitelist_ranges_count; 397 return gm20b_context_whitelist_ranges_count;
398} 398}
399 399
400static const u32 *gm20b_get_runcontrol_whitelist(void) 400const u32 *gm20b_get_runcontrol_whitelist(void)
401{ 401{
402 return gm20b_runcontrol_whitelist; 402 return gm20b_runcontrol_whitelist;
403} 403}
404 404
405static int gm20b_get_runcontrol_whitelist_count(void) 405int gm20b_get_runcontrol_whitelist_count(void)
406{ 406{
407 return gm20b_runcontrol_whitelist_count; 407 return gm20b_runcontrol_whitelist_count;
408} 408}
409 409
410static const 410const struct regop_offset_range *gm20b_get_runcontrol_whitelist_ranges(void)
411struct regop_offset_range *gm20b_get_runcontrol_whitelist_ranges(void)
412{ 411{
413 return gm20b_runcontrol_whitelist_ranges; 412 return gm20b_runcontrol_whitelist_ranges;
414} 413}
415 414
416static int gm20b_get_runcontrol_whitelist_ranges_count(void) 415int gm20b_get_runcontrol_whitelist_ranges_count(void)
417{ 416{
418 return gm20b_runcontrol_whitelist_ranges_count; 417 return gm20b_runcontrol_whitelist_ranges_count;
419} 418}
420 419
421static const u32 *gm20b_get_qctl_whitelist(void) 420const u32 *gm20b_get_qctl_whitelist(void)
422{ 421{
423 return gm20b_qctl_whitelist; 422 return gm20b_qctl_whitelist;
424} 423}
425 424
426static int gm20b_get_qctl_whitelist_count(void) 425int gm20b_get_qctl_whitelist_count(void)
427{ 426{
428 return gm20b_qctl_whitelist_count; 427 return gm20b_qctl_whitelist_count;
429} 428}
430 429
431static const struct regop_offset_range *gm20b_get_qctl_whitelist_ranges(void) 430const struct regop_offset_range *gm20b_get_qctl_whitelist_ranges(void)
432{ 431{
433 return gm20b_qctl_whitelist_ranges; 432 return gm20b_qctl_whitelist_ranges;
434} 433}
435 434
436static int gm20b_get_qctl_whitelist_ranges_count(void) 435int gm20b_get_qctl_whitelist_ranges_count(void)
437{ 436{
438 return gm20b_qctl_whitelist_ranges_count; 437 return gm20b_qctl_whitelist_ranges_count;
439} 438}
440 439
441static int gm20b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) 440int gm20b_apply_smpc_war(struct dbg_session_gk20a *dbg_s)
442{ 441{
443 /* Not needed on gm20b */ 442 /* Not needed on gm20b */
444 return 0; 443 return 0;
445} 444}
446
447void gm20b_init_regops(struct gpu_ops *gops)
448{
449 gops->regops.get_global_whitelist_ranges =
450 gm20b_get_global_whitelist_ranges;
451 gops->regops.get_global_whitelist_ranges_count =
452 gm20b_get_global_whitelist_ranges_count;
453
454 gops->regops.get_context_whitelist_ranges =
455 gm20b_get_context_whitelist_ranges;
456 gops->regops.get_context_whitelist_ranges_count =
457 gm20b_get_context_whitelist_ranges_count;
458
459 gops->regops.get_runcontrol_whitelist =
460 gm20b_get_runcontrol_whitelist;
461 gops->regops.get_runcontrol_whitelist_count =
462 gm20b_get_runcontrol_whitelist_count;
463
464 gops->regops.get_runcontrol_whitelist_ranges =
465 gm20b_get_runcontrol_whitelist_ranges;
466 gops->regops.get_runcontrol_whitelist_ranges_count =
467 gm20b_get_runcontrol_whitelist_ranges_count;
468
469 gops->regops.get_qctl_whitelist =
470 gm20b_get_qctl_whitelist;
471 gops->regops.get_qctl_whitelist_count =
472 gm20b_get_qctl_whitelist_count;
473
474 gops->regops.get_qctl_whitelist_ranges =
475 gm20b_get_qctl_whitelist_ranges;
476 gops->regops.get_qctl_whitelist_ranges_count =
477 gm20b_get_qctl_whitelist_ranges_count;
478
479 gops->regops.apply_smpc_war =
480 gm20b_apply_smpc_war;
481}