diff options
author | Luc Verhaegen <libv@skynet.be> | 2006-04-27 05:06:23 +0200 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2006-04-27 05:06:23 +0200 |
commit | 1d68ebca639b50a4f50d649567dbe62d5c9754d7 (patch) | |
tree | 1d3da49db6391694fbef80871f2d10567f70285d /src | |
parent | 75b0b49ec33fd2978a8a4e0e3a4090dfdaf46a67 (diff) |
When AVOID_CPIO, avoid using CPIO when finding out FB aperture size.
When mapping MMIO, we now go back to testing both the end of 8 and 4MB
apertures, and we stop touching CONFIG_CNTL before MMIO is mapped.
(reported by Donnie Berkholz)
Diffstat (limited to 'src')
-rw-r--r-- | src/atividmem.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/src/atividmem.c b/src/atividmem.c index 47fdb25..56618dd 100644 --- a/src/atividmem.c +++ b/src/atividmem.c @@ -212,8 +212,7 @@ Mach64MMIODetectAndMap(ATIPtr pATI) if (!pATI->pMMIO) { xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to map MMIO at " "0x%08lX.\n", pVideo->memBase[2]); - Mach64MMIOUnmap(pATI); - return FALSE; + return FALSE; } pATI->pBlock[1] = (char *)pATI->pMMIO + (pVideo->memBase[2] - Tmp); @@ -228,10 +227,18 @@ Mach64MMIODetectAndMap(ATIPtr pATI) } else { xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to get auxilliary MMIO" " aperture. BAR not set up correctly.\n"); - Mach64MMIOUnmap(pATI); return FALSE; } + + /* Verify that our MMIO range really is accessible. */ + if (!Mach64MMIOTest(pATI, pATI->pBlock[0])) { + xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to verify functionality " + "of MMIO.\n"); + Mach64MMIOUnmap(pATI); + return FALSE; + } } else { /* Gx/Cx/CT/ET have IO as the last kB of the FB aperture. */ +#ifndef AVOID_CPIO /* Check if our linear memory aperture is properly enabled */ if (!(inw(PIO_CONFIG_CNTL) & 0x3)) { CARD32 tmp = inw(PIO_CONFIG_CNTL); @@ -242,38 +249,46 @@ Mach64MMIODetectAndMap(ATIPtr pATI) } else if ((inw(PIO_CONFIG_CNTL) & 0x3) == 0x3) { xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Linear memory aperture " "has impossible size. Aborting.\n"); - Mach64MMIOUnmap(pATI); return FALSE; } +#endif - /* Check size of aperture. */ - if (((inw(PIO_CONFIG_CNTL) & 0x3) == 0x2) && (pVideo->size[0] >= 23)) + /* Here we test both 8 and 4MB apertures. Nasty logic: while loop for + * both aperture sizes, break when found or when failing on 4MB aperture + */ + if (pVideo->size[0] >= 23) Tmp = 0x00800000 - PageSize; else Tmp = 0x00400000 - PageSize; - pATI->pMMIO = xf86MapPciMem(pATI->scrnIndex, VIDMEM_MMIO, tag, + while (Tmp) { + pATI->pMMIO = xf86MapPciMem(pATI->scrnIndex, VIDMEM_MMIO, tag, pVideo->memBase[0] + Tmp, PageSize); - if (!pATI->pMMIO) { - xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to map MMIO at " - "0x%08lX.\n", pVideo->memBase[0] + Tmp); - Mach64MMIOUnmap(pATI); - return FALSE; - } + if (!pATI->pMMIO) { + xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to map MMIO at " + "0x%08lX.\n", pVideo->memBase[0] + Tmp); + return FALSE; + } + + pATI->pBlock[0] = (char *)pATI->pMMIO + PageSize - 0x400; + + if (Mach64MMIOTest(pATI, pATI->pBlock[0])) { + pATI->Block0Base = pVideo->memBase[0] + (Tmp + PageSize - 0x400); + xf86DrvMsg(pATI->scrnIndex, X_PROBED, "Using Block 0 MMIO aperture" + " at 0x%08lX.\n", pATI->Block0Base); + break; + } - pATI->pBlock[0] = (char *)pATI->pMMIO + PageSize - 0x400; + Mach64MMIOUnmap(pATI); - pATI->Block0Base = pVideo->memBase[0] + (Tmp + PageSize - 0x400); - xf86DrvMsg(pATI->scrnIndex, X_PROBED, "Using Block 0 MMIO aperture" - " at 0x%08lX.\n", pATI->Block0Base); - } + if (Tmp <= 0x00400000) { + xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to verify" + " functionality of MMIO.\n"); + break; + } - /* Verify that our MMIO range really is accessible. */ - if (!Mach64MMIOTest(pATI, pATI->pBlock[0])) { - xf86DrvMsg(pATI->scrnIndex, X_ERROR, "Unable to verify functionality " - "of MMIO.\n"); - Mach64MMIOUnmap(pATI); - return FALSE; + Tmp = 0x00400000 - PageSize; + } } #if 0 |