On Tue, 2003-10-21 at 15:33, Linus Torvalds wrote: > On Tue, 21 Oct 2003, Eric Anholt wrote: > > > > What is the proper way to get the equivalent of pci_name(pdev) on > > pre-2.5? Also, what is the cutoff where pci_name is available? Are the > > values from pci_name decimal or hex? > > The cut-off is 2.5.74 or so. > > The numbers are hex, and it's really implemented by just caching the > result of > > sprintf(string, "%04x:%02x:%02x.%d", > pci_domain_nr(dev->bus), > dev->bus->number, > PCI_SLOT(dev->devfn), > PCI_FUNC(dev->devfn)); > > (that last "%d" is irrelevant - the number is alway sin the range 0..7, > so it's same in decimal, octal and hex ;). > > "pci_name()" is more convenient in printouts etc. If backwards > compatibility of compatibility with *BSD makes "pci_name()" inconvenient, > feel free to do it by hand like this, but the important parts I had were: > > - _please_ use the domain number. There are real machines with multiple > independent PCI buses. We've already seen some real-life problems with > drivers that look for companion chips without knowing about the > "domain" thing, and as a result they find the wrong chip. > > The domain problem is rare today, but it will likely be less rare > tomorrow. > > - please start thinking of the day when DRI won't be all about PCI, and > the naming might be more complicated than the normal > domain/bus/slot/func thing. Thus the suggestion to tag the address with > the "address type" information. > > So whether you use "pci_name()" or anything else is much less important > than the two points above.
Excellent, this was just the info I wanted. I think this is all being covered in the changes I'm making now. The issue here was compatibility with linux 2.4.x, and possibly interpreting the busid in the X Server (not 100% sure if I'll need it in the end yet). For pre-2.5.74 I'm using a domain number of 0 on non-alpha and hose->bus->number on alpha, because of the lack of pci_domain_nr(), at least on the 2.4.19 I'm using I still need to figure out how XFree86 deals with domains, and if I can get the busid from XFree86 to match this format. The busid begins with "pci:", and currently the DRM has that hardcoded, but it can be changed when we get non-pci drivers. Similarly for libdrm, so far. -- Eric Anholt [EMAIL PROTECTED] http://people.freebsd.org/~anholt/ [EMAIL PROTECTED] ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel
