Convert more drivers for bsd-core, moving the ioctl definitions to shared
authorEric Anholt <anholt@freebsd.org>
Sat, 6 Nov 2004 23:02:07 +0000 (23:02 +0000)
committerEric Anholt <anholt@freebsd.org>
Sat, 6 Nov 2004 23:02:07 +0000 (23:02 +0000)
    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.

17 files changed:
bsd-core/Makefile
bsd-core/i915_drv.c
bsd-core/mach64_drv.c
bsd-core/mga_drv.c
bsd-core/r128_drv.c
bsd-core/radeon_drv.c
bsd-core/sis_drv.c
bsd-core/tdfx_drv.c
linux-core/i915_drv.c
linux-core/mach64_drv.c
linux-core/mga_drv.c
linux-core/sis_drv.c
shared-core/drm_pciids.txt
shared-core/i915_dma.c
shared-core/mach64_state.c
shared-core/mga_state.c
shared-core/sis_mm.c

index 81b1247..604c86f 100644 (file)
@@ -40,7 +40,7 @@ SHAREDFILES=  drm.h \
                sis_ds.c \
                sis_ds.h \
                sis_mm.c \
-               tdfx.h \
+               tdfx_drv.h \
                via.h \
                via_drm.h \
                via_drv.c \
index 15ef406..9729f05 100644 (file)
  *
  */
 
-#define DRM_DEV_NAME "drmsub"
-
-#include "i915.h"
 #include "drmP.h"
 #include "drm.h"
 #include "i915_drm.h"
 #include "i915_drv.h"
+#include "drm_pciids.h"
+
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t i915_pciidlist[] = {
+       i915_PCI_IDS
+};
+
+extern drm_ioctl_desc_t i915_ioctls[];
+extern int i915_max_ioctl;
+
+static void i915_configure(drm_device_t *dev)
+{
+       dev->dev_priv_size = 1; /* No dev_priv */
+       dev->prerelease = i915_driver_prerelease;
+       dev->pretakedown = i915_driver_pretakedown;
+       dev->irq_preinstall = i915_driver_irq_preinstall;
+       dev->irq_postinstall = i915_driver_irq_postinstall;
+       dev->irq_uninstall = i915_driver_irq_uninstall;
+       dev->irq_handler = i915_driver_irq_handler;
 
-#include "drm_agpsupport.h"
-#include "drm_auth.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_pci.h"
-#include "drm_vm.h"
-#include "drm_sysctl.h"
+       dev->driver_ioctls = i915_ioctls;
+       dev->max_driver_ioctl = i915_max_ioctl;
+
+       dev->driver_name = DRIVER_NAME;
+       dev->driver_desc = DRIVER_DESC;
+       dev->driver_date = DRIVER_DATE;
+       dev->driver_major = DRIVER_MAJOR;
+       dev->driver_minor = DRIVER_MINOR;
+       dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+
+       dev->use_agp = 1;
+       dev->require_agp = 1;
+       dev->use_mtrr = 1;
+       dev->use_irq = 1;
+}
 
 #ifdef __FreeBSD__
-DRIVER_MODULE(DRIVER_NAME, agp, DRM(driver), DRM(devclass), 0, 0);
-#elif defined(__NetBSD__)
+static int
+i915_probe(device_t dev)
+{
+       return drm_probe(dev, i915_pciidlist);
+}
+
+static int
+i915_attach(device_t nbdev)
+{
+       drm_device_t *dev = device_get_softc(nbdev);
+
+       bzero(dev, sizeof(drm_device_t));
+       i915_configure(dev);
+       return drm_attach(nbdev, i915_pciidlist);
+}
+
+static device_method_t i915_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         i915_probe),
+       DEVMETHOD(device_attach,        i915_attach),
+       DEVMETHOD(device_detach,        drm_detach),
+
+       { 0, 0 }
+};
+
+static driver_t i915_driver = {
+       "drmsub",
+       i915_methods,
+       sizeof(drm_device_t)
+};
+
+extern devclass_t drm_devclass;
+DRIVER_MODULE(i915, pci, i915_driver, drm_devclass, 0, 0);
+MODULE_DEPEND(i915, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
 CFDRIVER_DECL(i915, DV_TTY, NULL);
-#endif /* __FreeBSD__ */
+#endif
index 07fc84a..32e2ec6 100644 (file)
@@ -1,4 +1,4 @@
-/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*-
+/* mach64_drv.c -- ATI Rage 128 driver -*- linux-c -*-
  * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
 
 #include <sys/types.h>
 
-#include "mach64.h"
 #include "drmP.h"
 #include "drm.h"
 #include "mach64_drm.h"
 #include "mach64_drv.h"
+#include "drm_pciids.h"
 
-#include "drm_agpsupport.h"
-#include "drm_auth.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_pci.h"
-#include "drm_sysctl.h"
-#include "drm_vm.h"
-
-DRIVER_MODULE(mach64, pci, mach64_driver, mach64_devclass, 0, 0);
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t mach64_pciidlist[] = {
+       mach64_PCI_IDS
+};
+
+extern drm_ioctl_desc_t mach64_ioctls[];
+extern int mach64_max_ioctl;
+
+static void mach64_configure(drm_device_t *dev)
+{
+       dev->dev_priv_size = 1; /* No dev_priv */
+       dev->pretakedown = mach64_driver_pretakedown;
+       dev->vblank_wait = mach64_driver_vblank_wait;
+       dev->irq_preinstall = mach64_driver_irq_preinstall;
+       dev->irq_postinstall = mach64_driver_irq_postinstall;
+       dev->irq_uninstall = mach64_driver_irq_uninstall;
+       dev->irq_handler = mach64_driver_irq_handler;
+       dev->dma_ioctl = mach64_dma_buffers;
+
+       dev->driver_ioctls = mach64_ioctls;
+       dev->max_driver_ioctl = mach64_max_ioctl;
+
+       dev->driver_name = DRIVER_NAME;
+       dev->driver_desc = DRIVER_DESC;
+       dev->driver_date = DRIVER_DATE;
+       dev->driver_major = DRIVER_MAJOR;
+       dev->driver_minor = DRIVER_MINOR;
+       dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+
+       dev->use_agp = 1;
+       dev->use_mtrr = 1;
+       dev->use_pci_dma = 1;
+       dev->use_dma = 1;
+       dev->use_irq = 1;
+       dev->use_vbl_irq = 1;
+}
+
+#ifdef __FreeBSD__
+static int
+mach64_probe(device_t dev)
+{
+       return drm_probe(dev, mach64_pciidlist);
+}
+
+static int
+mach64_attach(device_t nbdev)
+{
+       drm_device_t *dev = device_get_softc(nbdev);
+
+       bzero(dev, sizeof(drm_device_t));
+       mach64_configure(dev);
+       return drm_attach(nbdev, mach64_pciidlist);
+}
+
+static device_method_t mach64_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         mach64_probe),
+       DEVMETHOD(device_attach,        mach64_attach),
+       DEVMETHOD(device_detach,        drm_detach),
+
+       { 0, 0 }
+};
+
+static driver_t mach64_driver = {
+       "drm",
+       mach64_methods,
+       sizeof(drm_device_t)
+};
+
+extern devclass_t drm_devclass;
+DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
+MODULE_DEPEND(mach64, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+CFDRIVER_DECL(mach64, DV_TTY, NULL);
+#endif
index 477086e..5d148a9 100644 (file)
  *
  */
 
-#include "mga.h"
 #include "drmP.h"
 #include "drm.h"
 #include "mga_drm.h"
 #include "mga_drv.h"
+#include "drm_pciids.h"
 
-#include "drm_agpsupport.h"
-#include "drm_auth.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_ioctl.h"
-#include "drm_irq.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_vm.h"
-#include "drm_sysctl.h"
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t mga_pciidlist[] = {
+       mga_PCI_IDS
+};
+
+extern drm_ioctl_desc_t mga_ioctls[];
+extern int mga_max_ioctl;
+
+static void mga_configure(drm_device_t *dev)
+{
+       dev->dev_priv_size = sizeof(drm_mga_buf_priv_t);
+       /* XXX dev->prerelease = mga_driver_prerelease; */
+       dev->pretakedown = mga_driver_pretakedown;
+       dev->vblank_wait = mga_driver_vblank_wait;
+       dev->irq_preinstall = mga_driver_irq_preinstall;
+       dev->irq_postinstall = mga_driver_irq_postinstall;
+       dev->irq_uninstall = mga_driver_irq_uninstall;
+       dev->irq_handler = mga_driver_irq_handler;
+       dev->dma_ioctl = mga_dma_buffers;
+       dev->dma_quiescent = mga_driver_dma_quiescent;
+
+       dev->driver_ioctls = mga_ioctls;
+       dev->max_driver_ioctl = mga_max_ioctl;
+
+       dev->driver_name = DRIVER_NAME;
+       dev->driver_desc = DRIVER_DESC;
+       dev->driver_date = DRIVER_DATE;
+       dev->driver_major = DRIVER_MAJOR;
+       dev->driver_minor = DRIVER_MINOR;
+       dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+
+       dev->use_agp = 1;
+       dev->require_agp = 1;
+       dev->use_mtrr = 1;
+       dev->use_dma = 1;
+       dev->use_irq = 1;
+       dev->use_vbl_irq = 1;
+}
 
 #ifdef __FreeBSD__
-DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
-#elif defined(__NetBSD__)
+static int
+mga_probe(device_t dev)
+{
+       return drm_probe(dev, mga_pciidlist);
+}
+
+static int
+mga_attach(device_t nbdev)
+{
+       drm_device_t *dev = device_get_softc(nbdev);
+
+       bzero(dev, sizeof(drm_device_t));
+       mga_configure(dev);
+       return drm_attach(nbdev, mga_pciidlist);
+}
+
+static device_method_t mga_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         mga_probe),
+       DEVMETHOD(device_attach,        mga_attach),
+       DEVMETHOD(device_detach,        drm_detach),
+
+       { 0, 0 }
+};
+
+static driver_t mga_driver = {
+       "drm",
+       mga_methods,
+       sizeof(drm_device_t)
+};
+
+extern devclass_t drm_devclass;
+DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
+MODULE_DEPEND(mga, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
 CFDRIVER_DECL(mga, DV_TTY, NULL);
 #endif
index 03bf1b5..f101279 100644 (file)
@@ -111,6 +111,6 @@ extern devclass_t drm_devclass;
 DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
 MODULE_DEPEND(r128, drm, 1, 1, 1);
 
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
 CFDRIVER_DECL(r128, DV_TTY, NULL);
 #endif
index 1c2722c..57ab3b9 100644 (file)
@@ -109,6 +109,6 @@ extern devclass_t drm_devclass;
 DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
 MODULE_DEPEND(radeon, drm, 1, 1, 1);
 
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
 CFDRIVER_DECL(radeon, DV_TTY, NULL);
 #endif /* __FreeBSD__ */
index 2d40018..10eca39 100644 (file)
  *
  */
 
-#include "sis.h"
 #include "drmP.h"
 #include "sis_drm.h"
 #include "sis_drv.h"
+#include "drm_pciids.h"
 
-#include "drm_auth.h"
-#include "drm_agpsupport.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_vm.h"
-#include "drm_sysctl.h"
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t sis_pciidlist[] = {
+       sis_PCI_IDS
+};
+
+extern drm_ioctl_desc_t sis_ioctls[];
+extern int sis_max_ioctl;
+
+static void sis_configure(drm_device_t *dev)
+{
+       dev->dev_priv_size = 1; /* No dev_priv */
+       dev->context_ctor = sis_init_context;
+       dev->context_dtor = sis_final_context;
+
+       dev->driver_ioctls = sis_ioctls;
+       dev->max_driver_ioctl = sis_max_ioctl;
+
+       dev->driver_name = DRIVER_NAME;
+       dev->driver_desc = DRIVER_DESC;
+       dev->driver_date = DRIVER_DATE;
+       dev->driver_major = DRIVER_MAJOR;
+       dev->driver_minor = DRIVER_MINOR;
+       dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+
+       dev->use_agp = 1;
+       dev->use_mtrr = 1;
+}
 
 #ifdef __FreeBSD__
-/* Avoid clash with sis ethernet */
-DRIVER_MODULE(sisdrm, pci, sisdrv_driver, sisdrv_devclass, 0, 0);
-#elif defined(__NetBSD__)
-CFDRIVER_DECL(sis, DV_TTY, NULL);
-#endif /* __FreeBSD__ */
+static int
+sis_probe(device_t dev)
+{
+       return drm_probe(dev, sis_pciidlist);
+}
+
+static int
+sis_attach(device_t nbdev)
+{
+       drm_device_t *dev = device_get_softc(nbdev);
 
+       bzero(dev, sizeof(drm_device_t));
+       sis_configure(dev);
+       return drm_attach(nbdev, sis_pciidlist);
+}
+
+static device_method_t sis_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         sis_probe),
+       DEVMETHOD(device_attach,        sis_attach),
+       DEVMETHOD(device_detach,        drm_detach),
+
+       { 0, 0 }
+};
+
+static driver_t sis_driver = {
+       "drm",
+       sis_methods,
+       sizeof(drm_device_t)
+};
+
+extern devclass_t drm_devclass;
+DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
+MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+CFDRIVER_DECL(sis, DV_TTY, NULL);
+#endif
index bc038cc..434fc42 100644 (file)
  *
  */
 
-#include "tdfx.h"
+#include "tdfx_drv.h"
 #include "drmP.h"
+#include "drm_pciids.h"
 
-#include "drm_auth.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_ioctl.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_vm.h"
-#include "drm_sysctl.h"
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t tdfx_pciidlist[] = {
+       tdfx_PCI_IDS
+};
+
+extern drm_ioctl_desc_t tdfx_ioctls[];
+extern int tdfx_max_ioctl;
+
+static void tdfx_configure(drm_device_t *dev)
+{
+       dev->dev_priv_size = 1; /* No dev_priv */
+
+       dev->max_driver_ioctl = 0;
+
+       dev->driver_name = DRIVER_NAME;
+       dev->driver_desc = DRIVER_DESC;
+       dev->driver_date = DRIVER_DATE;
+       dev->driver_major = DRIVER_MAJOR;
+       dev->driver_minor = DRIVER_MINOR;
+       dev->driver_patchlevel = DRIVER_PATCHLEVEL;
+
+       dev->use_mtrr = 1;
+}
 
 #ifdef __FreeBSD__
-DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
-#elif defined(__NetBSD__)
-CFDRIVER_DECL(tdfx, DV_TTY, NULL);
-#endif /* __FreeBSD__ */
+static int
+tdfx_probe(device_t dev)
+{
+       return drm_probe(dev, tdfx_pciidlist);
+}
 
-void DRM(driver_register_fns)(drm_device_t *dev)
+static int
+tdfx_attach(device_t nbdev)
 {
+       drm_device_t *dev = device_get_softc(nbdev);
+
+       bzero(dev, sizeof(drm_device_t));
+       tdfx_configure(dev);
+       return drm_attach(nbdev, tdfx_pciidlist);
 }
+
+static device_method_t tdfx_methods[] = {
+       /* Device interface */
+       DEVMETHOD(device_probe,         tdfx_probe),
+       DEVMETHOD(device_attach,        tdfx_attach),
+       DEVMETHOD(device_detach,        drm_detach),
+
+       { 0, 0 }
+};
+
+static driver_t tdfx_driver = {
+       "drm",
+       tdfx_methods,
+       sizeof(drm_device_t)
+};
+
+extern devclass_t drm_devclass;
+DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
+MODULE_DEPEND(tdfx, drm, 1, 1, 1);
+
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+CFDRIVER_DECL(tdfx, DV_TTY, NULL);
+#endif
index f0298e1..32694fc 100644 (file)
@@ -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,
index 3f736aa..17ba250 100644 (file)
@@ -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,
index 65e9d9c..7cd31ad 100644 (file)
@@ -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,
index a630050..70dd10e 100644 (file)
@@ -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,
index 0ec9e7e..11fcb39 100644 (file)
@@ -19,7 +19,7 @@
 0x1002 0x4C65 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Le R250 Mobility 9000 M9"
 0x1002 0x4C66 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Lf R250 Mobility 9000 M9"
 0x1002 0x4C67 CHIP_R250|CHIP_IS_MOBILITY "ATI Radeon Lg R250 Mobility 9000 M9"
-0x1002 0x4E50 CHIP_RV350 | CHIP_IS_MOBILITY "ATI Radeon RV300 Mobility 9600 M10"
+0x1002 0x4E50 CHIP_RV350|CHIP_IS_MOBILITY "ATI Radeon RV300 Mobility 9600 M10"
 0x1002 0x5144 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QD R100"
 0x1002 0x5145 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QE R100"
 0x1002 0x5146 CHIP_R100|CHIP_SINGLE_CRTC "ATI Radeon QF R100"
 0x1002 0x4c4d 0 "Rage Mobility P/M AGP 2X"
 0x1002 0x4c4e 0 "Rage Mobility L AGP 2X"
 
-[sisdrv]
+[sis]
 0x1039 0x0300 0 "SiS 300/305"
 0x1039 0x5300 0 "SiS 540"
 0x1039 0x6300 0 "SiS 630"
index 1c52496..c46ef9d 100644 (file)
 #include "i915_drm.h"
 #include "i915_drv.h"
 
+drm_ioctl_desc_t i915_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}
+};
+
+int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
+
 static inline void i915_print_status_page(drm_device_t * dev)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
@@ -94,15 +111,8 @@ int i915_dma_cleanup(drm_device_t * dev)
                }
 
                if (dev_priv->hw_status_page) {
-#ifdef __FreeBSD__
-#if __FreeBSD_version > 500000
-                       contigfree(dev_priv->hw_status_page, PAGE_SIZE, M_DRM);
-#endif
-#else
-                       pci_free_consistent(dev->pdev, PAGE_SIZE,
-                                           dev_priv->hw_status_page,
-                                           dev_priv->dma_status_page);
-#endif
+                       drm_pci_free(dev, PAGE_SIZE, dev_priv->hw_status_page,
+                                    dev_priv->dma_status_page);
                        /* Need to rewrite hardware status page */
                        I915_WRITE(0x02080, 0x1ffff000);
                }
@@ -179,15 +189,8 @@ static int i915_initialize(drm_device_t * dev,
        dev_priv->allow_batchbuffer = 1;
 
        /* Program Hardware Status Page */
-#ifdef __FreeBSD__
-       dev_priv->hw_status_page =
-           contigmalloc(PAGE_SIZE, M_DRM, M_NOWAIT, 0ul, 0, 0, 0);
-       dev_priv->dma_status_page = vtophys(dev_priv->hw_status_page);
-#else
-       dev_priv->hw_status_page =
-           pci_alloc_consistent(dev->pdev, PAGE_SIZE,
-                                &dev_priv->dma_status_page);
-#endif
+       dev_priv->hw_status_page = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 
+           0xffffffff, &dev_priv->dma_status_page);
 
        if (!dev_priv->hw_status_page) {
                dev->dev_private = (void *)dev_priv;
index 2d3c4f6..dbd38c8 100644 (file)
 #include "mach64_drm.h"
 #include "mach64_drv.h"
 
+/* Interface history:
+ *
+ * 1.0 - Initial mach64 DRM
+ *
+ */
+drm_ioctl_desc_t mach64_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},
+};
+
+int mach64_max_ioctl = DRM_ARRAY_SIZE(mach64_ioctls);
+
 /* ================================================================
  * DMA hardware state programming functions
  */
index 558beed..b529f6c 100644 (file)
 #include "mga_drm.h"
 #include "mga_drv.h"
 
+drm_ioctl_desc_t mga_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},
+};
+
+int mga_max_ioctl = DRM_ARRAY_SIZE(mga_ioctls);
+
 /* ================================================================
  * DMA hardware state programming functions
  */
index 7b0a2a4..497f202 100644 (file)
 #include "sis_drv.h"
 #include "sis_ds.h"
 
+drm_ioctl_desc_t sis_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}
+};
+
+int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls);
+
 #define MAX_CONTEXT 100
 #define VIDEO_TYPE 0
 #define AGP_TYPE 1