Commit Graph

962 Commits

Author SHA1 Message Date
mycroft d40837608f 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
   (it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
   *_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
   drives more quickly.
2003-09-19 21:35:56 +00:00
mycroft e80260e91f Whoops, make sure 6-byte commands work again. 2003-09-18 06:55:53 +00:00
mycroft f96fe2cc8a Don't print junk if an INQUIRY fails (usually with an ILLEGAL REQUEST due to
an unused LUN).  Also, if the qualifier says the LUN is non-existant, don't
try to attach a device here.
2003-09-18 05:06:53 +00:00
mycroft 9dbb8c86d4 Merge the geometry and cache handling code for all direct access and optical
devices, as it's general to all SCSI MMC devices.  In the process, remove
PQUIRK_NO_FLEX_PAGE.
2003-09-18 00:06:31 +00:00
mycroft e873dbd7ad 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.
2003-09-17 23:33:43 +00:00
mycroft b2d9db1002 Remove PQUIRK_BYTE5_ZERO. 2003-09-17 19:14:56 +00:00
mycroft 10675507e9 Don't be silent if there is no media present. 2003-09-13 15:49:04 +00:00
mycroft 953ba0b251 Make sure the "raw partition" can always be opened again. 2003-09-13 14:44:50 +00:00
mycroft af0c320925 Some devices really want INQUIRY to be the first command they receive. Also,
the result of the extra TEST UNIT READY was being ignored anyway.  So, I wrote
it, I nuke it.
2003-09-12 16:39:25 +00:00
mycroft 5118c3e1e9 Set up the blank fields in the INQUIRY buffer *before* executing the command --
because we can't really rely on the "additional length" being correct (any
more?).  Fixes some problems with devices showing up as "<, , >".
2003-09-10 05:35:50 +00:00
mycroft 3ce80fb07e Make similar changes as with cd_mode_{sense,select}(). 2003-09-09 06:32:14 +00:00
mycroft f733d9708b Remove NOMODESENSE quirks for Iomega drives -- they're totally unneeded. 2003-09-09 03:57:57 +00:00
mycroft 1c4e2cf723 Delete the NOMODESENSE quirks for Maxtor USB hard drives, as these are no
doubt resolved (and were never actually needed in the first place -- someone
was let out without supervision).
2003-09-09 03:01:27 +00:00
mycroft 67ed54a25b In the test for whether to start the unit, I used the wrong error code.
ENODEV is only returned when we get "medium not present," which we can fail
immediately on.  All other "not ready" cases return EIO.
2003-09-09 02:43:34 +00:00
mycroft 06fca94595 Exorcise PQUIRK_NODOORLOCK. 2003-09-09 02:37:55 +00:00
mycroft 7365679351 Oops. Fix a typo in cd_mode_select(). 2003-09-08 23:44:29 +00:00
mycroft ab5fff1eda Fix an error path where we might scsipi_prevent() on a non-removable device. 2003-09-08 23:43:35 +00:00
mycroft 5ad03464f5 There is absolutely no sense in having a PQUIRK_NODOORLOCK entry for a
non-removable device.  Nuke it.
2003-09-08 23:43:05 +00:00
mycroft a599f64320 If maxlun>0, automatically set PQUIRK_FORCELUNS, rather than using quirk
table entries.
2003-09-08 19:57:29 +00:00
mycroft 648730c4cf Do a START UNIT only if the TEST UNIT READY reports that the device is not
ready.  This avoids gratuitously starting the motor on floppy and CD-ROM
drives, and eliminates the need for the audio playing test in cdopen().

Therefore, also remove PQUIRK_NOSTARTUNIT.
2003-09-08 18:51:33 +00:00
mycroft 2bfde7f903 Attempt to deal with Martin's weirdass Sun drive by setting the mode sense
allocation length a little more precisely -- add the space for the header in
cd_mode_sense().  Also delete the XS_CTL_SILENT, since we really do want to
see errors.

Lastly, add a similar wrapper for mode select, simplifying the callers
slightly.
2003-09-08 16:16:43 +00:00
mycroft a7155b9951 Rework sd_scsibus_get_parms() a little. Try to get a block descriptor even
if our other MODE SENSEs fail.  Use this code for the optical device case,
at least for now.  (We could query the optical media type and do a table
lookup for the geometry, but why bother?  Actually, why bother with geometry
at all, but I digress...)
2003-09-08 06:31:23 +00:00
mycroft 98ba1f5667 On further investigation... don't panic if we try to do a 6-byte mode
sense/select on ATAPI.  Some tape drives require it.  And who knows?  Some
fool might wire a RBC device to ATAPI.
2003-09-08 03:50:27 +00:00
mycroft 637a6554cf Perform the exorcism on scsipi_mode_select() too. 2003-09-08 03:33:31 +00:00
mycroft 4588667f28 Exorcise something evil and wrong in scsipi_mode_sense(). 2003-09-08 03:24:12 +00:00
mycroft 0239de4901 RBC devices do in fact requre using 6-byte MODE SENSE/SELECT. This is totally
the wrong way to deal with that, but... I'll get back to it later.
2003-09-08 03:09:09 +00:00
mycroft f2a492ff6b Eliminate the separate ATAPI and SCSI attachments for "cd". 2003-09-08 01:56:33 +00:00
mycroft 5dd4bdd14c Use the const shaker. 2003-09-08 01:27:08 +00:00
mycroft 9203f63f67 We only need a single attachment for uk at scsibus and atapibus. 2003-09-08 01:26:41 +00:00
mycroft cd456a7097 Nuke some printf()s. 2003-09-08 01:13:04 +00:00
mycroft b6e043eed2 Set PQUIRK_ONLYBIG in the wdc-atapi frontend, obviating the need to ever test
the "bus type" for this.

Merge all the code in the SCSI and ATAPI backends for "cd" devices.  All of
the mode page handling and whatnot is general to SCSI MMC devices, and should
never have been separated to begin with.  This fixes a variety of problems,
and adds load/unload support for SCSI-attached devices.
2003-09-07 22:11:22 +00:00
mycroft 80605e4feb Use SMS_DBD in a several places to avoid even thinking about block descriptors. 2003-09-05 09:04:26 +00:00
mycroft 677da6684c Forgot to commit this. Add the "rpm" field to the flex geometry page. 2003-09-05 09:00:08 +00:00
mycroft 5c195383ca In addition to skipping a variable-length list of block descriptors, we also
have to adjust for whether he have a "small" or "large" mode sense response.

sd_scsibus_getcache(), sd_scsibus_setache(): Set SMS_DBD so that we don't
have to deal with block descriptors here.

sd_scsibus_mode_sense(): Add a new parameter, "int *big", which tells the
caller whether it's a small or large header.

sd_scsibus_get_parms(), sd_scsibus_getcache(), sd_scsibus_setcache(): Use
the "big" value to find the data following the mode sense header correctly.

sd_scsibus_mode_sense(): Disable PQUIRK_NOBIGMODESENSE for now, as the
reasons for it were dubious and most likely fixed now.

sd_scsibus_get_parms(): Now that we're actually locating the right data,
check the returned page code to see if it's correct before using the mode
page info.

sd_scsibus_get_parms(): Get the rotational rate from the flex geometry page
too, if present.

XXX sd_scsibus_get_{opt,simplifiedparms}() need some work.
2003-09-05 08:12:09 +00:00
mycroft 8b228f0d42 sd_scsibus_get_parms():
* Use the "block descriptor length" to find the beginning of the mode page
  data.  This is critical, since some devices do not return a block descriptor
  at all.  (XXX There is disgusting structure hackery here.)
* Always use scsipi_size() (i.e. READ CAPACITY) to get the total disk size.
* Get the rotational rate from the rigid geometry page.
* Don't read the block size from the block descriptor if there was none.
* Get the block size from the flexible geometry page if possible.
* If we don't like the way page 4 smells, try page 5, rather than just punting.
2003-09-05 00:28:55 +00:00
jrf 5e1e6d519e Added three scsi IDs which were tested by Dave Barnes who sent in
three PRs regarding them: 17836, 17837, 17838. Did a few kernel
compiles with them just to make sure they are okay. Approved by
christos@, thanks to Dave for sending the PRs and verifying to me
that they work.
2003-08-07 17:54:26 +00:00
wiz 86e9cd6e52 Add a cast to avoid an integer overflow.
Fixes playing (at least some) DVDs.
Patch from Tsubai Masanari (tsubai at iri.co.jp) -- thanks a lot!
2003-07-18 14:33:54 +00:00
martin 15a7538ed4 If a CD drive reports != 2048 byte block size, try to change it into
2048 byte mode. Fixes PR kern/22090.
Reviewed by Manuel Bouyer.
2003-07-10 18:18:40 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 292b5a8b0c Use aprint*(). 2003-05-13 03:00:07 +00:00
thorpej e43fecb228 Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself.  This paves the way for some future changes.
2003-05-10 23:12:28 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
fvdl 1f81d34aa0 Local change I had lying around: add NOLUNS quirk for an older seagate
drive.
2003-05-02 12:27:49 +00:00
dsl d91455ce26 Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
2003-05-02 08:45:10 +00:00
fvdl 8775f88505 Add another IBM drive that incorrectly reports DT only. 2003-04-21 18:07:14 +00:00
fvdl ee7b6f07aa One more FreeBSD compat define. 2003-04-20 23:43:04 +00:00
fvdl 4fe822c162 Correct typo in previous. 2003-04-20 12:05:42 +00:00
fvdl 3bc3f3793f Add FreeBSD compat define for PPR_PCOM 2003-04-20 11:53:28 +00:00
fvdl 40565542e4 Add NetBSD RCS id. 2003-04-19 19:21:35 +00:00