NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58231: NXP LPC1xxx virtual umass devices fail become ready
>Number: 58231
>Category: kern
>Synopsis: NXP LPC1xxx virtual umass devices fail become ready
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 07 10:05:00 +0000 2024
>Originator: staffan%shangtai.net@localhost
>Release: NetBSD 10.0
>Organization:
>Environment:
System: NetBSD shell.shangtai.net 9.3 NetBSD 9.3 (BLUEGLEAM_XEN3_DOMU) #11: Sat Aug 6 17:48:46 UTC 2022 duck%power.shangtai.net@localhost:/usr/build/src/sys/arch/amd64/compile/obj/BLUEGLEAM_XEN3_DOMU amd64
Architecture: x86_64
Machine: amd64
>Description:
This is a follow-up with a patch to the discussion on tech-kern@
(thread starts here:
http://mail-index.netbsd.org/tech-kern/2024/01/26/msg029452.html) about the LPC flash chip on my mnt reform2, so that the change can hopefully be included.
As discovered in the thread, these devices require that a SCSI START command
NOT be sent before they are accessed, and such a quirk is currently nonexistent
in NetBSD.
>How-To-Repeat:
Try to mount the virtual umass device on an NXP LPC1xxx on NetBSD
>Fix:
The following patch adds the required PQUIRK and adds a usb device quirk for
the LPC1xxx. It includes a change to the minimum number of cylinders in sd.c
that I'm not sure if is required (this is a very small device). I can test
without it if this change isn't desired.
This patchset is against the (then unreleased) netbsd-10 branch as of
February 4th 2024 (see patch header for more details)
# HG changeset patch
# User Staffan Thomen <duck%shangtai.net@localhost>
# Date 1707080552 0
# Sun Feb 04 21:02:32 2024 +0000
# Branch netbsd-10
# Node ID f368df5ceae4dbeb3a6a10e7e8b3c6668dc08303
# Parent 7ddaaaeb813a1bceaf4190cb6c3444cc3c225ebb
Round up cylinders to 1 if the device is so small it would be 0
diff -r 7ddaaaeb813a -r f368df5ceae4 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Tue Jan 16 08:28:51 2024 +0000
+++ b/sys/dev/scsipi/sd.c Sun Feb 04 21:02:32 2024 +0000
@@ -1769,6 +1769,8 @@
dp->heads = 64;
dp->sectors = 32;
dp->cyls = dp->disksize / (64 * 32);
+ if (dp->cyls == 0)
+ dp->cyls = 1;
}
dp->rot_rate = 3600;
# HG changeset patch
# User Staffan Thomen <duck%shangtai.net@localhost>
# Date 1707080615 0
# Sun Feb 04 21:03:35 2024 +0000
# Branch netbsd-10
# Node ID fb8c5f27a9473039c3bc82d453164ab2c201d5f4
# Parent f368df5ceae4dbeb3a6a10e7e8b3c6668dc08303
Add the PQUIRK_NOSTART quirk to prevent a START command from being sent to devices that don't support them
diff -r f368df5ceae4 -r fb8c5f27a947 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c Sun Feb 04 21:02:32 2024 +0000
+++ b/sys/dev/scsipi/scsipi_base.c Sun Feb 04 21:03:35 2024 +0000
@@ -1312,6 +1312,9 @@
{
struct scsipi_start_stop cmd;
+ if (periph->periph_quirks & PQUIRK_NOSTART)
+ return 0;
+
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = START_STOP;
cmd.byte2 = 0x00;
diff -r f368df5ceae4 -r fb8c5f27a947 sys/dev/scsipi/scsipiconf.h
--- a/sys/dev/scsipi/scsipiconf.h Sun Feb 04 21:02:32 2024 +0000
+++ b/sys/dev/scsipi/scsipiconf.h Sun Feb 04 21:03:35 2024 +0000
@@ -504,6 +504,7 @@
#define PQUIRK_NOREPSUPPOPC 0x01000000 /* does not grok
REPORT SUPPORTED OPCODES
to fetch device timeouts */
+#define PQUIRK_NOSTART 0x02000000 /* does not support START STOP */
/*
* Error values an adapter driver may return
*/
# HG changeset patch
# User Staffan Thomen <duck%shangtai.net@localhost>
# Date 1707080713 0
# Sun Feb 04 21:05:13 2024 +0000
# Branch netbsd-10
# Node ID cb668c56dec8cabbe5d0f6ed362d35db3faef28a
# Parent fb8c5f27a9473039c3bc82d453164ab2c201d5f4
Add the NXP vendor and the LPC1XXX product to apply its quirks
diff -r fb8c5f27a947 -r cb668c56dec8 sys/dev/usb/umass_quirks.c
--- a/sys/dev/usb/umass_quirks.c Sun Feb 04 21:03:35 2024 +0000
+++ b/sys/dev/usb/umass_quirks.c Sun Feb 04 21:05:13 2024 +0000
@@ -343,6 +343,16 @@
UMATCH_VENDOR_PRODUCT,
NULL, NULL
},
+
+ /* NXP LPC1xxx series ISP (In-System Programming) devices */
+
+ { { USB_VENDOR_NXP, USB_PRODUCT_NXP_LPC1XXX },
+ UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
+ 0,
+ PQUIRK_NOSTART | PQUIRK_NODOORLOCK | PQUIRK_NOSYNCCACHE | PQUIRK_ONLYBIG,
+ UMATCH_VENDOR_PRODUCT,
+ NULL, NULL
+ }
};
const struct umass_quirk *
diff -r fb8c5f27a947 -r cb668c56dec8 sys/dev/usb/usbdevs
--- a/sys/dev/usb/usbdevs Sun Feb 04 21:03:35 2024 +0000
+++ b/sys/dev/usb/usbdevs Sun Feb 04 21:05:13 2024 +0000
@@ -563,6 +563,7 @@
vendor LINUXFOUNDATION 0x1d6b Linux Foundation
vendor CINTERION 0x1e2d Cinterion
vendor AIRTIES 0x1eda AirTies
+vendor NXP 0x1fc9 NXP
vendor DLINK 0x2001 D-Link
vendor PLANEX2 0x2019 Planex Communications
vendor ENCORE 0x203d Encore
@@ -2572,6 +2573,9 @@
product NOVATEL2 U760_DRIVER 0x5030 Novatel Wireless U760 Windows/Mac Driver
product NOVATEL2 U760 0x6000 Novatel 760USB
+/* NXP products */
+product NXP LPC1XXX 0x000b NXP LPC1xxx IFLASH
+
/* Olympus products */
product OLYMPUS C1 0x0102 C-1 Digital Camera
product OLYMPUS C700 0x0105 C-700 Ultra Zoom
Home |
Main Index |
Thread Index |
Old Index