summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/Makefile2
-rw-r--r--bsd-core/i915_drv.c92
-rw-r--r--bsd-core/mach64_drv.c97
-rw-r--r--bsd-core/mga_drv.c92
-rw-r--r--bsd-core/r128_drv.c2
-rw-r--r--bsd-core/radeon_drv.c2
-rw-r--r--bsd-core/sis_drv.c84
-rw-r--r--bsd-core/tdfx_drv.c78
8 files changed, 352 insertions, 97 deletions
diff --git a/bsd-core/Makefile b/bsd-core/Makefile
index 81b12477..604c86fb 100644
--- a/bsd-core/Makefile
+++ b/bsd-core/Makefile
@@ -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 \
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index 15ef406c..9729f05c 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -28,32 +28,82 @@
*
*/
-#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
diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c
index 07fc84af..32e2ec60 100644
--- a/bsd-core/mach64_drv.c
+++ b/bsd-core/mach64_drv.c
@@ -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.
@@ -32,26 +32,85 @@
#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
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
index 477086e2..5d148a9c 100644
--- a/bsd-core/mga_drv.c
+++ b/bsd-core/mga_drv.c
@@ -30,29 +30,87 @@
*
*/
-#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
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index 03bf1b5d..f1012797 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -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
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
index 1c2722c2..57ab3b9d 100644
--- a/bsd-core/radeon_drv.c
+++ b/bsd-core/radeon_drv.c
@@ -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__ */
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
index 2d40018e..10eca397 100644
--- a/bsd-core/sis_drv.c
+++ b/bsd-core/sis_drv.c
@@ -25,29 +25,75 @@
*
*/
-#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
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
index bc038cc0..434fc428 100644
--- a/bsd-core/tdfx_drv.c
+++ b/bsd-core/tdfx_drv.c
@@ -31,28 +31,70 @@
*
*/
-#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