Commit Graph

83 Commits

Author SHA1 Message Date
Nick Hibma
9a1c8571c7 *sigh* I must have been on something that night. Make xpt_periph an
extern with the original in cam_xpt.c instead of replicating
xpt_periph in all the sources using it (and hence not initialising it)
2000-05-07 18:04:50 +00:00
Nick Hibma
540d9130cc Add a hack to cam that makes the cam_xpt available to the rest of the
kernel. Justin agress that there is no other reasonable alternative to
do automatic rescans on connect.

The problem is that when a new device attaches to a SIM (SCSI host
controller) we need to send a XPT_SCAN_BUS command to the SIM using
xpt_action. This requires however that there is a peripheral available
to take the command (otherwise xpt_done and later bomb). The RESCAN
ioctl uses the same periph.

This enables a USB mass storage drive to do an automatic rescan on
connection of the drive.

The automatic dropping of a CAM entry on disconnection was already
working (asynchronous event).

The next thing to do is find someone to commit a change to vpo to do the
same thing. Just port umass_cam_rescan and friends across to that
driver.

Approved by:   gibbs
2000-04-03 11:11:12 +00:00
Nick Hibma
0cdabce076 Various typo's.
One minor nit. The speed was displayed wrong when below 1Mb/s.
2000-03-15 21:55:48 +00:00
Matt Jacob
c19cf05d0d Redo the SHORT INQUIRY length stuff to be a bit cleaner.
Obtained from:gibbs@freebsd.org
2000-01-25 18:25:22 +00:00
Peter Wemm
75f51904b5 A minimal update to the device wiring code so that it looks at the
dynamic resource tables rather than relying on a duplicated cam-specific
table generated by config(8) in ioconf.c.  This was a major holdup to
getting loader / userconfig driven configuration of scsi wiring.
2000-01-23 18:03:38 +00:00
Matt Jacob
9ec5d7cd35 Remove garbage collected tags from their usage in the ccb_getdev
structure. Remove usage of the (now gone) pd_type tag of same.

Add an extra probing state such that if we successfully run an
initial inquiry (36 bytes), rerun another one with a longer data
size as informed by the 'additional length' field in the first
returned inquiry data (making sure not to get bigger than the
actual scsi_inquiry_data structure- which has also been modified-
see separate checkin of scsi_all.h). This allows devices such
as SAF-TE devices (which have identifying marks in offsets 48-53
in inquiry data) to be successfully found without special case
inquiry commands. There are also a lot of other things such as
version codes that are coming in in the SPC2 specification that it
would be useful to get our hands on.

Reviewed by:	gibbs@freebsd.org, ken@freebsd.org
2000-01-17 06:20:08 +00:00
Justin T. Gibbs
434bbf6e63 Clean up the xpt_sim creation to mirror how HBA drivers perform this task.
Clean up node creation in the EDT so that initialization follows member
declaration.

Sort registered paths by pathid so that we probe busses in order of
ascending pathid.  This makes hardwiring of busses without wiring
individual targets do what the user expects. (submitted by tegge@FreeBSD.org)

Fix an EDT node leak.  Target nodes would never go away.

Implement xpt_bus_deregister().
(prodded by some patches from T. Ichinoseki, but implemented differently.)
2000-01-14 23:08:46 +00:00
Matt Jacob
b6a0d1ab0c Make sure we don't look at an edt entry that could go away when we try
and figure out whether to probe higher than logical unit 7.
Obtained from:gibbs@freebsd.org
1999-12-20 16:16:53 +00:00
Matt Jacob
cda9006f07 minor comment update 1999-12-13 19:40:00 +00:00
Kenneth D. Merry
73d2691976 Convert the xpt, pass, pt and target drivers to use the new
make_dev()/destroy_dev() interface.
1999-11-17 04:59:09 +00:00
Kenneth D. Merry
10e1cf639d Fix Bus Device Resets from userland, and specifically from camcontrol.
camcontrol was setup to use the old scheme of going through the xpt(4)
device, which never worked properly (and has been disabled for a while).

camcontrol now sends BDRs through the pass(4) device, and XPT_RESET_DEV
CCBs are put on the device queue in the transport layer, as they should be.

Submitted by:	luoqi
Reviewed by:	ken
1999-10-31 02:39:44 +00:00
Matt Jacob
0642b69a16 Protect xpt_run_dev_sendq in xpt_release_devq_device with splsoftcam. This
seems to handle the case of timeouts firing during probe but after a device
has gone away. It really does help.
Obtained from:gibbs@freebsd.org
1999-10-16 23:31:34 +00:00
Nick Hibma
3e2c6ca3b9 Removal of sys/device.h
- Move intrhook stuff into kernel.h
- Remove all occurrences of #device <device.h>
- Add kernel.h were necessary (nowhere)
- delete device.h

This file contained the structures for cfdata (old style config) and is no
longer used. It was included by most drivers.

It confuses the remote debugger as the definition of 'struct device' in
device.h is found before the one in bus_private.h.
1999-10-05 21:19:41 +00:00
Poul-Henning Kamp
d6a0e38a1b Remove five now unused fields from struct cdevsw. They should never
have been there in the first place.  A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags
1999-09-25 18:24:47 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Poul-Henning Kamp
9dcbe2404a Convert DEVFS hooks in (most) drivers to make_dev().
Diskslice/label code not yet handled.

Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)

Add the correct hook for devfs to kern_conf.c

The net result of this excercise is that a lot less files depends on DEVFS,
and devtoname() gets more sensible output in many cases.

A few drivers had minor additional cleanups performed relating to cdevsw
registration.

A few drivers don't register a cdevsw{} anymore, but only use make_dev().
1999-08-23 20:59:21 +00:00
Justin T. Gibbs
2cefde5ff3 Implement the guts of the XPT_ABORT function code.
Clear residuals for XPT_TARGET_IO/XPT_CONT_TARGET_IO calls just
as we do for XPT_SCSI_IO calls.

Make xpt_release_devq a proper reciprocal of xpt_freeze_devq by
allowing the caller to decrement the count more than once per call.

Change the semantics of xpt_path_cmp to return 1 for a match
with a wildcard from path1 and 2 for a match with wildcards
from path2.  This change doesn't affect most callers as they
only check for >=0 (exact match or one containing a wildcard).

When cleaning up a device node, ensure that there are no timeouts
outstanding that reference it.
1999-08-16 22:22:41 +00:00
Matt Jacob
48f6456d82 Put in a limit (8) for lun width- do not exceed probing this unless a device
is quirked for allowing it. This will allow SCSI cards to specify their true
correct lun width (32 for Qlogic SCSI, 16 or 65536 for Qlogic Fibre Channel)
without crippling the system because of f/w breakage of a lot of drives.
Reviewed by:	gibbs@freebsd.org
1999-08-16 17:47:39 +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
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
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
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
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
2c3cca96df Quirk NOLUNS CALIPER CP150. 1999-05-11 02:41:00 +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
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
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
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
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
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
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
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
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
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
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
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