Re: what is the init entrance for pci bus scan in FREEbsd?

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Sun, 05 Jun 2005 11:05:08 -0600 (MDT)
In message: <87ab37ab05060108167dee1d6_at_mail.gmail.com>
            kylin <fierykylin_at_gmail.com> writes:
: Now i am coding a fake pcihotplug module in Freebsd 5.3 release,
: it contains two parts ,the userplace using a ioctl way to communicate
: with an cdev in /dev, and the kernel module which
: mainly operates on the Devclasses ,devlist and driverlist ....but
: still in the enable function,i have to rescan the pci bus. BUT, i can
: not find the pci bus scan code in the freebsd,i guess it was just an
: entry of the startup table which is made by compiler,
: still some one told me to follow the pci_init() way in LINUX ,but , i
: find it too hard in the OO structure bus arch of Freebsd .so
: WHERE can i get some code to follow in order to finish my pci rescan function? 

I'm not sure I understand what you are getting at here.  First, devd
already provides 95% of the infrastructure to do things when devices
are added to the system.

Second, you assume that linux's way of doing things is how FreeBSD
does things.  This isn't the case. FreeBSD scans the bus at pci bus
attach time and adds chilren nodes that it finds.  In the Cardbus
case, it will add nodes as the card bus bridge tells us of children,
and then probe/attaches them.  If you are implementing support for
bridges that announce new children, you should start by looking into
the pci bridge driver code (this will be in src/sys/dev/pci/pci_pci.c)
and add the approrpiate hooks there.  Next, you should look at the
following routines in cardbus (located in src/sys/dev/cardbus and
dev/pccbb): cbb_insert will call CARD_ATTACH_CARD on cbdev.  The
CARD_ATTACH_CARD method is implemented in cardbus.c's
cardbus_attach_card.  There it will probe all the slots on the bus.
It might be better to abstract the guts of this function, and move it
down into sys/dev/pci/pci.c if other bridges could use the same
functionality.

Finally, you should send me your work for review.  I've been keen on
expanding pci bus support for a long time and would be happy to review
such changes.

BTW, Which chipsets and hotplugging methods do you support?

Warner
Received on Sun Jun 05 2005 - 15:06:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:35 UTC