示例#1
0
static Bool
VMWAREProbe(DriverPtr drv, int flags)
{
    int numDevSections, numUsed;
    GDevPtr *devSections;
    int *usedChips;
    int i;
    Bool foundScreen = FALSE;
    char buildString[sizeof(VMWAREBuildStr)];

    RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr));
    xf86MsgVerb(X_PROBED, 4, "%s", buildString);

    numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections);
    if (numDevSections <= 0) {
#ifdef DEBUG
        xf86MsgVerb(X_ERROR, 0, "No vmware driver section\n");
#endif
        return FALSE;
    }
    if (xf86GetPciVideoInfo()) {
        VmwareLog(("Some PCI Video Info Exists\n"));
        numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_ID_VMWARE,
                                        VMWAREChipsets, VMWAREPciChipsets, devSections,
                                        numDevSections, drv, &usedChips);
        free(devSections);
        if (numUsed <= 0)
            return FALSE;
        if (flags & PROBE_DETECT)
            foundScreen = TRUE;
        else
            for (i = 0; i < numUsed; i++) {
                ScrnInfoPtr pScrn = NULL;

                VmwareLog(("Even some VMware SVGA PCI instances exists\n"));
                pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i],
                                            VMWAREPciChipsets, NULL, NULL, NULL,
                                            NULL, NULL);
                if (pScrn) {
                    VmwareLog(("And even configuration suceeded\n"));
                    pScrn->driverVersion = VMWARE_DRIVER_VERSION;
                    pScrn->driverName = VMWARE_DRIVER_NAME;
                    pScrn->name = VMWARE_NAME;
                    pScrn->Probe = VMWAREProbe;

#ifdef BUILD_VMWGFX
		    vmwgfx_hookup(pScrn);
#else
		    vmwlegacy_hookup(pScrn);
#endif /* defined(BUILD_VMWGFX) */

		    pScrn->driverPrivate = pScrn->PreInit;
		    pScrn->PreInit = VMwarePreinitStub;
                    foundScreen = TRUE;
                }
            }
        free(usedChips);
    }
    return foundScreen;
}
示例#2
0
static Bool
Probe(DriverPtr drv, int flags)
{
    int i, numDevSections;
    GDevPtr *devSections;
    Bool foundScreen = FALSE;
    const char *dev;
    ScrnInfoPtr scrn = NULL;

    /* For now, just bail out for PROBE_DETECT. */
    if (flags & PROBE_DETECT)
	return FALSE;

    /*
     * Find the config file Device sections that match this
     * driver, and return if there are none.
     */
    if ((numDevSections = xf86MatchDevice("modesetting", &devSections)) <= 0) {
	return FALSE;
    }

    for (i = 0; i < numDevSections; i++) {

	dev = xf86FindOptionValue(devSections[i]->options,"kmsdev");
	if (probe_hw(dev, NULL)) {
	    int entity;
	    entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
	    scrn = xf86ConfigFbEntity(scrn, 0, entity,
				  NULL, NULL, NULL, NULL);
	}

	if (scrn) {
	    foundScreen = TRUE;
	    scrn->driverVersion = 1;
	    scrn->driverName = "modesetting";
	    scrn->name = "modesetting";
	    scrn->Probe = Probe;
	    scrn->PreInit = PreInit;
	    scrn->ScreenInit = ScreenInit;
	    scrn->SwitchMode = SwitchMode;
	    scrn->AdjustFrame = AdjustFrame;
	    scrn->EnterVT = EnterVT;
	    scrn->LeaveVT = LeaveVT;
	    scrn->FreeScreen = FreeScreen;
	    scrn->ValidMode = ValidMode;

	    xf86DrvMsg(scrn->scrnIndex, X_INFO,
			   "using %s\n", dev ? dev : "default device");
	}
    }

    free(devSections);

    return foundScreen;
}
/* Mandatory */
static Bool
DUMMYProbe(DriverPtr drv, int flags)
{
    Bool foundScreen = FALSE;
    int numDevSections, numUsed;
    GDevPtr *devSections;
    int i;

    if (flags & PROBE_DETECT)
	return FALSE;
    /*
     * Find the config file Device sections that match this
     * driver, and return if there are none.
     */
    if ((numDevSections = xf86MatchDevice(DUMMY_DRIVER_NAME,
					  &devSections)) <= 0) {
	return FALSE;
    }

    numUsed = numDevSections;

    if (numUsed > 0) {

	for (i = 0; i < numUsed; i++) {
	    ScrnInfoPtr pScrn = NULL;
	    int entityIndex = 
		xf86ClaimNoSlot(drv,DUMMY_CHIP,devSections[i],TRUE);
	    /* Allocate a ScrnInfoRec and claim the slot */
	    if ((pScrn = xf86AllocateScreen(drv,0 ))) {
		   xf86AddEntityToScreen(pScrn,entityIndex);
		    pScrn->driverVersion = VERSION;
		    pScrn->driverName    = DUMMY_DRIVER_NAME;
		    pScrn->name          = DUMMY_NAME;
		    pScrn->Probe         = DUMMYProbe;
		    pScrn->PreInit       = DUMMYPreInit;
		    pScrn->ScreenInit    = DUMMYScreenInit;
		    pScrn->SwitchMode    = DUMMYSwitchMode;
		    pScrn->AdjustFrame   = DUMMYAdjustFrame;
		    pScrn->EnterVT       = DUMMYEnterVT;
		    pScrn->LeaveVT       = DUMMYLeaveVT;
		    pScrn->FreeScreen    = DUMMYFreeScreen;
		    pScrn->ValidMode     = DUMMYValidMode;

		    foundScreen = TRUE;
	    }
	}
    }    
    return foundScreen;
}
示例#4
0
static Bool
NestedProbe(DriverPtr drv, int flags) {
    Bool foundScreen = FALSE;
    int numDevSections;
    GDevPtr *devSections;
    int i;

    ScrnInfoPtr pScrn;
    int entityIndex;

    if (flags & PROBE_DETECT)
        return FALSE;

    if ((numDevSections = xf86MatchDevice(NESTED_DRIVER_NAME,
                                          &devSections)) <= 0) {
        return FALSE;
    }

    if (numDevSections > 0) {
        for(i = 0; i < numDevSections; i++) {
            pScrn = NULL;
            entityIndex = xf86ClaimNoSlot(drv, NESTED_CHIP, devSections[i],
                                          TRUE);
            pScrn = xf86AllocateScreen(drv, 0);
            if (pScrn) {
                xf86AddEntityToScreen(pScrn, entityIndex);
                pScrn->driverVersion = NESTED_VERSION;
                pScrn->driverName    = NESTED_DRIVER_NAME;
                pScrn->name          = NESTED_NAME;
                pScrn->Probe         = NestedProbe;
                pScrn->PreInit       = NestedPreInit;
                pScrn->ScreenInit    = NestedScreenInit;
                pScrn->SwitchMode    = NestedSwitchMode;
                pScrn->AdjustFrame   = NestedAdjustFrame;
                pScrn->EnterVT       = NestedEnterVT;
                pScrn->LeaveVT       = NestedLeaveVT;
                pScrn->FreeScreen    = NestedFreeScreen;
                pScrn->ValidMode     = NestedValidMode;
                foundScreen = TRUE;
            }
        }
    }

    return foundScreen;
}
示例#5
0
int
xf86platformProbeDev(DriverPtr drvp)
{
    Bool foundScreen = FALSE;
    GDevPtr *devList;
    const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);
    int i, j;

    /* find the main device or any device specificed in xorg.conf */
    for (i = 0; i < numDevs; i++) {
        for (j = 0; j < xf86_num_platform_devices; j++) {
            if (devList[i]->busID && *devList[i]->busID) {
                if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID))
                    break;
            }
            else {
                /* for non-seat0 servers assume first device is the master */
                if (ServerIsNotSeat0())
                    break;
                if (xf86_platform_devices[j].pdev) {
                    if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
                        break;
                }
            }
        }

        if (j == xf86_num_platform_devices)
             continue;

        foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0);
        if (!foundScreen)
            continue;
    }

    /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */
    if (xf86Info.autoAddGPU && numDevs) {
        for (j = 0; j < xf86_num_platform_devices; j++) {
            probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN);
        }
    }

    return foundScreen;
}
示例#6
0
/* Return TRUE if chipset is present; FALSE otherwise. */
static Bool
RADEONProbe(DriverPtr drv, int flags)
{
    int      numUsed;
    int      numDevSections;
    int     *usedChips;
    GDevPtr *devSections;
    Bool     foundScreen = FALSE;
    int      i;

    if (!xf86GetPciVideoInfo()) return FALSE;

    numDevSections = xf86MatchDevice(RADEON_NAME, &devSections);

    if (!numDevSections) return FALSE;

    numUsed = xf86MatchPciInstances(RADEON_NAME,
				    PCI_VENDOR_ATI,
				    RADEONChipsets,
				    RADEONPciChipsets,
				    devSections,
				    numDevSections,
				    drv,
				    &usedChips);

    if (numUsed <= 0) return FALSE;

    if (flags & PROBE_DETECT) {
	foundScreen = TRUE;
    } else {
	for (i = 0; i < numUsed; i++) {
	    if (radeon_get_scrninfo(usedChips[i], NULL))
		foundScreen = TRUE;
	}
    }

    free(usedChips);
    free(devSections);

    return foundScreen;
}
void
ati_gdev_subdriver(pointer options)
{
    int      nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev;
    GDevPtr *ATIGDevs;
    Bool     load_mach64 = FALSE, load_r128 = FALSE, load_radeon = FALSE;
    int      i;

    /* let the subdrivers configure for themselves */
    if (xf86ServerIsOnlyDetecting())
        return;

    /* get Device sections with Driver "ati" */
    nATIGDev = xf86MatchDevice(ATI_DRIVER_NAME, &ATIGDevs);
    nMach64GDev = xf86MatchDevice(MACH64_DRIVER_NAME, NULL);
    nR128GDev = xf86MatchDevice(R128_DRIVER_NAME, NULL);
    nRadeonGDev = xf86MatchDevice(RADEON_DRIVER_NAME, NULL);

    for (i = 0; i < nATIGDev; i++) {
        GDevPtr     ati_gdev = ATIGDevs[i];
        pciVideoPtr device = NULL;
        int         chip_family;

        /* get pci device for the Device section */
        if (ati_gdev->busID) {
            int bus, dev, func;

            if (!xf86ParsePciBusString(ati_gdev->busID, &bus, &dev, &func))
                continue;

            device = ati_device_get_from_busid(bus, dev, func);
        }
#ifdef XSERVER_PLATFORM_BUS
        else
            device = ati_device_get_indexed(i);
#else
        else {
            device = ati_device_get_primary();
        }
#endif

        if (!device)
            continue;

        /* check for non-ati devices and prehistoric mach32 */
        if ((PCI_DEV_VENDOR_ID(device) != PCI_VENDOR_ATI) ||
            (PCI_DEV_DEVICE_ID(device) == PCI_CHIP_MACH32))
            continue;

        /* replace Driver line in the Device section */
        chip_family = ATIChipID(PCI_DEV_DEVICE_ID(device));

        if (chip_family == ATI_CHIP_FAMILY_Mach64) {
            ati_gdev->driver = MACH64_DRIVER_NAME;
            load_mach64 = TRUE;
        }

        if (chip_family == ATI_CHIP_FAMILY_Rage128) {
            ati_gdev->driver = R128_DRIVER_NAME;
            load_r128 = TRUE;
        }

        if (chip_family == ATI_CHIP_FAMILY_Radeon) {
            ati_gdev->driver = RADEON_DRIVER_NAME;
            load_radeon = TRUE;
        }
    }
/* Mandatory */
static Bool
BW2Probe(DriverPtr drv, int flags)
{
    int i;
    GDevPtr *devSections;
    int *usedChips;
    int numDevSections;
    int numUsed;
    Bool foundScreen = FALSE;
    EntityInfoPtr pEnt;

    /*
     * The aim here is to find all cards that this driver can handle,
     * and for the ones not already claimed by another driver, claim the
     * slot, and allocate a ScrnInfoRec.
     *
     * This should be a minimal probe, and it should under no circumstances
     * change the state of the hardware.  Because a device is found, don't
     * assume that it will be used.  Don't do any initialisations other than
     * the required ScrnInfoRec initialisations.  Don't allocate any new
     * data structures.
     */

    /*
     * Next we check, if there has been a chipset override in the config file.
     * For this we must find out if there is an active device section which
     * is relevant, i.e., which has no driver specified or has THIS driver
     * specified.
     */

    if ((numDevSections = xf86MatchDevice(BW2_DRIVER_NAME,
					  &devSections)) <= 0) {
	/*
	 * There's no matching device section in the config file, so quit
	 * now.
	 */
	return FALSE;
    }

    /*
     * We need to probe the hardware first.  We then need to see how this
     * fits in with what is given in the config file, and allow the config
     * file info to override any contradictions.
     */

    numUsed = xf86MatchSbusInstances(BW2_NAME, SBUS_DEVICE_BW2,
		   devSections, numDevSections,
		   drv, &usedChips);

    xfree(devSections);
    if (numUsed <= 0)
	return FALSE;

    if (flags & PROBE_DETECT)
	foundScreen = TRUE;
    else for (i = 0; i < numUsed; i++) {
	pEnt = xf86GetEntityInfo(usedChips[i]);

	/*
	 * Check that nothing else has claimed the slots.
	 */
	if(pEnt->active) {
	    ScrnInfoPtr pScrn;

	    /* Allocate a ScrnInfoRec and claim the slot */
	    pScrn = xf86AllocateScreen(drv, 0);

	    /* Fill in what we can of the ScrnInfoRec */
	    pScrn->driverVersion = VERSION;
	    pScrn->driverName	 = BW2_DRIVER_NAME;
	    pScrn->name		 = BW2_NAME;
	    pScrn->Probe	 = BW2Probe;
	    pScrn->PreInit	 = BW2PreInit;
	    pScrn->ScreenInit	 = BW2ScreenInit;
	    pScrn->SwitchMode	 = BW2SwitchMode;
	    pScrn->AdjustFrame	 = BW2AdjustFrame;
	    pScrn->EnterVT	 = BW2EnterVT;
	    pScrn->LeaveVT	 = BW2LeaveVT;
	    pScrn->FreeScreen	 = BW2FreeScreen;
	    pScrn->ValidMode	 = BW2ValidMode;
	    xf86AddEntityToScreen(pScrn, pEnt->index);
	    foundScreen = TRUE;
	}
	xfree(pEnt);
    }
    xfree(usedChips);
    return foundScreen;
}
示例#9
0
Bool
xf86PciProbeDev(DriverPtr drvp)
{
    int i, j;
    struct pci_device *pPci;
    Bool foundScreen = FALSE;
    const struct pci_id_match *const devices = drvp->supported_devices;
    GDevPtr *devList;
    const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);

    for (i = 0; i < numDevs; i++) {
        struct pci_device_iterator *iter;
        unsigned device_id;

        /* Find the pciVideoRec associated with this device section.
         */
        iter = pci_id_match_iterator_create(NULL);
        while ((pPci = pci_device_next(iter)) != NULL) {
            if (devList[i]->busID && *devList[i]->busID) {
                if (xf86ComparePciBusString(devList[i]->busID,
                                            ((pPci->domain << 8)
                                             | pPci->bus),
                                            pPci->dev, pPci->func)) {
                    break;
                }
            }
            else if (xf86IsPrimaryPci(pPci)) {
                break;
            }
        }

        pci_iterator_destroy(iter);

        if (pPci == NULL) {
            continue;
        }
        device_id = (devList[i]->chipID > 0)
            ? devList[i]->chipID : pPci->device_id;

        /* Once the pciVideoRec is found, determine if the device is supported
         * by the driver.  If it is, probe it!
         */
        for (j = 0; !END_OF_MATCHES(devices[j]); j++) {
            if (PCI_ID_COMPARE(devices[j].vendor_id, pPci->vendor_id)
                && PCI_ID_COMPARE(devices[j].device_id, device_id)
                && ((devices[j].device_class_mask & pPci->device_class)
                    == devices[j].device_class)) {
                int entry;

                /* Allow the same entity to be used more than once for
                 * devices with multiple screens per entity.  This assumes
                 * implicitly that there will be a screen == 0 instance.
                 *
                 * FIXME Need to make sure that two different drivers don't
                 * FIXME claim the same screen > 0 instance.
                 */
                if ((devList[i]->screen == 0) && !xf86CheckPciSlot(pPci))
                    continue;

                DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
                       drvp->driverName, pPci->bus, pPci->dev, pPci->func);

                /* Allocate an entry in the lists to be returned */
                entry = xf86ClaimPciSlot(pPci, drvp, device_id,
                                         devList[i], devList[i]->active);

                if ((entry == -1) && (devList[i]->screen > 0)) {
                    unsigned k;

                    for (k = 0; k < xf86NumEntities; k++) {
                        EntityPtr pEnt = xf86Entities[k];

                        if (pEnt->bus.type != BUS_PCI)
                            continue;
                        if (pEnt->bus.id.pci == pPci) {
                            entry = k;
                            xf86AddDevToEntity(k, devList[i]);
                            break;
                        }
                    }
                }

                if (entry != -1) {
                    if ((*drvp->PciProbe) (drvp, entry, pPci,
                                           devices[j].match_data)) {
                        foundScreen = TRUE;
                    }
                    else
                        xf86UnclaimPciSlot(pPci, devList[i]);
                }

                break;
            }
        }
    }
    free(devList);

    return foundScreen;
}
示例#10
0
static Bool
NscProbe(DriverPtr drv, int flags)
{
   Bool foundScreen = FALSE;
   int numDevSections, numUsed;
   GDevPtr *devSections = NULL;
   int *usedChips = NULL;
   int i;

   GeodeDebug(("NscProbe: Probing for supported devices!\n"));
   /*
    * * Find the config file Device sections that match this
    * * driver, and return if there are none.
    */
   if ((numDevSections = xf86MatchDevice(NSC_NAME, &devSections)) <= 0) {
      GeodeDebug(("NscProbe: failed 1!\n"));
      return FALSE;
   }
   GeodeDebug(("NscProbe: Before MatchPciInstances!\n"));
   /* PCI BUS */
   if (xf86GetPciVideoInfo()) {
      numUsed = xf86MatchPciInstances(NSC_NAME, PCI_VENDOR_ID_NS,
				      GeodeChipsets, GeodePCIchipsets,
				      devSections, numDevSections,
				      drv, &usedChips);
      if (numUsed <= 0) {
	 /* Check for old CYRIX vendor ID (5530) */
	 numUsed = xf86MatchPciInstances(NSC_NAME,
					 PCI_VENDOR_ID_CYRIX,
					 GeodeChipsets, GeodePCIchipsets,
					 devSections, numDevSections,
					 drv, &usedChips);
      }

      GeodeDebug(("NscProbe: MatchPCI (%d)!\n", numUsed));

      if (numUsed > 0) {
	 if (flags & PROBE_DETECT)
	    foundScreen = TRUE;
	 else {
	    /* Durango only supports one instance, */
	    /* so take the first one */
	    for (i = 0; i < numUsed; i++) {
	       /* Allocate a ScrnInfoRec  */
	       ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);

	       EntityInfoPtr pEnt = xf86GetEntityInfo(usedChips[i]);
	       PciChipsets *p_id;

	       for (p_id = GeodePCIchipsets; p_id->numChipset != -1; p_id++) {
		  if (pEnt->chipset == p_id->numChipset) {
		     CPUDetected = GX1;
		     if (pEnt->chipset == PCI_CHIP_REDCLOUD)
			CPUDetected = GX2;
		     break;
		  }
	       }
	       xfree(pEnt);
	       GeodeDebug(("NscProbe: CPUDetected %d!\n", CPUDetected));

	       pScrn->driverName = NSC_DRIVER_NAME;
	       pScrn->name = NSC_NAME;
	       pScrn->Probe = NscProbe;

	       if (CPUDetected == GX1) {
		  GX1SetupChipsetFPtr(pScrn);
	       } else {			/* GX2 */
		  GX2SetupChipsetFPtr(pScrn);
	       }

	       foundScreen = TRUE;
	       xf86ConfigActivePciEntity(pScrn,
					 usedChips[i],
					 GeodePCIchipsets,
					 NULL, NULL, NULL, NULL, NULL);
	    }
	 }
      }
   }

   if (usedChips)
      xfree(usedChips);
   if (devSections)
      xfree(devSections);
   GeodeDebug(("NscProbe: result (%d)!\n", foundScreen));
   return foundScreen;
}
示例#11
0
/* Mandatory */
static Bool
VoodooProbe(DriverPtr drv, int flags)
{
    int i, numDevSections, numUsed, *usedChips;
    GDevPtr *devSections;
    Bool foundScreen = FALSE;

    /*
     * Look for config file Device sections with this driver specified.
     */
    if ((numDevSections = xf86MatchDevice(VOODOO_DRIVER_NAME,
						&devSections)) <= 0) {
#ifdef DEBUG
   	xf86ErrorFVerb(3,"%s: No Device section found.\n",VOODOO_NAME);
#endif
	/*
	 * There's no matching device section in the config file, so quit
	 * now.
	 */
	return FALSE;
    }

    /* PCI BUS */
#ifndef XSERVER_LIBPCIACCESS
    if (xf86GetPciVideoInfo() )
#endif
    {
	numUsed = xf86MatchPciInstances(VOODOO_NAME, PCI_VENDOR_3DFX,
					VoodooChipsets, VoodooPCIChipsets, 
					devSections,numDevSections,
					drv, &usedChips);

	if (numUsed > 0) {
	    if (flags & PROBE_DETECT)
		foundScreen = TRUE;
	    else for (i = 0; i < numUsed; i++) {
		ScrnInfoPtr pScrn = NULL;
		EntityInfoPtr pEnt;
		
		/* Allocate a ScrnInfoRec and claim the slot */
		if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
						       VoodooPCIChipsets,NULL,
						       NULL, NULL, NULL,
						       NULL))) {
		    pScrn->driverVersion = VOODOO_VERSION;
		    pScrn->driverName    = VOODOO_DRIVER_NAME;
		    pScrn->name          = VOODOO_NAME;
		    pScrn->Probe	 = VoodooProbe;
		    pScrn->PreInit	 = VoodooPreInit;
		    pScrn->ScreenInit    = VoodooScreenInit;
		    pScrn->SwitchMode	 = VoodooSwitchMode;
		    pScrn->EnterVT	 = VoodooEnterVT;
		    pScrn->LeaveVT	 = VoodooLeaveVT;
		    pScrn->FreeScreen    = VoodooFreeScreen;
		    foundScreen = TRUE;
		}
		pEnt = xf86GetEntityInfo(usedChips[i]);
	    }
	    free(usedChips);
	}
    }
    free(devSections);
    return foundScreen;
}
static Bool
CIRProbe(DriverPtr drv, int flags)
{
    int i;
    GDevPtr *devSections;
    pciVideoPtr pPci;
    int *usedChips;
    int numDevSections;
    int numUsed;
    Bool foundScreen = FALSE;
    ScrnInfoPtr (*subProbe)(int entity);
    ScrnInfoPtr pScrn;
    ModuleDescPtr pMod;

#ifdef CIR_DEBUG
    ErrorF("CirProbe\n");
#endif
  
    /*
     * For PROBE_DETECT, make sure both sub-modules are loaded before
     * calling xf86MatchPciInstances(), because the AvailableOptions()
     * functions may be called before xf86MatchPciInstances() returns.
     */
    
    if (flags & PROBE_DETECT) {
	if (!lg_loaded) {
	    if ((pMod = xf86LoadDrvSubModule(drv, "cirrus_laguna"))) {
		xf86LoaderModReqSymLists(pMod, lgSymbols, NULL);
		lg_loaded = TRUE;
	    }
	}
	if (!alp_loaded) {
	    if ((pMod = xf86LoadDrvSubModule(drv, "cirrus_alpine"))) {
		xf86LoaderModReqSymLists(pMod, alpSymbols, NULL);
		alp_loaded = TRUE;
	    }
	}
    }

    if ((numDevSections = xf86MatchDevice(CIR_DRIVER_NAME,
					  &devSections)) <= 0) {
	return FALSE;
    }
    
    if (xf86GetPciVideoInfo() == NULL) {
	/*
	 * We won't let anything in the config file override finding no
	 * PCI video cards at all.  This seems reasonable now, but we'll see.
	 */
	return FALSE;
    }
  
    numUsed = xf86MatchPciInstances(CIR_NAME, PCI_VENDOR_CIRRUS,
				    CIRChipsets, CIRPciChipsets, devSections,
 				    numDevSections, drv, &usedChips);
    /* Free it since we don't need that list after this */
    xfree(devSections);
    if (numUsed <= 0)
 	return FALSE;
    if (flags & PROBE_DETECT)
 	foundScreen = TRUE;
    else for (i = 0; i < numUsed; i++) {
 	/* The Laguna family of chips is so different from the Alpine
 	   family that we won't share even the highest-level of
 	   functions.  But, the Laguna chips /are/ Cirrus chips, so
 	   they should be handled in this driver (as opposed to their
 	   own driver). */
	pPci = xf86GetPciInfoForEntity(usedChips[i]);
 	if (pPci && (pPci->chipType == PCI_CHIP_GD5462 ||
 	    pPci->chipType == PCI_CHIP_GD5464 ||
 	    pPci->chipType == PCI_CHIP_GD5464BD ||
 	    pPci->chipType == PCI_CHIP_GD5465)) {
 	    
 	    if (!lg_loaded) {
 		if (!(pMod = xf86LoadDrvSubModule(drv, "cirrus_laguna"))) 
		    continue;
 		xf86LoaderModReqSymLists(pMod, lgSymbols, NULL);
 		lg_loaded = TRUE;
 	    }
 	    subProbe = LgProbe;
 	} else {
 	    if (!alp_loaded) {
 		if (!(pMod = xf86LoadDrvSubModule(drv, "cirrus_alpine")))
 		    continue;
 		xf86LoaderModReqSymLists(pMod, alpSymbols, NULL);
 		alp_loaded = TRUE;
 	    }
 	    subProbe = AlpProbe;
 	}
 	pScrn = NULL;
 	
 	if ((pScrn = subProbe(usedChips[i]))) {
 	    foundScreen = TRUE;
 	    /* Fill in what we can of the ScrnInfoRec */
 	    pScrn->driverVersion = VERSION;
 	    pScrn->driverName	 = CIR_DRIVER_NAME;
 	    pScrn->name		 = CIR_NAME;
 	    pScrn->Probe	 = NULL;
 	}
    }
    xfree(usedChips);
     
    return foundScreen;
}
static Bool
AmdProbe(DriverPtr drv, int flags)
{
    Bool foundScreen = FALSE;
    int numDevSections, numUsed;
    GDevPtr *devSections = NULL;
    int *usedChips = NULL;
    int i;
    void (*drvr_setup) (ScrnInfoPtr pScrni) = NULL;
    int CPUDetected;

    DEBUGMSG(1, (0, X_INFO, "AmdProbe: Probing for supported devices!\n"));
    /*
     * * Find the config file Device sections that match this
     * * driver, and return if there are none.
     */
    if ((numDevSections = xf86MatchDevice(GEODE_NAME, &devSections)) <= 0) {
        DEBUGMSG(1, (0, X_INFO, "AmdProbe: failed 1!\n"));
        return FALSE;
    }
    DEBUGMSG(1, (0, X_INFO, "AmdProbe: Before MatchPciInstances!\n"));
    /* PCI BUS */
    if (xf86GetPciVideoInfo()) {
        numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_NS,
                                        GeodeChipsets, GeodePCIchipsets,
                                        devSections, numDevSections, drv,
                                        &usedChips);

        if (numUsed <= 0)
            numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_AMD,
                                            GeodeChipsets, GeodePCIchipsets,
                                            devSections, numDevSections, drv,
                                            &usedChips);

        DEBUGMSG(1, (0, X_INFO, "AmdProbe: MatchPCI (%d)!\n", numUsed));

        if (numUsed > 0) {
            if (flags & PROBE_DETECT)
                foundScreen = TRUE;
            else {
                /* Durango only supports one instance, */
                /* so take the first one */
                for (i = 0; i < numUsed; i++) {
                    /* Allocate a ScrnInfoRec  */
                    ScrnInfoPtr pScrni = NULL;
                    EntityInfoPtr pEnt = xf86GetEntityInfo(usedChips[i]);
                    PciChipsets *p_id;

                    pScrni = xf86ConfigPciEntity(pScrni, 0, usedChips[i],
                                                 GeodePCIchipsets, NULL, NULL,
                                                 NULL, NULL, NULL);
                    for (p_id = GeodePCIchipsets; p_id->numChipset != -1;
                         p_id++) {
                        if (pEnt->chipset == p_id->numChipset) {
                            switch (pEnt->chipset) {
#ifdef HAVE_LX
                            case PCI_CHIP_GEODELX:
                                CPUDetected = LX;
                                drvr_setup = &LXSetupChipsetFPtr;
                                break;
#endif
#ifdef HAVE_GX
                            case PCI_CHIP_GEODEGX:
                                CPUDetected = GX;
                                drvr_setup = &GXSetupChipsetFPtr;
                                break;
#endif
                            default:
                                break;
                            }
                            break;
                        }
                    }
                    free(pEnt);
                    if (drvr_setup == NULL)
                        return FALSE;

                    DEBUGMSG(1, (0, X_INFO, "AmdProbe: CPUDetected %d!\n",
                                 CPUDetected));

                    pScrni->driverName = GEODE_DRIVER_NAME;
                    pScrni->driverVersion = GEODE_VERSION;
                    pScrni->name = GEODE_NAME;
                    pScrni->Probe = AmdProbe;
                    drvr_setup(pScrni);

                    foundScreen = TRUE;

                }
            }
        }
    }

    if (usedChips)
        free(usedChips);
    if (devSections)
        free(devSections);
    DEBUGMSG(1, (0, X_INFO, "AmdProbe: result (%d)!\n", foundScreen));
    return foundScreen;
}