Skip to contentSkip to conversation

scsi: Adjust SCSI inquiry command data length

PATCH In review Macpaul Lin 3 participants 3 messages Mar 5 – Mar 16 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi: Adjust SCSI inquiry command data length

Per the SCSI SPC-4 specification, the standard inquiry data length should not be less than 36 bytes. The current implementation uses 512 bytes, which causes detection failures on some UFS devices (e.g., Longsys) that do not expect a transfer length exceeding the standard inquiry size.

Align the default standard inquiry length with the Linux kernel's implementation (see drivers/scsi/scsi_scan.c), which uses 36 bytes as the default. Devices requiring vendor-specific inquiry lengths should be handled through quirk settings in the future.

---
 drivers/scsi/scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes for v2:
- Update commit message according to the review discussions.

drivers/scsi/scsi.c +1 -1
index 8fe6b38a8c74..116b696b08dd 100644
@@ -513,7 +513,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
 	pccb->target = target;
 	pccb->lun = lun;
 	pccb->pdata = tempbuff;
-	pccb->datalen = 512;
+	pccb->datalen = 36;
 	pccb->dma_dir = DMA_FROM_DEVICE;
 	scsi_setup_inquiry(pccb);
 	if (scsi_exec(dev, pccb)) {
Signature · 1 line
2.45.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Macpaul Lin

Per the SCSI SPC-4 specification, the standard inquiry data length should not be less than 36 bytes. The current implementation uses 512 bytes, which causes detection failures on some UFS devices (e.g., Longsys) that do not expect a transfer length exceeding the standard inquiry size.

Align the default standard inquiry length with the Linux kernel's implementation (see drivers/scsi/scsi_scan.c), which uses 36 bytes as the default. Devices requiring vendor-specific inquiry lengths should be handled through quirk settings in the future.

Thank you !

#2 lore raw
In reply to Macpaul Lin
Quoted 6 lines · Macpaul Lin

Per the SCSI SPC-4 specification, the standard inquiry data length should not be less than 36 bytes. The current implementation uses 512 bytes, which causes detection failures on some UFS devices (e.g., Longsys) that do not expect a transfer length exceeding the standard inquiry size.

Quoted 6 lines

Align the default standard inquiry length with the Linux kernel's implementation (see drivers/scsi/scsi_scan.c), which uses 36 bytes as the default. Devices requiring vendor-specific inquiry lengths should be handled through quirk settings in the future.

[...]

Applied to u-boot/next, thanks!

[1/1] scsi: Adjust SCSI inquiry command data length

      commit: 041364141b7daef8318a4b8495cac8570002773f
Signature · 1 line
Tom