[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Probing PCI device..



the PCI driver detection code has changed in kernel 2.4. look at
/usr/src/linux/Documentation/pci.txt for the new format. I think it
would be a real waste to write a driver for the 2.2 kernel, when 2.4 is
in -prerelease. 

in 2.2, you could do a pci_find_device(venid, devid, dev), where venid
is the vendor id, devid=device id, and dev is a ptr to a  struct pci_dev

I hate to :r pci.txt here, so i guess it'd be great if you could just
just less thru it. you'd get a better hang of things than i can ever
make you get. 

On Thu, Jan 04, 2001 at 07:52:29PM -0500, Vivek Sharma wrote:
> pci devices i.e. if I want to probe all the PCI devives then what argument
> should I pass to the function pci_find_class or other probing functions so
> that I can find out all the PCI devices starting from the very first
> device in the linked list.
> 

from pci.txt:

   In case you need to decide according to some more complex criteria,
   you can walk the list of all known PCI devices yourself:

           struct pci_dev *dev;
	   pci_for_each_dev(dev) {
		                   ... do anything you want with dev ...
	   }

---------

				   
> Also I am unable to do the probing work in user mode as there are no
> supporting libraries for the same. All the libraries for probing PCI
> devices are part of the linux kernel. So, is it possible to do so in user
> mode, if yes how? Related links will be of great help where I can found
> some detailed stuff.
> 

this isn't possible as the driver (even if its a module), has to be
inserted into kernel space. the kernel cannot access it unless its
there, so you cant let it execute in user space. On the other hand you
could consider using UML (User Mode Linux), which allows you to boot a
linux kernel in a virtualized environment, and hook in with gdb to debug
your driver. 

Nikhil.