Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Move all PCI/AGP code back to drmkms_pci module where it...



details:   https://anonhg.NetBSD.org/src/rev/26c384913e98
branches:  trunk
changeset: 333937:26c384913e98
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Nov 22 19:18:07 2014 +0000

description:
Move all PCI/AGP code back to drmkms_pci module where it belongs.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_agpsupport.c         |  10 ----
 sys/external/bsd/drm2/dist/drm/drm_pci.c                |   7 ++-
 sys/external/bsd/drm2/dist/drm/drm_stub.c               |   4 +-
 sys/external/bsd/drm2/dist/include/drm/drmP.h           |   2 +
 sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h |   1 -
 sys/external/bsd/drm2/drm/drm_drv.c                     |  40 +++++++++++-----
 sys/external/bsd/drm2/pci/drm_pci.c                     |  11 +---
 sys/external/bsd/drm2/pci/drm_pci_module.c              |   5 +-
 sys/modules/drmkms/Makefile                             |   4 +-
 sys/modules/drmkms_pci/Makefile                         |   4 +-
 10 files changed, 48 insertions(+), 40 deletions(-)

diffs (249 lines):

diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
--- a/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Sat Nov 22 19:18:07 2014 +0000
@@ -518,16 +518,6 @@
        dev->agp->enabled = 0;
 }
 
-void drm_agp_destroy(struct drm_device *dev)
-{
-       if (dev->agp) {
-               arch_phys_wc_del(dev->agp->agp_mtrr);
-               drm_agp_clear(dev);
-               kfree(dev->agp);
-               dev->agp = NULL;
-       }
-}
-
 #ifndef __NetBSD__             /* XXX Dead code that doesn't make sense...  */
 /**
  * Binds a collection of pages into AGP memory at the given offset, returning
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/dist/drm/drm_pci.c
--- a/sys/external/bsd/drm2/dist/drm/drm_pci.c  Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_pci.c  Sat Nov 22 19:18:07 2014 +0000
@@ -277,7 +277,12 @@
 
 void drm_pci_agp_destroy(struct drm_device *dev)
 {
-       drm_agp_destroy(dev);
+       if (dev->agp) {
+               arch_phys_wc_del(dev->agp->agp_mtrr);
+               drm_agp_clear(dev);
+               kfree(dev->agp);
+               dev->agp = NULL;
+       }
 }
 
 static struct drm_bus drm_pci_bus = {
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/dist/drm/drm_stub.c
--- a/sys/external/bsd/drm2/dist/drm/drm_stub.c Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_stub.c Sat Nov 22 19:18:07 2014 +0000
@@ -848,8 +848,10 @@
        if (dev->driver->unload)
                dev->driver->unload(dev);
 
+#ifndef __NetBSD__             /* Moved to drm_pci.  */
        if (dev->agp)
-               drm_agp_destroy(dev);
+               drm_pci_agp_destroy(dev);
+#endif
 
        drm_vblank_cleanup(dev);
 
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h     Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h     Sat Nov 22 19:18:07 2014 +0000
@@ -1607,9 +1607,11 @@
        drm_ioctl_t     *agph_bind_ioctl;
        drm_ioctl_t     *agph_unbind_ioctl;
        int             (*agph_release)(struct drm_device *);
+       void            (*agph_clear)(struct drm_device *);
 };
 
 extern int drm_agp_release_hook(struct drm_device *);
+extern void drm_agp_clear_hook(struct drm_device *);
 
 extern int drm_agp_register(const struct drm_agp_hooks *);
 extern void drm_agp_deregister(const struct drm_agp_hooks *);
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h
--- a/sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h   Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h   Sat Nov 22 19:18:07 2014 +0000
@@ -27,7 +27,6 @@
 
 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
 void drm_agp_clear(struct drm_device *dev);
-void drm_agp_destroy(struct drm_device *dev);
 int drm_agp_acquire(struct drm_device *dev);
 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
                          struct drm_file *file_priv);
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/drm/drm_drv.c
--- a/sys/external/bsd/drm2/drm/drm_drv.c       Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_drv.c       Sat Nov 22 19:18:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $    */
+/*     $NetBSD: drm_drv.c,v 1.11 2014/11/22 19:18:07 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.11 2014/11/22 19:18:07 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -393,7 +393,7 @@
                drm_irq_uninstall(dev);
 
        mutex_lock(&dev->struct_mutex);
-       drm_agp_clear(dev);
+       drm_agp_clear_hook(dev);
        drm_legacy_sg_cleanup(dev);
        list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
                list_del(&vma->head);
@@ -806,25 +806,39 @@
                    hooks, drm_current_agp_hooks);
 }
 
+static void __dead
+drm_noagp_panic(struct drm_device *dev)
+{
+       if ((dev != NULL) &&
+           (dev->control != NULL) &&
+           (dev->control->kdev != NULL))
+               panic("%s: no agp loaded", device_xname(dev->control->kdev));
+       else
+               panic("drm_device %p: no agp loaded", dev);
+}
+
 int
 drm_agp_release_hook(struct drm_device *dev)
 {
        const struct drm_agp_hooks *const hooks = drm_current_agp_hooks;
 
-       if (hooks == NULL) {
-               if ((dev != NULL) &&
-                   (dev->control != NULL) &&
-                   (dev->control->kdev != NULL))
-                       panic("drm_agp_release(%s): no agp loaded",
-                           device_xname(dev->control->kdev));
-               else
-                       panic("drm_agp_release(drm_device %p): no agp loaded",
-                           dev);
-       }
+       if (hooks == NULL)
+               drm_noagp_panic(dev);
        membar_consumer();
        return (*hooks->agph_release)(dev);
 }
 
+void
+drm_agp_clear_hook(struct drm_device *dev)
+{
+       const struct drm_agp_hooks *const hooks = drm_current_agp_hooks;
+
+       if (hooks == NULL)
+               drm_noagp_panic(dev);
+       membar_consumer();
+       (*hooks->agph_clear)(dev);
+}
+
 #define        DEFINE_AGP_HOOK_IOCTL(NAME, HOOK)                                     \
 static int                                                                   \
 NAME(struct drm_device *dev, void *data, struct drm_file *file)                      \
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/pci/drm_pci.c
--- a/sys/external/bsd/drm2/pci/drm_pci.c       Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci.c       Sat Nov 22 19:18:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_pci.c,v 1.7 2014/11/04 11:27:31 jmcneill Exp $     */
+/*     $NetBSD: drm_pci.c,v 1.8 2014/11/22 19:18:07 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.7 2014/11/04 11:27:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.8 2014/11/22 19:18:07 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -181,12 +181,7 @@
        drm_dev_unregister(dev);
 
        /* Tear down AGP stuff if necessary.  */
-       if (dev->agp) {
-               arch_phys_wc_del(dev->agp->agp_mtrr);
-               drm_agp_clear(dev);
-               kfree(dev->agp); /* XXX Should go in drm_agp_clear...  */
-               dev->agp = NULL;
-       }
+       drm_pci_agp_destroy(dev);
 
        /* Free the record of available bus space mappings.  */
        dev->bus_nmaps = 0;
diff -r 5b97061f0ed4 -r 26c384913e98 sys/external/bsd/drm2/pci/drm_pci_module.c
--- a/sys/external/bsd/drm2/pci/drm_pci_module.c        Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci_module.c        Sat Nov 22 19:18:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_pci_module.c,v 1.2 2014/03/18 18:20:43 riastradh Exp $     */
+/*     $NetBSD: drm_pci_module.c,v 1.3 2014/11/22 19:18:07 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.2 2014/03/18 18:20:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.3 2014/11/22 19:18:07 riastradh Exp $");
 
 #include <sys/module.h>
 
@@ -48,6 +48,7 @@
        .agph_bind_ioctl = &drm_agp_bind_ioctl,
        .agph_unbind_ioctl = &drm_agp_unbind_ioctl,
        .agph_release = &drm_agp_release,
+       .agph_clear = &drm_agp_clear,
 };
 
 static int
diff -r 5b97061f0ed4 -r 26c384913e98 sys/modules/drmkms/Makefile
--- a/sys/modules/drmkms/Makefile       Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/modules/drmkms/Makefile       Sat Nov 22 19:18:07 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2014/11/12 03:03:01 christos Exp $
+# $NetBSD: Makefile,v 1.7 2014/11/22 19:18:07 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "Makefile.inc"
@@ -12,7 +12,7 @@
 
 # Upstream source files.
 #SRCS+=        ati_pcigart.c           # Moved to drmkms_pci module.
-SRCS+= drm_agpsupport.c        # Moved to drmkms_pci module.
+#SRCS+=        drm_agpsupport.c        # Moved to drmkms_pci module.
 SRCS+= drm_auth.c
 SRCS+= drm_buffer.c
 SRCS+= drm_bufs.c
diff -r 5b97061f0ed4 -r 26c384913e98 sys/modules/drmkms_pci/Makefile
--- a/sys/modules/drmkms_pci/Makefile   Sat Nov 22 18:50:49 2014 +0000
+++ b/sys/modules/drmkms_pci/Makefile   Sat Nov 22 19:18:07 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2014/11/12 02:14:17 christos Exp $
+# $NetBSD: Makefile,v 1.4 2014/11/22 19:18:08 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -9,7 +9,7 @@
 KMOD=  drmkms_pci
 
 #SRCS+=        ati_pcigart.c           # XXX Restore for ATI support.
-#SRCS+=        drm_agpsupport.c
+SRCS+= drm_agpsupport.c
 SRCS+= drm_pci.c
 SRCS+= drm_pci_module.c
 



Home | Main Index | Thread Index | Old Index