PCI: Simplify OS PCI function registration a bit.
This commit is contained in:
parent
2d427b9cb1
commit
86cfe0ee23
|
@ -138,13 +138,13 @@
|
|||
|
||||
/* Global data */
|
||||
|
||||
pciBusInfo_t *pciBusInfo = NULL;
|
||||
pciBusFuncs_t *pciBusFuncs = NULL;
|
||||
|
||||
_X_EXPORT ADDRESS
|
||||
pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
|
||||
{
|
||||
if (pciBusInfo->funcs->pciAddrBusToHost)
|
||||
return pciBusInfo->funcs->pciAddrBusToHost(tag, type, addr);
|
||||
if (pciBusFuncs && pciBusFuncs->pciAddrBusToHost)
|
||||
return pciBusFuncs->pciAddrBusToHost(tag, type, addr);
|
||||
else
|
||||
return addr;
|
||||
}
|
||||
|
|
|
@ -191,23 +191,9 @@ typedef struct pci_bus_funcs {
|
|||
ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
|
||||
} pciBusFuncs_t, *pciBusFuncs_p;
|
||||
|
||||
/*
|
||||
* pciBusInfo_t - One structure per defined PCI bus
|
||||
*/
|
||||
typedef struct pci_bus_info {
|
||||
unsigned char numDevices; /* Range of valid devnums */
|
||||
unsigned char secondary; /* Boolean: bus is a secondary */
|
||||
int primary_bus; /* Parent bus */
|
||||
pciBusFuncs_p funcs; /* PCI access functions */
|
||||
void *pciBusPriv; /* Implementation private data */
|
||||
struct pci_device *bridge; /* bridge that opens this bus */
|
||||
} pciBusInfo_t;
|
||||
|
||||
#define HOST_NO_BUS ((pciBusInfo_t *)(-1))
|
||||
|
||||
/* Generic PCI service functions and helpers */
|
||||
ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
|
||||
|
||||
extern pciBusInfo_t *pciBusInfo;
|
||||
extern pciBusFuncs_t *pciBusFuncs;
|
||||
|
||||
#endif /* _PCI_H */
|
||||
|
|
|
@ -48,19 +48,6 @@
|
|||
|
||||
#include "pciaccess.h"
|
||||
|
||||
static pciBusFuncs_t bsd_funcs = {
|
||||
.pciAddrBusToHost = pciAddrNOOP,
|
||||
};
|
||||
|
||||
static pciBusInfo_t bsd_pci = {
|
||||
.numDevices = 32,
|
||||
.secondary = FALSE,
|
||||
.primary_bus = 0,
|
||||
.funcs = &bsd_funcs,
|
||||
.pciBusPriv = NULL,
|
||||
.bridge = NULL,
|
||||
};
|
||||
|
||||
_X_EXPORT pointer
|
||||
xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
|
||||
ADDRESS Base, unsigned long Size)
|
||||
|
@ -78,7 +65,5 @@ xf86MapLegacyIO(struct pci_device *dev)
|
|||
void
|
||||
bsdPciInit(void)
|
||||
{
|
||||
pciBusInfo = &bsd_pci;
|
||||
|
||||
xf86InitVidMem();
|
||||
}
|
||||
|
|
|
@ -79,15 +79,6 @@ static pciBusFuncs_t linuxFuncs0 = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static pciBusInfo_t linuxPci0 = {
|
||||
/* numDevices */ 32,
|
||||
/* secondary */ FALSE,
|
||||
/* primary_bus */ 0,
|
||||
/* funcs */ &linuxFuncs0,
|
||||
/* pciBusPriv */ NULL,
|
||||
/* bridge */ NULL
|
||||
};
|
||||
|
||||
static const struct pci_id_match match_host_bridge = {
|
||||
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
|
||||
(PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8),
|
||||
|
@ -109,7 +100,7 @@ linuxPciInit(void)
|
|||
we'll need a fallback for 2.0 kernels here */
|
||||
return;
|
||||
}
|
||||
pciBusInfo = &linuxPci0;
|
||||
pciBusFuncs = &linuxFuncs0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue