Commit 86c1fbd5 authored by Daniel Vetter's avatar Daniel Vetter

drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h>

And replace the drm_core_ prefix with drm_legacy_ since really, this
isn't core stuff.

Also drop drm_core_dropmap since it's unused.

v2: Fix up i810.ko fully which somehow slipped through.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 78238757
...@@ -120,25 +120,25 @@ static inline void *agp_remap(unsigned long offset, unsigned long size, ...@@ -120,25 +120,25 @@ static inline void *agp_remap(unsigned long offset, unsigned long size,
#endif /* agp */ #endif /* agp */
void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev) void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev)
{ {
if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
map->handle = agp_remap(map->offset, map->size, dev); map->handle = agp_remap(map->offset, map->size, dev);
else else
map->handle = ioremap(map->offset, map->size); map->handle = ioremap(map->offset, map->size);
} }
EXPORT_SYMBOL(drm_core_ioremap); EXPORT_SYMBOL(drm_legacy_ioremap);
void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev) void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
{ {
if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
map->handle = agp_remap(map->offset, map->size, dev); map->handle = agp_remap(map->offset, map->size, dev);
else else
map->handle = ioremap_wc(map->offset, map->size); map->handle = ioremap_wc(map->offset, map->size);
} }
EXPORT_SYMBOL(drm_core_ioremap_wc); EXPORT_SYMBOL(drm_legacy_ioremap_wc);
void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev) void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
{ {
if (!map->handle || !map->size) if (!map->handle || !map->size)
return; return;
...@@ -148,4 +148,4 @@ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev) ...@@ -148,4 +148,4 @@ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
else else
iounmap(map->handle); iounmap(map->handle);
} }
EXPORT_SYMBOL(drm_core_ioremapfree); EXPORT_SYMBOL(drm_legacy_ioremapfree);
...@@ -213,7 +213,7 @@ static int i810_dma_cleanup(struct drm_device *dev) ...@@ -213,7 +213,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
(drm_i810_private_t *) dev->dev_private; (drm_i810_private_t *) dev->dev_private;
if (dev_priv->ring.virtual_start) if (dev_priv->ring.virtual_start)
drm_core_ioremapfree(&dev_priv->ring.map, dev); drm_legacy_ioremapfree(&dev_priv->ring.map, dev);
if (dev_priv->hw_status_page) { if (dev_priv->hw_status_page) {
pci_free_consistent(dev->pdev, PAGE_SIZE, pci_free_consistent(dev->pdev, PAGE_SIZE,
dev_priv->hw_status_page, dev_priv->hw_status_page,
...@@ -227,7 +227,7 @@ static int i810_dma_cleanup(struct drm_device *dev) ...@@ -227,7 +227,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
drm_i810_buf_priv_t *buf_priv = buf->dev_private; drm_i810_buf_priv_t *buf_priv = buf->dev_private;
if (buf_priv->kernel_virtual && buf->total) if (buf_priv->kernel_virtual && buf->total)
drm_core_ioremapfree(&buf_priv->map, dev); drm_legacy_ioremapfree(&buf_priv->map, dev);
} }
} }
return 0; return 0;
...@@ -306,7 +306,7 @@ static int i810_freelist_init(struct drm_device *dev, drm_i810_private_t *dev_pr ...@@ -306,7 +306,7 @@ static int i810_freelist_init(struct drm_device *dev, drm_i810_private_t *dev_pr
buf_priv->map.flags = 0; buf_priv->map.flags = 0;
buf_priv->map.mtrr = 0; buf_priv->map.mtrr = 0;
drm_core_ioremap(&buf_priv->map, dev); drm_legacy_ioremap(&buf_priv->map, dev);
buf_priv->kernel_virtual = buf_priv->map.handle; buf_priv->kernel_virtual = buf_priv->map.handle;
} }
...@@ -334,7 +334,7 @@ static int i810_dma_initialize(struct drm_device *dev, ...@@ -334,7 +334,7 @@ static int i810_dma_initialize(struct drm_device *dev,
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
return -EINVAL; return -EINVAL;
} }
dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio_map = drm_legacy_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio_map) { if (!dev_priv->mmio_map) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
...@@ -342,7 +342,7 @@ static int i810_dma_initialize(struct drm_device *dev, ...@@ -342,7 +342,7 @@ static int i810_dma_initialize(struct drm_device *dev,
return -EINVAL; return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_legacy_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
...@@ -363,7 +363,7 @@ static int i810_dma_initialize(struct drm_device *dev, ...@@ -363,7 +363,7 @@ static int i810_dma_initialize(struct drm_device *dev,
dev_priv->ring.map.flags = 0; dev_priv->ring.map.flags = 0;
dev_priv->ring.map.mtrr = 0; dev_priv->ring.map.mtrr = 0;
drm_core_ioremap(&dev_priv->ring.map, dev); drm_legacy_ioremap(&dev_priv->ring.map, dev);
if (dev_priv->ring.map.handle == NULL) { if (dev_priv->ring.map.handle == NULL) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -566,9 +566,9 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, ...@@ -566,9 +566,9 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
return err; return err;
} }
drm_core_ioremap(dev_priv->warp, dev); drm_legacy_ioremap(dev_priv->warp, dev);
drm_core_ioremap(dev_priv->primary, dev); drm_legacy_ioremap(dev_priv->primary, dev);
drm_core_ioremap(dev->agp_buffer_map, dev); drm_legacy_ioremap(dev->agp_buffer_map, dev);
if (!dev_priv->warp->handle || if (!dev_priv->warp->handle ||
!dev_priv->primary->handle || !dev->agp_buffer_map->handle) { !dev_priv->primary->handle || !dev->agp_buffer_map->handle) {
...@@ -821,37 +821,37 @@ static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init) ...@@ -821,37 +821,37 @@ static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init)
dev_priv->dma_access = MGA_PAGPXFER; dev_priv->dma_access = MGA_PAGPXFER;
dev_priv->wagp_enable = MGA_WAGP_ENABLE; dev_priv->wagp_enable = MGA_WAGP_ENABLE;
dev_priv->status = drm_core_findmap(dev, init->status_offset); dev_priv->status = drm_legacy_findmap(dev, init->status_offset);
if (!dev_priv->status) { if (!dev_priv->status) {
DRM_ERROR("failed to find status page!\n"); DRM_ERROR("failed to find status page!\n");
return -EINVAL; return -EINVAL;
} }
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio = drm_legacy_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio) { if (!dev_priv->mmio) {
DRM_ERROR("failed to find mmio region!\n"); DRM_ERROR("failed to find mmio region!\n");
return -EINVAL; return -EINVAL;
} }
dev_priv->warp = drm_core_findmap(dev, init->warp_offset); dev_priv->warp = drm_legacy_findmap(dev, init->warp_offset);
if (!dev_priv->warp) { if (!dev_priv->warp) {
DRM_ERROR("failed to find warp microcode region!\n"); DRM_ERROR("failed to find warp microcode region!\n");
return -EINVAL; return -EINVAL;
} }
dev_priv->primary = drm_core_findmap(dev, init->primary_offset); dev_priv->primary = drm_legacy_findmap(dev, init->primary_offset);
if (!dev_priv->primary) { if (!dev_priv->primary) {
DRM_ERROR("failed to find primary dma region!\n"); DRM_ERROR("failed to find primary dma region!\n");
return -EINVAL; return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = dev->agp_buffer_map =
drm_core_findmap(dev, init->buffers_offset); drm_legacy_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("failed to find dma buffer region!\n"); DRM_ERROR("failed to find dma buffer region!\n");
return -EINVAL; return -EINVAL;
} }
drm_core_ioremap(dev_priv->warp, dev); drm_legacy_ioremap(dev_priv->warp, dev);
drm_core_ioremap(dev_priv->primary, dev); drm_legacy_ioremap(dev_priv->primary, dev);
drm_core_ioremap(dev->agp_buffer_map, dev); drm_legacy_ioremap(dev->agp_buffer_map, dev);
} }
dev_priv->sarea_priv = dev_priv->sarea_priv =
...@@ -937,14 +937,14 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup) ...@@ -937,14 +937,14 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
if ((dev_priv->warp != NULL) if ((dev_priv->warp != NULL)
&& (dev_priv->warp->type != _DRM_CONSISTENT)) && (dev_priv->warp->type != _DRM_CONSISTENT))
drm_core_ioremapfree(dev_priv->warp, dev); drm_legacy_ioremapfree(dev_priv->warp, dev);
if ((dev_priv->primary != NULL) if ((dev_priv->primary != NULL)
&& (dev_priv->primary->type != _DRM_CONSISTENT)) && (dev_priv->primary->type != _DRM_CONSISTENT))
drm_core_ioremapfree(dev_priv->primary, dev); drm_legacy_ioremapfree(dev_priv->primary, dev);
if (dev->agp_buffer_map != NULL) if (dev->agp_buffer_map != NULL)
drm_core_ioremapfree(dev->agp_buffer_map, dev); drm_legacy_ioremapfree(dev->agp_buffer_map, dev);
if (dev_priv->used_new_dma_init) { if (dev_priv->used_new_dma_init) {
#if __OS_HAS_AGP #if __OS_HAS_AGP
......
...@@ -460,21 +460,21 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) ...@@ -460,21 +460,21 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
return -EINVAL; return -EINVAL;
} }
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio = drm_legacy_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio) { if (!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n"); DRM_ERROR("could not find mmio region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); dev_priv->cce_ring = drm_legacy_findmap(dev, init->ring_offset);
if (!dev_priv->cce_ring) { if (!dev_priv->cce_ring) {
DRM_ERROR("could not find cce ring region!\n"); DRM_ERROR("could not find cce ring region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce(dev); r128_do_cleanup_cce(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); dev_priv->ring_rptr = drm_legacy_findmap(dev, init->ring_rptr_offset);
if (!dev_priv->ring_rptr) { if (!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n"); DRM_ERROR("could not find ring read pointer!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
...@@ -482,7 +482,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) ...@@ -482,7 +482,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
return -EINVAL; return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_legacy_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n"); DRM_ERROR("could not find dma buffer region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
...@@ -492,7 +492,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) ...@@ -492,7 +492,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
if (!dev_priv->is_pci) { if (!dev_priv->is_pci) {
dev_priv->agp_textures = dev_priv->agp_textures =
drm_core_findmap(dev, init->agp_textures_offset); drm_legacy_findmap(dev, init->agp_textures_offset);
if (!dev_priv->agp_textures) { if (!dev_priv->agp_textures) {
DRM_ERROR("could not find agp texture region!\n"); DRM_ERROR("could not find agp texture region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
...@@ -507,9 +507,9 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) ...@@ -507,9 +507,9 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (!dev_priv->is_pci) { if (!dev_priv->is_pci) {
drm_core_ioremap_wc(dev_priv->cce_ring, dev); drm_legacy_ioremap_wc(dev_priv->cce_ring, dev);
drm_core_ioremap_wc(dev_priv->ring_rptr, dev); drm_legacy_ioremap_wc(dev_priv->ring_rptr, dev);
drm_core_ioremap_wc(dev->agp_buffer_map, dev); drm_legacy_ioremap_wc(dev->agp_buffer_map, dev);
if (!dev_priv->cce_ring->handle || if (!dev_priv->cce_ring->handle ||
!dev_priv->ring_rptr->handle || !dev_priv->ring_rptr->handle ||
!dev->agp_buffer_map->handle) { !dev->agp_buffer_map->handle) {
...@@ -603,11 +603,11 @@ int r128_do_cleanup_cce(struct drm_device *dev) ...@@ -603,11 +603,11 @@ int r128_do_cleanup_cce(struct drm_device *dev)
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (!dev_priv->is_pci) { if (!dev_priv->is_pci) {
if (dev_priv->cce_ring != NULL) if (dev_priv->cce_ring != NULL)
drm_core_ioremapfree(dev_priv->cce_ring, dev); drm_legacy_ioremapfree(dev_priv->cce_ring, dev);
if (dev_priv->ring_rptr != NULL) if (dev_priv->ring_rptr != NULL)
drm_core_ioremapfree(dev_priv->ring_rptr, dev); drm_legacy_ioremapfree(dev_priv->ring_rptr, dev);
if (dev->agp_buffer_map != NULL) { if (dev->agp_buffer_map != NULL) {
drm_core_ioremapfree(dev->agp_buffer_map, dev); drm_legacy_ioremapfree(dev->agp_buffer_map, dev);
dev->agp_buffer_map = NULL; dev->agp_buffer_map = NULL;
} }
} else } else
......
...@@ -1949,15 +1949,15 @@ int r600_do_cleanup_cp(struct drm_device *dev) ...@@ -1949,15 +1949,15 @@ int r600_do_cleanup_cp(struct drm_device *dev)
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (dev_priv->flags & RADEON_IS_AGP) { if (dev_priv->flags & RADEON_IS_AGP) {
if (dev_priv->cp_ring != NULL) { if (dev_priv->cp_ring != NULL) {
drm_core_ioremapfree(dev_priv->cp_ring, dev); drm_legacy_ioremapfree(dev_priv->cp_ring, dev);
dev_priv->cp_ring = NULL; dev_priv->cp_ring = NULL;
} }
if (dev_priv->ring_rptr != NULL) { if (dev_priv->ring_rptr != NULL) {
drm_core_ioremapfree(dev_priv->ring_rptr, dev); drm_legacy_ioremapfree(dev_priv->ring_rptr, dev);
dev_priv->ring_rptr = NULL; dev_priv->ring_rptr = NULL;
} }
if (dev->agp_buffer_map != NULL) { if (dev->agp_buffer_map != NULL) {
drm_core_ioremapfree(dev->agp_buffer_map, dev); drm_legacy_ioremapfree(dev->agp_buffer_map, dev);
dev->agp_buffer_map = NULL; dev->agp_buffer_map = NULL;
} }
} else } else
...@@ -1968,7 +1968,7 @@ int r600_do_cleanup_cp(struct drm_device *dev) ...@@ -1968,7 +1968,7 @@ int r600_do_cleanup_cp(struct drm_device *dev)
r600_page_table_cleanup(dev, &dev_priv->gart_info); r600_page_table_cleanup(dev, &dev_priv->gart_info);
if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) { if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) {
drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); drm_legacy_ioremapfree(&dev_priv->gart_info.mapping, dev);
dev_priv->gart_info.addr = NULL; dev_priv->gart_info.addr = NULL;
} }
} }
...@@ -2059,20 +2059,20 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -2059,20 +2059,20 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
return -EINVAL; return -EINVAL;
} }
dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); dev_priv->cp_ring = drm_legacy_findmap(dev, init->ring_offset);
if (!dev_priv->cp_ring) { if (!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n"); DRM_ERROR("could not find cp ring region!\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); dev_priv->ring_rptr = drm_legacy_findmap(dev, init->ring_rptr_offset);
if (!dev_priv->ring_rptr) { if (!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n"); DRM_ERROR("could not find ring read pointer!\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
return -EINVAL; return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_legacy_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n"); DRM_ERROR("could not find dma buffer region!\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
...@@ -2081,7 +2081,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -2081,7 +2081,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
if (init->gart_textures_offset) { if (init->gart_textures_offset) {
dev_priv->gart_textures = dev_priv->gart_textures =
drm_core_findmap(dev, init->gart_textures_offset); drm_legacy_findmap(dev, init->gart_textures_offset);
if (!dev_priv->gart_textures) { if (!dev_priv->gart_textures) {
DRM_ERROR("could not find GART texture region!\n"); DRM_ERROR("could not find GART texture region!\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
...@@ -2092,9 +2092,9 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -2092,9 +2092,9 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
#if __OS_HAS_AGP #if __OS_HAS_AGP
/* XXX */ /* XXX */
if (dev_priv->flags & RADEON_IS_AGP) { if (dev_priv->flags & RADEON_IS_AGP) {
drm_core_ioremap_wc(dev_priv->cp_ring, dev); drm_legacy_ioremap_wc(dev_priv->cp_ring, dev);
drm_core_ioremap_wc(dev_priv->ring_rptr, dev); drm_legacy_ioremap_wc(dev_priv->ring_rptr, dev);
drm_core_ioremap_wc(dev->agp_buffer_map, dev); drm_legacy_ioremap_wc(dev->agp_buffer_map, dev);
if (!dev_priv->cp_ring->handle || if (!dev_priv->cp_ring->handle ||
!dev_priv->ring_rptr->handle || !dev_priv->ring_rptr->handle ||
!dev->agp_buffer_map->handle) { !dev->agp_buffer_map->handle) {
...@@ -2235,7 +2235,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -2235,7 +2235,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
dev_priv->gart_info.mapping.size = dev_priv->gart_info.mapping.size =
dev_priv->gart_info.table_size; dev_priv->gart_info.table_size;
drm_core_ioremap_wc(&dev_priv->gart_info.mapping, dev); drm_legacy_ioremap_wc(&dev_priv->gart_info.mapping, dev);
if (!dev_priv->gart_info.mapping.handle) { if (!dev_priv->gart_info.mapping.handle) {
DRM_ERROR("ioremap failed.\n"); DRM_ERROR("ioremap failed.\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
......
...@@ -1305,20 +1305,20 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -1305,20 +1305,20 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
return -EINVAL; return -EINVAL;
} }
dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); dev_priv->cp_ring = drm_legacy_findmap(dev, init->ring_offset);
if (!dev_priv->cp_ring) { if (!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n"); DRM_ERROR("could not find cp ring region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); dev_priv->ring_rptr = drm_legacy_findmap(dev, init->ring_rptr_offset);
if (!dev_priv->ring_rptr) { if (!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n"); DRM_ERROR("could not find ring read pointer!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
return -EINVAL; return -EINVAL;
} }
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); dev->agp_buffer_map = drm_legacy_findmap(dev, init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find dma buffer region!\n"); DRM_ERROR("could not find dma buffer region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
...@@ -1327,7 +1327,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -1327,7 +1327,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
if (init->gart_textures_offset) { if (init->gart_textures_offset) {
dev_priv->gart_textures = dev_priv->gart_textures =
drm_core_findmap(dev, init->gart_textures_offset); drm_legacy_findmap(dev, init->gart_textures_offset);
if (!dev_priv->gart_textures) { if (!dev_priv->gart_textures) {
DRM_ERROR("could not find GART texture region!\n"); DRM_ERROR("could not find GART texture region!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
...@@ -1337,9 +1337,9 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -1337,9 +1337,9 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (dev_priv->flags & RADEON_IS_AGP) { if (dev_priv->flags & RADEON_IS_AGP) {
drm_core_ioremap_wc(dev_priv->cp_ring, dev); drm_legacy_ioremap_wc(dev_priv->cp_ring, dev);
drm_core_ioremap_wc(dev_priv->ring_rptr, dev); drm_legacy_ioremap_wc(dev_priv->ring_rptr, dev);
drm_core_ioremap_wc(dev->agp_buffer_map, dev); drm_legacy_ioremap_wc(dev->agp_buffer_map, dev);
if (!dev_priv->cp_ring->handle || if (!dev_priv->cp_ring->handle ||
!dev_priv->ring_rptr->handle || !dev_priv->ring_rptr->handle ||
!dev->agp_buffer_map->handle) { !dev->agp_buffer_map->handle) {
...@@ -1475,7 +1475,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -1475,7 +1475,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
dev_priv->gart_info.mapping.size = dev_priv->gart_info.mapping.size =
dev_priv->gart_info.table_size; dev_priv->gart_info.table_size;
drm_core_ioremap_wc(&dev_priv->gart_info.mapping, dev); drm_legacy_ioremap_wc(&dev_priv->gart_info.mapping, dev);
dev_priv->gart_info.addr = dev_priv->gart_info.addr =
dev_priv->gart_info.mapping.handle; dev_priv->gart_info.mapping.handle;
...@@ -1569,15 +1569,15 @@ static int radeon_do_cleanup_cp(struct drm_device * dev) ...@@ -1569,15 +1569,15 @@ static int radeon_do_cleanup_cp(struct drm_device * dev)
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (dev_priv->flags & RADEON_IS_AGP) { if (dev_priv->flags & RADEON_IS_AGP) {
if (dev_priv->cp_ring != NULL) { if (dev_priv->cp_ring != NULL) {
drm_core_ioremapfree(dev_priv->cp_ring, dev); drm_legacy_ioremapfree(dev_priv->cp_ring, dev);
dev_priv->cp_ring = NULL; dev_priv->cp_ring = NULL;
} }
if (dev_priv->ring_rptr != NULL) { if (dev_priv->ring_rptr != NULL) {
drm_core_ioremapfree(dev_priv->ring_rptr, dev); drm_legacy_ioremapfree(dev_priv->ring_rptr, dev);
dev_priv->ring_rptr = NULL; dev_priv->ring_rptr = NULL;
} }
if (dev->agp_buffer_map != NULL) { if (dev->agp_buffer_map != NULL) {
drm_core_ioremapfree(dev->agp_buffer_map, dev); drm_legacy_ioremapfree(dev->agp_buffer_map, dev);
dev->agp_buffer_map = NULL; dev->agp_buffer_map = NULL;
} }
} else } else
...@@ -1597,7 +1597,7 @@ static int radeon_do_cleanup_cp(struct drm_device * dev) ...@@ -1597,7 +1597,7 @@ static int radeon_do_cleanup_cp(struct drm_device * dev)
if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB)
{ {
drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); drm_legacy_ioremapfree(&dev_priv->gart_info.mapping, dev);
dev_priv->gart_info.addr = NULL; dev_priv->gart_info.addr = NULL;
} }
} }
......
...@@ -706,7 +706,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -706,7 +706,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
return -EINVAL; return -EINVAL;
} }
if (init->status_offset != 0) { if (init->status_offset != 0) {
dev_priv->status = drm_core_findmap(dev, init->status_offset); dev_priv->status = drm_legacy_findmap(dev, init->status_offset);
if (!dev_priv->status) { if (!dev_priv->status) {
DRM_ERROR("could not find shadow status region!\n"); DRM_ERROR("could not find shadow status region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
...@@ -717,14 +717,14 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -717,14 +717,14 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
} }
if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) { if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) {
dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_token = init->buffers_offset;
dev->agp_buffer_map = drm_core_findmap(dev, dev->agp_buffer_map = drm_legacy_findmap(dev,
init->buffers_offset); init->buffers_offset);
if (!dev->agp_buffer_map) { if (!dev->agp_buffer_map) {
DRM_ERROR("could not find DMA buffer region!\n"); DRM_ERROR("could not find DMA buffer region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return -EINVAL; return -EINVAL;
} }
drm_core_ioremap(dev->agp_buffer_map, dev); drm_legacy_ioremap(dev->agp_buffer_map, dev);
if (!dev->agp_buffer_map->handle) { if (!dev->agp_buffer_map->handle) {
DRM_ERROR("failed to ioremap DMA buffer region!\n"); DRM_ERROR("failed to ioremap DMA buffer region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
...@@ -733,7 +733,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -733,7 +733,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
} }
if (init->agp_textures_offset) { if (init->agp_textures_offset) {
dev_priv->agp_textures = dev_priv->agp_textures =
drm_core_findmap(dev, init->agp_textures_offset); drm_legacy_findmap(dev, init->agp_textures_offset);
if (!dev_priv->agp_textures) { if (!dev_priv->agp_textures) {
DRM_ERROR("could not find agp texture region!\n"); DRM_ERROR("could not find agp texture region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
...@@ -756,7 +756,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -756,7 +756,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset); dev_priv->cmd_dma = drm_legacy_findmap(dev, init->cmd_dma_offset);
if (!dev_priv->cmd_dma) { if (!dev_priv->cmd_dma) {
DRM_ERROR("could not find command DMA region!\n"); DRM_ERROR("could not find command DMA region!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
...@@ -769,7 +769,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -769,7 +769,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
return -EINVAL; return -EINVAL;
} }
drm_core_ioremap(dev_priv->cmd_dma, dev); drm_legacy_ioremap(dev_priv->cmd_dma, dev);
if (!dev_priv->cmd_dma->handle) { if (!dev_priv->cmd_dma->handle) {
DRM_ERROR("failed to ioremap command " DRM_ERROR("failed to ioremap command "
"DMA region!\n"); "DMA region!\n");
...@@ -895,11 +895,11 @@ static int savage_do_cleanup_bci(struct drm_device * dev) ...@@ -895,11 +895,11 @@ static int savage_do_cleanup_bci(struct drm_device * dev)
} else if (dev_priv->cmd_dma && dev_priv->cmd_dma->handle && } else if (dev_priv->cmd_dma && dev_priv->cmd_dma->handle &&
dev_priv->cmd_dma->type == _DRM_AGP && dev_priv->cmd_dma->type == _DRM_AGP &&
dev_priv->dma_type == SAVAGE_DMA_AGP) dev_priv->dma_type == SAVAGE_DMA_AGP)
drm_core_ioremapfree(dev_priv->cmd_dma, dev); drm_legacy_ioremapfree(dev_priv->cmd_dma, dev);
if (dev_priv->dma_type == SAVAGE_DMA_AGP && if (dev_priv->dma_type == SAVAGE_DMA_AGP &&
dev->agp_buffer_map && dev->agp_buffer_map->handle) { dev->agp_buffer_map && dev->agp_buffer_map->handle) {
drm_core_ioremapfree(dev->agp_buffer_map, dev); drm_legacy_ioremapfree(dev->agp_buffer_map, dev);
/* make sure the next instance (which may be running /* make sure the next instance (which may be running
* in PCI mode) doesn't try to use an old * in PCI mode) doesn't try to use an old
* agp_buffer_map. */ * agp_buffer_map. */
......
...@@ -161,7 +161,7 @@ int via_dma_cleanup(struct drm_device *dev) ...@@ -161,7 +161,7 @@ int via_dma_cleanup(struct drm_device *dev)
if (dev_priv->ring.virtual_start) { if (dev_priv->ring.virtual_start) {
via_cmdbuf_reset(dev_priv); via_cmdbuf_reset(dev_priv);
drm_core_ioremapfree(&dev_priv->ring.map, dev); drm_legacy_ioremapfree(&dev_priv->ring.map, dev);
dev_priv->ring.virtual_start = NULL; dev_priv->ring.virtual_start = NULL;
} }
...@@ -200,7 +200,7 @@ static int via_initialize(struct drm_device *dev, ...@@ -200,7 +200,7 @@ static int via_initialize(struct drm_device *dev,
dev_priv->ring.map.flags = 0; dev_priv->ring.map.flags = 0;
dev_priv->ring.map.mtrr = 0; dev_priv->ring.map.mtrr = 0;
drm_core_ioremap(&dev_priv->ring.map, dev); drm_legacy_ioremap(&dev_priv->ring.map, dev);
if (dev_priv->ring.map.handle == NULL) { if (dev_priv->ring.map.handle == NULL) {
via_dma_cleanup(dev); via_dma_cleanup(dev);
......
...@@ -39,14 +39,14 @@ static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init) ...@@ -39,14 +39,14 @@ static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init)
return -EINVAL; return -EINVAL;
} }
dev_priv->fb = drm_core_findmap(dev, init->fb_offset); dev_priv->fb = drm_legacy_findmap(dev, init->fb_offset);
if (!dev_priv->fb) { if (!dev_priv->fb) {
DRM_ERROR("could not find framebuffer!\n"); DRM_ERROR("could not find framebuffer!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
via_do_cleanup_map(dev); via_do_cleanup_map(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio = drm_legacy_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio) { if (!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n"); DRM_ERROR("could not find mmio region!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -1310,24 +1310,6 @@ struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, ...@@ -1310,24 +1310,6 @@ struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
struct drm_file *filp, struct drm_file *filp,
u32 handle); u32 handle);
extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
unsigned int token)
{
struct drm_map_list *_entry;
list_for_each_entry(_entry, &dev->maplist, head)
if (_entry->user_token == token)
return _entry->map;
return NULL;
}
static __inline__ void drm_core_dropmap(struct drm_local_map *map)
{
}
struct drm_device *drm_dev_alloc(struct drm_driver *driver, struct drm_device *drm_dev_alloc(struct drm_driver *driver,
struct device *parent); struct device *parent);
void drm_dev_ref(struct drm_device *dev); void drm_dev_ref(struct drm_device *dev);
......
...@@ -58,4 +58,19 @@ void drm_legacy_idlelock_release(struct drm_lock_data *lock); ...@@ -58,4 +58,19 @@ void drm_legacy_idlelock_release(struct drm_lock_data *lock);
/* drm_pci.c dma alloc wrappers */ /* drm_pci.c dma alloc wrappers */
void __drm_legacy_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); void __drm_legacy_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
/* drm_memory.c */
void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev);
void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
static __inline__ struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
unsigned int token)
{
struct drm_map_list *_entry;
list_for_each_entry(_entry, &dev->maplist, head)
if (_entry->user_token == token)
return _entry->map;
return NULL;
}
#endif /* __DRM_DRM_LEGACY_H__ */ #endif /* __DRM_DRM_LEGACY_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment