Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci -allocate DMA maps as large as necessary in the ...



details:   https://anonhg.NetBSD.org/src/rev/85bd6442c5d3
branches:  trunk
changeset: 514899:85bd6442c5d3
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Sep 13 16:18:53 2001 +0000

description:
-allocate DMA maps as large as necessary in the worst case
-Add a really bad hack: The X server (4.1.0 afaict) appearently overwrites
 the PGTBL_CTL which contains the base address of the pseudo-GATT.
 Restore the original value if we notice this happened.
The X server works now, but only with soft cursor.

diffstat:

 sys/dev/pci/agp_i810.c |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 7991e18e1285 -r 85bd6442c5d3 sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Thu Sep 13 16:14:16 2001 +0000
+++ b/sys/dev/pci/agp_i810.c    Thu Sep 13 16:18:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.3 2001/09/11 06:51:47 fvdl Exp $        */
+/*     $NetBSD: agp_i810.c,v 1.4 2001/09/13 16:18:53 drochner Exp $    */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -377,8 +377,9 @@
                        return NULL;
                }
        } else if (type != 1) {
-               if (bus_dmamap_create(sc->as_dmat, size, 1, size, 0,
-                   BUS_DMA_NOWAIT, &mem->am_dmamap) != 0) {
+               if (bus_dmamap_create(sc->as_dmat, size, size / PAGE_SIZE + 1,
+                                     size, 0, BUS_DMA_NOWAIT,
+                                     &mem->am_dmamap) != 0) {
                        free(mem, M_AGP);
                        return NULL;
                }
@@ -413,7 +414,21 @@
                     off_t offset)
 {
        struct agp_i810_softc *isc = sc->as_chipc;
-       u_int32_t i;
+       u_int32_t regval, i;
+
+       /*
+        * XXX evil hack: the PGTBL_CTL appearently gets overwritten by the
+        * X server for mysterious reasons which leads to crashes if we write
+        * to the GTT through the MMIO window.
+        * Until the issue is solved, simply restore it.
+        */
+       regval = bus_space_read_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL);
+       if (regval != (isc->gatt->ag_physical | 1)) {
+               printf("agp_i810_bind_memory: PGTBL_CTL is 0x%x - fixing\n",
+                      regval);
+               bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL,
+                                 isc->gatt->ag_physical | 1);
+       }
 
        if (mem->am_type == 2)
                return 0;



Home | Main Index | Thread Index | Old Index