Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Dec 2002 00:50:46 -0700
From:      Scott Long <scott_long@btc.adaptec.com>
To:        yiding_wang@agilent.com
Cc:        freebsd-scsi@freebsd.org
Subject:   Re: Starting questions about FreeBSD PCI scsi driver.
Message-ID:  <20021204075046.GA587@hollin.btc.adaptec.com>
In-Reply-To: <334DD5C2ADAB9245B60F213F49C5EBCD019C7AB5@axcs03.cos.agilent.com>
References:  <334DD5C2ADAB9245B60F213F49C5EBCD019C7AB5@axcs03.cos.agilent.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 03, 2002 at 06:32:07PM -0700, yiding_wang@agilent.com wrote:
> Hello There,
> 
> This is the first expecrience for me with FreeBSD and I am going to start making fuss here.
> 
> I am writing a drivers for iSCSI and FC PCI initiator as well as target ramdisk on FreeBSD, and just installed 4.7 and downloaded a few docs.  By looking into CVS, I got a few initial questions.  I will use Buslogic driver bt.c as an example.  For better understanding, any reference to scsi driver under Linux, Unixware. Solaris, SCO OS5 will be welcomed since I have written drivers for scsi / FC / iSCSI under those enviornments.
> 
> Here comes the first set of question:
> 
> 1, I noticed that there are a few places drivers are spreaded.  For example
>     /sys/dev/buslogic/bt.c, v
>     /sys/dev/buslogic/bt_pci.c, v
>     /sys/dev/buslogic/btreg.h, v
> 
>    and same files and others which cover same hardware are located at:
>    /sys/i386/scsi/Attic/bt.c, v
>    /sys/i386/scsi/Attic/btreg.h, v
>    /sys/pci/Attic/bt9xx.c, v
>    /sys/pci/Attic/bt_pci.c, v
>    etc.

You're looking at the CVS RCS files, which are the internal 'database' files
for the CVS system.  What you need to do is use the 'cvs checkout' command
to check the appropriate versions of these files out.  Attic directories
are part of the CVS database and denote files that have been deleted from
the CVS system.  There are many guides and books for using CVS, so I
suggest doing a simple Google search on CVS and reading up on it.

> 
>    Why these drivers are spreaded?  
>    If I only have a pci initiator driver, can the source only be located under /sys/dev/vendor instead of also put some part of code under /sys/pci/Attic?

It should be in /sys/dev/<drivername>

> 
> 2, Does FreeBSD requires realmode driver to boot? Those bus (EISA, ISA, PCI) related subdirectories look like Solaris realmode driver distribution.

No real mode driver is needed.

> 
> 3, Where is proper place for driver source code?  If this driver does not intend for a boot device, can it be placed anywhere like other Unixes?

/sys/dev/<drivername>

> 
> 4, There are Makefiles for aic7xxx, e.g. under module, but nothing for bt.c.  Does that mean buslogic driver not supporting loadable module?

/sys/modules is the place for makefiles for drivers that can be built as
modules.  You would put your makefile in /sys/modules/<drivername>

> 
> 5, There are utility of "pkg_add" for driver loading, similar to Solaris, and "kldload" for module loading, similar to Linux.  Can I assume both methods work for scsi driver.  The difference will be kldload works only for this boot and module will be gone after "kldunload" or system reboot, but "pkg_add" will hook driver to kernel from boot to boot till pkg_delete is performed.  

pkg_add is a tool for installing binary packages onto a system.  It is similar
to the package system in solaris and the rpm system in linux.  pkg_add can
contain scripts that do post-install actions, like modifying the the system
to cause a driver to be loaded on bootup.

kldload is similar to insmod in linux.

> 
> 6, If driver will be loaded with pkg_add, where are those related package required header files located?

No header files are needed.  See the manual page for pkg_create.

> 
> 7, Does FreeBSD support multi-initiator?  If it does, how the devices are scanned?  
>     For example, if I have two card in the system.  During the xxx-probe routine, pci_get_devid(dev) is called.  Is this function being called once for every card by kernel or
>     driver needs to call the function multi times to discover those cards?

I think that you are confusing the 'multi-initiator' term.  Yes, you can
have more than one of a certain PCI device in your system.  Your driver's
probe and attach routines will be called once for each card.  The framework
that you need to use is called 'newbus'.  See the manual pages for
'device' and 'driver'.

> 
> 8, If driver support character device too, how to determine the major number?  Assign it randomly by driver or assigned by kernel and can be retreaved by driver?

Driver assignments are done in /sys/conf/majors.  Once a major number is
assigned, the driver is free to assume that it won't change.  This will
change in the future with DEVFS.

> 
> 9, I don't see detailed driver structure and system function calls from man page as well as handbooks (e.g. pci_get_devid).  Where is the best place to get those information?

Unfortunately this is not well documented.  Several articles have been written
in the past and can probably be found by searching the 'articles' section
of www.freebsd.org and/or deamonnews.org.  You should search for 'newbus' and
'cam'.

> 
> Many thanks!
> 
> Eddie (Yiding) Wang
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-scsi" in the body of the message

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021204075046.GA587>