aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2017-03-29 05:31:13 -0400
committerBen Skeggs <bskeggs@redhat.com>2017-04-06 00:39:04 -0400
commitc79505c1f9e14d7aa9eb3b085c799d77950b1e20 (patch)
treec7ce4cd8c6c7ea7b5ce88a4af1da78fe5af45d00 /drivers
parent008796d9a35f217d7f3672acd1d97ef77a5e05ff (diff)
drm/nouveau/secboot/gm20b: specify MC base address as argument
Allow the MC base address to be specified as an argument for the WPR region reading function. GP10B uses a different address layout as GM20B, so this is necessary. Also export the function to be used by GP10B. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c17
2 files changed, 12 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h
index 6dc9fc384f24..c8ab3d76bdef 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.h
@@ -41,4 +41,7 @@ void *gm200_secboot_dtor(struct nvkm_secboot *);
41int gm200_secboot_run_blob(struct nvkm_secboot *, struct nvkm_gpuobj *, 41int gm200_secboot_run_blob(struct nvkm_secboot *, struct nvkm_gpuobj *,
42 struct nvkm_falcon *); 42 struct nvkm_falcon *);
43 43
44/* Tegra-only */
45int gm20b_secboot_tegra_read_wpr(struct gm200_secboot *, u32);
46
44#endif 47#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
index 29e6f73dfd7e..b10ed59a4911 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
@@ -23,28 +23,29 @@
23#include "acr.h" 23#include "acr.h"
24#include "gm200.h" 24#include "gm200.h"
25 25
26#define TEGRA210_MC_BASE 0x70019000
27
26#ifdef CONFIG_ARCH_TEGRA 28#ifdef CONFIG_ARCH_TEGRA
27#define TEGRA_MC_BASE 0x70019000
28#define MC_SECURITY_CARVEOUT2_CFG0 0xc58 29#define MC_SECURITY_CARVEOUT2_CFG0 0xc58
29#define MC_SECURITY_CARVEOUT2_BOM_0 0xc5c 30#define MC_SECURITY_CARVEOUT2_BOM_0 0xc5c
30#define MC_SECURITY_CARVEOUT2_BOM_HI_0 0xc60 31#define MC_SECURITY_CARVEOUT2_BOM_HI_0 0xc60
31#define MC_SECURITY_CARVEOUT2_SIZE_128K 0xc64 32#define MC_SECURITY_CARVEOUT2_SIZE_128K 0xc64
32#define TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED (1 << 1) 33#define TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED (1 << 1)
33/** 34/**
34 * sb_tegra_read_wpr() - read the WPR registers on Tegra 35 * gm20b_secboot_tegra_read_wpr() - read the WPR registers on Tegra
35 * 36 *
36 * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region 37 * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region
37 * is reserved from system memory by the bootloader and irreversibly locked. 38 * is reserved from system memory by the bootloader and irreversibly locked.
38 * This function reads the address and size of the pre-configured WPR region. 39 * This function reads the address and size of the pre-configured WPR region.
39 */ 40 */
40static int 41int
41gm20b_tegra_read_wpr(struct gm200_secboot *gsb) 42gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
42{ 43{
43 struct nvkm_secboot *sb = &gsb->base; 44 struct nvkm_secboot *sb = &gsb->base;
44 void __iomem *mc; 45 void __iomem *mc;
45 u32 cfg; 46 u32 cfg;
46 47
47 mc = ioremap(TEGRA_MC_BASE, 0xd00); 48 mc = ioremap(mc_base, 0xd00);
48 if (!mc) { 49 if (!mc) {
49 nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n"); 50 nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n");
50 return PTR_ERR(mc); 51 return PTR_ERR(mc);
@@ -70,8 +71,8 @@ gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
70 return 0; 71 return 0;
71} 72}
72#else 73#else
73static int 74int
74gm20b_tegra_read_wpr(struct gm200_secboot *gsb) 75gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
75{ 76{
76 nvkm_error(&gsb->base.subdev, "Tegra support not compiled in\n"); 77 nvkm_error(&gsb->base.subdev, "Tegra support not compiled in\n");
77 return -EINVAL; 78 return -EINVAL;
@@ -84,7 +85,7 @@ gm20b_secboot_oneinit(struct nvkm_secboot *sb)
84 struct gm200_secboot *gsb = gm200_secboot(sb); 85 struct gm200_secboot *gsb = gm200_secboot(sb);
85 int ret; 86 int ret;
86 87
87 ret = gm20b_tegra_read_wpr(gsb); 88 ret = gm20b_secboot_tegra_read_wpr(gsb, TEGRA210_MC_BASE);
88 if (ret) 89 if (ret)
89 return ret; 90 return ret;
90 91