Re: /proc/pci

Martin Mares (mj@atrey.karlin.mff.cuni.cz)
Sun, 21 Sep 1997 10:08:34 +0200


Hi,

> Okay fine. How _SHOULD_ a userspace program find a PCI card?
> (I'm probably missing something here - I haven't really paid all that much
> attention to this thread 'till now)
>
> Incidentally - Until Linus allows graphics support into the kernel, the
> search has to be done in userspace (with all the races, instability, and
> all that go with it.. but considering most videocards aren't all that
> stable to begin with this shouldn't really be a problem).

I propose the following solution:

- Add the pci config space access syscalls to _all_ architectures
supporting PCI.

- Replace /proc/pci contents by a simple list of all found PCI devices
(userland programs should _not_ scan the bus) in the following format (one line
per device):
00 1F 1234 5678 0D FE000000 FD000000 ...
^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bus-----+ dev+fn vendor device interrupt addresses

id est all basic data available from the initial PCI probe. The remaining
information should be accessed by the syscalls only.

- Write a userland utility for pretty-printing of the config space
data gained from both /proc and the syscalls.

Do you see any problems with this approach?

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@gts.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Foolproof operation:  All parameters are hard coded."