From: Paul M. <pm...@mv...> - 2002-01-22 05:40:42
|
Hello, At the moment, DRM provides a wrapper for ioremap() but does not do so for ioremap_nocache().. this is unfortunate, as a good number of framebuffer drivers (probably X drivers as well) don't always want to remap in cached space. This is a quick and dirty patch that adds an ioremap_nocache() wrapp= er in the same way that ioremap() is treated.. This is against current CVS.. please apply. Regards, --=20 Paul Mundt <pm...@mv...> MontaVista Software, Inc. Index: drmP.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/d= rm/kernel/drmP.h,v retrieving revision 1.45 diff -u -r1.45 drmP.h --- drmP.h 2001/10/22 19:15:04 1.45 +++ drmP.h 2002/01/22 05:14:29 @@ -180,6 +180,9 @@ #define DRM_IOREMAP(map) \ (map)->handle =3D DRM(ioremap)( (map)->offset, (map)->size ) =20 +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle =3D DRM(ioremap_nocache)((map)->offset, (map)->size) + #define DRM_IOREMAPFREE(map) \ do { \ if ( (map)->handle && (map)->size ) \ @@ -622,6 +625,7 @@ extern void DRM(free_pages)(unsigned long address, int order, int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long= size); extern void DRM(ioremapfree)(void *pt, unsigned long size); =20 #if __REALLY_HAVE_AGP Index: drm_memory.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/d= rm/kernel/drm_memory.h,v retrieving revision 1.6 diff -u -r1.6 drm_memory.h --- drm_memory.h 2001/08/19 15:20:07 1.6 +++ drm_memory.h 2002/01/22 05:14:36 @@ -314,6 +314,29 @@ return pt; } =20 +void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + if (!(pt =3D ioremap_nocache(offset, size))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated +=3D size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + void DRM(ioremapfree)(void *pt, unsigned long size) { int alloc_count; |