diff options
author | Luc Verhaegen <libv@skynet.be> | 2006-03-13 00:16:22 +0000 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2006-03-13 00:16:22 +0000 |
commit | a91ec627e70c7d3ce4102f2675fcb0883c86d306 (patch) | |
tree | 656e8cf2e3096d770f4cad20b5cb3a86d228adef | |
parent | 2dd64279f07c09583c747db58f226dbfa5949486 (diff) |
Reorganise all actual device probing in Probe. Now the list of all pci
devices (i known) is only run down once.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/atiprobe.c | 268 | ||||
-rw-r--r-- | src/atistruct.h | 1 |
3 files changed, 100 insertions, 177 deletions
@@ -1,3 +1,11 @@ +2006-03-13 Luc Verhaegen <libv@skynet.be> + + * src/atiprobe.c: (ATIMach64Detect), (ATIProbe): + * src/atistruct.h: + + Reorganise all actual device probing in Probe. Now the list + of all pci devices (i known) is only run down once. + 2006-03-12 Luc Verhaegen <libv@skynet.be> * src/atibus.c: (ATIClaimResources): diff --git a/src/atiprobe.c b/src/atiprobe.c index b417c5b..5ae54d4 100644 --- a/src/atiprobe.c +++ b/src/atiprobe.c @@ -55,9 +55,6 @@ * largely ignored. */ -/* Used as a temporary buffer */ -#define Identifier ((char *)(pATI->MMIOCache)) - /* * An internal structure definition to facilitate the matching of detected * adapters to XF86Config Device sections. @@ -359,10 +356,6 @@ ATIMach64Detect return FALSE; } - /* Determine legacy BIOS address */ - pATI->BIOSBase = 0x000C0000U + - (GetBits(inr(SCRATCH_REG1), BIOS_BASE_SEGMENT) << 11); - ATIUnmapApertures(-1, pATI); pATI->PCIInfo = NULL; return TRUE; @@ -821,185 +814,109 @@ ATIProbe } } - if (nATIGDev) { + for (i = 0; xf86PciVideoInfo[i]; i++) { + pVideo = xf86PciVideoInfo[i]; + + if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) + continue; + + if (pVideo->vendor != PCI_VENDOR_ATI) + continue; -#ifndef AVOID_CPIO + /* Is this a mach64? */ + Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); + if ((Chip < ATI_CHIP_88800GXC) || (Chip > ATI_CHIP_Mach64)) + continue; - /* Next, look for sparse I/O Mach64's */ - for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { - if ((pVideo->vendor != PCI_VENDOR_ATI) || - (pVideo->chipType == PCI_CHIP_MACH32) || - pVideo->size[1]) - continue; + /* Check if this one has already been detected */ + for (j = 0; j < nATIPtr; j++) { + pATI = ATIPtrs[j]; + + /* Block IO? */ + if ((pVideo->size[1]) && (pATI->CPIOBase == pVideo->ioBase[1])) { + pATI->PCIInfo = pVideo; + goto SkipThisSlot; + } + + if (pATI->PCIInfo == pVideo) + goto SkipThisSlot; + } + xf86SetPciVideo(pVideo, MEM_IO); + + /* block IO? */ + if (pVideo->size[1]) { + pATI = ATIMach64Probe(pVideo, pVideo->ioBase[1], BLOCK_IO, Chip); + if (pATI) + xf86MsgVerb(X_INFO, 3, ATI_NAME ": Mach64 detected at %d:%d:%d.\n", + pVideo->bus, pVideo->device, pVideo->func); + } else { + +#ifndef AVOID_CPIO pPCI = pVideo->thisCard; if (pPCI == NULL) continue; - + PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); j = PciReg & 0x03U; if (j == 0x03U) { xf86Msg(X_WARNING, - ATI_NAME ": PCI Mach64 in slot %d:%d:%d cannot be" + ATI_NAME ": Mach64 at %d:%d:%d cannot be" " enabled\n because it has neither a block, nor a" " sparse, I/O base.\n", pVideo->bus, pVideo->device, pVideo->func); - } else - switch(ATICheckSparseIOBases(pVideo, ProbeFlags, - Mach64SparseIOBases[j], 4, TRUE)) { - case 0: - xf86Msg(X_WARNING, - ATI_NAME ": PCI Mach64 in slot %d:%d:%d will not" - " be enabled\n because it conflicts with another" - " non-video PCI device.\n", - pVideo->bus, pVideo->device, pVideo->func); - break; - default: /* Must be DoProbe */ - if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) - continue; - - /* Possibly fix block I/O indicator */ - if (PciReg & 0x00000004U) - pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, - PciReg & ~0x00000004U); - - xf86SetPciVideo(pVideo, MEM_IO); - - Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); - pATI = ATIMach64Probe(pVideo, Mach64SparseIOBases[j], - SPARSE_IO, Chip); - if (!pATI) { - xf86Msg(X_WARNING, - ATI_NAME ": PCI Mach64 in slot %d:%d:%d could" - " not be detected!\n", - pVideo->bus, pVideo->device, pVideo->func); - } else { - sprintf(Identifier, - "Shared PCI Mach64 in slot %d:%d:%d", - pVideo->bus, pVideo->device, pVideo->func); - xf86MsgVerb(X_INFO, 3, - ATI_NAME ": %s with sparse PIO base 0x%04lX" - " detected.\n", Identifier, - Mach64SparseIOBases[j]); - AddAdapter(pATI); - pATI->SharedAccelerator = TRUE; - pATI->PCIInfo = pVideo; - - if (pATI->VGAAdapter != ATI_ADAPTER_NONE) - ATIFindVGA(pVideo, &pVGA, &pATI, NULL, ProbeFlags); - } - - xf86SetPciVideo(NULL, NONE); - break; - } - } - -#else /* AVOID_CPIO */ - - for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { - if ((pVideo->vendor != PCI_VENDOR_ATI) || - (pVideo->chipType == PCI_CHIP_MACH32) || - pVideo->size[1]) continue; - - /* Check if this one has already been detected */ - for (j = 0; j < nATIPtr; j++) { - pATI = ATIPtrs[j]; - if (pATI->PCIInfo == pVideo) - goto SkipThisSlot; } - if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) - continue; - - xf86SetPciVideo(pVideo, MEM_IO); - - Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); - - /* The adapter's CPIO base is of little concern here */ - pATI = ATIMach64Probe(pVideo, 0, SPARSE_IO, Chip); - if (pATI) { - sprintf(Identifier, "Shared PCI Mach64 in slot %d:%d:%d", - pVideo->bus, pVideo->device, pVideo->func); - xf86MsgVerb(X_INFO, 3, - ATI_NAME ": %s with Block 0 base 0x%08lX detected.\n", - Identifier, pATI->Block0Base); - AddAdapter(pATI); - pATI->SharedAccelerator = TRUE; - pATI->PCIInfo = pVideo; - } else { + if (ATICheckSparseIOBases(pVideo, ProbeFlags, + Mach64SparseIOBases[j], 4, TRUE) == 0) { xf86Msg(X_WARNING, - ATI_NAME ": PCI Mach64 in slot %d:%d:%d could not be" - " detected!\n", + 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; } - xf86SetPciVideo(NULL, NONE); - - SkipThisSlot:; - } - + /* Possibly fix block I/O indicator */ + if (PciReg & 0x00000004U) + pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, PciReg & ~0x00000004U); + + pATI = ATIMach64Probe(pVideo, Mach64SparseIOBases[j], SPARSE_IO, Chip); + if (pATI) + xf86MsgVerb(X_INFO, 3, ATI_NAME ": Mach64 detected at %d:%d:%d" + " with sparse PIO base 0x%04lX detected.\n", + pVideo->bus, pVideo->device, pVideo->func, + Mach64SparseIOBases[j]); +#else + /* The adapter's CPIO base is of little concern here */ + pATI = ATIMach64Probe(pVideo, 0, SPARSE_IO, Chip); + if (pATI) + xf86MsgVerb(X_INFO, 3, ATI_NAME ": Mach64 detected at %d:%d:%d" + " with Block 0 base 0x%08lX detected.\n", + pVideo->bus, pVideo->device, pVideo->func, + pATI->Block0Base); #endif /* AVOID_CPIO */ - - } - - /* Lastly, look for block I/O devices */ - for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { - if ((pVideo->vendor != PCI_VENDOR_ATI) || - (pVideo->chipType == PCI_CHIP_MACH32) || - !pVideo->size[1]) - continue; - - /* Check for Rage128's, Radeon's and later adapters */ - Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); - if (Chip > ATI_CHIP_Mach64) - continue; - - if (!nATIGDev) - continue; - - /* Check if this one has already been detected */ - for (j = 0; j < nATIPtr; j++) { - pATI = ATIPtrs[j]; - if (pATI->CPIOBase == pVideo->ioBase[1]) - goto SetPCIInfo; } - if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) - continue; - - /* Probe for it */ - xf86SetPciVideo(pVideo, MEM_IO); - - pATI = ATIMach64Probe(pVideo, pVideo->ioBase[1], BLOCK_IO, Chip); - if (pATI) { - sprintf(Identifier, "Shared PCI/AGP Mach64 in slot %d:%d:%d", - pVideo->bus, pVideo->device, pVideo->func); - xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", - Identifier); + if (!pATI) { + xf86Msg(X_WARNING, ATI_NAME ": Mach64 at %d:%d:%d could not be" + " detected!\n", pVideo->bus, pVideo->device, pVideo->func); + } else { AddAdapter(pATI); + pATI->SharedAccelerator = TRUE; - + pATI->PCIInfo = pVideo; + #ifndef AVOID_CPIO - if (pATI->VGAAdapter != ATI_ADAPTER_NONE) ATIFindVGA(pVideo, &pVGA, &pATI, NULL, ProbeFlags); - #endif /* AVOID_CPIO */ - } - + xf86SetPciVideo(NULL, NONE); - if (!pATI) { - xf86Msg(X_WARNING, - ATI_NAME ": PCI/AGP Mach64 in slot %d:%d:%d could not be" - " detected!\n", pVideo->bus, pVideo->device, pVideo->func); - continue; - } - - SetPCIInfo: - pATI->PCIInfo = pVideo; + SkipThisSlot:; } /* @@ -1256,14 +1173,12 @@ ATIProbe if (j <= 0) continue; - for (k = i; ++k < nATIGDev; ) - { - if (j == ATIGDevs[k].iATIPtr) - { - xf86Msg(X_ERROR, - ATI_NAME ": XF86Config Device sections \"%s\" and" - " \"%s\" may not be assigned to the same adapter.\n", - pGDev->identifier, ATIGDevs[k].pGDev->identifier); + for (k = i; ++k < nATIGDev; ) { + if (j == ATIGDevs[k].iATIPtr) { + xf86Msg(X_ERROR, ATI_NAME ": XF86Config Device sections " + "\"%s\" and \"%s\" may not be assigned to the same " + "adapter.\n", pGDev->identifier, + ATIGDevs[k].pGDev->identifier); pATIGDev->iATIPtr = ATIGDevs[k].iATIPtr = -1; } } @@ -1274,27 +1189,28 @@ ATIProbe pATI = ATIPtrs[j - 1]; - xf86MsgVerb(X_INFO, 3, - ATI_NAME ": %s assigned to %sactive \"Device\" section" - " \"%s\".\n", - Identifier, pGDev->active ? "" : "in", pGDev->identifier); + if (!pATI->PCIInfo) + continue; + pVideo = pATI->PCIInfo; + + xf86MsgVerb(X_INFO, 3, ATI_NAME ": Mach64 at %d:%d:%d assigned to " + "%sactive \"Device\" section \"%s\".\n", pVideo->bus, + pVideo->device, pVideo->func, + pGDev->active ? "" : "in", pGDev->identifier); /* * Attach adapter to XF86Config Device section and register its * resources. */ - pVideo = pATI->PCIInfo; - - if (pVideo) - pATI->iEntity = xf86ClaimPciSlot(pVideo->bus, pVideo->device, - pVideo->func, pDriver, - pATIGDev->Chipset, pGDev, - pGDev->active); + pATI->iEntity = xf86ClaimPciSlot(pVideo->bus, pVideo->device, + pVideo->func, pDriver, + pATIGDev->Chipset, pGDev, + pGDev->active); - if (!pVideo || (pATI->iEntity < 0)) { + if (pATI->iEntity < 0) { xf86Msg(X_ERROR, - ATI_NAME ": Could not claim bus slot for %s.\n", - Identifier); + ATI_NAME ": Could not claim bus slot for %d:%d:%d.\n", + pVideo->bus, pVideo->device, pVideo->func); continue; } else ATIClaimResources(pATI, pGDev->active); diff --git a/src/atistruct.h b/src/atistruct.h index 589c31e..5943b49 100644 --- a/src/atistruct.h +++ b/src/atistruct.h @@ -265,7 +265,6 @@ typedef struct _ATIRec /* * BIOS-related definitions. */ - unsigned long BIOSBase; CARD8 I2CType, Tuner, Decoder, Audio; /* |