Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2002 03:38:28 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        ouyang kai <oykai@msn.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Hi, how the kernel add the devices
Message-ID:  <3D579024.5ABE33B7@mindspring.com>
References:  <OE72Z90yzrGqmSyfj3u0001ff04@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
ouyang kai wrote:
> 
>    Part 1.1.1    Type: Plain Text (text/plain)
>              Encoding: quoted-printable
> 
>                               Name: kernel_init_problem.txt
>    kernel_init_problem.txt    Type: Plain Text (text/plain)
>                           Encoding: quoted-printable

If you are talking about the fxp driver, then you need to look
in /usr/src/sys/dev/fxp/if_fxp.c, around line 240:

    DRIVER_MODULE(if_fxp, pci, fxp_driver, fxp_devclass, 0, 0);
    DRIVER_MODULE(if_fxp, cardbus, fxp_driver, fxp_devclass, 0, 0);
    DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0);

The definition of DRIVER_MODULE is variant, based on whether
the code is a loadable module, or is compiled into the kernel.

The original intent of the SYSINIT code was to erase the
distinction between code statically linked into the kernel,
and code loaded later, as a loadable module.

Specifically, the DRIVER_MODULE() macro uses the DECLARE_MODULE();
see /usr/src/sys/sys/bus.h, in which it specifies SI_SUB_DRIVERS
as the init_main.c code sort order, and the sub-order within that
as SI_ORDER_MIDDLE.

The DECLARE_MODULE() macro encapsulates a SYSINIT() entry; see
/usr/src/sys/sys/module.h.


The result is that the init_main.c code calls the entry point on
startup to probe the device (see /usr/src/sys/dev/fxp/if_fxp.c).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D579024.5ABE33B7>