structure of PCI ID not clear
Hi,
I am learning Kernel Programming these days I came across a structure Code:
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = { http://lxr.linux.no/#linux+v2.6.36/i...nux/pci.h#L567 http://lxr.linux.no/#linux+v2.6.36/i...icetable.h#L17 but I could not understand this type of structure definition. How does one point the following entry {0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, 1) What is first field 0x10ec mapped to is it vendor ? 2) What is second field 0x8139 mapped to is it device id ? 3) Does PCI_ANY_ID both represent subvendor,subdevice 4) What are these two 0,0 are they class,mask 5) What is RTL8139 is it driver_data 6) I am also not clear with the way the macro was defined. In the definition of following macro #define DEFINE_PCI_DEVICE_TABLE(_table) const struct pci_device_id _table[] __devinitconst _table is it an array of structure of type pci_device_id ? 7) What is __devinitconst? |
The pci.txt file in the documentation describes the fields in the structure (the table is an array of these pci_device_id structures as you surmised). Not all of the fields have to be provided (hence the PCI_ANY_ID and the zeroes).
Code:
The ID table is an array of struct pci_device_id entries ending with an |
I had a look on that page
What I am not clear with is the structure definition. I have defined structures as Quote:
Quote:
Quote:
from where a new developer would get these values 0x126c, 0x1211 I have no idea when to put 0x126c or 0x1211. How do you decide this? |
Quote:
Code:
struct pci_device_id rtl8139_pci_tbl[] = Quote:
The list of entries in the table will cover all the different devices for which the driver is relevant. Since different manufacturers use the same chipset, it is often possible to use the same driver for more than one PCI card. However, the cards will have different vendor and device ids, so each one will have a separate entry in the table. The table can then be used by the kernel to check for a matching driver. |
Quote:
As far as I understand once the probe function(Not too sure) detects or kernel detects then the driver would be looked up and control would be handed over to driver. If this is correct then how does probe works? Or how a particular device's presence on PCI bus detected. |
|
All times are GMT -5. The time now is 08:19 PM. |