Commit Graph

207 Commits

Author SHA1 Message Date
Poul-Henning Kamp
ce9edcf5b5 Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.
1999-08-09 10:35:05 +00:00
John-Mark Gurney
5acba6ec2a disable tag queing for the MICROP 4421-07 drive. It's an old 2gig drive.
convert MICROP to a static string
1999-07-11 06:10:47 +00:00
Matt Jacob
be74589b43 Fix my complete botch. I hope. Tested this time 1999-07-07 18:14:01 +00:00
Matt Jacob
473ac4479f suggestions from bde to clean up last checkin slighty 1999-07-06 01:40:03 +00:00
Matt Jacob
a7454a8878 Make the change similar to that suggested by Nick Hibma to avoid divide by
zero traps. I actually can't believe that this compiler is *sooooo* stupid
that it did a divide when there was 1024L*1024L instead of a right shift by
20. When we get quad type modifiers in kernel printf we can change to this
too (to avoid overflow on > terabyte disk sizes).
1999-07-03 21:14:45 +00:00
Peter Wemm
c9e7f49d11 A minor tweak to shut up gcc (on the Alpha) for two (false) warnings.
How it can think that something that is initialized at declaration can
be used while uninitialized is beyond me.
1999-07-03 16:29:32 +00:00
Peter Wemm
6d7b539a6e int/long printf format problems on the Alpha. 1999-07-01 19:56:50 +00:00
Kirk McKusick
67812eacd7 Convert buffer locking from using the B_BUSY and B_WANTED flags to using
lockmgr locks. This commit should be functionally equivalent to the old
semantics. That is, all buffer locking is done with LK_EXCLUSIVE
requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will
be done in future commits.
1999-06-26 02:47:16 +00:00
Matt Jacob
f0bbbb88da Quirk Tandberg 4100 like Tandberg 4200.
PR:		11675
Reviewed by:	msmith@FreeBSD.ORG
Submitted by:	blank@uni-trier.de
1999-06-24 15:21:10 +00:00
Matt Jacob
4b4c702b0b Quirk NOLUNS cabletron device.
PR:		11677
Submitted by:	"Matthew N. Dodd" <winter@jurai.net>
1999-06-20 18:19:44 +00:00
Poul-Henning Kamp
2447bec829 Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it.  cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables.  Most places they were used
bogusly.  Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
        72 bogus makedev() calls
        26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed.  Patches emailed to authors.  LINT
probably broken until they catch up.
1999-05-31 11:29:30 +00:00
Poul-Henning Kamp
4e2f199e0c This commit should be a extensive NO-OP:
Reformat and initialize correctly all "struct cdevsw".

        Initialize the d_maj and d_bmaj fields.

        The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format.  Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.
1999-05-30 16:53:49 +00:00
Matt Jacob
b9c8458b9d Add TDC 3800 to quirk list for fixed mode device.
PR:11866
Submitted by:	Helge Oldach hmo@sep.hamburg.com
1999-05-25 23:10:54 +00:00
Justin T. Gibbs
9911ecf957 Run xpt_action at splsoftcam() so that it cannot be re-entered by our SWI.
The XPT doesn't have a problem with this itself, but some controllers
drivers may have been caught off guard by the old behavior.

XPT_CONT_TARGET_IO is also a valid ccb type for cam_periph_unmapmem.
1999-05-25 20:17:29 +00:00
Kenneth D. Merry
edd24ab742 Fix the read/write permission checks in cam_periph_mapmem(). If we're
writing, we want to be able to read the buffer.  If we're reading, we want
to be able to write to the buffer.

PR:		kern/11870
Submitted by:	Andrew Mobbs <amobbs@allstor-sw.co.uk>
1999-05-25 17:10:04 +00:00
Justin T. Gibbs
8281556234 Rely on the statistics in XPT_GDEV_STATS instead of the versions still
retained in XPT_GDEV_TYPE for binary compatibility.  Mark the legacy
structure values for removal when we bump the major CAM revision.
1999-05-23 18:57:29 +00:00
Justin T. Gibbs
516871c613 Add a default async handler funstion to cam_periph.c to remove duplicated
code in all initiator type peripheral drivers.

scsi_target.c:
	Release ATIO structures that wind up in the 'unkown command queue'
	for consumption by our userland counterpart, back to the controller
	when the exception for that command is cleared.
1999-05-22 22:00:24 +00:00
Justin T. Gibbs
87cfaf0e1f Add the XPT_PATH_STATS and XPT_GDEV_STATS function codes. These ccb
types allow the reporting of error counts and other statistics.  Currently
we provide information on the last BDR or bus reset as well as active
transaction inforamtion, but this will be expanded as more information is
added to aid in error recovery.

Use the 'last reset' information to better handle bus settle delays.
Peripheral drivers now control whether a bus settle delay occurs and
for how long.  This allows target mode peripheral drivers to avoid
having their device queue frozen by the XPT for what shoudl only be
initiator type behavior.

Don't perform a bus reset if the target device is incapable of performing
transfer negotiation (e.g. Fiber Channel).

If we don't perform a bus reset but the controller is capable of transfer
negotiations, force negotiations on the first transaction to go to the
device.  This ensures that we aren't tripped up by a left over negotiation
from the prom, BIOS, loader, etc.

Add a default async handler funstion to cam_periph.c to remove duplicated
code in all initiator type peripheral drivers.

Allow mapping of XPT_CONT_TARGET_IO ccbs from userland.  They are
itentical to XPT_SCSI_IO ccbs as far as data mapping is concerned.
1999-05-22 21:58:47 +00:00
Justin T. Gibbs
804540113f Make xpt_path_comp work on wildcarded paths again. 1999-05-18 00:41:05 +00:00
Matt Jacob
040816ec58 Quirk this drive- all luns show up the same.
Submitted by:	Stephen McKay <syssgm@detir.qld.gov.au>
1999-05-11 15:44:39 +00:00
Matt Jacob
bd1b9cb70f Add a SA_FLAG_COMP_SUPP flag (to quirk compression as
SUPPORTED). Add a SA_FLAG_TAPE_FROZEN for (see below).
Add a queue_count field to softc.

Add HP T20* Travan-5 like tape device as a FIXED/512 type device.
Works for me. Add TANDBERG SLR5 as a variable SA_QUIRK_1FM device.
Change VIPER 2525 to 1024 byte blocksize. It's possible other
drives should change too, but see below..

Change argument to sagetparams to be pointer to a sa_comp_t union-
this can be either a DATA COMPRESSION or a DEVICE CONFIGURATION
page. In general compression now tries to use the DATA COMPRESSION
page and if that fails tries the DEVICE CONFIGURATION page.

Change close routine to not rewind tape if there's a failure in either
writing filemarks or in backing over one of two filemarks for a 2FM
at EOT tape- instead mark the tape as 'frozen' and print a message
saying that either an OFFLINE or REWIND or an MTEOM command is needed
to clear this state (all bring certainty back to tape position). Fix
sastrategy to not allow I/O to a frozen tape.

Add MTIOCGETEOTMODEL/MTIOCSETEOTMODEL ioctls that get and set the EOT
model for a tape drive (you can now dynamically change whether it's
a 2 FM @ EOT or 1FM at EOT tape device). This ought to give folks
something to handle the QIC drives we don't know about. Correctly propagate
record of compression algorithm back. Clear FROZEN flag for EOM, REWIND
and OFFLINE (and RETENSION and ERASE) cases.

Fix an egregious bug in sadone that had left the device queue frozen
for deferred (for fixed mode case) errors.

Add comment in samount about how useless the test unit ready is for
invalidating a mount (this has to be fixed later).

Fix residual calculation (per Eivind) in saerror so that negative values
for tape records being too large for the supplied buffer get caught. Do
some other saerrro cleanup.

Per Ken && Justin, add my name to copyright comment.
1999-05-11 04:01:35 +00:00
Matt Jacob
2c3cca96df Quirk NOLUNS CALIPER CP150. 1999-05-11 02:41:00 +00:00
Matt Jacob
00bb66d73c Make clear that the DATA COMPRESSION page is a SCSI-3 entity- not a SCSI-2
entity. Add the Device Configuration page data structure- this structure
should be used if you fail to fetch the DATA COMPRESSION page. Make a union
type of a mode header, a device configuration page and the data compression
page.

Add a couple of QIC density defines (QIC 2G/QIC 4GB).
1999-05-11 02:23:37 +00:00
Kenneth D. Merry
50711c71c9 Add a facility in the CAM error handling code to retry selection timeouts.
If the client requests that the error recovery code retry a selection
timeout, it will be retried after half a second.  The delay is to give the
device time to recover.

For most of these drivers, I only added selection timeout retries where
they were also retrying unit attention type errors.  The sa(4) driver calls
saerror() in a number of places, but most of them don't request retrying
unit attentions.

Also, bump the default minimum CD changer timeout from 2 to 5 seconds and
the maximum timeout from 10 to 15 seconds.  Some Pioneer changers seem to
have trouble with the shorter timeout.

Reviewed by:	gibbs
1999-05-09 01:25:34 +00:00
Poul-Henning Kamp
c48d17750f Introduce two functions: physread() and physwrite() and use these directly
in *devsw[] rather than the 46 local copies of the same functions.

(grog will do the same for vinum when he has time)
1999-05-07 07:03:47 +00:00
Kenneth D. Merry
9deea8574e Add a number of interrelated CAM feature enhancements and bug fixes.
NOTE:  These changes will require recompilation of any userland
applications, like cdrecord, xmcd, etc., that use the CAM passthrough
interface.  A make world is recommended.

camcontrol.[c8]:
 - We now support two new commands, "tags" and "negotiate".

	- The tags commands allows users to view the number of tagged
	  openings for a device as well as a number of other related
	  parameters, and it allows users to set tagged openings for
	  a device.

	- The negotiate command allows users to enable and disable
	  disconnection and tagged queueing, set sync rates, offsets
	  and bus width.  Note that not all of those features are
	  available for all controllers.  Only the adv, ahc, and ncr
	  drivers fully support all of the features at this point.
	  Some cards do not allow the setting of sync rates, offsets and
	  the like, and some of the drivers don't have any facilities to
	  do so.  Some drivers, like the adw driver, only support enabling
	  or disabling sync negotiation, but do not support setting sync
	  rates.

 - new description in the camcontrol man page of how to format a disk
 - cleanup of the camcontrol inquiry command
 - add support in the 'devlist' command for skipping unconfigured devices if
   -v was not specified on the command line.
 - make use of the new base_transfer_speed in the path inquiry CCB.
 - fix CCB bzero cases

cam_xpt.c, cam_sim.[ch], cam_ccb.h:

 - new flags on many CCB function codes to designate whether they're
   non-immediate, use a user-supplied CCB, and can only be passed from
   userland programs via the xpt device.  Use these flags in the transport
   layer and pass driver to categorize CCBs.

 - new flag in the transport layer device matching code for device nodes
   that indicates whether a device is unconfigured

 - bump the CAM version from 0x10 to 0x11

 - Change the CAM ioctls to use the version as their group code, so we can
   force users to recompile code even when the CCB size doesn't change.

 - add + fill in a new value in the path inquiry CCB, base_transfer_speed.
   Remove a corresponding field from the cam_sim structure, and add code to
   every SIM to set this field to the proper value.

 - Fix the set transfer settings code in the transport layer.

scsi_cd.c:

 - make some variables volatile instead of just casting them in various
   places
 - fix a race condition in the changer code
 - attach unless we get a "logical unit not supported" error.  This should
   fix all of the cases where people have devices that return weird errors
   when they don't have media in the drive.

scsi_da.c:

 - attach unless we get a "logical unit not supported" error

scsi_pass.c:

 - for immediate CCBs, just malloc a CCB to send the user request in.  This
   gets rid of the 'held' count problem in camcontrol tags.

scsi_pass.h:

 - change the CAM ioctls to use the CAM version as their group code.

adv driver:

 - Allow changing the sync rate and offset separately.

adw driver

 - Allow changing the sync rate and offset separately.

aha driver:

 - Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.

ahc driver:

 - Allow setting offset and sync rate separately

bt driver:

 - Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.

NCR driver:

 - Fix the ultra/ultra 2 negotiation bug
 - allow setting both the sync rate and offset separately

Other HBA drivers:
 - Put code in to set the base_transfer_speed field for
   XPT_GET_TRAN_SETTINGS CCBs.

Reviewed by:	gibbs, mjacob (isp), imp (aha)
1999-05-06 20:16:39 +00:00
Justin T. Gibbs
5f14bb14e3 Don't touch a path after we've free'd it. 1999-05-04 19:24:21 +00:00
Justin T. Gibbs
9dd03ecf30 Release bus entries in the EDT when a path is released.
Null out path entries when the path is released to catch bugs.
Free our configuration hook when we're done with it.
1999-04-23 23:25:48 +00:00
Peter Wemm
54a8c69347 Stage 1 of a cleanup of the i386 interrupt registration mechanism.
Interrupts under the new scheme are managed by the i386 nexus with the
awareness of the resource manager.  There is further room for optimizing
the interfaces still.  All the users of register_intr()/intr_create()
should be gone, with the exception of pcic and i386/isa/clock.c.
1999-04-21 07:26:30 +00:00
Justin T. Gibbs
d3a5df64ab Use macros for accessing the head of the heap so that code
is isolated from implementation details of the heap.
1999-04-19 21:26:17 +00:00
Justin T. Gibbs
5a526431f8 cam_periph.c:
Move handling of CAM_AUTOSENSE_FAIL into block dealing with
	all other scsi status errors.

cam_queue.c:
cam_queue.h:
	Fix 'off by one' heap bug in a more efficient manner.  Since
	heap algorithms like to deal with indexes started from 1,
	offset our heap array pointer at allocation time to make this
	so for a C environment.  This makes the implementation of the
	algorithm a bit more efficient.

cam_xpt.c:
	Use macros for accessing the head of the heap so that code
	is isolated from implementation details of the heap.
1999-04-19 21:26:08 +00:00
Matt Jacob
0366f90aa6 Make WangTek 51000 a fixed block device.
PR:		kern/11194
Obtained from:naddy@mips.rhein-neckar.de
1999-04-18 01:05:03 +00:00
Peter Wemm
e91896117b Well folks, this is it - The second stage of the removal for build support
for LKM's..
1999-04-17 08:36:07 +00:00
Justin T. Gibbs
cbcf29f8ea Remove camq_regen(). We already perform modular comparisons
for generation counts, so no further steps to deal with generation
count wrap are required.
1999-04-07 22:57:54 +00:00
Justin T. Gibbs
8bad620d54 Remove camq_regen(). We already perform modular comparisons
for generation counts, so no further steps to deal with generation
count wrap are required.

Fix an off by one problem in the camq heap code.
1999-04-07 22:57:48 +00:00
Peter Wemm
0cbbb7bffd Use PHOLD/PRELE rather than P_PHYSIO. 1999-04-06 03:05:36 +00:00
Kenneth D. Merry
ca3b51e9ed Disable tagged queueing for the IBM DCAS drives. These drives have poor
write performance when tagged queueing is enabled.

Although the PR was submitted for the 4 gig version of this drive, the
assumption is that the 2 gig version has the same problem.  Therefore
tagged queueing is disabled for both.

Also, update the comment for the Western Digital Enterprise drives to note
that the best performance for those drives is achieved when tagged queueing
is disabled and write caching is enabled.

PR:		kern/10398
Submitted by:	Hideaki Okada <hokada@isl.melco.co.jp>
1999-03-14 05:15:38 +00:00
Jordan K. Hubbard
79ccc19983 People who wanted the "tagged opening" message can boot -v. The rest
of us, who appear to have complained incessantly about this message since
it appeared, can now stop.
1999-03-11 10:48:02 +00:00
Kenneth D. Merry
c816e0254c The 4 gig version of the Seagate Medalist Pro seems to have the same
trouble with tagged queueing as the 6.5 gig version.

So, I've added a quirk entry for it to limit it to two outstanding
transactions at a time, just like the 6.5G version.  While I'm at it, add a
quirk for the 9G version of the drive, since it most likely has the same
problem.

Submitted by:	Jeremy Lea <reg@shale.csir.co.za>
1999-03-07 22:48:50 +00:00
Justin T. Gibbs
3a59d8c190 Implement the control device for the "targ" target mode processor target
emulator so that instances can be dynamically added and removed from the
system.

Properly reference count peripheral instances so they are cleaned up when
destroyed by the control device.

Set a timeout for test unit ready commands.  Before it was uninitialized
and could cause us to drop off the bus when no real timeout had occurred.
1999-03-05 23:25:11 +00:00
Justin T. Gibbs
e7783a9f45 Silence errors.
Reduce the number of accept target I/O entries we allow to better
exercise the resource shortage handling code in controller drivers.
1999-03-05 23:21:28 +00:00
Justin T. Gibbs
6f79c2d329 Silence complaints about synchronize cache requests that fail with illegal
request.
1999-03-05 23:20:20 +00:00
Justin T. Gibbs
d1dc9ab13a xpt_done has no reason to take a volatile ccb *. 1999-03-05 23:18:56 +00:00
Justin T. Gibbs
a5479bc57a Protect access to the EDT with splcam() to protect against corruption
caused by temporary EDT allocations performed by controller drivers in
their interrupt routiens.

Reference count bus entries in the EDT in preparation for support for
dynamic controller arrival and departure.

Have children of the EDT hold references to their parents.

Correct routing of the XPT_IMMED_NOTIFY ccb type for use in
target mode applications.

Fix a few cases where the generation count for EDT data members was
not being updated when a modification occurred.

splcam() problem Noticed by: Tor Egge <tegge@FreeBSD.org>
1999-03-05 23:18:16 +00:00
Justin T. Gibbs
a89bb8b406 Add constants and macros for dealing with XPT opcode group types. 1999-03-05 23:13:20 +00:00
Matt Jacob
b9a3993d60 +Match against T4000* for HP QIC quirks (not T4000S* where it doesn't then
catch a T4000s)
+ Set *some* kind of error at EOM if we're in fixed mode and have pending errs.
  Do not clear the ERR_PENDING bit if more buffers are queued.
+ Release the start_ccb in this case also, else we hang forever on rewinding.
+ Any kind of error for load to BOT in samount should then cause an attempt
  to use REWIND to come back to BOT. Do the initial load command quietly.
+ In samount, if we succeed, set the relative position markers.
1999-03-01 01:07:47 +00:00
Kenneth D. Merry
560d629f72 Add a quirk entry for the Seagate Medalist Pro 6 gig drive. It seems this
drive has very poor write performance (1.4MB/sec vs. 12MB/sec) with anything
more than two oustanding transactions.

So, this limits the number of tagged commands to two for that drive.
Thanks to Paul van der Zwan for doing a whole lot of testing to confirm
this.

Reported by:	Paul van der Zwan <paulz@trantor.xs4all.nl>
1999-02-26 18:38:06 +00:00
Kenneth D. Merry
588b47e5d2 Fix sync rate and transfer rate printouts in xpt_announce_periph().
Sync rates like 4.032MHz were getting printed as 4.32MHz.

Also, add a quirk entry for the 18G Quantum Atlas III.  Like most other
recent Quantum drives, it bogusly reports queue full.  Thanks to Andre
Albsmeier <andre.albsmeier@mchp.siemens.de> for the Atlas III inquiry
information.

Reviewed by:	gibbs
1999-02-18 18:08:39 +00:00
Justin T. Gibbs
11eaafb1f1 Completely set information in the transaction description before performing
a selwakeup for it.  Cosmetic.
1999-02-11 07:08:58 +00:00
Kenneth D. Merry
2a888f938e Add a prioritization field to the devstat_add_entry() call so that
peripheral drivers can determine where in the devstat(9) list they are
inserted.

This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed.  The devstat version number has been incremented as
well to reflect the change.

This sorts devices in the devstat list in "more interesting" to "less
interesting" order.  So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.

The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers.  For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.

Also, move the checkversion() call in vmstat(8) to a more logical place.

Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it.  Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.

Reviewed by:	bde, obrien
1999-02-10 00:04:13 +00:00
Matt Jacob
8410876eb9 quiet the alpha compiler 1999-02-05 08:49:34 +00:00
Matt Jacob
499d2a2a5c Extend unit numbers to a full 10 bits (split into sections
of the minor). Establish and use a control mode open. Control
mode opens may open the device without locking, but are prohibited
from all but some ioctls. MTIOCGET always works. MTIOCERRSTAT
works, but the clearing of latched error status is contingent
upon whether another application has the device open, in which
case an interruptible perip acquire is done. MTSETBSIZ, MTSETDNSTY
and MTCOMP also require a periph aquire.

Relative fileno and blkno are tracked. Note that just about any
error will make these undefined, and if you space to EOD or use
hardware block positioning, these are also lost until the next
UNLOAD or REWIND.

Driver state is also tracked and recorded in the unit softc
to be passed back in mt_dsreg for a MTIOCGET call.
Thanks to Dan Strick for suggesting this.

Reintroduce 2 filemarks at EOD for all but QIC devices. I
really think it's wrong, but there is a lot of 3rd party
software that depends upon this (not the least of which is
tcopy). Introduce a SA_QUIRK_1FM to ensure that some devices
can be marked as only being able to do 1 FM at EOD.

At samount time force a load to BOT if we aren't mounted. If the
LOAD command fails, use the REWIND command (e.g., for the IBM 3590
which for some gawdawful reason doesn't support the LOAD (to BOT)
command).

Also at samount time, if you don't know fixed or variable, try to
*set* to one of the known fixed (or variable, for special case)
density codes. We only have to do this once per boot, so it's not
that painful. This is another way to try and figure out the wierd
QIC devices without having to quirk everything in the universe.

A substantial amount of cleanup as to what operations can and what
operations cannot be retried. Don't retry space operations if they
fail- it'll just lead to lossage.

Not yet done is invalidating mounts correctly after errors. ENOTIME.
1999-02-05 07:32:52 +00:00
Matt Jacob
d032c79f31 add QIC 525,320,1320,3080 codes 1999-02-05 07:19:23 +00:00
Matthew Dillon
b4e36adf1c Fix warnings preparing for -Wall -Wcast-qual
Also disable one usb module in LINT due to fatal compilation errors,
    temporary.
1999-01-27 20:09:21 +00:00
Matthew Dillon
1c7c3c6a86 This is a rather large commit that encompasses the new swapper,
changes to the VM system to support the new swapper, VM bug
    fixes, several VM optimizations, and some additional revamping of the
    VM code.  The specific bug fixes will be documented with additional
    forced commits.  This commit is somewhat rough in regards to code
    cleanup issues.

Reviewed by:	"John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>
1999-01-21 08:29:12 +00:00
Matt Jacob
667d00a796 put it back the way it was 1999-01-20 23:00:31 +00:00
Matt Jacob
7781f5a621 temporary fix so alpha stays working while configure code is fixed 1999-01-20 19:08:45 +00:00
Kenneth D. Merry
6dd76100e4 By popular demand, back out the CONNER CFP* quirk entry, and return it to
its original form.  (Originally, it only applied to the CFP 2107.)

Hopefully we can come to some conclusion about which Conner drives are
broken for tagged queueing.
1999-01-20 01:13:20 +00:00
Kenneth D. Merry
1f04f5abd7 The Samsung WN34324U is broken for tagged queueing.
PR:		kern/9535
Submitted by:	NAKAJI Hiroyuki <nakaji@zeisei.dpri.kyoto-u.ac.jp>
1999-01-19 16:59:36 +00:00
Kenneth D. Merry
59190eaa10 Generalize the quirk entry for the Conner CFP* drives. It did just cover
the CFP2107, but it appears (not surprisingly) that the 1 gig and 4 gig
versions of that drive have the same problem with tagged queueing.

Also, fix the problem reported in PR kern/9482.  The XPT_DEV_MATCH case in
xptioctl() wasn't putting a proper path in the CCB before it called
xpt_action().  When CAMDEBUG is defined, and CAM_DEBUG_TRACE debugging is
turned on, the CAM_DEBUG statement at the beginning of xpt_action would end
up deferencing a NULL path pointer.  That of course caused a panic.

My solution is to just stick the xpt peripheral's path in the CCB.

PR:		kern/9482
Reviewed by:	gibbs
1999-01-19 01:02:47 +00:00
Peter Wemm
6d2a8f1ca0 Call the xpt_init() hook during at the start of the configure() process
via SYSINIT().  This gets a little closer to making cam useable as a
module.
1999-01-19 00:13:05 +00:00
Matt Jacob
15da947cba Sascha Blank <blank@uni-trier.de> convinced me I was an
idiot about testing SA_QUIRK_2FM in samount. Fixed.

Removed the NORRLS quirk (to save quirk space) and left
the behaviour of being quiet about failed reserve/release
(failed due Illegal Request) the same.

Added a SF_QUIET_IR for prevent/allow for the same purposes.
1999-01-16 19:20:30 +00:00
Matt Jacob
54e609ba5c More bandaids. One important one from Sascha Blank
(<blank@fox.uni-trier.de>) about quirks being set as
arithmetic values, not as bitfields. Add HP, Kennedy
and M4 1/2" reel quirk entries.

Do a lot of gratuitous source changing.

Audit all functions that build ccbs for the tape driver
and decide whether each one can be retried or not.

Still to do is some more state management post errors.
1999-01-16 04:02:31 +00:00
John Polstra
0ec81012da Replace includes of <sys/kernel.h> with includes of
<sys/linker_set.h> in those files that use only the linker set
definitions.
1999-01-14 06:22:10 +00:00
Justin T. Gibbs
c8bead2a12 Add support for wildcard device entries in the EDT. The target mode
'Black Hole' device uses this feature to schedule itself against any
target or lun attached to a controller that receives an unwanted request
from an initiator instead of having an instance per potential target/lun
request.

Use the wildcard entries to simplify wildcard async callback storage.

Don't announce devices twice to peripheral drivers.  The devices will
be announced as soon as the AC_PATH_REGISTERED event is registered by
the peripheral driver, so no manaul push of this event is required.

Reviewed by: Kenneth Merry <ken@FreeBSD.org>
1999-01-14 06:03:59 +00:00
Justin T. Gibbs
6fda903f5b The target mode 'Black Hole' device. This peripheral driver provides inquiry
data and sense information for target mode devices for which no other
peripheral driver is attached.  This simplifies the task of dealing with
luns that are not otherwise enabled for target mode if the controller
does not have firmware that automatically deals with this case (e.g.
the aic7xxx driver).
1999-01-14 06:00:29 +00:00
Justin T. Gibbs
443af83864 Properly handle transfers that only consume partial buffers. 1999-01-14 05:57:32 +00:00
Eivind Eklund
fcfc314003 Make dsopen() and dsioctl() use cdstrategy1 instead of cdstrategy.
This silence the warnings and makes it more obvious where the bugs
have to be fixed.
1999-01-12 16:26:19 +00:00
Matt Jacob
26fd36dffa Clean up and fix quirk table (was missing necessary wildcards) and add a couple
from the old driver. Change format of quirk table to have a preferred block
size for devices that need to be QUIRK_FIXED- this is loaded into the
last_media_blocksize tag at saregister time and will be used in the first
samount case.

Change sasetparams to take a sense_flags argument so that probe time testing
can be quieter (e.g. with SF_NO_PRINT).

Fix a couple of silly bugs in the fixed/variable determination in samount- one
was where there was a check against 'guessing' AND the density code being
default density- *SMACK* - you're only guessing if you find the media code
to be *other* than default density. Second bug was a test against current
blocksize being zero- should be a test against whether current blocksize
is not equal to the last blocksize if you had wanted to be fixed (suppose
you came up in fixed, but not the preferred size?). And if you don't
know what the fixed size should be, select 512 as the starting point,
not BLKDEV_IOSIZE (reality wins). Finally, in doing the test set to variable
mode, make sasetparams non-chatty.
1999-01-12 08:15:47 +00:00
Matt Jacob
7439f1066e Make HP T4000S quirk to FIXED mode 1999-01-11 18:26:25 +00:00
Eivind Eklund
cd651e8119 Add 'static' to the declaration, too. 1999-01-11 17:45:22 +00:00
Matt Jacob
f55ca80bcf Like the problems just fixed in scsi_da.c, make sure
to release the probe ccb before taking down the periph.
Also, don't do cdscheduling if you're not going to
attach the device after all.
Reviewed by:	ken@freebsd.org
1999-01-07 20:20:57 +00:00
Matt Jacob
f403e6edea A better fix to avoid race conditions between failed probes
and peripheral removal.
Obtained from:gibbs@freebsd.org
1999-01-07 20:19:09 +00:00
Kenneth D. Merry
4cdd022168 The Quantum Atlas III evidently has an identical problem to the Atlas II.
It keeps returning queue full until we have reduced the number of tagged
openings to the minimum.

So, put in a quirk entry with the same work-around.  This quirk entry is
only for the 9G Atlas III, once someone comes up with inquiry information
for the 18G version of that drive, we can quirk it as well.

Submitted by:	"Johan Granlund" <johan@granlund.nu>
1999-01-07 01:11:24 +00:00
Kenneth D. Merry
bfc0eb0f5a The Conner CFP2107 is a fixed-media drive, not removable media. This fixes
the quirk that disables tagged queueing for those drives.

Also, silence a warning by disabling xpt_for_all_targets() and
xpt_for_all_periphs().  These two functions are not currently used, but
they should not be removed.  They're part of a set of functions that
provide a way to execute a function for every {bus,target,device,periph} in
the system.

If anyone needs to use either function in the future, they can be
un-#ifdefed.
1999-01-05 21:37:07 +00:00
Matt Jacob
2e56e285fd Add a quirk that disables SYNCHRONIZE CACHE
PR:		8882
Obtained from:	Hellmuth Michaelis hm@kts.org
1999-01-05 20:43:41 +00:00
Matt Jacob
918d0cf6b7 Temporary workaround (bandaid) for case where you have READ
CAPACITY fail for a non-removable media device. There's a race
condition where the device entry is removed and then
xpt_release_ccb is called which attempts to give back the ccb
to a device that's now gone. In this bandaid release the ccb
early and then remember to not call xpt_release_ccb later.
1999-01-03 22:57:54 +00:00
Matt Jacob
656d1af535 Force ARCHIVE Vipers to be FIXED 1998-12-28 19:21:12 +00:00
Matt Jacob
5d754af79f a more correct change that should meet the sniff test 1998-12-24 06:01:15 +00:00
Matt Jacob
93f8eaab7d Unstaticize swi_camnet && swi_cambio so Alpha kernels can build again. 1998-12-24 02:43:41 +00:00
Matt Jacob
a1d461b7dd you can retry SYNC CACHE on UA errors 1998-12-23 16:48:17 +00:00
Eivind Eklund
3c68dd1aec Staticize.
Reviewed by:	gibbs
1998-12-22 20:05:23 +00:00
Matt Jacob
5a4f8fa5a4 Add a quirk NORRLS (no reserve/release) which can (and
will) get set for the devices that don't actually support
reserve/release (so we don't keep trying it).

Add softc storage and manage storing last I/O and CTL
commands that had errors (for correlative purposes).

In saclose clear the 'MOUNTED' bit if we either rewind or
unload (yes, this shouldn't be necessary since the next open
should catch whether a tape change occurred, but I'm having
some questions about that actually working so this is
safer for the moment). Oh, forgot to mention in previous
commit messages that some of the failures particularly at
close time cause the tape to be ejected (for the sake
of safety)- all this prior to redoing the state machine
(which is in progress) which will try and handle this better.

Complete the addition of the setmark support
(from Martin.Birgmeier@aon.at).
1998-12-22 17:26:13 +00:00
Matt Jacob
990635d6e8 1) Fix some serious bugs (1 botch on my part which caused a filemark to be
written even it the tape was opened readonly- 2 botches in deferred error
handling for FIXED LENGTH mode which caused panic && hand resp.). Fixed
a memory leak in sa_mount.
2) Fixed an annoying bug when turning of compression to actually reflect
this for future status calls.
3) Implement the MTIOCERRSTAT call where latched control and I/O residuals
and sense data are returned to the application asking for them.
1998-12-19 23:33:21 +00:00
Matt Jacob
b5c6d4c555 Add in block position/block locate functions. 1998-12-18 04:31:43 +00:00
Matt Jacob
d902101e8e Add structures and function definitions pertinent for hardware locate support. 1998-12-18 04:29:16 +00:00
Justin T. Gibbs
2e66665367 Correct the definition of the changer device capabilities page. The
previous definition confused some reserved bytes for exchange capabilities.
1998-12-17 22:26:39 +00:00
Matt Jacob
303826838c Add some tape specific density codes- only enough of them here to recognize
some specific older units so we can choose 2FM@EOD or FIXED blocksize
quirks.
1998-12-17 19:04:18 +00:00
Matt Jacob
888bec0f0c Several changes having to do blocksize- mostly to force variable as the default.
Attempt to determine (at mount time if not done so already) via density code
whether a device should default to fixed mode or not. Attempts to set to
variable that fail will cause fixed to be selected.

Similarly, the '2 filemarks at EOM' quirk is now determined (or attempted to
be determined) via density code. Some as yet not entirely tested code for
coping with 2FM@EOD position is now also in place.
1998-12-17 18:56:23 +00:00
Justin T. Gibbs
e500cd9896 Correctly track allocated accept target I/O ccbs so that they can be
aborted prior to disabling our lun.  This requires a second set of
links since we use the ones in the ccb_hdr during normal operations.

Nuke some unused variables.
1998-12-17 00:03:14 +00:00
Kenneth D. Merry
ff1fe75fab At Justin's request, limit the size of buffers that can be mapped into
and out of kernel address space (via the pass(4) and xpt(4) peripheral
drivers) to 64K (DFLTPHYS).  Some controllers, like the Adaptec 1542,
don't support more than 64K transactions.

We plan on eventually having the capability of limiting this size based
on min(MAXPHYS, controller max), but since that capability isn't here yet,
limit things to the lowest common denominator.
1998-12-16 21:00:06 +00:00
Kenneth D. Merry
79d49a061b Probable fix for the "cdda2wav" panics that various people have been
reporting since this past summer.  (I think Daniel O'Conner was the first.)

The problem appears to have been something like this:

 - cdda2wav by default passes in a buffer that is close to the 128K MAXPHYS
   limit.
 - many times, the buffer is not page aligned
 - vmapbuf() truncates the address, so that it is page aligned
 - that causes the total size of the buffer to be greater than MAXPHYS,
   which of course is a bad thing.

Here's a quote from the PR (kern/9067):

==================
In particular, note bp->b_bufsize = 0x0001f950 and bp->b_data = 0xf2219960
(which does not start on a page boundary).  vunmapbuf() loops through all
the pages without any difficulty until addr reaches 0xf2239000, and then
the panic occurs.  This seems to indicate that we are exceeding MAXPHYS
since we actually started from the middle of a page (the data is being
transfered to a non page aligned location).

To complete the description, note that the system call originates from
ReadCddaMMC12() (in scsi_cmds.c of cdda2wav) with a request to read 55
audio sectors of 2352 bytes (which is calculated to fall under MAXPHYS).
This in turn ends up calling scsi_send() (in scsi-bsd.c) which calls
cam_fill_csio() and cam_send_ccb().  This results in a CAMIOCOMMAND ioctl
with a ccb function code of XPT_SCSI_IO.
==================

The fix is to change the size check in cam_periph_mapmem() so that it is
like the one in minphys().  In particular, it is something like:

if ((buffer_length + (buf_ptr & PAGE_MASK)) > MAXPHYS)
	buffer is too big

My fix is based on the one in the PR, but I cleaned up a fair number of
things in cam_periph_mapmem().  The checks for each buffer to be mapped
are now in a separate loop from the actual mapping operation.  With the new
arrangement, we don't have to bother with unmapping any previously mapped
buffers if one of the checks fails.

Many thanks to James Liu for tracking this down.  I'd appreciate it if some
vm-savvy folks would look this over.  I believe this fix is correct, but I
could be wrong.

PR:		kern/9067 (also, kern/8112)
Reviewed by:	gibbs
Submitted by:	"James T. Liu" <jtliu@phlebas.rockefeller.edu>
1998-12-16 18:00:39 +00:00
Justin T. Gibbs
b6f7b14445 Enable/Disable our lun on open/close. Track resources kept at the controller
level so they can be reclaimed before attempting to disable our lun.
Correctly free descriptors.  Add periph locking and spl protection
around open and close.
1998-12-15 08:15:15 +00:00
Justin T. Gibbs
bb6087e5bb Wire up the XPT_ABORT and XPT_RESET_DEV ccb function codes so they can
be delivered to controller drivers.

Adjust for changes to the ccb_hdr list types in cam_queue.h
1998-12-15 08:13:10 +00:00
Justin T. Gibbs
6fc6a73645 Add definitions for TAILQ, LIST, and SLIST ccb_hdr queues. 1998-12-15 08:12:03 +00:00
Justin T. Gibbs
10fc9d90ce Return ENODEV instead of EINVAL when a particular exchange or move
operation exceeds the capabilities of the changer device.
1998-12-12 23:52:46 +00:00
Matt Jacob
ed744c4e51 Some fixes to handle fixed mode and variable mode more sensibly- and also
incorporate some notion of which revision the device is. If it's < SCSI2, for
example, READ BLOCK LIMITS is not a MANDATORY command.

At any rate, the initial state is to try and read block limits to get a notion
of the smallest and largest record size as well as the granularity. However,
this doesn't mean that the device should actually *in* fixed block mode should
the max && min  be equal... *That* choice is (for now) determined by whether
the device comes up with a blocksize of nonzero. If so, then it's a fixed block
preferred device, otherwise not (this will change again soon).

When actually doing I/O, and you're in fixed length mode, the block count is
*not* the byte count divided by the minimum block size- it's the byte count
divided by the current blocksize (or use shift/mask shortcuts if that worked
out...).

Then when you *change* the blocksize via an ioctl, make sure this actually
propagates to the stored notion of blocksize (and update the shift/mask
shortcuts).

Misc Other:
	When doing a mode select, only use the SCSI_SAME_DENSITY (0x7f) code if
the device is >= SCSI2- otherwise just use the saved density code.

	Recover from the ripple of ILLEGAL REQUEST not being 'retried' in that
RESERVE/RELEASE is not a mandatory command for < SCSI2 (so ignore it if it
fails).
1998-12-11 07:19:36 +00:00
Justin T. Gibbs
57c2edb48f Convert dadump to use reasonable data types so that some casting is unecessary. 1998-12-11 03:54:43 +00:00
Justin T. Gibbs
a0f37f55ee Do not attempt to retry commands that fail with ILLEGAL REQUEST status. 1998-12-11 03:53:05 +00:00
Justin T. Gibbs
4227e01d4d Convert debugging printfs to the CAM_DEBUG macro.
Allow sync transfers if the controller supports it.  Wide will follow
as soon as I get the kinks worked out of wide target transfers in the
aic7xxx driver (currently the only target mode driver in the tree).
1998-12-10 04:07:42 +00:00