Commit 9fc5cde7 authored by David Herrmann's avatar David Herrmann Committed by Dave Airlie

drm: mark drm_buf and drm_map as legacy

Move internal declarations to drm_legacy.h and add drm_legacy_*() prefix
to all legacy functions.

[airlied: add a bit of an explaination to drm_legacy.h]
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 9f50bd89
/**
* \file drm_bufs.c
* Generic buffer template
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/* /*
* Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com * Legacy: Generic DRM Buffer Management
* *
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved. * All Rights Reserved.
* *
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
* Author: Gareth Hughes <gareth@valinux.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
...@@ -39,6 +34,7 @@ ...@@ -39,6 +34,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <asm/shmparam.h> #include <asm/shmparam.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include "drm_legacy.h"
static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
struct drm_local_map *map) struct drm_local_map *map)
...@@ -365,9 +361,9 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, ...@@ -365,9 +361,9 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
return 0; return 0;
} }
int drm_addmap(struct drm_device * dev, resource_size_t offset, int drm_legacy_addmap(struct drm_device * dev, resource_size_t offset,
unsigned int size, enum drm_map_type type, unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, struct drm_local_map ** map_ptr) enum drm_map_flags flags, struct drm_local_map **map_ptr)
{ {
struct drm_map_list *list; struct drm_map_list *list;
int rc; int rc;
...@@ -377,8 +373,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset, ...@@ -377,8 +373,7 @@ int drm_addmap(struct drm_device * dev, resource_size_t offset,
*map_ptr = list->map; *map_ptr = list->map;
return rc; return rc;
} }
EXPORT_SYMBOL(drm_legacy_addmap);
EXPORT_SYMBOL(drm_addmap);
/** /**
* Ioctl to specify a range of memory that is available for mapping by a * Ioctl to specify a range of memory that is available for mapping by a
...@@ -391,8 +386,8 @@ EXPORT_SYMBOL(drm_addmap); ...@@ -391,8 +386,8 @@ EXPORT_SYMBOL(drm_addmap);
* \return zero on success or a negative value on error. * \return zero on success or a negative value on error.
* *
*/ */
int drm_addmap_ioctl(struct drm_device *dev, void *data, int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_map *map = data; struct drm_map *map = data;
struct drm_map_list *maplist; struct drm_map_list *maplist;
...@@ -429,9 +424,9 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data, ...@@ -429,9 +424,9 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data,
* its being used, and free any associate resource (such as MTRR's) if it's not * its being used, and free any associate resource (such as MTRR's) if it's not
* being on use. * being on use.
* *
* \sa drm_addmap * \sa drm_legacy_addmap
*/ */
int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
{ {
struct drm_map_list *r_list = NULL, *list_t; struct drm_map_list *r_list = NULL, *list_t;
drm_dma_handle_t dmah; drm_dma_handle_t dmah;
...@@ -485,19 +480,19 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) ...@@ -485,19 +480,19 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
return 0; return 0;
} }
EXPORT_SYMBOL(drm_rmmap_locked); EXPORT_SYMBOL(drm_legacy_rmmap_locked);
int drm_rmmap(struct drm_device *dev, struct drm_local_map *map) int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
{ {
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = drm_rmmap_locked(dev, map); ret = drm_legacy_rmmap_locked(dev, map);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_rmmap); EXPORT_SYMBOL(drm_legacy_rmmap);
/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on
* the last close of the device, and this is necessary for cleanup when things * the last close of the device, and this is necessary for cleanup when things
...@@ -514,8 +509,8 @@ EXPORT_SYMBOL(drm_rmmap); ...@@ -514,8 +509,8 @@ EXPORT_SYMBOL(drm_rmmap);
* \param arg pointer to a struct drm_map structure. * \param arg pointer to a struct drm_map structure.
* \return zero on success or a negative value on error. * \return zero on success or a negative value on error.
*/ */
int drm_rmmap_ioctl(struct drm_device *dev, void *data, int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_map *request = data; struct drm_map *request = data;
struct drm_local_map *map = NULL; struct drm_local_map *map = NULL;
...@@ -546,7 +541,7 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data, ...@@ -546,7 +541,7 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data,
return 0; return 0;
} }
ret = drm_rmmap_locked(dev, map); ret = drm_legacy_rmmap_locked(dev, map);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -599,7 +594,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev, ...@@ -599,7 +594,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev,
* reallocates the buffer list of the same size order to accommodate the new * reallocates the buffer list of the same size order to accommodate the new
* buffers. * buffers.
*/ */
int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) int drm_legacy_addbufs_agp(struct drm_device *dev,
struct drm_buf_desc *request)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
struct drm_buf_entry *entry; struct drm_buf_entry *entry;
...@@ -759,10 +755,11 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) ...@@ -759,10 +755,11 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
atomic_dec(&dev->buf_alloc); atomic_dec(&dev->buf_alloc);
return 0; return 0;
} }
EXPORT_SYMBOL(drm_addbufs_agp); EXPORT_SYMBOL(drm_legacy_addbufs_agp);
#endif /* __OS_HAS_AGP */ #endif /* __OS_HAS_AGP */
int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) int drm_legacy_addbufs_pci(struct drm_device *dev,
struct drm_buf_desc *request)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int count; int count;
...@@ -964,9 +961,10 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) ...@@ -964,9 +961,10 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
return 0; return 0;
} }
EXPORT_SYMBOL(drm_addbufs_pci); EXPORT_SYMBOL(drm_legacy_addbufs_pci);
static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request) static int drm_legacy_addbufs_sg(struct drm_device *dev,
struct drm_buf_desc *request)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
struct drm_buf_entry *entry; struct drm_buf_entry *entry;
...@@ -1135,8 +1133,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request ...@@ -1135,8 +1133,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
* addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
* PCI memory respectively. * PCI memory respectively.
*/ */
int drm_addbufs(struct drm_device *dev, void *data, int drm_legacy_addbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_buf_desc *request = data; struct drm_buf_desc *request = data;
int ret; int ret;
...@@ -1149,15 +1147,15 @@ int drm_addbufs(struct drm_device *dev, void *data, ...@@ -1149,15 +1147,15 @@ int drm_addbufs(struct drm_device *dev, void *data,
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (request->flags & _DRM_AGP_BUFFER) if (request->flags & _DRM_AGP_BUFFER)
ret = drm_addbufs_agp(dev, request); ret = drm_legacy_addbufs_agp(dev, request);
else else
#endif #endif
if (request->flags & _DRM_SG_BUFFER) if (request->flags & _DRM_SG_BUFFER)
ret = drm_addbufs_sg(dev, request); ret = drm_legacy_addbufs_sg(dev, request);
else if (request->flags & _DRM_FB_BUFFER) else if (request->flags & _DRM_FB_BUFFER)
ret = -EINVAL; ret = -EINVAL;
else else
ret = drm_addbufs_pci(dev, request); ret = drm_legacy_addbufs_pci(dev, request);
return ret; return ret;
} }
...@@ -1179,8 +1177,8 @@ int drm_addbufs(struct drm_device *dev, void *data, ...@@ -1179,8 +1177,8 @@ int drm_addbufs(struct drm_device *dev, void *data,
* lock, preventing of allocating more buffers after this call. Information * lock, preventing of allocating more buffers after this call. Information
* about each requested buffer is then copied into user space. * about each requested buffer is then copied into user space.
*/ */
int drm_infobufs(struct drm_device *dev, void *data, int drm_legacy_infobufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
struct drm_buf_info *request = data; struct drm_buf_info *request = data;
...@@ -1260,8 +1258,8 @@ int drm_infobufs(struct drm_device *dev, void *data, ...@@ -1260,8 +1258,8 @@ int drm_infobufs(struct drm_device *dev, void *data,
* *
* \note This ioctl is deprecated and mostly never used. * \note This ioctl is deprecated and mostly never used.
*/ */
int drm_markbufs(struct drm_device *dev, void *data, int drm_legacy_markbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
struct drm_buf_desc *request = data; struct drm_buf_desc *request = data;
...@@ -1307,8 +1305,8 @@ int drm_markbufs(struct drm_device *dev, void *data, ...@@ -1307,8 +1305,8 @@ int drm_markbufs(struct drm_device *dev, void *data,
* Calls free_buffer() for each used buffer. * Calls free_buffer() for each used buffer.
* This function is primarily used for debugging. * This function is primarily used for debugging.
*/ */
int drm_freebufs(struct drm_device *dev, void *data, int drm_legacy_freebufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
struct drm_buf_free *request = data; struct drm_buf_free *request = data;
...@@ -1360,8 +1358,8 @@ int drm_freebufs(struct drm_device *dev, void *data, ...@@ -1360,8 +1358,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
* offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
* drm_mmap_dma(). * drm_mmap_dma().
*/ */
int drm_mapbufs(struct drm_device *dev, void *data, int drm_legacy_mapbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int retcode = 0; int retcode = 0;
...@@ -1448,7 +1446,7 @@ int drm_mapbufs(struct drm_device *dev, void *data, ...@@ -1448,7 +1446,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,
return retcode; return retcode;
} }
int drm_dma_ioctl(struct drm_device *dev, void *data, int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
if (drm_core_check_feature(dev, DRIVER_MODESET)) if (drm_core_check_feature(dev, DRIVER_MODESET))
...@@ -1460,7 +1458,7 @@ int drm_dma_ioctl(struct drm_device *dev, void *data, ...@@ -1460,7 +1458,7 @@ int drm_dma_ioctl(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
} }
struct drm_local_map *drm_getsarea(struct drm_device *dev) struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev)
{ {
struct drm_map_list *entry; struct drm_map_list *entry;
...@@ -1472,4 +1470,4 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev) ...@@ -1472,4 +1470,4 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev)
} }
return NULL; return NULL;
} }
EXPORT_SYMBOL(drm_getsarea); EXPORT_SYMBOL(drm_legacy_getsarea);
...@@ -143,7 +143,7 @@ static void drm_master_destroy(struct kref *kref) ...@@ -143,7 +143,7 @@ static void drm_master_destroy(struct kref *kref)
list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) { list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
if (r_list->master == master) { if (r_list->master == master) {
drm_rmmap_locked(dev, r_list->map); drm_legacy_rmmap_locked(dev, r_list->map);
r_list = NULL; r_list = NULL;
} }
} }
...@@ -779,7 +779,7 @@ void drm_dev_unregister(struct drm_device *dev) ...@@ -779,7 +779,7 @@ void drm_dev_unregister(struct drm_device *dev)
drm_vblank_cleanup(dev); drm_vblank_cleanup(dev);
list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
drm_rmmap(dev, r_list->map); drm_legacy_rmmap(dev, r_list->map);
drm_minor_unregister(dev, DRM_MINOR_LEGACY); drm_minor_unregister(dev, DRM_MINOR_LEGACY);
drm_minor_unregister(dev, DRM_MINOR_RENDER); drm_minor_unregister(dev, DRM_MINOR_RENDER);
......
...@@ -62,8 +62,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { ...@@ -62,8 +62,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_MASTER), DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_MASTER),
DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_legacy_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_rmmap_ioctl, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_legacy_rmmap_ioctl, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_legacy_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_legacy_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_legacy_getsareactx, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_legacy_getsareactx, DRM_AUTH),
...@@ -87,12 +87,12 @@ static const struct drm_ioctl_desc drm_ioctls[] = { ...@@ -87,12 +87,12 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_ADD_BUFS, drm_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_ADD_BUFS, drm_legacy_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_MARK_BUFS, drm_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_MARK_BUFS, drm_legacy_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_legacy_infobufs, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_legacy_mapbufs, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_legacy_freebufs, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_legacy_dma_ioctl, DRM_AUTH),
DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
/*
* This file contains legacy interfaces that modern drm drivers
* should no longer be using. They cannot be removed as legacy
* drivers use them, and removing them are API breaks.
*/
struct drm_device; struct drm_device;
struct drm_file; struct drm_file;
...@@ -48,4 +53,19 @@ int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f); ...@@ -48,4 +53,19 @@ int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
/*
* Generic Buffer Management
*/
#define DRM_MAP_HASH_OFFSET 0x10000000
int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
#endif /* __DRM_LEGACY_H__ */ #endif /* __DRM_LEGACY_H__ */
...@@ -196,7 +196,7 @@ static int i915_initialize(struct drm_device *dev, drm_i915_init_t *init) ...@@ -196,7 +196,7 @@ static int i915_initialize(struct drm_device *dev, drm_i915_init_t *init)
struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
int ret; int ret;
master_priv->sarea = drm_getsarea(dev); master_priv->sarea = drm_legacy_getsarea(dev);
if (master_priv->sarea) { if (master_priv->sarea) {
master_priv->sarea_priv = (drm_i915_sarea_t *) master_priv->sarea_priv = (drm_i915_sarea_t *)
((u8 *)master_priv->sarea->handle + init->sarea_priv_offset); ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
......
...@@ -502,31 +502,31 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, ...@@ -502,31 +502,31 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
return err; return err;
} }
/* Make drm_addbufs happy by not trying to create a mapping for less /* Make drm_legacy_addbufs happy by not trying to create a mapping for
* than a page. * less than a page.
*/ */
if (warp_size < PAGE_SIZE) if (warp_size < PAGE_SIZE)
warp_size = PAGE_SIZE; warp_size = PAGE_SIZE;
offset = 0; offset = 0;
err = drm_addmap(dev, offset, warp_size, err = drm_legacy_addmap(dev, offset, warp_size,
_DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp);
if (err) { if (err) {
DRM_ERROR("Unable to map WARP microcode: %d\n", err); DRM_ERROR("Unable to map WARP microcode: %d\n", err);
return err; return err;
} }
offset += warp_size; offset += warp_size;
err = drm_addmap(dev, offset, dma_bs->primary_size, err = drm_legacy_addmap(dev, offset, dma_bs->primary_size,
_DRM_AGP, _DRM_READ_ONLY, &dev_priv->primary); _DRM_AGP, _DRM_READ_ONLY, &dev_priv->primary);
if (err) { if (err) {
DRM_ERROR("Unable to map primary DMA region: %d\n", err); DRM_ERROR("Unable to map primary DMA region: %d\n", err);
return err; return err;
} }
offset += dma_bs->primary_size; offset += dma_bs->primary_size;
err = drm_addmap(dev, offset, secondary_size, err = drm_legacy_addmap(dev, offset, secondary_size,
_DRM_AGP, 0, &dev->agp_buffer_map); _DRM_AGP, 0, &dev->agp_buffer_map);
if (err) { if (err) {
DRM_ERROR("Unable to map secondary DMA region: %d\n", err); DRM_ERROR("Unable to map secondary DMA region: %d\n", err);
return err; return err;
...@@ -538,7 +538,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, ...@@ -538,7 +538,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
req.flags = _DRM_AGP_BUFFER; req.flags = _DRM_AGP_BUFFER;
req.agp_start = offset; req.agp_start = offset;
err = drm_addbufs_agp(dev, &req); err = drm_legacy_addbufs_agp(dev, &req);
if (err) { if (err) {
DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err); DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err);
return err; return err;
...@@ -559,8 +559,8 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, ...@@ -559,8 +559,8 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
} }
offset += secondary_size; offset += secondary_size;
err = drm_addmap(dev, offset, agp_size - offset, err = drm_legacy_addmap(dev, offset, agp_size - offset,
_DRM_AGP, 0, &dev_priv->agp_textures); _DRM_AGP, 0, &dev_priv->agp_textures);
if (err) { if (err) {
DRM_ERROR("Unable to map AGP texture region %d\n", err); DRM_ERROR("Unable to map AGP texture region %d\n", err);
return err; return err;
...@@ -602,7 +602,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, ...@@ -602,7 +602,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
* *
* \todo * \todo
* Determine whether the maximum address passed to drm_pci_alloc is correct. * Determine whether the maximum address passed to drm_pci_alloc is correct.
* The same goes for drm_addbufs_pci. * The same goes for drm_legacy_addbufs_pci.
* *
* \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap * \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap
*/ */
...@@ -622,15 +622,15 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev, ...@@ -622,15 +622,15 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
return -EFAULT; return -EFAULT;
} }
/* Make drm_addbufs happy by not trying to create a mapping for less /* Make drm_legacy_addbufs happy by not trying to create a mapping for
* than a page. * less than a page.
*/ */
if (warp_size < PAGE_SIZE) if (warp_size < PAGE_SIZE)
warp_size = PAGE_SIZE; warp_size = PAGE_SIZE;
/* The proper alignment is 0x100 for this mapping */ /* The proper alignment is 0x100 for this mapping */
err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, err = drm_legacy_addmap(dev, 0, warp_size, _DRM_CONSISTENT,
_DRM_READ_ONLY, &dev_priv->warp); _DRM_READ_ONLY, &dev_priv->warp);
if (err != 0) { if (err != 0) {
DRM_ERROR("Unable to create mapping for WARP microcode: %d\n", DRM_ERROR("Unable to create mapping for WARP microcode: %d\n",
err); err);
...@@ -645,8 +645,8 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev, ...@@ -645,8 +645,8 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
for (primary_size = dma_bs->primary_size; primary_size != 0; for (primary_size = dma_bs->primary_size; primary_size != 0;
primary_size >>= 1) { primary_size >>= 1) {
/* The proper alignment for this mapping is 0x04 */ /* The proper alignment for this mapping is 0x04 */
err = drm_addmap(dev, 0, primary_size, _DRM_CONSISTENT, err = drm_legacy_addmap(dev, 0, primary_size, _DRM_CONSISTENT,
_DRM_READ_ONLY, &dev_priv->primary); _DRM_READ_ONLY, &dev_priv->primary);
if (!err) if (!err)
break; break;
} }
...@@ -669,7 +669,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev, ...@@ -669,7 +669,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
req.count = bin_count; req.count = bin_count;
req.size = dma_bs->secondary_bin_size; req.size = dma_bs->secondary_bin_size;
err = drm_addbufs_pci(dev, &req); err = drm_legacy_addbufs_pci(dev, &req);
if (!err) if (!err)
break; break;
} }
...@@ -708,15 +708,16 @@ static int mga_do_dma_bootstrap(struct drm_device *dev, ...@@ -708,15 +708,16 @@ static int mga_do_dma_bootstrap(struct drm_device *dev,
/* The first steps are the same for both PCI and AGP based DMA. Map /* The first steps are the same for both PCI and AGP based DMA. Map
* the cards MMIO registers and map a status page. * the cards MMIO registers and map a status page.
*/ */
err = drm_addmap(dev, dev_priv->mmio_base, dev_priv->mmio_size, err = drm_legacy_addmap(dev, dev_priv->mmio_base, dev_priv->mmio_size,
_DRM_REGISTERS, _DRM_READ_ONLY, &dev_priv->mmio); _DRM_REGISTERS, _DRM_READ_ONLY,
&dev_priv->mmio);
if (err) { if (err) {
DRM_ERROR("Unable to map MMIO region: %d\n", err); DRM_ERROR("Unable to map MMIO region: %d\n", err);
return err; return err;
} }
err = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, err = drm_legacy_addmap(dev, 0, SAREA_MAX, _DRM_SHM,
_DRM_READ_ONLY | _DRM_LOCKED | _DRM_KERNEL, _DRM_READ_ONLY | _DRM_LOCKED | _DRM_KERNEL,
&dev_priv->status); &dev_priv->status);
if (err) { if (err) {
DRM_ERROR("Unable to map status region: %d\n", err); DRM_ERROR("Unable to map status region: %d\n", err);
...@@ -809,7 +810,7 @@ static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init) ...@@ -809,7 +810,7 @@ static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init)
dev_priv->texture_offset = init->texture_offset[0]; dev_priv->texture_offset = init->texture_offset[0];
dev_priv->texture_size = init->texture_size[0]; dev_priv->texture_size = init->texture_size[0];
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_legacy_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("failed to find sarea!\n"); DRM_ERROR("failed to find sarea!\n");
return -EINVAL; return -EINVAL;
......
...@@ -452,7 +452,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) ...@@ -452,7 +452,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) | dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) |
(dev_priv->span_offset >> 5)); (dev_priv->span_offset >> 5));
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_legacy_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -2052,7 +2052,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -2052,7 +2052,7 @@ int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
dev_priv->buffers_offset = init->buffers_offset; dev_priv->buffers_offset = init->buffers_offset;
dev_priv->gart_textures_offset = init->gart_textures_offset; dev_priv->gart_textures_offset = init->gart_textures_offset;
master_priv->sarea = drm_getsarea(dev); master_priv->sarea = drm_legacy_getsarea(dev);
if (!master_priv->sarea) { if (!master_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
r600_do_cleanup_cp(dev); r600_do_cleanup_cp(dev);
......
...@@ -1298,7 +1298,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, ...@@ -1298,7 +1298,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
dev_priv->buffers_offset = init->buffers_offset; dev_priv->buffers_offset = init->buffers_offset;
dev_priv->gart_textures_offset = init->gart_textures_offset; dev_priv->gart_textures_offset = init->gart_textures_offset;
master_priv->sarea = drm_getsarea(dev); master_priv->sarea = drm_legacy_getsarea(dev);
if (!master_priv->sarea) { if (!master_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
radeon_do_cleanup_cp(dev); radeon_do_cleanup_cp(dev);
...@@ -2106,9 +2106,9 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -2106,9 +2106,9 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
else else
dev_priv->flags |= RADEON_IS_PCI; dev_priv->flags |= RADEON_IS_PCI;
ret = drm_addmap(dev, pci_resource_start(dev->pdev, 2), ret = drm_legacy_addmap(dev, pci_resource_start(dev->pdev, 2),
pci_resource_len(dev->pdev, 2), _DRM_REGISTERS, pci_resource_len(dev->pdev, 2), _DRM_REGISTERS,
_DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio); _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);
if (ret != 0) if (ret != 0)
return ret; return ret;
...@@ -2135,8 +2135,8 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master) ...@@ -2135,8 +2135,8 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)
/* prebuild the SAREA */ /* prebuild the SAREA */
sareapage = max_t(unsigned long, SAREA_MAX, PAGE_SIZE); sareapage = max_t(unsigned long, SAREA_MAX, PAGE_SIZE);
ret = drm_addmap(dev, 0, sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, ret = drm_legacy_addmap(dev, 0, sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK,
&master_priv->sarea); &master_priv->sarea);
if (ret) { if (ret) {
DRM_ERROR("SAREA setup failed\n"); DRM_ERROR("SAREA setup failed\n");
kfree(master_priv); kfree(master_priv);
...@@ -2162,7 +2162,7 @@ void radeon_master_destroy(struct drm_device *dev, struct drm_master *master) ...@@ -2162,7 +2162,7 @@ void radeon_master_destroy(struct drm_device *dev, struct drm_master *master)
master_priv->sarea_priv = NULL; master_priv->sarea_priv = NULL;
if (master_priv->sarea) if (master_priv->sarea)
drm_rmmap_locked(dev, master_priv->sarea); drm_legacy_rmmap_locked(dev, master_priv->sarea);
kfree(master_priv); kfree(master_priv);
...@@ -2181,9 +2181,9 @@ int radeon_driver_firstopen(struct drm_device *dev) ...@@ -2181,9 +2181,9 @@ int radeon_driver_firstopen(struct drm_device *dev)
dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE;
dev_priv->fb_aper_offset = pci_resource_start(dev->pdev, 0); dev_priv->fb_aper_offset = pci_resource_start(dev->pdev, 0);
ret = drm_addmap(dev, dev_priv->fb_aper_offset, ret = drm_legacy_addmap(dev, dev_priv->fb_aper_offset,
pci_resource_len(dev->pdev, 0), _DRM_FRAME_BUFFER, pci_resource_len(dev->pdev, 0),
_DRM_WRITE_COMBINING, &map); _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, &map);
if (ret != 0) if (ret != 0)
return ret; return ret;
...@@ -2196,7 +2196,7 @@ int radeon_driver_unload(struct drm_device *dev) ...@@ -2196,7 +2196,7 @@ int radeon_driver_unload(struct drm_device *dev)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
drm_rmmap(dev, dev_priv->mmio); drm_legacy_rmmap(dev, dev_priv->mmio);
kfree(dev_priv); kfree(dev_priv);
......
...@@ -556,7 +556,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -556,7 +556,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
/* /*
* Initialize mappings. On Savage4 and SavageIX the alignment * Initialize mappings. On Savage4 and SavageIX the alignment
* and size of the aperture is not suitable for automatic MTRR setup * and size of the aperture is not suitable for automatic MTRR setup
* in drm_addmap. Therefore we add them manually before the maps are * in drm_legacy_addmap. Therefore we add them manually before the maps are
* initialized, and tear them down on last close. * initialized, and tear them down on last close.
*/ */
int savage_driver_firstopen(struct drm_device *dev) int savage_driver_firstopen(struct drm_device *dev)
...@@ -624,19 +624,20 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -624,19 +624,20 @@ int savage_driver_firstopen(struct drm_device *dev)
/* Automatic MTRR setup will do the right thing. */ /* Automatic MTRR setup will do the right thing. */
} }
ret = drm_addmap(dev, mmio_base, SAVAGE_MMIO_SIZE, _DRM_REGISTERS, ret = drm_legacy_addmap(dev, mmio_base, SAVAGE_MMIO_SIZE,
_DRM_READ_ONLY, &dev_priv->mmio); _DRM_REGISTERS, _DRM_READ_ONLY,
&dev_priv->mmio);
if (ret) if (ret)
return ret; return ret;
ret = drm_addmap(dev, fb_base, fb_size, _DRM_FRAME_BUFFER, ret = drm_legacy_addmap(dev, fb_base, fb_size, _DRM_FRAME_BUFFER,
_DRM_WRITE_COMBINING, &dev_priv->fb); _DRM_WRITE_COMBINING, &dev_priv->fb);
if (ret) if (ret)
return ret; return ret;
ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, ret = drm_legacy_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE,
_DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING,
&dev_priv->aperture); &dev_priv->aperture);
return ret; return ret;
} }
...@@ -698,7 +699,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) ...@@ -698,7 +699,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
dev_priv->texture_offset = init->texture_offset; dev_priv->texture_offset = init->texture_offset;
dev_priv->texture_size = init->texture_size; dev_priv->texture_size = init->texture_size;
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_legacy_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
savage_do_cleanup_bci(dev); savage_do_cleanup_bci(dev);
......
...@@ -31,7 +31,7 @@ static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init) ...@@ -31,7 +31,7 @@ static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_legacy_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("could not find sarea!\n"); DRM_ERROR("could not find sarea!\n");
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
......
...@@ -153,8 +153,6 @@ int drm_err(const char *func, const char *format, ...); ...@@ -153,8 +153,6 @@ int drm_err(const char *func, const char *format, ...);
#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
#define DRM_MAP_HASH_OFFSET 0x10000000
/*@}*/ /*@}*/
/***********************************************************************/ /***********************************************************************/
...@@ -1243,31 +1241,6 @@ extern void drm_idlelock_release(struct drm_lock_data *lock_data); ...@@ -1243,31 +1241,6 @@ extern void drm_idlelock_release(struct drm_lock_data *lock_data);
extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv); extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv);
/* Buffer management support (drm_bufs.h) */
extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, struct drm_local_map **map_ptr);
extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_addbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_infobufs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_markbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_freebufs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_mapbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_dma_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
/* DMA support (drm_dma.h) */ /* DMA support (drm_dma.h) */
extern int drm_legacy_dma_setup(struct drm_device *dev); extern int drm_legacy_dma_setup(struct drm_device *dev);
extern void drm_legacy_dma_takedown(struct drm_device *dev); extern void drm_legacy_dma_takedown(struct drm_device *dev);
...@@ -1354,8 +1327,6 @@ extern unsigned int drm_timestamp_monotonic; ...@@ -1354,8 +1327,6 @@ extern unsigned int drm_timestamp_monotonic;
extern struct class *drm_class; extern struct class *drm_class;
extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
/* Debugfs support */ /* Debugfs support */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
...@@ -1466,6 +1437,18 @@ extern int drm_pci_set_unique(struct drm_device *dev, ...@@ -1466,6 +1437,18 @@ extern int drm_pci_set_unique(struct drm_device *dev,
struct drm_master *master, struct drm_master *master,
struct drm_unique *u); struct drm_unique *u);
/* Legacy Support */
int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, struct drm_local_map **map_p);
int drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);
int drm_legacy_addbufs_agp(struct drm_device *d, struct drm_buf_desc *req);
int drm_legacy_addbufs_pci(struct drm_device *d, struct drm_buf_desc *req);
/* sysfs support (drm_sysfs.c) */ /* sysfs support (drm_sysfs.c) */
struct drm_sysfs_class; struct drm_sysfs_class;
extern struct class *drm_sysfs_create(struct module *owner, char *name); extern struct class *drm_sysfs_create(struct module *owner, char *name);
......
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