Commit Graph

63 Commits

Author SHA1 Message Date
Attilio Rao
1bd320ec51 - Fix races on detach handling of AAC_IFFLAGS_* mask
- Fix races on setting AAC_AIFFLAGS_ALLOCFIBS
- Remove some unused AAC_IFFLAGS_* bits.
  Please note that the kthread still makes a difference between the
  total mask and AAC_AIFFLAGS_ALLOCFIBS because more flags may be
  added in the future to aifflags.

Sponsored by:			Sandvine Incorporated
Reported and reviewed by:	emaste
MFC after:			2 weeks
2011-06-10 20:23:56 +00:00
Ed Maste
729e10b9e2 We can pass a format string and args to panic(), so instead of using
printf() to output some information before a panic, just include that
information in the panic.

Submitted by:	bde
Reviewed by:	bde
2011-02-04 15:45:48 +00:00
Ed Maste
7f6563d13c Include driver name in panic string, to make it easier to find these should
the panic ever occur.
2011-02-03 03:07:11 +00:00
Ed Maste
851f59d7e2 Previously, the aac driver did not handle enclosure management AIFs,
which were raised during hot-swap events. Now such events trigger cam
rescans, as is done in the mps driver.

Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
2010-09-29 14:22:00 +00:00
Attilio Rao
04f798ecea Fix bogus busying mechanism from cdevsw callbacks:
- D_TRACKCLOSE may be used there as d_close() are expected to match up
  d_open() calls
- Replace the hand-crafted counter and flag with the
  device_busy()/device_unbusy() proper usage.

Sponsored by:	Sandvine Incorporated
Reported by:	Mark Johnston <mjohnston at sandvine dot com>
Tested by:	Mark Johnston
Reviewed by:	emaste

MFC after:	10 days
2010-09-15 14:24:21 +00:00
Ed Maste
94c0fd90f2 Whitespace cleanup, in advance of next sync with Adaptec's driver. No
functional change.
2010-04-13 00:33:07 +00:00
Ed Maste
8e7e6335bc Diff reduction with Adaptec's vendor driver.
Driver version 2.1.9 chosen as that Adaptec version roughly corresponds
with the current feature set merged to the in-tree driver.
2010-02-14 17:14:11 +00:00
Ed Maste
2134e2ef57 Garbage collect Falcon/PPC support that has not been used in released
products, based on discussion with Adaptec.
2010-02-12 18:48:18 +00:00
Jung-uk Kim
23e876b121 - Try pre-allocating all FIBs upfront. Previously we tried pre-allocating
128 FIBs first and allocated more later if necessary.  Remove now unused
definitions from the header file[1].
- Force sequential bus scanning.  It seems parallel scanning is in fact
slower and causes more harm than good[1].  Adjust a comment to reflect that.

PR:		kern/141269
Submitted by:	Alexander Sack (asack at niksun dot com)[1]
Reviewed by:	scottl
2009-12-08 05:35:51 +00:00
Ed Maste
e46b9eeada Rename aac_fast_intr to aac_filter to reflect its current use. Eliminate
the fallback of using the filter as an interrupt handler, as it is no
longer needed.

Discussed with:	scottl, jhb
2009-10-29 14:53:45 +00:00
Ed Maste
4a42b06106 Increase AAC_CMD_TIMEOUT from 30s to 120s to help avoid spurious
"COMMAND 0x........ TIMEOUT AFTER .. SECONDS" messages.  Any commands
that get truly stuck will still trigger the warning and the hardware
health check, just a little bit later.
2009-09-09 03:41:40 +00:00
Attilio Rao
ff0991c4e9 Sync with the official Adaptec vendor driver:
[1]	Add the support for the NARK controller which seems a variant of
	the i960Rx.
[2]	Split up memory regions and other resources in 2 different parts
	as long as NARK uses them separately (it is not clear to me
	why though as long as there are no more informations available
	on this controller). Please note that in all the other cases,
	the regions overlaps leaving the default behaviour for all the
	other controllers.
[3]	Implement a clock daemon responsible for maintain updated the
	wall clock time of the controller (run any 30 minutes)*.

Submitted by:	Adaptec (driver build 15317 [1, 2] and 15727 [3])
Reviewed by:	emaste
Tested by:	emaste
Sponsored by:	Sandvine Incorporated

* Please note that originally, in the Adaptec driver, the clock daemon
  is not implemented with callouts as in our in-tree driver.
2009-02-21 15:40:03 +00:00
Ed Maste
523da39bcc Add 64-bit array support for RAIDs > 2TB. This corresponds to ~ Adaptec
driver build 15317.

Tested on:
Adaptec 2230S, Firmware 4.2-0 (8205)
ICP ICP5085BL, Firmware 5.2-0 (12814)

Submitted by:	Adaptec
2008-03-25 21:39:06 +00:00
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
a723a5482e Allow simultaneous opens of the device for issuing commands to the
controller.  This is merged from Adaptec driver build 11669.
2007-12-07 00:22:23 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +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
4afedc314e Add support for the Adaptec RAID-On-Chip architecture. This in turn
provides support for the Adaptec 2130S adapter.  Thanks to Adaptec for
providing hardware for this.
2004-08-13 01:44:09 +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
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +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
Scott Long
2c81db6cb5 Turn down the queue size by 8 until I can figure out why the 512th command
keeps on getting lost.
2004-05-30 22:40:28 +00:00
Poul-Henning Kamp
0b7ed341e1 Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.

Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.

Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.

Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:

The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT

A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.

Manual page update to follow shortly.
2004-02-18 21:36:53 +00:00
Scott Long
ecd1c51f92 Do some small cleanups to comments and remove AACQ_COMPLETE definitions since
the completion queue is long-gone.
2004-02-07 17:40:38 +00:00
Scott Long
d85f27ce7f Remove the hack of lowering AAC_MAX_FIB now that the root cause of the
problem was found.
2004-02-07 10:30:59 +00:00
Scott Long
8f6a5435e7 Reduce AAC_MAX_FIBS to work around some yet-unidentified bugs in the
handling of resources shortages.  The driver is now so fast that it can
completely fill all 512 slots on the card, but for some reason only 511
slots are being allocated.  Anything that tries to go into the 512th
slot gets silently lost.   Both bugs need to be fixed at a later date,
but this should fix the reports of hangs in getblk and vinvalb.
2004-02-07 03:30:32 +00:00
Scott Long
9148fa21dd Take the plunge and make this driver be INTR_FAST. This re-arranges the
interrupt handler so that no locks are needed, and schedules the
command completion routine with a taskqueue_fast.  This also corrects the
locking in the command thread and removes the need for operation flags.

Simple load tests show that this is now considerably faster than FreeBSD 4.x
in the SMP case when multiple i/o tasks are running.
2004-01-30 07:04:39 +00:00
John Baldwin
8b149b5131 Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort.  In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by:	bde (kern_ktrace.c)
2003-08-07 15:04:27 +00:00
Scott Long
cd481291bd Handle the EINPROGRESS case of bus_dmamap_load() for data buffers. 2003-07-09 21:16:23 +00:00
Scott Long
4b00f859d0 Add a new quirk for cards that incorrectly interpret the amount of memory
in the system.  This might also have a small performance gain.
2003-07-09 19:19:16 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +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
7540e65e84 Move to 'struct disk*' API
Submitted by:	phk
2003-02-26 02:50:27 +00:00
Scott Long
3cbd08b843 The completion queue is no longer used, so nuke its associated code
and data structures.
2003-02-20 08:51:16 +00:00
Scott Long
cb0d64b9b9 Fix a 64-bit bogon. The hardware command structure only has one 32 bit
field for holding driver-dependant data.  Instead of putting the pointer
to the driver command struct in there, take advantage of these structs
being a (virtually) contiguous array and just put the array index in the
field.
2003-02-19 23:33:56 +00:00
Scott Long
8480cc638e o Move the cleanup of the fib maps into aac_free_commands() so as to
retain symetry with aac_alloc_commans().  Since aac_alloc_commands()
  allocates fib maps and places them onto the fib lists, aac_free_commands()
  should reverse those operations.

o Combine two ifs with the same body with an ||.

o Switch from uintptr_t to uint32_t for fib map load operations.
  The target is a uint32_t so using this type for the map load call
  avoids an extra cast.  uintptr_t should only be used when you need
  an "int sized the same as the machine's poitner size" which is not
  the case here.

o Removed the commented out M_WAITOK flag in the allocation in
  aac_alloc_commands().  The kernel will only block in the allocator
  if it can grow the size of the kernel.  This usually results in a
  page-out which could involve this aac device.  Thus, sleeping here
  could deadlock the machine.  Assuming this operation is occurring outside
  of attach time, we have enough fibs to operate anyway, so waiting for
  fibs to free up is okay if not optimal.

o In aac_alloc_commands(), if we cannot dmamem_alloc additional fib
  space, free the fib map.

o In aac_alloc_commands(), if we cannot create per-command dmamaps, don't
  lose track of the fib map that is mapping all of the commands that we
  have already released into the free pool.  Instead, just cut out of
  the loop and modify aac_free_commands to not attempt to free maps that
  have not been allocated.

o Don't use a magic number when pre-allocating fibs.

o Use PAGE_SIZE to allocate in page sized chunks instead of an
  architecture specific constant.

Submitted by: gibbs
2003-02-19 21:38:29 +00:00
Scott Long
ffb37f33f8 Implement a new dynamic command allocator. FIBs are allocated in 1 page
blocks now, which should eliminate problems with the driver failing to
attach due to insufficient contiguous RAM.  Allow the FIB pool to grow
from the default of 128 to the max of 512 as demand grows.  Also pad the
adapter init struct to work around the 2120/2200 DMA bug now that there
is no longer a FIB slab.
2003-02-10 00:34:24 +00:00
Scott Long
5f54d52203 Don't include aac_cam.h, since it was nuked in the last commit.
Deregister the shutdown eventhandler on unload.
2003-02-06 00:07:12 +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
Poul-Henning Kamp
f90c382c0c Make FreeBSD "struct disklabel" agnostic, step 311 of 723:
Rename diskerr() to disk_err() for naming consistency.

Drop the by now entirely useless struct disklabel argument.

Add a flag argument for new-line termination.

Fix a couple of printf-format-casts to %j instead of %l.

Correctly print the name of all bio commands.

Move the function from subr_disklabel.c to subr_disk.c,
and from <sys/disklabel.h> to <sys/disk.h>.

Use the new disk_err() throughout, #include <sys/disk.h> as needed.

Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.

Remove unused disklabel members of softc for aac, amr and mlx, which seem
to originally have been intended for diskerr() use, but which only rotted
and got Copy&Pasted at least two times to many.

Sponsored by:   DARPA & NAI Labs.
2002-09-20 12:52:03 +00:00
Peter Wemm
70148712be Constify a debug function arg that we pass __func__ to in order to pacify
gcc-3.1's 'const char *__func__;'
2002-05-24 05:57:47 +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
Scott Long
cbfd045b10 Prepare for a major update to the aac driver:
Update the aac driver with the new crashdump api.
	Protect sync fibs with a mutex.
	Align all DMA buffers on a PAGE_SIZE boundary.

MFC after:	3 days
2002-04-24 05:12:50 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Scott Long
fe94b852b3 Don't attach to Dell PERC2/QC cards that have a firmware rev of 1.x. This
check is complicated by the fact that the Adaptec 5400S cards claim to use
1.x firmware also.  PERC2/QC 1.x firmware is not compatible with this driver
and will cause a system hang.

MFC after:	3 days
2002-02-06 01:34:09 +00:00
Mike Smith
e45bef2aa9 Staticise the aac devclass. 2002-01-09 03:32:40 +00:00
David E. O'Brien
956d569b10 I missed a string concatenation. 2001-12-10 09:34:47 +00:00