Module Name: src
Committed By: riastradh
Date: Wed Mar 5 22:18:19 UTC 2014
Modified Files:
src/sys/dev/pci [riastradh-drm2]: agp_i810.c agp_i810var.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.73.26.1 -r1.73.26.2 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/dev/pci/agp_i810var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.73.26.1 src/sys/dev/pci/agp_i810.c:1.73.26.2
--- src/sys/dev/pci/agp_i810.c:1.73.26.1 Wed Mar 5 14:42:40 2014
+++ src/sys/dev/pci/agp_i810.c Wed Mar 5 22:18:19 2014
@@ -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 bool agp_i810_resume(device_t, co
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 @@ static struct agp_methods agp_i810_metho
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 @@ agp_i810_write_gtt_entry(struct agp_i810
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)
Index: src/sys/dev/pci/agp_i810var.h
diff -u src/sys/dev/pci/agp_i810var.h:1.1.2.1 src/sys/dev/pci/agp_i810var.h:1.1.2.2
--- src/sys/dev/pci/agp_i810var.h:1.1.2.1 Wed Mar 5 14:42:40 2014
+++ src/sys/dev/pci/agp_i810var.h Wed Mar 5 22:18:19 2014
@@ -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 @@ struct agp_i810_softc {
};
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);