English 中文(简体)
pci_driver.probe function not known so pci_device_id wrong?
原标题:pci_driver.probe function not called so pci_device_id wrong?

I am moving my first steps into Linux Kernel Device Driver development.

I learnt that for pci-e cards I have to call pci_register_driver providing information via an object of type pci_driver ( below an example ). When I load my module ( via insmod ) If the information passed via .id_table is found than the .probe function is called.

由于我现在看不到我的<代码>.probe 功能(我通过<代码>k添加了一些伐木),因此我必须假设,<编码>pci_device_id中所载的信息。 必须是错的?

Is there any way to retrieve this information directly from the hardware itself? Once I plug my PCI-E card on my Linux box, where I can find all information about it? Maybe reading BIOS or some file in sys?

感谢任何帮助。

AFG

      static struct pci_driver my_driver = {
      // other here
          .id_table = pci_datatable,
          .probe    = driver_add
      //
      };

      static struct pci_device_id pci_datatable[] __devinitdata =
      {
          { VendorID,  PciExp_0041,  PCI_ANY_ID, PCI_ANY_ID },
          { 0 },
      };

      int __devinit DmaDriverAdd(
          struct pci_dev *             pPciDev,
          const struct pci_device_id * pPciEntry
          )
      {
          // my stuff!
      }
最佳回答

页: 1

没有任何论点会给你一份清单,列出所有PCI设备,例如:

$ lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family 
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)
...

之后,使用:

$ lspci -v -n -s 03:00.0
03:00.0 0280: 8086:0085 (rev 34)
    Subsystem: 8086:1311
    Flags: bus master, fast devsel, latency 0, IRQ 52

也可在<代码>/sys中找到相同的资料:

$ cd /sys/bus/pci/devices/0000:03:00.0 
$ cat vendor device 
0x8086
0x0085
$ cat subsystem_vendor subsystem_device 
0x8086
0x1311
问题回答

虽然已接受的答复确实回答了问题,但我想阐述一下不要求履行的今后职能。

According to the Documentation/PCI/pci.txt (How To Write Linux PCI Drivers) the probing function is called for all existing PCI devices that are not owned by the other drivers yet. So, even if you have the correct vendor and device IDs you will not see the function being called if the device is owned by another driver. To see which drivers own which devices run:

www.un.org/spanish/ga -knn

如果你暂时将供应商身份识别和装置识别系统改为用户识别系统, ANY_ID 您的传承功能将要求每个>(即不拥有)装置。

<>strong>.id_table有时是一个关键要点,简单地加以配置,但通常会被遗忘。 我还建议检查你的驾驶员代码和EPA(粉碎机)的侧面。 最近,我发现有类似情况,因为出口加工区的供应商身份证明不是预期的。 (你可以在公共汽车行车上添加一些精彩的文字,以便在你的车库法中用西西扫描,以进一步检查。)





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

Relation between USB and PCI

I m bit confused by the following statement in linux device drivers book. http://www.linuxdriver.co.il/ldd3/ 13.2. USB and Sysfs To help understand what this long device path means, we describe ...

Configuring kernel

After create a new system call, how to update the kernel? I tried these lines, make-kpkg clean fakeroot make-kpkg -initrd -append-to-version=-custom kernel_image kernel_headers But Ubuntu asked me ...

热门标签