summaryrefslogtreecommitdiff
path: root/src/atipreinit.c
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2006-12-27 17:59:14 +0200
committerGeorge Sapountzis <gsap7@yahoo.gr>2007-01-28 01:24:22 +0200
commit3654b786f1ad1f4e6bfb2fff5ff057254958f7c0 (patch)
treee800da3bea280b0efbe6a6a4d3635a04ba39ba51 /src/atipreinit.c
parent0117c9bde0d0bbb487bc259cf55e8066ebd63f6a (diff)
Sane probe, based on work by Luc Verhaegen <libv@skynet.be>.
Diffstat (limited to 'src/atipreinit.c')
-rw-r--r--src/atipreinit.c70
1 files changed, 29 insertions, 41 deletions
diff --git a/src/atipreinit.c b/src/atipreinit.c
index cb5ba13..5d80d27 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -54,6 +54,20 @@
#include "xf86RAC.h"
/*
+ * FreeScreen handles the clean-up.
+ */
+static Bool
+Mach64GetRec(ScrnInfoPtr pScrn)
+{
+ if (!pScrn->driverPrivate) {
+ pScrn->driverPrivate = xnfcalloc(sizeof(ATIRec), 1);
+ memset(pScrn->driverPrivate, 0, sizeof(ATIRec));
+ }
+
+ return TRUE;
+}
+
+/*
* ATIReportMemory --
*
* This function reports on the amount and type of video memory found.
@@ -190,20 +204,22 @@ ATIPreInit
return FALSE;
}
- pATI = ATIPTR(pScreenInfo);
-
- if (pATI->iEntity != pScreenInfo->entityList[0])
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
- "Logic error: Entity mismatch.\n");
+ if (!Mach64GetRec(pScreenInfo))
return FALSE;
- }
+
+ pATI = ATIPTR(pScreenInfo);
/* Register resources */
- pEntity = xf86GetEntityInfo(pATI->iEntity);
+ pEntity = xf86GetEntityInfo(pScreenInfo->entityList[0]);
pGDev = pEntity->device;
pResources = pEntity->resources;
+
+ pATI->iEntity = pEntity->index;
+ pATI->Chip = pEntity->chipset;
+ pVideo = xf86GetPciInfoForEntity(pATI->iEntity);
+
xfree(pEntity);
+
if (!pResources)
pResources = xf86RegisterResources(pATI->iEntity, NULL, ResShared);
if (pResources)
@@ -301,6 +317,11 @@ ATIPreInit
ATIProcessOptions(pScreenInfo, pATI);
}
+ if (!ATIMach64ProbeIO(pVideo, pATI))
+ return FALSE;
+
+ ATIClaimBusSlot(pGDev->active, pATI);
+
#ifndef AVOID_CPIO
#ifdef TV_OUT
@@ -425,39 +446,6 @@ ATIPreInit
#endif /* AVOID_CPIO */
- /* Deal with ChipID & ChipRev overrides */
- if (pGDev->chipID >= 0)
- {
- ATIChipType Chip;
-
- Chip = ATIChipID(pGDev->chipID,
- (pGDev->chipRev < 0) ? pATI->ChipRev : pGDev->chipRev);
- if (Chip != pATI->Chip)
- {
- pATI->Chip = Chip;
- pATI->ChipType = pGDev->chipID;
- if (pGDev->chipRev < 0)
- {
- xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
- "Driver messages reflect ChipID 0x%04X override.\n",
- pATI->ChipType);
- }
- else
- {
- pATI->ChipRev = pGDev->chipRev;
- pATI->ChipVersion = GetBits(pATI->ChipRev,
- GetBits(CFG_CHIP_VERSION, CFG_CHIP_REV));
- pATI->ChipFoundry = GetBits(pATI->ChipRev,
- GetBits(CFG_CHIP_FOUNDRY, CFG_CHIP_REV));
- pATI->ChipRevision = GetBits(pATI->ChipRev,
- GetBits(CFG_CHIP_REVISION, CFG_CHIP_REV));
- xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
- "Driver messages reflect ChipID 0x%04X and ChipRev 0x%02X"
- " overrides.\n", pATI->ChipType, pATI->ChipRev);
- }
- }
- }
-
/* Finish private area initialisation */
pATI->DAC = ATI_DAC_GENERIC;