Commit Graph

298 Commits

Author SHA1 Message Date
Christian Brueffer
7598d04984 Correct the names or some Adaptec and ICP devices, verified by the
respective websites.

Reviewed by:	scottl
Approved by:	rwatson (mentor)
MFC after:	5 days
2006-06-17 18:42:26 +00:00
Scott Long
93cfca2294 Rearrange locking in the alloc_commands and ioctl paths to avoid problems. 2006-04-08 06:05:29 +00:00
Scott Long
065dd78ccf Initialize the event tailq.
Submitted by: Frank Mayhar
PR: kern/90882
MFC After: 1 day
2005-12-28 21:18:55 +00:00
Jens Schweikhardt
3a5c0f9218 Remove the unused AAC_DRIVER_BUILD_DATE macro.
Nuke whitespace at EOL while I'm here.

Approved by:	scottl (MAINTAINER)
2005-11-13 17:26:36 +00:00
Scott Long
2419217b8d Refactor the PCI probe code a bit. 2005-11-06 22:52:52 +00:00
Christian S.J. Peron
1ffe41c1ec Pickup I/O lock in aac_get_bus_info, as this code will call
aac_alloc_sync_fib(). aac_alloc_sync_fib() will assert that the I/O locks
are held. This fixes a panic on system boot up  when the aac(4) device's
bus_generic_attach() routine is called.

Reviewed by:	scottl
2005-10-31 00:12:19 +00:00
Scott Long
a441b3fc97 Fix a regression that prevented PERC3 hardware from working. Apparently they
do not support the GETINFO immediate command, unlike just about every other
variant of the hardware.  Also document some magic values and fix some minor
nearby whitespace.

MFC After: 3 days
2005-10-14 16:22:45 +00:00
Scott Long
81b3da088a Fix a missing set of lock operations.
Submitted by: green
PR: 87191
2005-10-10 20:13:31 +00:00
Scott Long
8eeb2ca6bf Ue a better msleep identifier. Fix some whitespace. 2005-10-08 22:41:57 +00:00
Scott Long
7a48c6d4ea aac_intr0 rotted long ago, remove it. 2005-10-08 22:36:54 +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
2b3b0f1721 Use time_uptime for timing commands instead of time_second. This is a bit
risky because the "current time" is supposed to be fed to the card during
initialization, and the current time is supposed to be put into each command
that is sent to the card.  Hopefully either the card doesn't actually care
about the timestamps, or it doesn't care about the absolute values so long
and the relative values are consistent.  Not an MFC candidate until more
thorough testing can be done.
2005-09-14 05:46:28 +00:00
Paul Saab
16ee26fd9b Add support for HP branded 2610SA
MFC after:	3 days
Approved by:	scottl
2005-08-08 19:39:58 +00:00
Scott Long
64682a68e2 Retire the FreeBSD 4.x compat code and __FreeBSD_version checks from the aac
driver.
2005-08-08 12:19:19 +00:00
Scott Long
1b3a4f4e7b Check the vendor and device, not subvendor and subdevice, when looking for
channel devices.  This should fix Dell 2450/2550/2650 systems that have RAID
enabled.  This will likely not fix 2400 systems though as I don't have the
appropriate PCI Id info for them.

MFC After: 3 day
2005-07-14 17:43:00 +00:00
Scott Long
b1c56c68b0 Add a text description for the Intel IOP302/303 processors. Be slightly
more verbose about the allocation of RAM on the controller.

Sbumitted by: Jeremy Chadwick
PR: kern/81259
MFC-After: 3 days
2005-06-01 07:11:17 +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
Scott Long
cbe4fd54ef Fix some busdma API violations in the dumpsys handler.
MFC After: 3 days
2005-05-02 22:56:52 +00:00
Sam Leffler
83888a7f30 purge dead code
Noticed by:	Coverity Prevent analysis tool
2005-03-26 23:37:54 +00:00
Scott Long
b5f516cdaf Handle failures better in the passthrough bus creation code.
Submitted by: Coverity Prevent analysis tool
2005-03-19 06:29:32 +00:00
Warner Losh
494f3ca182 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 19:24:22 +00:00
Scott Long
29c711f038 Remove the messy locking dance around xpt_done() 2005-02-09 11:50:16 +00:00
Scott Long
d563f671c3 Fix whitespace 2005-01-23 16:13:10 +00:00
Scott Long
608d7ac260 Add a default driver to attach to the "hidden" scsi channels of the Dell
PERC 3 controllers.  This is needed to keep the PM code from powering them
down.
2005-01-07 05:59:45 +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
ecefe5717e Add the PCI ID for the Adaptec 2230SLP card.
Submitted by: Ray Gilstrap
2004-12-15 07:03:21 +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
1248408df3 Don't force busdma to pre-allocate bounce pages for static allocations. 2004-11-21 04:03:29 +00:00
Scott Long
b1e56e58c5 Add support for the 21610SA 16-channel SATA card. Thanks to Adaptec for
providing hardware for testing.
2004-10-21 19:14:32 +00:00
Scott Long
15c37be013 If the timeout handler runs and notices that commands are timed out, check
the firmware status register on the card to see if the firmware is still
running.  There is no way to recover from this, but at least it can give
a hint as whether the car has crashed (which happens all too often).

MFC after: 3 days
2004-09-16 02:37:40 +00:00
Scott Long
bd971c4961 Put some of the probe messages under bootverbose so to lessen the noise. 2004-09-12 03:19:32 +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
dc9efde5b7 Destroy mutexes on detach. 2004-08-12 05:31:17 +00:00
Scott Long
ba1d57e7d9 Change FREE() to free() 2004-08-12 05:09:17 +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
3576af8fd7 Release the sync fib after the controller has been shut down. This also
releases the I/O lock instead of just leaking it.
2004-08-12 04:47:32 +00:00
Alexander Kabaev
eec256de79 Avoid casts as lvalues. 2004-07-28 06:21:53 +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
David E. O'Brien
13709702ba Cast printf'ed values to intmax_t. 2004-06-13 17:57:15 +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
614c22b2a2 Commit the correct version of the patch from last night. This fixes an
immediate panic when doing any i/o, and it closes a completion race.
2004-06-01 15:50:11 +00:00
Scott Long
397fa34f51 Collapse aac_map_command() into aac_startio(). Check the AAC_QUEUE_FRZN in
every iteration of aac_startio().  This ensures that a command that is
deferred for lack of resources doesn't immediately get retried in the
aac_startio() loop.  This avoids an almost certain livelock.
2004-06-01 05:32:26 +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
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Dag-Erling Smørgrav
7cec30e791 Unbreak the build. 2004-05-13 19:15:21 +00:00
Scott Long
d7f2f66e08 Enable INTR_ENTROPY if the interrupt is not set to INTR_FAST. Remove the
testing and setting of the INTR_ENTROPY macro as it is not needed in
FreeBSD 5.x.

Submitted by:	Alex Vasylenko
2004-05-13 16:02:18 +00:00
Scott Long
d8a0a47347 Remove the 'timeout' argument from aac_wait_command() as it isn't used and
never will be.  Update the XXX comment for this function to accurately reflect
why things are the way they are.
2004-04-14 19:11:29 +00:00
Scott Long
ad452e6553 Don peril-sensitive sunglasses and add PCI Id's for two new cards. I've
only done minimal testing on one of these cards and the firmware folks
have been extremely uncooperative in answering my qeustions about them, so
hopefully they will work ok for everyone.
2004-03-20 21:07:36 +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
John Baldwin
6074439965 kthread_exit() no longer requires Giant, so don't force callers to acquire
Giant just to call kthread_exit().

Requested by:	many
2004-03-05 22:42:17 +00:00
Scott Long
75fba44b93 Revert the last commit. I don't know what I was thinking, but this change
definitely doesn't help any thing.
2004-02-25 05:41:44 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Scott Long
41a1325df9 Fix a major brain-o. If the command needs to be put on the deferred queue,
take it off of the busy queue first.  This should fix the 'command is on
another queue' panic that showed up recently.
2004-02-21 05:32:40 +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
f893fdd54e Fall back to INTR_MPSAFE if INTR_FAST registration fails.
PR:	kern/62276
2004-02-09 05:29:05 +00:00
Scott Long
8b60cc16ab Remove the use of AACQ_COMPLETE here since there is no longer a completion
queue.
2004-02-07 20:54:29 +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
4102d44b77 If a command has to be deferred because there are no more resources for it
on the card, unmap it first.  This allows it to be picked up properly when
the queue gets kicked again.  This was the root problem for the lost command
(i.e. stuck in getblk/vinvalb) problem.  While here, panic if commands don't
map correctly instead of just silently ignoring the problem and dropping
command.  Also slow down the dynamic allocation of new commands.

It should be safe to go back into the aac waters.  Thanks to everyone who
suffered through this and provided good feedback.
2004-02-07 10:30:22 +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
a32a982d4a - Broaden the scope of locking in aac_command_thread() again to catch some
edge cases in the loop.

- Try to grab a command before dequeueing the bio from the bioq.  The old
  behaviour of requeuing deferred bios to the end of the bioq is arguably
  wrong.  This should be fixed in the future to check the bioq head without
  automatically dequeueing the bio.
2004-02-07 03:26:38 +00:00
Scott Long
9768efef88 Add an #ifdef _KERNEL so that this file can be used from userland. 2004-02-07 03:20:07 +00:00
Peter Wemm
786f2a4079 Make LINT compile on amd64 2004-02-06 01:47:52 +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
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
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
Scott Long
f29f42fce7 Remove a bogus PCI ID entry. 2003-11-01 00:13:43 +00:00
Mike Silbersack
184dcdc7c8 Change all SYSCTLS which are readonly and have a related TUNABLE
from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide
more useful error messages.
2003-10-21 18:28:36 +00:00
Scott Long
3df780cf76 Fix a couple of bugs with AIF handling:
- Correct the logic for the AIF array index pointers so that correct slot is
   always looked at.
 - Copy the full FIB payload size when copying AIF's, not just the first 64
   bytes.

Thanks to Mirapoint, Inc, for pointing these problems out and offering a
solution.
2003-10-17 21:44:06 +00:00
Scott Long
c567467af2 Eliminate the use of a statically assign major number for the aac device. 2003-09-29 14:10:04 +00:00
Scott Long
7753acd255 Correctly wrap the producer queue index when dequeuing commands. This wasn't
a problem for command responses since we rarely ever filled the queue.
However, adapter-initiated commands have a much smaller queue and could
tickle this bug.  It's possible that this might fix the recently reported
problems with the aac-2120s, though I haven't been able to reproduce the
problem locally.

MFC-After: 1 day
2003-09-16 16:07:15 +00:00
Scott Long
5b80c0d74d Use PCIR_BAR() instead of a magic offset. 2003-09-09 06:44:58 +00:00
Scott Long
8778f63db2 Commands submitted through the management interface won't have scatter/
gather lists.  Stop ignoring them and instead call the callback directly.
This unbreaks the management interface.
2003-09-01 20:44:18 +00:00
Scott Long
0bcbebd6df If ~ chars were pennies, I'd be pennyless. This should fix all of the
'command not in queue' panics.  Also fix a nearby style problem.
2003-09-01 00:20:29 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
dc5f7dd01b Prefer the new location of dev/pci/pci*.h. 2003-08-22 05:09:35 +00:00
Maxime Henrion
36ffc09c55 Fix build by correcting a wrong cast. 2003-08-20 08:24:49 +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
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
204c0bef67 Fix a missing } that got dropped from the last commit. 2003-07-09 19:30:30 +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
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
Scott Long
ed3392975b Fixing some glaring problems with aac_disk_dump().
- Mark that it cannot handle greater than 4GB of RAM at this time.  Fixing
   that will come later.  Fail any attempts to dump above thati limit.
 - If a call to aac_disk_dump() needs to be split into multiple i/o's,
   increment the virtual offset after each i/o instead of just dumping the
   same offset over and over again.
 - Bail out if bus_dmamap_load() returns an error.  Error recovery is likely
   not possible.
2003-06-19 01:49:04 +00:00
Scott Long
795d7dc093 When scanning for changed containers, don't assume that the controller
will respond in a sane manner.

Thanks to Petri Helenius <pete@he.iki.fi> for spotting this and pestering
me to fix it.
2003-06-03 02:10:55 +00:00
Scott Long
9d5be300d3 Add support for the upcoming 2410SA card.
Approved by:	re (telecon)
2003-05-30 09:22:19 +00:00
Scott Long
149af931ca Don't pass pointers to kernel data structures through 32-bit fields
as 64-bit architectures won't like this.  Use virtual array indexes
instead.  This *should* allow the driver to work on 64-bit platforms,
though it's still not endian clean.
2003-04-28 06:16:20 +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
a4d7a3c069 Include <sys/conf.h> rather than trusting <sys/disk.h> to do so. 2003-04-01 12:35:17 +00:00
Scott Long
b85f5808f8 Add the ability to send 64-bit scatter/gather elements to aac cards. This
is enabled when both the size of bus_addr_t > 4 and the card claims support.

Don't wake up the kthread to allocate more commands if we know that we've
already allocated the max number of commands.
2003-03-30 21:47:16 +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
Scott Long
6f420b1756 Now that bus_dmamem_alloc() handles its Giant mutex requirements itself,
don't bother doing the same in the code that calls it.
2003-03-13 22:56: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
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +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
7874f606d5 Introduce a new taskqueue that runs completely free of Giant, and in
turns runs its tasks free of Giant too.  It is intended that as drivers
become locked down, they will move out of the old, Giant-bound taskqueue
and into this new one.  The old taskqueue has been renamed to
taskqueue_swi_giant, and the new one keeps the name taskqueue_swi.
2003-02-26 03:15:42 +00:00
Scott Long
13f9c3024f Use BUS_SPACE_MAXADDR_32BIT in the DMA tag where needed. Before the recent
fix to BUS_SPACE_MAXADDR, we were probably bouncing quite a bit =-(
2003-02-26 02:55:58 +00:00
Scott Long
7540e65e84 Move to 'struct disk*' API
Submitted by:	phk
2003-02-26 02:50:27 +00:00
Poul-Henning Kamp
2c6b49f6af NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.

Dumper_t takes a void * as first arg which is more general than the
dev_t taken by d_dump_t.  (Remember: we could have net-dumpers if
somebody wrote us one!)

Define the convention for GEOM controlled disk devices to be that the
first argument to the dumper function is the struct disk pointer.

Change device drivers accordingly.
2003-02-21 19:00:48 +00:00
Poul-Henning Kamp
b82ff75854 NO_GEOM cleanup:
Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
2003-02-21 15:13:26 +00:00
Scott Long
65ac4ed65e On detach, don't remove the child from our list of children unless it has
successfully detached.
2003-02-20 23:13:48 +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
9c3a7fce37 Make the aac driver be INTR_MPSAFE. Once the interrupt handler determines
that a command completion happened, all further processing is deferred to
a taskqueue.  The taskqueue itself runs implicetely under Giant, but we
already used a taskqueue for the biodone() processing, so this at least
saves the contesting of Giant in the interrupt handler.
2003-02-19 21:58:34 +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
ddb8683e59 Teach the CAM module how to deregister itself so it can be unloaded. 2003-02-06 03:31:02 +00:00
Scott Long
a761a1ca60 Free the container and sim objects on detach. Convert several uses of
MALLOC to malloc.
2003-02-06 00:37:37 +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
Scott Long
128aa5a022 Hack around a bug in the 2200 and 2120 controllers that connot DMA
commands from below the first 8K of physical memory.  A better fix
is to modify the busdma api to allow either inclusion ranges or
multiple exclusion ranges, but that debate is for another day.

MFC After:	2 days
2003-01-23 01:01:44 +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
f30ac74cb0 Major bugfixes for large memory and fast systems.
aac.c:
        Re-arrange the interrupt handler to optimize the common case of
        the adapter interrupting us because one or more commands are complete,
        and do a read across the pci bus to ensure that all posted status
        writes are flushed.  This should close a race that could cause command
        completion interrupts to be lost.
        Follow the spec a bit closer when filling out command structures.
        Enable the Fast Response feature to eliminate the need for the card
        to DMA successfull command completions back into host memory.
        Tell the controller how much physical memory we have.  Without this
        there was a chance that our DMA regions would collide with the
        memory window used by the cache on the controller.  The result would
        be massive data corruption.  This seemed to mainly affect systems with
        >2GB of memory.
        Fix a few whitespace problems.

aac_debug.c:
        Add an extra diagnostic when printing out commands.

aac_disk.c:
        Add extra sanity checks.

aacreg.h:
        Prepare for making this 64-bit clean by reducing the use of enumeration
        types in structures.

Many thanks to Justin Gibbs for helping track these down.
2003-01-11 01:59:21 +00:00
Robert Watson
9e9466baf3 Use OPERATOR instead of WHEEL for make_dev(), use 0640 instead of 0644
for disk devices to be consistent with other storage devices.

Submitted by:	kris
Reviewed by:	scottl
2002-12-27 17:52:16 +00:00
Scott Long
a9f3d2c756 sable the CAM interface on some more cards. It seemed to be confusing and
upsetting the firmware there.

Thanks to imp@freebsd.org for suffering through testing with this.

Approved by:	re
2002-12-12 22:23:06 +00:00
Poul-Henning Kamp
4294d700d6 Fix mis-indentation.
Approved by:	scottl
2002-10-20 16:00:43 +00:00
Scott Long
316ec49abd Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create.  Passing the
value 0 prevents the alternate kstack from being created.  Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.

Reviewed by:	jake, peter, jhb
2002-10-02 07:44:29 +00:00
Scott Long
7419815d60 The AAC_COMPAT_LINUX option was really annoying, since it made the
aac driver dependent on the linux emulation module.  This was
especially bad for the release engineers who tried to move the
aac driver from the kernel onto the drivers floppy.  The linux
compat bits for this driver are now in their own driver, aac_linux.
It can be loaded as a module or compiled into the kernel.  For
the latter case, the AAC_COMPAT_LINUX option is needed, along with
the COMPAT_LINUX option.

I've tested this in every configuration I can think of.  This is an
MFC candidate for 4.7.

Idea from:	rwatson
MFC after:	3 days
2002-09-25 05:00:25 +00:00
Alfred Perlstein
4f492bfab5 use __packed. 2002-09-23 18:54:32 +00:00
Poul-Henning Kamp
7812d86f03 (This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)

If struct disklabel is the messenger: kill the messenger.

Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer).  This commit changes this communication to use four
explicit fields instead.

Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.

Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.

The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.

This concludes (modulus any mistakes) the series of disklabel related
commits.

I belive it all amounts to a NOP for all the rest of you :-)

Sponsored by:   DARPA & NAI Labs.
2002-09-20 19:36:05 +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
Scott Long
eb3025b3ed The aac driver needs 256K of contiguous physical memory in order to
attach.  If it can't get that (highly likely if loaded as a module on
a system that's been up for a while), give a more descriptive error
message.
Also clean up some nearby style nits.

MFC after:	2 days
2002-08-30 05:02:07 +00:00
Robert Watson
d49fa1ca6e In continuation of early fileop credential changes, modify fo_ioctl() to
accept an 'active_cred' argument reflecting the credential of the thread
initiating the ioctl operation.

- Change fo_ioctl() to accept active_cred; change consumers of the
  fo_ioctl() interface to generally pass active_cred from td->td_ucred.
- In fifofs, initialize filetmp.f_cred to ap->a_cred so that the
  invocations of soo_ioctl() are provided access to the calling f_cred.
  Pass ap->a_td->td_ucred as the active_cred, but note that this is
  required because we don't yet distinguish file_cred and active_cred
  in invoking VOP's.
- Update kqueue_ioctl() for its new argument.
- Update pipe_ioctl() for its new argument, pass active_cred rather
  than td_ucred to MAC for authorization.
- Update soo_ioctl() for its new argument.
- Update vn_ioctl() for its new argument, use active_cred rather than
  td->td_ucred to authorize VOP_IOCTL() and the associated VOP_GETATTR().

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-17 02:36:16 +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
Peter Wemm
7d05a38314 Fix deprecated use of label at end of compound statement 2002-05-24 05:58:13 +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
Tom Rhodes
d394511de3 More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
Scott Long
c52bf372f5 Update the PCI table as per Dell's fickleness.
MFC after:	3 days
2002-05-12 04:30:28 +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
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
Scott Long
ce2d4dd7f1 Add the PCI ID for an upcoming variant of a soon-to-be released series of
cards.
2002-04-18 15:47:31 +00:00
Scott Long
fee435e8ac Add support for the Dell 2650
Submitted by:	andrew_bachler@dell.com
2002-04-05 20:00:29 +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
671eafe203 Add support for the PERC3/Di found in the Dell 1650
Submitted by:	mp
2002-04-02 21:49:26 +00:00
Poul-Henning Kamp
67cd130e59 The AAC, TWE and IDA diskdrivers cannot dump until I and msmith
have ripped all the i386 specific formatting code from their
dump routines.  Due to the potential for trashing disks, I did
not want to do this "blind".
2002-03-31 22:29:52 +00:00
Scott Long
0e6020f359 Add ID's for a couple of upcoming cards.
MFC after:	1 day
2002-02-13 07:44:43 +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
Alfred Perlstein
a4db49537b Replace ffind_* with fget calls.
Make fget MPsafe.

Make fgetvp and fgetsock use the fget subsystem to reduce code bloat.

Push giant down in fpathconf().
2002-01-14 00:13:45 +00:00
Alfred Perlstein
9e209b124a Include sys/_lock.h and sys/_mutex.h to reduce namespace pollution.
Requested by: jhb
2002-01-13 21:37:49 +00:00
Alfred Perlstein
426da3bcfb SMP Lock struct file, filedesc and the global file list.
Seigo Tanimura (tanimura) posted the initial delta.

I've polished it quite a bit reducing the need for locking and
adapting it for KSE.

Locks:

1 mutex in each filedesc
   protects all the fields.
   protects "struct file" initialization, while a struct file
     is being changed from &badfileops -> &pipeops or something
     the filedesc should be locked.

1 mutex in each struct file
   protects the refcount fields.
   doesn't protect anything else.
   the flags used for garbage collection have been moved to
     f_gcflag which was the FILLER short, this doesn't need
     locking because the garbage collection is a single threaded
     container.
  could likely be made to use a pool mutex.

1 sx lock for the global filelist.

struct file *	fhold(struct file *fp);
        /* increments reference count on a file */

struct file *	fhold_locked(struct file *fp);
        /* like fhold but expects file to locked */

struct file *	ffind_hold(struct thread *, int fd);
        /* finds the struct file in thread, adds one reference and
                returns it unlocked */

struct file *	ffind_lock(struct thread *, int fd);
        /* ffind_hold, but returns file locked */

I still have to smp-safe the fget cruft, I'll get to that asap.
2002-01-13 11:58:06 +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
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Scott Long
8ea9ab6622 MFS: Use correct terminology for RAID 0/1 and 0/5. 2001-12-04 02:39:06 +00:00
Scott Long
1c4c22583c BAH! Missed another change to this file. 2001-12-04 02:26:57 +00:00
Scott Long
a1078af4df Bah, I missed this file on the last commit 2001-12-04 02:24:07 +00:00