summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2008-02-15 18:34:56 +0200
committerGeorge Sapountzis <gsap7@yahoo.gr>2008-02-15 18:34:56 +0200
commit665bd7e2f61cac3e029bbad5024034e5136deec1 (patch)
treed78f686f4f323973f7a334f4144ed2b5e0205662
parenta596c1618f72179a45289a50a1f9e89462ce9667 (diff)
ati wrapper: translate Device lines
-rw-r--r--src/ati.c361
-rw-r--r--src/ati.h4
-rw-r--r--src/atimach64probe.c33
-rw-r--r--src/atimisc.c8
-rw-r--r--src/atimodule.c6
-rw-r--r--src/r128_misc.c6
-rw-r--r--src/r128_probe.c48
-rw-r--r--src/radeon_misc.c6
-rw-r--r--src/radeon_probe.c46
9 files changed, 133 insertions, 385 deletions
diff --git a/src/ati.c b/src/ati.c
index 89e62dc4..b3f07caf 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -66,11 +66,8 @@
#include "ativersion.h"
/* names duplicated from version headers */
-#define MACH64_NAME "MACH64"
#define MACH64_DRIVER_NAME "mach64"
-#define R128_NAME "R128"
#define R128_DRIVER_NAME "r128"
-#define RADEON_NAME "RADEON"
#define RADEON_DRIVER_NAME "radeon"
enum
@@ -81,304 +78,170 @@ enum
ATI_CHIP_FAMILY_Radeon
};
-/*
- * Record which sub-drivers have already been loaded, and thus have called
- * xf86AddDriver(). For those sub-drivers, cause the ati wrapper later to fail
- * when probing.
- *
- * The check is only called once when the ati wrapper is loaded and depends on
- * the X server loading all drivers before doing any probes.
- */
-static Bool mach64_drv_added = FALSE;
-static Bool r128_drv_added = FALSE;
-static Bool radeon_drv_added = FALSE;
-
-void
-ati_check_subdriver_added()
-{
- if (LoaderSymbol(MACH64_NAME))
- mach64_drv_added = TRUE;
- if (LoaderSymbol(R128_NAME))
- r128_drv_added = TRUE;
- if (LoaderSymbol(RADEON_NAME))
- radeon_drv_added = TRUE;
-}
-
static int ATIChipID(const CARD16);
#ifdef XSERVER_LIBPCIACCESS
-static const struct pci_id_match ati_device_match = {
- PCI_VENDOR_ATI, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0
-};
-/* Stolen from xf86pciBus.c */
-/* PCI classes that get included in xf86PciVideoInfo */
-#define PCIINFOCLASSES(c) \
- ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) || \
- (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) || \
- ((((c) & 0x00ffff00) == ((PCI_CLASS_MULTIMEDIA << 16) | \
- (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) || \
- ((((c) & 0x00ffff00) == ((PCI_CLASS_PROCESSOR << 16) | \
- (PCI_SUBCLASS_PROCESSOR_COPROC << 8)))) )
+/* domain defines (stolen from xserver) */
+#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
+# define PCI_DOM_MASK 0x01fful
+#else
+# define PCI_DOM_MASK 0x0ffu
#endif
-/*
- * ATIIdentify --
- *
- * Print the driver's list of chipset names.
- */
-static void
-ATIIdentify
-(
- int flags
-)
+#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK))
+#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
+
+static struct pci_device*
+ati_device_get_from_busid(int bus, int dev, int func)
{
- /*
- * Only print chip families here, chip lists are printed when a subdriver
- * is loaded.
- */
- xf86Msg(X_INFO, "%s: %s\n", ATI_NAME,
- "ATI driver wrapper (version " ATI_VERSION_NAME ") for chipsets: "
- "mach64, rage128, radeon");
+ return pci_device_find_by_slot(PCI_DOM_FROM_BUS(bus),
+ PCI_BUS_NO_DOMAIN(bus),
+ dev,
+ func);
}
-/*
- * ATIProbe --
- *
- * This function is called once, at the start of the first server generation to
- * do a minimal probe for supported hardware.
- */
-static Bool
-ATIProbe
-(
- DriverPtr pDriver,
- int flags
-)
+static struct pci_device*
+ati_device_get_primary()
{
- pciVideoPtr pVideo;
-#ifndef XSERVER_LIBPCIACCESS
- pciVideoPtr *xf86PciVideoInfo;
-#else
- struct pci_device_iterator *pVideoIter;
-#endif
- Bool DoMach64 = FALSE;
- Bool DoRage128 = FALSE, DoRadeon = FALSE;
- int Chip;
+ struct pci_device *device = NULL;
+ struct pci_device_iterator *device_iter;
- /* Let the sub-drivers probe & configure for themselves */
- if (xf86ServerIsOnlyDetecting())
- return FALSE;
+ device_iter = pci_slot_match_iterator_create(NULL);
+
+ while ((device = pci_device_next(device_iter)) != NULL) {
+ if (xf86IsPrimaryPci(device))
+ break;
+ }
+
+ pci_iterator_destroy(device_iter);
+
+ return device;
+}
+
+#else /* XSERVER_LIBPCIACCESS */
-#ifndef XSERVER_LIBPCIACCESS
+static pciVideoPtr
+ati_device_get_from_busid(int bus, int dev, int func)
+{
+ pciVideoPtr pVideo = NULL;
+ pciVideoPtr *xf86PciVideoInfo;
xf86PciVideoInfo = xf86GetPciVideoInfo();
if (xf86PciVideoInfo == NULL)
- return FALSE;
+ return NULL;
while ((pVideo = *xf86PciVideoInfo++) != NULL)
{
- if ((PCI_DEV_VENDOR_ID(pVideo) != PCI_VENDOR_ATI) ||
- (PCI_DEV_DEVICE_ID(pVideo) == PCI_CHIP_MACH32))
- continue;
-
- /* Check for Rage128's, Radeon's and later adapters */
- Chip = ATIChipID(PCI_DEV_DEVICE_ID(pVideo));
- if (Chip == ATI_CHIP_FAMILY_Mach64)
- DoMach64 = TRUE;
- else if (Chip == ATI_CHIP_FAMILY_Rage128)
- DoRage128 = TRUE;
- else if (Chip == ATI_CHIP_FAMILY_Radeon)
- DoRadeon = TRUE;
+ if ((pVideo->bus == bus) && (pVideo->device == dev) &&
+ (pVideo->func == func))
+ break;
}
-#else /* XSERVER_LIBPCIACCESS */
+ return pVideo;
+}
- pVideoIter = pci_id_match_iterator_create(&ati_device_match);
+static pciVideoPtr
+ati_device_get_primary()
+{
+ pciVideoPtr pVideo = NULL;
+ pciVideoPtr *xf86PciVideoInfo;
- while ((pVideo = pci_device_next(pVideoIter)) != NULL)
- {
- /* Check for non-video devices */
- if (!PCIINFOCLASSES(pVideo->device_class))
- continue;
+ xf86PciVideoInfo = xf86GetPciVideoInfo();
- /* Check for prehistoric PCI Mach32 */
- if ((PCI_DEV_VENDOR_ID(pVideo) != PCI_VENDOR_ATI) ||
- (PCI_DEV_DEVICE_ID(pVideo) == PCI_CHIP_MACH32))
- continue;
+ if (xf86PciVideoInfo == NULL)
+ return NULL;
- /* Check for Rage128's, Radeon's and later adapters */
- Chip = ATIChipID(PCI_DEV_DEVICE_ID(pVideo));
- if (Chip == ATI_CHIP_FAMILY_Mach64)
- DoMach64 = TRUE;
- else if (Chip == ATI_CHIP_FAMILY_Rage128)
- DoRage128 = TRUE;
- else if (Chip == ATI_CHIP_FAMILY_Radeon)
- DoRadeon = TRUE;
+ while ((pVideo = *xf86PciVideoInfo++) != NULL)
+ {
+ if (xf86IsPrimaryPci(pVideo))
+ break;
}
- pci_iterator_destroy(pVideoIter);
+ return pVideo;
+}
#endif /* XSERVER_LIBPCIACCESS */
- /* Call Radeon driver probe */
- if (DoRadeon)
- {
- DriverRec *radeon;
-
- /* If the sub-driver was added, let it probe for itself */
- if (radeon_drv_added)
- return FALSE;
-
- if (!LoaderSymbol(RADEON_NAME))
- xf86LoadDrvSubModule(pDriver, RADEON_DRIVER_NAME);
-
- radeon = (DriverRec*)LoaderSymbol(RADEON_NAME);
-
- if (!radeon)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"radeon\" driver symbol.\n");
- return FALSE;
- }
-
- radeon->Identify(flags);
+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;
- if (radeon->Probe(pDriver, flags))
- return TRUE;
- }
+ /* let the subdrivers configure for themselves */
+ if (xf86ServerIsOnlyDetecting())
+ return;
- /* Call Rage 128 driver probe */
- if (DoRage128)
- {
- DriverRec *r128;
+ /* 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);
- /* If the sub-driver was added, let it probe for itself */
- if (r128_drv_added)
- return FALSE;
+ for (i = 0; i < nATIGDev; i++) {
+ GDevPtr ati_gdev = ATIGDevs[i];
+ pciVideoPtr device = NULL;
+ int chip_family;
- if (!LoaderSymbol(R128_NAME))
- xf86LoadDrvSubModule(pDriver, R128_DRIVER_NAME);
+ /* get pci device for the Device section */
+ if (ati_gdev->busID) {
+ int bus, dev, func;
- r128 = (DriverRec*)LoaderSymbol(R128_NAME);
+ if (!xf86ParsePciBusString(ati_gdev->busID, &bus, &dev, &func))
+ continue;
- if (!r128)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"r128\" driver symbol.\n");
- return FALSE;
+ device = ati_device_get_from_busid(bus, dev, func);
}
-
- r128->Identify(flags);
-
- if (r128->Probe(pDriver, flags))
- return TRUE;
- }
-
- /* Call Mach64 driver probe */
- if (DoMach64)
- {
- DriverRec *mach64;
-
- /* If the sub-driver was added, let it probe for itself */
- if (mach64_drv_added)
- return FALSE;
-
- if (!LoaderSymbol(MACH64_NAME))
- xf86LoadDrvSubModule(pDriver, MACH64_DRIVER_NAME);
-
- mach64 = (DriverRec*)LoaderSymbol(MACH64_NAME);
-
- if (!mach64)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"mach64\" driver symbol.\n");
- return FALSE;
+ else {
+ device = ati_device_get_primary();
}
- mach64->Identify(flags);
-
- if (mach64->Probe(pDriver, flags))
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
- * ATIAvailableOptions --
- *
- * Return recognised options that are intended for public consumption.
- */
-static const OptionInfoRec *
-ATIAvailableOptions
-(
- int ChipId,
- int BusId
-)
-{
- CARD16 ChipType = ChipId & 0xffff;
- int Chip;
+ if (!device)
+ continue;
- /* Probe should have loaded the appropriate subdriver by this point */
+ /* 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;
- Chip = ATIChipID(ChipType);
- if (Chip == ATI_CHIP_FAMILY_Mach64)
- {
- DriverRec *mach64 = (DriverRec*)LoaderSymbol(MACH64_NAME);
+ /* replace Driver line in the Device section */
+ chip_family = ATIChipID(PCI_DEV_DEVICE_ID(device));
- if (!mach64)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"mach64\" driver symbol.\n");
- return NULL;
+ if (chip_family == ATI_CHIP_FAMILY_Mach64) {
+ ati_gdev->driver = MACH64_DRIVER_NAME;
+ load_mach64 = TRUE;
}
- return mach64->AvailableOptions(ChipId, BusId);
- }
-
- if (Chip == ATI_CHIP_FAMILY_Rage128)
- {
- DriverRec *r128 = (DriverRec*)LoaderSymbol(R128_NAME);
-
- if (!r128)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"r128\" driver symbol.\n");
- return NULL;
+ if (chip_family == ATI_CHIP_FAMILY_Rage128) {
+ ati_gdev->driver = R128_DRIVER_NAME;
+ load_r128 = TRUE;
}
- return r128->AvailableOptions(ChipId, BusId);
+ if (chip_family == ATI_CHIP_FAMILY_Radeon) {
+ ati_gdev->driver = RADEON_DRIVER_NAME;
+ load_radeon = TRUE;
+ }
}
- if (Chip == ATI_CHIP_FAMILY_Radeon)
- {
- DriverRec *radeon = (DriverRec*)LoaderSymbol(RADEON_NAME);
+ xfree(ATIGDevs);
- if (!radeon)
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to find \"radeon\" driver symbol.\n");
- return NULL;
- }
+ /* load subdrivers as primary modules and only if they do not get loaded
+ * from other device sections
+ */
- return radeon->AvailableOptions(ChipId, BusId);
- }
+ if (load_mach64 && (nMach64GDev == 0))
+ xf86LoadOneModule(MACH64_DRIVER_NAME, options);
- return NULL;
-}
+ if (load_r128 && (nR128GDev == 0))
+ xf86LoadOneModule(R128_DRIVER_NAME, options);
-/* The root of all evil... */
-_X_EXPORT DriverRec ATI =
-{
- ATI_VERSION_CURRENT,
- "ati",
- ATIIdentify,
- ATIProbe,
- ATIAvailableOptions,
- NULL,
- 0
-};
+ if (load_radeon && (nRadeonGDev == 0))
+ xf86LoadOneModule(RADEON_DRIVER_NAME, options);
+}
/*
* ATIChipID --
diff --git a/src/ati.h b/src/ati.h
index e86e50c1..828aae10 100644
--- a/src/ati.h
+++ b/src/ati.h
@@ -31,8 +31,4 @@
#include "xf86_OSproc.h"
-extern void ati_check_subdriver_added();
-
-extern DriverRec ATI;
-
#endif /* ___ATI_H___ */
diff --git a/src/atimach64probe.c b/src/atimach64probe.c
index ffab153b..2b701d71 100644
--- a/src/atimach64probe.c
+++ b/src/atimach64probe.c
@@ -30,7 +30,6 @@
#include "atimach64probe.h"
#include "atimach64version.h"
#include "atioption.h"
-#include "ativersion.h"
/* include headers corresponding to ScrnInfoPtr fields */
#include "atipreinit.h"
@@ -110,10 +109,6 @@ Mach64PciChipsets[] = {
static const OptionInfoRec *
Mach64AvailableOptions(int chipid, int busid)
{
- /*
- * Return options defined in the mach64 submodule which will have been
- * loaded by this point.
- */
return ATIOptionsWeak();
}
@@ -141,9 +136,9 @@ Mach64Identify
static Bool
Mach64Probe(DriverPtr pDriver, int flags)
{
- GDevPtr *devSections, *ATIGDevs, *Mach64GDevs;
+ GDevPtr *devSections;
int *usedChips;
- int numDevSections, nATIGDev, nMach64GDev;
+ int numDevSections;
int numUsed;
Bool ProbeSuccess = FALSE;
@@ -152,31 +147,11 @@ Mach64Probe(DriverPtr pDriver, int flags)
return FALSE;
#endif
- /* Collect unclaimed device sections for both driver names */
- nATIGDev = xf86MatchDevice(ATI_DRIVER_NAME, &ATIGDevs);
- nMach64GDev = xf86MatchDevice(MACH64_DRIVER_NAME, &Mach64GDevs);
+ numDevSections = xf86MatchDevice(MACH64_DRIVER_NAME, &devSections);
- if ((numDevSections = nATIGDev + nMach64GDev) <= 0)
+ if (numDevSections <= 0)
return FALSE;
- if (ATIGDevs == NULL) {
- devSections = Mach64GDevs;
- numDevSections = nMach64GDev;
- } else if (Mach64GDevs == NULL) {
- devSections = ATIGDevs;
- numDevSections = nATIGDev;
- } else {
- /* Combine into one list */
- devSections = xnfalloc((numDevSections + 1) * sizeof(GDevPtr));
- (void)memcpy(devSections,
- ATIGDevs, nATIGDev * sizeof(GDevPtr));
- (void)memcpy(devSections + nATIGDev,
- Mach64GDevs, nMach64GDev * sizeof(GDevPtr));
- devSections[numDevSections] = NULL;
- xfree(ATIGDevs);
- xfree(Mach64GDevs);
- }
-
numUsed = xf86MatchPciInstances(MACH64_NAME, PCI_VENDOR_ATI,
Mach64Chipsets, Mach64PciChipsets,
devSections, numDevSections,
diff --git a/src/atimisc.c b/src/atimisc.c
index cf2347a3..0bcbff5b 100644
--- a/src/atimisc.c
+++ b/src/atimisc.c
@@ -25,8 +25,6 @@
#endif
#include "ati.h"
-#include "ativersion.h"
-
#include "atimach64probe.h"
#include "atimach64version.h"
@@ -34,7 +32,7 @@
static XF86ModuleVersionInfo ATIVersionRec =
{
- "mach64",
+ MACH64_DRIVER_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
@@ -64,10 +62,8 @@ ATISetup
if (!Inited)
{
- if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
- xf86AddDriver(&MACH64, Module, 0);
-
Inited = TRUE;
+ xf86AddDriver(&MACH64, Module, 0);
}
return (pointer)TRUE;
diff --git a/src/atimodule.c b/src/atimodule.c
index 802c35ad..c2493338 100644
--- a/src/atimodule.c
+++ b/src/atimodule.c
@@ -27,6 +27,8 @@
#include "ati.h"
#include "ativersion.h"
+extern void ati_gdev_subdriver(pointer options);
+
/* Module loader interface */
static XF86ModuleVersionInfo ATIVersionRec =
@@ -62,9 +64,7 @@ ATISetup
if (!Inited)
{
Inited = TRUE;
- xf86AddDriver(&ATI, Module, 0);
-
- ati_check_subdriver_added();
+ ati_gdev_subdriver(Options);
}
return (pointer)1;
diff --git a/src/r128_misc.c b/src/r128_misc.c
index f8bccfef..5eb6fac0 100644
--- a/src/r128_misc.c
+++ b/src/r128_misc.c
@@ -24,8 +24,6 @@
#include "config.h"
#endif
-#include "ativersion.h"
-
#include "r128_probe.h"
#include "r128_version.h"
@@ -65,10 +63,8 @@ R128Setup
if (!Inited)
{
- if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
- xf86AddDriver(&R128, Module, 0);
-
Inited = TRUE;
+ xf86AddDriver(&R128, Module, 0);
}
return (pointer)TRUE;
diff --git a/src/r128_probe.c b/src/r128_probe.c
index 75fae31a..8fc65cb8 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -37,12 +37,8 @@
* Authors:
* Rickard E. Faith <faith@valinux.com>
* Kevin E. Martin <martin@valinux.com>
- *
- * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge.
*/
-#include "ativersion.h"
-
#include "r128_probe.h"
#include "r128_version.h"
@@ -158,19 +154,7 @@ int gR128EntityIndex = -1;
static const OptionInfoRec *
R128AvailableOptions(int chipid, int busid)
{
- int i;
-
- /*
- * Return options defined in the r128 submodule which will have been
- * loaded by this point.
- */
- if ((chipid >> 16) == PCI_VENDOR_ATI)
- chipid -= PCI_VENDOR_ATI << 16;
- for (i = 0; R128PciChipsets[i].PCIid > 0; i++) {
- if (chipid == R128PciChipsets[i].PCIid)
- return R128OptionsWeak();
- }
- return NULL;
+ return R128OptionsWeak();
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
@@ -187,9 +171,9 @@ static Bool
R128Probe(DriverPtr drv, int flags)
{
int numUsed;
- int numDevSections, nATIGDev, nR128GDev;
+ int numDevSections;
int *usedChips;
- GDevPtr *devSections, *ATIGDevs, *R128GDevs;
+ GDevPtr *devSections;
Bool foundScreen = FALSE;
int i;
@@ -197,31 +181,9 @@ R128Probe(DriverPtr drv, int flags)
if (!xf86GetPciVideoInfo()) return FALSE;
#endif
- /* Collect unclaimed device sections for both driver names */
- nATIGDev = xf86MatchDevice(ATI_NAME, &ATIGDevs);
- nR128GDev = xf86MatchDevice(R128_NAME, &R128GDevs);
-
- if (!(numDevSections = nATIGDev + nR128GDev)) return FALSE;
+ numDevSections = xf86MatchDevice(R128_NAME, &devSections);
- if (!ATIGDevs) {
- if (!(devSections = R128GDevs))
- numDevSections = 1;
- else
- numDevSections = nR128GDev;
- } if (!R128GDevs) {
- devSections = ATIGDevs;
- numDevSections = nATIGDev;
- } else {
- /* Combine into one list */
- devSections = xnfalloc((numDevSections + 1) * sizeof(GDevPtr));
- (void)memcpy(devSections,
- ATIGDevs, nATIGDev * sizeof(GDevPtr));
- (void)memcpy(devSections + nATIGDev,
- R128GDevs, nR128GDev * sizeof(GDevPtr));
- devSections[numDevSections] = NULL;
- xfree(ATIGDevs);
- xfree(R128GDevs);
- }
+ if (!numDevSections) return FALSE;
numUsed = xf86MatchPciInstances(R128_NAME,
PCI_VENDOR_ATI,
diff --git a/src/radeon_misc.c b/src/radeon_misc.c
index fc608ddc..a5a2cccc 100644
--- a/src/radeon_misc.c
+++ b/src/radeon_misc.c
@@ -24,8 +24,6 @@
#include "config.h"
#endif
-#include "ativersion.h"
-
#include "radeon_probe.h"
#include "radeon_version.h"
@@ -64,10 +62,8 @@ RADEONSetup
static Bool Inited = FALSE;
if (!Inited) {
- if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
- xf86AddDriver(&RADEON, Module, 0);
-
Inited = TRUE;
+ xf86AddDriver(&RADEON, Module, 0);
}
return (pointer)TRUE;
diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index 0cf54b6c..49745309 100644
--- a/src/radeon_probe.c
+++ b/src/radeon_probe.c
@@ -36,12 +36,8 @@
* Authors:
* Kevin E. Martin <martin@xfree86.org>
* Rickard E. Faith <faith@valinux.com>
- *
- * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge.
*/
-#include "ativersion.h"
-
#include "radeon_probe.h"
#include "radeon_version.h"
#include "atipciids.h"
@@ -61,19 +57,7 @@ int gRADEONEntityIndex = -1;
static const OptionInfoRec *
RADEONAvailableOptions(int chipid, int busid)
{
- int i;
-
- /*
- * Return options defined in the radeon submodule which will have been
- * loaded by this point.
- */
- if ((chipid >> 16) == PCI_VENDOR_ATI)
- chipid -= PCI_VENDOR_ATI << 16;
- for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) {
- if (chipid == RADEONPciChipsets[i].PCIid)
- return RADEONOptionsWeak();
- }
- return NULL;
+ return RADEONOptionsWeak();
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
@@ -90,9 +74,9 @@ static Bool
RADEONProbe(DriverPtr drv, int flags)
{
int numUsed;
- int numDevSections, nATIGDev, nRadeonGDev;
+ int numDevSections;
int *usedChips;
- GDevPtr *devSections, *ATIGDevs, *RadeonGDevs;
+ GDevPtr *devSections;
Bool foundScreen = FALSE;
int i;
@@ -100,29 +84,9 @@ RADEONProbe(DriverPtr drv, int flags)
if (!xf86GetPciVideoInfo()) return FALSE;
#endif
- /* Collect unclaimed device sections for both driver names */
- nATIGDev = xf86MatchDevice(ATI_NAME, &ATIGDevs);
- nRadeonGDev = xf86MatchDevice(RADEON_NAME, &RadeonGDevs);
+ numDevSections = xf86MatchDevice(RADEON_NAME, &devSections);
- if (!(numDevSections = nATIGDev + nRadeonGDev)) return FALSE;
-
- if (!ATIGDevs) {
- if (!(devSections = RadeonGDevs)) numDevSections = 1;
- else numDevSections = nRadeonGDev;
- } if (!RadeonGDevs) {
- devSections = ATIGDevs;
- numDevSections = nATIGDev;
- } else {
- /* Combine into one list */
- devSections = xnfalloc((numDevSections + 1) * sizeof(GDevPtr));
- (void)memcpy(devSections,
- ATIGDevs, nATIGDev * sizeof(GDevPtr));
- (void)memcpy(devSections + nATIGDev,
- RadeonGDevs, nRadeonGDev * sizeof(GDevPtr));
- devSections[numDevSections] = NULL;
- xfree(ATIGDevs);
- xfree(RadeonGDevs);
- }
+ if (!numDevSections) return FALSE;
numUsed = xf86MatchPciInstances(RADEON_NAME,
PCI_VENDOR_ATI,