📄 atiprobe.c
字号:
/* * A note on probe strategy. I/O and memory response by certain PCI * devices has been disabled by the common layer at this point, * including any devices this driver might be interested in. The * following does sparse I/O probes, followed by block I/O probes. * Block I/O probes are dictated by what is found to be of interest in * PCI configuration space. All this will detect ATI adapters that do * not implement this disablement, pre-PCI or not. * * PCI configuration space is then scanned again for ATI devices that * failed to be detected the first time around. Each such device is * probed for again, this time with I/O temporarily enabled through * PCI. */ if (ATICheckSparseIOBases(NULL, ProbeFlags, ATTRX, 16, TRUE) == DoProbe) { pATI = ATIVGAProbe(NULL); if (pATI->Adapter == ATI_ADAPTER_NONE) { xfree(pATI); xf86MsgVerb(X_INFO, 4, ATI_NAME ": Unshared VGA not detected.\n"); } else { /* * Claim all MDA/HGA/CGA/EGA/VGA I/O ports. This might need to * be more selective. */ ATIClaimSparseIOBases(ProbeFlags, MonochromeIOBase, 48, DetectedVGA); pVGA = pATI; strcpy(Identifier, "Unshared VGA"); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); } } else { xf86MsgVerb(X_INFO, 2, ATI_NAME ": Unshared VGA not probed.\n"); } /* * Mach8/32 probing doesn't work well on some legacy free ia64 * However if we use AVOID_CPIO we don't get here at all. */ if (ATICheckSparseIOBases(NULL, ProbeFlags, 0x02E8U, 8, fChipsets[ATI_CHIPSET_IBM8514] || fChipsets[ATI_CHIPSET_MACH8] || fChipsets[ATI_CHIPSET_MACH32]) == DoProbe) { if ((pATI = ATI8514Probe(NULL))) { strcpy(Identifier, "Unshared 8514/A"); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); AddAdapter(p8514 = pATI); if ((pATI->VGAAdapter != ATI_ADAPTER_NONE) || (pATI->Coprocessor != ATI_CHIP_NONE)) ATIClaimVGA(NULL, &pVGA, pATI, p8514, ProbeFlags, Detected8514A); ATIClaimSparseIOBases(ProbeFlags, 0x02E8U, 8, Detected8514A); } else { xf86MsgVerb(X_INFO, 4, ATI_NAME ": Unshared 8514/A not detected.\n"); } } else { xf86MsgVerb(X_INFO, 2, ATI_NAME ": Unshared 8514/A not probed.\n"); } /* * Also NONPCI Mach64 probing is evil on legacy free platforms. * However if we use AVOID_CPIO we don't get here at all. */ for (i = 0; i < NumberOf(Mach64SparseIOBases); i++) { if (ATICheckSparseIOBases(NULL, ProbeFlags, Mach64SparseIOBases[i], 4, fChipsets[ATI_CHIPSET_MACH64]) != DoProbe) { xf86MsgVerb(X_INFO, 2, ATI_NAME ": Unshared Mach64 at PIO base 0x%04lX not" " probed.\n", Mach64SparseIOBases[i]); continue; } pATI = ATIMach64Probe(NULL, Mach64SparseIOBases[i], SPARSE_IO, 0); if (!pATI) { xf86MsgVerb(X_INFO, 4, ATI_NAME ": Unshared Mach64 at PIO base 0x%04lX not" " detected.\n", Mach64SparseIOBases[i]); continue; } sprintf(Identifier, "Unshared Mach64 at sparse PIO base 0x%04lX", Mach64SparseIOBases[i]); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); AddAdapter(pMach64[i] = pATI); if (pATI->VGAAdapter != ATI_ADAPTER_NONE) ATIClaimVGA(NULL, &pVGA, pATI, p8514, ProbeFlags, DetectedMach64); ATIClaimSparseIOBases(ProbeFlags, Mach64SparseIOBases[i], 4, DetectedMach64); }#endif /* AVOID_NON_PCI */ }#endif /* AVOID_CPIO */ if (xf86PciVideoInfo) { if (nATIGDev) {#ifndef AVOID_NON_PCI#ifdef AVOID_CPIO /* PCI sparse I/O adapters can still be used through MMIO */ for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || pVideo->size[1] || !(pPCI = pVideo->thisCard)) continue; PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); /* Possibly fix block I/O indicator */ if (PciReg & 0x00000004U) pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, PciReg & ~0x00000004U); Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); /* * The CPIO base used by the adapter is of little concern here. */ pATI = ATIMach64Probe(pVideo, 0, SPARSE_IO, Chip); if (!pATI) continue; sprintf(Identifier, "Unshared PCI sparse I/O Mach64 in slot %d:%d:%d", pVideo->bus, pVideo->device, pVideo->func); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected through Block 0 at 0x%08lX.\n", Identifier, pATI->Block0Base); AddAdapter(pATI); pATI->PCIInfo = pVideo; }#endif /* AVOID_CPIO */ for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || !pVideo->size[1]) continue; /* For now, ignore Rage128's and Radeon's */ Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); if ((Chip > ATI_CHIP_Mach64) || !(pPCI = pVideo->thisCard)) continue; /* * Possibly fix block I/O indicator in PCI configuration space. */ PciReg = pciReadLong(pPCI->tag, PCI_REG_USERCONFIG); if (!(PciReg & 0x00000004U)) pciWriteLong(pPCI->tag, PCI_REG_USERCONFIG, PciReg | 0x00000004U); pATI = ATIMach64Probe(pVideo, pVideo->ioBase[1], BLOCK_IO, Chip); if (!pATI) continue; sprintf(Identifier, "Unshared PCI/AGP Mach64 in slot %d:%d:%d", pVideo->bus, pVideo->device, pVideo->func); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); AddAdapter(pATI);#ifndef AVOID_CPIO /* This is probably not necessary */ if (pATI->VGAAdapter != ATI_ADAPTER_NONE) ATIClaimVGA(pVideo, &pVGA, pATI, p8514, ProbeFlags, DetectedMach64);#endif /* AVOID_CPIO */ }#endif /* AVOID_NON_PCI */#ifndef AVOID_CPIO /* * This is the second pass through PCI configuration space. Much * of this is verbiage to deal with potential situations that are * very unlikely to occur in practice. * * First, look for non-ATI shareable VGA's. For now, these must * the primary device. */ if (ATICheckSparseIOBases(NULL, ProbeFlags, ATTRX, 16, TRUE) == DoProbe) { for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { if ((pVideo->vendor == PCI_VENDOR_ATI) || !xf86IsPrimaryPci(pVideo)) continue; if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) continue; xf86SetPciVideo(pVideo, MEM_IO); pATI = ATIVGAProbe(NULL); if (pATI->Adapter == ATI_ADAPTER_NONE) { xfree(pATI); xf86Msg(X_WARNING, ATI_NAME ": PCI/AGP VGA compatible in slot" " %d:%d:%d could not be detected!\n", pVideo->bus, pVideo->device, pVideo->func); } else { sprintf(Identifier, "Shared non-ATI VGA in PCI/AGP slot %d:%d:%d", pVideo->bus, pVideo->device, pVideo->func); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); AddAdapter(pATI); pATI->SharedVGA = TRUE; pATI->BusType = ATI_BUS_PCI; pATI->PCIInfo = pVideo; } xf86SetPciVideo(NULL, NONE); } } /* Next, look for PCI Mach32's */ for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType != PCI_CHIP_MACH32)) continue; switch (ATICheckSparseIOBases(pVideo, ProbeFlags, 0x02E8U, 8, TRUE)) { case 0: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will not" " be enabled\n because it conflicts with a" " non-video PCI/AGP device.\n", pVideo->bus, pVideo->device, pVideo->func); break;#ifndef AVOID_NON_PCI case Detected8514A: if ((p8514->BusType >= ATI_BUS_PCI) && !p8514->PCIInfo) p8514->PCIInfo = pVideo; else xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will" " not be enabled\n because it conflicts with" " another %s %s.\n", pVideo->bus, pVideo->device, pVideo->func, ATIBusNames[p8514->BusType], ATIAdapterNames[p8514->Adapter]); break; case DetectedMach64: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d will not" " be enabled\n because it conflicts with a Mach64" " at I/O base 0x02EC.\n", pVideo->bus, pVideo->device, pVideo->func); break;#endif /* AVOID_NON_PCI */ default: /* Must be DoProbe */ if (!xf86CheckPciSlot(pVideo->bus, pVideo->device, pVideo->func)) continue; xf86SetPciVideo(pVideo, MEM_IO); if (!(pATI = ATI8514Probe(pVideo))) { xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d could" " not be detected!\n", pVideo->bus, pVideo->device, pVideo->func); } else { sprintf(Identifier, "Shared 8514/A in PCI slot %d:%d:%d", pVideo->bus, pVideo->device, pVideo->func); xf86MsgVerb(X_INFO, 3, ATI_NAME ": %s detected.\n", Identifier); if (pATI->Adapter != ATI_ADAPTER_MACH32) xf86Msg(X_WARNING, ATI_NAME ": PCI Mach32 in slot %d:%d:%d" " could only be detected as an %s!\n", pVideo->bus, pVideo->device, pVideo->func, ATIAdapterNames[pATI->Adapter]); AddAdapter(pATI); pATI->SharedAccelerator = TRUE; if ((pATI->VGAAdapter != ATI_ADAPTER_NONE) || (pATI->Coprocessor != ATI_CHIP_NONE)) ATIFindVGA(pVideo, &pVGA, &pATI, p8514, ProbeFlags); } xf86SetPciVideo(NULL, NONE); break; } } /* 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; 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" " 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;#ifndef AVOID_NON_PCI case Detected8514A: xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d will not" " be enabled\n because it conflicts with an %s.\n", pVideo->bus, pVideo->device, pVideo->func, ATIAdapterNames[p8514->Adapter]); break; case DetectedMach64: pATI = pMach64[j]; if ((pATI->BusType >= ATI_BUS_PCI) && !pATI->PCIInfo) pATI->PCIInfo = pVideo; else xf86Msg(X_WARNING, ATI_NAME ": PCI Mach64 in slot %d:%d:%d will"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -