Source-Changes-HG archive

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

[src/trunk]: src/sys Restore gtt page table control register on resume.



details:   https://anonhg.NetBSD.org/src/rev/1c384d5befdf
branches:  trunk
changeset: 992374:1c384d5befdf
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 00:51:37 2018 +0000

description:
Restore gtt page table control register on resume.

Additional subroutine agp_i810_reset is used by i915drmkms to make
sure it happens early enough, since i915drmkms resumes before agp.

XXX pullup-7
XXX pullup-8

diffstat:

 sys/dev/pci/agp_i810.c                    |  21 ++++++++++++++-------
 sys/dev/pci/agp_i810var.h                 |   8 +++-----
 sys/external/bsd/drm2/i915drm/intel_gtt.c |  12 +++++++++---
 3 files changed, 26 insertions(+), 15 deletions(-)

diffs (109 lines):

diff -r 21a33b285386 -r 1c384d5befdf sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Mon Aug 27 00:46:42 2018 +0000
+++ b/sys/dev/pci/agp_i810.c    Mon Aug 27 00:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $    */
+/*     $NetBSD: agp_i810.c,v 1.123 2018/08/27 00:51:37 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.123 2018/08/27 00:51:37 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1490,17 +1490,24 @@
        return 0;
 }
 
+void
+agp_i810_reset(struct agp_i810_softc *isc)
+{
+
+       /* Restore the page table control register.  */
+       bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL,
+           isc->pgtblctl);
+
+       agp_flush_cache();
+}
+
 static bool
 agp_i810_resume(device_t dv, const pmf_qual_t *qual)
 {
        struct agp_softc *sc = device_private(dv);
        struct agp_i810_softc *isc = sc->as_chipc;
 
-       /*
-        * XXX Nothing uses this!  Save on suspend, restore on resume?
-        */
-       isc->pgtblctl_resume_hack = READ4(AGP_I810_PGTBL_CTL);
-       agp_flush_cache();
+       agp_i810_reset(isc);
 
        return true;
 }
diff -r 21a33b285386 -r 1c384d5befdf sys/dev/pci/agp_i810var.h
--- a/sys/dev/pci/agp_i810var.h Mon Aug 27 00:46:42 2018 +0000
+++ b/sys/dev/pci/agp_i810var.h Mon Aug 27 00:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810var.h,v 1.6 2015/03/06 22:03:06 riastradh Exp $        */
+/*     $NetBSD: agp_i810var.h,v 1.7 2018/08/27 00:51:37 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -58,11 +58,8 @@
        struct agp_gatt *gatt;          /* i810-only OS-allocated GTT */
        uint32_t dcache_size;           /* i810-only on-chip memory size */
 
-       /* XXX Kludge to work around broken X servers.  */
+       /* Cached pgtblctl register for resume.  */
        pcireg_t pgtblctl;
-
-       /* XXX Vestige of unfinished powerhook?  */
-       uint32_t pgtblctl_resume_hack;
 };
 
 extern struct agp_softc        *agp_i810_sc;
@@ -75,3 +72,4 @@
            int);
 void   agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);
 void   agp_i810_chipset_flush(struct agp_i810_softc *);
+void   agp_i810_reset(struct agp_i810_softc *);
diff -r 21a33b285386 -r 1c384d5befdf sys/external/bsd/drm2/i915drm/intel_gtt.c
--- a/sys/external/bsd/drm2/i915drm/intel_gtt.c Mon Aug 27 00:46:42 2018 +0000
+++ b/sys/external/bsd/drm2/i915drm/intel_gtt.c Mon Aug 27 00:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_gtt.c,v 1.6 2018/08/06 00:30:15 riastradh Exp $  */
+/*     $NetBSD: intel_gtt.c,v 1.7 2018/08/27 00:51:37 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.6 2018/08/06 00:30:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.7 2018/08/27 00:51:37 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -125,8 +125,14 @@
 bool
 intel_enable_gtt(void)
 {
+       struct agp_softc *sc = agp_i810_sc;
+       struct agp_i810_softc *isc;
 
-       return (agp_i810_sc != NULL);
+       if (sc == NULL)
+               return false;
+       isc = sc->as_chipc;
+       agp_i810_reset(isc);
+       return true;
 }
 
 void



Home | Main Index | Thread Index | Old Index