diff options
author | Luc Verhaegen <libv@skynet.be> | 2006-03-14 21:28:42 +0000 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2006-03-14 21:28:42 +0000 |
commit | 78d6ef906c578d923594e974a555ee4439d9d0f0 (patch) | |
tree | 637bc8798146f8cf76f8c4b23138b51de4cabd50 | |
parent | a91ec627e70c7d3ce4102f2675fcb0883c86d306 (diff) |
- Kill off useless pVGA, and kill off anything that depends on
pATI->Adapter != ATI_ADAPTER_MACH64.
- Move conf poking below pci poking, and kill off some useless checking.
All the config we should really match is driver and maybe PCITag.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | src/atiprobe.c | 467 |
2 files changed, 113 insertions, 365 deletions
@@ -1,3 +1,14 @@ +2006-03-14 Luc Verhaegen <libv@skynet.be> + + * src/atiprobe.c: (ATIVGAWonderProbe), (ATIAssignVGA), + (ATIFindVGA), (ATIProbe): + + - Kill off useless pVGA, and kill off anything that depends on + pATI->Adapter != ATI_ADAPTER_MACH64. + - Move conf poking below pci poking, and kill off some useless + checking. All the config we should really match is driver and + maybe PCITag. + 2006-03-13 Luc Verhaegen <libv@skynet.be> * src/atiprobe.c: (ATIMach64Detect), (ATIProbe): diff --git a/src/atiprobe.c b/src/atiprobe.c index 5ae54d4..ee545f5 100644 --- a/src/atiprobe.c +++ b/src/atiprobe.c @@ -187,20 +187,13 @@ ATIVGAProbe * function resets pATI->CPIO_VGAWonder to zero. */ static void -ATIVGAWonderProbe -( - pciVideoPtr pVideo, - ATIPtr pATI, - ATIPtr p8514, - CARD8 *ProbeFlags -) +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: + 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" @@ -212,8 +205,7 @@ ATIVGAWonderProbe 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 %s %s.\n", pATI->CPIO_VGAWonder, - ATIBusNames[p8514->BusType], ATIAdapterNames[p8514->Adapter]); + " a 8514A.\n", pATI->CPIO_VGAWonder); pATI->CPIO_VGAWonder = 0; break; @@ -515,136 +507,38 @@ ATIMach64Probe * accelerator side. */ static void -ATIAssignVGA -( - pciVideoPtr pVideo, - ATIPtr *ppVGA, - ATIPtr pATI, - ATIPtr p8514, - CARD8 *ProbeFlags -) +ATIAssignVGA(pciVideoPtr pVideo, ATIPtr pATI, CARD8 *ProbeFlags) { - ATIPtr pVGA = *ppVGA; + CARD32 DACCntl = inr(DAC_CNTL); CARD8 OldDACMask; /* Assume unassignable VGA */ pATI->VGAAdapter = ATI_ADAPTER_NONE; - /* If no assignable VGA, return now */ - if ((pATI != pVGA) && (!pVGA || (pVGA->Adapter > ATI_ADAPTER_VGA))) - return; - - switch (pATI->Adapter) - { - case ATI_ADAPTER_8514A: - { - /* - * Assumption: Bit DISABPASSTHRU in ADVFUNC_CNTL is already - * off. - */ - OldDACMask = inb(VGA_DAC_MASK); - - if (inb(IBM_DAC_MASK) == OldDACMask) - { - outb(VGA_DAC_MASK, 0xA5U); - if (inb(IBM_DAC_MASK) == 0xA5U) - pATI->VGAAdapter = ATI_ADAPTER_VGA; - outb(VGA_DAC_MASK, OldDACMask); - } - } - break; - - case ATI_ADAPTER_MACH8: - { - CARD16 ClockSel = inw(CLOCK_SEL); - - if (ClockSel & DISABPASSTHRU) - outw(CLOCK_SEL, ClockSel & ~DISABPASSTHRU); - - ProbeWaitIdleEmpty(); - - OldDACMask = inb(VGA_DAC_MASK); - - if (inb(IBM_DAC_MASK) == OldDACMask) - { - outb(VGA_DAC_MASK, 0xA5U); - if (inb(IBM_DAC_MASK) == 0xA5U) - pATI->VGAAdapter = ATI_ADAPTER_VGA; - outb(VGA_DAC_MASK, OldDACMask); - } - - if (ClockSel & DISABPASSTHRU) - outw(CLOCK_SEL, ClockSel); - } - break; - - case ATI_ADAPTER_MACH32: - { - CARD16 ClockSel = inw(CLOCK_SEL), - MiscOptions = inw(MISC_OPTIONS); - - if (ClockSel & DISABPASSTHRU) - outw(CLOCK_SEL, ClockSel & ~DISABPASSTHRU); - if (MiscOptions & (DISABLE_VGA | DISABLE_DAC)) - outw(MISC_OPTIONS, - MiscOptions & ~(DISABLE_VGA | DISABLE_DAC)); - - ProbeWaitIdleEmpty(); - - OldDACMask = inb(VGA_DAC_MASK); - - if (inb(IBM_DAC_MASK) == OldDACMask) - { - outb(VGA_DAC_MASK, 0xA5U); - if (inb(IBM_DAC_MASK) == 0xA5U) - pATI->VGAAdapter = ATI_ADAPTER_MACH32; - outb(VGA_DAC_MASK, OldDACMask); - } - - if (ClockSel & DISABPASSTHRU) - outw(CLOCK_SEL, ClockSel); - if (MiscOptions & (DISABLE_VGA | DISABLE_DAC)) - outw(MISC_OPTIONS, MiscOptions); - } - break; - - case ATI_ADAPTER_MACH64: - { - CARD32 DACCntl = inr(DAC_CNTL); - - if (!(DACCntl & DAC_VGA_ADR_EN)) - outr(DAC_CNTL, DACCntl | DAC_VGA_ADR_EN); - - OldDACMask = inb(VGA_DAC_MASK); + if (!(DACCntl & DAC_VGA_ADR_EN)) + outr(DAC_CNTL, DACCntl | DAC_VGA_ADR_EN); + + OldDACMask = inb(VGA_DAC_MASK); + + if (in8(M64_DAC_MASK) == OldDACMask) { + outb(VGA_DAC_MASK, 0xA5U); - if (in8(M64_DAC_MASK) == OldDACMask) - { - outb(VGA_DAC_MASK, 0xA5U); - if (in8(M64_DAC_MASK) == 0xA5U) - pATI->VGAAdapter = ATI_ADAPTER_MACH64; - outb(VGA_DAC_MASK, OldDACMask); - } - - if (!(DACCntl & DAC_VGA_ADR_EN)) - outr(DAC_CNTL, DACCntl); - } - break; + if (in8(M64_DAC_MASK) == 0xA5U) { + pATI->VGAAdapter = ATI_ADAPTER_MACH64; + pATI->SharedVGA = TRUE; + } else + pATI->CPIO_VGAWonder = 0; - default: - break; + outb(VGA_DAC_MASK, OldDACMask); } - if (pATI->VGAAdapter == ATI_ADAPTER_NONE) - { - pATI->CPIO_VGAWonder = 0; - return; - } + if (!(DACCntl & DAC_VGA_ADR_EN)) + outr(DAC_CNTL, DACCntl); - if (pATI->CPIO_VGAWonder) - { - ATIVGAWonderProbe(pVideo, pATI, p8514, ProbeFlags); - if (!pATI->CPIO_VGAWonder) - { + 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 @@ -652,21 +546,9 @@ ATIAssignVGA * of I/O through the bus tree. */ pATI->CPIO_VGAWonder = GRAX; - ATIVGAWonderProbe(pVideo, pATI, p8514, ProbeFlags); + ATIVGAWonderProbe(pVideo, pATI, ProbeFlags); } } - - if (pATI == pVGA) - { - pATI->SharedVGA = TRUE; - return; - } - - /* Assign the VGA to this adapter */ - xfree(pVGA); - *ppVGA = pATI; - - xf86MsgVerb(X_INFO, 3, ATI_NAME ": VGA assigned to this adapter.\n"); } /* @@ -676,35 +558,23 @@ ATIAssignVGA * shareable. */ static void -ATIFindVGA -( - pciVideoPtr pVideo, - ATIPtr *ppVGA, - ATIPtr *ppATI, - ATIPtr p8514, - CARD8 *ProbeFlags -) +ATIFindVGA(pciVideoPtr pVideo, ATIPtr *ppATI, CARD8 *ProbeFlags) { ATIPtr pATI = *ppATI; - if (!*ppVGA) - { - /* - * An ATI PCI adapter has been detected at this point, and its VGA, if - * any, is shareable. Ensure the VGA isn't in sleep mode. - */ - outb(GENENA, 0x16U); - outb(GENVS, 0x01U); - outb(GENENA, 0x0EU); - - pATI = ATIVGAProbe(pATI); - if (pATI->VGAAdapter == ATI_ADAPTER_NONE) - return; + /* + * An ATI PCI adapter has been detected at this point, and its VGA, if + * any, is shareable. Ensure the VGA isn't in sleep mode. + */ + outb(GENENA, 0x16U); + outb(GENVS, 0x01U); + outb(GENENA, 0x0EU); - ppVGA = ppATI; - } + pATI = ATIVGAProbe(pATI); + if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + return; - ATIAssignVGA(pVideo, ppVGA, pATI, p8514, ProbeFlags); + ATIAssignVGA(pVideo, pATI, ProbeFlags); } #endif /* AVOID_CPIO */ @@ -716,11 +586,7 @@ ATIFindVGA * do a minimal probe for supported hardware. */ Bool -ATIProbe -( - DriverPtr pDriver, - int flags -) +ATIProbe(DriverPtr pDriver, int flags) { ATIPtr pATI, *ATIPtrs = NULL; GDevPtr pGDev; @@ -736,8 +602,6 @@ ATIProbe ATIChipType Chip; #ifndef AVOID_CPIO - - ATIPtr pVGA = NULL; static const IOADDRESS Mach64SparseIOBases[] = {0x02ECU, 0x01CCU, 0x01C8U}; CARD8 ProbeFlags[LongPort(SPARSE_IO_BASE) + 1]; @@ -756,64 +620,6 @@ ATIProbe (_p)->iEntity = -2; \ } while (0) - if (!(flags & PROBE_DETECT)) { - GDevPtr *GDevs; - int nGDev; - - /* - * Get a list of XF86Config device sections whose "Driver" is either - * not specified, or specified as this driver. From this list, - * eliminate those device sections that specify a "Chipset" or a - * "ChipID" not recognised by the driver. Those device sections that - * specify a "ChipRev" without a "ChipID" are also weeded out. - */ - nATIGDev = 0; - if ((nGDev = xf86MatchDevice(ATI_NAME, &GDevs)) > 0) - { - ATIGDevs = (ATIGDevPtr)xnfcalloc(nGDev, SizeOf(ATIGDev)); - - for (i = 0, pATIGDev = ATIGDevs; i < nGDev; i++) - { - pGDev = GDevs[i]; - Chipset = ATIIdentProbe(pGDev->chipset); - if (Chipset == -1) - continue; - - if ((pGDev->chipID > (int)((CARD16)(-1))) || - (pGDev->chipRev > (int)((CARD8)(-1)))) - continue; - - if (pGDev->chipID >= 0) - { - if (ATIChipID(pGDev->chipID, 0) == ATI_CHIP_Mach64) - continue; - } - else - { - if (pGDev->chipRev >= 0) - continue; - } - - pATIGDev->pGDev = pGDev; - pATIGDev->Chipset = Chipset; - nATIGDev++; - pATIGDev++; - - xf86MsgVerb(X_INFO, 3, - ATI_NAME ": Candidate \"Device\" section \"%s\".\n", - pGDev->identifier); - } - - xfree(GDevs); - - if (!nATIGDev) - { - xfree(ATIGDevs); - ATIGDevs = NULL; - } - } - } - for (i = 0; xf86PciVideoInfo[i]; i++) { pVideo = xf86PciVideoInfo[i]; @@ -910,7 +716,7 @@ ATIProbe #ifndef AVOID_CPIO if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIFindVGA(pVideo, &pVGA, &pATI, NULL, ProbeFlags); + ATIFindVGA(pVideo, &pATI, ProbeFlags); #endif /* AVOID_CPIO */ } @@ -979,155 +785,86 @@ ATIProbe } else { + GDevPtr *GDevs; + int nGDev; + /* - * Assign detected devices to XF86Config Device sections. This is done - * by comparing certain Device section specifications against the - * corresponding adapter information. Begin with those specifications - * that are independent of the adapter's bus location. + * Get a list of XF86Config device sections whose "Driver" is either + * not specified, or specified as this driver. From this list, + * eliminate those device sections that specify a "Chipset" or a + * "ChipID" not recognised by the driver. Those device sections that + * specify a "ChipRev" without a "ChipID" are also weeded out. */ - for (i = 0, pATIGDev = ATIGDevs; i < nATIGDev; i++, pATIGDev++) + nATIGDev = 0; + if ((nGDev = xf86MatchDevice(ATI_NAME, &GDevs)) > 0) { - pGDev = pATIGDev->pGDev; + ATIGDevs = (ATIGDevPtr)xnfcalloc(nGDev, SizeOf(ATIGDev)); - for (j = 0; j < nATIPtr; j++) + for (i = 0, pATIGDev = ATIGDevs; i < nGDev; i++) { - pATI = ATIPtrs[j]; - - /* - * First check the Chipset specification. The placement of - * "break" and "continue" statements here is carefully chosen - * to produce the intended behaviour for each Chipset value. - */ - switch (pATIGDev->Chipset) - { - case ATI_CHIPSET_ATI: - -#ifndef AVOID_CPIO - - if (pATI->Adapter == ATI_ADAPTER_VGA) - continue; - if (pATI->Adapter != ATI_ADAPTER_8514A) - break; - /* Fall through */ - - case ATI_CHIPSET_ATIVGA: - if (pATI->VGAAdapter == ATI_ADAPTER_VGA) - continue; - /* Fall through */ + pGDev = GDevs[i]; + Chipset = ATIIdentProbe(pGDev->chipset); + if (Chipset == -1) + continue; - case ATI_CHIPSET_IBMVGA: - if (pATI->VGAAdapter == ATI_ADAPTER_NONE) - continue; - break; + if ((pGDev->chipID > (int)((CARD16)(-1))) || + (pGDev->chipRev > (int)((CARD8)(-1)))) + continue; - case ATI_CHIPSET_VGAWONDER: - if (!pATI->CPIO_VGAWonder) - continue; - break; + if (pGDev->chipID >= 0) + { + if (ATIChipID(pGDev->chipID, 0) == ATI_CHIP_Mach64) + continue; + } + else + { + if (pGDev->chipRev >= 0) + continue; + } - case ATI_CHIPSET_IBM8514: - if (pATI->Adapter == ATI_ADAPTER_8514A) - break; - /* Fall through */ + pATIGDev->pGDev = pGDev; + pATIGDev->Chipset = Chipset; + nATIGDev++; + pATIGDev++; - case ATI_CHIPSET_MACH8: - if (pATI->Adapter == ATI_ADAPTER_MACH8) - break; - /* Fall through */ + xf86MsgVerb(X_INFO, 3, + ATI_NAME ": Candidate \"Device\" section \"%s\".\n", + pGDev->identifier); + } - case ATI_CHIPSET_MACH32: - if (pATI->Adapter == ATI_ADAPTER_MACH32) - break; - continue; + xfree(GDevs); -#endif /* AVOID_CPIO */ + if (!nATIGDev) + { + xfree(ATIGDevs); + ATIGDevs = NULL; + } + } - case ATI_CHIPSET_MACH64: - if (pATI->Adapter == ATI_ADAPTER_MACH64) - break; - continue; - default: - continue; - } + /* + * Assign detected devices to XF86Config Device sections. This is done + * by comparing certain Device section specifications against the + * corresponding adapter information. Begin with those specifications + * that are independent of the adapter's bus location. + */ + for (i = 0, pATIGDev = ATIGDevs; i < nATIGDev; i++, pATIGDev++) + { + pGDev = pATIGDev->pGDev; - /* - * The ChipID and ChipRev specifications are compared next. - * First, require these to be unspecified for anything other - * than Mach32 or Mach64 adapters. ChipRev is also required to - * be unspecified for Mach32's. ChipID is optional for - * Mach32's, and both specifications are optional for Mach64's. - * Lastly, allow both specifications to override their detected - * value in the case of Mach64 adapters whose ChipID is - * unrecognised. - */ + for (j = 0; j < nATIPtr; j++) { + pATI = ATIPtrs[j]; pVideo = pATI->PCIInfo; - if (pGDev->chipID >= 0) - { - if ((pATI->ChipType != pGDev->chipID) && - (!pVideo || (pGDev->chipID != pVideo->chipType))) - { - if ((pATI->Adapter != ATI_ADAPTER_MACH64) || - (pATI->Chip != ATI_CHIP_Mach64)) - continue; - - Chip = ATIChipID(pGDev->chipID, 0); - if ((Chip <= ATI_CHIP_264GTB) || - (Chip == ATI_CHIP_Mach64)) - continue; - } - if ((pGDev->chipRev >= 0) && - (pATI->ChipRev != pGDev->chipRev) && - (!pVideo || (pGDev->chipRev != pVideo->chipRev) || - (pGDev->chipID != pVideo->chipType))) - { - if (pATI->Chip < ATI_CHIP_264CT) - continue; - - if (pATI->Chip != ATI_CHIP_Mach64) - { - /* - * There are two foundry codes for UMC. Some - * adapters will advertise one in CONFIG_CHIP_ID - * and the other in PCI configuration space. For - * matching purposes, make both codes compare - * equal. - */ -# define UMC_IGNORE \ - (ATI_FOUNDRY_UMC ^ ATI_FOUNDRY_UMCA) -# define UMC_NOCARE \ - GetBits(SetBits(UMC_IGNORE, CFG_CHIP_FOUNDRY), \ - CFG_CHIP_REV) - - if ((pATI->ChipRev ^ pGDev->chipRev) & ~UMC_NOCARE) - continue; - - if ((pATI->ChipFoundry != ATI_FOUNDRY_UMC) && - (pATI->ChipFoundry != ATI_FOUNDRY_UMCA)) - continue; - - k = GetBits(pGDev->chipRev, - GetBits(CFG_CHIP_FOUNDRY, CFG_CHIP_REV)); - if ((k != ATI_FOUNDRY_UMC) && - (k != ATI_FOUNDRY_UMCA)) - continue; - } - } - } - /* - * IOBase is next. This is the first specification that is - * potentially dependent on bus location. It is only allowed - * for Mach64 adapters, and is optional. - */ - if (pGDev->IOBase && (pATI->CPIOBase != pGDev->IOBase)) + if (!pVideo) continue; - /* - * Compare BusID's. This specification is only allowed for PCI - * Mach32's or Mach64's and is optional. - */ - if (pVideo && pGDev->busID && pGDev->busID[0]) + /* Check chipset name if exists */ + if (pGDev->chipset && strncasecmp(pGDev->chipset, "mach64", 7)) + continue; + + /* Is this the right busID? */ + if (pGDev->busID && pGDev->busID[0]) if (!xf86ComparePciBusString(pGDev->busID, pVideo->bus, pVideo->device, pVideo->func)) continue; |