Commit Graph

287 Commits

Author SHA1 Message Date
Roman Divacky
36e335c161 Give panic format string to pacify clang warning. 2012-11-09 13:58:52 +00:00
Ryan Stone
a916893f23 Some aac(4) adapters will always report that a direct access device is
offline in response to a INQUIRY command that does not retreive vital
product data(I personally have observed the behaviour on an Adaptec 2405
and a 5805).  Force the peripheral qualifier to "connected" so that upper
layers correctly recognize that a disk is present.

This bug was uncovered by r216236.  Prior to that fix, aac(4) was
accidentally clearing the peripheral qualifier for all inquiry commands.

This fixes an issue where passthrough devices were not created for
disks behind aac(4) controllers suffering from the bug.  I have
verified that if a disk is not present that we still properly detect
that and not create the passthrough device.

Sponsored by:	Sandvine Incorporated
MFC after:	1 week
2012-09-25 19:12:12 +00:00
Sean Bruno
ce61627a2d On BIO_ERROR, set bio_resid to stop losing data in the error case.
Submitted by:	Mark Johnston <markjdb@gmail.com>
Reviewed by:	scottl@freebsd.org
MFC after:	2 weeks
2012-07-18 18:10:27 +00:00
Eitan Adler
d79661b9b8 Remove variables which are initialized but never used thereafter
reported by gcc46 warning

Approved by:	cperciva
MFC after:	1 week
2012-07-07 17:20:24 +00:00
John Baldwin
e495fd1f3d Use bus_get_dma_tag() to inherit the PCI bus' 4G boundary constraint.
Tested by:	emaste
2012-03-07 18:52:46 +00:00
Ed Maste
55b44675ae Revert r232260.
The problem is now fixed by a general workaround in r232267.
2012-02-28 19:50:14 +00:00
Ed Maste
d80ce62eb5 Avoid transfers crossing a 4GB boundary, which can lead to data
corruption.  Thanks to scottl@ for the suggestion.

This change will likely be revised after consideration of a general
method to address this type of issue for other drivers.

Sponsored by:   Sandvine Incorporated
MFC after:      3 days
2012-02-28 17:29:31 +00:00
Ed Maste
1423dcd65a Add a sysctl to report the firmware build number.
Some older firmware versions have issues that can be worked around by
avoiding certain operations.  Add a sysctl dev.aac.#.firmware_build to
make it easy for scripts or userland tools to detect the firmware
version.
2012-02-13 16:48:49 +00:00
Marius Strobl
4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Marius Strobl
1e5addb750 Merge from r225950:
Set the sense residual properly.

Reviewed by:	ken
2011-10-13 20:06:19 +00:00
Robert Watson
a9d2f8d84f Second-to-last commit implementing Capsicum capabilities in the FreeBSD
kernel for FreeBSD 9.0:

Add a new capability mask argument to fget(9) and friends, allowing system
call code to declare what capabilities are required when an integer file
descriptor is converted into an in-kernel struct file *.  With options
CAPABILITIES compiled into the kernel, this enforces capability
protection; without, this change is effectively a no-op.

Some cases require special handling, such as mmap(2), which must preserve
information about the maximum rights at the time of mapping in the memory
map so that they can later be enforced in mprotect(2) -- this is done by
narrowing the rights in the existing max_protection field used for similar
purposes with file permissions.

In namei(9), we assert that the code is not reached from within capability
mode, as we're not yet ready to enforce namespace capabilities there.
This will follow in a later commit.

Update two capability names: CAP_EVENT and CAP_KEVENT become
CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they
represent.

Approved by:	re (bz)
Submitted by:	jonathan
Sponsored by:	Google Inc
2011-08-11 12:30:23 +00:00
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
2ad1c92d96 Revert part of r173264. Both aac_ioctl_sendfib and aac_ioctl_send_raw_srb
make use of the aac_ioctl_event callback, if aac_alloc_command fails.  This
can end up in an infinite loop in the while loop in aac_release_command.

Further investigation into the issue mentioned by Scott Long [1] will be
necessary.

[1] http://lists.freebsd.org/pipermail/freebsd-current/2007-October/078740.html
2011-02-03 02:14:53 +00:00
John Baldwin
6074a71604 When masking direct and processor devices during an inquiry, properly
preserve the upper bits of the first data byte.

Reviewed by:	scottl
MFC after:	1 week
2010-12-06 17:06:21 +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
Ed Maste
dbb34a64a0 Use device_printf where possible, and otherwise at least include the
driver name in printf strings.

Reported by:	Mark Johnston
2010-09-16 23:33:24 +00:00
Attilio Rao
dfe2c294f3 Implement device unbusying via a cdevpriv destructor.
Suggested by:	jhb
Tested by:	Mark Johnston <mjohnston at sandvine dot com>
Reviewed by:	emaste, jhb
MFC after:	10 days
X-MFC:		r212661
2010-09-16 17:49:10 +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
435c8a15cf Add some enums and constants from Adaptec's latest driver
(build 17911).
2010-09-15 01:19:11 +00:00
Ed Maste
3e50771086 Avoid repeatedly spamming the console while a timed out command is waiting
to complete.  Instead, print one message after the timeout period expires,
and one more when (if) the command eventually completes.

MFC after:	1 month
2010-09-14 01:51:04 +00:00
Ed Maste
6352e2e20a Use enums in the aac_command_status_table rather than duplicating the same
values in two places.

Suggested by: Garrett Cooper
2010-04-13 12:10:55 +00:00
Ed Maste
e71d3b9c19 Sync some minor items with the upstream driver. Should have no functional
change.
2010-04-13 01:16:15 +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
Attilio Rao
6eafba267e Make the code more readable and compiling on 64-bits arch different
than amd64.

Sponsored by:	Sandvine Incorporated
Submitted by:	emaste
MFC:		2 weeks
X-MFC:		r205160
2010-03-15 14:20:16 +00:00
Attilio Rao
7b90e5ec95 Checkin a facility for specifying a passthrough FIB from userland.
arcconf tool by Adaptec already seems to use for identifying the
Serial Number of the devices.
Some simple things (like FIB setup and bound checks) are retrieved
from the Adaptec's driver, but this implementation is quite different
because it does use the normal buffer dmat area for loading segments
and not a special one (like the Adaptec's one does).

Sponsored by:	Sandvine Incorporated
Discussed with:	emaste, scottl
Reviewed by:	emaste, scottl
MFC:		2 weeks
2010-03-14 22:38:18 +00:00
Ed Maste
dbfc596084 Minor diff reduction with Adaptec's driver: in aac_release_command() set
cm_queue to AAC_ADAP_NORM_CMD_QUEUE by default.  In every place it was set,
it was set to AAC_ADAP_NORM_CMD_QUEUE anyhow.
2010-02-23 21:41:13 +00:00
Ed Maste
5aa4bb5b49 Include command type in COMMAND TIMEOUT messages to aid in debugging. 2010-02-17 22:28:37 +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
Martin Blapp
c2ede4b379 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +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
c89d07b9f5 Rename aac_srb32 to aac_srb, to match Adaptec's vendor driver. 2009-10-29 17:14:18 +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
867b1d3431 Do first controller time sync after 1 minute, as in Adaptec's vendor
driver.
2009-10-28 13:50:28 +00:00
Ed Maste
b69a64e9c8 Whitespace fixup: 8 spaces -> tab 2009-10-27 19:37:37 +00:00
Ed Maste
7771d6bf70 Whitespace tweak.
Submitted by:	phk, via accidental commit in r196969.
2009-09-09 04:04:09 +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
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
John Baldwin
a56fe095f0 Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by:	re (kib), attilio
2009-08-20 19:17:53 +00:00
Attilio Rao
444b91868b Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by:    ed, hps, jhb, imp, mav, scottl
No answer by:   ariff, thompsa, yongari
Tested by:      pho,
                G. Trematerra <giovanni dot trematerra at gmail dot com>,
                Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by:   Yahoo! Incorporated
Approved by:	re (ksmith)
2009-08-02 14:28:40 +00:00
Jung-uk Kim
35ea6959ac Get correct maxio from the controller and drop the tunable.
The default (64K) is too pessimistic for "new comm" hardware.
Also, this is bad because multiple controllers get limited by
the global tunable.

Reviewed by:	scottl
Approved by:	re (kensmith)
2009-07-11 08:10:18 +00:00
Warner Losh
00b4e54ae7 We no longer need to use d_thread_t, migrate to struct thread *. 2009-05-20 17:29:21 +00:00
Ed Maste
4824be888b SVN rev 188743 modified aac_rx_get_fwstatus to use the AAC_RX_OMR0
register instead of AAC_RX_FWSTATUS, as that is the way it's done in
Adaptec's vendor driver and in the Linux drivers.  (The same applies
to aac_rkt_get_fwstatus as well.)

However, a concern has been raised about the compatibility of this
change and old hardware / firmware versions.  In the absense of
specific information, revert to the original behaviour if the firmware
does not support the "New comm." interface.  Users of old cards or
firmware haven't reported the problems that are potentially solved by
switching to OMR0.
2009-02-23 18:22:06 +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
8d5b55c37f Use outbound message register 0 instead of mailbox 7 in
aac_{rx,rkt}_get_fwstatus, as done in Adaptec's vendor driver as well as
the Linux drivers.

Submitted by:   jkim, from Adaptec's driver
2009-02-18 01:36:20 +00:00