Commit Graph

31 Commits

Author SHA1 Message Date
Ed Maste
31a0399e57 Diff reduction to Adaptec's driver (around build 15317): catch up with a
change in debugging routines.

The fwprintf macro in the AAC_DEBUG case (mapping to printf) isn't from the
Adaptec driver.
2008-03-24 19:23:33 +00:00
Ed Maste
9bffabcec9 Merge from Adaptec a 64 bit fix and a workaround for luns != 0 returning
CAM_SEL_TIMEOUT on SAS controllers, which prevented passthrough devices
from being created.
2007-12-07 20:37:12 +00:00
Ed Maste
eb5cbaa020 Rework aac locking for MPSAFE CAM. This fixes a Giant mutex assertion
reported on freebsd-current [1].

Also dequeue all events in aac_release_command (instead of just one)
so that there's no risk of them getting stranded.

Reported by:    Steven Brown [1]
Submitted by:   scottl@

[1] http://lists.freebsd.org/pipermail/freebsd-current/2007-October/077928.html
2007-11-01 20:45:29 +00:00
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Scott Long
2b83592fdc Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM.  Drivers that are not yet MPSAFE register Giant and operate as
usual.  RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.
2007-04-15 08:49:19 +00:00
Scott Long
df8ed58dc5 Add a missing mutex unlock to an error path.
Submitted by: Yuxiang Luo
PR: 107943
2007-01-15 16:22:20 +00:00
Matt Jacob
bd3fd815a7 2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.
2006-11-02 00:54:38 +00:00
Matt Jacob
fa9ed86506 The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by:	freebsd-scsi and specific stakeholders
2006-10-31 05:53:29 +00:00
Xin LI
cf82f20057 Unlock aac_io_lock before returning, thus eliminates a mutex
leak.

Submitted by:	Beyond Luo <fedora ercist iscas ac cn>
PR:		kern/100046
Reviewed by:	scottl
2006-07-14 13:55:56 +00:00
Scott Long
7cb209f5d0 Mega Update to the aac driver to support a whole new family of cards and
the modified interface that they use.  Changes include:

- Register a different interrupt handler for the new interface.  This one is
  INTR_MPSAFE, not INTR_FAST, and directly processes completions and AIFs.
- Add an event registration and callback mechanism for the ioctl and CAM
  modules can know when a resource shortage clears.  This condition was
  previously fatal in CAM due to programming oversights.
- Fix locking to play better with newbus.
- Provide access methods for talking to cards with the NEWCOMM interface.
- Fix up the CAM module to be better suited for dealing with newer firmware
  on the PERC Si/Di series that requires talking to plain SCSI via aac.
- Add a whole slew of new PCI Id's.

Thanks to Adaptec for providing an initial version of this work and for
answering countless questions about it.  There are still some rough edges in
this, but it works well enough to commit and test for now.

Obtained from: Adaptec, Inc.
2005-10-08 15:55:09 +00:00
Scott Long
552d343294 Bring aac_cam into line with using time_uptime instead of time_second. 2005-09-14 05:49:34 +00:00
Scott Long
29c711f038 Remove the messy locking dance around xpt_done() 2005-02-09 11:50:16 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Scott Long
0b0594cd4f Complete the repo-copy of aac_ioctl.h from sys/dev/aac/to sys/sys. 2004-12-09 22:20:25 +00:00
Scott Long
bb6fe253cc Remove the AAC_LOCK macros. They no longer abstract anything and only
obfuscate the code.  No functional differences.
2004-08-12 05:05:06 +00:00
Scott Long
03b5fe51bf Collapse sync fib locking into normal i/o locking. The former didn't
protect the registers so it was trivially possible for a sync command and
i/o command to fight each other and confuse the controller.  Make the
sync fib alloc/release functions inline and remove the somewhat worthless
AAC_SYNC_LOCK_FORCE flag.  Thanks to Adil Katchi for helping me to track
this down in RELENG_4.
2004-06-02 18:15:48 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Scott Long
c5a8036c3d Temporary workaround for aac_cam to deal with CAM requiring Giant. This
should fix the panics on boot with newer Adaptec RAID cards.

Approved by:	re (rwatson)
2003-12-03 15:42:12 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Scott Long
b88ffdc860 Make aac(4) compile cleanly on 64-bit machines. The code was already 64-bit
safe, but some (unneeded and/or harmless) downcasts were generating warnings.
The driver still is not endian-clean.
2003-08-19 21:31:45 +00:00
Scott Long
a6d35632f5 Begin support for 64-bit address support and workarounds for newer cards:
- Add data structuress for doing 64-bit scatter/gather
	- Move busdma tag creations around so that only the parent is
	  created in aac_pci.c.
	- Retrieve the capabilities word from the firmware before setting
	  up command structures and tags. This allows the driver to decide
	  whether to do 64-bit commands, and if work-arounds are needed for
	  systems with >2GB of RAM.
	- Only enable the SCSI passthrough if it's enabled in the capabilities
	  word in the firmware.

This should fix problems with the 2120S and 2200S cards in systems with more
than 2GB of RAM.  Full 64-bit support is forthcoming.

MFC-After:	1 week
2003-03-26 17:50:11 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Scott Long
9e2e96d803 The aac driver has evolved enough over the last few months that it no
longer resembles the 4.x version very much.  Garbage collect the legacy
bits.
2003-03-01 05:07:19 +00:00
Scott Long
ae54359608 Bring aac out from under Giant:
- the mutex aac_io_lock protects the main codepaths which handle queues and
  hardware registers.  Only one acquire/release is done in the top-half and
  the taskqueue.  This mutex also applies to the userland command path and
  CAM data path.
- Move the taskqueue to the new Giant-free version.
- Register the disk device with DISKFLAG_NOGIANT so the top-half processing
  runs without Giant.
- Move the dynamic command allocator to the worker thread to avoid locking
  issues with bus_dmamem_alloc().

This gives about 20% improvement in most of my benchmarks.
2003-02-26 04:46:21 +00:00
Scott Long
ddb8683e59 Teach the CAM module how to deregister itself so it can be unloaded. 2003-02-06 03:31:02 +00:00
Scott Long
70545d1a1f Various cleanups:
- Move the command timeout check from a separate repeating timeout to the
   kthread since the kthread is already running periodically.
 - Move printing the hardware print buffer to the kthread.
 - Properly shut down the kernel thread on detach.
 - Detach the child array devices on detach.
 - Don't issue a controller halt command on detach.  Doing so requires a PCI
   reset to wake the controller back up.  The driver can now be unloaded as
   long as CAM support is not enabled.
2003-02-05 23:24:25 +00:00
Scott Long
2ffaffaa6e Since reseting the SCSI busses via the passthrough interface usually
confuses the controller, tell CAM not to do it.  Also report the
correct error condition to CAM when it tries to probe a target that
doesn't exists.
This should make the CAM interface less risky to use.

MFC After:	3 days
2003-01-13 23:51:14 +00:00
Scott Long
2f4bfb29bb Fix GET_TRAN_SETTINGS to be more correct.
Don't allow SCSI resets on the 5400S card, it seems to cause problems with
certain backplanes.

Submitted by:	lnb@freebsdsystems.com
MFC after:	3 days
2002-08-10 19:55:00 +00:00
Scott Long
39ee03c316 bzero out the sync command buffer when sending commands. This was causing
problems when enumerating multiple arrays.

This is an MFC candidate.
2002-05-03 00:07:50 +00:00
Scott Long
1089f082aa Fix a bug where the aacp device would only talk to bus 0 on the
controller.
2002-04-30 22:50:26 +00:00
Scott Long
fe3cb0e1ec Add a CAM interface to the aac driver. This is useful in case you should
ever connect a SCSI Cdrom/Tape/Jukebox/Scanner/Printer/kitty-litter-scooper
to your high-end RAID controller.  The interface to the arrays is still
via the block interface; this merely provides a way to circumvent the
RAID functionality and access the SCSI buses directly.  Note that for
somewhat obvious reasons, hard drives are not exposed to the da driver
through this interface, though you can still talk to them via the pass
driver.  Be the first on your block to low-level format unsuspecting
drives that are part of an array!

To enable this, add the 'aacp' device to your kernel config.

MFC after:	3 days
2002-04-27 01:31:17 +00:00