summaryrefslogtreecommitdiffstats
path: root/sys/dev/agp
diff options
context:
space:
mode:
authortakawata <takawata@FreeBSD.org>2007-01-06 08:31:31 +0000
committertakawata <takawata@FreeBSD.org>2007-01-06 08:31:31 +0000
commit0b64d2d9ba6be11f01290136b6e19e302398c3a8 (patch)
tree61baeeae3619296279512803fabdac2476930285 /sys/dev/agp
parent6f7fa5b38508c5f124444a1406a0dfc9b64913cd (diff)
downloadFreeBSD-src-0b64d2d9ba6be11f01290136b6e19e302398c3a8.zip
FreeBSD-src-0b64d2d9ba6be11f01290136b6e19e302398c3a8.tar.gz
Restore agp aperture size after resume, in case it is modified after boot.
Diffstat (limited to 'sys/dev/agp')
-rw-r--r--sys/dev/agp/agp_intel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/agp/agp_intel.c b/sys/dev/agp/agp_intel.c
index 42c8b0d..d30f0d4 100644
--- a/sys/dev/agp/agp_intel.c
+++ b/sys/dev/agp/agp_intel.c
@@ -55,6 +55,7 @@ struct agp_intel_softc {
u_int32_t initial_aperture; /* aperture size at startup */
struct agp_gatt *gatt;
u_int aperture_mask;
+ u_int32_t current_aperture; /* current aperture size */
};
static const char*
@@ -233,7 +234,7 @@ agp_intel_attach(device_t dev)
sc->aperture_mask = pci_read_config(dev, AGP_INTEL_APSIZE, 1) &
MAX_APSIZE;
pci_write_config(dev, AGP_INTEL_APSIZE, value, 1);
- sc->initial_aperture = AGP_GET_APERTURE(dev);
+ sc->current_aperture = sc->initial_aperture = AGP_GET_APERTURE(dev);
for (;;) {
gatt = agp_alloc_gatt(dev);
@@ -311,6 +312,10 @@ agp_intel_detach(device_t dev)
static int
agp_intel_resume(device_t dev)
{
+ struct agp_intel_softc *sc;
+ sc = device_get_softc(dev);
+
+ AGP_SET_APERTURE(dev, sc->current_aperture);
agp_intel_commit_gatt(dev);
return (bus_generic_resume(dev));
}
@@ -354,6 +359,8 @@ agp_intel_set_aperture(device_t dev, u_int32_t aperture)
if ((((apsize ^ sc->aperture_mask) << 22) | ((1 << 22) - 1)) + 1 != aperture)
return (EINVAL);
+ sc->current_aperture = apsize;
+
pci_write_config(dev, AGP_INTEL_APSIZE, apsize, 1);
return (0);
OpenPOWER on IntegriCloud