Commit Graph

40 Commits

Author SHA1 Message Date
Scott Long
4b22ce0730 The TWE driver should have been marked with gone_in for FreeBSD 13.x,
but was missed.  Mark it for gone_in 14.0.  The hardware hasn't been
produced or supported in over 20 years, and even back then it was
known to be electrically unreliable and prone to catastrophic failure.
2022-02-26 11:40:17 -07:00
Scott Long
b6ac753a88 Fix "set but not used" in twe. 2022-02-26 11:16:31 -07:00
Mateusz Guzik
b4492420b6 twe: clean up empty lines in .c and .h files 2020-09-01 21:31:50 +00:00
Scott Long
d176b8039e Ever since the block layer expanded its command syntax beyond just
BIO_READ and BIO_WRITE, we've handled this expanded syntax poorly in
drivers when the driver doesn't support a particular command.  Do a
sweep and fix that.

Reported by:	imp
2020-02-07 09:22:08 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Alexander Motin
6f954fb36b Remove MAXBSIZE use from drivers where it has nothing to do.
In some cases limits are just not needed, in others -- DFLTPHYS is the
right constant to use instead.

MFC after:	1 month
2015-03-22 16:10:28 +00:00
John Baldwin
51ba7b6f3e Remove remaining 4.x compat shims. No resulting changes (verified by
md5).
2012-09-07 18:41:19 +00:00
John Baldwin
1832280a9e - Explicitly call twe_done() to poll the hardware when looping in
twe_start() to simulate the behavior on 4.x where the driver dropped
  spl to allow interrupts to run to free up space in the command
  queue.  Be careful to only poll if we are going to make at least
  one more attempt to queue the current command.  Also, when polling,
  be careful to not call twe_startio() to queue more commands to avoid
  recursion.
- Move the buffer for formatting AEN messages into the softc instead of
  using a single driver-wide static buffer.

Requested by:	scottl (1)
Tested by:	Mike Tancsa @ Sentex
2012-09-05 14:31:58 +00:00
John Baldwin
06e8730c59 Add locking to the twe(4) driver and make it MPSAFE:
- Add per-controller configuration (sx) and I/O (mutex) locks.  The
  configuration lock protects the relationship of volumes and drives
  while the I/O lock protects access to the controller's registers and
  the main I/O path.
- Remove some checks for M_WAITOK malloc()'s failing.
- Remove the explicit bus space tag/handle from the softc and use
  bus_*() rather than bus_space_*().
- Reuse the existing new-bus sysctl context instead of creating a
  new one.
- Remove compat shims for FreeBSD 4.x.
- Use pci_enable_busmaster() rather than doing it by hand, and rely
  on bus_alloc_resource() to enable PCI I/O decoding.

Tested by:	Mike Tancsa  mike sentex net
Reviewed by:	scottl (partially)
MFC after:	1 month
2012-08-13 21:29:34 +00:00
Alexander Motin
c078c19633 Teach twe driver to report array stripe size to GEOM. 2009-12-25 17:34:43 +00:00
Roman Divacky
fd3c9374ff Change the command argument to ioctl routines to u_long to avoid
truncating the command to 32bit on 64bit archs where int is 32bit
(ie. amd64).

Approved by:	scottl
Approved by:	ed (mentor, implicit)
2009-09-22 16:28:07 +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
Christian Brueffer
a02b3966fc Add missing \n.
PR:		120341
Submitted by:	CyberLeo <cyberleo@cyberleo.net>
Approved by:	rwatson (mentor), aradford@amcc.com
MFC after:	3 days
2008-02-12 08:58:26 +00:00
Vinod Kashyap
7a824c3756 Undoing recent changes to make 3ware's i386 tools work on amd64, since there are
now amd64 versions of CLI and 3DM2 available.
2005-02-17 19:05:42 +00:00
Scott Long
8a87dc6fd9 Fix crashdumps on twe. The twe_immediate_request() path was not only
copying data to a temporary buffer before the I/O, but also copying that
temporary buffer back to the original data location after the I/O.  When
you're dumping kernel heap and stack and protected pages, this is very
very bad.

A belated thanks to Robert Watson for donating hardware for this (and future)
work.

MFC after: 3 days
2005-02-08 03:43:02 +00:00
Peter Wemm
d6ef0bf119 Recognize the 32-bit form of the twe binary passthrough ioctl()s so that
there is some hope for the 32-bit management utilities to run.  I've used
the cli successfully, but 3dm2 doesn't work for other reasons.  Of course,
a native binary of the 3dm2 and cli would be much better, but that doesn't
exist.
2004-12-17 17:45:29 +00:00
Vinod Kashyap
75e4d88db4 Fix for a problem seen only on 6xxx series controllers, where-in the
driver tries to submit the same request repeatedly, on finding the
controller cmd queue to be full.

Submitted by:ps, vkashyap
Reviewed by:re
Approved by:re
2004-06-11 18:42:44 +00:00
Vinod Kashyap
088113ed0b 1. Fixed potential problem that would cause out-of-order requests in twe_startio.
2. Changed version.

Submitted by: scottl
Reviewed by: vkashyap
Approved by: re
2004-05-12 04:10:37 +00:00
Vinod Kashyap
c2d083bbba 1. Better handle a return value of EINPROGRESS from bus_dmamap_load.
2. Check for bad return value from twe_map_request in places where there
   was no checking.

Reviewed by: ps
2004-03-25 19:30:35 +00:00
Colin Percival
27021df2ff Fix off-by-one error: sc->twe_drive is an array of TWE_MAX_UNITS elements.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
2004-02-22 01:03:38 +00:00
Paul Saab
a85e26c4bf After extensive QA cycles at 3ware, bring the driver in-line with all the
issues which they found and asked to be changed so 3ware can offcially
support the driver.

Summary of the most significant changes:

- TWE_OVERRIDE is no longer supported
- If twe_getparam failed, bogus data would be returned to the caller
- Cache the device unit in the twe_drive structure to aid debugging
- Add the 3ware driver version.
- Proper return error codes for many functions.
- Track the minimum queue length statistics
- 4.x compat: use the cached unit number from the twe_drive structure
  instead of the the cached si_drv2.  3ware found that after many loads
  and unloads that si_drv2 became corrupted.  This did not happen in
  -current.

Submitted by:	Vinod Kashyap (with modifications by me)
Approved by:	re (rwatson)
2003-12-02 07:57:20 +00:00
Paul Saab
ad8fc00c75 Don't tsleep on NULL 2003-08-19 12:22:17 +00:00
Paul Saab
f487e0e2df Fix the busdma support in twe to support EINPROGRESS and enable it for
use with PAE kernels.
2003-08-12 06:38:55 +00:00
Paul Saab
235a79707a Properly support the 3ware generic API.
- Build SGL's for ATA_PASSTHROUGH commands
- Fallback to using the sgl_offset when the opcode is unknown for building
  SGL's/
- Add ioctl calls for adding and removing units.
- Define previously undefined AEN's
- Allocate memory for the ioctl payload in multiples of 512bytes.

MFC after:      1 week
2003-08-05 19:55:21 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Archie Cobbs
4a6a94d8d8 Replace (ab)uses of "NULL" where "0" is really meant. 2002-08-22 21:24:01 +00:00
Mike Smith
3f1166f04c Update for the 6.9 firmware family (6xxx controllers), as well as for
the upcoming 7.4 family (7xxx controllers).

 - improved error reporting and handling
 - more diagnostic output
 - add extra command packet definitions
 - merge sources again with -stable
2002-03-07 09:55:41 +00:00
Peter Wemm
d62e201b7b Fix some unused warnings. One function is only used if
TWE_SHUTDOWN_NOTIFICATION is defined, the other two are never used.
2002-02-27 23:59:35 +00:00
Mike Smith
282070b3e8 Minor updates:
- Rework of twe_report_request to use the command status value rather
   than the flags register. (Joel Jacobson @ 3ware)
 - Update to match some changes in -current vs. stable.

MFC in: 1 week
2001-05-07 21:46:44 +00:00
Mike Smith
358cd20f3a Typo fix; use & to test for bits set in the status register.
Submitted by:	Joel Jacobson <jake@3ware.com>
2001-02-26 20:13:19 +00:00
John Baldwin
6db2e28142 Remove a prototype for an unused and undefined debugging function. 2001-01-23 22:21:14 +00:00
Mike Smith
b09d2ca319 - add support for crashdumps (courtesy of ps and Y!)
- standardise error reporting for commands
 - simplify the driver-to-controller bio transfer
 - add bio in/out accounting
 - correctly preserve the command ID in twe_ioctl (thanks to joel@3ware)
2000-12-03 02:11:35 +00:00
Mike Smith
76ba114c80 If we can't get a command to back the bio we just took off the queue,
put the bio back, otherwise we'll drop it when we bail.  This was
causing bio lossage under load, leading to eventual system lockup.
2000-11-03 16:11:05 +00:00
Mike Smith
d1702591ac Add a missing newline to a diagnostic. 2000-10-27 05:58:16 +00:00
Mike Smith
e6c12d85d0 Major update to the 'twe' driver.
- Layout reorganisation to enhance portability.  The driver now has
   a relatively MI 'core' and a FreeBSD-specific layer over the top.
   Since the NetBSD people have already done their own port, this is
   largely just to help me with the BSD/OS port.

 - Request ID allocation changed to improve performance (I'd been
   considering switching to this approach after having failed to come
   up with a better way to dynamically allocate request IDs, and seeing
   Andy Doran use it in the NetBSD port of the driver convinced me
   that I was wasting my time doing it any other way).  Now we just
   allocate all the requests up front.

 - Maximum request count bumped back to 255 after characterisation
   of a firmware issue (off-by-one causing it to crash with 256
   outstanding commands).

 - Control interface implemented.  This allows 3ware's '3dm' utility to
   talk to the controller.  3dm will be available from 3ware shortly.

 - Controller soft-reset feature added; if the controller signals a
   firmware or protocol error, the controller will be reset and all
   outstanding commands will be retried.
2000-10-25 06:59:06 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Mike Smith
2597312222 Initial import of a driver for the 3ware Escalade family of ATA RAID
controllers.
2000-05-24 23:35:23 +00:00