diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2011-10-24 15:42:34 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2011-10-24 15:42:34 +0000 |
commit | 6ccea7fa32be20b381f43cec076314b21037447f (patch) | |
tree | 881d937c7dffdf1b99848c0d03e4bea13d3d8715 /sys/dev | |
parent | 0bc2c4a1b1baf8ce3979efd4c5c679a1f7d1f6bd (diff) |
Fix unaligned pci config space access in intelagp.
tested by reported. ok kettenis@ (who pointed out a botch i'd made, too).
While here remove definition of another (unused) unaligned access. to be added
back when it is actually used (this one pointed out by deraadt@).
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/agp_intel.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/agpreg.h | 10 |
2 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/pci/agp_intel.c b/sys/dev/pci/agp_intel.c index e0a4cb875fd..c2ec4a8a346 100644 --- a/sys/dev/pci/agp_intel.c +++ b/sys/dev/pci/agp_intel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_intel.c,v 1.18 2010/08/07 20:47:24 deraadt Exp $ */ +/* $OpenBSD: agp_intel.c,v 1.19 2011/10/24 15:42:33 oga Exp $ */ /* $NetBSD: agp_intel.c,v 1.3 2001/09/15 00:25:00 thorpej Exp $ */ /*- @@ -260,7 +260,11 @@ agp_intel_attach(struct device *parent, struct device *self, void *aux) break; default: - pci_conf_write(pa->pa_pc, pa->pa_tag, AGP_INTEL_ERRSTS, 0x70); + reg = pci_conf_read(isc->isc_pc, isc->isc_tag, + AGP_INTEL_ERRCMD); + reg |= 0x7000; /* Ack ERRSTS bits 8-10*/ + pci_conf_write(isc->isc_pc, isc->isc_tag, + AGP_INTEL_ERRCMD, reg); } isc->agpdev = (struct agp_softc *)agp_attach_bus(pa, &agp_intel_methods, @@ -319,6 +323,7 @@ agp_intel_save(struct agp_intel_softc *isc) void agp_intel_restore(struct agp_intel_softc *isc) { + pcireg_t tmp; /* * reset size now just in case, if it worked before then sanity * checking will not fail @@ -374,8 +379,11 @@ agp_intel_restore(struct agp_intel_softc *isc) AGP_INTEL_I8XX_ERRSTS, 0x00ff); break; default: + tmp = pci_conf_read(isc->isc_pc, isc->isc_tag, + AGP_INTEL_ERRCMD); + tmp |= 0x7000; /* Ack ERRSTS bits 8-10*/ pci_conf_write(isc->isc_pc, isc->isc_tag, - AGP_INTEL_ERRSTS, 0x70); + AGP_INTEL_ERRCMD, tmp); break; } } diff --git a/sys/dev/pci/agpreg.h b/sys/dev/pci/agpreg.h index 9efe42b4ab4..e5d6b238d42 100644 --- a/sys/dev/pci/agpreg.h +++ b/sys/dev/pci/agpreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: agpreg.h,v 1.14 2011/10/16 01:11:31 dhill Exp $ */ +/* $OpenBSD: agpreg.h,v 1.15 2011/10/24 15:42:33 oga Exp $ */ /* $NetBSD: agpreg.h,v 1.1 2001/09/10 10:01:02 fvdl Exp $ */ /*- @@ -52,10 +52,6 @@ /* * Config offsets for Intel AGP chipsets. */ -/* i845/855PM */ -#define AGP_I845_AGPMISC 0x51 -#define AGPMISC_AAGN (1U << 1) /* Aperture AccessEN */ - /* i840/850/850E */ #define AGP_I840_MCHCFG 0x50 #define MCHCFG_AAGN (1U << 9) /* Aperture AccessEN */ @@ -70,7 +66,9 @@ #define AGP_INTEL_I8XX_ERRSTS 0xc8 /* Common register */ -#define AGP_INTEL_ERRSTS 0x91 /* Not i8XX */ +#define AGP_INTEL_ERRCMD 0x90 /* Not i8XX, 8 bits + * ERRSTS is at + 1 and is 16 + */ #define AGP_INTEL_AGPCMD 0xa8 #define AGPCMD_SBA (1U << 9) #define AGPCMD_AGPEN (1U << 8) |