summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm206/bios_gm206.c
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2016-07-18 05:17:20 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-09-08 23:05:58 -0400
commit39c48cb8bfa686692ce2fea3f4fefc3ddfaae5ab (patch)
treeaa23fe7dc474569fe8265ad702a3d92935f9bb01 /drivers/gpu/nvgpu/gm206/bios_gm206.c
parentf56ed459dde2a292b3af0dd4deb96b1090eb53a2 (diff)
gpu: nvgpu: get bios perf and clk table ptr
Implement support for reading perf and clk tables from VBIOS. JIRA DNVGPU-83 Change-Id: I095fea08479161362e4c2ffa7500ee6a57d6d447 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: http://git-master/r/1202602 (cherry picked from commit fb7c7356f131a198bd655a25fc6ff17067477e1b) Reviewed-on: http://git-master/r/1217299 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm206/bios_gm206.c')
-rw-r--r--drivers/gpu/nvgpu/gm206/bios_gm206.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gm206/bios_gm206.c b/drivers/gpu/nvgpu/gm206/bios_gm206.c
index 212fae62..7159ef83 100644
--- a/drivers/gpu/nvgpu/gm206/bios_gm206.c
+++ b/drivers/gpu/nvgpu/gm206/bios_gm206.c
@@ -21,6 +21,7 @@
21#include "hw_mc_gm206.h" 21#include "hw_mc_gm206.h"
22#include "hw_xve_gm206.h" 22#include "hw_xve_gm206.h"
23#include "hw_top_gm206.h" 23#include "hw_top_gm206.h"
24#include "bios_gm206.h"
24 25
25#define BIT_HEADER_ID 0xb8ff 26#define BIT_HEADER_ID 0xb8ff
26#define BIT_HEADER_SIGNATURE 0x00544942 27#define BIT_HEADER_SIGNATURE 0x00544942
@@ -54,15 +55,10 @@ struct bit {
54 u8 header_checksum; 55 u8 header_checksum;
55} __packed; 56} __packed;
56 57
57struct bit_token {
58 u8 token_id;
59 u8 data_version;
60 u16 data_size;
61 u16 data_ptr;
62} __packed;
63
64#define TOKEN_ID_NVINIT_PTRS 0x49 58#define TOKEN_ID_NVINIT_PTRS 0x49
65#define TOKEN_ID_FALCON_DATA 0x70 59#define TOKEN_ID_FALCON_DATA 0x70
60#define TOKEN_ID_PERF_PTRS 0x50
61#define TOKEN_ID_CLOCK_PTRS 0x43
66 62
67struct nvinit_ptrs { 63struct nvinit_ptrs {
68 u16 initscript_table_ptr; 64 u16 initscript_table_ptr;
@@ -423,6 +419,42 @@ static void gm206_bios_parse_falcon_data_v2(struct gk20a *g, int offset)
423 "could not parse falcon ucode table"); 419 "could not parse falcon ucode table");
424} 420}
425 421
422static void *gm206_bios_get_perf_table_ptrs(struct gk20a *g,
423 struct bit_token *ptoken, u8 table_id)
424{
425 u32 perf_table_id_offset = 0;
426 u8 *perf_table_ptr = NULL;
427
428 if (ptoken != NULL &&
429 table_id < (ptoken->data_size/sizeof(u32))) {
430
431 perf_table_id_offset = *((u32 *)&g->bios.data[
432 ptoken->data_ptr +
433 (table_id * PERF_PTRS_WIDTH)]);
434
435 gk20a_dbg_info("Perf_Tbl_ID-offset 0x%x Tbl_ID_Ptr-offset- 0x%x",
436 (ptoken->data_ptr +
437 (table_id * PERF_PTRS_WIDTH)),
438 perf_table_id_offset);
439
440 if (perf_table_id_offset != 0) {
441 /* check is perf_table_id_offset is > 64k */
442 if (perf_table_id_offset & ~0xFFFF)
443 perf_table_ptr =
444 &g->bios.data[g->bios.expansion_rom_offset +
445 perf_table_id_offset];
446 else
447 perf_table_ptr =
448 &g->bios.data[perf_table_id_offset];
449 } else
450 gk20a_warn(g->dev, "PERF TABLE ID %d is NULL",
451 table_id);
452 } else
453 gk20a_warn(g->dev, "INVALID PERF TABLE ID - %d ", table_id);
454
455 return (void *)perf_table_ptr;
456}
457
426static void gm206_bios_parse_bit(struct gk20a *g, int offset) 458static void gm206_bios_parse_bit(struct gk20a *g, int offset)
427{ 459{
428 struct bit bit; 460 struct bit bit;
@@ -453,6 +485,14 @@ static void gm206_bios_parse_bit(struct gk20a *g, int offset)
453 gm206_bios_parse_falcon_data_v2(g, 485 gm206_bios_parse_falcon_data_v2(g,
454 bit_token.data_ptr); 486 bit_token.data_ptr);
455 break; 487 break;
488 case TOKEN_ID_PERF_PTRS:
489 g->bios.perf_token =
490 (struct bit_token *)&g->bios.data[offset];
491 break;
492 case TOKEN_ID_CLOCK_PTRS:
493 g->bios.clock_token =
494 (struct bit_token *)&g->bios.data[offset];
495 break;
456 default: 496 default:
457 break; 497 break;
458 } 498 }
@@ -715,4 +755,5 @@ static int gm206_bios_init(struct gk20a *g)
715void gm206_init_bios(struct gpu_ops *gops) 755void gm206_init_bios(struct gpu_ops *gops)
716{ 756{
717 gops->bios.init = gm206_bios_init; 757 gops->bios.init = gm206_bios_init;
758 gops->bios.get_perf_table_ptrs = gm206_bios_get_perf_table_ptrs;
718} 759}