Commit Graph

29 Commits

Author SHA1 Message Date
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
b04e4c122b Remove FreeBSD 4.x compat shims. Verified by md5. 2012-09-26 14:17:14 +00:00
John Baldwin
0fca6f8bf5 Add locking to mlx(4) to make it MPSAFE along with some other fixes:
- Use callout(9) rather than timeout(9).
- Add a mutex as an I/O lock that protects the adapter and is used
  for the I/O path.
- Add an sx lock as a configuration lock that protects the relationship
  of configured volumes.
- Freeze the request queue when a DMA load is deferred with EINPROGRESS
  and unfreeze the queue when the DMA callback is invoked.
- Explicitly poll the hardware while waiting to submit a command to
  allow completed commands to free up slots in the command ring.
- Remove driver-wide 'initted' variable from mlx_*_fw_handshake() routines.
  That state should be per-controller instead.  Add it as an argument
  since the first caller knows when it is the first caller.
- Remove explicit bus_space tag/handle and use bus_*() rather than
  bus_space_*().
- Move duplicated PCI device ID probing into a  mlx_pci_match() routine.
- Don't check for PCIM_CMD_MEMEN (the PCI bus will enable that when
  allocating the resource) and use pci_enable_busmaster() rather than
  manipulating the register directly.

Tested by:	no one despite multiple requests (hope it works)
2012-09-17 15:27:30 +00:00
Scott Long
b6f97155cc Convert a number of drivers to obtaining their parent DMA tag from their
PCI device attachment.
2012-03-12 08:03:51 +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
Christian S.J. Peron
648fd2bd0b Add missing parenthesis around error handling code upon attaching
mlx devices. This fixes an issue where mlx device drives fail to be
detected at system boot.

This is a RELENG_6 candidate.

Submitted by:	oliver
PR:		kern/84163
2005-07-30 15:53:40 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Poul-Henning Kamp
23db907c0f Don't call mlx_free() i mlx_attach() in case of failure. Doing so
in mlx_attach_pci() is much cleaner.

Inspired by:	Coverity
2005-03-26 21:58:09 +00:00
David Schultz
730eb84011 If mlx_attach() returns an error, don't free sc again.
Spotted by:	Ted Unangst using the Coverity Prevent static analysis tool
Reviewed by:	scottl
2005-03-18 05:43:37 +00:00
Warner Losh
6b9907e7f8 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:10:49 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
38d8c9940b Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:42:59 +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
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
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
Mike Smith
15fd5d220f Driver modifications consistent with my other drivers to facilitate
the use of a single set of sources across 4.x and 5.x branches.

No significant code changes.
2001-06-25 04:32:31 +00:00
Matthew N. Dodd
9b11c7ba44 Avoid hardcoding the 'rid' and 'type' of the MEM/IOPORT resource.
Store the 'rid' and 'type' in the softc and use them in mlx.c:mlx_free().

EISA and MCA front ends will require this.

Approved by:	 msmith
2000-11-28 06:17:32 +00:00
Mike Smith
e10f2ee576 Return -10 from the PCI probe to allow room for an updated driver to
override one built into the kernel.
2000-10-28 10:46:30 +00:00
Mike Smith
786cd128a8 Add support for 2.x/3.x firmware adapters which are too old to have a
memory-mapped register window.  This closes the last known issue with
2.x vintage adapters.
2000-08-04 06:52:00 +00:00
Mike Smith
baff09db2c Change the way that scatter/gather list tables are allocated so that we
can use all of the s/g entries available on smaller cards.  This is
necessary if we want to be able to handle a non-page-aligned 64k transfer
on 2.x and 3.x firmware.

Fix a missing splx() that may have left us at splbio() for longer than
desired.

Reduce shadowing of controller-supplied parameters a little.
2000-05-06 08:54:33 +00:00
Poul-Henning Kamp
9626b608de Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by:    peter
2000-05-05 09:59:14 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Mike Smith
da8bb3a3bf Update to the latest development version of the Mylex driver. Changes in
this version include:

 - Support for version 2.x firmware (2.42 or later recommended).  This
   means we are the only open-source driver supporting these adapters.
   This code has only been tested on a Digital KZPCA adapter in an Alpha
   system, but is believed to be correct.  NOTE: EISA adapters are not
   yet supported.

 - Support the BIOS/Firmware initialisation handshake protocol.  This
   allows the driver to bring the card up to operational state even if
   the BIOS can't be run (eg. if it's an x86 BIOS in an Alpha system).

 - A working command pasthrough interface.  This allows a user-space
   configuration tool (under development) to issue arbitrary commands
   to the controller or to devices in the system.
2000-03-18 02:01:37 +00:00
Mike Smith
5792b7fe0b Major update to the Mylex DAC960 driver adding new hardware support
and fixing some major bugs.

 - Add support for the v5 firmware interface, used by the DAC1164P
   (tested) and AcceleRAID 352 (untested but should work).  We now cover
   all of the Mylex family's protocols except for v2 (used by EISA and
   Alpha-compatible cards).

 - Fix an accounting bug which resulted in endless 'poll still busy'
   messages.  In situations of high controller load the count of poll
   commands could be incremented without actually successfully launching
   a command.  This totally removes the accounting for status poll
   commnads; it was its own worst enemy.

 - Add some simple reentry prevention locks to processing of the waiting
   and completed command queues to prevent races which could result in
   I/O being done or completed twice (both are fatal).  This highlights
   a need for simple locking primitives in both the UP and SMP kernels.

 - Streamline the handling of command completion to reduce the amount of
   redundant work being done.  Remove the code which tests for commands
   that have gone missing in action; nobody has ever seen one of these
   and it wouldn't have worked properly anyhow.

 - Handle disconnection of drives from the controller in the detach,
   not shutdown method.  This avoids problems flushing the cache in
   a panic when a drive is mounted.

 - Don't call bus_generic_detach when disconnecting drives; it doesn't
   actually do anything useful.

 - Increment the log message index regardless of whether we actually
   retrieved one or not.  If we run into a message that we can't fetch,
   we don't want to spin endlessly complaining about the fact.

 - Don't assume that interrupts will work when we're flushing the
   controller.  We may think they are enabled, but in eg. a panic
   situation the controller may not be able to deliver an interrupt.
1999-12-11 00:00:13 +00:00
Mike Smith
4b006d7bb7 Move some hardware-related items to the hardware-related header.
Shift to using the same queueing strategy that the amr driver uses.
Some simple tests indicate that we use about 2% of the CPU at around
500tps with the controller completely saturated with I/O.
1999-10-26 23:20:43 +00:00
Mike Smith
f6b84b08c9 Add support for the version 4 firmware interface and the DAC960 PG and
PJ cards.  This will probably also support the AcceleRAID and
eXtremeRAID cards, but nobody has volunteered one for testing, so I
haven't enabled their PCI device IDs.

Slightly clean up communication between the disk devices and the
controller device as per new practice, and move some more register-
related items int mlxreg.h from mlxvar.h.

Remove some unnecessary read-modify-write operations to the card
control registers; they don't behave like that.

Increase the status polling interval to 10 seconds.  It's still possible
to load the card up to the point where a status poll will find the
previous poll still running, but this will reduce the incidence of
complaints.
1999-10-14 02:54:06 +00:00
Mike Smith
1ac4b82b11 This is a driver for the Mylex DAC960 family of integrated RAID
controllers.  It currently supports the P, PL, PD and PU variants,
with more to be supported shortly.
1999-10-07 02:20:32 +00:00