Ejemplo n.º 1
0
static Bool
ms_pci_probe(DriverPtr driver,
             int entity_num, struct pci_device *dev, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL,
                               NULL, NULL, NULL, NULL, NULL);
    if (scrn) {
        const char *devpath;
        GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0],
                                                  scrn->entityInstanceList[0]);

        devpath = xf86FindOptionValue(devSection->options, "kmsdev");
        if (probe_hw_pci(devpath, dev)) {
            ms_setup_scrn_hooks(scrn);

            xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
                       "claimed PCI slot %d@%d:%d:%d\n",
                       dev->bus, dev->domain, dev->dev, dev->func);
            xf86DrvMsg(scrn->scrnIndex, X_INFO,
                       "using %s\n", devpath ? devpath : "default device");
        }
        else
            scrn = NULL;
    }
    return scrn != NULL;
}
Ejemplo n.º 2
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;
}
static Bool
AmdPciProbe(DriverPtr driver,
            int entity_num, struct pci_device *device, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;

    ErrorF("AmdPciProbe: Probing for supported devices!\n");

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, GeodePCIchipsets,
                               NULL, NULL, NULL, NULL, NULL);

    if (scrn != NULL) {
        scrn->driverName = GEODE_DRIVER_NAME;
        scrn->driverVersion = GEODE_VERSION;
        scrn->name = GEODE_NAME;
        scrn->Probe = NULL;

        switch (device->device_id) {
#ifdef HAVE_LX
        case PCI_CHIP_GEODELX:
            LXSetupChipsetFPtr(scrn);
            break;
#endif
#ifdef HAVE_GX
        case PCI_CHIP_GEODEGX:
            GXSetupChipsetFPtr(scrn);
            break;
#endif
        default:
            ErrorF("AmdPciProbe: unknown device ID\n");
            return FALSE;
        }
    }
    return scrn != NULL;
}
static Bool
radeon_get_scrninfo(int entity_num, void *pci_dev)
{
    ScrnInfoPtr   pScrn = NULL;
    EntityInfoPtr pEnt;

    pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, RADEONPciChipsets,
                                NULL,
                                NULL, NULL, NULL, NULL);

    if (!pScrn)
        return FALSE;

    if (pci_dev) {
      if (!radeon_kernel_mode_enabled(pScrn, pci_dev)) {
	return FALSE;
      }
    }

    pScrn->driverVersion = RADEON_VERSION_CURRENT;
    pScrn->driverName    = RADEON_DRIVER_NAME;
    pScrn->name          = RADEON_NAME;
    pScrn->Probe         = NULL;

    pScrn->PreInit       = RADEONPreInit_KMS;
    pScrn->ScreenInit    = RADEONScreenInit_KMS;
    pScrn->SwitchMode    = RADEONSwitchMode_KMS;
    pScrn->AdjustFrame   = RADEONAdjustFrame_KMS;
    pScrn->EnterVT       = RADEONEnterVT_KMS;
    pScrn->LeaveVT       = RADEONLeaveVT_KMS;
    pScrn->FreeScreen    = RADEONFreeScreen_KMS;
    pScrn->ValidMode     = RADEONValidMode;

    pEnt = xf86GetEntityInfo(entity_num);

    /* Create a RADEONEntity for all chips, even with old single head
     * Radeon, need to use pRADEONEnt for new monitor detection routines.
     */
    {
        DevUnion    *pPriv;

        xf86SetEntitySharable(entity_num);

        if (gRADEONEntityIndex == -1)
            gRADEONEntityIndex = xf86AllocateEntityPrivateIndex();

        pPriv = xf86GetEntityPrivate(pEnt->index,
                                     gRADEONEntityIndex);

	xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1);

        if (!pPriv->ptr)
            pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1);
    }

    free(pEnt);

    return TRUE;
}
Ejemplo n.º 5
0
ScrnInfoPtr
LgProbe(int entity)
{
    ScrnInfoPtr pScrn = NULL;
    if ((pScrn = xf86ConfigPciEntity(pScrn, 0, entity, CIRPciChipsets,
					   NULL, NULL, NULL, NULL, NULL))) {
	pScrn->PreInit		= LgPreInit;
	pScrn->ScreenInit	= LgScreenInit;
	pScrn->SwitchMode	= LgSwitchMode;
	pScrn->AdjustFrame	= LgAdjustFrame;
	pScrn->EnterVT		= LgEnterVT;
	pScrn->LeaveVT		= LgLeaveVT;
	pScrn->FreeScreen	= LgFreeScreen;
	pScrn->ValidMode	= LgValidMode;
    }
    return pScrn;
}
Ejemplo n.º 6
0
/*
 * intel_pci_probe --
 *
 * Look through the PCI bus to find cards that are intel boards.
 * Setup the dispatch table for the rest of the driver functions.
 *
 */
static Bool intel_pci_probe(DriverPtr		driver,
			    int			entity_num,
			    struct pci_device	*device,
			    intptr_t		match_data)
{
	ScrnInfoPtr scrn;
	PciChipsets intel_pci_chipsets[ARRAY_SIZE(intel_chipsets)];
	int i;

	chipset_info = (void *)match_data;


	for (i = 0; i < ARRAY_SIZE(intel_chipsets); i++) {
		intel_pci_chipsets[i].numChipset = intel_chipsets[i].token;
		intel_pci_chipsets[i].PCIid = intel_chipsets[i].token;
		intel_pci_chipsets[i].dummy = NULL;
	}

	scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
				   NULL, NULL, NULL, NULL, NULL);
	if (scrn != NULL) {
		scrn->driverVersion = INTEL_VERSION;
		scrn->driverName = INTEL_DRIVER_NAME;
		scrn->name = INTEL_NAME;
		scrn->Probe = NULL;

#if KMS_ONLY
		intel_init_scrn(scrn);
#else
		switch (DEVICE_ID(device)) {
		case PCI_CHIP_I810:
		case PCI_CHIP_I810_DC100:
		case PCI_CHIP_I810_E:
		case PCI_CHIP_I815:
			lg_i810_init(scrn);
			break;

		default:
			intel_init_scrn(scrn);
			break;
		}
#endif
	}
	return scrn != NULL;
}
Ejemplo n.º 7
0
static Bool
intel_xorg_pci_probe(DriverPtr driver,
                     int entity_num, struct pci_device *device, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, intel_xorg_pci_devices,
                               NULL, NULL, NULL, NULL, NULL);
    if (scrn != NULL) {
        scrn->driverVersion = 1;
        scrn->driverName = "i915";
        scrn->name = "modesetting";
        scrn->Probe = NULL;

        /* Use all the functions from the xorg tracker */
        xorg_tracker_set_functions(scrn);
    }
    return scrn != NULL;
}
Ejemplo n.º 8
0
static Bool
r600_xorg_pci_probe(DriverPtr driver,
	  int entity_num, struct pci_device *device, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;
    EntityInfoPtr entity;

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, r600_xorg_pci_devices,
			       NULL, NULL, NULL, NULL, NULL);
    if (scrn != NULL) {
	scrn->driverVersion = 1;
	scrn->driverName = "r600";
	scrn->name = "R600G";
	scrn->Probe = NULL;

	entity = xf86GetEntityInfo(entity_num);

	/* Use all the functions from the xorg tracker */
	xorg_tracker_set_functions(scrn);
    }
    return scrn != NULL;
}
Ejemplo n.º 9
0
static Bool
ms_pci_probe(DriverPtr driver,
	     int entity_num, struct pci_device *dev, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL,
			       NULL, NULL, NULL, NULL, NULL);
    if (scrn) {
	const char *devpath;
	GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0],
						  scrn->entityInstanceList[0]);

	devpath = xf86FindOptionValue(devSection->options, "kmsdev");
	if (probe_hw_pci(devpath, dev)) {
	    scrn->driverVersion = 1;
	    scrn->driverName = "modesetting";
	    scrn->name = "modeset";
	    scrn->Probe = NULL;
	    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_CONFIG,
		       "claimed PCI slot %d@%d:%d:%d\n", 
		       dev->bus, dev->domain, dev->dev, dev->func);
	    xf86DrvMsg(scrn->scrnIndex, X_INFO,
		       "using %s\n", devpath ? devpath : "default device");
	} else
	    scrn = NULL;
    }
    return scrn != NULL;
}
Ejemplo n.º 10
0
static Bool
VMwarePciProbe (DriverPtr           drv,
                int                 entity_num,
                struct pci_device   *device,
                intptr_t            match_data)
{
    ScrnInfoPtr     scrn = NULL;

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VMWAREPciChipsets,
                               NULL, NULL, NULL, NULL, NULL);
    if (scrn != NULL) {
        scrn->driverVersion = VMWARE_DRIVER_VERSION;
        scrn->driverName = VMWARE_DRIVER_NAME;
        scrn->name = VMWARE_NAME;
        scrn->Probe = NULL;
    }

    switch (DEVICE_ID(device)) {
    case PCI_DEVICE_ID_VMWARE_SVGA2:
    case PCI_DEVICE_ID_VMWARE_SVGA:
        xf86MsgVerb(X_INFO, 4, "VMwarePciProbe: Valid device\n");

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

	scrn->driverPrivate = scrn->PreInit;
	scrn->PreInit = VMwarePreinitStub;
        break;
    default:
        xf86MsgVerb(X_INFO, 4, "VMwarePciProbe: Unknown device\n");
    }
    return scrn != NULL;
}
Ejemplo n.º 11
0
static Bool
radeon_get_scrninfo(int entity_num, void *pci_dev)
{
    ScrnInfoPtr   pScrn = NULL;
    EntityInfoPtr pEnt;
    int kms = 0;

    pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, RADEONPciChipsets,
                                NULL,
                                NULL, NULL, NULL, NULL);

    if (!pScrn)
        return FALSE;

    if (pci_dev) {
      if (radeon_kernel_mode_enabled(pScrn, pci_dev)) {
	kms = 1;
      } else {
        if (!radeon_ums_supported(pScrn, pci_dev)) {
          return FALSE;
        }
      }
    }

    pScrn->driverVersion = RADEON_VERSION_CURRENT;
    pScrn->driverName    = RADEON_DRIVER_NAME;
    pScrn->name          = RADEON_NAME;
#ifdef XSERVER_LIBPCIACCESS
    pScrn->Probe         = NULL;
#else
    pScrn->Probe         = RADEONProbe;
#endif

#ifdef XF86DRM_MODE
    if (kms == 1) {
      pScrn->PreInit       = RADEONPreInit_KMS;
      pScrn->ScreenInit    = RADEONScreenInit_KMS;
      pScrn->SwitchMode    = RADEONSwitchMode_KMS;
      pScrn->AdjustFrame   = RADEONAdjustFrame_KMS;
      pScrn->EnterVT       = RADEONEnterVT_KMS;
      pScrn->LeaveVT       = RADEONLeaveVT_KMS;
      pScrn->FreeScreen    = RADEONFreeScreen_KMS;
      pScrn->ValidMode     = RADEONValidMode;
    } else 
#endif 
    {
      pScrn->PreInit       = RADEONPreInit;
      pScrn->ScreenInit    = RADEONScreenInit;
      pScrn->SwitchMode    = RADEONSwitchMode;
      pScrn->AdjustFrame   = RADEONAdjustFrame;
      pScrn->EnterVT       = RADEONEnterVT;
      pScrn->LeaveVT       = RADEONLeaveVT;
      pScrn->FreeScreen    = RADEONFreeScreen;
      pScrn->ValidMode     = RADEONValidMode;
    }

    pEnt = xf86GetEntityInfo(entity_num);

    /* Create a RADEONEntity for all chips, even with old single head
     * Radeon, need to use pRADEONEnt for new monitor detection routines.
     */
    {
        DevUnion    *pPriv;
        RADEONEntPtr pRADEONEnt;

        xf86SetEntitySharable(entity_num);

        if (gRADEONEntityIndex == -1)
            gRADEONEntityIndex = xf86AllocateEntityPrivateIndex();

        pPriv = xf86GetEntityPrivate(pEnt->index,
                                     gRADEONEntityIndex);

	xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1);

        if (!pPriv->ptr) {
            pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1);
            pRADEONEnt = pPriv->ptr;
            pRADEONEnt->HasSecondary = FALSE;
        } else {
            pRADEONEnt = pPriv->ptr;
            pRADEONEnt->HasSecondary = TRUE;
        }
    }

    free(pEnt);

    return TRUE;
}
Ejemplo n.º 12
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;
}
Ejemplo n.º 13
0
static Bool
nouveau_xorg_pci_probe(DriverPtr driver,
	  int entity_num, struct pci_device *device, intptr_t match_data)
{
    ScrnInfoPtr scrn = NULL;
    struct nouveau_device *dev = NULL;
    char *busid;
    int chipset, ret;

    busid = malloc(64);
    if (!busid)
	return FALSE;

    sprintf(busid, "pci:%04x:%02x:%02x.%d",
	    device->domain, device->bus,
	    device->dev, device->func);

    ret = drmCheckModesettingSupported(busid);
    if (ret) {
	xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
	free(busid);
	return FALSE;
    }

    ret = nouveau_device_open(busid, &dev);
    free(busid);
    if (ret) {
	xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
	return FALSE;
    }

    chipset = dev->chipset;
    nouveau_device_del(&dev);

    switch (chipset & 0xf0) {
    case 0x00:
    case 0x10:
    case 0x20:
	xf86DrvMsg(-1, X_NOTICE, "Too old chipset: NV%02x\n", chipset);
	return FALSE;
    case 0x30:
    case 0x40:
    case 0x60:
    case 0x50:
    case 0x80:
    case 0x90:
    case 0xa0:
    case 0xc0:
    case 0xd0:
    case 0xe0:
    case 0xf0:
	xf86DrvMsg(-1, X_INFO, "Detected chipset: NV%02x\n", chipset);
	break;
    default:
	xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
	return FALSE;
    }

    scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
			       NULL, NULL, NULL, NULL, NULL);
    if (scrn != NULL) {
	scrn->driverVersion = 1;
	scrn->driverName = "nouveau";
	scrn->name = "nouveau2";
	scrn->Probe = NULL;

	/* Use all the functions from the xorg tracker */
	xorg_tracker_set_functions(scrn);
    }
    return scrn != NULL;
}
Ejemplo n.º 14
0
/*
 * intel_pci_probe --
 *
 * Look through the PCI bus to find cards that are intel boards.
 * Setup the dispatch table for the rest of the driver functions.
 *
 */
static Bool intel_pci_probe(DriverPtr		driver,
			    int			entity_num,
			    struct pci_device	*device,
			    intptr_t		match_data)
{
	ScrnInfoPtr scrn;
	PciChipsets intel_pci_chipsets[NUM_CHIPSETS];
	unsigned i;

	if (!has_kernel_mode_setting(device)) {
#if KMS_ONLY
		return FALSE;
#else
		switch (DEVICE_ID(device)) {
		case PCI_CHIP_I810:
		case PCI_CHIP_I810_DC100:
		case PCI_CHIP_I810_E:
		case PCI_CHIP_I815:
			break;
		default:
			return FALSE;
		}
#endif
	}

	for (i = 0; i < NUM_CHIPSETS; i++) {
		intel_pci_chipsets[i].numChipset = intel_chipsets[i].token;
		intel_pci_chipsets[i].PCIid = intel_chipsets[i].token;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,99,0,0)
		intel_pci_chipsets[i].resList = RES_SHARED_VGA;
#else
		intel_pci_chipsets[i].dummy = NULL;
#endif
	}

	scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
				   NULL, NULL, NULL, NULL, NULL);
	if (scrn == NULL)
		return FALSE;

	scrn->driverVersion = INTEL_VERSION;
	scrn->driverName = INTEL_DRIVER_NAME;
	scrn->name = INTEL_NAME;
	scrn->driverPrivate = (void *)(match_data | 1);
	scrn->Probe = NULL;

#if !KMS_ONLY
	switch (DEVICE_ID(device)) {
	case PCI_CHIP_I810:
	case PCI_CHIP_I810_DC100:
	case PCI_CHIP_I810_E:
	case PCI_CHIP_I815:
		return lg_i810_init(scrn);
	}
#endif

#if !UMS_ONLY
	switch (get_accel_method()) {
#if USE_SNA
	case SNA: return sna_init_scrn(scrn, entity_num);
#endif

#if USE_UXA
	case UXA: return intel_init_scrn(scrn);
#endif

	default: break;
	}
#endif

	return FALSE;
}
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;
}