Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/include/drm Add operatio...
details: https://anonhg.NetBSD.org/src/rev/1df1ecf32da3
branches: riastradh-drm2
changeset: 788221:1df1ecf32da3
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:47:05 2013 +0000
description:
Add operations to drmP.h for access to drm_local_map memory or I/O.
diffstat:
sys/external/bsd/drm2/dist/include/drm/drmP.h | 98 +++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diffs (107 lines):
diff -r 6d0b790e6b81 -r 1df1ecf32da3 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h Wed Jul 24 02:46:49 2013 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h Wed Jul 24 02:47:05 2013 +0000
@@ -1987,5 +1987,103 @@
#endif
}
+#ifdef __NetBSD__
+static inline bool
+DRM_IS_BUS_SPACE(struct drm_local_map *map)
+{
+ switch (map->type) {
+ case _DRM_FRAME_BUFFER:
+ panic("I don't know how to access drm frame buffer memory!");
+
+ case _DRM_REGISTERS:
+ return true;
+
+ case _DRM_SHM:
+ panic("I don't know how to access drm shared memory!");
+
+ case _DRM_AGP:
+ panic("I don't know how to access drm agp memory!");
+
+ case _DRM_SCATTER_GATHER:
+ panic("I don't know how to access drm scatter-gather memory!");
+
+ case _DRM_CONSISTENT:
+ /*
+ * XXX Old drm uses bus space access for this, but
+ * consistent maps don't have bus space handles! They
+ * do, however, have kernel virtual addresses in the
+ * map->handle, so maybe that's right.
+ */
+#if 0
+ return false;
+#endif
+ panic("I don't know how to access drm consistent memory!");
+
+ case _DRM_GEM:
+ panic("I don't know how to access drm gem memory!");
+ }
+}
+
+static inline uint8_t
+DRM_READ8(struct drm_local_map *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_1(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset);
+ else
+ return *(volatile uint8_t *)((vaddr_t)map->handle + offset);
+}
+
+static inline uint16_t
+DRM_READ16(struct drm_local_map *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_2(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset);
+ else
+ return *(volatile uint16_t *)((vaddr_t)map->handle + offset);
+}
+
+static inline uint32_t
+DRM_READ32(struct drm_local_map *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_4(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset);
+ else
+ return *(volatile uint32_t *)((vaddr_t)map->handle + offset);
+}
+
+static inline void
+DRM_WRITE8(struct drm_local_map *map, bus_size_t offset, uint8_t value)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_1(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset, value);
+ else
+ *(volatile uint8_t *)((vaddr_t)map->handle + offset) = value;
+}
+
+static inline void
+DRM_WRITE16(struct drm_local_map *map, bus_size_t offset, uint16_t value)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_2(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset, value);
+ else
+ *(volatile uint16_t *)((vaddr_t)map->handle + offset) = value;
+}
+
+static inline void
+DRM_WRITE32(struct drm_local_map *map, bus_size_t offset, uint32_t value)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_4(map->lm_data.bus_space.bst,
+ map->lm_data.bus_space.bsh, offset, value);
+ else
+ *(volatile uint32_t *)((vaddr_t)map->handle + offset) = value;
+}
+#endif /* defined(__NetBSD__) */
+
#endif /* __KERNEL__ */
#endif
Home |
Main Index |
Thread Index |
Old Index