Commit Graph

1015 Commits

Author SHA1 Message Date
thorpej
c490cdc5be Warn if a sync period requiring DT was negotiated on a peripheral not
capable of DT.
2003-10-10 05:58:56 +00:00
bouyer
99d6009c2a Make the ATA mid-layer appears as atabus, as proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/25/0006.html
This adds a device (atabus) between IDE controllers and wd or atapibus, to
have each ATA channel show up in the device tree. Later there will be atabus
devices in /dev, so that we can do IOCTL on them.
Each atabus has its own kernel thread, to handle operations that needs polling,
e.g. reset and others.

Device probing on each bus it defered to the atabus thread creation.
This allows to do the reset and basic device probes in parallel, which reduce
boot time on systems with several pciide controllers.
2003-10-08 10:58:12 +00:00
bouyer
7b066791c8 Remove references to University of California from my copyright notices. 2003-10-05 17:48:49 +00:00
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
fvdl
a434795392 Add a PCAP_NODT quirk. I have two older Quantum Atlas drives that work
fine at U2W, but barf at U160, with different controllers. Unfortunately
sometimes just being initialized at U160 does the trick, so setting them
to lower speed in the BIOS may also be needed.
2003-04-19 19:16:06 +00:00
fvdl
016a1095a9 A device should always respond to inquiry or test unit ready; disable
retries for these during discovery. From Pascal Renauld at Network
Storage Solutions, Inc
2003-04-19 19:12:59 +00:00
fvdl
ea399d0682 Add MSG_QAS_REQUEST definition. 2003-04-19 19:11:13 +00:00
fvdl
76a06d99f3 IU pkt/task definitions include file. From FreeBSD. 2003-04-19 19:10:25 +00:00
nathanw
c4921eb479 Remove extra right paren. 2003-04-16 21:08:06 +00:00
thorpej
ce68b169df * Change the APIs that handle the sync period to work with 100ths of ns,
rather than 10ths of ns.  This is necessary in order to represent
  Ultra320 SCSI.
* Add Ultra320 SCSI to the scsipi_syncparams[] table.

We're not going to bother bumping any version numbers with this change; only
the "hba" driver uses scsipi_sync_period_to_factor(), and the uses of
scsipi_sync_factor_to_period() are all internal to the scsipi code.  Most
things just pass the factor around, which is unchanged by this.

Reviewed by Frank van der Linden.
2003-04-16 20:25:59 +00:00
perry
5f549c5ea8 Add a quirk for the Tandberg SLR/5
Fix supplied by Rex McMaster in PR kern/13603
2003-04-14 16:18:23 +00:00
fvdl
8103646465 Check RAW_PART against the media size instead of the disklabel.
Add the media size in 512-byte sectors to the softc, to avoid
some 64 bit computations. Bump the capacity stored in softcs
for disks to 64 bits.
2003-04-03 22:18:23 +00:00
erh
dcf3619707 Add a quirk to allow my NEO Jukebox to work again. 2003-04-03 17:41:51 +00:00
dbj
1820cd2e5c use PRId64 to printf bp->b_blkno, which is of type daddr_t 2003-03-20 05:49:21 +00:00
bouyer
8bc89ec2cb Move the SCSI_DELAY before the serialization for probe. multiple SCSI busses
can sleep, only probes have to be keept ordered.
2003-03-14 22:17:14 +00:00
drochner
49e6bf0fa5 Add support for "simplified direct" (aka RBC) devices.
This reveals some ugly points in the sd driver, as
the PQUIRK_ONLYBIG flag (there are 6, 10, 12 and 16 byte
CDBs for r/w) and the handling of small/big mode
select/sense. This should be cleaned up.
Also the "long" struct disk_parms.disksize is worth
a thought...
2003-03-07 16:18:57 +00:00
thorpej
eb14e86676 Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it.  This fixes a few places where either b_dep or b_interlock were
not properly initialized.
2003-02-25 20:35:31 +00:00
yamt
bcd7beec98 initialize b_interlock properly.
(for ioctl)
2003-02-23 08:50:58 +00:00
hannken
8f45c81f55 Add PQUIRK_NO_FLEX_PAGE for Fujitsu MO MCJ3230AP.
This drive returns bogus geometry (0 heads, 0 sectors).
2003-02-19 14:33:15 +00:00
pk
c94277bcbc Remove NOTAG quirk for the Seagate ST11200N; the cause of the failure that
prompted this entry was actually a driver bug.
2003-02-10 08:10:51 +00:00
mjacob
caffbd9ad1 kern/20231- pass the correct argument (arg_addr) on thru to scsipi_do_ioctl,
not the locally dereferenced fetch.
2003-02-07 17:36:13 +00:00
pk
338f31f581 Make the buffer cache code MP-safe. 2003-02-05 21:38:38 +00:00
wrstuden
28a2da880e Add defines and structure for control mode page. 2003-02-04 18:09:40 +00:00
thorpej
882dec6ba3 Test callout_pending(), not callout_active(), and eliminate now-unnecessary
callout_deactivate() calls.
2003-02-03 23:50:59 +00:00
bouyer
6acd95acc8 Add PQUIRK_NOLUNS entry for "NEC ", "CD-ROM DRIVE:502".
Fixes PR kern/18479
2003-02-01 21:38:09 +00:00
bouyer
0e0c2ae01d Remove revision in quirk entry for TOSHIBA XM-4101TASUNSLCD. The same drive with a newer revision also fails, so assume all revisions are bad until proven otherwise. Should fix PR kern/19912. 2003-01-27 18:55:24 +00:00
bad
f4aacfe9fc Being able to make image backups of your whole disk, not to mention not
causing certain ata disks to lock up by reading beyond the last block,
beats catering to broken devices.

bounds_check_with_label() RAW_PART too.
2003-01-23 00:00:32 +00:00
simonb
b2fd1c7b6d Remove a line of unreachable code. It seems to be a remnant of starting
off with a different driver, and the way this code is structured the
offending line isn't needed.
2003-01-21 00:24:20 +00:00
simonb
276fd1665c The Double-Semi-Colon Police. 2003-01-20 05:29:53 +00:00
simonb
4a67cf4f79 Only declare and set the "info" variable #ifndef SCSIVERBOSE. 2003-01-20 04:08:44 +00:00
martin
13e2ed575e Merge botch. 2003-01-18 12:05:39 +00:00
toshii
389a24609c Use the correct byte positions to read data returned by DVD_LU_SEND_RPC_STATE. 2003-01-13 03:32:56 +00:00
pk
d15d3cbfc0 Add two disks capable of doing synchronous transfer mode, but don't
report SCSI2: "MICROP 1924" and "FUJITSU M2266"
2003-01-09 12:25:00 +00:00
matt
5d09a84558 Add multiple inclusion protection. 2003-01-06 21:02:18 +00:00
wiz
1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
thorpej
72a7af27b0 Use aprint_normal() in cfprint routines. 2003-01-01 00:10:15 +00:00
jmcneill
ee462f15e8 Another sizeof -> 4 + 2048 fix for dvd_read_manufact after malloc changes 2002-12-15 17:48:14 +00:00
jmcneill
675603655c In dvd_read_disckey, sizeof(buf) is no longer '4 + 2048' after the
malloc change. Replace 'sizeof(buf)' with '4 + 2048' -- this makes
dvd_read_disckey work properly again.
2002-12-15 17:43:50 +00:00
fvdl
530a60a1e0 Don't waste too much kernel stack space on (infrequent) ioctl operations,
use malloc instead for temp space.
2002-12-15 01:55:44 +00:00
fvdl
bc4bea2904 Remove duplicate define that crept in. 2002-12-06 23:04:16 +00:00
fvdl
bcceca7072 Sync this with the FreeBSD version, adding a few aliases and new definitions. 2002-12-06 22:46:34 +00:00
jdolecek
661f8e80e2 Add NOLUNS|NOSYNC quirk for NEC CD-ROM DRIVE:222.
Change sent in PR kern/19286 by Dave Barnes.
2002-12-05 10:39:58 +00:00
christos
514f7047e4 si_ -> sel_ 2002-11-26 18:49:40 +00:00
scw
7a4dfd98e4 Quell an uninitialised variable warning. 2002-11-24 11:52:13 +00:00
thorpej
73f78d5e61 Fix signed/unsigned comparison warnings. 2002-11-09 18:52:20 +00:00
jdc
09f6c6a9cc Apply patch from Takeshi Nakayama on current-users which fixes problems
when trying to play audio CD's on some drives.  The original message was :

> In my analysis, rev 1.19 of cd_scsi.c used cd_scsibus_set_mode()
> instead of scsipi_mode_select(). cd_scsibus_set_mode() had the code
> which clear a data.header.data_length, but scsipi_mode_select()
> does not have. So we need `data.header.data_length = 0;' before
> calling scsipi_mode_select().

Fixes PR 7299 and probably PR 15155 and PR 16883 too.
2002-11-03 21:14:28 +00:00
mrg
603098b9b5 implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
	- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
	when processing hw.diskstats, add the read&write bytes/transfers for
	the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail.  however, the next time this is
change it will not fail again.

this is just the kernel portion.
2002-11-01 11:31:50 +00:00
jdolecek
e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
mjacob
3c709b448c Fixes kern/18709 (correcting some typos in comments) 2002-10-19 18:41:34 +00:00
junyoung
cc537c2f3a Add option NEW_BUFQ_STRATEGY, a new buffer queue strategy for better
system responsiness under high disk I/O load.

OK'ed by Juergen Hannken-Illjes.
2002-10-18 14:31:10 +00:00
thorpej
60adad59bd Define a "scsi_core" attribute. Make the "scsi" attribute depend on
"scsi_core".  Make all the files previously selected by the "scsi"
attribute selected by the "scsi_core" attribute.  Give the "scsibus"
device the "scsi_core" attribute.
2002-10-09 20:23:56 +00:00