# Anyone done any SCSI Quirks in the kernel?



## osx-addict (Mar 16, 2010)

I picked up a Dell PowerVault 122T (VS80) DLT tape drive (aka Benchmark VS640 changer) over the weekend for $60.. Works fine if you mount tapes your self.. However, this unit is an autochanger but FreeBSD does not see the 2nd LUN on the SCSI bus -- which I gather is somewhat common.  In researching this, I found the references to the Quirks that are occasionally needed.  See herefor some background and testing info.  I put a quirk in place in this file similar to that shown below :


```
{
		T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "BNCHMARK",
		"VS640*", "*"
	},
        CAM_QUIRK_HILUNS, /*mintags*/0, /*maxtags*/0
```

Unfortunately it was not recognized upon the next reboot..  Has anyone done one of these before and can point me in the right direction to diagnosing how to get it working? I enabled some CAM related debug flags and after installing that kernel, I get TONS of debug output to the point where it seemed like I was not going to have a usable kernel.. Ugg!!


----------



## mdhughes (Mar 17, 2010)

Do you have the changer device in your kernel?
[CMD="device          ch              # SCSI media changers"][/CMD]


----------



## mdhughes (Mar 17, 2010)

Sorry, I forgot the config option in my post:

```
device          ch              # SCSI media changers
```


----------



## osx-addict (Mar 17, 2010)

I'm running the GENERIC kernel and just looked (via the FreeBSD CVS system) at the GENERIC kernel file and see that line listed in there..  I know for a fact that this changer shows the tape drive on LUN 0 and the changer on LUN 1 -- but I believe that when it (the driver) does the probing, it only probes LUN 0 -- in fact I read that in the code.  I tried enabling CAM_DEBUG but it is *REALLY *verbose to the point where I'm not sure the system is usable -- except perhaps via ssh or something since the console is spewing and generating giant /var/log/message files.  Any suggestions would be appreciated!


----------



## osx-addict (Mar 29, 2010)

Just thought I'd reply in the off chance I may help someone else in the same boat -- using an HP Proliant Server with integrated SmartArray controller (SmartArray 5i in this case on a DL380G3).  I was doing an IRC chat late last week with Scott Long (maintainer of the SCSI CAM driver code) and he gave me a patch to have the kernel dump all the luns found as it probes the SCSI bus -- using all of the info provided by the SCSI card (5i).  After rebuilding the kernel and reviewing the output in the log, it was apparent that the 5i card is not exposing the 2nd LUN of the tape changer -- just LUN 0 (tape drive) is exposed.  So, he suggested I not use the 5i for control of a tape changer and use a non-raid controller.  I am getting a decent deal on an Adaptec 29320ALP-R controller for $52 (openbox).. Haven't yet received it but will update this thread once I get it..


----------



## osx-addict (Apr 3, 2010)

Ok.. I can report that I received an LSI 22320-R PCI-X SCSI controller and put it into my Proliant DL380G3 and it was able to see all luns on my tape changer (0,1).. Even the GENERIC kernel figured things out.  So, this is solved for me!  A bit thanks to Scott Long for his help and the others for leading me the way to find Scott!


```
mpt0: <LSILogic 1030 Ultra4 Adapter> port 0x4000-0x40ff mem 0xf7ce0000-0xf7cfffff,0xf7cc0000-0xf7cdffff irq 20 at device 1.0 on pci3
mpt0: [ITHREAD]
mpt0: MPI Version=1.2.15.0
mpt0: Capabilities: ( RAID-1E RAID-1 SAFTE )
mpt0: 0 Active Volumes (1 Max)
mpt0: 0 Hidden Drive Members (6 Max)
mpt1: <LSILogic 1030 Ultra4 Adapter> port 0x4400-0x44ff mem 0xf7ca0000-0xf7cbffff,0xf7c80000-0xf7c9ffff irq 21 at device 1.1 on pci3
mpt1: [ITHREAD]
mpt1: MPI Version=1.2.15.0
mpt1: Capabilities: ( RAID-1E RAID-1 SAFTE )
mpt1: 0 Active Volumes (1 Max)
mpt1: 0 Hidden Drive Members (6 Max)
.
.
.
sa0 at mpt0 bus 0 scbus1 target 6 lun 0
sa0: <BNCHMARK VS640 5639> Removable Sequential Access SCSI-2 device
sa0: 20.000MB/s transfers (10.000MHz, offset 15, 16bit)
da0 at ciss1 bus 0 scbus5 target 0 lun 0
da0: <COMPAQ RAID 5  VOLUME OK> Fixed Direct Access SCSI-0 device
da0: 135.168MB/s transfers
da0: Command Queueing enabled
da0: 420035MB (860232555 512 byte sectors: 255H 63S/T 53547C)
ch0 at mpt0 bus 0 scbus1 target 6 lun 1
ch0: <BNCHMARK VS640 5639> Removable Changer SCSI-2 device
ch0: 20.000MB/s transfers (10.000MHz, offset 15, 16bit)
ch0: 8 slots, 1 drive, 0 pickers, 0 portals

I was able to use mtx to see the status just fine :

srv1# camcontrol devlist
<BNCHMARK VS640 5639>              at scbus1 target 6 lun 0 (sa0,pass0)
<BNCHMARK VS640 5639>              at scbus1 target 6 lun 1 (ch0,pass1)
<COMPAQ RAID 5  VOLUME OK>         at scbus5 target 0 lun 0 (da0,pass2)


srv1# mtx -f /dev/pass1 status
 Storage Changer /dev/pass1:1 Drives, 8 Slots ( 0 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded)
     Storage Element 1:Empty
     Storage Element 2:Full
     Storage Element 3:Full
     Storage Element 4:Full
     Storage Element 5:Full
     Storage Element 6:Full
     Storage Element 7:Full
     Storage Element 8:Full
```


----------

