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. --- bsd-core/tdfx_drv.c | 78 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 18 deletions(-) (limited to 'bsd-core/tdfx_drv.c') 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 -- cgit v1.2.3