Commit Graph

126 Commits

Author SHA1 Message Date
cgd 8a2d9d7d74 in the ATAPI bug workaround code ("HACK"), don't forget to set
SCSI_AUTOCONF when executing SCSI commands.
1998-03-03 23:15:36 +00:00
cgd ed81982205 #if some bug workaround code which only needs to be compiled if
ATAPI 'sd's are present.
1998-01-15 18:59:03 +00:00
cgd 3b207eaf83 add support for an ATAPI attachment for 'sd'.
fix 'cd' driver's NCD_SCSI bogosity (was using testing wrong macro!)
clean up in various ways:
* make common atapi_mode_{sense,select}() functions.
* put ATAPI data structures in more sensible headers, split up by
  device type.
* include headers a bit more carefully.
* pass flags to attachment-specific cd functions, and use them.
* get rid of SCSI bits in scsipi_base.h's scsipi_make_xs(), move
  them into the correct place in scsi_base.c.
* fix minor typo in struct name in scsipiconf.h (which was apparently
  never used except in a #define later in the same file).
* use __attribute__ to force 4-byte alignment for xs command store,
  so that architectures trying to bus_space_write_multi_N() (where
  N > 1) that data to a controller won't lose.
* clean up a few comments in typos, and make a few #defines easier to
  understand/maintain.
* rename cd_link.h to cdvar.h (via repository copy).  This is exactly
  what a 'var' file is supposed to be.
1998-01-15 02:21:27 +00:00
thorpej 93f26b5f40 Adjust for changes to config. 1998-01-12 09:49:10 +00:00
thorpej 75e554c27d Implement two macros, scsipi_command() and scsipi_command_direct(), and
use them to hide the structure of the function pointers we jump through
to issue a command.
1997-10-18 19:50:51 +00:00
explorer 80513cb5ae o Make usage of /dev/random dependant on
pseudo-device   rnd                     # /dev/random and in-kernel generator
  in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
  that this code is derived in part from Ted Tyso's linux code.
1997-10-13 00:46:08 +00:00
explorer b5feb41072 Add hooks to insert timing info into the random system 1997-10-10 01:09:03 +00:00
thorpej 939e074dcc Implement DIOCGDEFLABEL. 1997-10-08 23:05:22 +00:00
enami d7d845c3d2 Cosmetic changes to keep coding style consistency in this directory;
- Indent with tab of width 8.
- Use four column to indent continuation line.
- Fold long line if possible.
- Use return (xx) instead of return xx.
- Compare pointer against NULL instead of testing like boolean.
- Delete whitespace at the end of line.
- Delete whitespace in front of function call operator.
- Delete whitespace after cast.
- Dereference a pointer to function explicitly.
- Add an empty line after local variable declaration.
- Use NULL instead of (char *)0.
- Dont use block for single statement.
1997-10-01 01:18:38 +00:00
mjacob 2896e07556 Allow SDOUTSTANDING to be defined elsewhere (e.g., config file). 1997-09-20 18:56:30 +00:00
bouyer 6f3bab1f59 Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
1997-08-27 11:22:52 +00:00
fair be20028837 trivial change for PR#3815 1997-08-04 07:16:49 +00:00
phil a8597d8143 Report actual disksize on finding a disk.
(From: der Mouse  <mouse@Rodents.Montreal.QC.CA>)
1997-07-02 03:51:25 +00:00
thorpej 84166e5151 foosize()'s return value is in DEV_BSIZE units; adjust the size obtained
from the disklabel accordingly.
1997-06-24 00:28:36 +00:00
pk 8303adf18a sdsize(): only call sdopen()/sdclose() if not already open, per the
current openmask.
1997-06-18 20:38:59 +00:00
mycroft aca1dae3c4 Push the buffer cleanup code into scsi_done(), and split it so that biodone()
is called *after* the driver `done' routine.  This fixes disk I/O statistics
on SCSI devices.

Also, calling the `done' routine with a `complete' argument of 0 and actually
having it do anything meaningful loses in at least 3 ways, so just nuke the
argument altogether and don't call it this way.  If the driver needs to do
some error handling, that's what `err_handler' is for.
1997-04-02 02:29:30 +00:00
mikel 4a6b41b8fe garbage collect unused variable (was this struct declaration orginally
a typedef?); from Enami Tsugutomo in PR kern/3282.
1997-03-04 06:25:22 +00:00
thorpej 15b56daab6 If posting an error condition because the media has been unloaded,
make sure to set the residual count to reflect that no data was
transfered.

From Naofumi HONDA / MINOURA Makoto, PR #3007.
1997-02-21 23:03:25 +00:00
thorpej 625d310b1b Handle optical disks a little better, from Naofumi HONDA / MINOURA Makoto
in PR #3009, with some slight KNF from me.
1997-02-21 21:51:59 +00:00
cgd ea0c7b4423 update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
1996-12-05 01:06:39 +00:00
thorpej 40611b811f Start a mode sense with a clean sense buffer.
Fixes PR #2953, from David M. Stanhope <dms@celtech.com>.
1996-11-29 19:58:40 +00:00
matthias c53ad1988a * At least the Teac FC-1 Shugart-SCSI bridgeboard does motor on/off
management by itself. But when it gets a start unit request, it keeps
the floppy motor running all the time. This adds code for dealing with
yet another quirk (SDEV_NOSTARTUNIT) that prevents sd.c from sending
start unit requests. A entry for the Teac FC-1 is added to the quirk
table.
1996-10-23 07:25:39 +00:00
christos 9a2c8cf28c revert previous kprintf change 1996-10-12 23:23:13 +00:00
christos 9beb92aad7 printf -> kprintf, sprintf -> ksprintf 1996-10-10 23:32:59 +00:00
christos 7e1c82f6f4 - Apply PR/2535: Add support for flex scsi disks.
- Add a quirk called SCSI_NOMODESENSE for drives like the iomega jaz,
  that don't support mode sense.
1996-07-05 16:19:02 +00:00
thorpej 56543dfb7d In sddump(), don't check the SDEV_MEDIA_LOADED bit of the device, since
that bit might have been cleared by successful unmounting of all filesystems
on the dump device, e.g. in the case of "reboot -d".
1996-06-04 23:12:14 +00:00
leo 153c617719 Clear SDEV_MEDIA_LOADED bit on the last close of a device. This causes the
geometry info & the disklabel to be reloaded on each 'first-open' of the
device.
1996-05-14 10:38:47 +00:00
thorpej 1379322cde Print the error code in the "not queued" message, to make debugging
a bit easier, and make sure a newline gets printed.
1996-05-14 00:10:37 +00:00
christos 0efbe64fb8 Cleanup the rest of the SCSIDEBUG printfs. From Bernd Ernesti. 1996-05-05 19:52:50 +00:00
christos 88c3808921 - SCSIDEBUG printf() fixes. 1996-05-03 19:48:20 +00:00
christos ffd5576439 remove include of <sys/cpu.h> 1996-04-22 01:44:31 +00:00
christos beec8ba94c Eliminate scsi_conf.h. 1996-03-30 21:44:50 +00:00
mycroft 5ed22a9852 Put back dk_establish() for now. 1996-03-26 22:22:19 +00:00
mycroft 5f57f43753 Increase *OUTSTANDING.
Remove old dk_establish() garbage.
Support the `ancient' bit in both drivers.
1996-03-26 20:32:06 +00:00
mycroft caeb897758 Fix trivial oversight in last. 1996-03-24 07:36:11 +00:00
mycroft e819063285 Define a full set of [234][bl]tol() and lto[234][bl]() conversion functions,
inlined.
Use sized types in protocol structures.
Make the definition of scsi_sense_data less ugly.
1996-03-19 03:05:15 +00:00
pk 12bcc82160 Parentheses are your friends. 1996-03-17 02:06:50 +00:00
thorpej 532e997971 New device attachment scheme:
- split softc size and match/attach out from cfdriver into
	  a new struct cfattach.

	- new "attach" directive for files.*.  May specify the name of
	  the cfattach structure, so that devices may be easily attached
	  to parents with different autoconfiguration semantics.
1996-03-17 00:57:14 +00:00
thorpej a8573feb51 Normalize SCSI autoconfiguration output.
From Chris Demetriou <cgd@NetBSD.ORG>.  Fixes PR #1958.
1996-03-05 00:15:09 +00:00
christos 0bc63f486d scsi prototypes 1996-02-14 21:46:52 +00:00
thorpej c7a20f0ee3 Implement DIOCLOCK and DIOCEJECT. DIOCEJECT is limited to removable
media.  Fixes PR #1975.
1996-01-30 18:24:47 +00:00
thorpej 8068d9eeb2 Handle cases like the following:
- controller calls scsi_done() with error XS_TIMEOUT
	- scsi_done() calls sddone()
	- sddone() calls disk_unbusy()
	- scsi_done() calls controller to retry command (missing the
	  call to disk_busy())
	- controller calls scsi_done()
	- scsi_done() calls sddone()
	- sddone() calls disk_busy(), which panics because of the imbalance.
Bug noticed by Leo Weppleman, who also suggested this fix; pass an additional
boolean argument ("complete") to the device's "done" routine, with a
value of `0' passed from the previous call to "done", and add an additional
call to "done" when the xfer resources are freed.
1996-01-12 22:43:26 +00:00
thorpej 5b39541e48 New generic disk framework. Highlights:
- New metrics handling.  Metrics are now kept in the new
	  `struct disk'.  Busy time is now stored as a timeval, and
	  transfer count in bytes.

	- Storage for disklabels is now dynamically allocated, so that
	  the size of the disk structure is not machine-dependent.

	- Several new functions for attaching and detaching disks, and
	  handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
1996-01-07 22:01:38 +00:00
thorpej 1cd2ca323b Remove a couple of now unneeded assignments. 1995-12-07 21:54:24 +00:00
thorpej b6c6d46a82 In sdminphys(), add a comment about the semantics of the "length" field
in a 6-byte read/write cdb (namely, length == 0 really means 256), and
that we handle this conservatively by limiting the transfer to 255 blocks.
*sigh* One just never knows how a pre-scsi-1 device is going to behave.
1995-12-07 19:46:00 +00:00
thorpej c9895db015 In both cd.c and sd.c:
If the read or write request can fit into a 6-byte cdb, then
	use a 6-byte cdb, otherwise use the 10-byte as before.

In sd.c:
	In sdattach(), make a note if the device is "ancient" (i.e.
	inqbuf.version & SID_ANSII == 0).

	Implement sdminphys(): if the device is "ancient", shorten the
	transfer so it will fit into a 6-byte cdb.

These changes have eliminated the rejected read/write requests on my
Sun 3/60 with 2 ESDI disks behind an Emulex MD21.
1995-12-07 19:11:32 +00:00
mycroft 92221a1399 Return EINVAL if something other than a whole number of blocks is requested. 1995-10-10 02:52:56 +00:00
pk db0107b895 Specify SCSI_DATA_OUT in sddump() (from John Kohl; PR#1482). 1995-09-30 22:57:19 +00:00
thorpej 249cddaaa7 Don't declare Debugger(). It's handled in <sys/systm.h>.
#include <sys/systm.h> where necessary, as suggested by Jonathan Stone.
Fixes PR #1511.
1995-09-26 19:26:48 +00:00
mycroft 8887de9230 opri --> s 1995-08-12 22:58:01 +00:00