summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-19 11:29:42 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-19 11:29:42 +0000
commit12c0afa0e7ec87d4ff845059ddc9861beed076d9 (patch)
tree7bd771440c0af1352a92583b06e2fc331be34bf2 /sys
parente53fb66e4c1f6b2efef40c178c47295d9bad4f96 (diff)
Prevent GPU lockups with KMS & AGP-enable on Uninorth (G4) machines.
Based on linux commit 5613beb46d54da6ef7f1c4589e9f2e60eeb10721 found by jsg@. KMS is now usable on Uninorth machines but X11 output is still corrupted. ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/agp_apple.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/pci/agp_apple.c b/sys/dev/pci/agp_apple.c
index 69aa7806037..3b061671ce3 100644
--- a/sys/dev/pci/agp_apple.c
+++ b/sys/dev/pci/agp_apple.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_apple.c,v 1.6 2015/12/19 11:23:35 mpi Exp $ */
+/* $OpenBSD: agp_apple.c,v 1.7 2015/12/19 11:29:41 mpi Exp $ */
/*
* Copyright (c) 2012 Martin Pieuchot <mpi@openbsd.org>
@@ -51,6 +51,7 @@ int agp_apple_set_aperture(void *sc, bus_size_t);
void agp_apple_bind_page(void *, bus_addr_t, paddr_t, int);
void agp_apple_unbind_page(void *, bus_addr_t);
void agp_apple_flush_tlb(void *);
+int agp_apple_enable(void *, uint32_t);
const struct cfattach appleagp_ca = {
sizeof(struct agp_apple_softc), agp_apple_match, agp_apple_attach,
@@ -64,6 +65,7 @@ const struct agp_methods agp_apple_methods = {
agp_apple_bind_page,
agp_apple_unbind_page,
agp_apple_flush_tlb,
+ agp_apple_enable,
};
int
@@ -221,9 +223,24 @@ agp_apple_flush_tlb(void *v)
AGP_APPLE_GART_ENABLE | AGP_APPLE_GART_INVALIDATE);
pci_conf_write(asc->asc_pc, asc->asc_tag, AGP_APPLE_GARTCTRL,
AGP_APPLE_GART_ENABLE);
+ }
+}
+
+int
+agp_apple_enable(void *v, uint32_t mode)
+{
+ struct agp_apple_softc *asc = v;
+
+ if ((asc->asc_flags & AGP_APPLE_ISU3) == 0) {
+ /*
+ * GART invalidate/SBA reset? Linux and Darwin do something
+ * similar and it prevents GPU lockups with KMS.
+ */
pci_conf_write(asc->asc_pc, asc->asc_tag, AGP_APPLE_GARTCTRL,
AGP_APPLE_GART_ENABLE | AGP_APPLE_GART_2XRESET);
- pci_conf_write(asc->asc_pc, asc->asc_tag, AGP_APPLE_GARTCTRL,
- AGP_APPLE_GART_ENABLE);
+ pci_conf_write(asc->asc_pc, asc->asc_tag,
+ AGP_APPLE_GARTCTRL, AGP_APPLE_GART_ENABLE);
}
+
+ return (agp_generic_enable(asc->agpdev, mode));
}