Commit graph

571 commits

Author SHA1 Message Date
Seigo Tanimura 512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
Scott Long 68153f43b6 Sprinkle GIANT_REQUIRED asserts around the xpt layer to aid with locking the
SCSI drivers.
2003-11-09 02:22:33 +00:00
Scott Long 8226fdbdce Don't be so chatty when performing manual sense. This should make ATAPICAM
devices a lot more quiet.
2003-11-08 10:56:57 +00:00
Kenneth D. Merry 65afe1f454 In camperiphdone(), make sure we check for fatal errors and bail out
instead of retrying them blindly.

This should fix some of the problems people have been having with cdrom
drives taking a long time to probe.  This should also eliminate the need
for the initial TUR in cdsize().

cam_periph.c:	Don't keep retrying if the error we get back is a fatal
		error.  This should help us detect the transition from
		"Logical unit not ready, cause not reportable" to "Medium
		not present" in the "TUR many" handler.  (The TUR many
		handler gets triggered for Logical unit not ready, cause
		not reportable errors.)

scsi_cd.c:	Remove the initial test unit ready in cdsize().  Hopefully
		it isn't necessary after the above change.

Submitted by:	gibbs (mostly)
Tested by:	peter
MFC After:	2 weeks
2003-10-27 06:15:55 +00:00
Poul-Henning Kamp 24730dd78a Use bio_offset instead of bio_blkno 2003-10-18 17:26:13 +00:00
Poul-Henning Kamp f485bd3a10 There is no need to muck about with the B_PHYS flag here. We never even
get close to DEV_STRATEGY() which is the only place it is relevant.
2003-10-18 11:01:11 +00:00
Thomas Quinot 28cd624700 (dacleanup, dasysctlinit): Defend against calling sysctl_ctx_free on
an uninitialized sysctl_ctx, using flag DA_FLAG_SCTX_INIT. This
 prevents a panic encoutered with some umass units that probe correctly
 but fail to attach. Same problem, and same fix, as scsi_cd.c rev. 1.86.

Reviewed by:	njl, ken
2003-10-08 07:12:30 +00:00
Thomas Quinot 09ece45849 (cdcleanup): Defend against calling sysctl_ctx_free before the sysctl_ctx
has been initialized.
(cdsysctlinit): Set flag CD_FLAG_SCTX_INIT after sysctl_ctx has been
 initialized.

This resolves a panic encountered when a cd drive is sucessfully probed
but fails to attach.

Reviewed by:	ken
2003-10-07 14:46:59 +00:00
Poul-Henning Kamp ca803d52fd Add disk_destroy() call to detach processing.
Add short tempered TUR to cdsize() as a workaround.
2003-10-06 10:39:13 +00:00
Hidetoshi Shimokawa 9eb73373e7 Be kind to 64bit architectures. 2003-10-02 08:56:14 +00:00
Hidetoshi Shimokawa 60ddd2e45c - Pick up a correct path_id for the bus on AC_PATH_REGISTERED.
- Call cam_periph_invalidate() only if the periph is found.
2003-09-30 08:03:52 +00:00
Poul-Henning Kamp 2cac580671 GEOMify. 2003-09-30 07:52:15 +00:00
Hidetoshi Shimokawa 388f522d79 Detach black hole device on AC_PATH_DEREGISTERED. 2003-09-25 05:02:19 +00:00
Thomas Quinot a035059fc1 (scsi_request_sense): Set allocation length in REQUEST_SENSE CCB.
Reviewed by:	ken
2003-09-21 08:45:36 +00:00
Thomas Quinot 86addc5271 (camperiphdone): When the cam_periph layer performs sense recovery,
completion of recovery is indicated by positioning the CAM_AUTOSNS_VALID
 bit in the status field of the CCB, not in the flags field.
This fixes an endless loop of sense recovery actions.

Reviewed by:	ken
2003-09-21 08:42:32 +00:00
Matt Jacob 53d0345138 I forgot whom I got this from- only set single initiator buffered mode
if we've recorded in our softc that we should set it.
2003-09-13 02:01:56 +00:00
Poul-Henning Kamp 0c7721e8f9 Disable the use of cloning use in floppy and CD drivers.
This commit puts the relevant code snippets under #ifdef GONE_IN_5
(rather than #ifndef BURN_BRIDGES) thereby disabling the code now.

The code wil be entirely removed before 5.2 unless we find reasons
why this would be a bad idea.

Approach suggested by:	imp
2003-09-11 19:27:24 +00:00
Alan Cox 8373f36dbb In case vmapbuf() fails, release all of the held resources.
Submitted by:	tegge
2003-09-10 18:23:43 +00:00
Poul-Henning Kamp 7837155fa2 Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.
For the floppy driver, use fdcontrol to manipulate density selection.

For the CD drivers, the 'a' and 'c' suffix is without actual effect and
any applications insisting on it can be satisfied with a symlink:
	ln -s /dev/cd0 /dev/cd0a

Ongoing discussion may result in these pieces of code being removed before
the 5-stable branch as opposed to after.
2003-09-05 10:40:16 +00:00
Nate Lawson faf9513401 Calling KNOTE with locks held may result in recursion when it calls back
into targreadfilt().  Unlock around calls to notify_user().  If an application
is sending CCBs while the endpoint is shutting down, this may result in
incomplete disable.  A more complete solution will come with a "dying" flag.

Submitted by:	simokawa
2003-09-04 16:30:03 +00:00
Nate Lawson 5512662bdf Upon receiving a CCB for a LUN that is not enabled, be sure to unlock the
softc on exit.

Submitted by:	simokawa
2003-09-04 16:05:41 +00:00
Nate Lawson f3e99b763a Remove the quirk for the FujiFilm camera. Submitter indicates it is now
working without the quirk.

PR:
Submitted by:	guido
Reviewed by:
Approved by:
Obtained from:
MFC after:	30 days
2003-09-04 01:01:20 +00:00
Kenneth D. Merry 700a0cbaca Unbreak buildworld. sys/taskqueue.h is a kernel-only include.
Pointy Hat to:	ken
2003-09-03 12:31:03 +00:00
Kenneth D. Merry cb32189e23 Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers
out of cdregister() and daregister(), which are run from interrupt context.

The sysctl code does blocking mallocs (M_WAITOK), which causes problems
if malloc(9) actually needs to sleep.

The eventual fix for this issue will involve moving the CAM probe process
inside a kernel thread.  For now, though, I have fixed the issue by moving
dynamic sysctl variable creation for these two drivers to a task queue
running in a kernel thread.

The existing task queues (taskqueue_swi and taskqueue_swi_giant) run in
software interrupt handlers, which wouldn't fix the problem at hand.  So I
have created a new task queue, taskqueue_thread, that runs inside a kernel
thread.  (It also runs outside of Giant -- clients must explicitly acquire
and release Giant in their taskqueue functions.)

scsi_cd.c:	Remove sysctl variable creation code from cdregister(), and
		move it to a new function, cdsysctlinit().  Queue
		cdsysctlinit() to the taskqueue_thread taskqueue once we
		have fully registered the cd(4) driver instance.

scsi_da.c:	Remove sysctl variable creation code from daregister(), and
		move it to move it to a new function, dasysctlinit().
		Queue dasysctlinit() to the taskqueue_thread taskqueue once
		we have fully registered the da(4) instance.

taskqueue.h:	Declare the new taskqueue_thread taskqueue, update some
		comments.

subr_taskqueue.c:
		Create the new kernel thread taskqueue.  This taskqueue
		runs outside of Giant, so any functions queued to it would
		need to explicitly acquire/release Giant if they need it.

cd.4:		Update the cd(4) man page to talk about the minimum command
		size sysctl/loader tunable.  Also note that the changer
		variables are available as loader tunables as well.

da.4:		Update the da(4) man page to cover the retry_count,
		default_timeout and minimum_cmd_size sysctl variables/loader
		tunables.  Remove references to /dev/r???, they aren't used
		any longer.

cd.9:		Update the cd(9) man page to describe the CD_Q_10_BYTE_ONLY
		quirk.

taskqueue.9:	Update the taskqueue(9) man page to describe the new thread
		task queue, and the taskqueue_swi_giant queue.

MFC after:	3 days
2003-09-03 04:46:28 +00:00
Nate Lawson 486d7256a3 Remove quirk for Apacer Handydrive. Kevin Oberman <oberman@es.net> reports
that it works without the quirk.  This and any other quirk changes will be
MFCd after the release unless they fix a known problem.

MFC after:	1 month
2003-08-25 18:48:45 +00:00
Nate Lawson b4ea9fb547 Sort quirks into sections. 2003-08-25 18:14:43 +00:00
Nate Lawson 72c5c840ff Add the DA_Q_NO_PREVENT quirk which keeps da(4) from sending PREVENT/ALLOW
commands.  Add a quirk for the Creative Nomad MuVo USB device that uses
it as well as NO_SYNCHRONIZE_CACHE.

PR:		kern/53094
Submitted by:	Richard Nyberg <rnyberg@it.su.se>
MFC after:	3 days
2003-08-22 16:35:53 +00:00
Nate Lawson 6c3bdd6dee Quirk for Jungsoft NEXDISK USB flash key. Fails to mount without
NO_SYNCHRONIZE_CACHE.

PR:		kern/54737
Submitted by:	David Thiel <lx@redundancy.redundancy.org>
MFC after:	3 days
2003-08-22 05:58:23 +00:00
Nate Lawson e1dca0e939 Add quirks for the EXATELECOM i-Bead mp3 player.
PR:		kern/51675
Submitted by:	Nicolas Jombart <ecu@ipv42.net>
MFC after:	3 days
2003-08-22 05:43:30 +00:00
Nate Lawson 370f5d5b0f Remove all USB quirks that only specify DA_Q_NO_6_BYTE. They are no longer
needed.  Other USB quirks remain in hopes that user testing will reveal
which ones are also no longer needed.

Courtesy of:	USENIX lunch break
2003-08-06 17:30:03 +00:00
Nate Lawson a70515e217 Remove unused cmd6workaround() calls.
MFC after:	1 day
2003-08-06 14:24:16 +00:00
Nate Lawson dda5f182ae Fix the new DA_OLD_QUIRKS option for normal and module compiles.
Pointed out by: 	bde
2003-07-29 18:08:16 +00:00
Nate Lawson af991a6d16 Deprecate USB and Firewire quirks. We should now never send 6 byte commands
to such devices.  If a device fails due to this commit, add:
   options DA_OLD_QUIRKS
to the kernel config and recompile.  Then send the output of "camcontrol
inquiry da0" to scsi@freebsd.org so the quirk can be re-enabled.
2003-07-29 04:32:33 +00:00
Nate Lawson 1deac58179 Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands.  Add a check for this flag to da(4) and cd(4) so
that they honor it.  This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate.  The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.

MFC after:	1 day
2003-07-28 06:15:59 +00:00
Thomas Quinot 95f4c5d29d Reference PR for IntelligentStick quirk entry.
PR:		kern/53005
2003-07-18 16:26:36 +00:00
Thomas Quinot c679659e75 Add quirk entry for IntelligentStick disc-on-key USB devices.
Reported by Samuel Tardieu <sam@rfc1149.net>.

Reviewed by:	roberto
MFC after:	1 week
2003-07-17 15:33:08 +00:00
Nate Lawson 2813692cc2 Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry.  Changes all drives
  >1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

Looked over by:	scottl
2003-06-14 22:17:41 +00:00
Nate Lawson 141bdcc15a Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry.  Changes all drives
  >1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

PR:
Submitted by:
Looked over by:	scottl
Approved by:
Obtained from:
MFC after:
2003-06-14 22:17:38 +00:00
David E. O'Brien ee709e7024 Use __FBSDID(). 2003-06-10 18:14:05 +00:00
David E. O'Brien 9c963d873e Use __FBSDID(). 2003-06-10 17:50:20 +00:00
Matt Jacob e404e36b27 Check in some months long pending minor debug output changes.
Clarify that the implicit fallthrough was *not* intentional (thanks, Poul!)
and reorganize the code so a correct fallthrough (with /* FALLTHROUGH */)
occurs.
2003-06-02 00:37:42 +00:00
Poul-Henning Kamp 878d4f3dda Remove unused variables.
Remove break after return.
Add XXX comment where intent is unclear.

Found by:       FlexeLint
2003-06-01 09:12:24 +00:00
Poul-Henning Kamp 058675037b Add /* FALLTHROUGH */
Found by:	FlexeLint
2003-06-01 09:01:02 +00:00
Poul-Henning Kamp 07c6eac9d7 Add /* FALLTHROUGH */
Move /* FALLTHROUGH */ to correct location.
Remove unused variable(s).

Found by:       FlexeLint
2003-05-31 20:46:21 +00:00
Poul-Henning Kamp 82dcf708f8 Add /* FALLTHROUGH */
Remove unused variable(s).
Order switch in canonical order.

Found by:       FlexeLint
2003-05-31 20:44:32 +00:00
Poul-Henning Kamp 7379c88f4f Add /* FALLTHROUGH */
Found by:       FlexeLint
2003-05-31 18:20:26 +00:00
Poul-Henning Kamp 56824e138d Use symbolic constants instead of "4".
Use arrays instead of relying on struct packing.

Identical md5(scsi_ch.o).
2003-05-31 16:54:37 +00:00
Poul-Henning Kamp 7021f3f539 Don't use return(foo(...)); in a function returning void.
Found by:       FlexeLint
2003-05-31 16:36:42 +00:00
Nate Lawson f410510b09 Add a quirk for OTi USB flash key.
PR:		kern/51825
Approved by:	re (rwatson)
2003-05-15 17:35:35 +00:00
Kenneth D. Merry 3674802f42 Fix three problems in large (>2TB) device handling:
- Make sure we don't release the READ CAPACITY CCB twice
 - If we have a device that needs a 16 byte READ CAPACITY command, make
   sure we call xpt_schedule() so we can get a CCB.
 - Don't unlock the peripheral until we're fully probed.

Many thanks to Julian Elischer for providing hardware and testing this.

Tested by:	julian
2003-05-03 00:21:40 +00:00