aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/amr/amr.c
Commit message (Collapse)AuthorAgeFilesLines
* amr: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-17/+2
| | | | Notes: svn path=/head/; revision=365111
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Ever since the block layer expanded its command syntax beyond justScott Long2020-02-071-0/+4
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=357647
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326255
* As with r323317, hold off on releasing the intrhook during boot untilScott Long2017-09-081-5/+5
| | | | | | | | we're ready to accept probing from GEOM. Untested, but the pattern is the same as with aac. Notes: svn path=/head/; revision=323319
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-2/+2
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-1/+1
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298646
* Don't assume that bio_cmd is a bitfield.Warner Losh2016-03-101-1/+1
| | | | | | | Differential revision: https://reviews.freebsd.org/D5590 Notes: svn path=/head/; revision=296592
* Set but not used variables eliminated.Warner Losh2014-08-081-6/+2
| | | | Notes: svn path=/head/; revision=269711
* Further adjust the workaround in r234501. Rounding all small requests upJohn Baldwin2012-10-051-2/+8
| | | | | | | | | | | | | | | | to 32k swamped the controller causing firmware hangs. Instead, round requests smaller than 64k up to the next power of 2 as a general rule. To handle the one known special case of a command that accepts a 12k buffer returning a 24k-ish reply, round requests between 8k and 16k up to 32k rather than 16k. The result is that commands less than 8k should now be rounded up to a smaller size (either 4k or 8k) rather than 32k. PR: kern/155658 Tested by: Andreas Longwitz MFC after: 1 week Notes: svn path=/head/; revision=241228
* As a followup to r234501, ensure that the native ioctl path always allocatesJohn Baldwin2012-09-191-6/+2
| | | | | | | | | | | | a 4kb buffer if a request uses a buffer size of 0. (The Linux ioctl path already did this.) PR: kern/155658 Submitted by: Andreas Longwitz MFC after: 1 week Notes: svn path=/head/; revision=240692
* Essentially revert r239912. The amr_periodic function hadn't been armed inScott Long2012-08-311-38/+0
| | | | | | | | over 10 years and was dead code; the previous revision exposed it as such to CLANG. The solution is to cull the whole thing. Notes: svn path=/head/; revision=239939
* Use callout(9) rather than timeout(9). Note that the periodic timer inJohn Baldwin2012-08-301-3/+3
| | | | | | | | amr(4) is never started, so this should be even more of a NOP than normal. Notes: svn path=/head/; revision=239912
* The amr(4) firmware contains a rather dubious "feature" where itJohn Baldwin2012-04-201-14/+31
| | | | | | | | | | | | | | | | | | | | assumes for small buffers (< 64k) that the OS driver is actually using a buffer rounded up to the next power of 2. It also assumes that the buffer is at least 4k in size. Furthermore, there is at least one known instance of megarc sending a request with a 12k buffer where the firmware writes out a 24k-ish reply. To workaround the data corruption triggered by this "feature", ensure that buffers for user commands use a minimum size of 32k, and that buffers between 32k and 64k use a 64k buffer. PR: kern/155658 Submitted by: Andreas Longwitz longwitz incore de Reviewed by: scottl MFC after: 1 week Notes: svn path=/head/; revision=234501
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Remove extraneous semicolons, no functional changes.Martin Blapp2010-01-071-1/+1
| | | | | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week Notes: svn path=/head/; revision=201758
* Remove spurious `)`Christian Brueffer2009-10-281-1/+1
| | | | | | | | | PR: 137758 Submitted by: Henning Petersen <henning.petersen@t-online.de> MFC after: 1 week Notes: svn path=/head/; revision=198546
* Revert previous commit and add myself to the list of people who shouldPoul-Henning Kamp2009-09-081-1/+1
| | | | | | | know better than to commit with a cat in the area. Notes: svn path=/head/; revision=196970
* Add necessary include.Poul-Henning Kamp2009-09-081-1/+1
| | | | Notes: svn path=/head/; revision=196969
* Temporarily revert the new-bus locking for 8.0 release. It will beJohn Baldwin2009-08-201-21/+2
| | | | | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Notes: svn path=/head/; revision=196403
* Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao2009-08-021-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=196037
* We no longer need to use d_thread_t, migrate to struct thread *.Warner Losh2009-05-201-5/+5
| | | | Notes: svn path=/head/; revision=192450
* Move the CAM passthrough code into a true module so that it doesn't have to beScott Long2008-11-031-19/+12
| | | | | | | | | compiled into the main AMR driver. It's code that is nice to have but not required for normal operation, and it is reported to cause problems for some people. Notes: svn path=/head/; revision=184573
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-2/+2
| | | | | | | | | | | | | | | | | | After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib Notes: svn path=/head/; revision=183397
* While spin-waiting for the mailbox semaphore to update, do flushing reads ofScott Long2008-07-201-1/+4
| | | | | | | PCI bus so that we don't have to wait more than needed. Notes: svn path=/head/; revision=180633
* Many improvements that have been collected over time:Scott Long2008-01-241-27/+111
| | | | | | | | | - Improve error handling for load operations. - Fix a memory corruption bug when using certain linux management apps. - Allocate all commands up front to avoid OOM deadlocks later on. Notes: svn path=/head/; revision=175622
* Rewrite the DMA code paths from being an impenitrable maze of special casesScott Long2007-12-121-349/+135
| | | | | | | | to a much saner and simplier unified code path. Along the way, fix various CAM nits and bugs so that the passthrough works correctly for all cases. Notes: svn path=/head/; revision=174544
* Provide unqiue malloc types instead of using M_DEVBUF.Scott Long2007-12-021-20/+22
| | | | Notes: svn path=/head/; revision=174194
* Fix printf format bugs that where hidden by AMR_DEBUG.Scott Long2007-12-021-3/+3
| | | | Notes: svn path=/head/; revision=174184
* Turn the CAM passthroug interface to AMR back ON. Adjust theScott Long2007-11-281-1/+1
| | | | | | | | | | | | T_DIRECT filtering so that disk drives can be attached via the pass driver. Add CAM locking. Don't mark CAM commands as SG64 since the hardware isn't designed to deal with 64-bit passthru commands. Hopefully the bounce buffer changes that were done for the management/ioctl interface are robust enough to handle this deficiency for CAM as well. Notes: svn path=/head/; revision=174030
* Implement BIO_FLUSH handling for da(4), amr(4), ata(4) and ataraid(4).Pawel Jakub Dawidek2006-10-311-10/+21
| | | | | | | Sponsored by: home.pl Notes: svn path=/head/; revision=163834
* Chain the bus_dmamap_load() calls when mapping a command with a data CCBJohn Baldwin2006-07-171-24/+42
| | | | | | | | | | | | | | | instead of doing the first load with the BUS_DMA_NOWAIT flag. On 4.x with PAE and > 4gb of RAM this proved disastrous if there weren't enough bounce pages as amr_mapcmd() would return failure but the callback would later fire once enough bounce pages were available and would then overwrite another command's S/G list. MFC after: 3 days Submitted by: scottl (4.x version) Reviewed by: scottl (port from 4.x to HEAD) Notes: svn path=/head/; revision=160443
* Make amr_linux work as a module by avoiding calling amr_linux_ioctl_intDoug Ambrisko2006-05-031-5/+32
| | | | | | | | | | | from the amr_linux. This simplifies the amr_linux shim and puts the smarts into amr.c. I tested this with 2 amr controllers in one box. It seems to work okay with them. Notes: svn path=/head/; revision=158267
* After further review and discussion, partially revert the previous commit.Scott Long2006-04-081-18/+13
| | | | | | | | | | | | | The real problem was that ioctl handlers needed to call amr_wait_command() with the list lock held. This not only solves the completion race, it also prevents bounce buffer corruption that could arise from amr_start() being called without the proper locks held. Discussed with: ps MFC After: 3 days Notes: svn path=/head/; revision=157586
* Close a pesky race where after checking the BUSY flag in amr_wait_command,Paul Saab2006-04-081-6/+19
| | | | | | | | | | | the completion of the command can occur before tsleep is called and the command ends up blocking forever since the wakeup has already been called. Submitted by: ups Notes: svn path=/head/; revision=157585
* - Move the command setup from amr_start1 into the card specific submitPaul Saab2006-02-021-60/+59
| | | | | | | | | | routines. - Add or replace cpu_spinwait() with DELAY(1) to a few of the busy loops when reading from the controller to work around firmware bugs which can crash the controller. Notes: svn path=/head/; revision=155222
* When the RAID firmware returns a failure, don't hard error the result.Doug Ambrisko2006-01-261-9/+4
| | | | | | | | | | | | | | This is important with MegaLib, when issuing a GET_REBUILD_PROG since it returns an error if the drive is not in rebuild state. This will be MFC'ed shortly. Submitted by: ps Reviewed by: scottl Found by: ambrisko Notes: svn path=/head/; revision=154876
* Check the return value of copyin.Scott Long2006-01-141-1/+2
| | | | | | | Found by: Coverity Prevent (tm) Notes: svn path=/head/; revision=154370
* Don't free the ap object if it was never created.Scott Long2006-01-101-1/+2
| | | | | | | Submitted by: jkim Notes: svn path=/head/; revision=154156
* Mega update to the LSI MegaRAID driver:Scott Long2005-12-141-202/+738
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Implement a large set of ioctl shims so that the Linux management apps from LSI will work. This includes infrastructure to support adding, deleting and rescanning arrays at runtime. This is based on work from Doug Ambrosko, heavily augmented by LSI and Yahoo. 2. Implement full 64-bit DMA support. Systems with more than 4GB of RAM can now operate without the cost of bounce buffers. Cards that cannot do 64-bit DMA will automatically revert to using bounce buffers. This option can be forced off by setting the 'hw.amr.force_sg32" tunable in the loader. It should only be turned off for debugging purposes. This work was sponsored by Yahoo. 3. Streamline the command delivery and interrupt handler paths after much discussion with Dell and LSI. The logic now closely matches the intended design, making it both more robust and much faster. Certain i/o failures under heavy load should be fixed with this. 4. Optimize the locking. In the interrupt handler, the card can be checked for completed commands without any locks held, due to the handler being implicitely serialized and there being no need to look at any shared data. Only grab the lock to return the command structure to the free pool. A small optimization can still be made to collect all of the completions together and then free them together under a single lock. Items 3 and 4 significantly increase the performance of the driver. On an LSI 320-2X card, transactions per second went from 13,000 to 31,000 in my testing with these changes. However, these changes are still fairly experimental and shouldn't be merged to 6.x until there is more testing. Thanks to Doug Ambrosko, LSI, Dell, and Yahoo for contributing towards this. Notes: svn path=/head/; revision=153409
* The CAM interface is broken and seems to be causing lockups on boot. ItScott Long2005-11-261-0/+13
| | | | | | | | | | doesn't appear to have worked in a long time, so just disable it completely for now. MFC After: 3 days Notes: svn path=/head/; revision=152817
* Remove spl markers from AMR.Scott Long2005-11-061-15/+5
| | | | | | | MFC After: 3 days Notes: svn path=/head/; revision=152119
* Complete the removal of __FreeBSD_version checks from the amr driver. TheScott Long2005-08-081-2/+2
| | | | | | | | driver had advanced enough over the years that direct sharing of code with FreeBSD 4.x was in no way possible anymore. Notes: svn path=/head/; revision=148850
* Print the actual disk device we failed to complete i/o on.Paul Saab2005-07-291-2/+2
| | | | Notes: svn path=/head/; revision=148499
* Don't allow ioctl commands to be interrupted by the user.Paul Saab2005-07-291-6/+4
| | | | Notes: svn path=/head/; revision=148498
* polled commands can read or write, so bus_dmamap_sync properlyPaul Saab2005-06-231-2/+16
| | | | | | | | | according to the type of request. Approved by: re Notes: svn path=/head/; revision=147536
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-2/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* handle potential null ptrSam Leffler2005-03-311-1/+3
| | | | | | | Noticed by: Coverity Prevent analysis tool Notes: svn path=/head/; revision=144369
* Fix a null pointer de-ref when passthrough ioctls are issued. ThisScott Long2005-03-131-8/+11
| | | | | | | | | involves some code shuffle to avoid locking problems. MFC After: 3 days Notes: svn path=/head/; revision=143488
* Fix the ioctl path by ensuring that amr_start1() gets called for commandsScott Long2005-03-041-18/+22
| | | | | | | | | | | with no associated data. Also revert previous changes that allocate off of the stack instead of using malloc, as it's not needed. Many thanks to LSI for investigating and fixing these problems. Submitted by: rajeshpr @ lsil . com Notes: svn path=/head/; revision=143121