Commit 46f55f5d authored by Ian Romanick's avatar Ian Romanick

Initial batch of changes for PCI rework. All future changes will be

tracked individually.
parent d00aa6b8
......@@ -1032,6 +1032,10 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl")
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.3.0])
XORG_LIBS="$XORG_LIBS $PCIACCESS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
linux*)
if test "x$LNXAPM" = xyes; then
......@@ -1191,7 +1195,6 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
AC_SUBST([XORG_OS_SUBDIR])
AC_SUBST([XORG_OS_KBD])
dnl only used in hw/xfree86/scanpci, TTBOMK
AC_PATH_PROG(PERL, perl, no)
dnl unlikely as this may be ...
if test "x$PERL" = xno; then
......@@ -1670,7 +1673,6 @@ hw/xfree86/os-support/usl/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/rac/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/scanpci/Makefile
hw/xfree86/shadowfb/Makefile
hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
......@@ -1685,8 +1687,6 @@ hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile
hw/xfree86/utils/ioport/Makefile
hw/xfree86/utils/kbd_mode/Makefile
hw/xfree86/utils/pcitweak/Makefile
hw/xfree86/utils/scanpci/Makefile
hw/xfree86/utils/xorgcfg/Makefile
hw/xfree86/utils/xorgconfig/Makefile
hw/dmx/config/Makefile
......
......@@ -6,12 +6,12 @@ DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp xf8_16bpp \
xf8_32bpp loader scanpci dixmods exa \
xf8_32bpp loader dixmods exa \
$(DRI_SUBDIR) utils $(DOC_SUBDIR) getconfig
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
xf8_16bpp xf8_32bpp loader scanpci dixmods dri exa \
xf8_16bpp xf8_32bpp loader dixmods dri exa \
utils doc getconfig
bin_PROGRAMS = Xorg
......
......@@ -47,7 +47,7 @@ libinit_a_SOURCES = xf86Build.h xf86Init.c
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
-I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
......
......@@ -37,6 +37,8 @@
#ifndef _XF86_H
#define _XF86_H
#include <pciaccess.h>
#include "xf86str.h"
#include "xf86Opt.h"
#include <X11/Xfuncproto.h>
......@@ -94,16 +96,13 @@ extern CARD32 xf86DummyVar3;
/* xf86Bus.c */
Bool xf86CheckPciSlot(int bus, int device, int func);
int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
Bool xf86CheckPciSlot( const struct pci_device * );
int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
int *func);
Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
void xf86FormatPciBusNumber(int busnum, char *buffer);
pciVideoPtr *xf86GetPciVideoInfo(void);
pciConfigPtr *xf86GetPciConfigInfo(void);
void xf86SetPciVideo(pciVideoPtr, resType);
void xf86PrintResList(int verb, resPtr list);
resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
......@@ -114,7 +113,7 @@ int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
void xf86EnableAccess(ScrnInfoPtr pScrn);
void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
Bool xf86IsPrimaryPci(pciVideoPtr pPci);
Bool xf86IsPrimaryPci(struct pci_device * pPci);
Bool xf86IsPrimaryIsa(void);
/* new RAC */
resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
......@@ -130,19 +129,17 @@ int xf86GetNumEntityInstances(int entityIndex);
GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
EntityInfoPtr xf86GetEntityInfo(int entityIndex);
pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
int xf86GetPciEntity(int bus, int dev, int func);
Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, pointer);
void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type);
resPtr xf86RegisterResources(int entityIndex, resList list,
unsigned long Access);
Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base);
Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base);
void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
xf86SetAccessFuncPtr oldFuncs);
Bool xf86IsEntityPrimary(int entityIndex);
Bool xf86FixPciResource(int entityIndex, int prt, memType alignment,
unsigned long type);
resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
void xf86EnterServerState(xf86State state);
......@@ -153,17 +150,13 @@ resRange xf86GetSparse(unsigned long type, memType fixed_bits,
memType decode_mask, memType address_mask,
resPtr avoid);
memType xf86ChkConflict(resRange *rgp, int entityIndex);
Bool xf86IsPciDevPresent(int bus, int dev, int func);
ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
Bool xf86NoSharedResources(int screenIndex, resType res);
resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2);
pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
char n, pciVideoPtr pvp_exclude);
pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
char n, pciVideoPtr pvp_exclude);
#ifdef INCLUDE_DEPRECATED
void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable);
#endif
struct pci_device * xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
char n, const struct pci_device * pvp_exclude);
struct pci_device * xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
char n, const struct pci_device * pvp_exclude);
void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
#ifdef async
......@@ -185,8 +178,8 @@ DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
void *busData, int chipset);
GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo,
int chipset);
GDevPtr xf86AddDeviceToConfigure( const char *driver,
struct pci_device * pVideo, int chipset );
/* xf86Cursor.c */
......
......@@ -176,7 +176,8 @@ xf86AutoConfig(void)
{
const char **p;
char buf[1024];
pciVideoPtr *pciptr, info = NULL;
struct pci_device ** pciptr;
struct pci_device * info = NULL;
char *driver = NULL;
FILE *gp = NULL;
ConfigStatus ret;
......@@ -267,8 +268,8 @@ xf86AutoConfig(void)
}
strcat(searchPath, GETCONFIG_DIR);
ErrorF("xf86AutoConfig: Primary PCI is %d:%d:%d\n",
info->bus, info->device, info->func);
ErrorF("xf86AutoConfig: Primary PCI is %u@%u:%u:%u\n",
info->domain, info->bus, info->dev, info->func);
snprintf(buf, sizeof(buf), "%s"
#ifdef DEBUG
......@@ -281,9 +282,9 @@ xf86AutoConfig(void)
path,
(unsigned int)xorgGetVersion(),
searchPath,
info->vendor, info->chipType, info->chipRev,
info->subsysVendor, info->subsysCard,
info->class << 8 | info->subclass);
info->vendor_id, info->device_id, info->revision,
info->subvendor_id, info->subdevice_id,
info->device_class >> 8);
ErrorF("Running \"%s\"\n", buf);
gp = Popen(buf, "r");
if (gp) {
......@@ -365,4 +366,3 @@ xf86AutoConfig(void)
return FALSE;
}
}
......@@ -53,6 +53,7 @@
#include "xf86_OSproc.h"
#include "xf86RAC.h"
#include "Pci.h"
/* Entity data */
EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
......@@ -1402,7 +1403,9 @@ xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex)
void
xf86ResourceBrokerInit(void)
{
#if 0
resPtr resPci;
#endif
osRes = NULL;
......@@ -1417,8 +1420,12 @@ xf86ResourceBrokerInit(void)
xf86PrintResList(3, osRes);
/* Bus dep initialization */
#if 0
resPci = ResourceBrokerInitPci(&osRes);
Acc = xf86JoinResLists(xf86DupResList(osRes), resPci);
#else
Acc = xf86DupResList( osRes );
#endif
xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n");
xf86PrintResList(3, Acc);
......@@ -1806,7 +1813,7 @@ xf86GetResourcesImplicitly(int entityIndex)
case BUS_SBUS:
return NULL;
case BUS_PCI:
return GetImplicitPciResources(entityIndex);
return NULL;
case BUS_last:
return NULL;
}
......@@ -1888,31 +1895,32 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
}
static void
busTypeSpecific(EntityPtr pEnt, xf86State state, xf86AccessPtr *acc_mem,
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
busTypeSpecific( EntityPtr pEnt, xf86AccessPtr *acc_mem,
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io )
{
pciAccPtr *ppaccp;
switch (pEnt->bus.type) {
case BUS_ISA:
case BUS_SBUS:
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
break;
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
break;
case BUS_PCI:
ppaccp = xf86PciAccInfo;
while (*ppaccp) {
if ((*ppaccp)->busnum == pEnt->pciBusId.bus
&& (*ppaccp)->devnum == pEnt->pciBusId.device
&& (*ppaccp)->funcnum == pEnt->pciBusId.func) {
*acc_io = &(*ppaccp)->ioAccess;
*acc_mem = &(*ppaccp)->memAccess;
*acc_mem_io = &(*ppaccp)->io_memAccess;
break;
case BUS_PCI: {
struct pci_device * dev =
pci_device_find_by_slot( PCI_DOM_FROM_BUS( pEnt->pciBusId.bus ),
PCI_BUS_NO_DOMAIN( pEnt->pciBusId.bus ),
pEnt->pciBusId.device,
pEnt->pciBusId.func );
if ( dev != NULL ) {
pciAccPtr paccp = (pciAccPtr) dev->user_data;
if ( paccp != NULL ) {
*acc_io = & paccp->ioAccess;
*acc_mem = & paccp->memAccess;
*acc_mem_io = & paccp->io_memAccess;
}
ppaccp++;
}
break;
}
default:
*acc_mem = *acc_io = *acc_mem_io = NULL;
break;
......@@ -1928,7 +1936,7 @@ setAccess(EntityPtr pEnt, xf86State state)
xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL;
int prop;
busTypeSpecific(pEnt,state,&acc_mem,&acc_io,&acc_mem_io);
busTypeSpecific( pEnt, &acc_mem, &acc_io, &acc_mem_io );
/* The replacement function needs to handle _all_ shared resources */
/* unless they are handeled locally and disabled otherwise */
......@@ -2481,15 +2489,6 @@ xf86PostProbe(void)
#endif
}
xf86FreeResList(acc);
#if !(defined(__alpha__) && defined(linux)) && \
!(defined(__ia64__) && defined(linux)) && \
!(defined(__sparc64__) && defined(__OpenBSD__))
/*
* No need to validate on Alpha Linux or OpenBSD/sparc64,
* trust the kernel.
*/
ValidatePci();
#endif
xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n");
xf86PrintResList(3, Acc);
......
......@@ -124,7 +124,7 @@ typedef struct x_BusAccRec {
struct {
int bus;
int primary_bus;
PCITAG acc;
struct pci_device * dev;
pciBridgesSave save;
} pci;
} busdep;
......
......@@ -36,6 +36,8 @@
#include <fcntl.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <pciaccess.h>
#include "Pci.h"
#include "os.h"
#ifdef XFree86LOADER
#include "loaderProcs.h"
......@@ -44,7 +46,6 @@
#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xf86Priv.h"
#include "xf86PciData.h"
#define IN_XSERVER
#include "xf86Parser.h"
#include "xf86tokens.h"
......@@ -59,7 +60,7 @@
typedef struct _DevToConfig {
GDevRec GDev;
pciVideoPtr pVideo;
struct pci_device * pVideo;
#if defined(__sparc__) && !defined(__OpenBSD__)
sbusDevicePtr sVideo;
#endif
......@@ -104,7 +105,7 @@ GDevPtr
xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
{
int i, j;
pciVideoPtr pVideo = NULL;
struct pci_device * pVideo = NULL;
Bool isPrimary = FALSE;
if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1)
......@@ -113,11 +114,12 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
/* Check for duplicates */
switch (bus) {
case BUS_PCI:
pVideo = (pciVideoPtr) busData;
pVideo = (struct pci_device *) busData;
for (i = 0; i < nDevToConfig; i++)
if (DevToConfig[i].pVideo &&
(DevToConfig[i].pVideo->domain == pVideo->domain) &&
(DevToConfig[i].pVideo->bus == pVideo->bus) &&
(DevToConfig[i].pVideo->device == pVideo->device) &&
(DevToConfig[i].pVideo->dev == pVideo->dev) &&
(DevToConfig[i].pVideo->func == pVideo->func))
return NULL;
isPrimary = xf86IsPrimaryPci(pVideo);
......@@ -176,9 +178,9 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
char busnum[8];
NewDevice.pVideo = pVideo;
xf86FindPciNamesByDevice(pVideo->vendor, pVideo->chipType,
NOVENDOR, NOSUBSYS,
&VendorName, &CardName, NULL, NULL);
VendorName = pci_device_get_vendor_name( pVideo );
CardName = pci_device_get_device_name( pVideo );
if (!VendorName) {
VendorName = xnfalloc(15);
......@@ -200,13 +202,13 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
NewDevice.GDev.busID = xnfalloc(16);
xf86FormatPciBusNumber(pVideo->bus, busnum);
sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d",
busnum, pVideo->device, pVideo->func);
busnum, pVideo->dev, pVideo->func);
NewDevice.GDev.chipID = pVideo->chipType;
NewDevice.GDev.chipRev = pVideo->chipRev;
NewDevice.GDev.chipID = pVideo->device_id;
NewDevice.GDev.chipRev = pVideo->revision;
if (chipset < 0)
chipset = (pVideo->vendor << 16) | pVideo->chipType;
chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
}
break;
case BUS_ISA:
......@@ -252,7 +254,8 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
* Backwards compatibility
*/
_X_EXPORT GDevPtr
xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, int chipset)
xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo,
int chipset)
{
return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA,
pVideo, chipset);
......@@ -828,22 +831,20 @@ DoConfigure()
/* Call all of the probe functions, reporting the results. */
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
xorgHWFlags flags;
Bool found_screen;
DriverRec * const drv = xf86DriverList[CurrentDriver];
if (!xorgHWAccess) {
if (!xf86DriverList[CurrentDriver]->driverFunc
|| !xf86DriverList[CurrentDriver]->driverFunc(NULL,
GET_REQUIRED_HW_INTERFACES,
&flags)
if (!drv->driverFunc
|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
|| NEED_IO_ENABLED(flags))
continue;
}
if (xf86DriverList[CurrentDriver]->Probe == NULL) continue;
if ((*xf86DriverList[CurrentDriver]->Probe)(
xf86DriverList[CurrentDriver], PROBE_DETECT) &&
xf86DriverList[CurrentDriver]->Identify)
(*xf86DriverList[CurrentDriver]->Identify)(0);
found_screen = xf86CallDriverProbe( drv, TRUE );
if ( found_screen && drv->Identify ) {
(*drv->Identify)(0);
}
}
if (nDevToConfig <= 0) {
......@@ -932,7 +933,7 @@ DoConfigure()
oldNumScreens = xf86NumScreens;
(*xf86DriverList[i]->Probe)(xf86DriverList[i], 0);
xf86CallDriverProbe( xf86DriverList[i], FALSE );
/* reorder */
k = screennum > 0 ? screennum : 1;
......@@ -960,7 +961,6 @@ DoConfigure()
}
}
}
xf86SetPciVideo(NULL,NONE);
}
xfree(driverProbed);
}
......
......@@ -97,9 +97,7 @@ DoProbe()
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
if (drv->Probe == NULL) continue;
probeResult = (*drv->Probe)( drv, PROBE_DETECT );
probeResult = xf86CallDriverProbe( drv, TRUE );
if (!probeResult) {
xf86ErrorF("Probe in driver `%s' returns FALSE\n",
drv->driverName);
......
......@@ -39,6 +39,7 @@
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <pciaccess.h>
#include "os.h"
#ifdef XFree86LOADER
#include "loaderProcs.h"
......@@ -46,17 +47,100 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Pci.h"
#include "xf86ScanPci.h"
static void ScanPciDisplayPCICardInfo( int verbosity );
void
ScanPciDisplayPCICardInfo(int verbosity)
{
struct pci_id_match match;
pciConfigPtr pcrp, *pcrpp;
int i;
xf86EnableIO();
pcrpp = xf86scanpci(0);
if (pcrpp == NULL) {
xf86MsgVerb(X_NONE,0,"No PCI info available\n");
return;
}
xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus:Device:Function)\n\n");
for (i = 0; (pcrp = pcrpp[i]); i++) {
const char *svendorname = NULL, *subsysname = NULL;
const char *vendorname = NULL, *devicename = NULL;
Bool noCard = FALSE;
const char *prefix1 = "", *prefix2 = "";
xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ",
pcrp->busnum, pcrp->devnum, pcrp->funcnum);
/*
* Lookup as much as we can about the device.
*/
match.vendor_id = pcrp->pci_vendor;
match.device_id = pcrp->_pci_device;
match.subvendor_id = (pcrp->pci_subsys_vendor != 0)
? pcrp->pci_subsys_vendor : PCI_MATCH_ANY;
match.subdevice_id = (pcrp->pci_subsys_card != 0)
? pcrp->pci_subsys_card : PCI_MATCH_ANY;
match.device_class = 0;
match.device_class_mask = 0;
pci_get_strings( & match, & vendorname, & devicename,
& svendorname, & subsysname);
if (svendorname)
xf86MsgVerb(X_NONE, -verbosity, "%s ", svendorname);
if (subsysname)
xf86MsgVerb(X_NONE, -verbosity, "%s ", subsysname);
if (svendorname && !subsysname) {
if ( match.subdevice_id != PCI_MATCH_ANY ) {
xf86MsgVerb(X_NONE, -verbosity, "unknown card (0x%04x) ",
match.subdevice_id);
} else {
xf86MsgVerb(X_NONE, -verbosity, "card ");
}
}
if (!svendorname && !subsysname) {
/*
* We didn't find a text representation of the information
* about the card.
*/
if ( (match.subvendor_id != PCI_MATCH_ANY)
|| (match.subdevice_id != PCI_MATCH_ANY) ) {
/*
* If there was information and we just couldn't interpret
* it, print it out as unknown, anyway.
*/
xf86MsgVerb(X_NONE, -verbosity,
"unknown card (0x%04x/0x%04x) ",
match.subvendor_id, match.subdevice_id);
} else
noCard = TRUE;
}
if (!noCard) {
prefix1 = "using a ";
prefix2 = "using an ";
}
if (vendorname && devicename) {
xf86MsgVerb(X_NONE, -verbosity,"%s%s %s\n", prefix1, vendorname,
devicename);
} else if (vendorname) {
xf86MsgVerb(X_NONE, -verbosity,
"%sunknown chip (DeviceId 0x%04x) from %s\n",
prefix2, match.device_id, vendorname);
} else {
xf86MsgVerb(X_NONE, -verbosity,
"%sunknown chipset(0x%04x/0x%04x)\n",
prefix2, match.vendor_id, match.device_id);
}
}
}
void DoScanPci(int argc, char **argv, int i)
{
int j,skip,globalVerbose,scanpciVerbose;
ScanPciSetupProcPtr PciSetup;
ScanPciDisplayCardInfoProcPtr DisplayPCICardInfo;
#ifdef XFree86LOADER
int errmaj, errmin;
#endif
int j,skip,globalVerbose;
/*
* first we need to finish setup of the OS so that we can call other
......@@ -90,37 +174,7 @@ void DoScanPci(int argc, char **argv, int i)
* Setting scanpciVerbose to 0 will ensure that the output will go to
* stderr for all reasonable default stderr verbosity levels.
*/
scanpciVerbose = 0;
/*
* now get the loader set up and load the scanpci module
*/
#ifdef XFree86LOADER
/* Initialise the loader */
LoaderInit();
/* Tell the loader the default module search path */
LoaderSetPath(xf86ModulePath);
if (!LoadModule("scanpci", NULL, NULL, NULL, NULL, NULL,
&errmaj, &errmin)) {
LoaderErrorMsg(NULL, "scanpci", errmaj, errmin);
exit(1);
}
if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) {
/* For now, just a warning */
xf86Msg(X_WARNING, "Some symbols could not be resolved!\n");
}
PciSetup = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds");
DisplayPCICardInfo =
(ScanPciDisplayCardInfoProcPtr)LoaderSymbol("ScanPciDisplayPCICardInfo");
#else
PciSetup = ScanPciSetupPciIds;
DisplayPCICardInfo = ScanPciDisplayPCICardInfo;
#endif
if (!(*PciSetup)())
FatalError("ScanPciSetupPciIds() failed\n");
(*DisplayPCICardInfo)(scanpciVerbose);
ScanPciDisplayPCICardInfo( 0 );
/*
* That's it; we really should clean things up, but a simple
......
This diff is collapsed.
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.212 2004/01/27 01:31:45 dawes Exp $ */
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Init.c,v 1.36 2006/06/01 18:47:01 daniels Exp $ */
/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Init.c,v 1.37 2006/06/01 19:37:53 ajax Exp $ */
/*
* Loosely based on code bearing the following copyright:
......@@ -114,13 +114,6 @@ extern void os2ServerVideoAccess();
void (*xf86OSPMClose)(void) = NULL;
#endif
#ifdef XFree86LOADER
static char *baseModules[] = {
"pcidata",
NULL
};
#endif
/* Common pixmap formats */
static PixmapFormatRec formats[MAXFORMATS] = {
......@@ -267,6 +260,53 @@ PostConfigInit(void)
OsInitColors();
}
/**
* Call the driver's correct probe function.
*
* If the driver implements the \c DriverRec::PciProbe entry-point and an
* appropriate PCI device (with matching Device section in the xorg.conf file)
* is found, it is called. If \c DriverRec::PciProbe or no devices can be
* successfully probed with it (e.g., only non-PCI devices are available),
* the driver's \c DriverRec::Probe function is called.
*
* \param drv Driver to probe
*
* \return
* If a device can be successfully probed by the driver, \c TRUE is
* returned. Otherwise, \c FALSE is returned.
*/
Bool
xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
{
Bool foundScreen = FALSE;
if ( drv->PciProbe != NULL ) {
if ( xf86DoProbe ) {
assert( detect_only );
foundScreen = check_for_matching_devices( drv );
}
else if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
assert( detect_only );
foundScreen = add_matching_devices_to_configure_list( drv );
}
else {
assert( ! detect_only );
foundScreen = probe_devices_from_device_sections( drv );
}
}
if ( ! foundScreen && (drv->Probe != NULL) ) {
xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
drv->driverName );
foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
: PROBE_DEFAULT );
}
return foundScreen;
}
void
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
......@@ -372,11 +412,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
LoaderFreeDirList(list);
}
#endif
/* Force load mandatory base modules */
if (!xf86LoadModules(baseModules, NULL))
FatalError("Unable to load required base modules, Exiting...\n");
#endif
xf86OpenConsole();
......@@ -501,16 +536,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|| NEED_IO_ENABLED(flags))
continue;
}
if (xf86DriverList[i]->Probe != NULL)
xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
else {
xf86MsgVerb(X_WARNING, 0,
"Driver `%s' has no Probe function (ignoring)\n",
xf86DriverList[i]->driverName
? xf86DriverList[i]->driverName : "noname");
}
xf86SetPciVideo(NULL,NONE);
xf86CallDriverProbe( xf86DriverList[i], FALSE );
}