summaryrefslogtreecommitdiff
path: root/bsd-core/r128_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-11-06 01:41:47 +0000
committerEric Anholt <anholt@freebsd.org>2004-11-06 01:41:47 +0000
commitc9202c89653b8dac2ac322c3d3a7389945e1c94c (patch)
treeda57c01384977ea6a2962cfaac9c7c426da2c0f8 /bsd-core/r128_drv.c
parent39a23640b2de9e59e99d48e6de8c9edae0231856 (diff)
Commit WIP of BSD conversion to core model. Compiles for r128, radeon, but
doesn't run yet. Moves the ioctl definitions for these two drivers back to the shared code -- they aren't OS-specific.
Diffstat (limited to 'bsd-core/r128_drv.c')
-rw-r--r--bsd-core/r128_drv.c98
1 files changed, 76 insertions, 22 deletions
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
index a9af3694..02fbd173 100644
--- a/bsd-core/r128_drv.c
+++ b/bsd-core/r128_drv.c
@@ -30,34 +30,88 @@
*
*/
-#include "r128.h"
#include "drmP.h"
#include "drm.h"
#include "r128_drm.h"
#include "r128_drv.h"
-#if __REALLY_HAVE_SG
-#include "ati_pcigart.h"
-#endif
+#include "drm_pciids.h"
+
+/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
+static drm_pci_id_list_t r128_pciidlist[] = {
+ r128_PCI_IDS
+};
+
+extern drm_ioctl_desc_t r128_ioctls[];
+extern int r128_max_ioctl;
+
+static void r128_configure(drm_device_t *dev)
+{
+ dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
+ dev->prerelease = r128_driver_prerelease;
+ dev->pretakedown = r128_driver_pretakedown;
+ dev->vblank_wait = r128_driver_vblank_wait;
+ dev->irq_preinstall = r128_driver_irq_preinstall;
+ dev->irq_postinstall = r128_driver_irq_postinstall;
+ dev->irq_uninstall = r128_driver_irq_uninstall;
+ dev->irq_handler = r128_driver_irq_handler;
+ /* XXX dev->reclaim_buffers = drm_core_reclaim_buffers;*/
+ /* XXX dev->get_map_ofs = drm_core_get_map_ofs;
+ dev->get_reg_ofs = drm_core_get_reg_ofs;*/
+ /* XXX: Postinit inlined into drm_drv
+ dev->postinit = postinit; */
-#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"
-#include "drm_scatter.h"
+ 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_sg = 1;
+ dev->use_dma = 1;
+ dev->use_irq = 1;
+ dev->use_vbl_irq = 1;
+}
#ifdef __FreeBSD__
-DRIVER_MODULE(r128, pci, r128_driver, r128_devclass, 0, 0);
+static int
+r128_probe(device_t dev)
+{
+ return drm_probe(dev, r128_pciidlist);
+}
+
+static int
+r128_attach(device_t nbdev)
+{
+ drm_device_t *dev = device_get_softc(nbdev);
+
+ bzero(dev, sizeof(drm_device_t));
+ r128_configure(dev);
+ return drm_attach(nbdev, r128_pciidlist);
+}
+
+static device_method_t r128_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, r128_probe),
+ DEVMETHOD(device_attach, r128_attach),
+ DEVMETHOD(device_detach, drm_detach),
+
+ { 0, 0 }
+};
+
+static driver_t r128_driver = {
+ "drm",
+ r128_methods,
+ sizeof(drm_device_t)
+};
+
+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__)
CFDRIVER_DECL(r128, DV_TTY, NULL);
-#endif /* __FreeBSD__ */
+#endif