Re: Where the modules for found PCI devices is loaded?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Sat, 18 Oct 2008 19:32:16 +0900,
J.H.Kim <frog1120@xxxxxxxxx> a écrit :

> I'm reading kernel source  code for the  first time.  First,  I'd
> like to know  how  the PCI  driver  works.
> I found the routines which scans PCI bus and and  add  data structure
> of the  found  devices into  bus data structure as linked list.
> But I got lost there.  Each device probe routine seems to be called
> after the related module is loaded.
> I cannot find the routines which call modprobe or insmod  for  desired
> modules related to found devices and I wonder how the module for each
> device is selected.
> So, I'm finding where the PCI network driver module is loaded, for
> example. Any advice would be greatly appreciated.

In /lib/modules/<kernelversion>/modules.alias, there is a list of
associations between PCI IDs and modules names, like:

alias pci:v0000106Bd00001645sv*sd*bc*sc*i* tg3

When a PCI device is detected on the PCI bus, the kernel sends an
uevent to the user-space daemon udev, with a MODALIAS variable,
containing a string like pci:v0000106Bd00001645sv*sd*bc*sc*i*. Then
udev runs the modprobe command with the module alias in argument.
modprobe travels through the modules.alias file and loads the
corresponding module. Once loaded the module tells the kernel that it
handles PCI devices identified by some IDs, and its ->probe() method
gets called.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux