Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau Work bus_space or klu...
details: https://anonhg.NetBSD.org/src/rev/47627d4c679c
branches: trunk
changeset: 366025:47627d4c679c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 07:36:28 2018 +0000
description:
Work bus_space or kludges into instmem stuff as expedient.
diffstat:
sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/memory.h | 11 +++-
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_base.c | 13 +++-
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c | 8 ++-
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv04.c | 11 +++-
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c | 26 ++++++---
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv50.c | 12 +++-
6 files changed, 58 insertions(+), 23 deletions(-)
diffs (297 lines):
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/memory.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/memory.h Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/memory.h Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: memory.h,v 1.2 2018/08/27 04:58:30 riastradh Exp $ */
+/* $NetBSD: memory.h,v 1.3 2018/08/27 07:36:28 riastradh Exp $ */
#ifndef __NVKM_MEMORY_H__
#define __NVKM_MEMORY_H__
@@ -17,6 +17,11 @@
const struct nvkm_memory_func *func;
};
+#ifdef __NetBSD__
+# define __nvkm_memory_iomem
+# define __iomem __nvkm_memory_iomem
+#endif
+
struct nvkm_memory_func {
void *(*dtor)(struct nvkm_memory *);
enum nvkm_memory_target (*target)(struct nvkm_memory *);
@@ -30,6 +35,10 @@
void (*map)(struct nvkm_memory *, struct nvkm_vma *, u64 offset);
};
+#ifdef __NetBSD__
+# undef __iomem
+#endif
+
void nvkm_memory_ctor(const struct nvkm_memory_func *, struct nvkm_memory *);
int nvkm_memory_new(struct nvkm_device *, enum nvkm_memory_target,
u64 size, u32 align, bool zero, struct nvkm_memory **);
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_base.c Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_base.c Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_instmem_base.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_instmem_base.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -24,13 +24,17 @@
* Authors: Ben Skeggs
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_base.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_base.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $");
#include "priv.h"
#include <core/memory.h>
#include <subdev/bar.h>
+#ifdef __NetBSD__
+# define __iomem __nvkm_memory_iomem
+#endif
+
/******************************************************************************
* instmem object base implementation
*****************************************************************************/
@@ -87,7 +91,6 @@
* pointers come from.
*/
-# define __iomem
# define ioread32_native fake_ioread32_native
# define iowrite32_native fake_iowrite32_native
@@ -115,13 +118,13 @@
static u32
nvkm_instobj_rd32(struct nvkm_memory *memory, u64 offset)
{
- return ioread32_native(nvkm_instobj(memory)->map + offset);
+ return ioread32_native((const char *)nvkm_instobj(memory)->map + offset);
}
static void
nvkm_instobj_wr32(struct nvkm_memory *memory, u64 offset, u32 data)
{
- iowrite32_native(data, nvkm_instobj(memory)->map + offset);
+ iowrite32_native(data, (char *)nvkm_instobj(memory)->map + offset);
}
#ifdef __NetBSD__
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_instmem_gk20a.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_instmem_gk20a.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $ */
/*
* Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
@@ -44,7 +44,7 @@
* goes beyond a certain threshold. At the moment this limit is 1MB.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_gk20a.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_gk20a.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $");
#include "priv.h"
@@ -54,6 +54,10 @@
#include <subdev/fb.h>
#include <subdev/ltc.h>
+#ifdef __NetBSD__
+# define __iomem __nvkm_memory_iomem
+#endif
+
struct gk20a_instobj {
struct nvkm_memory memory;
struct nvkm_mem mem;
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv04.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv04.c Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv04.c Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_instmem_nv04.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_instmem_nv04.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
* Authors: Ben Skeggs
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv04.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv04.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $");
#define nv04_instmem(p) container_of((p), struct nv04_instmem, base)
#include "priv.h"
@@ -32,6 +32,10 @@
#include <core/memory.h>
#include <core/ramht.h>
+#ifdef __NetBSD__
+# define __iomem __nvkm_memory_iomem
+#endif
+
struct nv04_instmem {
struct nvkm_instmem base;
struct nvkm_mm heap;
@@ -71,7 +75,8 @@
{
struct nv04_instobj *iobj = nv04_instobj(memory);
struct nvkm_device *device = iobj->imem->base.subdev.device;
- return device->pri + 0x700000 + iobj->node->offset;
+ return (char __iomem *)bus_space_vaddr(device->mmiot, device->mmioh) +
+ 0x700000 + iobj->node->offset;
}
static void
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
* Authors: Ben Skeggs
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.3 2018/08/27 07:36:28 riastradh Exp $");
#define nv40_instmem(p) container_of((p), struct nv40_instmem, base)
#include "priv.h"
@@ -33,6 +33,10 @@
#include <core/ramht.h>
#include <engine/gr/nv40.h>
+#ifdef __NetBSD__
+# define __iomem __nvkm_memory_iomem
+#endif
+
struct nv40_instmem {
struct nvkm_instmem base;
struct nvkm_mm heap;
@@ -40,9 +44,8 @@
bus_space_tag_t iomemt;
bus_space_handle_t iomemh;
bus_size_t iomemsz;
-#else
+#endif
void __iomem *iomem;
-#endif
};
/******************************************************************************
@@ -78,7 +81,7 @@
nv40_instobj_acquire(struct nvkm_memory *memory)
{
struct nv40_instobj *iobj = nv40_instobj(memory);
- return iobj->imem->iomem + iobj->node->offset;
+ return (char __iomem *)iobj->imem->iomem + iobj->node->offset;
}
static void
@@ -162,7 +165,7 @@
nv40_instmem_rd32(struct nvkm_instmem *base, u32 addr)
{
#ifdef __NetBSD__
- struct nv40_instmem *imem = nv40_instmem(base)
+ struct nv40_instmem *imem = nv40_instmem(base);
return bus_space_read_4(imem->iomemt, imem->iomemh, addr);
#else
return ioread32_native(nv40_instmem(base)->iomem + addr);
@@ -173,7 +176,7 @@
nv40_instmem_wr32(struct nvkm_instmem *base, u32 addr, u32 data)
{
#ifdef __NetBSD__
- struct nv40_instmem *imem = nv40_instmem(base)
+ struct nv40_instmem *imem = nv40_instmem(base);
bus_space_write_4(imem->iomemt, imem->iomemh, addr, data);
#else
iowrite32_native(data, nv40_instmem(base)->iomem + addr);
@@ -246,7 +249,11 @@
nvkm_memory_del(&imem->base.vbios);
nvkm_mm_fini(&imem->heap);
if (imem->iomem)
+#ifdef __NetBSD__
+ bus_space_unmap(imem->iomemt, imem->iomemh, imem->iomemsz);
+#else
iounmap(imem->iomem);
+#endif
return imem;
}
@@ -290,14 +297,15 @@
iomembase = device->func->resource_addr(device, bar);
iomemsz = device->func->resource_size(device, bar);
/* XXX errno NetBSD->Linux */
- ret = -bus_space_map(imem->iomemt, iomemaddr, imem->iomemsz, 0,
- &imem->iomemh);
+ ret = -bus_space_map(imem->iomemt, iomembase, imem->iomemsz,
+ BUS_SPACE_MAP_LINEAR, &imem->iomemh);
if (ret) {
nvkm_error(&imem->base.subdev, "unable to map PRAMIN BAR %d"
": %d\n", bar, ret);
return ret;
}
imem->iomemsz = iomemsz;
+ imem->iomem = bus_space_vaddr(imem->iomemt, imem->iomemh);
}
#else
imem->iomem = ioremap(device->func->resource_addr(device, bar),
diff -r c926d9876b8c -r 47627d4c679c sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv50.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv50.c Mon Aug 27 07:36:18 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv50.c Mon Aug 27 07:36:28 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_instmem_nv50.c,v 1.3 2018/08/27 06:36:48 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_instmem_nv50.c,v 1.4 2018/08/27 07:36:28 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
* Authors: Ben Skeggs
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv50.c,v 1.3 2018/08/27 06:36:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv50.c,v 1.4 2018/08/27 07:36:28 riastradh Exp $");
#define nv50_instmem(p) container_of((p), struct nv50_instmem, base)
#include "priv.h"
@@ -34,6 +34,10 @@
#include <subdev/fb.h>
#include <subdev/mmu.h>
+#ifdef __NetBSD__
+# define __iomem __nvkm_memory_iomem
+#endif
+
struct nv50_instmem {
struct nvkm_instmem base;
unsigned long lock_flags;
@@ -83,7 +87,9 @@
struct nvkm_subdev *subdev = &iobj->imem->base.subdev;
struct nvkm_device *device = subdev->device;
u64 size = nvkm_memory_size(memory);
+#ifndef __NetBSD__
void __iomem *map;
+#endif
int ret;
iobj->map = ERR_PTR(-ENOMEM);
@@ -201,7 +207,7 @@
nvkm_vm_put(&iobj->bar);
#ifdef __NetBSD__
bus_space_unmap(iobj->bst, iobj->bsh,
- nvkm_memory_size(iobj->memory));
+ nvkm_memory_size(&iobj->memory));
iobj->map = NULL;
#else
iounmap(iobj->map);
Home |
Main Index |
Thread Index |
Old Index