xf86-video-ati: Branch 'pci-rework'

George Sapountzis gsap7 at kemper.freedesktop.org
Fri Mar 9 15:25:03 EET 2007


 src/atipreinit.c |   10 ++++++++++
 src/atividmem.c  |   10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

New commits:
diff-tree 0d17cfda5f5d690eb5fbf1cc1d6dbac06dbdee7a (from b6038e8f2944e195ab16f1aa23cf0cfb90cb7547)
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Fri Mar 9 00:58:22 2007 +0200

    Fix check for MMIO offset falling in the linear apperture.
    
    The check was wrong and there is one case that it cannot catch (see below).
    Fix the test and restore the original code for re-setting pATI->Block0Base
    for MMIOInLinear before re-mapping the aperture.
    
    This affects old CX/GX cards only and I cannot test.
    
     ------------------------------------------
    
    For LE linear aperture only:
    
    * 8MB linear aperture,
      8MB mmio offset, the test is (8 > 8) [map]
    
    * 4MB linear aperture,
      8MB mmio offset, the test is (8 > 4) [bail]
      8MB mmio offset, the test is (4 > 4) [map]
    
    For LE and BE linear aperture:
    
    * 8MB linear aperture,
      8MB mmio offset, the test is (8 > 16) [map]
    
    * 4MB linear aperture,
      8MB mmio offset, the test is (8 > 8) [map while it should not]
      8MB mmio offset, the test is (4 > 8) [map]

diff --git a/src/atipreinit.c b/src/atipreinit.c
index 00137d1..db4d574 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -1803,6 +1803,16 @@ ATIPreInit
             {
                 int AcceleratorVideoRAM = 0, ServerVideoRAM;
 
+                /*
+                 * Unless specified in PCI configuration space, set MMIO
+                 * address to tail end of linear aperture.
+                 */
+                if (pATI->MMIOInLinear)
+                {
+                    pATI->Block0Base =
+                        pATI->LinearBase + pATI->LinearSize - 0x00000400U;
+                }
+
                 AcceleratorVideoRAM = pATI->LinearSize >> 10;
 
                 /*
diff --git a/src/atividmem.c b/src/atividmem.c
index 2a7c9c1..632987a 100644
--- a/src/atividmem.c
+++ b/src/atividmem.c
@@ -255,7 +255,11 @@ ATIMapApertures
     }
     else if (pATI->Block0Base)
     {
-        CARD32 Block0Offset = pATI->Block0Base - pVideo->memBase[0];
+        unsigned long mmio_offset, linear_size;
+
+        mmio_offset = pATI->Block0Base - pVideo->memBase[0];
+
+        linear_size = (1 << pVideo->size[0]);
 
         pATI->pMMIO = NULL;
 
@@ -263,7 +267,7 @@ ATIMapApertures
          * assumes that old mach64 cards with a 4MB linear aperture do not have
          * an extended BE aperture which would give a size of 8MB.
          */
-        if (Block0Offset + 0x00000400U >= (1 << pVideo->size[0]))
+        if (mmio_offset + 0x00000400U > linear_size)
         {
             ATIUnmapLinear(iScreen, pATI);
 
@@ -279,7 +283,7 @@ ATIMapApertures
 
         pATI->Mapped = TRUE;
 
-        pATI->pBlock[0] = (char *)pATI->pMemoryLE + Block0Offset;
+        pATI->pBlock[0] = (char *)pATI->pMemoryLE + mmio_offset;
 
         if (pATI->Block1Base)
             pATI->pBlock[1] = (char *)pATI->pBlock[0] - 0x00000400U;



More information about the xorg-commit mailing list