diff options
author | Michel Daenzer <michel@daenzer.net> | 2002-02-02 17:03:51 +0000 |
---|---|---|
committer | Michel Daenzer <michel@daenzer.net> | 2002-02-02 17:03:51 +0000 |
commit | 65d25572deec33b7da13c211bf0aa78c361f535a (patch) | |
tree | ad4f38469cd6cbb503d08a15374e50eb950fb087 | |
parent | 44aa4d6297874022a4f5a49ea24f2d052584d3dc (diff) |
wrapper for ioremap_nocache() like for ioremap() (Paul Mundt)
-rw-r--r-- | linux-core/drmP.h | 4 | ||||
-rw-r--r-- | linux-core/drm_memory.h | 23 | ||||
-rw-r--r-- | linux/drmP.h | 4 | ||||
-rw-r--r-- | linux/drm_memory.h | 23 |
4 files changed, 54 insertions, 0 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 7557fdc90..85a6a06f6 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -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 unsigned long DRM(alloc_pages)(int order, int area); 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 diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index f11b80c3e..22aab7f49 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -314,6 +314,29 @@ void *DRM(ioremap)(unsigned long offset, unsigned long size) 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; diff --git a/linux/drmP.h b/linux/drmP.h index 7557fdc90..85a6a06f6 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -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 unsigned long DRM(alloc_pages)(int order, int area); 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 diff --git a/linux/drm_memory.h b/linux/drm_memory.h index f11b80c3e..22aab7f49 100644 --- a/linux/drm_memory.h +++ b/linux/drm_memory.h @@ -314,6 +314,29 @@ void *DRM(ioremap)(unsigned long offset, unsigned long size) 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; |