diff options
Diffstat (limited to 'drivers/char/drm/radeon_cp.c')
-rw-r--r-- | drivers/char/drm/radeon_cp.c | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index af95b5897a0c..335423c5c186 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1823,24 +1823,20 @@ static int radeon_do_resume_cp(struct drm_device * dev) | |||
1823 | return 0; | 1823 | return 0; |
1824 | } | 1824 | } |
1825 | 1825 | ||
1826 | int radeon_cp_init(DRM_IOCTL_ARGS) | 1826 | int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1827 | { | 1827 | { |
1828 | DRM_DEVICE; | 1828 | drm_radeon_init_t *init = data; |
1829 | drm_radeon_init_t init; | ||
1830 | 1829 | ||
1831 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1830 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1832 | 1831 | ||
1833 | DRM_COPY_FROM_USER_IOCTL(init, (drm_radeon_init_t __user *) data, | 1832 | if (init->func == RADEON_INIT_R300_CP) |
1834 | sizeof(init)); | ||
1835 | |||
1836 | if (init.func == RADEON_INIT_R300_CP) | ||
1837 | r300_init_reg_flags(); | 1833 | r300_init_reg_flags(); |
1838 | 1834 | ||
1839 | switch (init.func) { | 1835 | switch (init->func) { |
1840 | case RADEON_INIT_CP: | 1836 | case RADEON_INIT_CP: |
1841 | case RADEON_INIT_R200_CP: | 1837 | case RADEON_INIT_R200_CP: |
1842 | case RADEON_INIT_R300_CP: | 1838 | case RADEON_INIT_R300_CP: |
1843 | return radeon_do_init_cp(dev, &init); | 1839 | return radeon_do_init_cp(dev, init); |
1844 | case RADEON_CLEANUP_CP: | 1840 | case RADEON_CLEANUP_CP: |
1845 | return radeon_do_cleanup_cp(dev); | 1841 | return radeon_do_cleanup_cp(dev); |
1846 | } | 1842 | } |
@@ -1848,9 +1844,8 @@ int radeon_cp_init(DRM_IOCTL_ARGS) | |||
1848 | return -EINVAL; | 1844 | return -EINVAL; |
1849 | } | 1845 | } |
1850 | 1846 | ||
1851 | int radeon_cp_start(DRM_IOCTL_ARGS) | 1847 | int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1852 | { | 1848 | { |
1853 | DRM_DEVICE; | ||
1854 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1849 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1855 | DRM_DEBUG("\n"); | 1850 | DRM_DEBUG("\n"); |
1856 | 1851 | ||
@@ -1874,33 +1869,29 @@ int radeon_cp_start(DRM_IOCTL_ARGS) | |||
1874 | /* Stop the CP. The engine must have been idled before calling this | 1869 | /* Stop the CP. The engine must have been idled before calling this |
1875 | * routine. | 1870 | * routine. |
1876 | */ | 1871 | */ |
1877 | int radeon_cp_stop(DRM_IOCTL_ARGS) | 1872 | int radeon_cp_stop(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1878 | { | 1873 | { |
1879 | DRM_DEVICE; | ||
1880 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1874 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1881 | drm_radeon_cp_stop_t stop; | 1875 | drm_radeon_cp_stop_t *stop = data; |
1882 | int ret; | 1876 | int ret; |
1883 | DRM_DEBUG("\n"); | 1877 | DRM_DEBUG("\n"); |
1884 | 1878 | ||
1885 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1879 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1886 | 1880 | ||
1887 | DRM_COPY_FROM_USER_IOCTL(stop, (drm_radeon_cp_stop_t __user *) data, | ||
1888 | sizeof(stop)); | ||
1889 | |||
1890 | if (!dev_priv->cp_running) | 1881 | if (!dev_priv->cp_running) |
1891 | return 0; | 1882 | return 0; |
1892 | 1883 | ||
1893 | /* Flush any pending CP commands. This ensures any outstanding | 1884 | /* Flush any pending CP commands. This ensures any outstanding |
1894 | * commands are exectuted by the engine before we turn it off. | 1885 | * commands are exectuted by the engine before we turn it off. |
1895 | */ | 1886 | */ |
1896 | if (stop.flush) { | 1887 | if (stop->flush) { |
1897 | radeon_do_cp_flush(dev_priv); | 1888 | radeon_do_cp_flush(dev_priv); |
1898 | } | 1889 | } |
1899 | 1890 | ||
1900 | /* If we fail to make the engine go idle, we return an error | 1891 | /* If we fail to make the engine go idle, we return an error |
1901 | * code so that the DRM ioctl wrapper can try again. | 1892 | * code so that the DRM ioctl wrapper can try again. |
1902 | */ | 1893 | */ |
1903 | if (stop.idle) { | 1894 | if (stop->idle) { |
1904 | ret = radeon_do_cp_idle(dev_priv); | 1895 | ret = radeon_do_cp_idle(dev_priv); |
1905 | if (ret) | 1896 | if (ret) |
1906 | return ret; | 1897 | return ret; |
@@ -1963,9 +1954,8 @@ void radeon_do_release(struct drm_device * dev) | |||
1963 | 1954 | ||
1964 | /* Just reset the CP ring. Called as part of an X Server engine reset. | 1955 | /* Just reset the CP ring. Called as part of an X Server engine reset. |
1965 | */ | 1956 | */ |
1966 | int radeon_cp_reset(DRM_IOCTL_ARGS) | 1957 | int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1967 | { | 1958 | { |
1968 | DRM_DEVICE; | ||
1969 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1959 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1970 | DRM_DEBUG("\n"); | 1960 | DRM_DEBUG("\n"); |
1971 | 1961 | ||
@@ -1984,9 +1974,8 @@ int radeon_cp_reset(DRM_IOCTL_ARGS) | |||
1984 | return 0; | 1974 | return 0; |
1985 | } | 1975 | } |
1986 | 1976 | ||
1987 | int radeon_cp_idle(DRM_IOCTL_ARGS) | 1977 | int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1988 | { | 1978 | { |
1989 | DRM_DEVICE; | ||
1990 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1979 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1991 | DRM_DEBUG("\n"); | 1980 | DRM_DEBUG("\n"); |
1992 | 1981 | ||
@@ -1997,16 +1986,14 @@ int radeon_cp_idle(DRM_IOCTL_ARGS) | |||
1997 | 1986 | ||
1998 | /* Added by Charl P. Botha to call radeon_do_resume_cp(). | 1987 | /* Added by Charl P. Botha to call radeon_do_resume_cp(). |
1999 | */ | 1988 | */ |
2000 | int radeon_cp_resume(DRM_IOCTL_ARGS) | 1989 | int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv) |
2001 | { | 1990 | { |
2002 | DRM_DEVICE; | ||
2003 | 1991 | ||
2004 | return radeon_do_resume_cp(dev); | 1992 | return radeon_do_resume_cp(dev); |
2005 | } | 1993 | } |
2006 | 1994 | ||
2007 | int radeon_engine_reset(DRM_IOCTL_ARGS) | 1995 | int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) |
2008 | { | 1996 | { |
2009 | DRM_DEVICE; | ||
2010 | DRM_DEBUG("\n"); | 1997 | DRM_DEBUG("\n"); |
2011 | 1998 | ||
2012 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1999 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
@@ -2020,7 +2007,7 @@ int radeon_engine_reset(DRM_IOCTL_ARGS) | |||
2020 | 2007 | ||
2021 | /* KW: Deprecated to say the least: | 2008 | /* KW: Deprecated to say the least: |
2022 | */ | 2009 | */ |
2023 | int radeon_fullscreen(DRM_IOCTL_ARGS) | 2010 | int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv) |
2024 | { | 2011 | { |
2025 | return 0; | 2012 | return 0; |
2026 | } | 2013 | } |
@@ -2198,42 +2185,36 @@ static int radeon_cp_get_buffers(struct drm_device *dev, | |||
2198 | return 0; | 2185 | return 0; |
2199 | } | 2186 | } |
2200 | 2187 | ||
2201 | int radeon_cp_buffers(DRM_IOCTL_ARGS) | 2188 | int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv) |
2202 | { | 2189 | { |
2203 | DRM_DEVICE; | ||
2204 | struct drm_device_dma *dma = dev->dma; | 2190 | struct drm_device_dma *dma = dev->dma; |
2205 | int ret = 0; | 2191 | int ret = 0; |
2206 | struct drm_dma __user *argp = (void __user *)data; | 2192 | struct drm_dma *d = data; |
2207 | struct drm_dma d; | ||
2208 | 2193 | ||
2209 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 2194 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
2210 | 2195 | ||
2211 | DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d)); | ||
2212 | |||
2213 | /* Please don't send us buffers. | 2196 | /* Please don't send us buffers. |
2214 | */ | 2197 | */ |
2215 | if (d.send_count != 0) { | 2198 | if (d->send_count != 0) { |
2216 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", | 2199 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
2217 | DRM_CURRENTPID, d.send_count); | 2200 | DRM_CURRENTPID, d->send_count); |
2218 | return -EINVAL; | 2201 | return -EINVAL; |
2219 | } | 2202 | } |
2220 | 2203 | ||
2221 | /* We'll send you buffers. | 2204 | /* We'll send you buffers. |
2222 | */ | 2205 | */ |
2223 | if (d.request_count < 0 || d.request_count > dma->buf_count) { | 2206 | if (d->request_count < 0 || d->request_count > dma->buf_count) { |
2224 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", | 2207 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
2225 | DRM_CURRENTPID, d.request_count, dma->buf_count); | 2208 | DRM_CURRENTPID, d->request_count, dma->buf_count); |
2226 | return -EINVAL; | 2209 | return -EINVAL; |
2227 | } | 2210 | } |
2228 | 2211 | ||
2229 | d.granted_count = 0; | 2212 | d->granted_count = 0; |
2230 | 2213 | ||
2231 | if (d.request_count) { | 2214 | if (d->request_count) { |
2232 | ret = radeon_cp_get_buffers(dev, file_priv, &d); | 2215 | ret = radeon_cp_get_buffers(dev, file_priv, d); |
2233 | } | 2216 | } |
2234 | 2217 | ||
2235 | DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d)); | ||
2236 | |||
2237 | return ret; | 2218 | return ret; |
2238 | } | 2219 | } |
2239 | 2220 | ||