Commit Graph

55 Commits

Author SHA1 Message Date
Warner Losh
bf1e599dc1 Save the device so we can do a device_printf.
Use this in preference to aha_name.
Remove aha_name function and #define it to device_get_unitname()
Minor indentation tweaks resulting therefrom
2003-11-13 04:14:53 +00:00
Warner Losh
71edba1fe8 Move 'guessing' code from the probe into the identify routine where it more
properly belongs.
2003-11-10 02:47:11 +00:00
Warner Losh
116f7a3ddb Tweak the front end driver file list
Also some minor whitespace nits.
2003-11-09 20:02:47 +00:00
Warner Losh
40f583c24a Let bus space manage softc. 2003-11-09 19:51:16 +00:00
Warner Losh
9b4fbfe900 Minor tweaks to make it behave better:
o When we're resetting the board, make sure that we error out the pending
  CCBs first.  Otherwise the aha_cmd won't accept further commands, such
  as those that are used to reset the card (AOP_INITIALIZE_MBOX).  This
  appears to cause a cascade failure where no more commands are possible
  to the card.
o Reduce from 10s down to 1s the amount of time we're willing to tolerate
  the card being awol.  This helps the above case.
o Add some error checking to two commands issued in the probe.

I have a dim memory of gibbs@ trying to tell me about this problem a
few years ago, so pointy hat to imp@ for sitting on it so long.
2003-11-09 17:16:39 +00:00
Warner Losh
3cce43b94e Make this driver a little more style(9) compliant 2003-11-09 00:51:52 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Scott Long
7e71df9339 Bring back bus_dmasync_op_t. It is now a typedef to an int, though the
BUS_DMASYNC_ definitions remain as before.  The does not change the ABI,
and reverts the API to be a bit more compatible and flexible.  This has
survived a full 'make universe'.

Approved by:	re (bmah)
2003-05-27 04:59:59 +00:00
Maxime Henrion
7a648f56cf I deserve a big pointy hat for having missed all those references
to bus_dmasync_op_t in my last commit.
2003-04-10 23:50:06 +00:00
Matthew N. Dodd
563d4d8656 Clean up argument comments for bus_dma_tag_create() calls. 2003-03-29 09:46:10 +00:00
Alfred Perlstein
8deebb0160 Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
2003-02-02 13:17:30 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Peter Wemm
ba3d594ddc Fix build on alpha. It used to case an int to a pointer in order to do
pointer arithmetic.  Detour via uintptr_t, since we're generating an
offset not dereferencing them.
2002-10-09 09:30:57 +00:00
Peter Wemm
9c580bea80 Fix new gcc-3.1 warnings. I think this gets GENERIC compiling cleanly
again.
2002-05-24 05:21:36 +00:00
Warner Losh
1bd4d86275 Remove NAHA, NAHATOT and aha_softcs and related code. It was unused
except for setting it.  Also remove count from aha and replace it with
optional.

Also add commented out pccard lines for all the old card drivers.
They have to be commented out until they are converted because it
causes problems in NEWCARD.
2001-02-04 16:45:39 +00:00
Warner Losh
b76f687a7e Remove unnecessary includes found by phk's script a long time ago. 2000-12-13 06:25:22 +00:00
David Malone
66efa50621 Make a few more mallocs use M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	imp
2000-10-29 16:29:05 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Alexander Langer
0cca1cc078 Fix typo (accessable --> accessible).
PR:		18588
Submitted by:	Anatoly Vorobey <mellon@pobox.com>
Reviewed by:	asmodai
2000-06-14 17:53:40 +00:00
Poul-Henning Kamp
ed6aff7387 Remove unneeded <sys/buf.h> includes.
Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.
2000-04-18 15:15:39 +00:00
Warner Losh
25f061dedd Fix plug and play support:
o Cut out the probed stuff.  We no longer need it since newbus implicitly
  checks for this (likely bt can be changed as well in this way).
o Add preliminary support for unload.  Untested because aha doesn't yet
  support identify and there are some interactions with PnP that I've
  not yet worked out.

With this I can boot the AHA-1542CP FW F.0.  All the aha resources
appear to be picked up via pnp now.
2000-01-24 07:08:40 +00:00
Warner Losh
822ddbd8f7 MIN unused, so kill it 1999-10-25 04:28:53 +00:00
Warner Losh
d17298bf1c Kill unused includes 1999-10-11 19:05:21 +00:00
Matthew N. Dodd
fe76c677ea Use the PRVERB() macro instead of 'if (bootverbose) printf()...
Add debuging for all failure cases in aha_cmd().

Always check DATAIN_REG_READY even if we're ready to exit the
read loop.

The last fix allows the AHA-1640 MCA SCSI adapter to operate
correctly and likely fixes problems on a few other oddball
adapters. (I suspect my Dell Drive Array in 1540 mode needs this.)

Reviewed by:	Warner Losh
1999-10-02 17:40:07 +00:00
Doug Rabson
4c2212401b Remove vestiges of old pnp code. 1999-09-03 20:11:25 +00:00
Peter Wemm
ae5d5ac013 Missed this use of the old pnp includes. I don't think this is meant to
be here though.
1999-09-02 05:59:20 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Justin T. Gibbs
086646f7c6 Properly set the alignment argument to bus_dma_tag_create(). If we
don't care about the alignment, set it to 1, meaning single byte alignment.
1999-08-16 01:52:21 +00:00
Justin T. Gibbs
378d6d7395 The 1542 cards do not allow adapter commands to be queued while mailbox
commands are outstanding.  You'd think they'd just clear the IDLE bit,
but alas, no.  Delay until all pending mailbox commands have completed
in aha_cmd to work around this.

Report sync rates correctly on Fast Adaptec cards.  Clones may still be
reported incorrectly since there is no documenation on how they report
extended sync values.

Clean up some unused fields in the aha softc.
1999-05-25 20:15:20 +00:00
Warner Losh
fca33042ed Put a small delay in before sending the inquire_setup command. The
docs don't seem to shed light on why this is needed, but reports from
the field indicate this helps prevent problems in this area.  Ken's
changes seem to have exposed this bug, rather than caused it, as far
as I can tell.

Thanks to Jack O'Neill for tracking this down.

Submitted by: jack@germanium.xtalwind.net

Very strong 3.2 merge candidate.
1999-05-14 23:10:25 +00:00
Warner Losh
ca0cc0c9be Add another kludge to the card identification probe. It appears that
some aha 1542B cards will return 0x7f for the unimplemented GEOMETRY
register.

This is a good 3.2 candidate.

PR: 11469
Submitted by: Thomas David Rivers
1999-05-11 08:12:11 +00:00
Peter Wemm
1ce418a67d ahatimeout is static.. 1999-05-06 22:18:21 +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
Eivind Eklund
505ab9b86b Staticize. 1999-04-11 02:55:52 +00:00
Warner Losh
ec0211864c Better logging when the Geometry register probe fails. 1999-03-02 20:56:07 +00:00
Warner Losh
07353d4247 o enable plug and play support for the aha driver. Given the cumbersome
pnp system in freebsd, I'm not sure how useful this will be, but my
  1542CP seems to work well in plug and play mode and does seem to
  probe correctly at all the oddball addresses/irq/drqs that I tried.
  [[
     I was unable to get /kernel.conf or /kernel.config to read in, so
     I wasn't able to verify that this method of userconfig works.  that's
     one thing that makes pnp so hard to use in the current scheme.
     Pointers to the right new way of doing this accepted.
  ]]
o Add some kludges to maybe bring support for 1540A/1542A into the
  driver.  Since I have no 154xA cards, and the only person I know
  that has them hasn't given me feedback, I'm making this commit
  blind.
o Honor unit numbers that are in the config file now.  This allows one
  to hard wire the unit numbers (and have high unit numbers for plug
  and pray devices, which can't seem to be hardwired) and have the
  cards not migrate from aha1 -> aha0 should aha0 go on the fritz.  I
  didn't verify that hard wired scsi busses would work, but did verify
  that hard wired aha addresses did work to a limited extent.  Both
  aha0 and aha1 must be hardwired, or when the card that was in aha0
  goes away, the probe for aha0 might pick up the card that otherwise
  would have been aha1.
1999-01-20 06:21:27 +00:00
Warner Losh
ed994fe86a Invalid is spelled with the v *BEFORE* the a. 1998-12-22 22:31:06 +00:00
Justin T. Gibbs
e84c798977 Don't calculate the residual twice. 1998-12-22 18:14:50 +00:00
Warner Losh
b128b9cf2a o Convert length of hccb to integer from the array. Eivind Eklund
pointed this out, but I've not seen a manifestation of this.
o Check against 0x00 as well as 0xff for geometry register, as some clone
  cards don't return 0xff.  Vadim Mikhailov pointed this out in PR
  8743 for his Dell SCSI Array controller working in AHA-1540
  emulation mode.  Note that this test is likely to go away in the
  future in favor of a better one Justin has recommended.
1998-12-15 02:51:54 +00:00
Justin T. Gibbs
0aae7eb02e Pull in fixes similar to those recently committed to the bt driver:
- For transactions of 0 length, us a non-residual checking CCB type.

 - Preserve command status if our interrupt handler completes a command
   while we are polling for completion in aha_cmd.
1998-12-13 00:05:04 +00:00
Archie Cobbs
2127f26023 Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>
1998-12-04 22:54:57 +00:00
Warner Losh
46d4978e39 o Patch, slightly altered, from Graham Menhennitt for older aha 1542B
cards.  My machine didn't tickle this problem, so I can't tell if
  it fixed anything or not.  However, it didn't break my already working
  1542-{B,C,CF,CP} probes.
o Minor comment correction
o Minor correction in printf
1998-11-25 19:12:56 +00:00
Justin T. Gibbs
712463b1fa Noop Commit - Change was in last revision.
If the next available mailbox is not in the free state, print a warning
and handle the condition as a temporary resource shortage.  The condition
should never happen, but we shouldn't panic since recovery is possible.
1998-11-10 06:47:11 +00:00
Justin T. Gibbs
d0993d7584 Fix probes when a port address is specified.
Convert from BT'isms to AHA'isms

Don't fail the probe if the illegal command bit is set in the status
register.  If the BusLogic MultiMaster probe preceeded us, it may well
have determined that the card we are attaching to was not a true MultiMaster
by sending us a command that fails on the 154X.

Reset the adapter before doing the inquiry.  This provides extra sanity
and will also clear the illegal command status bit that my be left over
from the MultiMaster probe.
1998-11-10 06:44:42 +00:00
Justin T. Gibbs
4663e36736 -Wunused cleanup.
Submitted by:	Poul-Henning Kamp <phk@freebsd.org>
1998-10-15 23:46:33 +00:00
Warner Losh
ca1a3d8c33 Reduce the number of ccbs to 16, per the aha documentation. Move
bogus comment to proper place.

This should fix the hangs people are seeing under very heavy load, at
least it does for me.  Please let me know if you continue to have
problems.
1998-10-15 19:53:30 +00:00
Justin T. Gibbs
9574f7968d Hook up ahapoll so that dumps, synchronize cache commands or any other
command that comes in through xpt_polled_action works correctly.
1998-10-09 21:38:36 +00:00
Warner Losh
27af0eb7b6 GC unused stuff. 1998-10-02 04:37:49 +00:00
Warner Losh
667b14c256 Misc cleanup and probe rework:
o Use the board id command to find out what kind of board
	  we're talking to.  If we're talking to a board that is has
	  an ID that is shared between boards supported by the aha
	  driver and the bt driver, then use the bt's geometry
	  register to weed out the bt cards.  Otherwise assume that we
	  support this card.
	o Remove bt esetup command sending to the card.  It seems to
	  wedge too many cards.
	o Revert to doing a soft reset after an invalid command.  This
	  change didn't fix anything, so I'm backing it out.  The
	  whole issue of card resetting needs to be revisisted at some
	  point so that we can do it properly on all hardware.
	o GC unused stuff in some places.
1998-10-01 04:53:55 +00:00