summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-02-09 11:32:02 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-13 12:43:09 -0500
commited35f0a4042074463bf52ba04583fde680d1d389 (patch)
tree7052337e9457e87e2829490942a7c563a742cb2f
parent9af510574957fc885a4ae9f96d23c6ad464eeb8f (diff)
gpu: nvgpu: Add enable/disable shadow ROM HAL
Add HAL for enabling and disabling shadow ROM. This removes XVE dependency from bios code. Change-Id: Icafec72dae71669376bbfb97077661b7165badb8 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1302223
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gm206/bios_gm206.c7
-rw-r--r--drivers/gpu/nvgpu/gp106/xve_gp106.c17
3 files changed, 21 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 72f9170e..39be4e9c 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -783,6 +783,8 @@ struct gpu_ops {
783#if defined(CONFIG_PCI_MSI) 783#if defined(CONFIG_PCI_MSI)
784 void (*rearm_msi)(struct gk20a *g); 784 void (*rearm_msi)(struct gk20a *g);
785#endif 785#endif
786 void (*enable_shadow_rom)(struct gk20a *g);
787 void (*disable_shadow_rom)(struct gk20a *g);
786 } xve; 788 } xve;
787}; 789};
788 790
diff --git a/drivers/gpu/nvgpu/gm206/bios_gm206.c b/drivers/gpu/nvgpu/gm206/bios_gm206.c
index bfb90e19..fa736da5 100644
--- a/drivers/gpu/nvgpu/gm206/bios_gm206.c
+++ b/drivers/gpu/nvgpu/gm206/bios_gm206.c
@@ -24,7 +24,6 @@
24 24
25#include <nvgpu/hw/gm206/hw_pwr_gm206.h> 25#include <nvgpu/hw/gm206/hw_pwr_gm206.h>
26#include <nvgpu/hw/gm206/hw_mc_gm206.h> 26#include <nvgpu/hw/gm206/hw_mc_gm206.h>
27#include <nvgpu/hw/gm206/hw_xve_gm206.h>
28#include <nvgpu/hw/gm206/hw_top_gm206.h> 27#include <nvgpu/hw/gm206/hw_top_gm206.h>
29 28
30#define BIT_HEADER_ID 0xb8ff 29#define BIT_HEADER_ID 0xb8ff
@@ -868,8 +867,7 @@ static int gm206_bios_init(struct gk20a *g)
868 g->bios.data = vmalloc(BIOS_SIZE); 867 g->bios.data = vmalloc(BIOS_SIZE);
869 if (!g->bios.data) 868 if (!g->bios.data)
870 return -ENOMEM; 869 return -ENOMEM;
871 gk20a_writel(g, NV_PCFG + xve_rom_ctrl_r(), 870 g->ops.xve.disable_shadow_rom(g);
872 xve_rom_ctrl_rom_shadow_disabled_f());
873 for (i = 0; i < g->bios.size/4; i++) { 871 for (i = 0; i < g->bios.size/4; i++) {
874 u32 val = be32_to_cpu(gk20a_readl(g, 0x300000 + i*4)); 872 u32 val = be32_to_cpu(gk20a_readl(g, 0x300000 + i*4));
875 873
@@ -878,8 +876,7 @@ static int gm206_bios_init(struct gk20a *g)
878 g->bios.data[(i*4)+2] = (val >> 8) & 0xff; 876 g->bios.data[(i*4)+2] = (val >> 8) & 0xff;
879 g->bios.data[(i*4)+3] = val & 0xff; 877 g->bios.data[(i*4)+3] = val & 0xff;
880 } 878 }
881 gk20a_writel(g, NV_PCFG + xve_rom_ctrl_r(), 879 g->ops.xve.enable_shadow_rom(g);
882 xve_rom_ctrl_rom_shadow_enabled_f());
883 } 880 }
884 881
885 err = gm206_bios_parse_rom(g); 882 err = gm206_bios_parse_rom(g);
diff --git a/drivers/gpu/nvgpu/gp106/xve_gp106.c b/drivers/gpu/nvgpu/gp106/xve_gp106.c
index 83ae9306..ecc6de60 100644
--- a/drivers/gpu/nvgpu/gp106/xve_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/xve_gp106.c
@@ -25,6 +25,8 @@
25#include <nvgpu/hw/gp106/hw_xp_gp106.h> 25#include <nvgpu/hw/gp106/hw_xp_gp106.h>
26#include <nvgpu/hw/gp106/hw_xve_gp106.h> 26#include <nvgpu/hw/gp106/hw_xve_gp106.h>
27 27
28#define NV_PCFG 0x88000
29
28/** 30/**
29 * Init a timer and place the timeout data in @timeout. 31 * Init a timer and place the timeout data in @timeout.
30 */ 32 */
@@ -661,6 +663,18 @@ static void xve_rearm_msi_gp106(struct gk20a *g)
661} 663}
662#endif 664#endif
663 665
666static void xve_enable_shadow_rom_gp106(struct gk20a *g)
667{
668 g->ops.xve.xve_writel(g, NV_PCFG + xve_rom_ctrl_r(),
669 xve_rom_ctrl_rom_shadow_enabled_f());
670}
671
672static void xve_disable_shadow_rom_gp106(struct gk20a *g)
673{
674 g->ops.xve.xve_writel(g, NV_PCFG + xve_rom_ctrl_r(),
675 xve_rom_ctrl_rom_shadow_disabled_f());
676}
677
664/* 678/*
665 * Init the HAL functions and what not. xve_sw_init_gp106() is for initializing 679 * Init the HAL functions and what not. xve_sw_init_gp106() is for initializing
666 * all the other stuff like debugfs nodes, etc. 680 * all the other stuff like debugfs nodes, etc.
@@ -678,5 +692,8 @@ int gp106_init_xve_ops(struct gpu_ops *gops)
678#if defined(CONFIG_PCI_MSI) 692#if defined(CONFIG_PCI_MSI)
679 gops->xve.rearm_msi = xve_rearm_msi_gp106; 693 gops->xve.rearm_msi = xve_rearm_msi_gp106;
680#endif 694#endif
695 gops->xve.enable_shadow_rom = xve_enable_shadow_rom_gp106;
696 gops->xve.disable_shadow_rom = xve_disable_shadow_rom_gp106;
697
681 return 0; 698 return 0;
682} 699}