summaryrefslogtreecommitdiff
path: root/sys/dev/amr
Commit message (Collapse)AuthorAgeFilesLines
* Merge r254306:Scott Long2013-08-151-22/+1
| | | | | | | | | | | | | | | | | | | | | Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, adrian, achim Approved by: re Notes: svn path=/releng/9.2/; revision=254364
* Big MFC of the physbio changes necessary for unmapped I/O. These changesScott Long2013-06-181-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have been in production at Netflix for several months with significant success. MFC r246713: Reform the busdma API so that new types may be added without modifying every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback. MFC r249538: Some compilers issue a warning when wider integer is casted to narrow pointer. Supposedly shut down the warning by casting through uintptr_t. MFC r251479: Simplify the checking of flags for cam_periph_mapmem(). This gets rid of a lot of code redundancy and grossness at very minor expense. MFC r251837: MFC r251842: Add infrastructure for doing compatibility shims, as has been sorely needed for the last 10 years. Far too much of the internal API is exposed, and every small adjustment causes applications to stop working. To kick this off, bump the API version to 0x17 as should have been done with r246713, but add shims to compensate. Thanks to the shims, there should be no visible change in application behavior. Submitted by: kib, jeffr Approved by: kib Obtained from: Netflix Notes: svn path=/stable/9/; revision=251874
* MFC r227293 (by ed):Alexander Motin2013-04-052-2/+2
| | | | | | | | | Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. This means that their use is restricted to a single C file. Notes: svn path=/stable/9/; revision=249132
* MFC 240692,241228:John Baldwin2013-02-271-8/+10
| | | | | | | | | | | | | | | | Adjust the ioctl workaround from r234501: - Ensure the native ioctl path always allocates a 4kb buffer if a request uses a buffer size of 0. - Rounding all small requests up 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. Notes: svn path=/stable/9/; revision=247420
* MFC 234501:John Baldwin2012-05-301-14/+31
| | | | | | | | | | | | | | | | The amr(4) firmware contains a rather dubious "feature" where it 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. Notes: svn path=/stable/9/; revision=236318
* MFC 232854,232874,232882,232883,232886 for bus_get_dma_tag()Scott Long2012-03-161-1/+1
| | | | Notes: svn path=/stable/9/; revision=233024
* MFC r226173, r227843, r227848 and r227908:Hans Petter Selasky2011-12-311-3/+1
| | | | | | | | | Use DEVMETHOD_END to mark end of device methods. Remove superfluous device methods. Add some missing __FBSBID() macros. Notes: svn path=/stable/9/; revision=229093
* Second-to-last commit implementing Capsicum capabilities in the FreeBSDRobert Watson2011-08-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel for FreeBSD 9.0: Add a new capability mask argument to fget(9) and friends, allowing system call code to declare what capabilities are required when an integer file descriptor is converted into an in-kernel struct file *. With options CAPABILITIES compiled into the kernel, this enforces capability protection; without, this change is effectively a no-op. Some cases require special handling, such as mmap(2), which must preserve information about the maximum rights at the time of mapping in the memory map so that they can later be enforced in mprotect(2) -- this is done by narrowing the rights in the existing max_protection field used for similar purposes with file permissions. In namei(9), we assert that the code is not reached from within capability mode, as we're not yet ready to enforce namespace capabilities there. This will follow in a later commit. Update two capability names: CAP_EVENT and CAP_KEVENT become CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they represent. Approved by: re (bz) Submitted by: jonathan Sponsored by: Google Inc Notes: svn path=/head/; revision=224778
* Fix clang warning on empty statement.Matthew D Fleming2010-07-281-2/+2
| | | | | | | | Reviewed by: rdivacky, zml Approved by: zml (mentor) Notes: svn path=/head/; revision=210570
* 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-202-6/+6
| | | | 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-033-33/+58
| | | | | | | | | 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
* Remove an errant definition for AMR_CONFIG_ENQ3_SOLICITED NOTIFY that wasScott Long2008-02-061-1/+0
| | | | | | | accidently reverted in the previous commit. Notes: svn path=/head/; revision=176041
* Many improvements that have been collected over time:Scott Long2008-01-243-43/+146
| | | | | | | | | - 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-124-434/+258
| | | | | | | | 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-022-26/+29
| | | | Notes: svn path=/head/; revision=174194
* Refactor completion handlers so that they can be combined into a singleScott Long2007-12-021-76/+29
| | | | | | | function. Add missing locking. Notes: svn path=/head/; revision=174193
* Make a pass at style.9 complianceScott Long2007-12-021-398/+435
| | | | Notes: svn path=/head/; revision=174186
* Fix a typo that was hidden by AMR_DEBUG.Scott Long2007-12-021-1/+1
| | | | Notes: svn path=/head/; revision=174185
* 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-282-76/+64
| | | | | | | | | | | | 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
* Prepare for future integration between CAM and newbus. xpt_bus_registerScott Long2007-06-171-1/+1
| | | | | | | | | | now takes a device_t to be the parent of the bus that is being created. Most SIMs have been updated with a reasonable argument, but a few exceptions just pass NULL for now. This argument isn't used yet and the newbus integration likely won't be ready until after 7.0-RELEASE. Notes: svn path=/head/; revision=170872
* Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM willScott Long2007-04-151-0/+1
| | | | | | | | | | | | | | use to synchornize and protect all data objects that are used for that SIM. Drivers that are not yet MPSAFE register Giant and operate as usual. RIght now, no drivers are MPSAFE, though a few will be changed in the coming week as this work settles down. The driver API has changed, so all CAM drivers will need to be recompiled. The userland API has not changed, so tools like camcontrol do not need to be recompiled. Notes: svn path=/head/; revision=168752
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-1/+1
| | | | | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@ Notes: svn path=/head/; revision=166901
* Add MODULE_DEPENDS for cam, pci, mca, eisa and isa where needed.Matt Jacob2006-12-111-0/+2
| | | | | | | | PR: 106543 MFC after: 3 days Notes: svn path=/head/; revision=165102
* 2nd and final commit that moves us to CAM_NEW_TRAN_CODEMatt Jacob2006-11-021-20/+0
| | | | | | | | | as the default. Reviewed by multitudes. Notes: svn path=/head/; revision=163896
* Implement BIO_FLUSH handling for da(4), amr(4), ata(4) and ataraid(4).Pawel Jakub Dawidek2006-10-312-11/+22
| | | | | | | Sponsored by: home.pl Notes: svn path=/head/; revision=163834
* The first of 3 major steps to move the CAM layer forward to usingMatt Jacob2006-10-311-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | the CAM_NEW_TRAN_CODE that has been in the tree for some years now. This first step consists solely of adding to or correcting CAM_NEW_TRAN_CODE pieces in the kernel source tree such that a both a GENERIC (at least on i386) and a LINT build with CAM_NEW_TRAN_CODE as an option will compile correctly and run (at least with some the h/w I have). After a short settle time, the other pieces (making CAM_NEW_TRAN_CODE the default and updating libcam and camcontrol) will be brought in. This will be an incompatible change in that the size of structures related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change in both size and content. However, basic system operation and basic system utilities work well enough with this change. Reviewed by: freebsd-scsi and specific stakeholders Notes: svn path=/head/; revision=163816
* 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-033-127/+41
| | | | | | | | | | | 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
* Reduce the Linux ioctl range to what is needed. I didn't know whatDoug Ambrisko2006-04-141-2/+2
| | | | | | | I was doing when I first set the range up. Notes: svn path=/head/; revision=157755
* After further review and discussion, partially revert the previous commit.Scott Long2006-04-083-20/+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-083-6/+21
| | | | | | | | | | | 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
* Check the return value of copyin() and return an error if it fails.John Baldwin2006-02-231-2/+4
| | | | | | | | | | Coverity ID: 839 Found by: Coverity Prevent MFC after: 1 week Reviewed by: ps, scottl Notes: svn path=/head/; revision=155953
* Use void * for pointer rather than u_int8_t *, since it doesn'tWarner Losh2006-02-041-5/+4
| | | | | | | matter. Well it does for type punning warnings. Notes: svn path=/head/; revision=155317
* Enable 64bit SGL's on PERC 4/DCPaul Saab2006-02-021-1/+1
| | | | Notes: svn path=/head/; revision=155223
* - Move the command setup from amr_start1 into the card specific submitPaul Saab2006-02-022-61/+60
| | | | | | | | | | 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
* Add in the Linux IOCTL shim and create the megadev0 device soDoug Ambrisko2006-01-241-0/+191
| | | | | | | | | | | | | | | | | | | Linux LSI MegaRaid tools can run on FreeBSD until Linux emulation. Add in the Linux IOCTL shim and create the megadev0 device so Linux LSI MegaRaid tools can run on FreeBSD until Linux emulation. Add glue to build the modules but don't tie it into the build yet until I test it from the CVS repo. via the mirror on an amd64 machine. Tie this into the Linux32 emulation on amd64 so the tools can run on amd64 kernel. Cleaned up by: ps (amr_linux.c) Notes: svn path=/head/; revision=154789
* Check the return value of copyin.Scott Long2006-01-141-1/+2
| | | | | | | Found by: Coverity Prevent (tm) Notes: svn path=/head/; revision=154370
* - Correct amr_enquiry3 structure[1].Jung-uk Kim2006-01-131-5/+5
| | | | | | | | | | - Remove redundant AMR_CONFIG_ENQ3_SOLICITED_NOTIFY from the previous commit while I am here. PR: kern/29727 [1] Notes: svn path=/head/; revision=154321
* 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-147-285/+949
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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