summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-04 16:02:58 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-04 16:02:58 +0000
commit206fe41965076a184fe029dc61bf83d642cb895d (patch)
tree0ff38a1cf808d89599e8c0ede090823c21a5a926 /sys/dev
parent9b9c127350b93fe963d02b30e446519be2222021 (diff)
Remove the three inline functions from drmP.h.
deiline drm_core_findmap(), and merge drm_core_ioremap{,free}() into drm_ioremap{,free}() instead of having an inline that just calls another function.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drmP.h38
-rw-r--r--sys/dev/pci/drm/drm_bufs.c14
-rw-r--r--sys/dev/pci/drm/drm_memory.c28
3 files changed, 36 insertions, 44 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index 1cd39eae8e1..6e9b3345f77 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -481,8 +481,12 @@ void *drm_alloc(size_t);
void *drm_calloc(size_t, size_t);
void *drm_realloc(void *, size_t, size_t);
void drm_free(void *);
-void *drm_ioremap(struct drm_device *, struct drm_local_map *);
-void drm_ioremapfree(struct drm_local_map *);
+
+/* XXX until we get PAT support */
+#define drm_core_ioremap_wc drm_core_ioremap
+void drm_core_ioremap(struct drm_local_map *, struct drm_device *);
+void drm_core_ioremapfree(struct drm_local_map *);
+
int drm_mtrr_add(unsigned long, size_t, int);
int drm_mtrr_del(int, unsigned long, size_t, int);
@@ -506,6 +510,7 @@ int drm_lock_free(struct drm_lock_data *, unsigned int);
/* Buffer management and DMA support (drm_bufs.c) */
int drm_order(unsigned long);
+struct drm_local_map *drm_core_findmap(struct drm_device *, unsigned long);
int drm_rmmap_ioctl(struct drm_device *, void *, struct drm_file *);
void drm_rmmap(struct drm_device *, struct drm_local_map *);
void drm_rmmap_locked(struct drm_device *, struct drm_local_map *);
@@ -588,34 +593,5 @@ int drm_agp_bind_ioctl(struct drm_device *, void *, struct drm_file *);
int drm_sg_alloc_ioctl(struct drm_device *, void *, struct drm_file *);
int drm_sg_free(struct drm_device *, void *, struct drm_file *);
-/* Inline replacements for DRM_IOREMAP macros */
-#define drm_core_ioremap_wc drm_core_ioremap
-static __inline__ void
-drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
-{
- map->handle = drm_ioremap(dev, map);
-}
-
-static __inline__ void
-drm_core_ioremapfree(struct drm_local_map *map)
-{
- if ( map->handle && map->size )
- drm_ioremapfree(map);
-}
-
-static __inline__ struct drm_local_map *
-drm_core_findmap(struct drm_device *dev, unsigned long offset)
-{
- struct drm_local_map *map;
-
- DRM_LOCK();
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (offset == map->ext)
- break;
- }
- DRM_UNLOCK();
- return (map);
-}
-
#endif /* __KERNEL__ */
#endif /* _DRM_P_H_ */
diff --git a/sys/dev/pci/drm/drm_bufs.c b/sys/dev/pci/drm/drm_bufs.c
index 32a15d11f2b..d5c2cad02ee 100644
--- a/sys/dev/pci/drm/drm_bufs.c
+++ b/sys/dev/pci/drm/drm_bufs.c
@@ -59,6 +59,20 @@ drm_order(unsigned long size)
return order;
}
+struct drm_local_map *
+drm_core_findmap(struct drm_device *dev, unsigned long offset)
+{
+ struct drm_local_map *map;
+
+ DRM_LOCK();
+ TAILQ_FOREACH(map, &dev->maplist, link) {
+ if (offset == map->ext)
+ break;
+ }
+ DRM_UNLOCK();
+ return (map);
+}
+
int
drm_addmap(struct drm_device * dev, unsigned long offset, unsigned long size,
enum drm_map_type type, enum drm_map_flags flags,
diff --git a/sys/dev/pci/drm/drm_memory.c b/sys/dev/pci/drm/drm_memory.c
index 3194c235e92..19fea19d38d 100644
--- a/sys/dev/pci/drm/drm_memory.c
+++ b/sys/dev/pci/drm/drm_memory.c
@@ -75,12 +75,16 @@ drm_free(void *pt)
free(pt, M_DRM);
}
-void *
-drm_ioremap(struct drm_device *dev, struct drm_local_map *map)
+/* Inline replacements for DRM_IOREMAP macros */
+void
+drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
{
DRM_DEBUG("offset: 0x%x size: 0x%x type: %d\n", map->offset, map->size,
map->type);
+ /* default to failure. */
+ map->handle = 0;
+
if (map->type == _DRM_AGP || map->type == _DRM_FRAME_BUFFER) {
/*
* there can be multiple agp maps in the same BAR, agp also
@@ -92,23 +96,21 @@ drm_ioremap(struct drm_device *dev, struct drm_local_map *map)
if (bus_space_map(map->bst, map->offset,
map->size, BUS_SPACE_MAP_LINEAR, &map->bsh)) {
DRM_ERROR("ioremap fail\n");
- return (NULL);
+ return;
}
- } else {
- return (NULL);
+ /* handles are still supposed to be kernel virtual addresses */
+ map->handle = bus_space_vaddr(map->bst, map->bsh);
}
- /* handles are still supposed to be kernel virtual addresses */
- return bus_space_vaddr(map->bst, map->bsh);
}
void
-drm_ioremapfree(struct drm_local_map *map)
+drm_core_ioremapfree(struct drm_local_map *map)
{
- if (map == NULL || (map->type != _DRM_AGP && map->type !=
- _DRM_FRAME_BUFFER))
- return;
-
- bus_space_unmap(map->bst, map->bsh, map->size);
+ if (map->handle && map->size && (map->type == _DRM_AGP ||
+ map->type == _DRM_FRAME_BUFFER)) {
+ bus_space_unmap(map->bst, map->bsh, map->size);
+ map->handle = 0;
+ }
}
int