Re: Universal Flash Storage Driver Proposal
Date: Fri, 14 Mar 2025 05:28:53 UTC
Hi Warner, I'm back in the office :). > I've been studying UMASS and have a different idea. I'm starting to not > like the PIM flags > now that I've read it. > > There's about a dozen commands that different USB flash devices can't do in > various ways. > I've started to convert umass to just fail the command as illegal when a > bad command is > sent to it. I've also been modifying the da, cd, etc drivers to notice the > illegal commands and > modify its behavior. It isn't a new idea: the periph drivers have been > doing it to cope with > drives that don't support READ(6) commands. It's recently (in the last 5 > years) expanded to > dealing with other commands like SYNCHRONIZE CACHE, MODE SENSE. > > The idea is to allow the device to reject the command as illegal. In the > cases of reduced SCSI > command sets, like RBC, UFS, etc the SIM should reject known bad commands > at the SIM > layer because history has shown that some of the > lower-quality-but-still-working-enough drives > can hang when unexpected commands are sent to them. > > Not supporting MODE SENSE(6) likely is going to be a somewhat larger change. I will follow up on your UMASS modification. And if you give me a guide, I'll follow it > Test how? I'm not sure I understand this question well enough to answer, > so maybe a few examples will help me focus an answer. I was wondering how you do unit tests and integration tests for device drivers. Is there a framework to write unit tests when developing a device driver? Is there any tool you use for Integration test (e.g. FIO(flexible I/O tester)) (I'm a FreeBSD newbie, so please forgive me if this is a stupid question). > In the mean time, I'll see if I can locate a copy of the UFS standard > or a reasonable summary. The ones at jedec.org are a bit too expensive > for me to buy on my own. I've found excerpts of it datasheets at best, which > may suffice for my review needs. If you register with JEDEC, you can get the documentation for UFS 2.1 version for free, although it is not the latest spec. There are two documents to look at for the UFS specification. UFSHCI, which is the host interface, and UFS, which is the device. - UFS 2.1 spec: https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf - UFSHCI 2.1 spec: https://www.jedec.org/sites/default/files/docs/JESD223C.pdf My implementation will be based on UFS 4.1, but the basics are the same. The main differences between UFS 2.1 and 4.1 are as follows - I/O queue changed from single queue to multi-queue - Maximum HS-GEAR changed from 3 -> 5, which improves bandwidth - Supports Write Booster (SLC caching) - Supports Host Performance Booster (HPB) I will explain the specification changes when I request a review of the features added in UFS 4.1. Thanks, Jaeyoon