# Switchtec PM8546 PCIe switch not recognized as ses storage switch device



## agilestorage (Nov 11, 2020)

So far I have loaded these drivers pmspcv, mpr, smartpqi, ntb and ntb_transport as a module during boot time and noticed none of the drivers helped to detect the PCIe switch as SES. During performing pciconf command, I have noticed storage switch has been detected but when it is enquired using 'sg' tool command, received an error. Below are the log information for your reference,

```
pcib12@pci0:59:0:0: class=0x060400 card=0xbeef11f8 chip=0x854611f8 rev=0x00 hdr=0x01
vendor = 'PMC-Sierra Inc.'
device = 'PM8546 B-FEIP PSX 96xG3 PCIe Storage Switch'
class = bridge
subclass = PCI-PCI
cap 10[40] = PCI-Express 2 upstream port max data 256(512)
link x16(x16) speed 8.0(8.0) ASPM disabled(L1)
cap 05[7c] = MSI supports 8 messages, 64 bit
cap 01[8c] = powerspec 3 supports D0 D3 current D0
cap 0d[94] = PCI Bridge card=0xbeef11f8
```
This PM8546 is the switchtec device, refer https://www.microchip.com/wwwproducts/en/PM8546#additional-features

dmesg log:

```
cam_periph_alloc: attempt to re-allocate valid device ses0 rejected flags 0 refcount 2
enc_async: Unable to probe new device due to status 0x6
cam_periph_alloc: attempt to re-allocate valid device pass0 rejected flags 0 refcount 4
passasync: Unable to attach new device due to status 0x6: CCB request was invalid
ses0 at ahciem0 bus 0 scbus8 target 0 lun 0
ses0: <AHCI SGPIO Enclosure 1.00 0001> SEMB S-E-S 2.00 device
ses0: SEMB SES Device

root@node1:/dev # sg_ses -v ses0
inquiry cdb: [URL='https://forums.freebsd.org/callto:12%2000%2000%2000%2024%2000']12 00 00 00 24 00[/URL]
inquiry: transport: (pass0:ahciem0:0:0:0): INQUIRY. CDB: [URL='https://forums.freebsd.org/callto:12%2000%2000%2000%2024%2000']12 00 00 00 24 00[/URL]
(pass0:ahciem0:0:0:0): CAM status: CCB request was invalid

ses0 doesn't respond to a SCSI INQUIRY
```


```
root@node1:/dev # sg_ses -v nvme0
cam_open_spec_device: cam_lookup_pass: CAMGETPASSTHRU ioctl failed
cam_lookup_pass: No such file or directory
cam_lookup_pass: either the pass driver isn't in your kernel
cam_lookup_pass: or nvme0 doesn't exist
open error: nvme0: Operation not permitted
```
As mentioned in the product pdf file, they have used the 'sg_ses_microcode' binary to download the firmware to that device, since none of the drivers are not detecting the storage switch as device.

Has anyone a idea which driver or kernel module has to be loaded to make this PCIe switch working?

Thank you for your help
Chris


----------



## ralphbsz (Nov 11, 2020)

SES is a SCSI protocol; you can download it from the T10 website (perhaps after giving them some money, BTDT). PCIe is not inherently a dedicated SCSI transport mechanism. But today SOP exists (at least in slideware and standards form), which allows transporting SCSI commands over PCIe. I have no idea what drivers in FreeBSD actually support it.

Look at man camcontrol, look for "SOP" and "PCIe". Use that as a starting point.

I have no idea whether the sg utils have been updated for SOP. I would search their documentation (man pages, README files) for words like "NVMe", "SOP" and "PCIe". If that fails, download their source code (it's a bit messy, but after a few hours of reading you'll get it.


----------

