Doubt about Linux PCIe infraestructure
david.hagood at gmail.com
david.hagood at gmail.com
Wed Sep 29 00:20:24 EST 2010
> Hi,
>
> I have a simple doubt about linux PCI/PCIe infraestructure.
>
> When I register a PCI driver using pci_register_driver() will the
> probe function be automatically called or will it just be called if PCI
> infraestructure match a Vendor and Device id on bus?
When you register your driver, you supply a list of VID/DID pairs for
which your driver is applicable, and if those devices are on the bus, your
probe will be called.
>
> I am loading a PCI driver that register itself using
> pci_register_driver() but the probe function isn't called.
>
If you didn't indicate your driver was for the VID/DID of the device, your
probe won't be called - why should it? As far as you told the kernel,
there's no hardware pertaining to your driver.
The old days of "every driver probes every device" are gone.
Here's an example code fragment:
/* define the list of devices we support */
static struct pci_device_id ppc_ep_device_ids[] =
{
{PCI_DEVICE(PCI_VENDOR_ID_FREESCALE,PCI_DEVICE_ID_MPC8641D)},
{0} /* end of list indicator */
};
MODULE_DEVICE_TABLE(pci, ppc_ep_device_ids); /* tell udev to load our
module for these devices */
pci_register_driver(&ppc_ep_device_driver); /* tell the kernel we handle
these devices */
More information about the Linuxppc-dev
mailing list