summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2006-03-15 12:27:16 +0000
committerLuc Verhaegen <libv@skynet.be>2006-03-15 12:27:16 +0000
commite8e449f51463f8816cd5369d2a20a70b813f63ad (patch)
tree11f8f2de6baffda2132c4c02e0a090f5ea108fd4
parent78d6ef906c578d923594e974a555ee4439d9d0f0 (diff)
Clean up ProbeFlags and SparseIOBase poking.
-rw-r--r--ChangeLog7
-rw-r--r--src/atiprobe.c190
2 files changed, 14 insertions, 183 deletions
diff --git a/ChangeLog b/ChangeLog
index eeb6fbf..1ec1a52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-15 Luc Verhaegen <libv@skynet.be>
+
+ * src/atiprobe.c: (ATIVGAProbe), (ATIAssignVGA), (ATIFindVGA),
+ (ATIProbe):
+
+ Clean up ProbeFlags and SparseIOBase poking.
+
2006-03-14 Luc Verhaegen <libv@skynet.be>
* src/atiprobe.c: (ATIVGAWonderProbe), (ATIAssignVGA),
diff --git a/src/atiprobe.c b/src/atiprobe.c
index ee545f5..f250f94 100644
--- a/src/atiprobe.c
+++ b/src/atiprobe.c
@@ -69,77 +69,13 @@ typedef struct _ATIGDev
#ifndef AVOID_CPIO
/*
- * Definitions for I/O conflict avoidance.
- */
-#define LongPort(_Port) GetBits(_Port, PCIGETIO(SPARSE_IO_BASE))
-#define DetectedVGA (1 << 0)
-#define Detected8514A (1 << 1)
-#define DetectedMach64 (1 << 2)
-#define Allowed (1 << 3)
-#define DoProbe (1 << 4)
-typedef struct
-{
- IOADDRESS Base;
- CARD8 Size;
- CARD8 Flag;
-} PortRec, *PortPtr;
-
-/*
- * ATICheckSparseIOBases --
- *
- * This function checks whether a sparse I/O base can safely be probed.
- */
-static CARD8
-ATICheckSparseIOBases
-(
- pciVideoPtr pVideo,
- CARD8 *ProbeFlags,
- const IOADDRESS IOBase,
- const int Count,
- const Bool Override
-)
-{
- CARD32 FirstPort, LastPort;
-
- if (!pVideo || !xf86IsPrimaryPci(pVideo))
- {
- FirstPort = LongPort(IOBase);
- LastPort = LongPort(IOBase + Count - 1);
-
- for (; FirstPort <= LastPort; FirstPort++)
- {
- CARD8 ProbeFlag = ProbeFlags[FirstPort];
-
- if (ProbeFlag & DoProbe)
- continue;
-
- if (!(ProbeFlag & Allowed))
- return ProbeFlag;
-
- if (Override)
- continue;
-
- /* User might wish to override this decision */
- xf86Msg(X_WARNING,
- ATI_NAME ": Sparse I/O base 0x%04lX not probed.\n", IOBase);
- return Allowed;
- }
- }
-
- return DoProbe;
-}
-
-/*
* ATIVGAProbe --
*
* This function looks for an IBM standard VGA, or clone, and sets
* pATI->VGAAdapter if one is found.
*/
static ATIPtr
-ATIVGAProbe
-(
- ATIPtr pVGA
-)
+ATIVGAProbe(ATIPtr pVGA)
{
CARD8 IOValue1, IOValue2, IOValue3;
@@ -179,93 +115,6 @@ ATIVGAProbe
return pVGA;
}
-/*
- * ATIVGAWonderProbe --
- *
- * This function determines if ATI extended VGA registers can be accessed
- * through the I/O port specified by pATI->CPIO_VGAWonder. If not, the
- * function resets pATI->CPIO_VGAWonder to zero.
- */
-static void
-ATIVGAWonderProbe(pciVideoPtr pVideo, ATIPtr pATI, CARD8 *ProbeFlags)
-{
- CARD8 IOValue1, IOValue2, IOValue3, IOValue4, IOValue5, IOValue6;
-
- switch (ATICheckSparseIOBases(pVideo, ProbeFlags,
- pATI->CPIO_VGAWonder, 2, TRUE)){
- case 0:
- xf86Msg(X_WARNING,
- ATI_NAME ": Expected VGA Wonder capability could not be"
- " detected at I/O port 0x%04lX because it would conflict with"
- " a non-video PCI/AGP device.\n", pATI->CPIO_VGAWonder);
- pATI->CPIO_VGAWonder = 0;
- break;
-
- case Detected8514A:
- xf86Msg(X_WARNING,
- ATI_NAME ": Expected VGA Wonder capability could not be"
- " detected at I/O port 0x%04lX because it would conflict with"
- " a 8514A.\n", pATI->CPIO_VGAWonder);
- pATI->CPIO_VGAWonder = 0;
- break;
-
- case DetectedMach64:
- xf86Msg(X_WARNING,
- ATI_NAME ": Expected VGA Wonder capability could not be"
- " detected at I/O port 0x%04lX because it would conflict with"
- " a Mach64.\n", pATI->CPIO_VGAWonder);
- pATI->CPIO_VGAWonder = 0;
- break;
-
- case DetectedVGA:
- default: /* Must be DoProbe */
- if (pVideo && !xf86IsPrimaryPci(pVideo) &&
- (pATI->Chip <= ATI_CHIP_88800GXD))
- {
- /* Set up extended VGA register addressing */
- PutReg(GRAX, 0x50U, GetByte(pATI->CPIO_VGAWonder, 0));
- PutReg(GRAX, 0x51U,
- GetByte(pATI->CPIO_VGAWonder, 1) | pATI->VGAOffset);
- }
- /*
- * Register 0xBB is used by the BIOS to keep track of various
- * things (monitor type, etc.). Except for 18800-x's, register
- * 0xBC must be zero and causes the adapter to enter a test mode
- * when written to with a non-zero value.
- */
- IOValue1 = inb(pATI->CPIO_VGAWonder);
- IOValue2 = ATIGetExtReg(IOValue1);
- IOValue3 = ATIGetExtReg(0xBBU);
- ATIPutExtReg(0xBBU, IOValue3 ^ 0xAAU);
- IOValue4 = ATIGetExtReg(0xBBU);
- ATIPutExtReg(0xBBU, IOValue3 ^ 0x55U);
- IOValue5 = ATIGetExtReg(0xBBU);
- ATIPutExtReg(0xBBU, IOValue3);
- if (pATI->Chip <= ATI_CHIP_18800_1)
- IOValue6 = 0;
- else
- IOValue6 = ATIGetExtReg(0xBCU);
- ATIPutExtReg(IOValue1, IOValue2);
-
- if ((IOValue4 == (IOValue3 ^ 0xAAU)) &&
- (IOValue5 == (IOValue3 ^ 0x55U)) &&
- (IOValue6 == 0))
- {
- xf86MsgVerb(X_INFO, 3,
- ATI_NAME ": VGA Wonder at I/O port 0x%04lX detected.\n",
- pATI->CPIO_VGAWonder);
- }
- else
- {
- xf86Msg(X_WARNING,
- ATI_NAME ": Expected VGA Wonder capability at I/O port"
- " 0x%04lX was not detected.\n", pATI->CPIO_VGAWonder);
- pATI->CPIO_VGAWonder = 0;
- }
- break;
- }
-}
-
#endif /* AVOID_CPIO */
/*
@@ -507,13 +356,15 @@ ATIMach64Probe
* accelerator side.
*/
static void
-ATIAssignVGA(pciVideoPtr pVideo, ATIPtr pATI, CARD8 *ProbeFlags)
+ATIAssignVGA(pciVideoPtr pVideo, ATIPtr pATI)
{
CARD32 DACCntl = inr(DAC_CNTL);
CARD8 OldDACMask;
/* Assume unassignable VGA */
pATI->VGAAdapter = ATI_ADAPTER_NONE;
+ if (pATI->CPIO_VGAWonder)
+ pATI->CPIO_VGAWonder = 0;
if (!(DACCntl & DAC_VGA_ADR_EN))
outr(DAC_CNTL, DACCntl | DAC_VGA_ADR_EN);
@@ -534,21 +385,6 @@ ATIAssignVGA(pciVideoPtr pVideo, ATIPtr pATI, CARD8 *ProbeFlags)
if (!(DACCntl & DAC_VGA_ADR_EN))
outr(DAC_CNTL, DACCntl);
-
- if (pATI->CPIO_VGAWonder) {
- ATIVGAWonderProbe(pVideo, pATI, ProbeFlags);
-
- if (!pATI->CPIO_VGAWonder) {
- /*
- * Some adapters are reputed to append ATI extended VGA registers
- * to the VGA Graphics controller registers. In particular, 0x01CE
- * cannot, in general, be used in a PCI environment due to routing
- * of I/O through the bus tree.
- */
- pATI->CPIO_VGAWonder = GRAX;
- ATIVGAWonderProbe(pVideo, pATI, ProbeFlags);
- }
- }
}
/*
@@ -558,7 +394,7 @@ ATIAssignVGA(pciVideoPtr pVideo, ATIPtr pATI, CARD8 *ProbeFlags)
* shareable.
*/
static void
-ATIFindVGA(pciVideoPtr pVideo, ATIPtr *ppATI, CARD8 *ProbeFlags)
+ATIFindVGA(pciVideoPtr pVideo, ATIPtr *ppATI)
{
ATIPtr pATI = *ppATI;
@@ -574,7 +410,7 @@ ATIFindVGA(pciVideoPtr pVideo, ATIPtr *ppATI, CARD8 *ProbeFlags)
if (pATI->VGAAdapter == ATI_ADAPTER_NONE)
return;
- ATIAssignVGA(pVideo, pATI, ProbeFlags);
+ ATIAssignVGA(pVideo, pATI);
}
#endif /* AVOID_CPIO */
@@ -603,8 +439,6 @@ ATIProbe(DriverPtr pDriver, int flags)
#ifndef AVOID_CPIO
static const IOADDRESS Mach64SparseIOBases[] = {0x02ECU, 0x01CCU, 0x01C8U};
- CARD8 ProbeFlags[LongPort(SPARSE_IO_BASE) + 1];
-
#endif /* AVOID_CPIO */
/* We only do PCI from now on. */
@@ -674,16 +508,6 @@ ATIProbe(DriverPtr pDriver, int flags)
continue;
}
- if (ATICheckSparseIOBases(pVideo, ProbeFlags,
- Mach64SparseIOBases[j], 4, TRUE) == 0) {
- xf86Msg(X_WARNING,
- ATI_NAME ": Mach64 at %d:%d:%d will not"
- " be enabled\n because it conflicts with another"
- " non-video PCI device.\n",
- pVideo->bus, pVideo->device, pVideo->func);
- continue;
- }
-
/* Possibly fix block I/O indicator */
if (PciReg & 0x00000004U)
pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, PciReg & ~0x00000004U);
@@ -716,7 +540,7 @@ ATIProbe(DriverPtr pDriver, int flags)
#ifndef AVOID_CPIO
if (pATI->VGAAdapter != ATI_ADAPTER_NONE)
- ATIFindVGA(pVideo, &pATI, ProbeFlags);
+ ATIFindVGA(pVideo, &pATI);
#endif /* AVOID_CPIO */
}