On Wed, Jan 23, 2002 at 05:54:17PM +0000, Keith Whitwell wrote: > > 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() > > wrapper in the same way that ioremap() is treated.. > > > > This is against current CVS.. please apply. > > This didn't seem to apply cleanly. Can you recheck the patch as sent? I > haven't investigated. > Odd. Applies just fine here. Will send it as an attachment this time..
Regards, -- Paul Mundt <[EMAIL PROTECTED]> MontaVista Software, Inc.
Index: drmP.h =================================================================== RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/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 = DRM(ioremap)( (map)->offset, (map)->size ) +#define DRM_IOREMAP_NOCACHE(map) \ + (map)->handle = 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); #if __REALLY_HAVE_AGP Index: drm_memory.h =================================================================== RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/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; } +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 = 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 += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + void DRM(ioremapfree)(void *pt, unsigned long size) { int alloc_count;
msg02485/pgp00000.pgp
Description: PGP signature