Commit Graph

367 Commits

Author SHA1 Message Date
Peter Wemm
2398f0cd1d Hints overhaul:
- Replace some very poorly thought out API hacks that should have been
  fixed a long while ago.
- Provide some much more flexible search functions (resource_find_*())
- Use strings for storage instead of an outgrowth of the rather
  inconvenient temporary ioconf table from config().  We already had a
  fallback to using strings before malloc/vm was running anyway.
2001-06-12 09:40:04 +00:00
Noriaki Mitsunaga
36afc45690 Sorry, an "ARCHIVE Python 06408" does not need SA_QUIRK_NOCOMP. 2001-06-06 13:01:44 +00:00
Matt Jacob
2c7d0b8dbc first blush at some FC path inquiry settings 2001-06-04 18:23:49 +00:00
Matt Jacob
f253884421 Do NOLUNS dance for oddball Exabyte. We *really* need to do this as hints.
Correct match for A5000 SES instance.

PR:		19887
MFC after:	2 weeks
2001-06-04 18:20:52 +00:00
Matt Jacob
fd13aa4745 first blush at some FC path inquiry settings 2001-06-04 18:08:30 +00:00
Noriaki Mitsunaga
a5c3951e7a Add a quirk entry for ARCHIVE Python 06408.
Approved by:	mjacob
2001-06-01 12:36:24 +00:00
Kenneth D. Merry
cb429a255a Print out the asc/ascq and description even when both the asc and ascq
are zero.  This is so that users will see the "no addtional sense" printout
and know that they have the full sense information.
2001-05-27 03:22:51 +00:00
John Baldwin
8bd57f8fc2 Remove unneeded includes of sys/ipl.h and machine/ipl.h. 2001-05-15 23:22:29 +00:00
Poul-Henning Kamp
b63170f870 Exploit recent improvements in the disk minilayer to simplify error
handling a bit.

Dogmatic lingupurists can celebrate that a number of gotos got removed.

Reviewed by:	mjacob, ken
2001-05-08 08:30:48 +00:00
Poul-Henning Kamp
a468031ce8 Actually biofinish(struct bio *, struct devstat *, int error) is more general
than the bioerror().

Most of this patch is generated by scripts.
2001-05-06 20:00:03 +00:00
Joerg Wunsch
66d98ff938 Add q quirk for the old SONY SMO drive i've been sitting upon in my
private tree for too long now.  This (pre SCSI-2) drive returns a
mystic code when the medium is inserted but not spun up.
2001-05-05 14:42:06 +00:00
Kenneth D. Merry
9c6a092060 Fix up unit attention and selection timeout handling in various peripheral
drivers.

- change daprevent() to set CAM_RETRY_SELTO and SF_RETRY_UA when it calls
  cam_periph_runccb().
- change the pt(4) driver to ignore unit attentions
- change the targ(4) driver to retry selection timeouts
- clean up a few formatting glitches in the targ(4) driver

Reviewed by:	gibbs
2001-05-01 19:37:25 +00:00
Kenneth D. Merry
7b1f8d8bd4 Add sense key table entries for DATA PROTECT and BLANK CHECK. This will
prevent scsi_sense_desc() from deferencing a NULL pointer when a drive
happens to return one of these sense keys.

Reported by:	Michael Samuel <michael@miknet.net>
2001-04-30 21:40:09 +00:00
Kenneth D. Merry
00e54d14f6 In camperiphscsisenseerror(), don't return an error when the error action
is SS_NOP.

Submitted by:	joerg
2001-04-30 21:02:57 +00:00
Kenneth D. Merry
6c3a3e1013 Fix an errant search and replace that broke SCSI start unit commands.
This should fix automatic spinups as well as 'camcontrol start'.
2001-04-30 16:07:38 +00:00
Joerg Wunsch
fc89704c57 Fix the `tape drive spinning indefinately upon mt stat' problem.
With the recent changes in the CAM error handling, some problems in
the error handling of sa(4) have been uncovered.  Basically, a number
of conditions that are not actually errors have been mistreated as
genuine errors.  In particular:

. Trying to read in variable length mode with a mismatched blocksize
  between the on-tape (virtual) blocks and the read(2) supplied buffer
  size, causing an ILI SCSI condition, have caused an attempt to retry
  the supposedly `errored' transfer, causing the tape to be read
  continuously until it eventually hit EOM.  Since by default any
  simple mt(1) operation does an initial test read, an `mt stat' was
  sufficient to trigger this bug.

  Note that it's Justin's opinion that treating a NO SENSE as an EIO
  is another bug in CAM.  I feel not authorized to fix cam_periph.c
  without another confirmation that i'm on the right track, however.

. Hitting a filemark caused the read(2) syscall to return EIO, instead
  of returning a `short read'.  Note that the current fix only solves
  this problem in variable length mode.  Fixed length mode uses a
  different code path, and since i didn't grok all the intentions behind
  that handling, i did not touch it (IOW: it's still broken, and you get
  an EIO upon hitting a filemark).

The solution is to keep track of those conditions inside saerror(),
and upon completion to not call cam_periph_error() in that case.  We
need to make sure that the device gets unfrozen if needed though (in
case of actual errors, cam_periph_error() does this on our behalf).

Not objected by:       mjacob (who currently doesn't have the time to
			      review the patch)
2001-04-22 20:13:28 +00:00
Kenneth D. Merry
623db3603c Fix an off-by-2 error in periphdriver_register(). The read side of the
bcopy would go off the end of the array by two elements, which sometimes
causes a panic if it happens to cross into a page that isn't mapped.

Submitted by:	gibbs
Reviewed by:	peter
2001-04-16 15:53:54 +00:00
Matt Jacob
34707c9f37 If we have and error and are booting verbosely, don't be complaining
if this was a non-retryable selection timeout- wading through 256 targets
worth of Fibre Channel 'selection timeouts' is tedious at best.
2001-04-04 18:24:35 +00:00
Murray Stokely
22a6b4127a comment typo: subsytem -> subsystem
PR:		26219
Submitted by:	Andre <andre@akademie3000.de>, chern@osd.bsdi.com
2001-03-31 04:34:15 +00:00
John Baldwin
f34fa851e0 Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
2001-03-28 09:17:56 +00:00
Paul Saab
6b8b8c7fdc Last commit was broken.. It always prints '[CTRL-C to abort]'.
Move duplicate code for printing the status of the dump and checking
for abort into a separate function.

Pointy hat to:	me
2001-03-28 01:37:29 +00:00
Paul Saab
f2a404d5a6 Change the dump routines to only abort if control-c is pressed.
If any other key is pressed, print a message stating that control-c
is how to abort.

Reviewed by:	peter
2001-03-27 06:24:08 +00:00
Kenneth D. Merry
3393f8daa3 Rewrite of the CAM error recovery code.
Some of the major changes include:

	- The SCSI error handling portion of cam_periph_error() has
	  been broken out into a number of subfunctions to better
	  modularize the code that handles the hierarchy of SCSI errors.
	  As a result, the code is now much easier to read.

	- String handling and error printing has been significantly
	  revamped.  We now use sbufs to do string formatting instead
	  of using printfs (for the kernel) and snprintf/strncat (for
	  userland) as before.

	  There is a new catchall error printing routine,
	  cam_error_print() and its string-based counterpart,
	  cam_error_string() that allow the kernel and userland
	  applications to pass in a CCB and have errors printed out
	  properly, whether or not they're SCSI errors.  Among other
	  things, this helped eliminate a fair amount of duplicate code
	  in camcontrol.

	  We now print out more information than before, including
	  the CAM status and SCSI status and the error recovery action
	  taken to remedy the problem.

	- sbufs are now available in userland, via libsbuf.  This
	  change was necessary since most of the error printing code
	  is shared between libcam and the kernel.

	- A new transfer settings interface is included in this checkin.
	  This code is #ifdef'ed out, and is primarily intended to aid
	  discussion with HBA driver authors on the final form the
	  interface should take.  There is example code in the ahc(4)
	  driver that implements the HBA driver side of the new
	  interface.  The new transfer settings code won't be enabled
	  until we're ready to switch all HBA drivers over to the new
	  interface.

src/Makefile.inc1,
lib/Makefile:		Add libsbuf.  It must be built before libcam,
			since libcam uses sbuf routines.

libcam/Makefile:	libcam now depends on libsbuf.

libsbuf/Makefile:	Add a makefile for libsbuf.  This pulls in the
			sbuf sources from sys/kern.

bsd.libnames.mk:	Add LIBSBUF.

camcontrol/Makefile:	Add -lsbuf.  Since camcontrol is statically
			linked, we can't depend on the dynamic linker
			to pull in libsbuf.

camcontrol.c:		Use cam_error_print() instead of checking for
			CAM_SCSI_STATUS_ERROR on every failed CCB.

sbuf.9:			Change the prototypes for sbuf_cat() and
			sbuf_cpy() so that the source string is now a
			const char *.  This is more in line wth the
			standard system string functions, and helps
			eliminate warnings when dealing with a const
			source buffer.

			Fix a typo.

cam.c:			Add description strings for the various CAM
			error status values, as well as routines to
			look up those strings.

			Add new cam_error_string() and
			cam_error_print() routines for userland and
			the kernel.

cam.h:			Add a new CAM flag, CAM_RETRY_SELTO.

			Add enumerated types for the various options
			available with cam_error_print() and
			cam_error_string().

cam_ccb.h:		Add new transfer negotiation structures/types.

			Change inq_len in the ccb_getdev structure to
			be "reserved".  This field has never been
			filled in, and will be removed when we next
			bump the CAM version.

cam_debug.h:		Fix typo.

cam_periph.c:		Modularize cam_periph_error().  The SCSI error
			handling part of cam_periph_error() is now
			in camperiphscsistatuserror() and
			camperiphscsisenseerror().

			In cam_periph_lock(), increase the reference
			count on the periph while we wait for our lock
			attempt to succeed so that the periph won't go
			away while we're sleeping.

cam_xpt.c:		Add new transfer negotiation code.  (ifdefed
			out)

			Add a new function, xpt_path_string().  This
			is a string/sbuf analog to xpt_print_path().

scsi_all.c:		Revamp string handing and error printing code.
			We now use sbufs for much of the string
			formatting code.  More of that code is shared
			between userland the kernel.

scsi_all.h:		Get rid of SS_TURSTART, it wasn't terribly
			useful in the first place.

			Add a new error action, SS_REQSENSE.  (Send a
			request sense and then retry the command.)
			This is useful when the controller hasn't
			performed autosense for some reason.

			Change the default actions around a bit.

scsi_cd.c,
scsi_da.c,
scsi_pt.c,
scsi_ses.c:		SF_RETRY_SELTO -> CAM_RETRY_SELTO.  Selection
			timeouts shouldn't be covered by a sense flag.

scsi_pass.[ch]:		SF_RETRY_SELTO -> CAM_RETRY_SELTO.

			Get rid of the last vestiges of a read/write
			interface.

libkern/bsearch.c,
sys/libkern.h,
conf/files:		Add bsearch.c, which is needed for some of the
			new table lookup routines.

aic7xxx_freebsd.c:	Define AHC_NEW_TRAN_SETTINGS if
			CAM_NEW_TRAN_CODE is defined.

sbuf.h,
subr_sbuf.c:		Add the appropriate #ifdefs so sbufs can
			compile and run in userland.

			Change sbuf_printf() to use vsnprintf()
			instead of kvprintf(), which is only available
			in the kernel.

			Change the source string for sbuf_cpy() and
			sbuf_cat() to be a const char *.

			Add __BEGIN_DECLS and __END_DECLS around
			function prototypes since they're now exported
			to userland.

kdump/mkioctls:		Include stdio.h before cam.h since cam.h now
			includes a function with a FILE * argument.

Submitted by:	gibbs (mostly)
Reviewed by:	jdp, marcel (libsbuf makefile changes)
Reviewed by:	des (sbuf changes)
Reviewed by:	ken
2001-03-27 05:45:52 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Kenneth D. Merry
e35550e2bc Fix inquiry length detection for the ses(4) driver. It was using the
inq_len member of the ccb_getdev structure, but we've never filled that
value in..

So we now get the length from the inquiry data returned by the drive.
(Since we will fetch as much inquiry data as the drive claims to support.)

Reviewed by:	mjacob
Reported by:	Andrzej Tobola <san@iem.pw.edu.pl>
2001-03-16 22:16:54 +00:00
Kenneth D. Merry
f8d98b3493 In xpt_set_transfer_settings(), force async if either the period or the
offset is set to 0.

Re-arrange the DT limiting code so that we don't end up setting the period
to 0xa if the user really wants async.  The previous behavior seemed to
confuse the aic(4) driver.

PR:		kern/22733
Reviewed by:	gibbs
2001-03-13 22:35:28 +00:00
Noriaki Mitsunaga
a4539b3e56 o Support AUTO SENSE correctly.
o Offset and period in synch messages and width negotiation should be
  done for per target not per lun. Move these from *lun_info to
  *targ_info.
o Change in handling XPT_RESET_DEV and XPT_GET_TRAN_SETTINGS .
o Change CAM_* xpt_done return values.
o Busy loop did not timeout. Change this to timeout as original NetBSD/pc98.

Reviewed by:	bsd-nomads ML
2001-02-25 12:40:30 +00:00
Justin T. Gibbs
ce81b0893e In the SCSI_NO_SENSE_STRINGS case, properly fill the table with the
asc and ascq pair rather than asc, asc.

PR: 25291
Submitted by: Stephen Ferrari <sferrari@yahoo.com>
2001-02-24 19:24:36 +00:00
Matt Jacob
654bb95c76 Restore a print_sense=FALSE that got nuked by accident in last delta.
Noticed by:	Dan Nelson <dnelson@emsphone.com>
2001-02-22 06:43:42 +00:00
Matt Jacob
d5725e422d Use the correct device names (now that we have devfs to embarrass us).
PR:		25254
2001-02-21 17:29:01 +00:00
Matt Jacob
216a89d6a4 1. The key SSD_KEY_RECOVERED_ERROR is not an error at all and should
not be retried. It is an indication that there was an error that was
corrected during the execution of the command. This is per ANSI SCSI2
spec.

It's possible that these should also be noted to the console (as indicative,
perhaps, of growing media defect lists in drives), but the default of
printing errors out if bootverbose in this case is probably enough.

Also, there'd been a missing ERESTART for that clause anyway.

2. If you have an ABORTED COMMAND, it's almost invariably a SCSI parity
error. You should never be silent about these since users should do something
about this if it occurs (moving that power cord *away* from the SCSI cable is
always a good first start). This should print irrespective of bootverbose
because it's an actual real error even if we retry a transmission.

Reviewed by:	audit@freebsd.org, gibbs@freebsd.org
2001-02-11 23:46:54 +00:00
John Baldwin
062d8ff5a0 - Catch up to the new swi API changes:
- Use swi_* function names.
  - Use void * to hold cookies to handlers instead of struct intrhand *.
- In sio.c, use 'driver_name' instead of "sio" as the name of the driver
  lock to minimize diffs with cy(4).
2001-02-09 17:46:35 +00:00
Peter Wemm
0b7c27b904 Change the peripheral driver list from a linker set to module driven
driver registration.  This should allow things like da, sa, cd etc to be
in seperate KLD's to the cam core and make them preloadable.
2001-02-07 07:05:59 +00:00
Poul-Henning Kamp
37d4006626 Another round of the <sys/queue.h> FOREACH transmogriffer.
Created with:   sed(1)
Reviewed by:    md5(1)
2001-02-04 16:08:18 +00:00
Poul-Henning Kamp
fc2ffbe604 Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)
2001-02-04 13:13:25 +00:00
Kenneth D. Merry
75fab00593 Back out rev 1.102. The IBM DNES drives work fine for me, jedgar and other
folks.

My guess is that reducing the number of tags is just masking the real
problem for the PR submitter.  I'll re-open the PR and see if I can work
with the submitter to diagnose the problem.

PR:		21139
2001-01-29 05:33:14 +00:00
Kenneth D. Merry
0212e4b63b Fix region code reporting.
Reported by:	Andrew Gordon <arg@arg1.demon.co.uk>
2001-01-28 21:43:17 +00:00
John Baldwin
1e8b33eb23 #ifdef a local variable only used in debugging code.
Reviewed by:	-scsi
2001-01-24 01:46:57 +00:00
John Baldwin
e2138fee20 Const'ify cam_sim.sim_name to quiet warnings.
Reviewed by:	-scsi
2001-01-24 01:46:18 +00:00
Matt Jacob
df6c100d51 "Rejected with status" is better than "Rejected for status". 2001-01-24 00:14:37 +00:00
Joerg Wunsch
3b9d81dc1a Mark the (ancient) MaxOptix Tahiti 1 drive as a known rogue that would
respond to all LUNs.

Reviewed by:	ken
2001-01-23 10:49:30 +00:00
Matt Jacob
b94ec3184f Make some attempt to accomodate kern/24221- propate residual to mt_resid
even if it might overflow.

If we do a read or set of hardware or logical block position, we also
clear Tape Frozen status.
2001-01-19 21:08:15 +00:00
Matt Jacob
1b66199389 Add tags quirk for IBM DNES drives.
PR:		21139
Obtained from:	campt@miralink.com
2001-01-16 17:02:16 +00:00
Matt Jacob
e01862e9b0 Use the residual from a spacing operation to try and figure out where
we *really* are.

It should be noted that there is a degenerate case where soft tape
location will be lost (not causing a frozen state- but causing
the loss of reporting fileno/blockno)- that's where you backspace
over a filemark- you stop backspacing as soon as you cross the
filemark, but you have no idea what the record number now is because
you have no idea how many records you are into the file you just
backed into. Such is life.

While I'm at it, also pick up residuals from writing filemarks.

PR:		24222
2001-01-16 00:53:45 +00:00
Matt Jacob
64a471a304 Get rid of those pesky "driver mistake" messages... destroy the create_d dev_t
when you take down the device.

Reviewed by:	audit@freebsd.org (Warner, Justin)
2001-01-16 00:30:37 +00:00
Matt Jacob
86bff6836d Fix PR 24220 by using the periph private field0 for a CCB for not
only CCB type but also extra flags- one of which can be "position
updated".

In other changes: Add in a SA_QUIRK_NO_CPAGE quirk so that it's possible
to avoid using a (broken) device's implementation of he DEVICE COMPRESSION
page.

Also do a couple of printout cleanups.

As per some discussion on FreeBSD-scsi, skip doing tape flushing
if we're reading tape logical block location (MTIOCRDSPOS).
2001-01-15 22:28:11 +00:00
Yoshihiro Takahashi
628f1ab931 Check __i386__, not i386. 2001-01-13 13:21:43 +00:00
Steve Price
298157102f Spell declarations correctly. 2001-01-12 02:49:40 +00:00
Garrett Wollman
da0e7e4554 select() DKI is defined in <sys/selinfo.h> now. 2001-01-09 04:31:48 +00:00
Nick Hibma
de24b6fde3 Add the 'No 6 byte commands' quirk for the Yano ATAPI USB bridge.
Submitted by:	Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
2001-01-08 00:32:51 +00:00