summaryrefslogtreecommitdiffstats
path: root/sys/dev/agp
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-11-11 12:37:13 +0000
committerkib <kib@FreeBSD.org>2014-11-11 12:37:13 +0000
commitfe89e07d5deae1403be239608c51128ef4a0a808 (patch)
tree5000e5e1a1f23dba8dafa3641ce8bbc009dab60d /sys/dev/agp
parent4d1b5f70ee0bf0a60ac9e1a7806fe21a1e3c7556 (diff)
downloadFreeBSD-src-fe89e07d5deae1403be239608c51128ef4a0a808.zip
FreeBSD-src-fe89e07d5deae1403be239608c51128ef4a0a808.tar.gz
On 965 and higher, map GTT as write-combining.
Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'sys/dev/agp')
-rw-r--r--sys/dev/agp/agp_i810.c51
1 files changed, 43 insertions, 8 deletions
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index 9afd201..6e06292 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -115,6 +115,8 @@ static int agp_sb_get_gtt_total_entries(device_t dev);
static int agp_i810_install_gatt(device_t dev);
static int agp_i830_install_gatt(device_t dev);
+static int agp_i965_install_gatt(device_t dev);
+static int agp_g4x_install_gatt(device_t dev);
static void agp_i810_deinstall_gatt(device_t dev);
static void agp_i830_deinstall_gatt(device_t dev);
@@ -397,7 +399,7 @@ static const struct agp_i810_driver agp_i810_g965_driver = {
.get_stolen_size = agp_i915_get_stolen_size,
.get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries,
.get_gtt_total_entries = agp_i965_get_gtt_total_entries,
- .install_gatt = agp_i830_install_gatt,
+ .install_gatt = agp_i965_install_gatt,
.deinstall_gatt = agp_i830_deinstall_gatt,
.write_gtt = agp_i965_write_gtt,
.install_gtt_pte = agp_i965_install_gtt_pte,
@@ -466,7 +468,7 @@ static const struct agp_i810_driver agp_i810_g4x_driver = {
.get_stolen_size = agp_i915_get_stolen_size,
.get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries,
.get_gtt_total_entries = agp_gen5_get_gtt_total_entries,
- .install_gatt = agp_i830_install_gatt,
+ .install_gatt = agp_g4x_install_gatt,
.deinstall_gatt = agp_i830_deinstall_gatt,
.write_gtt = agp_g4x_write_gtt,
.install_gtt_pte = agp_g4x_install_gtt_pte,
@@ -489,7 +491,7 @@ static const struct agp_i810_driver agp_i810_sb_driver = {
.get_stolen_size = agp_sb_get_stolen_size,
.get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries,
.get_gtt_total_entries = agp_sb_get_gtt_total_entries,
- .install_gatt = agp_i830_install_gatt,
+ .install_gatt = agp_g4x_install_gatt,
.deinstall_gatt = agp_i830_deinstall_gatt,
.write_gtt = agp_sb_write_gtt,
.install_gtt_pte = agp_sb_install_gtt_pte,
@@ -1406,14 +1408,11 @@ agp_i810_install_gatt(device_t dev)
return (0);
}
-static int
-agp_i830_install_gatt(device_t dev)
+static void
+agp_i830_install_gatt_init(struct agp_i810_softc *sc)
{
- struct agp_i810_softc *sc;
uint32_t pgtblctl;
- sc = device_get_softc(dev);
-
/*
* The i830 automatically initializes the 128k gatt on boot.
* GATT address is already in there, make sure it's enabled.
@@ -1423,10 +1422,46 @@ agp_i830_install_gatt(device_t dev)
bus_write_4(sc->sc_res[0], AGP_I810_PGTBL_CTL, pgtblctl);
sc->gatt->ag_physical = pgtblctl & ~1;
+}
+
+static int
+agp_i830_install_gatt(device_t dev)
+{
+ struct agp_i810_softc *sc;
+
+ sc = device_get_softc(dev);
+ agp_i830_install_gatt_init(sc);
return (0);
}
static int
+agp_gen4_install_gatt(device_t dev, const vm_size_t gtt_offset)
+{
+ struct agp_i810_softc *sc;
+
+ sc = device_get_softc(dev);
+ pmap_change_attr((vm_offset_t)rman_get_virtual(sc->sc_res[0]) +
+ gtt_offset, rman_get_size(sc->sc_res[0]) - gtt_offset,
+ VM_MEMATTR_WRITE_COMBINING);
+ agp_i830_install_gatt_init(sc);
+ return (0);
+}
+
+static int
+agp_i965_install_gatt(device_t dev)
+{
+
+ return (agp_gen4_install_gatt(dev, 512 * 1024));
+}
+
+static int
+agp_g4x_install_gatt(device_t dev)
+{
+
+ return (agp_gen4_install_gatt(dev, 2 * 1024 * 1024));
+}
+
+static int
agp_i810_attach(device_t dev)
{
struct agp_i810_softc *sc;
OpenPOWER on IntegriCloud