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

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

 



Hi Thomas,

On Wed, Oct 22, 2008 at 4:03 PM, Thomas Petazzoni
<thomas.petazzoni@xxxxxxxxxxxxxxxxxx> wrote:
> 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.
>

I noticed that PCI_DEVICE_TABLE is defined here:


./drivers/net/sky2.c:
static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = {

./drivers/net/bnx2.c:
static DEFINE_PCI_DEVICE_TABLE(bnx2_pci_tbl) = {

and within this table are a list of all the vendor IDs:

static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = {
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },    /* DGE-560T */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) },    /* DGE-550SX */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) },    /* DGE-560SX */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B03) },    /* DGE-550T */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, /* 88E8021 */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, /* 88E8022 */

So are all these vendor ID - which are statically defined inside the
sky2.ko module, somehow made to go into modules.alias as well?   (at
compilation time, i supposed)

Appreciate very much your explanation :-).



-- 
Regards,
Peter Teoh

--
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