Eliminate all the code for querying the PCI class from the PCI ID database.
Class information is not, and never has been, stored there. Therefore, this is just a bunch of elaborate code to read 0x00000000. This has received testing on x86 and x86-64 Linux.
This commit is contained in:
parent
6d7083bd69
commit
5fd0f94006
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2006-02-20 Ian Romanick <idr@us.ibm.com>
|
||||||
|
|
||||||
|
* hw/xfree86/common/xf86pciBus.c: (FindPCIVideoInfo),
|
||||||
|
(xf86GetPciRes):
|
||||||
|
* hw/xfree86/common/xf86str.h:
|
||||||
|
* hw/xfree86/os-support/bus/xf86Pci.h:
|
||||||
|
* hw/xfree86/scanpci/xf86PciData.h:
|
||||||
|
* hw/xfree86/scanpci/xf86ScanPci.c:
|
||||||
|
Eliminate all the code for querying the PCI class from the PCI
|
||||||
|
ID database. Class information is not, and never has been,
|
||||||
|
stored there. Therefore, this is just a bunch of elaborate
|
||||||
|
code to read 0x00000000.
|
||||||
|
|
||||||
|
|
||||||
2006-02-21 Adam Jackson <ajax@freedesktop.org>
|
2006-02-21 Adam Jackson <ajax@freedesktop.org>
|
||||||
|
|
||||||
* Xi/allowev.c:
|
* Xi/allowev.c:
|
||||||
|
|
|
@ -67,8 +67,6 @@ ScanPciSetupProcPtr xf86SetupPciIds = NULL;
|
||||||
ScanPciCloseProcPtr xf86ClosePciIds = NULL;
|
ScanPciCloseProcPtr xf86ClosePciIds = NULL;
|
||||||
ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice = NULL;
|
ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice = NULL;
|
||||||
ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys = NULL;
|
ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys = NULL;
|
||||||
ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys = NULL;
|
|
||||||
ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice = NULL;
|
|
||||||
|
|
||||||
static resPtr pciAvoidRes = NULL;
|
static resPtr pciAvoidRes = NULL;
|
||||||
|
|
||||||
|
@ -148,7 +146,6 @@ static PciBusPtr xf86PciBus = NULL;
|
||||||
#define PV_I_RANGE(range,pvp,i,type) \
|
#define PV_I_RANGE(range,pvp,i,type) \
|
||||||
P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type)
|
P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type)
|
||||||
|
|
||||||
static void getPciClassFlags(pciConfigPtr *pcrpp);
|
|
||||||
static void pciConvertListToHost(int bus, int dev, int func, resPtr list);
|
static void pciConvertListToHost(int bus, int dev, int func, resPtr list);
|
||||||
static PciBusPtr xf86GetPciBridgeInfo(void);
|
static PciBusPtr xf86GetPciBridgeInfo(void);
|
||||||
|
|
||||||
|
@ -199,25 +196,17 @@ FindPCIVideoInfo(void)
|
||||||
if (xf86IsolateDevice.bus || xf86IsolateDevice.device || xf86IsolateDevice.func)
|
if (xf86IsolateDevice.bus || xf86IsolateDevice.device || xf86IsolateDevice.func)
|
||||||
DoIsolateDeviceCheck = 1;
|
DoIsolateDeviceCheck = 1;
|
||||||
pcrpp = xf86PciInfo = xf86scanpci(0);
|
pcrpp = xf86PciInfo = xf86scanpci(0);
|
||||||
getPciClassFlags(pcrpp);
|
|
||||||
|
|
||||||
if (pcrpp == NULL) {
|
if (pcrpp == NULL) {
|
||||||
xf86PciVideoInfo = NULL;
|
xf86PciVideoInfo = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xf86PciBus = xf86GetPciBridgeInfo();
|
xf86PciBus = xf86GetPciBridgeInfo();
|
||||||
|
|
||||||
while ((pcrp = pcrpp[i])) {
|
|
||||||
int baseclass;
|
|
||||||
int subclass;
|
|
||||||
|
|
||||||
if (pcrp->listed_class & 0xffff) {
|
while ((pcrp = pcrpp[i])) {
|
||||||
baseclass = (pcrp->listed_class >> 8) & 0xff;
|
const int baseclass = pcrp->pci_base_class;
|
||||||
subclass = pcrp->listed_class & 0xff;
|
const int subclass = pcrp->pci_sub_class;
|
||||||
} else {
|
|
||||||
baseclass = pcrp->pci_base_class;
|
|
||||||
subclass = pcrp->pci_sub_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PCIINFOCLASSES(baseclass, subclass) &&
|
if (PCIINFOCLASSES(baseclass, subclass) &&
|
||||||
(DoIsolateDeviceCheck ?
|
(DoIsolateDeviceCheck ?
|
||||||
|
@ -357,7 +346,6 @@ FindPCIVideoInfo(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->listed_class = pcrp->listed_class;
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -958,15 +946,9 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes)
|
||||||
|
|
||||||
for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) {
|
for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) {
|
||||||
resPtr *res;
|
resPtr *res;
|
||||||
CARD8 baseclass, subclass;
|
const CARD8 baseclass = pcrp->pci_base_class;
|
||||||
|
const CARD8 subclass = pcrp->pci_sub_class;
|
||||||
|
|
||||||
if (pcrp->listed_class & 0x0ffff) {
|
|
||||||
baseclass = pcrp->listed_class >> 8;
|
|
||||||
subclass = pcrp->listed_class;
|
|
||||||
} else {
|
|
||||||
baseclass = pcrp->pci_base_class;
|
|
||||||
subclass = pcrp->pci_sub_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PCIINFOCLASSES(baseclass, subclass))
|
if (PCIINFOCLASSES(baseclass, subclass))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1662,17 +1644,11 @@ xf86PciProbe(void)
|
||||||
(ScanPciFindByDeviceProcPtr)LoaderSymbol("ScanPciFindPciNamesByDevice");
|
(ScanPciFindByDeviceProcPtr)LoaderSymbol("ScanPciFindPciNamesByDevice");
|
||||||
xf86FindPciNamesBySubsys =
|
xf86FindPciNamesBySubsys =
|
||||||
(ScanPciFindBySubsysProcPtr)LoaderSymbol("ScanPciFindPciNamesBySubsys");
|
(ScanPciFindBySubsysProcPtr)LoaderSymbol("ScanPciFindPciNamesBySubsys");
|
||||||
xf86FindPciClassBySubsys =
|
|
||||||
(ScanPciFindClassBySubsysProcPtr)LoaderSymbol("ScanPciFindPciClassBySubsys");
|
|
||||||
xf86FindPciClassByDevice =
|
|
||||||
(ScanPciFindClassByDeviceProcPtr)LoaderSymbol("ScanPciFindPciClassByDevice");
|
|
||||||
#else
|
#else
|
||||||
xf86SetupPciIds = ScanPciSetupPciIds;
|
xf86SetupPciIds = ScanPciSetupPciIds;
|
||||||
xf86ClosePciIds = ScanPciClosePciIds;
|
xf86ClosePciIds = ScanPciClosePciIds;
|
||||||
xf86FindPciNamesByDevice = ScanPciFindPciNamesByDevice;
|
xf86FindPciNamesByDevice = ScanPciFindPciNamesByDevice;
|
||||||
xf86FindPciNamesBySubsys = ScanPciFindPciNamesBySubsys;
|
xf86FindPciNamesBySubsys = ScanPciFindPciNamesBySubsys;
|
||||||
xf86FindPciClassBySubsys = ScanPciFindPciClassBySubsys;
|
|
||||||
xf86FindPciClassByDevice = ScanPciFindPciClassByDevice;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!xf86SetupPciIds())
|
if (!xf86SetupPciIds())
|
||||||
|
@ -1739,11 +1715,9 @@ xf86GetPciBridgeInfo(void)
|
||||||
for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) {
|
for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) {
|
||||||
if (pcrp->busnum > MaxBus)
|
if (pcrp->busnum > MaxBus)
|
||||||
MaxBus = pcrp->busnum;
|
MaxBus = pcrp->busnum;
|
||||||
if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE) ||
|
if ( pcrp->pci_base_class == PCI_CLASS_BRIDGE ) {
|
||||||
(((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) {
|
const int sub_class = pcrp->pci_sub_class;
|
||||||
int sub_class;
|
|
||||||
sub_class = (pcrp->listed_class & 0xffff) ?
|
|
||||||
(pcrp->listed_class & 0xff) : pcrp->pci_sub_class;
|
|
||||||
domain = xf86GetPciDomain(pcrp->tag);
|
domain = xf86GetPciDomain(pcrp->tag);
|
||||||
|
|
||||||
switch (sub_class) {
|
switch (sub_class) {
|
||||||
|
@ -3247,36 +3221,6 @@ xf86CheckPciSlot(int bus, int device, int func)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This used to load the scanpci module. The pcidata module is now used
|
|
||||||
* (which the server always loads early). The main difference between the
|
|
||||||
* two modules is size, and the scanpci module should only ever be loaded
|
|
||||||
* when the X server is run with the -scanpci flag.
|
|
||||||
*
|
|
||||||
* To make sure that the required information is present in the pcidata
|
|
||||||
* module, add a PCI_VENDOR_* macro for the relevant vendor to xf86PciInfo.h,
|
|
||||||
* and add the class override data to ../etc/extrapci.ids.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
getPciClassFlags(pciConfigPtr *pcrpp)
|
|
||||||
{
|
|
||||||
pciConfigPtr pcrp;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if (!pcrpp)
|
|
||||||
return;
|
|
||||||
while ((pcrp = pcrpp[i])) {
|
|
||||||
if (!(pcrp->listed_class =
|
|
||||||
xf86FindPciClassBySubsys(pcrp->pci_subsys_vendor,
|
|
||||||
pcrp->pci_subsys_card))) {
|
|
||||||
pcrp->listed_class =
|
|
||||||
xf86FindPciClassByDevice(pcrp->pci_vendor, pcrp->pci_device);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86FindPciVendorDevice() xf86FindPciClass(): These functions
|
* xf86FindPciVendorDevice() xf86FindPciClass(): These functions
|
||||||
* are meant to be used by the pci bios emulation. Some bioses
|
* are meant to be used by the pci bios emulation. Some bioses
|
||||||
|
|
|
@ -447,7 +447,6 @@ typedef struct {
|
||||||
pointer thisCard;
|
pointer thisCard;
|
||||||
Bool validSize;
|
Bool validSize;
|
||||||
Bool validate;
|
Bool validate;
|
||||||
CARD32 listed_class;
|
|
||||||
} pciVideoRec, *pciVideoPtr;
|
} pciVideoRec, *pciVideoPtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -659,7 +659,6 @@ typedef struct pci_device {
|
||||||
pciCfgSpc cfgspc;
|
pciCfgSpc cfgspc;
|
||||||
int basesize[7]; /* number of bits in base addr allocations */
|
int basesize[7]; /* number of bits in base addr allocations */
|
||||||
Bool minBasesize;
|
Bool minBasesize;
|
||||||
CARD32 listed_class;
|
|
||||||
pointer businfo; /* pointer to secondary's bus info structure */
|
pointer businfo; /* pointer to secondary's bus info structure */
|
||||||
Bool fakeDevice; /* Device added by system chipset support */
|
Bool fakeDevice; /* Device added by system chipset support */
|
||||||
} pciDevice, *pciConfigPtr;
|
} pciDevice, *pciConfigPtr;
|
||||||
|
|
|
@ -48,10 +48,6 @@ typedef int (*ScanPciFindByDeviceProcPtr)(
|
||||||
typedef int (*ScanPciFindBySubsysProcPtr)(
|
typedef int (*ScanPciFindBySubsysProcPtr)(
|
||||||
unsigned short svendor, unsigned short subsys,
|
unsigned short svendor, unsigned short subsys,
|
||||||
const char **svname, const char **sname);
|
const char **svname, const char **sname);
|
||||||
typedef CARD32 (*ScanPciFindClassBySubsysProcPtr)(
|
|
||||||
unsigned short vendor, unsigned short subsystem);
|
|
||||||
typedef CARD32 (*ScanPciFindClassByDeviceProcPtr)(
|
|
||||||
unsigned short vendor, unsigned short device);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Whoever loads this module needs to define these and initialise them
|
* Whoever loads this module needs to define these and initialise them
|
||||||
|
@ -61,8 +57,6 @@ extern ScanPciSetupProcPtr xf86SetupPciIds;
|
||||||
extern ScanPciCloseProcPtr xf86ClosePciIds;
|
extern ScanPciCloseProcPtr xf86ClosePciIds;
|
||||||
extern ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice;
|
extern ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice;
|
||||||
extern ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys;
|
extern ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys;
|
||||||
extern ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys;
|
|
||||||
extern ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice;
|
|
||||||
|
|
||||||
Bool ScanPciSetupPciIds(void);
|
Bool ScanPciSetupPciIds(void);
|
||||||
void ScanPciClosePciIds(void);
|
void ScanPciClosePciIds(void);
|
||||||
|
@ -72,9 +66,5 @@ int ScanPciFindPciNamesByDevice(unsigned short vendor, unsigned short device,
|
||||||
const char **svname, const char **sname);
|
const char **svname, const char **sname);
|
||||||
int ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys,
|
int ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys,
|
||||||
const char **svname, const char **sname);
|
const char **svname, const char **sname);
|
||||||
CARD32 ScanPciFindPciClassBySubsys(unsigned short vendor,
|
|
||||||
unsigned short subsystem);
|
|
||||||
CARD32 ScanPciFindPciClassByDevice(unsigned short vendor,
|
|
||||||
unsigned short device);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,16 +75,6 @@
|
||||||
#include "xf86PciIds.h"
|
#include "xf86PciIds.h"
|
||||||
#include "xf86ScanPci.h"
|
#include "xf86ScanPci.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* PCI classes that have messages printed always. The others are only
|
|
||||||
* have a message printed when the vendor/dev IDs are recognised.
|
|
||||||
*/
|
|
||||||
#define PCIALWAYSPRINTCLASSES(b,s) \
|
|
||||||
(((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \
|
|
||||||
((b) == PCI_CLASS_DISPLAY) || \
|
|
||||||
((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO))
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XFree86LOADER
|
#ifdef XFree86LOADER
|
||||||
|
|
||||||
#include "xf86Module.h"
|
#include "xf86Module.h"
|
||||||
|
@ -272,58 +262,6 @@ ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CARD32
|
|
||||||
ScanPciFindPciClassBySubsys(unsigned short vendor, unsigned short subsys)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
const pciSubsystemInfo **pSub;
|
|
||||||
|
|
||||||
if (vendor == NOVENDOR || subsys == NOSUBSYS)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (i = 0; pciVendorSubsysInfoList[i].VendorName; i++) {
|
|
||||||
if (vendor == pciVendorSubsysInfoList[i].VendorID) {
|
|
||||||
pSub = pciVendorSubsysInfoList[i].Subsystem;
|
|
||||||
if (!pSub) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for (j = 0; pSub[j]; j++) {
|
|
||||||
if (subsys == pSub[j]->SubsystemID) {
|
|
||||||
return pSub[j]->class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CARD32
|
|
||||||
ScanPciFindPciClassByDevice(unsigned short vendor, unsigned short device)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
const pciDeviceInfo **pDev;
|
|
||||||
|
|
||||||
if (vendor == NOVENDOR || device == NODEVICE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (i = 0; pciVendorInfoList[i].VendorName; i++) {
|
|
||||||
if (vendor == pciVendorInfoList[i].VendorID) {
|
|
||||||
pDev = pciVendorInfoList[i].Device;
|
|
||||||
if (!pDev) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for (j = 0; pDev[j]; j++) {
|
|
||||||
if (device == pDev[j]->DeviceID) {
|
|
||||||
return pDev[j]->class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PCIDATA
|
#ifndef PCIDATA
|
||||||
void
|
void
|
||||||
ScanPciDisplayPCICardInfo(int verbosity)
|
ScanPciDisplayPCICardInfo(int verbosity)
|
||||||
|
|
Loading…
Reference in New Issue