Subject: CVS commit: src/sys/dev/scsipi
To: None <source-changes@NetBSD.org>
From: Charles M. Hannum <email@example.com>
Date: 09/17/2003 23:33:45
Module Name: src
Committed By: mycroft
Date: Wed Sep 17 23:33:44 UTC 2003
src/sys/dev/scsipi: scsipi_disk.h sd_scsi.c
If READ CAPACITY fails, try a READ FORMAT CAPACITIES. Separate this into
another function, always doing a page 0 MODE SENSE to get the block
descriptor if we use READ CAPACITY, and use SMS_DBD on the page 4/5 MODE
SENSE. This does one extra command in some cases, but it separates and
simplifies the code a little.
Why do we prefer READ CAPACITY over READ FORMAT CAPACITIES? Two reasons:
1) It's much older and is much less likely to have had its command code
abused, and is thus "safer" to try first. 2) ALL of my USB flash readers
and pen drives screw up their capacity descriptors -- mostly off-by-one
errors in the size (they return the maximum LBA number instead, a la READ
CAPACITY, which has *never* been how READ FORMAT CAPACITIES was documented
in the MMC spec), and one returns the "no media" code on slots that have
media inserted (despite returning almost-correct data otherwise)!
F*** me with a chainsaw.
To generate a diff of this commit:
cvs rdiff -r1.8 -r1.9 src/sys/dev/scsipi/scsipi_disk.h
cvs rdiff -r1.35 -r1.36 src/sys/dev/scsipi/sd_scsi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.