Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/dev/pci Expose agp_i810_write_gtt_entry for drm2.



details:   https://anonhg.NetBSD.org/src/rev/2022d140ea0a
branches:  riastradh-drm2
changeset: 788648:2022d140ea0a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 05 22:18:19 2014 +0000

description:
Expose agp_i810_write_gtt_entry for drm2.

Also add an agp_i810_post_gtt_entry to do a posting read for that GTT
entry.

diffstat:

 sys/dev/pci/agp_i810.c    |  37 ++++++++++++++++++++++++++++++++-----
 sys/dev/pci/agp_i810var.h |   5 ++++-
 2 files changed, 36 insertions(+), 6 deletions(-)

diffs (88 lines):

diff -r 435bcf7162f9 -r 2022d140ea0a sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Wed Mar 05 22:18:10 2014 +0000
+++ b/sys/dev/pci/agp_i810.c    Wed Mar 05 22:18:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $     */
+/*     $NetBSD: agp_i810.c,v 1.73.26.2 2014/03/05 22:18:19 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.73.26.2 2014/03/05 22:18:19 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -87,8 +87,6 @@
 static int agp_i810_init(struct agp_softc *);
 
 static int agp_i810_init(struct agp_softc *);
-static int agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t,
-                                   bus_addr_t);
 
 static struct agp_methods agp_i810_methods = {
        agp_i810_get_aperture,
@@ -103,7 +101,7 @@
        agp_i810_unbind_memory,
 };
 
-static int
+int
 agp_i810_write_gtt_entry(struct agp_i810_softc *isc, off_t off, bus_addr_t v)
 {
        u_int32_t pte;
@@ -157,6 +155,35 @@
        return 0;
 }
 
+void
+agp_i810_post_gtt_entry(struct agp_i810_softc *isc, off_t off)
+{
+       bus_size_t base_off, wroff;
+
+       base_off = 0;
+       wroff = (off >> AGP_PAGE_SHIFT) * 4;
+
+       switch (isc->chiptype) {
+       case CHIP_I810:
+       case CHIP_I830:
+       case CHIP_I855:
+               base_off = AGP_I810_GTT;
+               break;
+       case CHIP_I965:
+               base_off = AGP_I965_GTT;
+               break;
+       case CHIP_G4X:
+               base_off = AGP_G4X_GTT;
+               break;
+       case CHIP_I915:
+       case CHIP_G33:
+               (void)bus_space_read_4(isc->gtt_bst, isc->gtt_bsh, wroff);
+               return;
+       }
+
+       (void)READ4(base_off + wroff);
+}
+
 /* XXXthorpej -- duplicated code (see arch/x86/pci/pchb.c) */
 static int
 agp_i810_vgamatch(const struct pci_attach_args *pa)
diff -r 435bcf7162f9 -r 2022d140ea0a sys/dev/pci/agp_i810var.h
--- a/sys/dev/pci/agp_i810var.h Wed Mar 05 22:18:10 2014 +0000
+++ b/sys/dev/pci/agp_i810var.h Wed Mar 05 22:18:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810var.h,v 1.1.2.1 2014/03/05 14:42:40 riastradh Exp $    */
+/*     $NetBSD: agp_i810var.h,v 1.1.2.2 2014/03/05 22:18:19 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -51,3 +51,6 @@
 };
 
 extern struct agp_softc        *agp_i810_sc;
+
+int    agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, bus_addr_t);
+void   agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);



Home | Main Index | Thread Index | Old Index