From cb5aaa89871c051098ae8067d0e386840b7bdc59 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Nov 2004 23:02:07 +0000 Subject: Convert more drivers for bsd-core, moving the ioctl definitions to shared code. Remove the "drv" from sisdrv, as it's unnecessary. Use the drm_pci functions in i915 instead of per-os implementations of the same. Avoid whitespace within fields in drm_pciids.txt (one of the r300 definitions), since it breaks the bsd pciids script. Tested on sis, mga, r128. i915 needs more work. --- linux-core/i915_drv.c | 20 ++++---------------- linux-core/mach64_drv.c | 22 ++++------------------ linux-core/mga_drv.c | 18 ++++-------------- linux-core/sis_drv.c | 16 +++++----------- 4 files changed, 17 insertions(+), 59 deletions(-) (limited to 'linux-core') diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c index f0298e17..32694fc3 100644 --- a/linux-core/i915_drv.c +++ b/linux-core/i915_drv.c @@ -50,20 +50,8 @@ static struct pci_device_id pciidlist[] = { i915_PCI_IDS }; -static drm_ioctl_desc_t ioctls[] = { - [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1}, - [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1}, - [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0}, - [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1}, - [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} -}; +extern drm_ioctl_desc_t i915_ioctls[]; +extern int i915_max_ioctl; static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { @@ -81,8 +69,8 @@ static struct drm_driver driver = { .get_reg_ofs = drm_core_get_reg_ofs, .postinit = postinit, .version = version, - .ioctls = ioctls, - .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .ioctls = i915_ioctls, + .num_ioctls = i915_max_ioctl, .fops = { .owner = THIS_MODULE, .open = drm_open, diff --git a/linux-core/mach64_drv.c b/linux-core/mach64_drv.c index 3f736aa3..17ba250c 100644 --- a/linux-core/mach64_drv.c +++ b/linux-core/mach64_drv.c @@ -64,22 +64,8 @@ static struct pci_device_id pciidlist[] = { mach64_PCI_IDS }; -/* Interface history: - * - * 1.0 - Initial mach64 DRM - * - */ -static drm_ioctl_desc_t ioctls[] = { - [DRM_IOCTL_NR(DRM_MACH64_INIT)] = {mach64_dma_init, 1, 1}, - [DRM_IOCTL_NR(DRM_MACH64_CLEAR)] = {mach64_dma_clear, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_SWAP)] = {mach64_dma_swap, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_IDLE)] = {mach64_dma_idle, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_RESET)] = {mach64_engine_reset, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_VERTEX)] = {mach64_dma_vertex, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_BLIT)] = {mach64_dma_blit, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_FLUSH)] = {mach64_dma_flush, 1, 0}, - [DRM_IOCTL_NR(DRM_MACH64_GETPARAM)] = {mach64_get_param, 1, 0}, -}; +extern drm_ioctl_desc_t mach64_ioctls[]; +extern int mach64_max_ioctl; static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { @@ -97,8 +83,8 @@ static struct drm_driver driver = { .get_reg_ofs = drm_core_get_reg_ofs, .postinit = postinit, .version = version, - .ioctls = ioctls, - .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .ioctls = mach64_ioctls, + .num_ioctls = mach64_max_ioctl, .dma_ioctl = mach64_dma_buffers, .fops = { .owner = THIS_MODULE, diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index 65e9d9c1..7cd31ad9 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -71,18 +71,8 @@ static struct pci_device_id pciidlist[] = { mga_PCI_IDS }; -static drm_ioctl_desc_t ioctls[] = { - [DRM_IOCTL_NR(DRM_MGA_INIT)] = {mga_dma_init, 1, 1}, - [DRM_IOCTL_NR(DRM_MGA_FLUSH)] = {mga_dma_flush, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_RESET)] = {mga_dma_reset, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_SWAP)] = {mga_dma_swap, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_CLEAR)] = {mga_dma_clear, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_VERTEX)] = {mga_dma_vertex, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_INDICES)] = {mga_dma_indices, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_ILOAD)] = {mga_dma_iload, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_BLIT)] = {mga_dma_blit, 1, 0}, - [DRM_IOCTL_NR(DRM_MGA_GETPARAM)] = {mga_getparam, 1, 0}, -}; +extern drm_ioctl_desc_t mga_ioctls[]; +extern int mga_max_ioctl; static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { @@ -102,8 +92,8 @@ static struct drm_driver driver = { .get_reg_ofs = drm_core_get_reg_ofs, .postinit = postinit, .version = version, - .ioctls = ioctls, - .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .ioctls = mga_ioctls, + .num_ioctls = mga_max_ioctl, .dma_ioctl = mga_dma_buffers, .fops = { .owner = THIS_MODULE, diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c index a6300509..70dd10e7 100644 --- a/linux-core/sis_drv.c +++ b/linux-core/sis_drv.c @@ -58,17 +58,11 @@ static int version(drm_version_t * version) } static struct pci_device_id pciidlist[] = { - sisdrv_PCI_IDS + sis_PCI_IDS }; -static drm_ioctl_desc_t ioctls[] = { - [DRM_IOCTL_NR(DRM_SIS_FB_ALLOC)] = {sis_fb_alloc, 1, 0}, - [DRM_IOCTL_NR(DRM_SIS_FB_FREE)] = {sis_fb_free, 1, 0}, - [DRM_IOCTL_NR(DRM_SIS_AGP_INIT)] = {sis_ioctl_agp_init, 1, 1}, - [DRM_IOCTL_NR(DRM_SIS_AGP_ALLOC)] = {sis_ioctl_agp_alloc, 1, 0}, - [DRM_IOCTL_NR(DRM_SIS_AGP_FREE)] = {sis_ioctl_agp_free, 1, 0}, - [DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, 1, 1} -}; +extern drm_ioctl_desc_t sis_ioctls[]; +extern int sis_max_ioctl; static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { @@ -80,8 +74,8 @@ static struct drm_driver driver = { .get_reg_ofs = drm_core_get_reg_ofs, .postinit = postinit, .version = version, - .ioctls = ioctls, - .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .ioctls = sis_ioctls, + .num_ioctls = sis_max_ioctl, .fops = { .owner = THIS_MODULE, .open = drm_open, -- cgit v1.2.3