Global s/xf86MapDomainIO/xf86MapLegacyIO/. Let's call a duck a duck,

okay?  Since xf86MapLegacyIO is called from only one place, cut the
parameter list down to the one parameter that actually conveys some
information:  the one that gives a PCI device.  Change from using a
PCITAG to a pci_device.
This commit is contained in:
Ian Romanick 2006-07-24 13:33:34 -07:00
parent aed6fe0bb1
commit 2fd6b995ff
9 changed files with 29 additions and 33 deletions

View File

@ -1492,9 +1492,7 @@ xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
if (active) {
/* Map in this domain's I/O space */
p->domainIO = xf86MapDomainIO(-1, VIDMEM_MMIO,
pciTag(bus, d->dev, d->func),
0, 1);
p->domainIO = xf86MapLegacyIO(dev);
}
return num;

View File

@ -251,7 +251,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86MapReadSideEffects)
SYMFUNC(xf86GetPciDomain)
SYMFUNC(xf86MapDomainMemory)
SYMFUNC(xf86MapDomainIO)
SYMFUNC(xf86ReadDomainMemory)
SYMFUNC(xf86UDelay)
SYMFUNC(xf86IODelay)

View File

@ -25,7 +25,7 @@
* xf86GetPciDomain() - Return domain number from a PCITAG
* xf86MapDomainMemory() - Like xf86MapPciMem() but can handle
* domain/host address translation
* xf86MapDomainIO() - Maps PCI I/O spaces
* xf86MapLegacyIO() - Maps PCI I/O spaces
* xf86ReadDomainMemory() - Like xf86ReadPciBIOS() but can handle
* domain/host address translation
*
@ -497,11 +497,11 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
return xf86MapVidMem(ScreenNum, Flags, Base, Size);
}
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
IOADDRESS
xf86MapLegacyIO(struct pci_device *dev)
{
return Base;
(void) dev;
return 0;
}
_X_EXPORT int

View File

@ -327,12 +327,11 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
pDomain->dense_mem + Base - _bus_base(), Size);
}
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
IOADDRESS
xf86MapLegacyIO(struct pci_device *dev)
{
axpDomainPtr pDomain;
int domain = PCI_DOM_FROM_TAG(Tag);
const int domain = dev->domain;
if ((domain < 0) || (domain >= pciNumDomains) ||
!(pDomain = xf86DomainInfo[domain]))
@ -343,7 +342,7 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
* base [this is ok since we also constrain sparse I/O systems to
* a single domain in axpSetupDomains()]
*/
if (pDomain->sparse_io) return Base;
if (pDomain->sparse_io) return 0;
/*
* I/O addresses on Alpha are really just different physical memory
@ -356,11 +355,11 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
* Map the entire I/O space (64kB) at once and only once.
*/
if (!pDomain->mapped_io)
pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(ScreenNum, Flags,
pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(-1, VIDMEM_MMIO,
pDomain->dense_io - _bus_base(),
0x10000);
return pDomain->mapped_io + Base;
return pDomain->mapped_io;
}
_X_EXPORT int

View File

@ -677,33 +677,34 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
*
* This has no means of returning failure, so all errors are fatal
*/
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
IOADDRESS
xf86MapLegacyIO(struct pci_device *dev)
{
int domain = xf86GetPciDomain(Tag);
const PCITAG tag = PCI_MAKE_TAG(PCI_MAKE_BUS(dev->domain, dev->bus),
dev->dev, dev->func);
const int domain = xf86GetPciDomain(tag);
int fd;
if ((domain <= 0) || (domain >= MAX_DOMAINS))
FatalError("xf86MapDomainIO(): domain out of range\n");
FatalError("xf86MapLegacyIO(): domain out of range\n");
if (DomainMmappedIO[domain])
return (IOADDRESS)DomainMmappedIO[domain] + Base;
return (IOADDRESS)DomainMmappedIO[domain];
/* Permanently map all of I/O space */
if ((fd = linuxOpenLegacy(Tag, "legacy_io")) < 0) {
DomainMmappedIO[domain] = linuxMapPci(ScreenNum, Flags, Tag,
0, linuxGetIOSize(Tag),
if ((fd = linuxOpenLegacy(tag, "legacy_io")) < 0) {
DomainMmappedIO[domain] = linuxMapPci(-1, VIDMEM_MMIO, tag,
0, linuxGetIOSize(tag),
PCIIOC_MMAP_IS_IO);
/* ia64 can't mmap legacy IO port space */
if (!DomainMmappedIO[domain])
return Base;
return 0;
}
else { /* legacy_io file exists, encode fd */
DomainMmappedIO[domain] = (pointer)(fd << 24);
}
return (IOADDRESS)DomainMmappedIO[domain] + Base;
return (IOADDRESS)DomainMmappedIO[domain];
}
/*

View File

@ -623,7 +623,7 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
}
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
xf86MapLegacyIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
{
sparcDomainPtr pDomain;
@ -633,7 +633,7 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
!(pDomain = xf86DomainInfo[domain]) ||
(((unsigned long long)Base + (unsigned long long)Size) >
pDomain->io_size))
FatalError("xf86MapDomainIO() called with invalid parameters.\n");
FatalError("xf86MapLegacyIO() called with invalid parameters.\n");
/* Permanently map all of I/O space */
if (!pDomain->io) {

View File

@ -767,8 +767,7 @@ extern int pciNumBuses;
int xf86GetPciDomain(PCITAG tag);
pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
ADDRESS Base, unsigned long Size);
IOADDRESS xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size);
IOADDRESS xf86MapLegacyIO(struct pci_device *dev);
int xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len,
unsigned char *Buf);

View File

@ -184,7 +184,7 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn)
/*
* Only take over the inx/outx functions if this is a dense I/O
* system *and* addressing domains are being used. The dense I/O
* routines expect I/O to be mapped (as done in xf86MapDomainIO)
* routines expect I/O to be mapped (as done in xf86MapLegacyIO)
*/
_alpha_outb = _dense_outb;
_alpha_outw = _dense_outw;

View File

@ -56,7 +56,7 @@
* space of a given PCI domain; reads and writes are used to do port I/O.
* The file descriptor for the file is stored in the upper bits of the
* value passed in by the caller, and is created and populated by
* xf86MapDomainIO.
* xf86MapLegacyIO.
*
* If the legacy_io interface doesn't exist, we fall back to the glibc in/out
* routines, which are prefixed by an underscore (e.g. _outb).