Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/linux drm: Nix drm_agp_borrow.



details:   https://anonhg.NetBSD.org/src/rev/59bdd2b6eccd
branches:  trunk
changeset: 368567:59bdd2b6eccd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jul 19 22:24:33 2022 +0000

description:
drm: Nix drm_agp_borrow.

This horrible kludge dates from before I understood the relation of
genfb_pci and pci drm drivers in the old and new worlds of drm.

The only user of it, in i915, was changed to use agp_i810_borrow
directly in the last drm update, so this hack can die.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_agpsupport.c         |  25 +++-------------
 sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h |   5 +--
 sys/external/bsd/drm2/drm/drm_agp_hook.c                |  18 +----------
 sys/external/bsd/drm2/linux/linux_pci.c                 |   5 +--
 4 files changed, 10 insertions(+), 43 deletions(-)

diffs (153 lines):

diff -r f2bd41877137 -r 59bdd2b6eccd sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
--- a/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Tue Jul 19 22:04:14 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Tue Jul 19 22:24:33 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_agpsupport.c,v 1.12 2021/12/18 23:44:57 riastradh Exp $    */
+/*     $NetBSD: drm_agpsupport.c,v 1.13 2022/07/19 22:24:33 riastradh Exp $    */
 
 /*
  * \file drm_agpsupport.c
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_agpsupport.c,v 1.12 2021/12/18 23:44:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_agpsupport.c,v 1.13 2022/07/19 22:24:33 riastradh Exp $");
 
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -527,25 +527,9 @@
        dev->agp->acquired = 0;
        dev->agp->enabled = 0;
 }
+
 #ifdef __NetBSD__
 
-static void __pci_iomem *
-drm_agp_borrow_hook(struct drm_device *dev, unsigned i, bus_size_t size)
-{
-       struct pci_dev *pdev = dev->pdev;
-
-       if (!agp_i810_borrow(pdev->pd_resources[i].addr, size,
-               &pdev->pd_resources[i].bsh))
-               return NULL;
-       /* XXX Synchronize with pci_iomap in linux_pci.c.  */
-       pdev->pd_resources[i].bst = pdev->pd_pa.pa_memt;
-       pdev->pd_resources[i].kva = bus_space_vaddr(pdev->pd_resources[i].bst,
-           pdev->pd_resources[i].bsh);
-       pdev->pd_resources[i].mapped = true;
-
-       return pdev->pd_resources[i].kva;
-}
-
 static void
 drm_agp_flush_hook(void)
 {
@@ -572,7 +556,6 @@
        .agph_free_ioctl = drm_agp_free_ioctl_hook,
        .agph_init = drm_agp_init_hook,
        .agph_clear = drm_agp_clear_hook,
-       .agph_borrow = drm_agp_borrow_hook,
        .agph_flush = drm_agp_flush_hook,
 };
 
@@ -622,6 +605,8 @@
                if (error)
                        return error;
                return 0;
+       case MODULE_CMD_AUTOUNLOAD:
+               return EBUSY;
        case MODULE_CMD_FINI:
                error = drmkms_agp_fini();
                if (error)
diff -r f2bd41877137 -r 59bdd2b6eccd sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h
--- a/sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h   Tue Jul 19 22:04:14 2022 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drm_agpsupport.h   Tue Jul 19 22:24:33 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_agpsupport.h,v 1.9 2021/12/18 23:45:45 riastradh Exp $     */
+/*     $NetBSD: drm_agpsupport.h,v 1.10 2022/07/19 22:24:34 riastradh Exp $    */
 
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef _DRM_AGPSUPPORT_H_
@@ -20,8 +20,6 @@
 struct drm_file;
 
 struct drm_agp_hooks {
-       void __pci_iomem *
-               (*agph_borrow)(struct drm_device *, unsigned, bus_size_t);
        void    (*agph_flush)(void);
 
        struct drm_agp_head *
@@ -108,7 +106,6 @@
                       struct drm_file *file_priv);
 
 #ifdef __NetBSD__
-void __pci_iomem *drm_agp_borrow(struct drm_device *, unsigned, bus_size_t);
 void drm_agp_flush(void);
 void drm_agp_fini(struct drm_device *);
 int drm_agp_register(const struct drm_agp_hooks *);
diff -r f2bd41877137 -r 59bdd2b6eccd sys/external/bsd/drm2/drm/drm_agp_hook.c
--- a/sys/external/bsd/drm2/drm/drm_agp_hook.c  Tue Jul 19 22:04:14 2022 +0000
+++ b/sys/external/bsd/drm2/drm/drm_agp_hook.c  Tue Jul 19 22:24:33 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_agp_hook.c,v 1.6 2021/12/19 09:52:00 riastradh Exp $       */
+/*     $NetBSD: drm_agp_hook.c,v 1.7 2022/07/19 22:24:34 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_agp_hook.c,v 1.6 2021/12/19 09:52:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_agp_hook.c,v 1.7 2022/07/19 22:24:34 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/condvar.h>
@@ -264,20 +264,6 @@
 DEFINE_AGP_HOOK_IOCTL(drm_agp_bind_ioctl, agph_bind_ioctl)
 DEFINE_AGP_HOOK_IOCTL(drm_agp_unbind_ioctl, agph_unbind_ioctl)
 
-void __pci_iomem *
-drm_agp_borrow(struct drm_device *dev, unsigned bar, bus_size_t size)
-{
-       const struct drm_agp_hooks *hooks;
-       void __pci_iomem *iomem;
-
-       if ((hooks = drm_agp_hooks_acquire()) == NULL)
-               return NULL;
-       iomem = hooks->agph_borrow(dev, bar, size);
-       drm_agp_hooks_release(hooks);
-
-       return iomem;
-}
-
 void
 drm_agp_flush(void)
 {
diff -r f2bd41877137 -r 59bdd2b6eccd sys/external/bsd/drm2/linux/linux_pci.c
--- a/sys/external/bsd/drm2/linux/linux_pci.c   Tue Jul 19 22:04:14 2022 +0000
+++ b/sys/external/bsd/drm2/linux/linux_pci.c   Tue Jul 19 22:24:33 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_pci.c,v 1.21 2022/02/27 14:19:20 riastradh Exp $ */
+/*     $NetBSD: linux_pci.c,v 1.22 2022/07/19 22:24:34 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.21 2022/02/27 14:19:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.22 2022/07/19 22:24:34 riastradh Exp $");
 
 #if NACPICA > 0
 #include <dev/acpi/acpivar.h>
@@ -639,7 +639,6 @@
            &pdev->pd_resources[i].bsh);
        if (error)
                return NULL;
-       /* XXX Synchronize with drm_agp_borrow_hook in drm_agpsupport.c.  */
        pdev->pd_resources[i].bst = pdev->pd_pa.pa_memt;
        pdev->pd_resources[i].kva = bus_space_vaddr(pdev->pd_resources[i].bst,
            pdev->pd_resources[i].bsh);



Home | Main Index | Thread Index | Old Index