From owner-freebsd-hackers Mon Aug 12 3:42: 0 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E51C37B400 for ; Mon, 12 Aug 2002 03:41:58 -0700 (PDT) Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 189AD43E5E for ; Mon, 12 Aug 2002 03:41:58 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0085.cvx21-bradley.dialup.earthlink.net ([209.179.192.85] helo=mindspring.com) by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17eCe4-0006ik-00; Mon, 12 Aug 2002 03:41:57 -0700 Message-ID: <3D579024.5ABE33B7@mindspring.com> Date: Mon, 12 Aug 2002 03:38:28 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: ouyang kai Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Hi, how the kernel add the devices References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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