Commit d31d2954 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (22 commits)
  drm: add initial r500 drm support
  radeon: setup the ring buffer fetcher to be less agressive.
  drm: fixup some of the ioctl function exit paths
  drm: the drm really should call pci_set_master..
  i915: Add chipset id for Intel Integrated Graphics Device
  drm: cleanup DRM_DEBUG() parameters
  drm/i915: add support for E7221 chipset
  drm: don't cast a pointer to pointer of list_head
  mga_dma: return 'err' not just zero from mga_do_cleanup_dma()
  drm: add _DRM_DRIVER flag, and re-order unload.
  drm: enable udev node creation
  drm: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.
  drm: move drm_mem_init to proper place in startup sequence
  drm: call driver load function after initialising AGP
  drm: Fix ioc32 compat layer
  drm: fd.o bug #11895: Only add the AGP base to map offset if the caller didn't.
  i915: add suspend/resume support
  drm: update DRM sysfs support
  drm: Initialize the AGP structure's base address at init rather than enable.
  drm: move two function extern into the correct block
  ...
parents 7a8c6ad9 3d5e2c13
...@@ -105,4 +105,3 @@ config DRM_SAVAGE ...@@ -105,4 +105,3 @@ config DRM_SAVAGE
help help
Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
chipset. If M is selected the module will be called savage. chipset. If M is selected the module will be called savage.
...@@ -38,5 +38,3 @@ obj-$(CONFIG_DRM_I915) += i915.o ...@@ -38,5 +38,3 @@ obj-$(CONFIG_DRM_I915) += i915.o
obj-$(CONFIG_DRM_SIS) += sis.o obj-$(CONFIG_DRM_SIS) += sis.o
obj-$(CONFIG_DRM_SAVAGE)+= savage.o obj-$(CONFIG_DRM_SAVAGE)+= savage.o
obj-$(CONFIG_DRM_VIA) +=via.o obj-$(CONFIG_DRM_VIA) +=via.o
...@@ -41,4 +41,3 @@ For specific information about kernel-level support, see: ...@@ -41,4 +41,3 @@ For specific information about kernel-level support, see:
A Security Analysis of the Direct Rendering Infrastructure A Security Analysis of the Direct Rendering Infrastructure
http://dri.sourceforge.net/doc/security_low_level.html http://dri.sourceforge.net/doc/security_low_level.html
...@@ -41,7 +41,7 @@ static void *drm_ati_alloc_pcigart_table(int order) ...@@ -41,7 +41,7 @@ static void *drm_ati_alloc_pcigart_table(int order)
struct page *page; struct page *page;
int i; int i;
DRM_DEBUG("%s: alloc %d order\n", __FUNCTION__, order); DRM_DEBUG("%d order\n", order);
address = __get_free_pages(GFP_KERNEL | __GFP_COMP, address = __get_free_pages(GFP_KERNEL | __GFP_COMP,
order); order);
...@@ -54,7 +54,7 @@ static void *drm_ati_alloc_pcigart_table(int order) ...@@ -54,7 +54,7 @@ static void *drm_ati_alloc_pcigart_table(int order)
for (i = 0; i < order; i++, page++) for (i = 0; i < order; i++, page++)
SetPageReserved(page); SetPageReserved(page);
DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); DRM_DEBUG("returning 0x%08lx\n", address);
return (void *)address; return (void *)address;
} }
...@@ -63,7 +63,7 @@ static void drm_ati_free_pcigart_table(void *address, int order) ...@@ -63,7 +63,7 @@ static void drm_ati_free_pcigart_table(void *address, int order)
struct page *page; struct page *page;
int i; int i;
int num_pages = 1 << order; int num_pages = 1 << order;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
page = virt_to_page((unsigned long)address); page = virt_to_page((unsigned long)address);
......
...@@ -202,7 +202,8 @@ enum drm_map_flags { ...@@ -202,7 +202,8 @@ enum drm_map_flags {
_DRM_KERNEL = 0x08, /**< kernel requires access */ _DRM_KERNEL = 0x08, /**< kernel requires access */
_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
_DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */
_DRM_REMOVABLE = 0x40 /**< Removable mapping */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */
_DRM_DRIVER = 0x80 /**< Managed by driver */
}; };
struct drm_ctx_priv_map { struct drm_ctx_priv_map {
......
...@@ -292,7 +292,6 @@ struct drm_magic_entry { ...@@ -292,7 +292,6 @@ struct drm_magic_entry {
struct list_head head; struct list_head head;
struct drm_hash_item hash_item; struct drm_hash_item hash_item;
struct drm_file *priv; struct drm_file *priv;
struct drm_magic_entry *next;
}; };
struct drm_vma_entry { struct drm_vma_entry {
...@@ -388,8 +387,8 @@ struct drm_file { ...@@ -388,8 +387,8 @@ struct drm_file {
struct drm_head *head; struct drm_head *head;
int remove_auth_on_close; int remove_auth_on_close;
unsigned long lock_count; unsigned long lock_count;
void *driver_priv;
struct file *filp; struct file *filp;
void *driver_priv;
}; };
/** Wait queue */ /** Wait queue */
...@@ -401,11 +400,9 @@ struct drm_queue { ...@@ -401,11 +400,9 @@ struct drm_queue {
wait_queue_head_t read_queue; /**< Processes waiting on block_read */ wait_queue_head_t read_queue; /**< Processes waiting on block_read */
atomic_t block_write; /**< Queue blocked for writes */ atomic_t block_write; /**< Queue blocked for writes */
wait_queue_head_t write_queue; /**< Processes waiting on block_write */ wait_queue_head_t write_queue; /**< Processes waiting on block_write */
#if 1
atomic_t total_queued; /**< Total queued statistic */ atomic_t total_queued; /**< Total queued statistic */
atomic_t total_flushed; /**< Total flushes statistic */ atomic_t total_flushed; /**< Total flushes statistic */
atomic_t total_locks; /**< Total locks statistics */ atomic_t total_locks; /**< Total locks statistics */
#endif
enum drm_ctx_flags flags; /**< Context preserving and 2D-only */ enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
struct drm_waitlist waitlist; /**< Pending buffers */ struct drm_waitlist waitlist; /**< Pending buffers */
wait_queue_head_t flush_queue; /**< Processes waiting until flush */ wait_queue_head_t flush_queue; /**< Processes waiting until flush */
...@@ -416,7 +413,8 @@ struct drm_queue { ...@@ -416,7 +413,8 @@ struct drm_queue {
*/ */
struct drm_lock_data { struct drm_lock_data {
struct drm_hw_lock *hw_lock; /**< Hardware lock */ struct drm_hw_lock *hw_lock; /**< Hardware lock */
struct drm_file *file_priv; /**< File descr of lock holder (0=kernel) */ /** Private of lock holder's file (NULL=kernel) */
struct drm_file *file_priv;
wait_queue_head_t lock_queue; /**< Queue of blocked processes */ wait_queue_head_t lock_queue; /**< Queue of blocked processes */
unsigned long lock_time; /**< Time of last lock in jiffies */ unsigned long lock_time; /**< Time of last lock in jiffies */
spinlock_t spinlock; spinlock_t spinlock;
...@@ -491,6 +489,27 @@ struct drm_sigdata { ...@@ -491,6 +489,27 @@ struct drm_sigdata {
struct drm_hw_lock *lock; struct drm_hw_lock *lock;
}; };
/*
* Generic memory manager structs
*/
struct drm_mm_node {
struct list_head fl_entry;
struct list_head ml_entry;
int free;
unsigned long start;
unsigned long size;
struct drm_mm *mm;
void *private;
};
struct drm_mm {
struct list_head fl_entry;
struct list_head ml_entry;
};
/** /**
* Mappings list * Mappings list
*/ */
...@@ -498,7 +517,7 @@ struct drm_map_list { ...@@ -498,7 +517,7 @@ struct drm_map_list {
struct list_head head; /**< list head */ struct list_head head; /**< list head */
struct drm_hash_item hash; struct drm_hash_item hash;
struct drm_map *map; /**< mapping */ struct drm_map *map; /**< mapping */
unsigned int user_token; uint64_t user_token;
}; };
typedef struct drm_map drm_local_map_t; typedef struct drm_map drm_local_map_t;
...@@ -536,24 +555,6 @@ struct drm_ati_pcigart_info { ...@@ -536,24 +555,6 @@ struct drm_ati_pcigart_info {
int table_size; int table_size;
}; };
/*
* Generic memory manager structs
*/
struct drm_mm_node {
struct list_head fl_entry;
struct list_head ml_entry;
int free;
unsigned long start;
unsigned long size;
struct drm_mm *mm;
void *private;
};
struct drm_mm {
struct list_head fl_entry;
struct list_head ml_entry;
};
/** /**
* DRM driver structure. This structure represent the common code for * DRM driver structure. This structure represent the common code for
* a family of cards. There will one drm_device for each card present * a family of cards. There will one drm_device for each card present
...@@ -567,6 +568,8 @@ struct drm_driver { ...@@ -567,6 +568,8 @@ struct drm_driver {
void (*postclose) (struct drm_device *, struct drm_file *); void (*postclose) (struct drm_device *, struct drm_file *);
void (*lastclose) (struct drm_device *); void (*lastclose) (struct drm_device *);
int (*unload) (struct drm_device *); int (*unload) (struct drm_device *);
int (*suspend) (struct drm_device *);
int (*resume) (struct drm_device *);
int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
void (*dma_ready) (struct drm_device *); void (*dma_ready) (struct drm_device *);
int (*dma_quiescent) (struct drm_device *); int (*dma_quiescent) (struct drm_device *);
...@@ -642,6 +645,7 @@ struct drm_head { ...@@ -642,6 +645,7 @@ struct drm_head {
* may contain multiple heads. * may contain multiple heads.
*/ */
struct drm_device { struct drm_device {
struct device dev; /**< Linux device */
char *unique; /**< Unique identifier: e.g., busid */ char *unique; /**< Unique identifier: e.g., busid */
int unique_len; /**< Length of unique field */ int unique_len; /**< Length of unique field */
char *devname; /**< For /proc/interrupts */ char *devname; /**< For /proc/interrupts */
...@@ -750,7 +754,6 @@ struct drm_device { ...@@ -750,7 +754,6 @@ struct drm_device {
struct pci_controller *hose; struct pci_controller *hose;
#endif #endif
struct drm_sg_mem *sg; /**< Scatter gather memory */ struct drm_sg_mem *sg; /**< Scatter gather memory */
unsigned long *ctx_bitmap; /**< context bitmap */
void *dev_private; /**< device private data */ void *dev_private; /**< device private data */
struct drm_sigdata sigdata; /**< For block_all_signals */ struct drm_sigdata sigdata; /**< For block_all_signals */
sigset_t sigmask; sigset_t sigmask;
...@@ -847,6 +850,8 @@ extern int drm_release(struct inode *inode, struct file *filp); ...@@ -847,6 +850,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
/* Mapping support (drm_vm.h) */ /* Mapping support (drm_vm.h) */
extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
/* Memory management support (drm_memory.h) */ /* Memory management support (drm_memory.h) */
...@@ -1061,11 +1066,11 @@ extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); ...@@ -1061,11 +1066,11 @@ extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
/* sysfs support (drm_sysfs.c) */ /* sysfs support (drm_sysfs.c) */
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);
extern void drm_sysfs_destroy(struct class *cs); extern void drm_sysfs_destroy(void);
extern struct class_device *drm_sysfs_device_add(struct class *cs, extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head);
struct drm_head *head); extern void drm_sysfs_device_remove(struct drm_device *dev);
extern void drm_sysfs_device_remove(struct class_device *class_dev);
/* /*
* Basic memory manager support (drm_mm.c) * Basic memory manager support (drm_mm.c)
...@@ -1073,7 +1078,7 @@ extern void drm_sysfs_device_remove(struct class_device *class_dev); ...@@ -1073,7 +1078,7 @@ extern void drm_sysfs_device_remove(struct class_device *class_dev);
extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent, extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
unsigned long size, unsigned long size,
unsigned alignment); unsigned alignment);
void drm_mm_put_block(struct drm_mm_node * cur); extern void drm_mm_put_block(struct drm_mm_node * cur);
extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size, extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size,
unsigned alignment, int best_match); unsigned alignment, int best_match);
extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size); extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size);
...@@ -1144,8 +1149,5 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area); ...@@ -1144,8 +1149,5 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area);
/*@}*/ /*@}*/
extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif #endif
...@@ -166,7 +166,6 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) ...@@ -166,7 +166,6 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
dev->agp->mode = mode.mode; dev->agp->mode = mode.mode;
agp_enable(dev->agp->bridge, mode.mode); agp_enable(dev->agp->bridge, mode.mode);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1; dev->agp->enabled = 1;
return 0; return 0;
} }
...@@ -417,7 +416,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) ...@@ -417,7 +416,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
INIT_LIST_HEAD(&head->memory); INIT_LIST_HEAD(&head->memory);
head->cant_use_aperture = head->agp_info.cant_use_aperture; head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask; head->page_mask = head->agp_info.page_mask;
head->base = head->agp_info.aper_base;
return head; return head;
} }
......
...@@ -229,11 +229,17 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset, ...@@ -229,11 +229,17 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
#ifdef __alpha__ #ifdef __alpha__
map->offset += dev->hose->mem_space->start; map->offset += dev->hose->mem_space->start;
#endif #endif
/* Note: dev->agp->base may actually be 0 when the DRM /* In some cases (i810 driver), user space may have already
* is not in control of AGP space. But if user space is * added the AGP base itself, because dev->agp->base previously
* it should already have added the AGP base itself. * only got set during AGP enable. So, only add the base
* address if the map's offset isn't already within the
* aperture.
*/ */
if (map->offset < dev->agp->base ||
map->offset > dev->agp->base +
dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
map->offset += dev->agp->base; map->offset += dev->agp->base;
}
map->mtrr = dev->agp->agp_mtrr; /* for getmap */ map->mtrr = dev->agp->agp_mtrr; /* for getmap */
/* This assumes the DRM is in total control of AGP space. /* This assumes the DRM is in total control of AGP space.
...@@ -429,6 +435,7 @@ int drm_rmmap(struct drm_device *dev, drm_local_map_t *map) ...@@ -429,6 +435,7 @@ int drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
return ret; return ret;
} }
EXPORT_SYMBOL(drm_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
...@@ -1592,5 +1599,3 @@ int drm_order(unsigned long size) ...@@ -1592,5 +1599,3 @@ int drm_order(unsigned long size)
return order; return order;
} }
EXPORT_SYMBOL(drm_order); EXPORT_SYMBOL(drm_order);
...@@ -200,9 +200,11 @@ int drm_lastclose(struct drm_device * dev) ...@@ -200,9 +200,11 @@ int drm_lastclose(struct drm_device * dev)
} }
list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) { list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
if (!(r_list->map->flags & _DRM_DRIVER)) {
drm_rmmap_locked(dev, r_list->map); drm_rmmap_locked(dev, r_list->map);
r_list = NULL; r_list = NULL;
} }
}
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
for (i = 0; i < dev->queue_count; i++) { for (i = 0; i < dev->queue_count; i++) {
...@@ -255,8 +257,6 @@ int drm_init(struct drm_driver *driver) ...@@ -255,8 +257,6 @@ int drm_init(struct drm_driver *driver)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
drm_mem_init();
for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) { for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) {
pid = (struct pci_device_id *)&driver->pci_driver.id_table[i]; pid = (struct pci_device_id *)&driver->pci_driver.id_table[i];
...@@ -293,10 +293,6 @@ static void drm_cleanup(struct drm_device * dev) ...@@ -293,10 +293,6 @@ static void drm_cleanup(struct drm_device * dev)
drm_lastclose(dev); drm_lastclose(dev);
drm_ht_remove(&dev->map_hash);
drm_ctxbitmap_cleanup(dev);
if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
dev->agp && dev->agp->agp_mtrr >= 0) { dev->agp && dev->agp->agp_mtrr >= 0) {
int retval; int retval;
...@@ -314,6 +310,9 @@ static void drm_cleanup(struct drm_device * dev) ...@@ -314,6 +310,9 @@ static void drm_cleanup(struct drm_device * dev)
if (dev->driver->unload) if (dev->driver->unload)
dev->driver->unload(dev); dev->driver->unload(dev);
drm_ht_remove(&dev->map_hash);
drm_ctxbitmap_cleanup(dev);
drm_put_head(&dev->primary); drm_put_head(&dev->primary);
if (drm_put_dev(dev)) if (drm_put_dev(dev))
DRM_ERROR("Cannot unload module\n"); DRM_ERROR("Cannot unload module\n");
...@@ -383,22 +382,24 @@ static int __init drm_core_init(void) ...@@ -383,22 +382,24 @@ static int __init drm_core_init(void)
goto err_p3; goto err_p3;
} }
drm_mem_init();
DRM_INFO("Initialized %s %d.%d.%d %s\n", DRM_INFO("Initialized %s %d.%d.%d %s\n",
CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
return 0; return 0;
err_p3: err_p3:
drm_sysfs_destroy(drm_class); drm_sysfs_destroy();
err_p2: err_p2:
unregister_chrdev(DRM_MAJOR, "drm"); unregister_chrdev(DRM_MAJOR, "drm");
drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB); drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
err_p1: err_p1:
return ret; return ret;
} }
static void __exit drm_core_exit(void) static void __exit drm_core_exit(void)
{ {
remove_proc_entry("dri", NULL); remove_proc_entry("dri", NULL);
drm_sysfs_destroy(drm_class); drm_sysfs_destroy();
unregister_chrdev(DRM_MAJOR, "drm"); unregister_chrdev(DRM_MAJOR, "drm");
...@@ -494,23 +495,25 @@ int drm_ioctl(struct inode *inode, struct file *filp, ...@@ -494,23 +495,25 @@ int drm_ioctl(struct inode *inode, struct file *filp,
} else { } else {
if (cmd & (IOC_IN | IOC_OUT)) { if (cmd & (IOC_IN | IOC_OUT)) {
kdata = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL); kdata = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
if (!kdata) if (!kdata) {
return -ENOMEM; retcode = -ENOMEM;
goto err_i1;
}
} }
if (cmd & IOC_IN) { if (cmd & IOC_IN) {
if (copy_from_user(kdata, (void __user *)arg, if (copy_from_user(kdata, (void __user *)arg,
_IOC_SIZE(cmd)) != 0) { _IOC_SIZE(cmd)) != 0) {
retcode = -EACCES; retcode = -EFAULT;
goto err_i1; goto err_i1;
} }
} }
retcode = func(dev, kdata, file_priv); retcode = func(dev, kdata, file_priv);
if (cmd & IOC_OUT) { if ((retcode == 0) && (cmd & IOC_OUT)) {
if (copy_to_user((void __user *)arg, kdata, if (copy_to_user((void __user *)arg, kdata,
_IOC_SIZE(cmd)) != 0) _IOC_SIZE(cmd)) != 0)
retcode = -EACCES; retcode = -EFAULT;
} }
} }
......
...@@ -200,4 +200,3 @@ void drm_ht_remove(struct drm_open_hash *ht) ...@@ -200,4 +200,3 @@ void drm_ht_remove(struct drm_open_hash *ht)
ht->table = NULL; ht->table = NULL;
} }
} }
...@@ -65,4 +65,3 @@ extern void drm_ht_remove(struct drm_open_hash *ht); ...@@ -65,4 +65,3 @@ extern void drm_ht_remove(struct drm_open_hash *ht);
#endif #endif
...@@ -1051,8 +1051,12 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1051,8 +1051,12 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
drm_ioctl_compat_t *fn; drm_ioctl_compat_t *fn;
int ret; int ret;
/* Assume that ioctls without an explicit compat routine will just
* work. This may not always be a good assumption, but it's better
* than always failing.
*/
if (nr >= ARRAY_SIZE(drm_compat_ioctls)) if (nr >= ARRAY_SIZE(drm_compat_ioctls))
return -ENOTTY; return drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
fn = drm_compat_ioctls[nr]; fn = drm_compat_ioctls[nr];
......
...@@ -235,17 +235,9 @@ int drm_getclient(struct drm_device *dev, void *data, ...@@ -235,17 +235,9 @@ int drm_getclient(struct drm_device *dev, void *data,
idx = client->idx; idx = client->idx;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (list_empty(&dev->filelist)) {
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
i = 0; i = 0;
list_for_each_entry(pt, &dev->filelist, lhead) { list_for_each_entry(pt, &dev->filelist, lhead) {
if (i++ >= idx) if (i++ >= idx) {
break;
}
client->auth = pt->authenticated; client->auth = pt->authenticated;
client->pid = pt->pid; client->pid = pt->pid;
client->uid = pt->uid; client->uid = pt->uid;
...@@ -254,6 +246,11 @@ int drm_getclient(struct drm_device *dev, void *data, ...@@ -254,6 +246,11 @@ int drm_getclient(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return 0; return 0;
}
}
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
} }
/** /**
......
...@@ -107,7 +107,7 @@ static int drm_irq_install(struct drm_device * dev) ...@@ -107,7 +107,7 @@ static int drm_irq_install(struct drm_device * dev)
dev->irq_enabled = 1; dev->irq_enabled = 1;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); DRM_DEBUG("irq=%d\n", dev->irq);
if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) {
init_waitqueue_head(&dev->vbl_queue); init_waitqueue_head(&dev->vbl_queue);
...@@ -164,7 +164,7 @@ int drm_irq_uninstall(struct drm_device * dev) ...@@ -164,7 +164,7 @@ int drm_irq_uninstall(struct drm_device * dev)
if (!irq_enabled) if (!irq_enabled)
return -EINVAL; return -EINVAL;
DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); DRM_DEBUG("irq=%d\n", dev->irq);
dev->driver->irq_uninstall(dev); dev->driver->irq_uninstall(dev);
......
...@@ -179,4 +179,3 @@ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) ...@@ -179,4 +179,3 @@ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev)
iounmap(map->handle); iounmap(map->handle);
} }
EXPORT_SYMBOL(drm_core_ioremapfree); EXPORT_SYMBOL(drm_core_ioremapfree);
...@@ -293,4 +293,3 @@ void drm_mm_takedown(struct drm_mm * mm) ...@@ -293,4 +293,3 @@ void drm_mm_takedown(struct drm_mm * mm)
drm_free(entry, sizeof(*entry), DRM_MEM_MM); drm_free(entry, sizeof(*entry), DRM_MEM_MM);
} }
...@@ -139,6 +139,101 @@ ...@@ -139,6 +139,101 @@
{0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
{0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
{0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7103, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7109, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x710A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x710B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x710C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x710E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x710F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7140, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7141, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7142, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7143, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x714F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7153, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x715E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x715F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7183, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7186, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7187, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7188, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x718A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x718B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x718C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x718D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x718F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7193, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7196, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x719B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x719F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71D2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71D4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71D5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7245, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7246, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7247, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7248, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x724F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7280, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7283, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7284, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
{0x1002, 0x728B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
{0x1002, 0x728C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7290, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7291, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7293, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
{0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
{0, 0, 0} {0, 0, 0}
...@@ -311,5 +406,5 @@ ...@@ -311,5 +406,5 @@
{0x8086, 0x29d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x8086, 0x29d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x8086, 0x2a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0, 0, 0} {0, 0, 0}
...@@ -236,11 +236,11 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, ...@@ -236,11 +236,11 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
type = "??"; type = "??";
else else
type = types[map->type]; type = types[map->type];
DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ", DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i, i,
map->offset, map->offset,
map->size, type, map->flags, map->size, type, map->flags,
r_list->user_token); (unsigned long) r_list->user_token);
if (map->mtrr < 0) { if (map->mtrr < 0) {
DRM_PROC_PRINT("none\n"); DRM_PROC_PRINT("none\n");
} else { } else {
......
...@@ -67,7 +67,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) ...@@ -67,7 +67,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
struct drm_sg_mem *entry; struct drm_sg_mem *entry;
unsigned long pages, i, j; unsigned long pages, i, j;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
if (!drm_core_check_feature(dev, DRIVER_SG)) if (!drm_core_check_feature(dev, DRIVER_SG))
return -EINVAL; return -EINVAL;
...@@ -81,7 +81,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) ...@@ -81,7 +81,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages); DRM_DEBUG("size=%ld pages=%ld\n", request->size, pages);
entry->pages = pages; entry->pages = pages;
entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist), entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist),
...@@ -122,8 +122,8 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) ...@@ -122,8 +122,8 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
entry->handle = ScatterHandle((unsigned long)entry->virtual); entry->handle = ScatterHandle((unsigned long)entry->virtual);
DRM_DEBUG("sg alloc handle = %08lx\n", entry->handle); DRM_DEBUG("handle = %08lx\n", entry->handle);
DRM_DEBUG("sg alloc virtual = %p\n", entry->virtual); DRM_DEBUG("virtual = %p\n", entry->virtual);
for (i = (unsigned long)entry->virtual, j = 0; j < pages; for (i = (unsigned long)entry->virtual, j = 0; j < pages;
i += PAGE_SIZE, j++) { i += PAGE_SIZE, j++) {
...@@ -210,7 +210,7 @@ int drm_sg_free(struct drm_device *dev, void *data, ...@@ -210,7 +210,7 @@ int drm_sg_free(struct drm_device *dev, void *data,
if (!entry || entry->handle != request->handle) if (!entry || entry->handle != request->handle)
return -EINVAL; return -EINVAL;
DRM_DEBUG("sg free virtual = %p\n", entry->virtual); DRM_DEBUG("virtual = %p\n", entry->virtual);
drm_sg_cleanup(entry); drm_sg_cleanup(entry);
......
...@@ -98,10 +98,6 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, ...@@ -98,10 +98,6 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
dev->driver = driver; dev->driver = driver;
if (dev->driver->load)
if ((retcode = dev->driver->load(dev, ent->driver_data)))
goto error_out_unreg;
if (drm_core_has_AGP(dev)) { if (drm_core_has_AGP(dev)) {
if (drm_device_is_agp(dev)) if (drm_device_is_agp(dev))
dev->agp = drm_agp_init(dev); dev->agp = drm_agp_init(dev);
...@@ -120,6 +116,10 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, ...@@ -120,6 +116,10 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
} }
} }
if (dev->driver->load)
if ((retcode = dev->driver->load(dev, ent->driver_data)))
goto error_out_unreg;
retcode = drm_ctxbitmap_init(dev); retcode = drm_ctxbitmap_init(dev);
if (retcode) { if (retcode) {
DRM_ERROR("Cannot allocate memory for context bitmap.\n"); DRM_ERROR("Cannot allocate memory for context bitmap.\n");
...@@ -168,11 +168,10 @@ static int drm_get_head(struct drm_device * dev, struct drm_head * head) ...@@ -168,11 +168,10 @@ static int drm_get_head(struct drm_device * dev, struct drm_head * head)
goto err_g1; goto err_g1;
} }
head->dev_class = drm_sysfs_device_add(drm_class, head); ret = drm_sysfs_device_add(dev, head);
if (IS_ERR(head->dev_class)) { if (ret) {
printk(KERN_ERR printk(KERN_ERR
"DRM: Error sysfs_device_add.\n"); "DRM: Error sysfs_device_add.\n");
ret = PTR_ERR(head->dev_class);
goto err_g2; goto err_g2;
} }
*heads = head; *heads = head;
...@@ -218,6 +217,7 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -218,6 +217,7 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
if (ret) if (ret)
goto err_g1; goto err_g1;
pci_set_master(pdev);
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) { if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
goto err_g2; goto err_g2;
...@@ -283,7 +283,7 @@ int drm_put_head(struct drm_head * head) ...@@ -283,7 +283,7 @@ int drm_put_head(struct drm_head * head)
DRM_DEBUG("release secondary minor %d\n", minor); DRM_DEBUG("release secondary minor %d\n", minor);
drm_proc_cleanup(minor, drm_proc_root, head->dev_root); drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
drm_sysfs_device_remove(head->dev_class); drm_sysfs_device_remove(head->dev);
*head = (struct drm_head) {.dev = NULL}; *head = (struct drm_head) {.dev = NULL};
......
...@@ -19,6 +19,45 @@ ...@@ -19,6 +19,45 @@
#include "drm_core.h" #include "drm_core.h"
#include "drmP.h" #include "drmP.h"
#define to_drm_device(d) container_of(d, struct drm_device, dev)
/**
* drm_sysfs_suspend - DRM class suspend hook
* @dev: Linux device to suspend
* @state: power state to enter
*
* Just figures out what the actual struct drm_device associated with
* @dev is and calls its suspend hook, if present.
*/
static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
{
struct drm_device *drm_dev = to_drm_device(dev);
printk(KERN_ERR "%s\n", __FUNCTION__);
if (drm_dev->driver->suspend)
return drm_dev->driver->suspend(drm_dev);
return 0;
}
/**
* drm_sysfs_resume - DRM class resume hook
* @dev: Linux device to resume
*
* Just figures out what the actual struct drm_device associated with
* @dev is and calls its resume hook, if present.
*/
static int drm_sysfs_resume(struct device *dev)
{
struct drm_device *drm_dev = to_drm_device(dev);
if (drm_dev->driver->resume)
return drm_dev->driver->resume(drm_dev);
return 0;
}
/* Display the version of drm_core. This doesn't work right in current design */ /* Display the version of drm_core. This doesn't work right in current design */
static ssize_t version_show(struct class *dev, char *buf) static ssize_t version_show(struct class *dev, char *buf)
{ {
...@@ -33,7 +72,7 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL); ...@@ -33,7 +72,7 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
* @owner: pointer to the module that is to "own" this struct drm_sysfs_class * @owner: pointer to the module that is to "own" this struct drm_sysfs_class
* @name: pointer to a string for the name of this class. * @name: pointer to a string for the name of this class.
* *
* This is used to create a struct drm_sysfs_class pointer that can then be used * This is used to create DRM class pointer that can then be used
* in calls to drm_sysfs_device_add(). * in calls to drm_sysfs_device_add().
* *
* Note, the pointer created here is to be destroyed when finished by making a * Note, the pointer created here is to be destroyed when finished by making a
...@@ -50,6 +89,9 @@ struct class *drm_sysfs_create(struct module *owner, char *name) ...@@ -50,6 +89,9 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
goto err_out; goto err_out;
} }
class->suspend = drm_sysfs_suspend;
class->resume = drm_sysfs_resume;
err = class_create_file(class, &class_attr_version); err = class_create_file(class, &class_attr_version);
if (err) if (err)
goto err_out_class; goto err_out_class;
...@@ -63,94 +105,100 @@ struct class *drm_sysfs_create(struct module *owner, char *name) ...@@ -63,94 +105,100 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
} }
/** /**
* drm_sysfs_destroy - destroys a struct drm_sysfs_class structure * drm_sysfs_destroy - destroys DRM class
* @cs: pointer to the struct drm_sysfs_class that is to be destroyed
* *
* Note, the pointer to be destroyed must have been created with a call to * Destroy the DRM device class.
* drm_sysfs_create().
*/ */
void drm_sysfs_destroy(struct class *class) void drm_sysfs_destroy(void)
{ {
if ((class == NULL) || (IS_ERR(class))) if ((drm_class == NULL) || (IS_ERR(drm_class)))
return; return;
class_remove_file(drm_class, &class_attr_version);
class_remove_file(class, &class_attr_version); class_destroy(drm_class);
class_destroy(class);
} }
static ssize_t show_dri(struct class_device *class_device, char *buf) static ssize_t show_dri(struct device *device, struct device_attribute *attr,
char *buf)
{ {
struct drm_device * dev = ((struct drm_head *)class_get_devdata(class_device))->dev; struct drm_device *dev = to_drm_device(device);
if (dev->driver->dri_library_name) if (dev->driver->dri_library_name)
return dev->driver->dri_library_name(dev, buf); return dev->driver->dri_library_name(dev, buf);
return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name); return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name);
} }
static struct class_device_attribute class_device_attrs[] = { static struct device_attribute device_attrs[] = {
__ATTR(dri_library_name, S_IRUGO, show_dri, NULL), __ATTR(dri_library_name, S_IRUGO, show_dri, NULL),
}; };
/**
* drm_sysfs_device_release - do nothing
* @dev: Linux device
*
* Normally, this would free the DRM device associated with @dev, along
* with cleaning up any other stuff. But we do that in the DRM core, so
* this function can just return and hope that the core does its job.
*/
static void drm_sysfs_device_release(struct device *dev)
{
return;
}
/** /**
* drm_sysfs_device_add - adds a class device to sysfs for a character driver * drm_sysfs_device_add - adds a class device to sysfs for a character driver
* @cs: pointer to the struct class that this device should be registered to. * @dev: DRM device to be added
* @dev: the dev_t for the device to be added. * @head: DRM head in question
* @device: a pointer to a struct device that is assiociated with this class device.
* @fmt: string for the class device's name
* *
* A struct class_device will be created in sysfs, registered to the specified * Add a DRM device to the DRM's device model class. We use @dev's PCI device
* class. A "dev" file will be created, showing the dev_t for the device. The * as the parent for the Linux device, and make sure it has a file containing
* pointer to the struct class_device will be returned from the call. Any further * the driver we're using (for userspace compatibility).
* sysfs files that might be required can be created using this pointer.
* Note: the struct class passed to this function must have previously been
* created with a call to drm_sysfs_create().
*/ */
struct class_device *drm_sysfs_device_add(struct class *cs, struct drm_head *head) int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head)
{ {
struct class_device *class_dev; int err;
int i, j, err; int i, j;
class_dev = class_device_create(cs, NULL, dev->dev.parent = &dev->pdev->dev;
MKDEV(DRM_MAJOR, head->minor), dev->dev.class = drm_class;
&(head->dev->pdev)->dev, dev->dev.release = drm_sysfs_device_release;
"card%d", head->minor); dev->dev.devt = head->device;
if (IS_ERR(class_dev)) { snprintf(dev->dev.bus_id, BUS_ID_SIZE, "card%d", head->minor);
err = PTR_ERR(class_dev);
err = device_register(&dev->dev);
if (err) {
DRM_ERROR("device add failed: %d\n", err);
goto err_out; goto err_out;
} }
class_set_devdata(class_dev, head); for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
err = device_create_file(&dev->dev, &device_attrs[i]);
for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
err = class_device_create_file(class_dev,
&class_device_attrs[i]);
if (err) if (err)
goto err_out_files; goto err_out_files;
} }
return class_dev; return 0;
err_out_files: err_out_files:
if (i > 0) if (i > 0)
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
class_device_remove_file(class_dev, device_remove_file(&dev->dev, &device_attrs[i]);
&class_device_attrs[i]); device_unregister(&dev->dev);
class_device_unregister(class_dev);
err_out: err_out:
return ERR_PTR(err);
return err;
} }
/** /**
* drm_sysfs_device_remove - removes a class device that was created with drm_sysfs_device_add() * drm_sysfs_device_remove - remove DRM device
* @dev: the dev_t of the device that was previously registered. * @dev: DRM device to remove
* *
* This call unregisters and cleans up a class device that was created with a * This call unregisters and cleans up a class device that was created with a
* call to drm_sysfs_device_add() * call to drm_sysfs_device_add()
*/ */
void drm_sysfs_device_remove(struct class_device *class_dev) void drm_sysfs_device_remove(struct drm_device *dev)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
class_device_remove_file(class_dev, &class_device_attrs[i]); device_remove_file(&dev->dev, &device_attrs[i]);
class_device_unregister(class_dev); device_unregister(&dev->dev);
} }
...@@ -180,7 +180,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, ...@@ -180,7 +180,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
return NOPAGE_SIGBUS; return NOPAGE_SIGBUS;
get_page(page); get_page(page);
DRM_DEBUG("shm_nopage 0x%lx\n", address); DRM_DEBUG("0x%lx\n", address);
return page; return page;
} }
...@@ -294,7 +294,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, ...@@ -294,7 +294,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
get_page(page); get_page(page);
DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); DRM_DEBUG("0x%lx (page %lu)\n", address, page_nr);
return page; return page;
} }
......
...@@ -570,7 +570,7 @@ static void i810EmitState(struct drm_device * dev) ...@@ -570,7 +570,7 @@ static void i810EmitState(struct drm_device * dev)
drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty; unsigned int dirty = sarea_priv->dirty;
DRM_DEBUG("%s %x\n", __FUNCTION__, dirty); DRM_DEBUG("%x\n", dirty);
if (dirty & I810_UPLOAD_BUFFERS) { if (dirty & I810_UPLOAD_BUFFERS) {
i810EmitDestVerified(dev, sarea_priv->BufferState); i810EmitDestVerified(dev, sarea_priv->BufferState);
...@@ -802,8 +802,7 @@ static void i810_dma_dispatch_flip(struct drm_device * dev) ...@@ -802,8 +802,7 @@ static void i810_dma_dispatch_flip(struct drm_device * dev)
int pitch = dev_priv->pitch; int pitch = dev_priv->pitch;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n", DRM_DEBUG("page=%d pfCurrentPage=%d\n",
__FUNCTION__,
dev_priv->current_page, dev_priv->current_page,
dev_priv->sarea_priv->pf_current_page); dev_priv->sarea_priv->pf_current_page);
...@@ -848,8 +847,6 @@ static void i810_dma_quiescent(struct drm_device * dev) ...@@ -848,8 +847,6 @@ static void i810_dma_quiescent(struct drm_device * dev)
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
/* printk("%s\n", __FUNCTION__); */
i810_kernel_lost_context(dev); i810_kernel_lost_context(dev);
BEGIN_LP_RING(4); BEGIN_LP_RING(4);
...@@ -869,8 +866,6 @@ static int i810_flush_queue(struct drm_device * dev) ...@@ -869,8 +866,6 @@ static int i810_flush_queue(struct drm_device * dev)
int i, ret = 0; int i, ret = 0;
RING_LOCALS; RING_LOCALS;
/* printk("%s\n", __FUNCTION__); */
i810_kernel_lost_context(dev); i810_kernel_lost_context(dev);
BEGIN_LP_RING(2); BEGIN_LP_RING(2);
...@@ -949,7 +944,7 @@ static int i810_dma_vertex(struct drm_device *dev, void *data, ...@@ -949,7 +944,7 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", DRM_DEBUG("idx %d used %d discard %d\n",
vertex->idx, vertex->used, vertex->discard); vertex->idx, vertex->used, vertex->discard);
if (vertex->idx < 0 || vertex->idx > dma->buf_count) if (vertex->idx < 0 || vertex->idx > dma->buf_count)
...@@ -987,7 +982,7 @@ static int i810_clear_bufs(struct drm_device *dev, void *data, ...@@ -987,7 +982,7 @@ static int i810_clear_bufs(struct drm_device *dev, void *data,
static int i810_swap_bufs(struct drm_device *dev, void *data, static int i810_swap_bufs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
DRM_DEBUG("i810_swap_bufs\n"); DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
...@@ -1068,11 +1063,10 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, ...@@ -1068,11 +1063,10 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf,
sarea_priv->dirty = 0x7f; sarea_priv->dirty = 0x7f;
DRM_DEBUG("dispatch mc addr 0x%lx, used 0x%x\n", address, used); DRM_DEBUG("addr 0x%lx, used 0x%x\n", address, used);
dev_priv->counter++; dev_priv->counter++;
DRM_DEBUG("dispatch counter : %ld\n", dev_priv->counter); DRM_DEBUG("dispatch counter : %ld\n", dev_priv->counter);
DRM_DEBUG("i810_dma_dispatch_mc\n");
DRM_DEBUG("start : %lx\n", start); DRM_DEBUG("start : %lx\n", start);
DRM_DEBUG("used : %d\n", used); DRM_DEBUG("used : %d\n", used);
DRM_DEBUG("start + used - 4 : %ld\n", start + used - 4); DRM_DEBUG("start + used - 4 : %ld\n", start + used - 4);
...@@ -1179,7 +1173,7 @@ static void i810_do_init_pageflip(struct drm_device * dev) ...@@ -1179,7 +1173,7 @@ static void i810_do_init_pageflip(struct drm_device * dev)
{ {
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
dev_priv->page_flipping = 1; dev_priv->page_flipping = 1;
dev_priv->current_page = 0; dev_priv->current_page = 0;
dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
...@@ -1189,7 +1183,7 @@ static int i810_do_cleanup_pageflip(struct drm_device * dev) ...@@ -1189,7 +1183,7 @@ static int i810_do_cleanup_pageflip(struct drm_device * dev)
{ {
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
if (dev_priv->current_page != 0) if (dev_priv->current_page != 0)
i810_dma_dispatch_flip(dev); i810_dma_dispatch_flip(dev);
...@@ -1202,7 +1196,7 @@ static int i810_flip_bufs(struct drm_device *dev, void *data, ...@@ -1202,7 +1196,7 @@ static int i810_flip_bufs(struct drm_device *dev, void *data,
{ {
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
......
...@@ -145,7 +145,7 @@ extern int i810_max_ioctl; ...@@ -145,7 +145,7 @@ extern int i810_max_ioctl;
#define BEGIN_LP_RING(n) do { \ #define BEGIN_LP_RING(n) do { \
if (I810_VERBOSE) \ if (I810_VERBOSE) \
DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", n, __FUNCTION__); \ DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \
if (dev_priv->ring.space < n*4) \ if (dev_priv->ring.space < n*4) \
i810_wait_ring(dev, n*4); \ i810_wait_ring(dev, n*4); \
dev_priv->ring.space -= n*4; \ dev_priv->ring.space -= n*4; \
......
...@@ -156,8 +156,7 @@ extern int i830_driver_device_is_agp(struct drm_device * dev); ...@@ -156,8 +156,7 @@ extern int i830_driver_device_is_agp(struct drm_device * dev);
#define BEGIN_LP_RING(n) do { \ #define BEGIN_LP_RING(n) do { \
if (I830_VERBOSE) \ if (I830_VERBOSE) \
printk("BEGIN_LP_RING(%d) in %s\n", \ printk("BEGIN_LP_RING(%d)\n", (n)); \
n, __FUNCTION__); \
if (dev_priv->ring.space < n*4) \ if (dev_priv->ring.space < n*4) \
i830_wait_ring(dev, n*4, __FUNCTION__); \ i830_wait_ring(dev, n*4, __FUNCTION__); \
outcount = 0; \ outcount = 0; \
......
...@@ -31,17 +31,6 @@ ...@@ -31,17 +31,6 @@
#include "i915_drm.h" #include "i915_drm.h"
#include "i915_drv.h" #include "i915_drv.h"
#define IS_I965G(dev) (dev->pci_device == 0x2972 || \
dev->pci_device == 0x2982 || \
dev->pci_device == 0x2992 || \
dev->pci_device == 0x29A2 || \
dev->pci_device == 0x2A02 || \
dev->pci_device == 0x2A12)
#define IS_G33(dev) (dev->pci_device == 0x29b2 || \
dev->pci_device == 0x29c2 || \
dev->pci_device == 0x29d2)
/* Really want an OS-independent resettable timer. Would like to have /* Really want an OS-independent resettable timer. Would like to have
* this loop run for (eg) 3 sec, but have the timer reset every time * this loop run for (eg) 3 sec, but have the timer reset every time
* the head pointer changes, so that EBUSY only happens if the ring * the head pointer changes, so that EBUSY only happens if the ring
...@@ -90,6 +79,7 @@ void i915_kernel_lost_context(struct drm_device * dev) ...@@ -90,6 +79,7 @@ void i915_kernel_lost_context(struct drm_device * dev)
static int i915_dma_cleanup(struct drm_device * dev) static int i915_dma_cleanup(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private;
/* Make sure interrupts are disabled here because the uninstall ioctl /* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private * may not have been called from userspace and after dev_private
* is freed, it's too late. * is freed, it's too late.
...@@ -97,16 +87,16 @@ static int i915_dma_cleanup(struct drm_device * dev) ...@@ -97,16 +87,16 @@ static int i915_dma_cleanup(struct drm_device * dev)
if (dev->irq) if (dev->irq)
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
if (dev->dev_private) {
drm_i915_private_t *dev_priv =
(drm_i915_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_core_ioremapfree(&dev_priv->ring.map, dev);
dev_priv->ring.virtual_start = 0;
dev_priv->ring.map.handle = 0;
dev_priv->ring.map.size = 0;
} }
if (dev_priv->status_page_dmah) { if (dev_priv->status_page_dmah) {
drm_pci_free(dev, dev_priv->status_page_dmah); drm_pci_free(dev, dev_priv->status_page_dmah);
dev_priv->status_page_dmah = NULL;
/* Need to rewrite hardware status page */ /* Need to rewrite hardware status page */
I915_WRITE(0x02080, 0x1ffff000); I915_WRITE(0x02080, 0x1ffff000);
} }
...@@ -117,32 +107,22 @@ static int i915_dma_cleanup(struct drm_device * dev) ...@@ -117,32 +107,22 @@ static int i915_dma_cleanup(struct drm_device * dev)
I915_WRITE(0x2080, 0x1ffff000); I915_WRITE(0x2080, 0x1ffff000);
} }
drm_free(dev->dev_private, sizeof(drm_i915_private_t),
DRM_MEM_DRIVER);
dev->dev_private = NULL;
}
return 0; return 0;
} }
static int i915_initialize(struct drm_device * dev, static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
drm_i915_private_t * dev_priv,
drm_i915_init_t * init)
{ {
memset(dev_priv, 0, sizeof(drm_i915_private_t)); drm_i915_private_t *dev_priv = dev->dev_private;
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
return -EINVAL; return -EINVAL;
} }
dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset); dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset);
if (!dev_priv->mmio_map) { if (!dev_priv->mmio_map) {
dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("can not find mmio map!\n"); DRM_ERROR("can not find mmio map!\n");
return -EINVAL; return -EINVAL;
...@@ -165,7 +145,6 @@ static int i915_initialize(struct drm_device * dev, ...@@ -165,7 +145,6 @@ static int i915_initialize(struct drm_device * dev,
drm_core_ioremap(&dev_priv->ring.map, dev); drm_core_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;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n"); " ring buffer\n");
...@@ -197,7 +176,6 @@ static int i915_initialize(struct drm_device * dev, ...@@ -197,7 +176,6 @@ static int i915_initialize(struct drm_device * dev,
drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
if (!dev_priv->status_page_dmah) { if (!dev_priv->status_page_dmah) {
dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
DRM_ERROR("Can not allocate hardware status page\n"); DRM_ERROR("Can not allocate hardware status page\n");
return -ENOMEM; return -ENOMEM;
...@@ -209,7 +187,6 @@ static int i915_initialize(struct drm_device * dev, ...@@ -209,7 +187,6 @@ static int i915_initialize(struct drm_device * dev,
I915_WRITE(0x02080, dev_priv->dma_status_page); I915_WRITE(0x02080, dev_priv->dma_status_page);
} }
DRM_DEBUG("Enabled hardware status page\n"); DRM_DEBUG("Enabled hardware status page\n");
dev->dev_private = (void *)dev_priv;
return 0; return 0;
} }
...@@ -254,17 +231,12 @@ static int i915_dma_resume(struct drm_device * dev) ...@@ -254,17 +231,12 @@ static int i915_dma_resume(struct drm_device * dev)
static int i915_dma_init(struct drm_device *dev, void *data, static int i915_dma_init(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv;
drm_i915_init_t *init = data; drm_i915_init_t *init = data;
int retcode = 0; int retcode = 0;
switch (init->func) { switch (init->func) {
case I915_INIT_DMA: case I915_INIT_DMA:
dev_priv = drm_alloc(sizeof(drm_i915_private_t), retcode = i915_initialize(dev, init);
DRM_MEM_DRIVER);
if (dev_priv == NULL)
return -ENOMEM;
retcode = i915_initialize(dev, dev_priv, init);
break; break;
case I915_CLEANUP_DMA: case I915_CLEANUP_DMA:
retcode = i915_dma_cleanup(dev); retcode = i915_dma_cleanup(dev);
...@@ -685,7 +657,7 @@ static int i915_getparam(struct drm_device *dev, void *data, ...@@ -685,7 +657,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
int value; int value;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -719,7 +691,7 @@ static int i915_setparam(struct drm_device *dev, void *data, ...@@ -719,7 +691,7 @@ static int i915_setparam(struct drm_device *dev, void *data,
drm_i915_setparam_t *param = data; drm_i915_setparam_t *param = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -749,7 +721,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, ...@@ -749,7 +721,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
drm_i915_hws_addr_t *hws = data; drm_i915_hws_addr_t *hws = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -757,7 +729,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, ...@@ -757,7 +729,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12);
dev_priv->hws_map.offset = dev->agp->agp_info.aper_base + hws->addr; dev_priv->hws_map.offset = dev->agp->base + hws->addr;
dev_priv->hws_map.size = 4*1024; dev_priv->hws_map.size = 4*1024;
dev_priv->hws_map.type = 0; dev_priv->hws_map.type = 0;
dev_priv->hws_map.flags = 0; dev_priv->hws_map.flags = 0;
...@@ -765,7 +737,6 @@ static int i915_set_status_page(struct drm_device *dev, void *data, ...@@ -765,7 +737,6 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
drm_core_ioremap(&dev_priv->hws_map, dev); drm_core_ioremap(&dev_priv->hws_map, dev);
if (dev_priv->hws_map.handle == NULL) { if (dev_priv->hws_map.handle == NULL) {
dev->dev_private = (void *)dev_priv;
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
dev_priv->status_gfx_addr = 0; dev_priv->status_gfx_addr = 0;
DRM_ERROR("can not ioremap virtual address for" DRM_ERROR("can not ioremap virtual address for"
...@@ -784,6 +755,10 @@ static int i915_set_status_page(struct drm_device *dev, void *data, ...@@ -784,6 +755,10 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
int i915_driver_load(struct drm_device *dev, unsigned long flags) int i915_driver_load(struct drm_device *dev, unsigned long flags)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long base, size;
int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1;
/* i915 has 4 more counters */ /* i915 has 4 more counters */
dev->counters += 4; dev->counters += 4;
dev->types[6] = _DRM_STAT_IRQ; dev->types[6] = _DRM_STAT_IRQ;
...@@ -791,24 +766,51 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -791,24 +766,51 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
dev->types[8] = _DRM_STAT_SECONDARY; dev->types[8] = _DRM_STAT_SECONDARY;
dev->types[9] = _DRM_STAT_DMA; dev->types[9] = _DRM_STAT_DMA;
dev_priv = drm_alloc(sizeof(drm_i915_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL)
return -ENOMEM;
memset(dev_priv, 0, sizeof(drm_i915_private_t));
dev->dev_private = (void *)dev_priv;
/* Add register map (needed for suspend/resume) */
base = drm_get_resource_start(dev, mmio_bar);
size = drm_get_resource_len(dev, mmio_bar);
ret = drm_addmap(dev, base, size, _DRM_REGISTERS,
_DRM_KERNEL | _DRM_DRIVER,
&dev_priv->mmio_map);
return ret;
}
int i915_driver_unload(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
if (dev_priv->mmio_map)
drm_rmmap(dev, dev_priv->mmio_map);
drm_free(dev->dev_private, sizeof(drm_i915_private_t),
DRM_MEM_DRIVER);
return 0; return 0;
} }
void i915_driver_lastclose(struct drm_device * dev) void i915_driver_lastclose(struct drm_device * dev)
{ {
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
if (dev_priv->agp_heap)
i915_mem_takedown(&(dev_priv->agp_heap)); i915_mem_takedown(&(dev_priv->agp_heap));
}
i915_dma_cleanup(dev); i915_dma_cleanup(dev);
} }
void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
{ {
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_release(dev, file_priv, dev_priv->agp_heap); i915_mem_release(dev, file_priv, dev_priv->agp_heap);
}
} }
struct drm_ioctl_desc i915_ioctls[] = { struct drm_ioctl_desc i915_ioctls[] = {
......
This diff is collapsed.
This diff is collapsed.
...@@ -276,7 +276,7 @@ static int i915_emit_irq(struct drm_device * dev) ...@@ -276,7 +276,7 @@ static int i915_emit_irq(struct drm_device * dev)
i915_kernel_lost_context(dev); i915_kernel_lost_context(dev);
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter; dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;
...@@ -300,7 +300,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) ...@@ -300,7 +300,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int ret = 0; int ret = 0;
DRM_DEBUG("%s irq_nr=%d breadcrumb=%d\n", __FUNCTION__, irq_nr, DRM_DEBUG("irq_nr=%d breadcrumb=%d\n", irq_nr,
READ_BREADCRUMB(dev_priv)); READ_BREADCRUMB(dev_priv));
if (READ_BREADCRUMB(dev_priv) >= irq_nr) if (READ_BREADCRUMB(dev_priv) >= irq_nr)
...@@ -312,8 +312,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) ...@@ -312,8 +312,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
READ_BREADCRUMB(dev_priv) >= irq_nr); READ_BREADCRUMB(dev_priv) >= irq_nr);
if (ret == -EBUSY) { if (ret == -EBUSY) {
DRM_ERROR("%s: EBUSY -- rec: %d emitted: %d\n", DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
__FUNCTION__,
READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
} }
...@@ -329,7 +328,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ ...@@ -329,7 +328,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ
int ret = 0; int ret = 0;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -365,7 +364,7 @@ int i915_irq_emit(struct drm_device *dev, void *data, ...@@ -365,7 +364,7 @@ int i915_irq_emit(struct drm_device *dev, void *data,
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -388,7 +387,7 @@ int i915_irq_wait(struct drm_device *dev, void *data, ...@@ -388,7 +387,7 @@ int i915_irq_wait(struct drm_device *dev, void *data,
drm_i915_irq_wait_t *irqwait = data; drm_i915_irq_wait_t *irqwait = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -418,13 +417,12 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data, ...@@ -418,13 +417,12 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data,
drm_i915_vblank_pipe_t *pipe = data; drm_i915_vblank_pipe_t *pipe = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
if (pipe->pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) { if (pipe->pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) {
DRM_ERROR("%s called with invalid pipe 0x%x\n", DRM_ERROR("called with invalid pipe 0x%x\n", pipe->pipe);
__FUNCTION__, pipe->pipe);
return -EINVAL; return -EINVAL;
} }
...@@ -443,7 +441,7 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data, ...@@ -443,7 +441,7 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data,
u16 flag; u16 flag;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -555,7 +553,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, ...@@ -555,7 +553,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
list_add_tail((struct list_head *)vbl_swap, &dev_priv->vbl_swaps.head); list_add_tail(&vbl_swap->head, &dev_priv->vbl_swaps.head);
dev_priv->swaps_pending++; dev_priv->swaps_pending++;
spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
......
...@@ -276,7 +276,7 @@ int i915_mem_alloc(struct drm_device *dev, void *data, ...@@ -276,7 +276,7 @@ int i915_mem_alloc(struct drm_device *dev, void *data,
struct mem_block *block, **heap; struct mem_block *block, **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -314,7 +314,7 @@ int i915_mem_free(struct drm_device *dev, void *data, ...@@ -314,7 +314,7 @@ int i915_mem_free(struct drm_device *dev, void *data,
struct mem_block *block, **heap; struct mem_block *block, **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -342,7 +342,7 @@ int i915_mem_init_heap(struct drm_device *dev, void *data, ...@@ -342,7 +342,7 @@ int i915_mem_init_heap(struct drm_device *dev, void *data,
struct mem_block **heap; struct mem_block **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -366,7 +366,7 @@ int i915_mem_destroy_heap( struct drm_device *dev, void *data, ...@@ -366,7 +366,7 @@ int i915_mem_destroy_heap( struct drm_device *dev, void *data,
struct mem_block **heap; struct mem_block **heap;
if ( !dev_priv ) { if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); DRM_ERROR( "called with no initialization\n" );
return -EINVAL; return -EINVAL;
} }
...@@ -384,4 +384,3 @@ int i915_mem_destroy_heap( struct drm_device *dev, void *data, ...@@ -384,4 +384,3 @@ int i915_mem_destroy_heap( struct drm_device *dev, void *data,
i915_mem_takedown( heap ); i915_mem_takedown( heap );
return 0; return 0;
} }
...@@ -998,7 +998,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup) ...@@ -998,7 +998,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
} }
} }
return 0; return err;
} }
int mga_dma_init(struct drm_device *dev, void *data, int mga_dma_init(struct drm_device *dev, void *data,
...@@ -1050,7 +1050,7 @@ int mga_dma_flush(struct drm_device *dev, void *data, ...@@ -1050,7 +1050,7 @@ int mga_dma_flush(struct drm_device *dev, void *data,
#if MGA_DMA_DEBUG #if MGA_DMA_DEBUG
int ret = mga_do_wait_for_idle(dev_priv); int ret = mga_do_wait_for_idle(dev_priv);
if (ret < 0) if (ret < 0)
DRM_INFO("%s: -EBUSY\n", __FUNCTION__); DRM_INFO("-EBUSY\n");
return ret; return ret;
#else #else
return mga_do_wait_for_idle(dev_priv); return mga_do_wait_for_idle(dev_priv);
......
...@@ -249,7 +249,7 @@ do { \ ...@@ -249,7 +249,7 @@ do { \
} else if ( dev_priv->prim.space < \ } else if ( dev_priv->prim.space < \
dev_priv->prim.high_mark ) { \ dev_priv->prim.high_mark ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "wrap...\n"); \
return -EBUSY; \ return -EBUSY; \
} \ } \
} \ } \
...@@ -260,7 +260,7 @@ do { \ ...@@ -260,7 +260,7 @@ do { \
if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \
if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "wrap...\n"); \
return -EBUSY; \ return -EBUSY; \
} \ } \
mga_do_dma_wrap_end( dev_priv ); \ mga_do_dma_wrap_end( dev_priv ); \
...@@ -280,8 +280,7 @@ do { \ ...@@ -280,8 +280,7 @@ do { \
#define BEGIN_DMA( n ) \ #define BEGIN_DMA( n ) \
do { \ do { \
if ( MGA_VERBOSE ) { \ if ( MGA_VERBOSE ) { \
DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ DRM_INFO( "BEGIN_DMA( %d )\n", (n) ); \
(n), __FUNCTION__ ); \
DRM_INFO( " space=0x%x req=0x%Zx\n", \ DRM_INFO( " space=0x%x req=0x%Zx\n", \
dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \
} \ } \
...@@ -292,7 +291,7 @@ do { \ ...@@ -292,7 +291,7 @@ do { \
#define BEGIN_DMA_WRAP() \ #define BEGIN_DMA_WRAP() \
do { \ do { \
if ( MGA_VERBOSE ) { \ if ( MGA_VERBOSE ) { \
DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ DRM_INFO( "BEGIN_DMA()\n" ); \
DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \
} \ } \
prim = dev_priv->prim.start; \ prim = dev_priv->prim.start; \
...@@ -311,7 +310,7 @@ do { \ ...@@ -311,7 +310,7 @@ do { \
#define FLUSH_DMA() \ #define FLUSH_DMA() \
do { \ do { \
if ( 0 ) { \ if ( 0 ) { \
DRM_INFO( "%s:\n", __FUNCTION__ ); \ DRM_INFO( "\n" ); \
DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ DRM_INFO( " tail=0x%06x head=0x%06lx\n", \
dev_priv->prim.tail, \ dev_priv->prim.tail, \
MGA_READ( MGA_PRIMADDRESS ) - \ MGA_READ( MGA_PRIMADDRESS ) - \
......
...@@ -619,7 +619,7 @@ static void mga_dma_dispatch_swap(struct drm_device * dev) ...@@ -619,7 +619,7 @@ static void mga_dma_dispatch_swap(struct drm_device * dev)
FLUSH_DMA(); FLUSH_DMA();
DRM_DEBUG("%s... done.\n", __FUNCTION__); DRM_DEBUG("... done.\n");
} }
static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf) static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
...@@ -631,7 +631,7 @@ static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * bu ...@@ -631,7 +631,7 @@ static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * bu
u32 length = (u32) buf->used; u32 length = (u32) buf->used;
int i = 0; int i = 0;
DMA_LOCALS; DMA_LOCALS;
DRM_DEBUG("vertex: buf=%d used=%d\n", buf->idx, buf->used); DRM_DEBUG("buf=%d used=%d\n", buf->idx, buf->used);
if (buf->used) { if (buf->used) {
buf_priv->dispatched = 1; buf_priv->dispatched = 1;
...@@ -678,7 +678,7 @@ static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * b ...@@ -678,7 +678,7 @@ static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * b
u32 address = (u32) buf->bus_address; u32 address = (u32) buf->bus_address;
int i = 0; int i = 0;
DMA_LOCALS; DMA_LOCALS;
DRM_DEBUG("indices: buf=%d start=%d end=%d\n", buf->idx, start, end); DRM_DEBUG("buf=%d start=%d end=%d\n", buf->idx, start, end);
if (start != end) { if (start != end) {
buf_priv->dispatched = 1; buf_priv->dispatched = 1;
...@@ -955,7 +955,7 @@ static int mga_dma_iload(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -955,7 +955,7 @@ static int mga_dma_iload(struct drm_device *dev, void *data, struct drm_file *fi
#if 0 #if 0
if (mga_do_wait_for_idle(dev_priv) < 0) { if (mga_do_wait_for_idle(dev_priv) < 0) {
if (MGA_DMA_DEBUG) if (MGA_DMA_DEBUG)
DRM_INFO("%s: -EBUSY\n", __FUNCTION__); DRM_INFO("-EBUSY\n");
return -EBUSY; return -EBUSY;
} }
#endif #endif
...@@ -1014,7 +1014,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *fil ...@@ -1014,7 +1014,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *fil
int value; int value;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1046,7 +1046,7 @@ static int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -1046,7 +1046,7 @@ static int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *fi
DMA_LOCALS; DMA_LOCALS;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1075,7 +1075,7 @@ file_priv) ...@@ -1075,7 +1075,7 @@ file_priv)
u32 *fence = data; u32 *fence = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -651,7 +651,7 @@ int r128_cce_start(struct drm_device *dev, void *data, struct drm_file *file_pri ...@@ -651,7 +651,7 @@ int r128_cce_start(struct drm_device *dev, void *data, struct drm_file *file_pri
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4) { if (dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4) {
DRM_DEBUG("%s while CCE running\n", __FUNCTION__); DRM_DEBUG("while CCE running\n");
return 0; return 0;
} }
...@@ -710,7 +710,7 @@ int r128_cce_reset(struct drm_device *dev, void *data, struct drm_file *file_pri ...@@ -710,7 +710,7 @@ int r128_cce_reset(struct drm_device *dev, void *data, struct drm_file *file_pri
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__); DRM_DEBUG("called before init done\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -462,8 +462,7 @@ do { \ ...@@ -462,8 +462,7 @@ do { \
#define BEGIN_RING( n ) do { \ #define BEGIN_RING( n ) do { \
if ( R128_VERBOSE ) { \ if ( R128_VERBOSE ) { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ DRM_INFO( "BEGIN_RING( %d )\n", (n)); \
(n), __FUNCTION__ ); \
} \ } \
if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
COMMIT_RING(); \ COMMIT_RING(); \
......
...@@ -42,7 +42,7 @@ static void r128_emit_clip_rects(drm_r128_private_t * dev_priv, ...@@ -42,7 +42,7 @@ static void r128_emit_clip_rects(drm_r128_private_t * dev_priv,
{ {
u32 aux_sc_cntl = 0x00000000; u32 aux_sc_cntl = 0x00000000;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING((count < 3 ? count : 3) * 5 + 2); BEGIN_RING((count < 3 ? count : 3) * 5 + 2);
...@@ -85,7 +85,7 @@ static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv) ...@@ -85,7 +85,7 @@ static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_r128_context_regs_t *ctx = &sarea_priv->context_state; drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(2); BEGIN_RING(2);
...@@ -100,7 +100,7 @@ static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv) ...@@ -100,7 +100,7 @@ static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_r128_context_regs_t *ctx = &sarea_priv->context_state; drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(13); BEGIN_RING(13);
...@@ -126,7 +126,7 @@ static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv) ...@@ -126,7 +126,7 @@ static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_r128_context_regs_t *ctx = &sarea_priv->context_state; drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(3); BEGIN_RING(3);
...@@ -142,7 +142,7 @@ static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv) ...@@ -142,7 +142,7 @@ static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_r128_context_regs_t *ctx = &sarea_priv->context_state; drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(5); BEGIN_RING(5);
...@@ -161,7 +161,7 @@ static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv) ...@@ -161,7 +161,7 @@ static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_r128_context_regs_t *ctx = &sarea_priv->context_state; drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(2); BEGIN_RING(2);
...@@ -178,7 +178,7 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv) ...@@ -178,7 +178,7 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)
drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0]; drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[0];
int i; int i;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(7 + R128_MAX_TEXTURE_LEVELS); BEGIN_RING(7 + R128_MAX_TEXTURE_LEVELS);
...@@ -204,7 +204,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) ...@@ -204,7 +204,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)
drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1];
int i; int i;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG(" %s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(5 + R128_MAX_TEXTURE_LEVELS); BEGIN_RING(5 + R128_MAX_TEXTURE_LEVELS);
...@@ -226,7 +226,7 @@ static void r128_emit_state(drm_r128_private_t * dev_priv) ...@@ -226,7 +226,7 @@ static void r128_emit_state(drm_r128_private_t * dev_priv)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
unsigned int dirty = sarea_priv->dirty; unsigned int dirty = sarea_priv->dirty;
DRM_DEBUG("%s: dirty=0x%08x\n", __FUNCTION__, dirty); DRM_DEBUG("dirty=0x%08x\n", dirty);
if (dirty & R128_UPLOAD_CORE) { if (dirty & R128_UPLOAD_CORE) {
r128_emit_core(dev_priv); r128_emit_core(dev_priv);
...@@ -362,7 +362,7 @@ static void r128_cce_dispatch_clear(struct drm_device * dev, ...@@ -362,7 +362,7 @@ static void r128_cce_dispatch_clear(struct drm_device * dev,
unsigned int flags = clear->flags; unsigned int flags = clear->flags;
int i; int i;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
if (dev_priv->page_flipping && dev_priv->current_page == 1) { if (dev_priv->page_flipping && dev_priv->current_page == 1) {
unsigned int tmp = flags; unsigned int tmp = flags;
...@@ -466,7 +466,7 @@ static void r128_cce_dispatch_swap(struct drm_device * dev) ...@@ -466,7 +466,7 @@ static void r128_cce_dispatch_swap(struct drm_device * dev)
struct drm_clip_rect *pbox = sarea_priv->boxes; struct drm_clip_rect *pbox = sarea_priv->boxes;
int i; int i;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
#if R128_PERFORMANCE_BOXES #if R128_PERFORMANCE_BOXES
/* Do some trivial performance monitoring... /* Do some trivial performance monitoring...
...@@ -528,8 +528,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev) ...@@ -528,8 +528,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)
{ {
drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n", DRM_DEBUG("page=%d pfCurrentPage=%d\n",
__FUNCTION__,
dev_priv->current_page, dev_priv->sarea_priv->pfCurrentPage); dev_priv->current_page, dev_priv->sarea_priv->pfCurrentPage);
#if R128_PERFORMANCE_BOXES #if R128_PERFORMANCE_BOXES
...@@ -1156,7 +1155,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, ...@@ -1156,7 +1155,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
int count, *x, *y; int count, *x, *y;
int i, xbuf_size, ybuf_size; int i, xbuf_size, ybuf_size;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
count = depth->n; count = depth->n;
if (count > 4096 || count <= 0) if (count > 4096 || count <= 0)
...@@ -1226,7 +1225,7 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple) ...@@ -1226,7 +1225,7 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)
drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_private_t *dev_priv = dev->dev_private;
int i; int i;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
BEGIN_RING(33); BEGIN_RING(33);
...@@ -1309,7 +1308,7 @@ static int r128_do_cleanup_pageflip(struct drm_device * dev) ...@@ -1309,7 +1308,7 @@ static int r128_do_cleanup_pageflip(struct drm_device * dev)
static int r128_cce_flip(struct drm_device *dev, void *data, struct drm_file *file_priv) static int r128_cce_flip(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
...@@ -1328,7 +1327,7 @@ static int r128_cce_swap(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -1328,7 +1327,7 @@ static int r128_cce_swap(struct drm_device *dev, void *data, struct drm_file *fi
{ {
drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_private_t *dev_priv = dev->dev_private;
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
...@@ -1356,7 +1355,7 @@ static int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file * ...@@ -1356,7 +1355,7 @@ static int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1412,7 +1411,7 @@ static int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file ...@@ -1412,7 +1411,7 @@ static int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1557,11 +1556,11 @@ static int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file ...@@ -1557,11 +1556,11 @@ static int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
DRM_DEBUG("indirect: idx=%d s=%d e=%d d=%d\n", DRM_DEBUG("idx=%d s=%d e=%d d=%d\n",
indirect->idx, indirect->start, indirect->end, indirect->idx, indirect->start, indirect->end,
indirect->discard); indirect->discard);
...@@ -1622,7 +1621,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -1622,7 +1621,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi
int value; int value;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -77,23 +77,31 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, ...@@ -77,23 +77,31 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
return -EFAULT; return -EFAULT;
} }
box.x1 = if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
(box.x1 + box.x1 = (box.x1) &
R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; R300_CLIPRECT_MASK;
box.y1 = box.y1 = (box.y1) &
(box.y1 + R300_CLIPRECT_MASK;
R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; box.x2 = (box.x2) &
box.x2 = R300_CLIPRECT_MASK;
(box.x2 + box.y2 = (box.y2) &
R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; R300_CLIPRECT_MASK;
box.y2 = } else {
(box.y2 + box.x1 = (box.x1 + R300_CLIPRECT_OFFSET) &
R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; R300_CLIPRECT_MASK;
box.y1 = (box.y1 + R300_CLIPRECT_OFFSET) &
R300_CLIPRECT_MASK;
box.x2 = (box.x2 + R300_CLIPRECT_OFFSET) &
R300_CLIPRECT_MASK;
box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) &
R300_CLIPRECT_MASK;
}
OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) |
(box.y1 << R300_CLIPRECT_Y_SHIFT)); (box.y1 << R300_CLIPRECT_Y_SHIFT));
OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) |
(box.y2 << R300_CLIPRECT_Y_SHIFT)); (box.y2 << R300_CLIPRECT_Y_SHIFT));
} }
OUT_RING_REG(R300_RE_CLIPRECT_CNTL, r300_cliprect_cntl[nr - 1]); OUT_RING_REG(R300_RE_CLIPRECT_CNTL, r300_cliprect_cntl[nr - 1]);
...@@ -133,9 +141,11 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, ...@@ -133,9 +141,11 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
static u8 r300_reg_flags[0x10000 >> 2]; static u8 r300_reg_flags[0x10000 >> 2];
void r300_init_reg_flags(void) void r300_init_reg_flags(struct drm_device *dev)
{ {
int i; int i;
drm_radeon_private_t *dev_priv = dev->dev_private;
memset(r300_reg_flags, 0, 0x10000 >> 2); memset(r300_reg_flags, 0, 0x10000 >> 2);
#define ADD_RANGE_MARK(reg, count,mark) \ #define ADD_RANGE_MARK(reg, count,mark) \
for(i=((reg)>>2);i<((reg)>>2)+(count);i++)\ for(i=((reg)>>2);i<((reg)>>2)+(count);i++)\
...@@ -230,6 +240,9 @@ void r300_init_reg_flags(void) ...@@ -230,6 +240,9 @@ void r300_init_reg_flags(void)
ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8); ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8);
ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8); ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
ADD_RANGE(0x4074, 16);
}
} }
static __inline__ int r300_check_range(unsigned reg, int count) static __inline__ int r300_check_range(unsigned reg, int count)
......
...@@ -816,6 +816,46 @@ static const u32 R300_cp_microcode[][2] = { ...@@ -816,6 +816,46 @@ static const u32 R300_cp_microcode[][2] = {
{0000000000, 0000000000}, {0000000000, 0000000000},
}; };
static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
{
u32 ret;
RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff));
ret = RADEON_READ(R520_MC_IND_DATA);
RADEON_WRITE(R520_MC_IND_INDEX, 0);
return ret;
}
u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
{
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
else
return RADEON_READ(RADEON_MC_FB_LOCATION);
}
static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
{
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
else
RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
}
static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
{
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
else
RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
}
static int RADEON_READ_PLL(struct drm_device * dev, int addr) static int RADEON_READ_PLL(struct drm_device * dev, int addr)
{ {
drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_private_t *dev_priv = dev->dev_private;
...@@ -824,7 +864,7 @@ static int RADEON_READ_PLL(struct drm_device * dev, int addr) ...@@ -824,7 +864,7 @@ static int RADEON_READ_PLL(struct drm_device * dev, int addr)
return RADEON_READ(RADEON_CLOCK_CNTL_DATA); return RADEON_READ(RADEON_CLOCK_CNTL_DATA);
} }
static int RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr) static u32 RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr)
{ {
RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff); RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff);
return RADEON_READ(RADEON_PCIE_DATA); return RADEON_READ(RADEON_PCIE_DATA);
...@@ -1074,6 +1114,7 @@ static int radeon_do_engine_reset(struct drm_device * dev) ...@@ -1074,6 +1114,7 @@ static int radeon_do_engine_reset(struct drm_device * dev)
radeon_do_pixcache_flush(dev_priv); radeon_do_pixcache_flush(dev_priv);
if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_RV515) {
clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX); clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX);
mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL); mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL);
...@@ -1109,6 +1150,7 @@ static int radeon_do_engine_reset(struct drm_device * dev) ...@@ -1109,6 +1150,7 @@ static int radeon_do_engine_reset(struct drm_device * dev)
RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl); RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl);
RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
}
/* Reset the CP ring */ /* Reset the CP ring */
radeon_do_cp_reset(dev_priv); radeon_do_cp_reset(dev_priv);
...@@ -1134,14 +1176,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev, ...@@ -1134,14 +1176,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
* always appended to the fb which is not necessarily the case * always appended to the fb which is not necessarily the case
*/ */
if (!dev_priv->new_memmap) if (!dev_priv->new_memmap)
RADEON_WRITE(RADEON_MC_FB_LOCATION, radeon_write_fb_location(dev_priv,
((dev_priv->gart_vm_start - 1) & 0xffff0000) ((dev_priv->gart_vm_start - 1) & 0xffff0000)
| (dev_priv->fb_location >> 16)); | (dev_priv->fb_location >> 16));
#if __OS_HAS_AGP #if __OS_HAS_AGP
if (dev_priv->flags & RADEON_IS_AGP) { if (dev_priv->flags & RADEON_IS_AGP) {
RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base); RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base);
RADEON_WRITE(RADEON_MC_AGP_LOCATION, radeon_write_agp_location(dev_priv,
(((dev_priv->gart_vm_start - 1 + (((dev_priv->gart_vm_start - 1 +
dev_priv->gart_size) & 0xffff0000) | dev_priv->gart_size) & 0xffff0000) |
(dev_priv->gart_vm_start >> 16))); (dev_priv->gart_vm_start >> 16)));
...@@ -1190,9 +1232,15 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev, ...@@ -1190,9 +1232,15 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
/* Set ring buffer size */ /* Set ring buffer size */
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
RADEON_WRITE(RADEON_CP_RB_CNTL, RADEON_WRITE(RADEON_CP_RB_CNTL,
dev_priv->ring.size_l2qw | RADEON_BUF_SWAP_32BIT); RADEON_BUF_SWAP_32BIT |
(dev_priv->ring.fetch_size_l2ow << 18) |
(dev_priv->ring.rptr_update_l2qw << 8) |
dev_priv->ring.size_l2qw);
#else #else
RADEON_WRITE(RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw); RADEON_WRITE(RADEON_CP_RB_CNTL,
(dev_priv->ring.fetch_size_l2ow << 18) |
(dev_priv->ring.rptr_update_l2qw << 8) |
dev_priv->ring.size_l2qw);
#endif #endif
/* Start with assuming that writeback doesn't work */ /* Start with assuming that writeback doesn't work */
...@@ -1299,7 +1347,7 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on) ...@@ -1299,7 +1347,7 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start); RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start);
dev_priv->gart_size = 32*1024*1024; dev_priv->gart_size = 32*1024*1024;
RADEON_WRITE(RADEON_MC_AGP_LOCATION, radeon_write_agp_location(dev_priv,
(((dev_priv->gart_vm_start - 1 + (((dev_priv->gart_vm_start - 1 +
dev_priv->gart_size) & 0xffff0000) | dev_priv->gart_size) & 0xffff0000) |
(dev_priv->gart_vm_start >> 16))); (dev_priv->gart_vm_start >> 16)));
...@@ -1333,7 +1381,7 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on) ...@@ -1333,7 +1381,7 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
dev_priv->gart_vm_start + dev_priv->gart_vm_start +
dev_priv->gart_size - 1); dev_priv->gart_size - 1);
RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */ radeon_write_agp_location(dev_priv, 0xffffffc0); /* ?? */
RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL, RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL,
RADEON_PCIE_TX_GART_EN); RADEON_PCIE_TX_GART_EN);
...@@ -1376,7 +1424,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) ...@@ -1376,7 +1424,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
/* Turn off AGP aperture -- is this required for PCI GART? /* Turn off AGP aperture -- is this required for PCI GART?
*/ */
RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */ radeon_write_agp_location(dev_priv, 0xffffffc0);
RADEON_WRITE(RADEON_AGP_COMMAND, 0); /* clear AGP_COMMAND */ RADEON_WRITE(RADEON_AGP_COMMAND, 0); /* clear AGP_COMMAND */
} else { } else {
RADEON_WRITE(RADEON_AIC_CNTL, RADEON_WRITE(RADEON_AIC_CNTL,
...@@ -1581,10 +1629,9 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1581,10 +1629,9 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
dev->agp_buffer_map->handle); dev->agp_buffer_map->handle);
} }
dev_priv->fb_location = (RADEON_READ(RADEON_MC_FB_LOCATION) dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 16;
& 0xffff) << 16;
dev_priv->fb_size = dev_priv->fb_size =
((RADEON_READ(RADEON_MC_FB_LOCATION) & 0xffff0000u) + 0x10000) ((radeon_read_fb_location(dev_priv) & 0xffff0000u) + 0x10000)
- dev_priv->fb_location; - dev_priv->fb_location;
dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) | dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) |
...@@ -1663,6 +1710,11 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) ...@@ -1663,6 +1710,11 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
dev_priv->ring.size = init->ring_size; dev_priv->ring.size = init->ring_size;
dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8); dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8);
dev_priv->ring.rptr_update = /* init->rptr_update */ 4096;
dev_priv->ring.rptr_update_l2qw = drm_order( /* init->rptr_update */ 4096 / 8);
dev_priv->ring.fetch_size = /* init->fetch_size */ 32;
dev_priv->ring.fetch_size_l2ow = drm_order( /* init->fetch_size */ 32 / 16);
dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1;
dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
...@@ -1830,7 +1882,7 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri ...@@ -1830,7 +1882,7 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (init->func == RADEON_INIT_R300_CP) if (init->func == RADEON_INIT_R300_CP)
r300_init_reg_flags(); r300_init_reg_flags(dev);
switch (init->func) { switch (init->func) {
case RADEON_INIT_CP: case RADEON_INIT_CP:
...@@ -1852,12 +1904,12 @@ int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_pr ...@@ -1852,12 +1904,12 @@ int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_pr
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (dev_priv->cp_running) { if (dev_priv->cp_running) {
DRM_DEBUG("%s while CP running\n", __FUNCTION__); DRM_DEBUG("while CP running\n");
return 0; return 0;
} }
if (dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS) { if (dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS) {
DRM_DEBUG("%s called with bogus CP mode (%d)\n", DRM_DEBUG("called with bogus CP mode (%d)\n",
__FUNCTION__, dev_priv->cp_mode); dev_priv->cp_mode);
return 0; return 0;
} }
...@@ -1962,7 +2014,7 @@ int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_pr ...@@ -1962,7 +2014,7 @@ int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_pr
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__); DRM_DEBUG("called before init done\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2239,6 +2291,10 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -2239,6 +2291,10 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
case CHIP_R350: case CHIP_R350:
case CHIP_R420: case CHIP_R420:
case CHIP_RV410: case CHIP_RV410:
case CHIP_RV515:
case CHIP_R520:
case CHIP_RV570:
case CHIP_R580:
dev_priv->flags |= RADEON_HAS_HIERZ; dev_priv->flags |= RADEON_HAS_HIERZ;
break; break;
default: default:
......
...@@ -656,6 +656,7 @@ typedef struct drm_radeon_indirect { ...@@ -656,6 +656,7 @@ typedef struct drm_radeon_indirect {
#define RADEON_PARAM_SCRATCH_OFFSET 11 #define RADEON_PARAM_SCRATCH_OFFSET 11
#define RADEON_PARAM_CARD_TYPE 12 #define RADEON_PARAM_CARD_TYPE 12
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
typedef struct drm_radeon_getparam { typedef struct drm_radeon_getparam {
int param; int param;
......
...@@ -123,6 +123,12 @@ enum radeon_family { ...@@ -123,6 +123,12 @@ enum radeon_family {
CHIP_R420, CHIP_R420,
CHIP_RV410, CHIP_RV410,
CHIP_RS400, CHIP_RS400,
CHIP_RV515,
CHIP_R520,
CHIP_RV530,
CHIP_RV560,
CHIP_RV570,
CHIP_R580,
CHIP_LAST, CHIP_LAST,
}; };
...@@ -166,6 +172,12 @@ typedef struct drm_radeon_ring_buffer { ...@@ -166,6 +172,12 @@ typedef struct drm_radeon_ring_buffer {
int size; int size;
int size_l2qw; int size_l2qw;
int rptr_update; /* Double Words */
int rptr_update_l2qw; /* log2 Quad Words */
int fetch_size; /* Double Words */
int fetch_size_l2ow; /* log2 Oct Words */
u32 tail; u32 tail;
u32 tail_mask; u32 tail_mask;
int space; int space;
...@@ -336,6 +348,7 @@ extern int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file ...@@ -336,6 +348,7 @@ extern int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file
extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
extern void radeon_freelist_reset(struct drm_device * dev); extern void radeon_freelist_reset(struct drm_device * dev);
extern struct drm_buf *radeon_freelist_get(struct drm_device * dev); extern struct drm_buf *radeon_freelist_get(struct drm_device * dev);
...@@ -382,7 +395,7 @@ extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd, ...@@ -382,7 +395,7 @@ extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg); unsigned long arg);
/* r300_cmdbuf.c */ /* r300_cmdbuf.c */
extern void r300_init_reg_flags(void); extern void r300_init_reg_flags(struct drm_device *dev);
extern int r300_do_cp_cmdbuf(struct drm_device * dev, extern int r300_do_cp_cmdbuf(struct drm_device * dev,
struct drm_file *file_priv, struct drm_file *file_priv,
...@@ -454,6 +467,16 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, ...@@ -454,6 +467,16 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
#define RADEON_IGPGART_ENABLE 0x38 #define RADEON_IGPGART_ENABLE 0x38
#define RADEON_IGPGART_UNK_39 0x39 #define RADEON_IGPGART_UNK_39 0x39
#define R520_MC_IND_INDEX 0x70
#define R520_MC_IND_WR_EN (1<<24)
#define R520_MC_IND_DATA 0x74
#define RV515_MC_FB_LOCATION 0x01
#define RV515_MC_AGP_LOCATION 0x02
#define R520_MC_FB_LOCATION 0x04
#define R520_MC_AGP_LOCATION 0x05
#define RADEON_MPP_TB_CONFIG 0x01c0 #define RADEON_MPP_TB_CONFIG 0x01c0
#define RADEON_MEM_CNTL 0x0140 #define RADEON_MEM_CNTL 0x0140
#define RADEON_MEM_SDRAM_MODE_REG 0x0158 #define RADEON_MEM_SDRAM_MODE_REG 0x0158
...@@ -615,8 +638,50 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, ...@@ -615,8 +638,50 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
# define RADEON_SOFT_RESET_E2 (1 << 5) # define RADEON_SOFT_RESET_E2 (1 << 5)
# define RADEON_SOFT_RESET_RB (1 << 6) # define RADEON_SOFT_RESET_RB (1 << 6)
# define RADEON_SOFT_RESET_HDP (1 << 7) # define RADEON_SOFT_RESET_HDP (1 << 7)
/*
* 6:0 Available slots in the FIFO
* 8 Host Interface active
* 9 CP request active
* 10 FIFO request active
* 11 Host Interface retry active
* 12 CP retry active
* 13 FIFO retry active
* 14 FIFO pipeline busy
* 15 Event engine busy
* 16 CP command stream busy
* 17 2D engine busy
* 18 2D portion of render backend busy
* 20 3D setup engine busy
* 26 GA engine busy
* 27 CBA 2D engine busy
* 31 2D engine busy or 3D engine busy or FIFO not empty or CP busy or
* command stream queue not empty or Ring Buffer not empty
*/
#define RADEON_RBBM_STATUS 0x0e40 #define RADEON_RBBM_STATUS 0x0e40
/* Same as the previous RADEON_RBBM_STATUS; this is a mirror of that register. */
/* #define RADEON_RBBM_STATUS 0x1740 */
/* bits 6:0 are dword slots available in the cmd fifo */
# define RADEON_RBBM_FIFOCNT_MASK 0x007f # define RADEON_RBBM_FIFOCNT_MASK 0x007f
# define RADEON_HIRQ_ON_RBB (1 << 8)
# define RADEON_CPRQ_ON_RBB (1 << 9)
# define RADEON_CFRQ_ON_RBB (1 << 10)
# define RADEON_HIRQ_IN_RTBUF (1 << 11)
# define RADEON_CPRQ_IN_RTBUF (1 << 12)
# define RADEON_CFRQ_IN_RTBUF (1 << 13)
# define RADEON_PIPE_BUSY (1 << 14)
# define RADEON_ENG_EV_BUSY (1 << 15)
# define RADEON_CP_CMDSTRM_BUSY (1 << 16)
# define RADEON_E2_BUSY (1 << 17)
# define RADEON_RB2D_BUSY (1 << 18)
# define RADEON_RB3D_BUSY (1 << 19) /* not used on r300 */
# define RADEON_VAP_BUSY (1 << 20)
# define RADEON_RE_BUSY (1 << 21) /* not used on r300 */
# define RADEON_TAM_BUSY (1 << 22) /* not used on r300 */
# define RADEON_TDM_BUSY (1 << 23) /* not used on r300 */
# define RADEON_PB_BUSY (1 << 24) /* not used on r300 */
# define RADEON_TIM_BUSY (1 << 25) /* not used on r300 */
# define RADEON_GA_BUSY (1 << 26)
# define RADEON_CBA2D_BUSY (1 << 27)
# define RADEON_RBBM_ACTIVE (1 << 31) # define RADEON_RBBM_ACTIVE (1 << 31)
#define RADEON_RE_LINE_PATTERN 0x1cd0 #define RADEON_RE_LINE_PATTERN 0x1cd0
#define RADEON_RE_MISC 0x26c4 #define RADEON_RE_MISC 0x26c4
...@@ -1004,6 +1069,13 @@ do { \ ...@@ -1004,6 +1069,13 @@ do { \
RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \ RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \
} while (0) } while (0)
#define RADEON_WRITE_MCIND( addr, val ) \
do { \
RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \
RADEON_WRITE(R520_MC_IND_DATA, (val)); \
RADEON_WRITE(R520_MC_IND_INDEX, 0); \
} while (0)
#define CP_PACKET0( reg, n ) \ #define CP_PACKET0( reg, n ) \
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
#define CP_PACKET0_TABLE( reg, n ) \ #define CP_PACKET0_TABLE( reg, n ) \
...@@ -1114,8 +1186,7 @@ do { \ ...@@ -1114,8 +1186,7 @@ do { \
#define BEGIN_RING( n ) do { \ #define BEGIN_RING( n ) do { \
if ( RADEON_VERBOSE ) { \ if ( RADEON_VERBOSE ) { \
DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ DRM_INFO( "BEGIN_RING( %d )\n", (n)); \
n, __FUNCTION__ ); \
} \ } \
if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \
COMMIT_RING(); \ COMMIT_RING(); \
......
...@@ -154,7 +154,7 @@ static int radeon_driver_vblank_do_wait(struct drm_device * dev, ...@@ -154,7 +154,7 @@ static int radeon_driver_vblank_do_wait(struct drm_device * dev,
int ack = 0; int ack = 0;
atomic_t *counter; atomic_t *counter;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -205,7 +205,7 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr ...@@ -205,7 +205,7 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -227,7 +227,7 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr ...@@ -227,7 +227,7 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr
drm_radeon_irq_wait_t *irqwait = data; drm_radeon_irq_wait_t *irqwait = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -224,7 +224,7 @@ int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_p ...@@ -224,7 +224,7 @@ int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_p
struct mem_block *block, **heap; struct mem_block *block, **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -259,7 +259,7 @@ int radeon_mem_free(struct drm_device *dev, void *data, struct drm_file *file_pr ...@@ -259,7 +259,7 @@ int radeon_mem_free(struct drm_device *dev, void *data, struct drm_file *file_pr
struct mem_block *block, **heap; struct mem_block *block, **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -285,7 +285,7 @@ int radeon_mem_init_heap(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -285,7 +285,7 @@ int radeon_mem_init_heap(struct drm_device *dev, void *data, struct drm_file *fi
struct mem_block **heap; struct mem_block **heap;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -898,7 +898,7 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev, ...@@ -898,7 +898,7 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev,
int w = pbox[i].x2 - x; int w = pbox[i].x2 - x;
int h = pbox[i].y2 - y; int h = pbox[i].y2 - y;
DRM_DEBUG("dispatch clear %d,%d-%d,%d flags 0x%x\n", DRM_DEBUG("%d,%d-%d,%d flags 0x%x\n",
x, y, w, h, flags); x, y, w, h, flags);
if (flags & RADEON_FRONT) { if (flags & RADEON_FRONT) {
...@@ -1368,7 +1368,7 @@ static void radeon_cp_dispatch_swap(struct drm_device * dev) ...@@ -1368,7 +1368,7 @@ static void radeon_cp_dispatch_swap(struct drm_device * dev)
int w = pbox[i].x2 - x; int w = pbox[i].x2 - x;
int h = pbox[i].y2 - y; int h = pbox[i].y2 - y;
DRM_DEBUG("dispatch swap %d,%d-%d,%d\n", x, y, w, h); DRM_DEBUG("%d,%d-%d,%d\n", x, y, w, h);
BEGIN_RING(9); BEGIN_RING(9);
...@@ -1422,8 +1422,7 @@ static void radeon_cp_dispatch_flip(struct drm_device * dev) ...@@ -1422,8 +1422,7 @@ static void radeon_cp_dispatch_flip(struct drm_device * dev)
int offset = (dev_priv->sarea_priv->pfCurrentPage == 1) int offset = (dev_priv->sarea_priv->pfCurrentPage == 1)
? dev_priv->front_offset : dev_priv->back_offset; ? dev_priv->front_offset : dev_priv->back_offset;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s: pfCurrentPage=%d\n", DRM_DEBUG("pfCurrentPage=%d\n",
__FUNCTION__,
dev_priv->sarea_priv->pfCurrentPage); dev_priv->sarea_priv->pfCurrentPage);
/* Do some trivial performance monitoring... /* Do some trivial performance monitoring...
...@@ -1562,7 +1561,7 @@ static void radeon_cp_dispatch_indirect(struct drm_device * dev, ...@@ -1562,7 +1561,7 @@ static void radeon_cp_dispatch_indirect(struct drm_device * dev,
{ {
drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end); DRM_DEBUG("buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
if (start != end) { if (start != end) {
int offset = (dev_priv->gart_buffers_offset int offset = (dev_priv->gart_buffers_offset
...@@ -1758,7 +1757,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, ...@@ -1758,7 +1757,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev,
buf = radeon_freelist_get(dev); buf = radeon_freelist_get(dev);
} }
if (!buf) { if (!buf) {
DRM_DEBUG("radeon_cp_dispatch_texture: EAGAIN\n"); DRM_DEBUG("EAGAIN\n");
if (DRM_COPY_TO_USER(tex->image, image, sizeof(*image))) if (DRM_COPY_TO_USER(tex->image, image, sizeof(*image)))
return -EFAULT; return -EFAULT;
return -EAGAIN; return -EAGAIN;
...@@ -2413,7 +2412,7 @@ static int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_fil ...@@ -2413,7 +2412,7 @@ static int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_fil
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_DEBUG("indirect: idx=%d s=%d e=%d d=%d\n", DRM_DEBUG("idx=%d s=%d e=%d d=%d\n",
indirect->idx, indirect->start, indirect->end, indirect->idx, indirect->start, indirect->end,
indirect->discard); indirect->discard);
...@@ -2779,7 +2778,7 @@ static int radeon_emit_wait(struct drm_device * dev, int flags) ...@@ -2779,7 +2778,7 @@ static int radeon_emit_wait(struct drm_device * dev, int flags)
drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
DRM_DEBUG("%s: %x\n", __FUNCTION__, flags); DRM_DEBUG("%x\n", flags);
switch (flags) { switch (flags) {
case RADEON_WAIT_2D: case RADEON_WAIT_2D:
BEGIN_RING(2); BEGIN_RING(2);
...@@ -3035,6 +3034,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil ...@@ -3035,6 +3034,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
case RADEON_PARAM_VBLANK_CRTC: case RADEON_PARAM_VBLANK_CRTC:
value = radeon_vblank_crtc_get(dev); value = radeon_vblank_crtc_get(dev);
break; break;
case RADEON_PARAM_FB_LOCATION:
value = radeon_read_fb_location(dev_priv);
break;
default: default:
DRM_DEBUG("Invalid parameter %d\n", param->param); DRM_DEBUG("Invalid parameter %d\n", param->param);
return -EINVAL; return -EINVAL;
......
...@@ -115,7 +115,7 @@ static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file ...@@ -115,7 +115,7 @@ static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file
dev_priv->vram_offset = fb->offset; dev_priv->vram_offset = fb->offset;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("offset = %u, size = %u", fb->offset, fb->size); DRM_DEBUG("offset = %u, size = %u\n", fb->offset, fb->size);
return 0; return 0;
} }
...@@ -205,7 +205,7 @@ static int sis_ioctl_agp_init(struct drm_device *dev, void *data, ...@@ -205,7 +205,7 @@ static int sis_ioctl_agp_init(struct drm_device *dev, void *data,
dev_priv->agp_offset = agp->offset; dev_priv->agp_offset = agp->offset;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("offset = %u, size = %u", agp->offset, agp->size); DRM_DEBUG("offset = %u, size = %u\n", agp->offset, agp->size);
return 0; return 0;
} }
......
...@@ -179,14 +179,12 @@ static int via_initialize(struct drm_device * dev, ...@@ -179,14 +179,12 @@ static int via_initialize(struct drm_device * dev,
} }
if (dev_priv->ring.virtual_start != NULL) { if (dev_priv->ring.virtual_start != NULL) {
DRM_ERROR("%s called again without calling cleanup\n", DRM_ERROR("called again without calling cleanup\n");
__FUNCTION__);
return -EFAULT; return -EFAULT;
} }
if (!dev->agp || !dev->agp->base) { if (!dev->agp || !dev->agp->base) {
DRM_ERROR("%s called with no agp memory available\n", DRM_ERROR("called with no agp memory available\n");
__FUNCTION__);
return -EFAULT; return -EFAULT;
} }
...@@ -267,8 +265,7 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * ...@@ -267,8 +265,7 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
dev_priv = (drm_via_private_t *) dev->dev_private; dev_priv = (drm_via_private_t *) dev->dev_private;
if (dev_priv->ring.virtual_start == NULL) { if (dev_priv->ring.virtual_start == NULL) {
DRM_ERROR("%s called without initializing AGP ring buffer.\n", DRM_ERROR("called without initializing AGP ring buffer.\n");
__FUNCTION__);
return -EFAULT; return -EFAULT;
} }
...@@ -337,8 +334,7 @@ static int via_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -337,8 +334,7 @@ static int via_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *fi
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_DEBUG("via cmdbuffer, buf %p size %lu\n", cmdbuf->buf, DRM_DEBUG("buf %p size %lu\n", cmdbuf->buf, cmdbuf->size);
cmdbuf->size);
ret = via_dispatch_cmdbuffer(dev, cmdbuf); ret = via_dispatch_cmdbuffer(dev, cmdbuf);
if (ret) { if (ret) {
...@@ -379,8 +375,7 @@ static int via_pci_cmdbuffer(struct drm_device *dev, void *data, struct drm_file ...@@ -379,8 +375,7 @@ static int via_pci_cmdbuffer(struct drm_device *dev, void *data, struct drm_file
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_DEBUG("via_pci_cmdbuffer, buf %p size %lu\n", cmdbuf->buf, DRM_DEBUG("buf %p size %lu\n", cmdbuf->buf, cmdbuf->size);
cmdbuf->size);
ret = via_dispatch_pci_cmdbuffer(dev, cmdbuf); ret = via_dispatch_pci_cmdbuffer(dev, cmdbuf);
if (ret) { if (ret) {
...@@ -648,14 +643,13 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * ...@@ -648,14 +643,13 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *
uint32_t tmp_size, count; uint32_t tmp_size, count;
drm_via_private_t *dev_priv; drm_via_private_t *dev_priv;
DRM_DEBUG("via cmdbuf_size\n"); DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, file_priv); LOCK_TEST_WITH_RETURN(dev, file_priv);
dev_priv = (drm_via_private_t *) dev->dev_private; dev_priv = (drm_via_private_t *) dev->dev_private;
if (dev_priv->ring.virtual_start == NULL) { if (dev_priv->ring.virtual_start == NULL) {
DRM_ERROR("%s called without initializing AGP ring buffer.\n", DRM_ERROR("called without initializing AGP ring buffer.\n");
__FUNCTION__);
return -EFAULT; return -EFAULT;
} }
......
...@@ -169,9 +169,9 @@ int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) ...@@ -169,9 +169,9 @@ int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
unsigned int cur_vblank; unsigned int cur_vblank;
int ret = 0; int ret = 0;
DRM_DEBUG("viadrv_vblank_wait\n"); DRM_DEBUG("\n");
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
...@@ -201,24 +201,23 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc ...@@ -201,24 +201,23 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc
maskarray_t *masks; maskarray_t *masks;
int real_irq; int real_irq;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("called with no initialization\n");
return -EINVAL; return -EINVAL;
} }
if (irq >= drm_via_irq_num) { if (irq >= drm_via_irq_num) {
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, DRM_ERROR("Trying to wait on unknown irq %d\n", irq);
irq);
return -EINVAL; return -EINVAL;
} }
real_irq = dev_priv->irq_map[irq]; real_irq = dev_priv->irq_map[irq];
if (real_irq < 0) { if (real_irq < 0) {
DRM_ERROR("%s Video IRQ %d not available on this hardware.\n", DRM_ERROR("Video IRQ %d not available on this hardware.\n",
__FUNCTION__, irq); irq);
return -EINVAL; return -EINVAL;
} }
...@@ -251,7 +250,7 @@ void via_driver_irq_preinstall(struct drm_device * dev) ...@@ -251,7 +250,7 @@ void via_driver_irq_preinstall(struct drm_device * dev)
drm_via_irq_t *cur_irq; drm_via_irq_t *cur_irq;
int i; int i;
DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv); DRM_DEBUG("dev_priv: %p\n", dev_priv);
if (dev_priv) { if (dev_priv) {
cur_irq = dev_priv->via_irqs; cur_irq = dev_priv->via_irqs;
...@@ -298,7 +297,7 @@ void via_driver_irq_postinstall(struct drm_device * dev) ...@@ -298,7 +297,7 @@ void via_driver_irq_postinstall(struct drm_device * dev)
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
u32 status; u32 status;
DRM_DEBUG("via_driver_irq_postinstall\n"); DRM_DEBUG("\n");
if (dev_priv) { if (dev_priv) {
status = VIA_READ(VIA_REG_INTERRUPT); status = VIA_READ(VIA_REG_INTERRUPT);
VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL
...@@ -317,7 +316,7 @@ void via_driver_irq_uninstall(struct drm_device * dev) ...@@ -317,7 +316,7 @@ void via_driver_irq_uninstall(struct drm_device * dev)
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
u32 status; u32 status;
DRM_DEBUG("driver_irq_uninstall)\n"); DRM_DEBUG("\n");
if (dev_priv) { if (dev_priv) {
/* Some more magic, oh for some data sheets ! */ /* Some more magic, oh for some data sheets ! */
...@@ -344,7 +343,7 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -344,7 +343,7 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv)
return -EINVAL; return -EINVAL;
if (irqwait->request.irq >= dev_priv->num_irqs) { if (irqwait->request.irq >= dev_priv->num_irqs) {
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, DRM_ERROR("Trying to wait on unknown irq %d\n",
irqwait->request.irq); irqwait->request.irq);
return -EINVAL; return -EINVAL;
} }
...@@ -362,8 +361,7 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -362,8 +361,7 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv)
} }
if (irqwait->request.type & VIA_IRQ_SIGNAL) { if (irqwait->request.type & VIA_IRQ_SIGNAL) {
DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n", DRM_ERROR("Signals on Via IRQs not implemented yet.\n");
__FUNCTION__);
return -EINVAL; return -EINVAL;
} }
......
...@@ -29,7 +29,7 @@ static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init) ...@@ -29,7 +29,7 @@ static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init)
{ {
drm_via_private_t *dev_priv = dev->dev_private; drm_via_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
dev_priv->sarea = drm_getsarea(dev); dev_priv->sarea = drm_getsarea(dev);
if (!dev_priv->sarea) { if (!dev_priv->sarea) {
...@@ -79,7 +79,7 @@ int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -79,7 +79,7 @@ int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
drm_via_init_t *init = data; drm_via_init_t *init = data;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
switch (init->func) { switch (init->func) {
case VIA_INIT_MAP: case VIA_INIT_MAP:
...@@ -121,4 +121,3 @@ int via_driver_unload(struct drm_device *dev) ...@@ -121,4 +121,3 @@ int via_driver_unload(struct drm_device *dev)
return 0; return 0;
} }
...@@ -53,7 +53,7 @@ int via_agp_init(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -53,7 +53,7 @@ int via_agp_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
dev_priv->agp_offset = agp->offset; dev_priv->agp_offset = agp->offset;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("offset = %u, size = %u", agp->offset, agp->size); DRM_DEBUG("offset = %u, size = %u\n", agp->offset, agp->size);
return 0; return 0;
} }
...@@ -77,7 +77,7 @@ int via_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -77,7 +77,7 @@ int via_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
dev_priv->vram_offset = fb->offset; dev_priv->vram_offset = fb->offset;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("offset = %u, size = %u", fb->offset, fb->size); DRM_DEBUG("offset = %u, size = %u\n", fb->offset, fb->size);
return 0; return 0;
......
...@@ -33,7 +33,7 @@ void via_init_futex(drm_via_private_t * dev_priv) ...@@ -33,7 +33,7 @@ void via_init_futex(drm_via_private_t * dev_priv)
{ {
unsigned int i; unsigned int i;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) { for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) {
DRM_INIT_WAITQUEUE(&(dev_priv->decoder_queue[i])); DRM_INIT_WAITQUEUE(&(dev_priv->decoder_queue[i]));
...@@ -73,7 +73,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_ ...@@ -73,7 +73,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_
drm_via_sarea_t *sAPriv = dev_priv->sarea_priv; drm_via_sarea_t *sAPriv = dev_priv->sarea_priv;
int ret = 0; int ret = 0;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("\n");
if (fx->lock > VIA_NR_XVMC_LOCKS) if (fx->lock > VIA_NR_XVMC_LOCKS)
return -EFAULT; return -EFAULT;
......
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