PCI rework

Ian Romanick idr at us.ibm.com
Mon May 1 10:09:53 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Kettenis wrote:

> Matthieu Herb, asked me to have a look at libpciaccess some time ago.
> My conclusion then was that it is too tightly bound to Linux.  It
> takes the Linux sysfs pci access interface as a model instead of the
> actual pci hardware.  I especially feel the support to map memory
> associated with the PCI BAR's does not belong in the library.  It is
> not impossible to implement the libpciaccess backend for other
> operating systems, but it would be rather awkward.

How do you figure?  The interface is modeled after the interface in
libpci (part of pciutils), which was created long before the sysfs
interface was available, and has been ported to other platforms.  There
was quite a bit of discussion about this some months ago (in February).
 Most of the main points were hit in this thread:

http://lists.freedesktop.org/archives/xorg/2006-February/012705.html

> Looking at your patch I see that changes to the drivers are mostly
> changes like:
> 
> -    *pucByte = pciReadByte(pMga->PciTag,ulOffset);
> +    pci_device_cfg_read_u8( pMga->PciInfo, pucByte, ulOffset );
> 
> So basically this is just replacing the current interfaces with the
> equivalent libpciaccess interfaces.  Why not keep the current current
> interfaces and reimplement them to use libpciaccess in the
> Linux-specific Xorg code?  I really don't see any major flaws in the
> current xf86Pci.h interfaces, but I agree that some of the
> implementation could use some cleanup.

The old interface uses a transparent bus identifier to select the
device.  The new interface uses a pointer to an extendable data
structure.  There are several practical problems with using the bus
identifier.  The use of all the PCI_DOM_FROM_BUS, PCI_BUS_NO_DOM, and
the other various PCI domain hacks being chief among them.  It's just a
bad design from the word go.

We could probably make wrapper routines to make unmodified drivers work
with a modified server.  I'm not terribly interested in doing that
particular bit of work. ;)

> Oh, and I really think you shouldn't change the coding style.  Those
> extra spaces after the the '(' are just plain ugly ;-).

Yeah,beingabletoactuallyreadthecodeissuchahorriblething. :P
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEVkDhX1gOwKyEAw8RAofuAKCRP9x0eX0GfYTnYAs0Mpui6zaw0QCcC1QD
0/TdSCfv6Bv0TsaV/SnHzTM=
=Hxp3
-----END PGP SIGNATURE-----



More information about the xorg mailing list