| .. | .. |
|---|
| 29 | 29 | * Gareth Hughes <gareth@valinux.com> |
|---|
| 30 | 30 | */ |
|---|
| 31 | 31 | |
|---|
| 32 | +#include <linux/delay.h> |
|---|
| 33 | +#include <linux/dma-mapping.h> |
|---|
| 32 | 34 | #include <linux/firmware.h> |
|---|
| 35 | +#include <linux/module.h> |
|---|
| 33 | 36 | #include <linux/platform_device.h> |
|---|
| 34 | 37 | #include <linux/slab.h> |
|---|
| 35 | | -#include <linux/module.h> |
|---|
| 38 | +#include <linux/uaccess.h> |
|---|
| 36 | 39 | |
|---|
| 37 | | -#include <drm/drmP.h> |
|---|
| 40 | +#include <drm/drm_agpsupport.h> |
|---|
| 41 | +#include <drm/drm_device.h> |
|---|
| 42 | +#include <drm/drm_file.h> |
|---|
| 43 | +#include <drm/drm_irq.h> |
|---|
| 44 | +#include <drm/drm_print.h> |
|---|
| 38 | 45 | #include <drm/r128_drm.h> |
|---|
| 46 | + |
|---|
| 39 | 47 | #include "r128_drv.h" |
|---|
| 40 | 48 | |
|---|
| 41 | 49 | #define R128_FIFO_DEBUG 0 |
|---|
| .. | .. |
|---|
| 85 | 93 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
|---|
| 86 | 94 | if (!(R128_READ(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY)) |
|---|
| 87 | 95 | return 0; |
|---|
| 88 | | - DRM_UDELAY(1); |
|---|
| 96 | + udelay(1); |
|---|
| 89 | 97 | } |
|---|
| 90 | 98 | |
|---|
| 91 | 99 | #if R128_FIFO_DEBUG |
|---|
| .. | .. |
|---|
| 102 | 110 | int slots = R128_READ(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK; |
|---|
| 103 | 111 | if (slots >= entries) |
|---|
| 104 | 112 | return 0; |
|---|
| 105 | | - DRM_UDELAY(1); |
|---|
| 113 | + udelay(1); |
|---|
| 106 | 114 | } |
|---|
| 107 | 115 | |
|---|
| 108 | 116 | #if R128_FIFO_DEBUG |
|---|
| .. | .. |
|---|
| 124 | 132 | r128_do_pixcache_flush(dev_priv); |
|---|
| 125 | 133 | return 0; |
|---|
| 126 | 134 | } |
|---|
| 127 | | - DRM_UDELAY(1); |
|---|
| 135 | + udelay(1); |
|---|
| 128 | 136 | } |
|---|
| 129 | 137 | |
|---|
| 130 | 138 | #if R128_FIFO_DEBUG |
|---|
| .. | .. |
|---|
| 211 | 219 | return r128_do_pixcache_flush(dev_priv); |
|---|
| 212 | 220 | } |
|---|
| 213 | 221 | } |
|---|
| 214 | | - DRM_UDELAY(1); |
|---|
| 222 | + udelay(1); |
|---|
| 215 | 223 | } |
|---|
| 216 | 224 | |
|---|
| 217 | 225 | #if R128_FIFO_DEBUG |
|---|
| .. | .. |
|---|
| 560 | 568 | dev_priv->gart_info.addr = NULL; |
|---|
| 561 | 569 | dev_priv->gart_info.bus_addr = 0; |
|---|
| 562 | 570 | dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCI; |
|---|
| 563 | | - if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { |
|---|
| 571 | + rc = drm_ati_pcigart_init(dev, &dev_priv->gart_info); |
|---|
| 572 | + if (rc) { |
|---|
| 564 | 573 | DRM_ERROR("failed to init PCI GART!\n"); |
|---|
| 565 | 574 | dev->dev_private = (void *)dev_priv; |
|---|
| 566 | 575 | r128_do_cleanup_cce(dev); |
|---|
| 567 | | - return -ENOMEM; |
|---|
| 576 | + return rc; |
|---|
| 568 | 577 | } |
|---|
| 569 | 578 | R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); |
|---|
| 570 | 579 | #if IS_ENABLED(CONFIG_AGP) |
|---|
| .. | .. |
|---|
| 837 | 846 | return buf; |
|---|
| 838 | 847 | } |
|---|
| 839 | 848 | } |
|---|
| 840 | | - DRM_UDELAY(1); |
|---|
| 849 | + udelay(1); |
|---|
| 841 | 850 | } |
|---|
| 842 | 851 | |
|---|
| 843 | 852 | DRM_DEBUG("returning NULL!\n"); |
|---|
| .. | .. |
|---|
| 869 | 878 | r128_update_ring_snapshot(dev_priv); |
|---|
| 870 | 879 | if (ring->space >= n) |
|---|
| 871 | 880 | return 0; |
|---|
| 872 | | - DRM_UDELAY(1); |
|---|
| 881 | + udelay(1); |
|---|
| 873 | 882 | } |
|---|
| 874 | 883 | |
|---|
| 875 | 884 | /* FIXME: This is being ignored... */ |
|---|
| .. | .. |
|---|
| 915 | 924 | */ |
|---|
| 916 | 925 | if (d->send_count != 0) { |
|---|
| 917 | 926 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
|---|
| 918 | | - DRM_CURRENTPID, d->send_count); |
|---|
| 927 | + task_pid_nr(current), d->send_count); |
|---|
| 919 | 928 | return -EINVAL; |
|---|
| 920 | 929 | } |
|---|
| 921 | 930 | |
|---|
| .. | .. |
|---|
| 923 | 932 | */ |
|---|
| 924 | 933 | if (d->request_count < 0 || d->request_count > dma->buf_count) { |
|---|
| 925 | 934 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
|---|
| 926 | | - DRM_CURRENTPID, d->request_count, dma->buf_count); |
|---|
| 935 | + task_pid_nr(current), d->request_count, dma->buf_count); |
|---|
| 927 | 936 | return -EINVAL; |
|---|
| 928 | 937 | } |
|---|
| 929 | 938 | |
|---|