From ed35f0a4042074463bf52ba04583fde680d1d389 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 9 Feb 2017 08:32:02 -0800 Subject: 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 Reviewed-on: http://git-master/r/1302223 --- drivers/gpu/nvgpu/gk20a/gk20a.h | 2 ++ drivers/gpu/nvgpu/gm206/bios_gm206.c | 7 ++----- drivers/gpu/nvgpu/gp106/xve_gp106.c | 17 +++++++++++++++++ 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 { #if defined(CONFIG_PCI_MSI) void (*rearm_msi)(struct gk20a *g); #endif + void (*enable_shadow_rom)(struct gk20a *g); + void (*disable_shadow_rom)(struct gk20a *g); } xve; }; 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 @@ #include #include -#include #include #define BIT_HEADER_ID 0xb8ff @@ -868,8 +867,7 @@ static int gm206_bios_init(struct gk20a *g) g->bios.data = vmalloc(BIOS_SIZE); if (!g->bios.data) return -ENOMEM; - gk20a_writel(g, NV_PCFG + xve_rom_ctrl_r(), - xve_rom_ctrl_rom_shadow_disabled_f()); + g->ops.xve.disable_shadow_rom(g); for (i = 0; i < g->bios.size/4; i++) { u32 val = be32_to_cpu(gk20a_readl(g, 0x300000 + i*4)); @@ -878,8 +876,7 @@ static int gm206_bios_init(struct gk20a *g) g->bios.data[(i*4)+2] = (val >> 8) & 0xff; g->bios.data[(i*4)+3] = val & 0xff; } - gk20a_writel(g, NV_PCFG + xve_rom_ctrl_r(), - xve_rom_ctrl_rom_shadow_enabled_f()); + g->ops.xve.enable_shadow_rom(g); } 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 @@ #include #include +#define NV_PCFG 0x88000 + /** * Init a timer and place the timeout data in @timeout. */ @@ -661,6 +663,18 @@ static void xve_rearm_msi_gp106(struct gk20a *g) } #endif +static void xve_enable_shadow_rom_gp106(struct gk20a *g) +{ + g->ops.xve.xve_writel(g, NV_PCFG + xve_rom_ctrl_r(), + xve_rom_ctrl_rom_shadow_enabled_f()); +} + +static void xve_disable_shadow_rom_gp106(struct gk20a *g) +{ + g->ops.xve.xve_writel(g, NV_PCFG + xve_rom_ctrl_r(), + xve_rom_ctrl_rom_shadow_disabled_f()); +} + /* * Init the HAL functions and what not. xve_sw_init_gp106() is for initializing * all the other stuff like debugfs nodes, etc. @@ -678,5 +692,8 @@ int gp106_init_xve_ops(struct gpu_ops *gops) #if defined(CONFIG_PCI_MSI) gops->xve.rearm_msi = xve_rearm_msi_gp106; #endif + gops->xve.enable_shadow_rom = xve_enable_shadow_rom_gp106; + gops->xve.disable_shadow_rom = xve_disable_shadow_rom_gp106; + return 0; } -- cgit v1.2.2