Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm/dist/bsd-core only use bus_space*() on ...
details: https://anonhg.NetBSD.org/src/rev/0f8603dd72e1
branches: trunk
changeset: 755014:0f8603dd72e1
user: mrg <mrg%NetBSD.org@localhost>
date: Wed May 19 22:14:20 2010 +0000
description:
only use bus_space*() on drm_local_map_t's that have been mapped into
some bus space somewhere. otherwise, just use normal accesses since
it is normal memory.
this fixes radeondrm on x86 since bus_space_tag_t became a pointer.
add the "GEM" and "TTM" mapping types to sysctl support (though right
now we will never have them in our list of maps.)
diffstat:
sys/external/bsd/drm/dist/bsd-core/drmP.h | 138 +++++++++++++++--------
sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c | 2 +-
2 files changed, 92 insertions(+), 48 deletions(-)
diffs (167 lines):
diff -r 7e02f9017047 -r 0f8603dd72e1 sys/external/bsd/drm/dist/bsd-core/drmP.h
--- a/sys/external/bsd/drm/dist/bsd-core/drmP.h Wed May 19 21:59:34 2010 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drmP.h Wed May 19 22:14:20 2010 +0000
@@ -357,53 +357,6 @@
"lock; addl $0,0(%%rsp)" : : : "memory");
#endif
-#if defined(__FreeBSD__)
-
-#define DRM_READ8(map, offset) \
- *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_READ16(map, offset) \
- *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_READ32(map, offset) \
- *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_WRITE8(map, offset, val) \
- *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-#define DRM_WRITE16(map, offset, val) \
- *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-#define DRM_WRITE32(map, offset, val) \
- *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-
-#define DRM_VERIFYAREA_READ( uaddr, size ) \
- (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
-
-#elif defined(__NetBSD__)
-
-typedef vaddr_t vm_offset_t;
-
-#define DRM_READ8(map, offset) \
- bus_space_read_1( (map)->bst, (map)->bsh, (offset))
-#define DRM_READ16(map, offset) \
- bus_space_read_2( (map)->bst, (map)->bsh, (offset))
-#define DRM_READ32(map, offset) \
- bus_space_read_4( (map)->bst, (map)->bsh, (offset))
-#define DRM_WRITE8(map, offset, val) \
- bus_space_write_1((map)->bst, (map)->bsh, (offset), (val))
-#define DRM_WRITE16(map, offset, val) \
- bus_space_write_2((map)->bst, (map)->bsh, (offset), (val))
-#define DRM_WRITE32(map, offset, val) \
- bus_space_write_4((map)->bst, (map)->bsh, (offset), (val))
-
-#define DRM_VERIFYAREA_READ( uaddr, size ) \
- (!uvm_map_checkprot(&(curproc->p_vmspace->vm_map), \
- (vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ))
-
-#endif
-
#define DRM_COPY_TO_USER(user, kern, size) \
copyout(kern, user, size)
#define DRM_COPY_FROM_USER(kern, user, size) \
@@ -929,6 +882,97 @@
#define drm_core_has_AGP(dev) (0)
#endif
+#if defined(__FreeBSD__)
+
+#define DRM_READ8(map, offset) \
+ *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset))
+#define DRM_READ16(map, offset) \
+ *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset))
+#define DRM_READ32(map, offset) \
+ *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset))
+#define DRM_WRITE8(map, offset, val) \
+ *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset)) = val
+#define DRM_WRITE16(map, offset, val) \
+ *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset)) = val
+#define DRM_WRITE32(map, offset, val) \
+ *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
+ (vm_offset_t)(offset)) = val
+
+#define DRM_VERIFYAREA_READ( uaddr, size ) \
+ (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
+
+#elif defined(__NetBSD__)
+
+typedef vaddr_t vm_offset_t;
+
+#define DRM_IS_BUS_SPACE(map) ((map)->type == _DRM_REGISTERS || \
+ (map)->type == _DRM_CONSISTENT)
+
+static __inline__ u_int8_t
+DRM_READ8(drm_local_map_t *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_1(map->bst, map->bsh, offset);
+ else
+ return *(volatile u_int8_t *)((vaddr_t)map->handle + offset);
+}
+
+static __inline__ u_int16_t
+DRM_READ16(drm_local_map_t *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_2(map->bst, map->bsh, offset);
+ else
+ return *(volatile u_int16_t *)((vaddr_t)map->handle + offset);
+}
+
+static __inline__ u_int32_t
+DRM_READ32(drm_local_map_t *map, bus_size_t offset)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ return bus_space_read_4(map->bst, map->bsh, offset);
+ else
+ return *(volatile u_int32_t *)((vaddr_t)map->handle + offset);
+}
+
+static __inline__ void
+DRM_WRITE8(drm_local_map_t *map, bus_size_t offset, u_int8_t val)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_1(map->bst, map->bsh, offset, val);
+ else
+ *(volatile u_int8_t *)((vaddr_t)map->handle + offset) = val;
+}
+
+static __inline__ void
+DRM_WRITE16(drm_local_map_t *map, bus_size_t offset, u_int16_t val)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_2(map->bst, map->bsh, offset, val);
+ else
+ *(volatile u_int16_t *)((vaddr_t)map->handle + offset) = val;
+}
+
+static __inline__ void
+DRM_WRITE32(drm_local_map_t *map, bus_size_t offset, u_int32_t val)
+{
+ if (DRM_IS_BUS_SPACE(map))
+ bus_space_write_4(map->bst, map->bsh, offset, val);
+ else
+ *(volatile u_int32_t *)((vaddr_t)map->handle + offset) = val;
+}
+
+#define DRM_VERIFYAREA_READ( uaddr, size ) \
+ (!uvm_map_checkprot(&(curproc->p_vmspace->vm_map), \
+ (vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ))
+
+#endif
+
extern int drm_debug_flag;
/* Device setup support (drm_drv.c) */
diff -r 7e02f9017047 -r 0f8603dd72e1 sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c
--- a/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Wed May 19 21:59:34 2010 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c Wed May 19 22:14:20 2010 +0000
@@ -234,7 +234,7 @@
int len = 0;
#endif
drm_local_map_t *map, *tempmaps;
- const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "GEM", "TTM" };
const char *type, *yesno;
int i, mapcount;
char buf[128];
Home |
Main Index |
Thread Index |
Old Index