summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/vbios/bios.c
diff options
context:
space:
mode:
authorSrirangan <smadhavan@nvidia.com>2018-08-20 05:13:41 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-23 00:55:49 -0400
commit3fbaee7099039eee84343027dd1ce20679c0c113 (patch)
tree0de4934723f58cad9cdcdb642927ffce0cfac6d8 /drivers/gpu/nvgpu/common/vbios/bios.c
parent52305f0514d29e7fb2cb5e2154188e09faa3fe94 (diff)
gpu: nvgpu: common: Fix MISRA 15.6 violations
MISRA Rule-15.6 requires that all if-else blocks be enclosed in braces, including single statement blocks. Fix errors due to single statement if blocks without braces, introducing the braces. JIRA NVGPU-671 Change-Id: I4d9933c51a297a725f48cbb15520a70494d74aeb Signed-off-by: Srirangan <smadhavan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1800833 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/vbios/bios.c')
-rw-r--r--drivers/gpu/nvgpu/common/vbios/bios.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/common/vbios/bios.c b/drivers/gpu/nvgpu/common/vbios/bios.c
index 12c0eded..0760a6cd 100644
--- a/drivers/gpu/nvgpu/common/vbios/bios.c
+++ b/drivers/gpu/nvgpu/common/vbios/bios.c
@@ -352,10 +352,11 @@ int nvgpu_bios_parse_rom(struct gk20a *g)
352 } 352 }
353 } 353 }
354 354
355 if (!found) 355 if (!found) {
356 return -EINVAL; 356 return -EINVAL;
357 else 357 } else {
358 return 0; 358 return 0;
359 }
359} 360}
360 361
361static void nvgpu_bios_parse_biosdata(struct gk20a *g, int offset) 362static void nvgpu_bios_parse_biosdata(struct gk20a *g, int offset)
@@ -393,8 +394,9 @@ u32 nvgpu_bios_get_nvlink_config_data(struct gk20a *g)
393{ 394{
394 struct nvlink_config_data_hdr_v1 config; 395 struct nvlink_config_data_hdr_v1 config;
395 396
396 if (g->bios.nvlink_config_data_offset == 0) 397 if (g->bios.nvlink_config_data_offset == 0) {
397 return -EINVAL; 398 return -EINVAL;
399 }
398 400
399 memcpy(&config, &g->bios.data[g->bios.nvlink_config_data_offset], 401 memcpy(&config, &g->bios.data[g->bios.nvlink_config_data_offset],
400 sizeof(config)); 402 sizeof(config));
@@ -458,8 +460,9 @@ static void nvgpu_bios_parse_devinit_appinfo(struct gk20a *g, int dmem_offset)
458 interface.script_phys_base, 460 interface.script_phys_base,
459 interface.script_size); 461 interface.script_size);
460 462
461 if (interface.version != 1) 463 if (interface.version != 1) {
462 return; 464 return;
465 }
463 g->bios.devinit_tables_phys_base = interface.tables_phys_base; 466 g->bios.devinit_tables_phys_base = interface.tables_phys_base;
464 g->bios.devinit_script_phys_base = interface.script_phys_base; 467 g->bios.devinit_script_phys_base = interface.script_phys_base;
465} 468}
@@ -475,8 +478,9 @@ static int nvgpu_bios_parse_appinfo_table(struct gk20a *g, int offset)
475 hdr.version, hdr.header_size, 478 hdr.version, hdr.header_size,
476 hdr.entry_size, hdr.entry_count); 479 hdr.entry_size, hdr.entry_count);
477 480
478 if (hdr.version != 1) 481 if (hdr.version != 1) {
479 return 0; 482 return 0;
483 }
480 484
481 offset += sizeof(hdr); 485 offset += sizeof(hdr);
482 for (i = 0; i < hdr.entry_count; i++) { 486 for (i = 0; i < hdr.entry_count; i++) {
@@ -487,8 +491,9 @@ static int nvgpu_bios_parse_appinfo_table(struct gk20a *g, int offset)
487 nvgpu_log_fn(g, "appInfo id %d dmem_offset %d", 491 nvgpu_log_fn(g, "appInfo id %d dmem_offset %d",
488 entry.id, entry.dmem_offset); 492 entry.id, entry.dmem_offset);
489 493
490 if (entry.id == APPINFO_ID_DEVINIT) 494 if (entry.id == APPINFO_ID_DEVINIT) {
491 nvgpu_bios_parse_devinit_appinfo(g, entry.dmem_offset); 495 nvgpu_bios_parse_devinit_appinfo(g, entry.dmem_offset);
496 }
492 497
493 offset += hdr.entry_size; 498 offset += hdr.entry_size;
494 } 499 }
@@ -583,8 +588,9 @@ static int nvgpu_bios_parse_falcon_ucode_table(struct gk20a *g, int offset)
583 hdr.entry_size, hdr.entry_count, 588 hdr.entry_size, hdr.entry_count,
584 hdr.desc_version, hdr.desc_size); 589 hdr.desc_version, hdr.desc_size);
585 590
586 if (hdr.version != 1) 591 if (hdr.version != 1) {
587 return -EINVAL; 592 return -EINVAL;
593 }
588 594
589 offset += hdr.header_size; 595 offset += hdr.header_size;
590 596
@@ -603,30 +609,34 @@ static int nvgpu_bios_parse_falcon_ucode_table(struct gk20a *g, int offset)
603 609
604 err = nvgpu_bios_parse_falcon_ucode_desc(g, 610 err = nvgpu_bios_parse_falcon_ucode_desc(g,
605 &g->bios.devinit, entry.desc_ptr); 611 &g->bios.devinit, entry.desc_ptr);
606 if (err) 612 if (err) {
607 err = nvgpu_bios_parse_falcon_ucode_desc(g, 613 err = nvgpu_bios_parse_falcon_ucode_desc(g,
608 &g->bios.devinit, 614 &g->bios.devinit,
609 entry.desc_ptr + 615 entry.desc_ptr +
610 g->bios.expansion_rom_offset); 616 g->bios.expansion_rom_offset);
617 }
611 618
612 if (err) 619 if (err) {
613 nvgpu_err(g, 620 nvgpu_err(g,
614 "could not parse devinit ucode desc"); 621 "could not parse devinit ucode desc");
622 }
615 } else if (entry.target_id == TARGET_ID_PMU && 623 } else if (entry.target_id == TARGET_ID_PMU &&
616 entry.application_id == APPLICATION_ID_PRE_OS) { 624 entry.application_id == APPLICATION_ID_PRE_OS) {
617 int err; 625 int err;
618 626
619 err = nvgpu_bios_parse_falcon_ucode_desc(g, 627 err = nvgpu_bios_parse_falcon_ucode_desc(g,
620 &g->bios.preos, entry.desc_ptr); 628 &g->bios.preos, entry.desc_ptr);
621 if (err) 629 if (err) {
622 err = nvgpu_bios_parse_falcon_ucode_desc(g, 630 err = nvgpu_bios_parse_falcon_ucode_desc(g,
623 &g->bios.preos, 631 &g->bios.preos,
624 entry.desc_ptr + 632 entry.desc_ptr +
625 g->bios.expansion_rom_offset); 633 g->bios.expansion_rom_offset);
634 }
626 635
627 if (err) 636 if (err) {
628 nvgpu_err(g, 637 nvgpu_err(g,
629 "could not parse preos ucode desc"); 638 "could not parse preos ucode desc");
639 }
630 } 640 }
631 641
632 offset += hdr.entry_size; 642 offset += hdr.entry_size;
@@ -645,13 +655,15 @@ static void nvgpu_bios_parse_falcon_data_v2(struct gk20a *g, int offset)
645 falcon_data.falcon_ucode_table_ptr); 655 falcon_data.falcon_ucode_table_ptr);
646 err = nvgpu_bios_parse_falcon_ucode_table(g, 656 err = nvgpu_bios_parse_falcon_ucode_table(g,
647 falcon_data.falcon_ucode_table_ptr); 657 falcon_data.falcon_ucode_table_ptr);
648 if (err) 658 if (err) {
649 err = nvgpu_bios_parse_falcon_ucode_table(g, 659 err = nvgpu_bios_parse_falcon_ucode_table(g,
650 falcon_data.falcon_ucode_table_ptr + 660 falcon_data.falcon_ucode_table_ptr +
651 g->bios.expansion_rom_offset); 661 g->bios.expansion_rom_offset);
662 }
652 663
653 if (err) 664 if (err) {
654 nvgpu_err(g, "could not parse falcon ucode table"); 665 nvgpu_err(g, "could not parse falcon ucode table");
666 }
655} 667}
656 668
657void *nvgpu_bios_get_perf_table_ptrs(struct gk20a *g, 669void *nvgpu_bios_get_perf_table_ptrs(struct gk20a *g,
@@ -674,8 +686,9 @@ void *nvgpu_bios_get_perf_table_ptrs(struct gk20a *g,
674 (table_id * PERF_PTRS_WIDTH)]); 686 (table_id * PERF_PTRS_WIDTH)]);
675 data_size = PERF_PTRS_WIDTH; 687 data_size = PERF_PTRS_WIDTH;
676 } 688 }
677 } else 689 } else {
678 return (void *)perf_table_ptr; 690 return (void *)perf_table_ptr;
691 }
679 692
680 if (table_id < (ptoken->data_size/data_size)) { 693 if (table_id < (ptoken->data_size/data_size)) {
681 694
@@ -686,18 +699,21 @@ void *nvgpu_bios_get_perf_table_ptrs(struct gk20a *g,
686 699
687 if (perf_table_id_offset != 0) { 700 if (perf_table_id_offset != 0) {
688 /* check is perf_table_id_offset is > 64k */ 701 /* check is perf_table_id_offset is > 64k */
689 if (perf_table_id_offset & ~0xFFFF) 702 if (perf_table_id_offset & ~0xFFFF) {
690 perf_table_ptr = 703 perf_table_ptr =
691 &g->bios.data[g->bios.expansion_rom_offset + 704 &g->bios.data[g->bios.expansion_rom_offset +
692 perf_table_id_offset]; 705 perf_table_id_offset];
693 else 706 } else {
694 perf_table_ptr = 707 perf_table_ptr =
695 &g->bios.data[perf_table_id_offset]; 708 &g->bios.data[perf_table_id_offset];
696 } else 709 }
710 } else {
697 nvgpu_warn(g, "PERF TABLE ID %d is NULL", 711 nvgpu_warn(g, "PERF TABLE ID %d is NULL",
698 table_id); 712 table_id);
699 } else 713 }
714 } else {
700 nvgpu_warn(g, "INVALID PERF TABLE ID - %d ", table_id); 715 nvgpu_warn(g, "INVALID PERF TABLE ID - %d ", table_id);
716 }
701 717
702 return (void *)perf_table_ptr; 718 return (void *)perf_table_ptr;
703} 719}
@@ -731,9 +747,10 @@ static void nvgpu_bios_parse_bit(struct gk20a *g, int offset)
731 nvgpu_bios_parse_nvinit_ptrs(g, bit_token.data_ptr); 747 nvgpu_bios_parse_nvinit_ptrs(g, bit_token.data_ptr);
732 break; 748 break;
733 case TOKEN_ID_FALCON_DATA: 749 case TOKEN_ID_FALCON_DATA:
734 if (bit_token.data_version == 2) 750 if (bit_token.data_version == 2) {
735 nvgpu_bios_parse_falcon_data_v2(g, 751 nvgpu_bios_parse_falcon_data_v2(g,
736 bit_token.data_ptr); 752 bit_token.data_ptr);
753 }
737 break; 754 break;
738 case TOKEN_ID_PERF_PTRS: 755 case TOKEN_ID_PERF_PTRS:
739 g->bios.perf_token = 756 g->bios.perf_token =