summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drmP.h82
-rw-r--r--linux-core/drm_memory.h1
-rw-r--r--linux-core/i810_dma.c4
-rw-r--r--linux-core/i830_dma.c4
4 files changed, 39 insertions, 52 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index d50bb2d9..2f5bc8fd 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -219,54 +219,6 @@
/***********************************************************************/
-/** \name Mapping helper macros */
-/*@{*/
-
-#define DRM_IOREMAP(map, dev) \
- (map)->handle = DRM(ioremap)( (map)->offset, (map)->size, (dev) )
-
-#define DRM_IOREMAP_NOCACHE(map, dev) \
- (map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size, (dev))
-
-#define DRM_IOREMAPFREE(map, dev) \
- do { \
- if ( (map)->handle && (map)->size ) \
- DRM(ioremapfree)( (map)->handle, (map)->size, (dev) ); \
- } while (0)
-
-/**
- * Find mapping.
- *
- * \param _map matching mapping if found, untouched otherwise.
- * \param _o offset.
- *
- * Expects the existence of a local variable named \p dev pointing to the
- * drm_device structure.
- */
-#define DRM_FIND_MAP(_map, _o) \
-do { \
- struct list_head *_list; \
- list_for_each( _list, &dev->maplist->head ) { \
- drm_map_list_t *_entry = list_entry( _list, drm_map_list_t, head ); \
- if ( _entry->map && \
- _entry->map->offset == (_o) ) { \
- (_map) = _entry->map; \
- break; \
- } \
- } \
-} while(0)
-
-/**
- * Drop mapping.
- *
- * \sa #DRM_FIND_MAP.
- */
-#define DRM_DROP_MAP(_map)
-
-/*@}*/
-
-
-/***********************************************************************/
/** \name Internal types and structures */
/*@{*/
@@ -985,6 +937,40 @@ extern void *DRM(pci_alloc)(drm_device_t *dev, size_t size,
extern void DRM(pci_free)(drm_device_t *dev, size_t size,
void *vaddr, dma_addr_t busaddr);
+
+/* Inline replacements for DRM_IOREMAP macros */
+static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev)
+{
+ map->handle = DRM(ioremap)( map->offset, map->size, dev );
+}
+
+static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev)
+{
+ map->handle = DRM(ioremap_nocache)(map->offset, map->size, dev);
+}
+
+static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev)
+{
+ if ( map->handle && map->size )
+ DRM(ioremapfree)( map->handle, map->size, dev );
+}
+
+static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
+{
+ struct list_head *_list;
+ list_for_each( _list, &dev->maplist->head ) {
+ drm_map_list_t *_entry = list_entry( _list, drm_map_list_t, head );
+ if ( _entry->map &&
+ _entry->map->offset == offset ) {
+ return _entry->map;
+ }
+ }
+ return NULL;
+}
+
+static __inline__ void drm_core_dropmap(struct drm_map *map)
+{
+}
/*@}*/
#endif /* __KERNEL__ */
diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h
index c6ea1fcc..d1c4b23a 100644
--- a/linux-core/drm_memory.h
+++ b/linux-core/drm_memory.h
@@ -199,6 +199,7 @@ static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *d
iounmap(pt);
}
+
#if DEBUG_MEMORY
#include "drm_memory_debug.h"
#else
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index b09487e8..d558988f 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -371,14 +371,14 @@ static int i810_dma_initialize(drm_device_t *dev,
DRM_ERROR("can not find sarea!\n");
return -EINVAL;
}
- DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset );
+ dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio_map) {
dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev);
DRM_ERROR("can not find mmio map!\n");
return -EINVAL;
}
- DRM_FIND_MAP( dev->agp_buffer_map, init->buffers_offset );
+ dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) {
dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev);
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 22005604..1a8c6336 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -378,14 +378,14 @@ static int i830_dma_initialize(drm_device_t *dev,
DRM_ERROR("can not find sarea!\n");
return -EINVAL;
}
- DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset );
+ dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset);
if(!dev_priv->mmio_map) {
dev->dev_private = (void *)dev_priv;
i830_dma_cleanup(dev);
DRM_ERROR("can not find mmio map!\n");
return -EINVAL;
}
- DRM_FIND_MAP( dev->agp_buffer_map, init->buffers_offset );
+ dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
if(!dev->agp_buffer_map) {
dev->dev_private = (void *)dev_priv;
i830_dma_cleanup(dev);