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
This commit is contained in:
Terje Bergstrom
2017-02-09 08:32:02 -08:00
committed by mobile promotions
parent 9af5105749
commit ed35f0a404
3 changed files with 21 additions and 5 deletions

View File

@@ -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;
};

View File

@@ -24,7 +24,6 @@
#include <nvgpu/hw/gm206/hw_pwr_gm206.h>
#include <nvgpu/hw/gm206/hw_mc_gm206.h>
#include <nvgpu/hw/gm206/hw_xve_gm206.h>
#include <nvgpu/hw/gm206/hw_top_gm206.h>
#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);

View File

@@ -25,6 +25,8 @@
#include <nvgpu/hw/gp106/hw_xp_gp106.h>
#include <nvgpu/hw/gp106/hw_xve_gp106.h>
#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;
}