Bug 235897 - quirky Sandisk SDCZ48-032G when using XHCI
Summary: quirky Sandisk SDCZ48-032G when using XHCI
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-02-20 19:37 UTC by vidwer+fbsdbugs
Modified: 2020-10-17 23:13 UTC (History)
1 user (show)

See Also:


Attachments
draft patch for quirk found in SanDisk Ultra SDCZ48-032G (1.84 KB, text/plain)
2019-02-20 19:37 UTC, vidwer+fbsdbugs
no flags Details
diff to solve CCB errors (1.20 KB, patch)
2019-02-21 00:24 UTC, vidwer+fbsdbugs
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description vidwer+fbsdbugs 2019-02-20 19:37:20 UTC
Created attachment 202201 [details]
draft patch for quirk found in SanDisk Ultra SDCZ48-032G

Running 13-CURRENT, r344363 on amd64.

dmesg:
ugen1.3: <SanDisk Ultra> at usbus1
umass0 on uhub4
umass0: <SanDisk Ultra, class 0/0, rev 3.00/1.00, addr 2> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 3 more tries remain
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 2 more tries remain
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <SanDisk Ultra 1.00> Removable Direct Access SPC-4 SCSI device
da0: Serial Number <redacted>
da0: 400.000MB/s transfers
da0: 29328MB (60063744 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>


usbconfig -d ugen1.3 dump_all_desc:
ugen1.3: <SanDisk Ultra> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps)
pwr=ON (224mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0300
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0009
  idVendor = 0x0781
  idProduct = 0x5581
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <SanDisk>
  iProduct = 0x0002  <Ultra>
  iSerialNumber = 0x0003  <redacted>
  bNumConfigurations = 0x0001

 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x002c
    bNumInterfaces = 0x0001
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0070

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x0008  <Mass storage>
      bInterfaceSubClass = 0x0006
      bInterfaceProtocol = 0x0050
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0400
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x06
      bDescriptorType = 0x30
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x06, 0x30, 0x01, 0x00, 0x00, 0x00


     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0002  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0400
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x06
      bDescriptorType = 0x30
      bDescriptorSubType = 0x0f
       RAW dump:
       0x00 | 0x06, 0x30, 0x0f, 0x00, 0x00, 0x00


Proposed, yet unimproving the CCB stall, diff: see attached diff.

I reasoned that scsi_da.c might benefit from "*" in the version field
("1.00"), however that won't clear the stall either.
Comment 1 vidwer+fbsdbugs 2019-02-20 19:40:28 UTC
While usb_quirk.c looks like this, the message (after the diff) shows without errors _but_ the disk's pretty name is gone in da0:

Index: sys/dev/usb/quirk/usb_quirk.c
===================================================================
--- sys/dev/usb/quirk/usb_quirk.c	(revision 344363)
+++ sys/dev/usb/quirk/usb_quirk.c	(working copy)
@@ -396,6 +396,8 @@
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(SANDISK, SDCZ4_256, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
+	USB_QUIRK(SANDISK, SDCZ48_32, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
+	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE,UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SANDISK, SDDR31, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1),
 	USB_QUIRK(SANDISK, IMAGEMATE_SDDR289, 0x0000, 0xffff,

ugen1.3: <SanDisk Ultra> at usbus1
umass0 on uhub3
umass0: <SanDisk Ultra, class 0/0, rev 3.00/1.00, addr 2> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0xc580
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <  > Removable Direct Access SCSI-2 device
da0: 400.000MB/s transfers
da0: 29328MB (60063744 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
Comment 2 vidwer+fbsdbugs 2019-02-20 21:48:24 UTC
With
+options        CAMDEBUG
+options        CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH)
in sys/amd64/conf/GENERIC:

ugen1.3: <SanDisk Ultra> at usbus1
umass0 on uhub4
umass0: <SanDisk Ultra, class 0/0, rev 3.00/1.00, addr 2> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
(noperiph:umass-sim0:0:-1:ffffffff): xpt_async(AC_PATH_REGISTERED)
(probe0:umass-sim0:0:0:0): Periph created
(probe0:umass-sim0:0:0:0): Probe started
(probe0:umass-sim0:0:0:0): Probe PROBE_INVALID to PROBE_INQUIRY
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00 
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 3 more tries remain
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00 
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 2 more tries remain
(probe0:umass-sim0:0:0:0): Probe PROBE_INQUIRY to PROBE_FULL_INQUIRY
(probe0:umass-sim0:0:0:0): Probe PROBE_FULL_INQUIRY to PROBE_REPORT_LUNS
(probe0:umass-sim0:0:0:0): Probe: 1 lun(s) reported
(probe0:umass-sim0:0:0:0): Probe PROBE_REPORT_LUNS to PROBE_SUPPORTED_VPD_LIST
(probe0:umass-sim0:0:0:0): Probe PROBE_SUPPORTED_VPD_LIST to PROBE_DEVICE_ID
(probe0:umass-sim0:0:0:0): Probe PROBE_DEVICE_ID to PROBE_EXTENDED_INQUIRY
(probe0:umass-sim0:0:0:0): Probe PROBE_EXTENDED_INQUIRY to PROBE_SERIAL_NUM
(probe0:umass-sim0:0:0:0): Probe PROBE_SERIAL_NUM to PROBE_TUR_FOR_NEGOTIATION
(probe0:umass-sim0:0:0:0): Probe PROBE_TUR_FOR_NEGOTIATION to PROBE_DONE
(probe0:umass-sim0:0:0:0): Probe completed
(probe0:umass-sim0:0:0:0): Periph invalidated
(probe0:umass-sim0:0:0:0): Periph destroyed
(noperiph:umass-sim0:0:0:0): xpt_async(AC_FOUND_DEVICE)
(pass2:umass-sim0:0:0:0): Periph created
pass2 at umass-sim0 bus 0 scbus2 target 0 lun 0
pass2: <SanDisk Ultra 1.00> Removable Direct Access SPC-4 SCSI device
pass2: Serial Number <redacted>
pass2: 400.000MB/s transfers
(da0:umass-sim0:0:0:0): Periph created
GEOM: new disk da0
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <SanDisk Ultra 1.00> Removable Direct Access SPC-4 SCSI device
da0: Serial Number <redacted>
da0: 400.000MB/s transfers
da0: 29328MB (60063744 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
da0: Delete methods: <NONE(*),ZERO>
(noperiph:umass-sim0:0:0:0): (da0:umass-sim0:0:0:0): xpt_async(AC_ADVINFO_CHANGED)
daopen
(da0:umass-sim0:0:0:0): daclose
(da0:umass-sim0:0:0:0): daopen
(da0:umass-sim0:0:0:0): daclose
(da0:umass-sim0:0:0:0): daopen
(da0:umass-sim0:0:0:0): daclose
(da0:umass-sim0:0:0:0): daopen
(da0:umass-sim0:0:0:0): daclose
(da0:umass-sim0:0:0:0): daopen
(da0:umass-sim0:0:0:0): daclose
Comment 3 vidwer+fbsdbugs 2019-02-21 00:24:33 UTC
Created attachment 202209 [details]
diff to solve CCB errors

The attached patch (for usb_quirks.c) works for me.

Original work was found using google with "CAM status: CCB request completed with an error" at https://forums.freebsd.org/threads/usb-disks-unusable-ccb-request-completed-with-an-error.60419/
Comment 4 Hans Petter Selasky freebsd_committer 2019-02-22 21:57:58 UTC
Let me know if the submitted patch does not work.
Comment 5 commit-hook freebsd_committer 2019-02-22 21:58:09 UTC
A commit references this bug:

Author: hselasky
Date: Fri Feb 22 21:57:27 UTC 2019
New revision: 344477
URL: https://svnweb.freebsd.org/changeset/base/344477

Log:
  Add new USB quirk.

  PR:			235897
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Changes:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs
Comment 6 commit-hook freebsd_committer 2019-03-01 08:04:43 UTC
A commit references this bug:

Author: hselasky
Date: Fri Mar  1 08:04:17 UTC 2019
New revision: 344693
URL: https://svnweb.freebsd.org/changeset/base/344693

Log:
  MFC r344477:
  Add new USB quirk.

  PR:			235897
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/12/
  stable/12/sys/dev/usb/quirk/usb_quirk.c
  stable/12/sys/dev/usb/usbdevs
Comment 7 commit-hook freebsd_committer 2019-03-01 08:05:46 UTC
A commit references this bug:

Author: hselasky
Date: Fri Mar  1 08:05:29 UTC 2019
New revision: 344694
URL: https://svnweb.freebsd.org/changeset/base/344694

Log:
  MFC r344477:
  Add new USB quirk.

  PR:			235897
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/11/
  stable/11/sys/dev/usb/quirk/usb_quirk.c
  stable/11/sys/dev/usb/usbdevs
Comment 8 commit-hook freebsd_committer 2019-03-01 08:06:49 UTC
A commit references this bug:

Author: hselasky
Date: Fri Mar  1 08:06:24 UTC 2019
New revision: 344695
URL: https://svnweb.freebsd.org/changeset/base/344695

Log:
  MFC r344477:
  Add new USB quirk.

  PR:			235897
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/10/
  stable/10/sys/dev/usb/quirk/usb_quirk.c
  stable/10/sys/dev/usb/usbdevs
Comment 9 vidwer+fbsdbugs 2020-10-17 23:13:56 UTC
(In reply to Hans Petter Selasky from comment #4)
FYI, it also works fine with just UQ_MSC_NO_SYNC_CACHE.