示例#1
0
文件: gm20b.c 项目: Gnurou/nouveau
/**
 * gm20b_secboot_tegra_read_wpr() - read the WPR registers on Tegra
 *
 * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region
 * is reserved from system memory by the bootloader and irreversibly locked.
 * This function reads the address and size of the pre-configured WPR region.
 */
int
gm20b_secboot_tegra_read_wpr(struct gm200_secboot *gsb, u32 mc_base)
{
	struct nvkm_secboot *sb = &gsb->base;
	void __iomem *mc;
	u32 cfg;

	mc = ioremap(mc_base, 0xd00);
	if (!mc) {
		nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n");
		return PTR_ERR(mc);
	}
	sb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) |
	      ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32);
	sb->wpr_size = ioread32_native(mc + MC_SECURITY_CARVEOUT2_SIZE_128K)
		<< 17;
	cfg = ioread32_native(mc + MC_SECURITY_CARVEOUT2_CFG0);
	iounmap(mc);

	/* Check that WPR settings are valid */
	if (sb->wpr_size == 0) {
		nvkm_error(&sb->subdev, "WPR region is empty\n");
		return -EINVAL;
	}

	if (!(cfg & TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED)) {
		nvkm_error(&sb->subdev, "WPR region not locked\n");
		return -EINVAL;
	}

	return 0;
}
static u32
nv40_instmem_rd32(struct nouveau_object *object, u64 addr)
{
	struct nv04_instmem_priv *priv = (void *)object;
#ifdef __NetBSD__
	return bus_space_read_4(priv->iomemt, priv->iomemh, addr);
#else
	return ioread32_native(priv->iomem + addr);
#endif
}
示例#3
0
u32
_nouveau_fifo_channel_rd32(struct nouveau_object *object, u64 addr)
{
	struct nouveau_fifo_chan *chan = (void *)object;
#ifdef __NetBSD__
	return bus_space_read_4(chan->bst, chan->bsh, addr);
#else
	return ioread32_native(chan->user + addr);
#endif
}
示例#4
0
u32
nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index)
{
    bool is_iomem;
    u32 *mem = ttm_kmap_obj_virtual(&nvbo->kmap, &is_iomem);
    mem = &mem[index];
    if (is_iomem)
        return ioread32_native((void __force __iomem *)mem);
    else
        return *mem;
}
示例#5
0
文件: nv40.c 项目: 24hours/linux
static u32
nv40_instmem_rd32(struct nouveau_object *object, u64 addr)
{
	struct nv04_instmem_priv *priv = (void *)object;
	return ioread32_native(priv->iomem + addr);
}
示例#6
0
static u32
nouveau_barobj_rd32(struct nouveau_object *object, u64 addr)
{
	struct nouveau_barobj *barobj = (void *)object;
	return ioread32_native(barobj->iomem + addr);
}
示例#7
0
/* fast-path, where backend is able to provide direct pointer to memory */
static u32
nvkm_gpuobj_rd32_fast(struct nvkm_gpuobj *gpuobj, u32 offset)
{
	return ioread32_native(gpuobj->map + offset);
}