xf86-video-ati: Branch 'pci-rework' - 2 commits
George Sapountzis
gsap7 at kemper.freedesktop.org
Tue Mar 20 22:26:25 EET 2007
src/atipreinit.c | 118 +++++++++++++++++++++----------------------------------
1 files changed, 47 insertions(+), 71 deletions(-)
New commits:
diff-tree a82c56230a8e2b80641ba80a368efde4fcca7208 (from 9ceee85a37e345255ae133e3e8f9e8c4e7b6cc2c)
Author: George Sapountzis <gsap7 at yahoo.gr>
Date: Mon Mar 19 19:05:04 2007 +0200
[mach64] Compute MMIO address once for each case (PIO, MMIO).
For an MMIO-only driver, the extra MMIO address probing is not needed since we
already compute the MMIO address during probe and do not make any BIOS calls.
For a PIO driver, this extra probing could even result in a wrong MMIO address
since the checking is done by reading through PIO, not MMIO. The MMIO address
is later corrected but having the extra probe there is useless.
diff --git a/src/atipreinit.c b/src/atipreinit.c
index f63784f..92528f6 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -100,24 +100,6 @@ static const rgb defaultWeight = {0, 0
static const Gamma defaultGamma = {0.0, 0.0, 0.0};
/*
- * ATIMach64Map --
- *
- * This function attempts to mmap() a Mach64's MMIO aperture.
- */
-static void
-ATIMach64Map
-(
- int iScreen,
- ATIPtr pATI
-)
-{
- (void)ATIMapApertures(iScreen, pATI);
- if (!pATI->pBlock[0] ||
- (pATI->config_chip_id != inr(CONFIG_CHIP_ID)))
- ATIUnmapApertures(iScreen, pATI);
-}
-
-/*
* ATIPrintNoiseIfRequested --
*
* This function formats debugging information on the server's stderr when
@@ -174,7 +156,6 @@ ATIPreInit
resPtr pResources;
pciVideoPtr pVideo;
DisplayModePtr pMode;
- unsigned long Block0Base;
CARD32 IOValue;
int i, j;
int Numerator, Denominator;
@@ -401,6 +382,8 @@ ATIPreInit
return TRUE;
}
+#ifndef AVOID_CPIO
+
/* I/O bases might no longer be valid after BIOS initialisation */
{
if (pATI->CPIODecoding == BLOCK_IO)
@@ -415,6 +398,8 @@ ATIPreInit
}
}
+#endif /* AVOID_CPIO */
+
#ifdef AVOID_CPIO
pScreenInfo->racMemFlags =
@@ -437,38 +422,17 @@ ATIPreInit
/* Finish probing the adapter */
{
-
- Block0Base = pATI->Block0Base; /* save */
-
- do
- {
- /*
- * Find and mmap() MMIO area. Allow only auxiliary aperture if
- * it exists.
- */
- if (!pATI->Block0Base)
- {
- /* Check tail end of linear (8MB or 4MB) aperture */
- if ((pATI->Block0Base = PCI_REGION_BASE(pVideo, 0, REGION_MEM)))
- {
- pATI->MMIOInLinear = TRUE;
-
- pATI->Block0Base += 0x007FFC00U;
- ATIMach64Map(pScreenInfo->scrnIndex, pATI);
- if (pATI->pBlock[0])
- break;
-
- pATI->Block0Base -= 0x00400000U;
- ATIMach64Map(pScreenInfo->scrnIndex, pATI);
- if (pATI->pBlock[0])
- break;
- }
- }
-
- ATIMach64Map(pScreenInfo->scrnIndex, pATI);
- } while (0);
-
- pATI->Block0Base = Block0Base; /* restore */
+ /*
+ * For MMIO register access, the MMIO address is computed when probing
+ * and there are no BIOS calls. This mapping should always succeed.
+ *
+ * For CPIO register access, the MMIO address is computed above in the
+ * presence of an auxiliary aperture. Otherwise, it is set to zero and
+ * gets computed when we read the linear aperture configuration. This
+ * mapping is either irrelevant or a no-op.
+ */
+ if (!ATIMapApertures(pScreenInfo->scrnIndex, pATI))
+ return FALSE;
#ifdef AVOID_CPIO
@@ -481,15 +445,24 @@ ATIPreInit
#endif /* AVOID_CPIO */
+ /*
+ * Verify register access by comparing against the CONFIG_CHIP_ID
+ * value saved by adapter detection.
+ */
+ if (pATI->config_chip_id != inr(CONFIG_CHIP_ID))
+ {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
+ "Adapter registers not mapped correctly.\n");
+ goto bail_locked;
+ }
+
pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL);
if (!(pATIHW->crtc_gen_cntl & CRTC_EN) &&
(pATI->Chip >= ATI_CHIP_264CT))
{
xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
"Adapter has not been initialised.\n");
- ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
- ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
- return FALSE;
+ goto bail_locked;
}
#ifdef AVOID_CPIO
@@ -499,9 +472,7 @@ ATIPreInit
xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
"Adapters found to be in VGA mode on server entry are not"
" supported by the MMIO-only version of this driver.\n");
- ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
- ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
- return FALSE;
+ goto bail_locked;
}
#endif /* AVOID_CPIO */
@@ -1810,7 +1781,7 @@ ATIPreInit
{
int AcceleratorVideoRAM = 0, ServerVideoRAM;
- pATI->MMIOInLinear = FALSE;
+#ifndef AVOID_CPIO
/*
* Unless specified in PCI configuration space, set MMIO
@@ -1823,6 +1794,8 @@ ATIPreInit
pATI->MMIOInLinear = TRUE;
}
+#endif /* AVOID_CPIO */
+
AcceleratorVideoRAM = pATI->LinearSize >> 10;
/*
@@ -2479,6 +2452,8 @@ ATIPreInit
bail:
ATILock(pATI);
+
+bail_locked:
ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize);
ATIUnmapApertures(pScreenInfo->scrnIndex, pATI);
diff-tree 9ceee85a37e345255ae133e3e8f9e8c4e7b6cc2c (from 3fd14c8094c30076c380dedbbb0709b6a6a870c1)
Author: George Sapountzis <gsap7 at yahoo.gr>
Date: Mon Mar 19 19:04:10 2007 +0200
[mach64] Move setting of PIO and MMIO addresses up, after BIOS init.
Partially revert "Minor refactoring of pATI->Block0Base computation."
This parially reverts commit 2c8b33b761e4411451aea1eea3a89d629aeea40d.
diff --git a/src/atipreinit.c b/src/atipreinit.c
index 62fd660..f63784f 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -401,6 +401,20 @@ ATIPreInit
return TRUE;
}
+ /* I/O bases might no longer be valid after BIOS initialisation */
+ {
+ if (pATI->CPIODecoding == BLOCK_IO)
+ pATI->CPIOBase = PCI_REGION_BASE(pVideo, 1, REGION_IO);
+
+ pATI->MMIOInLinear = FALSE;
+
+ /* Set MMIO address from PCI configuration space, if available */
+ if ((pATI->Block0Base = PCI_REGION_BASE(pVideo, 2, REGION_MEM)))
+ {
+ pATI->Block0Base += 0x0400U;
+ }
+ }
+
#ifdef AVOID_CPIO
pScreenInfo->racMemFlags =
@@ -423,19 +437,6 @@ ATIPreInit
/* Finish probing the adapter */
{
- /* I/O bases might no longer be valid after BIOS initialisation */
-
- /* Set CPIO address from PCI configuration space, for block I/O */
- if (pATI->CPIODecoding == BLOCK_IO)
- pATI->CPIOBase = PCI_REGION_BASE(pVideo, 1, REGION_IO);
-
- pATI->MMIOInLinear = FALSE;
-
- /* Set MMIO address from PCI configuration space, if available */
- if ((pATI->Block0Base = PCI_REGION_BASE(pVideo, 2, REGION_MEM)))
- {
- pATI->Block0Base += 0x0400U;
- }
Block0Base = pATI->Block0Base; /* save */
More information about the xorg-commit
mailing list