summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Noland <rnoland@2hip.net>2008-09-07 12:44:02 -0400
committerRobert Noland <rnoland@2hip.net>2008-09-07 12:44:02 -0400
commit2880c86eb246aceeb5c750e27259a7b6d8897328 (patch)
tree5bb6cd34a902448022f9e2112e7bfdf89f80ee5a
parent740f09bffde20d9207497bd107d50941ca21278a (diff)
[FreeBSD] Implement drm_ioremap_wc() to set a range of mem to write-combining
-rw-r--r--bsd-core/drmP.h9
-rw-r--r--bsd-core/drm_memory.c5
2 files changed, 12 insertions, 2 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index f8705e36..de59f426 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -70,6 +70,7 @@ typedef struct drm_file drm_file_t;
#include <machine/pmap.h>
#include <machine/bus.h>
#include <machine/resource.h>
+#include <machine/specialreg.h>
#include <machine/sysarch.h>
#include <sys/endian.h>
#include <sys/mman.h>
@@ -897,6 +898,7 @@ void *drm_calloc(size_t nmemb, size_t size, int area);
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area);
void drm_free(void *pt, size_t size, int area);
+void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
void drm_ioremapfree(drm_local_map_t *map);
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
@@ -1110,10 +1112,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
size_t align, dma_addr_t maxaddr);
void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
-#define drm_core_ioremap_wc drm_core_ioremap
-
/* Inline replacements for DRM_IOREMAP macros */
static __inline__ void
+drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
+{
+ map->handle = drm_ioremap_wc(dev, map);
+}
+static __inline__ void
drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
{
map->handle = drm_ioremap(dev, map);
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
index 80891402..272c0874 100644
--- a/bsd-core/drm_memory.c
+++ b/bsd-core/drm_memory.c
@@ -80,6 +80,11 @@ void drm_free(void *pt, size_t size, int area)
free(pt, M_DRM);
}
+void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map)
+{
+ return pmap_mapdev_attr(map->offset, map->size, PAT_WRITE_COMBINING);
+}
+
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
{
#ifdef __FreeBSD__