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/include/nvif Attempt ...
details: https://anonhg.NetBSD.org/src/rev/3758da5e75ff
branches: trunk
changeset: 992703:3758da5e75ff
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 07:32:59 2018 +0000
description:
Attempt to work out nvif iomem crud.
diffstat:
sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/driver.h | 11 +-
sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/object.h | 96 +++++++++++-
2 files changed, 105 insertions(+), 2 deletions(-)
diffs (159 lines):
diff -r a19df1316b20 -r 3758da5e75ff sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/driver.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/driver.h Mon Aug 27 07:32:50 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/driver.h Mon Aug 27 07:32:59 2018 +0000
@@ -1,8 +1,13 @@
-/* $NetBSD: driver.h,v 1.2 2018/08/27 04:58:30 riastradh Exp $ */
+/* $NetBSD: driver.h,v 1.3 2018/08/27 07:32:59 riastradh Exp $ */
#ifndef __NVIF_DRIVER_H__
#define __NVIF_DRIVER_H__
+#ifdef __NetBSD__
+# define __nvif_iomem volatile
+# define __iomem __nvif_iomem
+#endif
+
struct nvif_driver {
const char *name;
int (*init)(const char *name, u64 device, const char *cfg,
@@ -16,6 +21,10 @@
bool keep;
};
+#ifdef __NetBSD__
+# undef __iomem
+#endif
+
extern const struct nvif_driver nvif_driver_nvkm;
extern const struct nvif_driver nvif_driver_drm;
extern const struct nvif_driver nvif_driver_lib;
diff -r a19df1316b20 -r 3758da5e75ff sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/object.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/object.h Mon Aug 27 07:32:50 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/include/nvif/object.h Mon Aug 27 07:32:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: object.h,v 1.2 2018/08/27 04:58:30 riastradh Exp $ */
+/* $NetBSD: object.h,v 1.3 2018/08/27 07:32:59 riastradh Exp $ */
#ifndef __NVIF_OBJECT_H__
#define __NVIF_OBJECT_H__
@@ -11,6 +11,56 @@
int maxver;
};
+#ifdef __NetBSD__
+# define __nvif_iomem volatile
+# define __iomem __nvif_iomem
+# define ioread8 nvif_object_ioread8
+# define ioread16 nvif_object_ioread32
+# define ioread32 nvif_object_ioread16
+# define iowrite8 nvif_object_iowrite8
+# define iowrite16 nvif_object_iowrite16
+# define iowrite32 nvif_object_iowrite32
+static inline uint8_t
+ioread8(const void __iomem *p)
+{
+ uint8_t v = *(const uint8_t __iomem *)p;
+ membar_consumer();
+ return v;
+}
+static inline uint8_t
+ioread16(const void __iomem *p)
+{
+ uint16_t v = *(const uint16_t __iomem *)p;
+ membar_consumer();
+ return v;
+}
+static inline uint8_t
+ioread32(const void __iomem *p)
+{
+ uint32_t v = *(const uint32_t __iomem *)p;
+ membar_consumer();
+ return v;
+}
+static inline void
+iowrite8(uint8_t v, void __iomem *p)
+{
+ membar_producer();
+ *(uint8_t __iomem *)p = v;
+}
+static inline void
+iowrite16(uint16_t v, void __iomem *p)
+{
+ membar_producer();
+ *(uint16_t __iomem *)p = v;
+}
+static inline void
+iowrite32(uint32_t v, void __iomem *p)
+{
+ membar_producer();
+ *(uint32_t __iomem *)p = v;
+}
+#endif
+
struct nvif_object {
struct nvif_client *client;
u32 handle;
@@ -53,12 +103,46 @@
else \
nvif_object_wr(_object, (b), (c), (d)); \
})
+#ifdef __NetBSD__
+/* Force expansion now. */
+static inline uint8_t
+nvif_rd08(struct nvif_object *obj, uint64_t offset)
+{
+ return nvif_rd(obj, ioread8, 1, offset);
+}
+static inline uint8_t
+nvif_rd16(struct nvif_object *obj, uint64_t offset)
+{
+ return nvif_rd(obj, ioread16, 2, offset);
+}
+static inline uint8_t
+nvif_rd32(struct nvif_object *obj, uint64_t offset)
+{
+ return nvif_rd(obj, ioread32, 4, offset);
+}
+static inline void
+nvif_wr08(struct nvif_object *obj, uint64_t offset, uint8_t v)
+{
+ nvif_wr(obj, iowrite8, 1, offset, v);
+}
+static inline void
+nvif_wr16(struct nvif_object *obj, uint64_t offset, uint16_t v)
+{
+ nvif_wr(obj, iowrite16, 2, offset, v);
+}
+static inline void
+nvif_wr32(struct nvif_object *obj, uint64_t offset, uint32_t v)
+{
+ nvif_wr(obj, iowrite32, 4, offset, v);
+}
+#else
#define nvif_rd08(a,b) ({ ((u8)nvif_rd((a), ioread8, 1, (b))); })
#define nvif_rd16(a,b) ({ ((u16)nvif_rd((a), ioread16_native, 2, (b))); })
#define nvif_rd32(a,b) ({ ((u32)nvif_rd((a), ioread32_native, 4, (b))); })
#define nvif_wr08(a,b,c) nvif_wr((a), iowrite8, 1, (b), (u8)(c))
#define nvif_wr16(a,b,c) nvif_wr((a), iowrite16_native, 2, (b), (u16)(c))
#define nvif_wr32(a,b,c) nvif_wr((a), iowrite32_native, 4, (b), (u32)(c))
+#endif
#define nvif_mask(a,b,c,d) ({ \
struct nvif_object *__object = (a); \
u32 _addr = (b), _data = nvif_rd32(__object, _addr); \
@@ -66,6 +150,16 @@
_data; \
})
+#ifdef __NetBSD__
+# undef __iomem
+# undef ioread8
+# undef ioread16
+# undef ioread32
+# undef iowrite8
+# undef iowrite16
+# undef iowrite32
+#endif
+
#define nvif_mthd(a,b,c,d) nvif_object_mthd((a), (b), (c), (d))
/*XXX*/
Home |
Main Index |
Thread Index |
Old Index