setting up target mode
Wenbiao Liang
wenbiao.liang at shaw.ca
Sat Oct 4 23:12:19 PDT 2003
Hi,
I am trying to set up target mode on my FreeBSD 5.1 box.
On my FreeBSD box, I have a 2940 card (with aic7880 chip), SCSI id=6, a
ST2.1s hard drive. SCSI id=1 (though the HD is not mounted to any file
system, all the file systems are on one IDE drive.)
On another PC (lets call it machineB), I have a 2940 card (7870 chip), SCSI
ID 7, no other devices.
I connect the two SCSI cards with an external SCSI cable.
In the FreeBSD box, I have rebuilt the kernel, in the conf file, I have the
"device ahc" line commented out (so that I can kldload and debug the
ahc.ko/ahc_pci.ko), I also add "device targ", "device targbh", and "options
AHC_TMODE_ENABLE=0x40" lines in the conf file. In the aic7xxx.* files, I
have #define AHC_TARGET_MODE 1
After the new kernel is built, I boot the FreeBSD box first, log in as root,
and kldload the ahc_pci.ko. I got the following messages:
ahc0: <Adaptec 2940 Ultra SCSI adapter> port 0x1400-0x14ff mem
0xf480400-0xf4804ff irq 9 at device 15.0 on pci0
aic7880: Single Channel A, SCSI Id=6, 16/253 SCBs
(targetbh0:ahc0:0:-1:-1): Lun now enabled for target mode
I then boot machineB, in adaptec's BIOS scan, I can see the ST2.1S hard
drive (on the FreeBSD box) being probed, so I think both SCSI cards are
connected. But the SCSI 7880 card at ID 6 on the FreeBSD machine are not
probed. (at this time, the FreeBSD machine shows a message: "Someone reset
the Channel A").
Then, I hit ctrl-A on machineB and enter the Adaptec Select utility, and do
a Scan disk, and it says there is no device on SCSI ID 6.
I then boot machineB into Windows 98, and run a utility (a scanner capture
utility), in this utility I can select the SCSI bus and ID of the "scanner"
device to send command to. I select aic7870 and ID=6 (I was trying to make
the scanner utility believing the "FreeBSD" is now a target mode device
connected to the aic7870 bus, aka. the scanner). However, when I send
commands, I got errors back, and there is no response at the FreeBSD side.
I have some questions:
1. Is what I have done on the FreeBSD box side to enable the target mode
correct? What else do I need to do? How can I make sure it is really
working? (to know that the problems, if any, are on the machineB side?)
2. I have searched google new groups about target mode, and seems to me that
scsi_target.c is an example code to show how to use target mode. However, I
don't know how to compile and run it. Is there a makefile for it?
3. I uderstand target mode can be: the SCSI card can behave like a target
device that accepts commands from other initiator device (such as other SCSI
card or a SCSI scanner connected to the SCSI bus). Is my understanding
correct?
4. What I am trying to achieve is: I bought a SCSI scanner (Nikon LS3510AF)
and I would like to write a device driver for it, because the driver that
comes with the scanner only supports Windows95. However, I don't have any
specs on the SCSI commands this scanner uses and Nikon is not going to send
me. So I have to "hack" to monitor the SCSI traffic to know the commands. I
don't have a hardware SCSI monitor, so I was thinking I can setup a FreeBSD
box with a SCSI card, enable target mode on the card, and fool the Windows95
scanner driver into thinking that this SCSI card on the FreeBSD box is a
valid LS3510AF scanner and sending commands to it. On the FreeBSD side, I
can then log the commands in order for me to write new drivers for the
scanner. The question is: will this method work?
Thanks,
Wenbiao
More information about the aic7xxx
mailing list