summaryrefslogtreecommitdiffstats
path: root/sys/dev/aac/aac.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid casts as lvalues.kan2004-07-281-3/+4
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-4/+4
| | | | Bump __FreeBSD_version accordingly.
* Collapse sync fib locking into normal i/o locking. The former didn'tscottl2004-06-021-38/+5
| | | | | | | | 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.
* Commit the correct version of the patch from last night. This fixes anscottl2004-06-011-7/+7
| | | | immediate panic when doing any i/o, and it closes a completion race.
* Collapse aac_map_command() into aac_startio(). Check the AAC_QUEUE_FRZN inscottl2004-06-011-43/+31
| | | | | | 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.
* Remove the 'timeout' argument from aac_wait_command() as it isn't used andscottl2004-04-141-14/+10
| | | | | never will be. Update the XXX comment for this function to accurately reflect why things are the way they are.
* kthread_exit() no longer requires Giant, so don't force callers to acquirejhb2004-03-051-1/+0
| | | | | | Giant just to call kthread_exit(). Requested by: many
* Revert the last commit. I don't know what I was thinking, but this changescottl2004-02-251-1/+0
| | | | definitely doesn't help any thing.
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | 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.
* Fix a major brain-o. If the command needs to be put on the deferred queue,scottl2004-02-211-0/+1
| | | | | take it off of the busy queue first. This should fix the 'command is on another queue' panic that showed up recently.
* Change the disk(9) API in order to make device removal more robust.phk2004-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Do some small cleanups to comments and remove AACQ_COMPLETE definitions sincescottl2004-02-071-3/+2
| | | | the completion queue is long-gone.
* If a command has to be deferred because there are no more resources for itscottl2004-02-071-9/+11
| | | | | | | | | | | 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.
* - Broaden the scope of locking in aac_command_thread() again to catch somescottl2004-02-071-11/+17
| | | | | | | | | 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.
* Take the plunge and make this driver be INTR_FAST. This re-arranges thescottl2004-01-301-60/+53
| | | | | | | | | 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.
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-11-091-1/+1
| | | | | | | | | | | | | 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
* Fix a couple of bugs with AIF handling:scottl2003-10-171-11/+15
| | | | | | | | | | - 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.
* Eliminate the use of a statically assign major number for the aac device.scottl2003-09-291-3/+0
|
* Correctly wrap the producer queue index when dequeuing commands. This wasn'tscottl2003-09-161-1/+5
| | | | | | | | | | 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
* Commands submitted through the management interface won't have scatter/scottl2003-09-011-0/+2
| | | | | gather lists. Stop ignoring them and instead call the callback directly. This unbreaks the management interface.
* If ~ chars were pennies, I'd be pennyless. This should fix all of thescottl2003-09-011-2/+3
| | | | 'command not in queue' panics. Also fix a nearby style problem.
* Use __FBSDID().obrien2003-08-241-2/+3
| | | | Also some minor style cleanups.
* Make aac(4) compile cleanly on 64-bit machines. The code was already 64-bitscottl2003-08-191-16/+12
| | | | | safe, but some (unneeded and/or harmless) downcasts were generating warnings. The driver still is not endian-clean.
* Handle the EINPROGRESS case of bus_dmamap_load() for data buffers.scottl2003-07-091-49/+52
|
* Fix a missing } that got dropped from the last commit.scottl2003-07-091-0/+1
|
* Add a new quirk for cards that incorrectly interpret the amount of memoryscottl2003-07-091-1/+9
| | | | in the system. This might also have a small performance gain.
* Mega busdma API commit.scottl2003-07-011-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* When scanning for changed containers, don't assume that the controllerscottl2003-06-031-7/+10
| | | | | | | will respond in a sane manner. Thanks to Petri Helenius <pete@he.iki.fi> for spotting this and pestering me to fix it.
* Don't pass pointers to kernel data structures through 32-bit fieldsscottl2003-04-281-13/+51
| | | | | | 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.
* Use bioq_flush() to drain a bio queue with a specific error code.phk2003-04-011-1/+1
| | | | | | | | 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.
* Add the ability to send 64-bit scatter/gather elements to aac cards. Thisscottl2003-03-301-39/+78
| | | | | | | 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.
* Begin support for 64-bit address support and workarounds for newer cards:scottl2003-03-261-33/+131
| | | | | | | | | | | | | | | | | - 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
* Now that bus_dmamem_alloc() handles its Giant mutex requirements itself,scottl2003-03-131-2/+0
| | | | don't bother doing the same in the code that calls it.
* Centralize the devstat handling for all GEOM disk device driversphk2003-03-081-1/+0
| | | | | | | | 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.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+6
| | | | | | | | | | | | | 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)
* The aac driver has evolved enough over the last few months that it noscottl2003-03-011-53/+6
| | | | | longer resembles the 4.x version very much. Garbage collect the legacy bits.
* Bring aac out from under Giant:scottl2003-02-261-15/+32
| | | | | | | | | | | | | | - 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.
* Introduce a new taskqueue that runs completely free of Giant, and inscottl2003-02-261-1/+1
| | | | | | | 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.
* Move to 'struct disk*' APIscottl2003-02-261-4/+4
| | | | Submitted by: phk
* On detach, don't remove the child from our list of children unless it hasscottl2003-02-201-1/+1
| | | | successfully detached.
* The completion queue is no longer used, so nuke its associated codescottl2003-02-201-1/+0
| | | | and data structures.
* Fix a 64-bit bogon. The hardware command structure only has one 32 bitscottl2003-02-191-3/+3
| | | | | | | 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.
* Make the aac driver be INTR_MPSAFE. Once the interrupt handler determinesscottl2003-02-191-36/+12
| | | | | | | 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.
* o Move the cleanup of the fib maps into aac_free_commands() so as toscottl2003-02-191-32/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Implement a new dynamic command allocator. FIBs are allocated in 1 pagescottl2003-02-101-46/+81
| | | | | | | | 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.
* Teach the CAM module how to deregister itself so it can be unloaded.scottl2003-02-061-0/+1
|
* Free the container and sim objects on detach. Convert several uses ofscottl2003-02-061-6/+10
| | | | MALLOC to malloc.
* Don't include aac_cam.h, since it was nuked in the last commit.scottl2003-02-061-6/+6
| | | | Deregister the shutdown eventhandler on unload.
* Various cleanups:scottl2003-02-051-53/+81
| | | | | | | | | | | - 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.
* Hack around a bug in the 2200 and 2120 controllers that connot DMAscottl2003-01-231-3/+17
| | | | | | | | 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
OpenPOWER on IntegriCloud