# How to get pms driver to recognize Atto H680 SAS HBA card?



## avner (Mar 1, 2021)

I am trying to use an Atto H680 host bus adapter to connect to an LTO tape drive. Atto does not provide a freebsd driver for this card. However, I am using the same card under Debian linux without a proprietary driver. On the linux box the driver "pm8001" is attached to the card. I was able to determine this based on the output of lshw command.

I think that the pms (pmspcv) driver may work since it is specified for use with the 8001 chipset.

I am building a custom kernel now to include the pms driver but I am unsure how to point this driver at the scsi HBA.

The bios shows that my tape drive is registered on channel 1, id 0, lun 0.

The ATTO H680 is on channel 1, SAS address 500108600090AEA0.

My question is can I manually tell freebsd to use the pms driver on this HBA based on SAS address or scsi channel?

Do I need to put something like "PMS_load="YES" in /boot/loader.conf?

Any related advice appreciated.


----------



## SirDice (Mar 1, 2021)

You can't "force" a driver onto a device. A driver is picked based on the device's IDs. If the driver knows the right IDs for this device than that driver will be attached. 


avner said:


> Do I need to put something like "PMS_load="YES" in /boot/loader.conf?


The driver is already included in the GENERIC kernel. The fact this driver doesn't recognise your card means your particular card model/type is not supported.

Please show the output of `pciconf -lv` for this card. Based on the IDs we can have a look at the source code to see if it's supported or not. We also need to know the version of FreeBSD, new models are added all the time. The card may already have been added in a newer version.


----------



## avner (Mar 1, 2021)

Here is the item of interest. The complete result of pciconf -lv is below that.

```
none4@pci0:6:0:0:       class=0x010700 card=0x0042117c chip=0x0042117c rev=0x00 hdr=0x00
    vendor     = 'ATTO Technology, Inc.'
    device     = 'ExpressSAS 6Gb/s SAS/SATA HBA'
    class      = mass storage
    subclass   = SAS
```
I have installed the 12.2 RELEASE version of FreeBSD on r710 server with perc6i raid card.

Thanks for your assistance.

```
root@daria:/usr/src # pciconf -lv
hostb0@pci0:0:0:0:      class=0x060000 card=0x02351028 chip=0x34068086 rev=0x13 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '5520 I/O Hub to ESI Port'
    class      = bridge
    subclass   = HOST-PCI
pcib1@pci0:0:1:0:       class=0x060400 card=0x02351028 chip=0x34088086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/5500/X58 I/O Hub PCI Express Root Port 1'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:3:0:       class=0x060400 card=0x02351028 chip=0x340a8086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/5500/X58 I/O Hub PCI Express Root Port 3'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:4:0:       class=0x060400 card=0x02351028 chip=0x340b8086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/X58 I/O Hub PCI Express Root Port 4'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:5:0:       class=0x060400 card=0x02351028 chip=0x340c8086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/X58 I/O Hub PCI Express Root Port 5'
    class      = bridge
    subclass   = PCI-PCI
pcib5@pci0:0:6:0:       class=0x060400 card=0x02351028 chip=0x340d8086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/X58 I/O Hub PCI Express Root Port 6'
    class      = bridge
    subclass   = PCI-PCI
pcib6@pci0:0:7:0:       class=0x060400 card=0x02351028 chip=0x340e8086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '5520/5500/X58 I/O Hub PCI Express Root Port 7'
    class      = bridge
    subclass   = PCI-PCI
pcib7@pci0:0:9:0:       class=0x060400 card=0x02351028 chip=0x34108086 rev=0x13 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '7500/5520/5500/X58 I/O Hub PCI Express Root Port 9'
    class      = bridge
    subclass   = PCI-PCI
none0@pci0:0:20:0:      class=0x080000 card=0x00000000 chip=0x342e8086 rev=0x13 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7500/5520/5500/X58 I/O Hub System Management Registers'
    class      = base peripheral
    subclass   = interrupt controller
none1@pci0:0:20:1:      class=0x080000 card=0x00000000 chip=0x34228086 rev=0x13 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers'
    class      = base peripheral
    subclass   = interrupt controller
none2@pci0:0:20:2:      class=0x080000 card=0x00000000 chip=0x34238086 rev=0x13 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '7500/5520/5500/X58 I/O Hub Control Status and RAS Registers'
    class      = base peripheral
    subclass   = interrupt controller
uhci0@pci0:0:26:0:      class=0x0c0300 card=0x02351028 chip=0x29378086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
uhci1@pci0:0:26:1:      class=0x0c0300 card=0x02351028 chip=0x29388086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
ehci0@pci0:0:26:7:      class=0x0c0320 card=0x02351028 chip=0x293c8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB2 EHCI Controller'
    class      = serial bus
    subclass   = USB
uhci2@pci0:0:29:0:      class=0x0c0300 card=0x02351028 chip=0x29348086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
uhci3@pci0:0:29:1:      class=0x0c0300 card=0x02351028 chip=0x29358086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
ehci1@pci0:0:29:7:      class=0x0c0320 card=0x02351028 chip=0x293a8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801I (ICH9 Family) USB2 EHCI Controller'
    class      = serial bus
    subclass   = USB
pcib8@pci0:0:30:0:      class=0x060401 card=0x02351028 chip=0x244e8086 rev=0x92 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801 PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:      class=0x060100 card=0x02351028 chip=0x29188086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801IB (ICH9) LPC Interface Controller'
    class      = bridge
    subclass   = PCI-ISA
none3@pci0:0:31:2:      class=0x01018f card=0x02351028 chip=0x29218086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801IB (ICH9) 2 port SATA Controller [IDE mode]'
    class      = mass storage
    subclass   = ATA
bce0@pci0:1:0:0:        class=0x020000 card=0x02351028 chip=0x163914e4 rev=0x20 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme II BCM5709 Gigabit Ethernet'
    class      = network
    subclass   = ethernet
bce1@pci0:1:0:1:        class=0x020000 card=0x02351028 chip=0x163914e4 rev=0x20 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme II BCM5709 Gigabit Ethernet'
    class      = network
    subclass   = ethernet
bce2@pci0:2:0:0:        class=0x020000 card=0x02351028 chip=0x163914e4 rev=0x20 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme II BCM5709 Gigabit Ethernet'
    class      = network
    subclass   = ethernet
bce3@pci0:2:0:1:        class=0x020000 card=0x02351028 chip=0x163914e4 rev=0x20 hdr=0x00
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'NetXtreme II BCM5709 Gigabit Ethernet'
    class      = network
    subclass   = ethernet
mfi0@pci0:3:0:0:        class=0x010400 card=0x1f0c1028 chip=0x00601000 rev=0x04 hdr=0x00
    vendor     = 'Broadcom / LSI'
    device     = 'MegaRAID SAS 1078'
    class      = mass storage
    subclass   = RAID
none4@pci0:6:0:0:       class=0x010700 card=0x0042117c chip=0x0042117c rev=0x00 hdr=0x00
    vendor     = 'ATTO Technology, Inc.'
    device     = 'ExpressSAS 6Gb/s SAS/SATA HBA'
    class      = mass storage
    subclass   = SAS
vgapci0@pci0:8:3:0:     class=0x030000 card=0x02351028 chip=0x0532102b rev=0x0a hdr=0x00
    vendor     = 'Matrox Electronics Systems Ltd.'
    device     = 'MGA G200eW WPCM450'
    class      = display
    subclass   = VGA
root@daria:/usr/src #
```


----------



## avner (Mar 1, 2021)

SirDice said:


> You can't "force" a driver onto a device. A driver is picked based on the device's IDs. If the driver knows the right IDs for this device than that driver will be attached.
> 
> The driver is already included in the GENERIC kernel. The fact this driver doesn't recognise your card means your particular card model/type is not supported.
> 
> Please show the output of `pciconf -lv` for this card. Based on the IDs we can have a look at the source code to see if it's supported or not. We also need to know the version of FreeBSD, new models are added all the time. The card may already have been added in a newer version.


I agree the driver does not recognize my card. Is there some way to trick the driver to recognize the card? Just for testing. Maybe it won't work but I was thinking for the purpose of passing bytes through to a tape device that there is relatively little processing the card needs to do and so maybe it will work with a generic scsi driver or some other driver built for a similar chipset.


----------



## avner (Mar 1, 2021)

SirDice said:


> You can't "force" a driver onto a device. A driver is picked based on the device's IDs. If the driver knows the right IDs for this device than that driver will be attached.
> 
> The driver is already included in the GENERIC kernel. The fact this driver doesn't recognise your card means your particular card model/type is not supported.
> 
> Please show the output of `pciconf -lv` for this card. Based on the IDs we can have a look at the source code to see if it's supported or not. We also need to know the version of FreeBSD, new models are added all the time. The card may already have been added in a newer version.


I found this in a 2008 press release ( full reference: ATTO Technology Ships Industry's First 6-Gb SAS/SATA Host Adapter | Press | ATTO )

ATTO's 6-Gb ExpressSAS® products leverage the experience ATTO has gained over 20 years of working closely with OEMs, and utilizes PMC-Sierra's new PM8001 Tachyon® SPC 8x6G 8-port SAS/SATA controller to meet the most demanding performance requirements of data-intensive IT applications including transactional databases, e-mail servers and large server farms.

“PMC-Sierra continues to deliver industry-leading enterprise storage controllers and complete end-to-end SAS/SATA chipset solutions,” said Kevin Burbank, director of product marketing for PMC-Sierra's Enterprise Storage Division. “The PM8001 Tachyon SPC 6Gb/s SAS controller enables our customers to deliver superior performance and differentiate their solutions with advanced SAS-2 features. We are pleased that PMC-Sierra's 6Gb/s SAS solutions have helped ATTO get to market quickly with its high-performance family of 6Gb/s SAS/SATA host adapters.”

So it seems that the pms driver which claims to work on the PMC-Sierra pm8001 should work with my ATTO H680 card but somehow the driver is not recognizing the card. I have seen a suggestion in another post, or mailing list, with a similar situation to comment out in the source code a line in that tests if the vendor is such-and-such. That related to mpt driver and a different ATTO card (see below). But, I could not figure out where in the pms driver source code this test is applied.

"
> On 2018-06-15 10:41, Frank Leonhardt wrote:

> FWIW I've given up for now and put in an Adaptec card, which worked
> first time.

Hello Frank,

I had the same problem with a ATTO UL5D card.
You have to comment out lines 181 and 182 in /usr/src/sys/dev/mpt/mpt_pci.c where the card vendor gets checked.
Like this:
//      if (pci_get_vendor(dev) != MPI_MANUFACTPAGE_VENDORID_LSILOGIC)
//              return (ENXIO)

Here only LSI cards with MPI_MANUFACTPAGE_VENDORID_LSILOGIC = 1000 will be allowed, all others including ATTO = 117c will be ignored.
After compiling a custom kernel without these lines your card will be initialized without problems.

Stefan"


----------



## avner (Mar 1, 2021)

SirDice said:


> You can't "force" a driver onto a device. A driver is picked based on the device's IDs. If the driver knows the right IDs for this device than that driver will be attached.
> 
> The driver is already included in the GENERIC kernel. The fact this driver doesn't recognise your card means your particular card model/type is not supported.
> 
> Please show the output of `pciconf -lv` for this card. Based on the IDs we can have a look at the source code to see if it's supported or not. We also need to know the version of FreeBSD, new models are added all the time. The card may already have been added in a newer version.


I am wondering if editing lxcommon.h in /usr/src/sys/dev/pms/freebsd/driver/common may be a stumble in the right direction?


----------



## Snurg (Mar 1, 2021)

Yes, you need to add the Atto card information into the ag_card_type structure after adding the #define constants for Atto.
This structure gets walked through in the hardware probe routine, and if the particular vendor/device ids are found they are activated.
There are also other structures that need to be updated accordingly, for example the list of hardware names.

Maybe after you did that, and tested it working, post the diff as patch file in a PR asking for Atto support or mail it onto a FreeBSD mailing list, so that it can get integrated into future FreeBSD versions.


----------

