aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mfi
Commit message (Collapse)AuthorAgeFilesLines
* MFC r261491 (by ambrisko):Mark Johnston2014-08-272-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | Add a tunable "hw.mfi.mrsas_enable" to allow mfi(4) to drop priority and allow mrsas(4) from LSI to attach to newer LSI cards that are support by mrsas(4). If mrsas(4) is not loaded into the system at boot then mfi(4) will always attach. If a modified mrsas(4) is loaded in the system. That modification is return "-30" in it's probe since that is between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY. This option is controller by a new probe flag "MFI_FLAGS_MRSAS" in mfi_ident that denotes cards that should work with mrsas(4). New entries that should have this option. This is the first step to get mrsas(4) checked into FreeBSD and to avoid collision with people that use mrsas(4) from LSI. Since mfi(4) takes priority, then mrsas(4) users need to rebuild GENERIC. Using the .disabled="1" method doesn't work since that blocks attaching and the probe gave it to mfi(4). MFC r267451 (by delphij): Correct variable for loader tunable variable hw.mfi.mrsas_enable. Notes: svn path=/stable/9/; revision=270733
* MFC r261535:Mark Johnston2014-03-103-6/+29
| | | | | | | | | | | Add support for MegaRAID Fury cards. The main change needed to boot from a 9341-4i controller was to ensure that scatter/gather lists are ended with an end-of-list marker. Both the mrsas and Linux megaraid_sas drivers use this marker with Invader cards as well, so we do the same thing, though it is apparently not strictly necessary. Notes: svn path=/stable/9/; revision=262968
* MFC r255869:Doug Ambrisko2013-10-221-0/+1
| | | | | | | | Add PCI device ID for MegaRAID Invader cards. This was the only change needed to make it work on my card. Notes: svn path=/stable/9/; revision=256924
* MFC r254742:Mark Johnston2013-09-201-5/+1
| | | | | | | | | Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait(). xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if the driver initiates multiple rescans in quick succession. Notes: svn path=/stable/9/; revision=255740
* MFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYSSean Bruno2013-09-111-1/+2
| | | | Notes: svn path=/stable/9/; revision=255479
* Merge r254263:Scott Long2013-08-131-14/+2
| | | | | | | | | | | | | | | | | | | | | | 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. Candidate for 9.2 Submitted by: jhb Reviewed by: jfv, marius, adrian, achim Notes: svn path=/stable/9/; revision=254306
* MFC r251516Sean Bruno2013-07-121-0/+4
| | | | | | | | | Implement foreign device handling. PR: kern/172091 Notes: svn path=/stable/9/; revision=253244
* MFC r249468:Alexander Motin2013-07-081-1/+1
| | | | | | | | | | | Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now. Notes: svn path=/stable/9/; revision=253037
* MFC r242726 (ambrisko):Mark Johnston2013-07-033-0/+81
| | | | | | | | | | | | Add support for SCSI pass through devices to be attached and detached. MFC r251172 (sbruno): xpt_create_path() requires mfi_io_lock to be held, so do it. mfi(4) doesn't panic on host startup now. Notes: svn path=/stable/9/; revision=252643
* MFC r252471:Steven Hartland2013-07-031-5/+8
| | | | | | | | | | | | | | | | | | Remove forced timeout of in-flight commands from mfi_timeout. While this prevents commands getting stuck forever there is no way to guarantee that data from the command hasn't been committed to the device. In addition older mfi firmware has a bug that would cause the controller to frequently stall IO for over our timeout value, which when combined with a forced timeout often resulted in panics in UFS; which would otherwise be avoided when the command eventually completed if left alone. For reference this timeout issue is resolved in Dell FW package 21.2.1-0000. Fixed FW package version for none Dell controller will likely vary. Notes: svn path=/stable/9/; revision=252554
* Fix two swapped definitions. Note it is directly committed to this branchJung-uk Kim2013-06-201-2/+2
| | | | | | | because it fixes r250496, i.e., MFC of r247369 to stable/9. Notes: svn path=/stable/9/; revision=252038
* Big MFC of the physbio changes necessary for unmapped I/O. These changesScott Long2013-06-182-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 r247426:Steven Hartland2013-06-051-5/+11
| | | | | | | Add hw.mfi.cmd_timeout loader / sysctl tuneable. Notes: svn path=/stable/9/; revision=251406
* MFC r244123 Add CTLFLAG_RWTUN defineSteven Hartland2013-05-116-318/+474
| | | | | | | | | | MFC r247367 Fix non-recusive mutex MFI I/O lock MFC r247369 Fix a large amount of bugs in MFI that cause panics Approved by: pjd (mentor) Notes: svn path=/stable/9/; revision=250496
* MFC r249257:Mark Johnston2013-05-102-0/+21
| | | | | | | | | | | | | Add support for getting and setting BBU properties related to battery relearning. Specifically, add subcommands to mfiutil(8) which allow the user to set the BBU and autolearn modes when the firmware supports it, and add a subcommand which kicks off a battery relearn. MFC r249258: Switch to a 2-clause license. Notes: svn path=/stable/9/; revision=250482
* MFC r248627:Xin LI2013-04-081-1/+1
| | | | | | | | | | Don't attempt to reference sc before testing whether it's NULL. Submitted by: Sascha Wildner Obtained from: DragonFly Notes: svn path=/stable/9/; revision=249290
* MFC r247594:Xin LI2013-03-051-1/+1
| | | | | | | | | | Fix a typo in mfi_stp_cmd() that would give wrong assignment. Submitted by: Sascha Wildner <saw online de> Obtained from: DragonFly rev 0dc98fff2206d7bb78ce5e07ac34d6954e4bd96a Notes: svn path=/stable/9/; revision=247828
* MFC r242681 (ambrisko):Xin LI2012-12-036-198/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | - Extend the prior commit to use the generic SCSI command building function use that for JBOD and Thunderbolt disk write command. Now we only have one implementation in mfi. - Fix dumping on Thunderbolt cards. Polled IO commands do not seem to be normally acknowledged by changing cmd_status to MFI_STAT_OK. In order to get acknowledgement of the IO is complete, the Thunderbolt command queue needs to be run through. I added a flag MFI_CMD_SCSI to indicate this command is being polled and to complete the Thunderbolt wrapper and indicate the result. This flag needs to be set in the JBOD case in case if that us using Thunderbolt card. When in the polling loop check for completed commands. - Remove mfi_tbolt_is_ldio and just do the check when needed. - Fix an issue when attaching of disk device happens when a device is already scheduled to be attached but hasn't attached. - add a tunable to allow raw disk attachment to CAM via: hw.mfi.allow_cam_disk_passthrough=1 - fixup aborting of commands (AEN and LD state change). Use a generic abort function and only wait the command being aborted not both. Thunderbolt cards don't seem to abort commands so the abort times out. Notes: svn path=/stable/9/; revision=243824
* MFC r242497:Xin LI2012-12-031-26/+82
| | | | | | | | | | | | | | Copy code from scsi_read_write() as mfi_build_syspd_cdb() to build SCSI command properly. Without this change, mfi(4) always sends 10 byte READ and WRITE commands, which will cause data corruption when device is larger than 2^32 sectors. PR: kern/173291 Submitted by: Steven Hartland <steven.hartland multiplay.co.uk> Reviewed by: mav Notes: svn path=/stable/9/; revision=243823
* MFC r243078:Eitan Adler2012-11-301-2/+2
| | | | | | | | | | Add deviceid to the disk output on boot to help debugging. PR: kern/173290 Approved by: cperciva (implicit) Notes: svn path=/stable/9/; revision=243697
* MFC 240962:John Baldwin2012-10-071-0/+1
| | | | | | | | Grab the mfi_config_lock while performing a MFI_DCMD_CFG_FOREIGN_IMPORT request on behalf of a user utility. Notes: svn path=/stable/9/; revision=241324
* MFC r238371Sean Bruno2012-09-231-0/+1
| | | | | | | | | | | When an MFI command fails, the driver needs to set bio->bio_resid so that the upper levels notice. Otherwise we see commands silently failing leading to data corruption. This mirrors dadone() Submitted by: Andrew Boyer aboyer@averesystems.com Notes: svn path=/stable/9/; revision=240873
* MFC r238373Sean Bruno2012-09-231-0/+1
| | | | | | | | | sys/dev/mfivar.h contains references to MFI_DEBUG, but it never gets turned on unless the file also includes opt_mfi.h. Submitted by: Andrew Boyer aboyer@averesystems.com Notes: svn path=/stable/9/; revision=240867
* MFC 238077:John Baldwin2012-08-291-4/+8
| | | | | | | | | | | | | | | | | | | | | Fix panics triggered by older mfiutil binaries run on the new mfi(4) driver. The new driver changed the size of the mfi_dcmd_frame structure in such a way that a MFI_IOC_PASSTHRU ioctl from an old amd64 binary is treated as an MFI_IOC_PASSTHRU32 ioctl in the new driver. As a result, the user pointer is treated as the buffer length. mfi_user_command() doesn't have a bounds check on the buffer length, so it passes a really big value to malloc() which panics when it tries to exhaust the kmem_map. Fix this two ways: - Only honor MFI_IOC_PASSTHRU32 if the binary has the SV_ILP32 flag set, otherwise treat it as an unknown ioctl. - Add a bounds check on the buffer length passed by the user. For now it fails any user attempts to use a buffer larger than 1MB. While here, fix a few other nits: - Remove an unnecessary check for a NULL return from malloc(M_WAITOK). - Use the ENOTTY errno for invalid ioctl commands instead of ENOENT. Notes: svn path=/stable/9/; revision=239866
* MFC: r237546Marius Strobl2012-07-021-1/+1
| | | | | | | | | Correct sizeof usage Obtained from: DragonFly Notes: svn path=/stable/9/; revision=238013
* MFC r236323Sean Bruno2012-06-071-4/+11
| | | | | | | | Cosmetic nit. If a configured volume has no label, don't emit an empty string for the name during probe. Simply indicate that it has no label. Notes: svn path=/stable/9/; revision=236719
* MFC r235634Sean Bruno2012-05-211-2/+7
| | | | | | | Fix and update battery status bits according to linux driver Notes: svn path=/stable/9/; revision=235738
* MFC r235318, r235321Sean Bruno2012-05-162-5/+4
| | | | | | | | | Fix inappropriate data type for two bus_dmamap_t variables that were causing PAE to insta-panic on startup. Remove one unused variable that was commented out. Notes: svn path=/stable/9/; revision=235525
* MFC r235014: Rebuild fix and LBA calculation fix for ThunderBoltDoug Ambrisko2012-05-076-130/+275
| | | | | | | | | | | | | based cards. MFC r235016: Some style improvements. MFC r235040: Fix the returns in mfi_tbolt_sync_map_info that I added. PR: 167226 Notes: svn path=/stable/9/; revision=235135
* MFC r233711:Doug Ambrisko2012-04-1811-261/+3752
| | | | | | | | | | | | | | | | | | | | Major update to driver to support for Drake Skinny and ThunderBolt cards. MFC r233768: Change typedef atomic_t to struct mfi_atomic to avoid name space collision and some couple more style changes. MFC r233805: Move struct megasas_sge from mfi_ioctl.h to mfivar.h so we can remove including machine/bus.h. Add some more mfi_ prefixes to avoid name space pollution. MFC r233877: - Do not include machine/atomic.h. It is no longer necessary since r233768. - Remove bogus "atomic" macros and a read-only variable from softc. Notes: svn path=/stable/9/; revision=234429
* 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 227577: The sys/sysctl.h header is needed when MFI_DEBUG is defined.John Baldwin2012-01-051-0/+1
| | | | Notes: svn path=/stable/9/; revision=229661
* MFC 227562:John Baldwin2012-01-055-9/+27
| | | | | | | | | | Add single-message MSI support to mfi(4). It is disabled by default but can be enabled via the hw.mfi.msi tunable. Many mfi(4) controllers also support MSI-X, but in testing it seems that many adapters do not work with MSI-X but do work with MSI. Notes: svn path=/stable/9/; revision=229611
* MFC r226173, r227843, r227848 and r227908:Hans Petter Selasky2011-12-311-3/+2
| | | | | | | | | 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
* MFC r227409:Xin LI2011-11-151-0/+6
| | | | | | | | | | | | | | | Do a dummy read to flush the interrupt ACK that we just performed, ensuring that everything is really, truly consistent. This fixes certain cases where one will see various: mfi0: COMMAND 0xffffffXXXXXXXXXX TIMEOUT AFTER XX SECONDS Submitted by: scottl Ok'ed by: jhb Approved by: re (kib) Notes: svn path=/stable/9/; revision=227533
* MFC r226896:Konstantin Belousov2011-11-051-1/+18
| | | | | | | | | | | Fix an implicit dependency between the MFI driver and CAM that had grown due to an API change in CAM. It's once again possible to link a static kernel with 'mfi' without requiring 'scbus' as well. Ditto for KLD loading. Approved by: re (bz) Notes: svn path=/stable/9/; revision=227117
* Merge from r225950:Marius Strobl2011-10-291-1/+7
| | | | | | | | | | Set the sense residual properly. Reviewed by: ken Approved by: re (kib) Notes: svn path=/stable/9/; revision=226910
* MFC r225869:Alexander Motin2011-10-022-40/+64
| | | | | | | | | | | | | | | - Add special support for the MFI_CMD ioctl with MFI_CMD_STP command, used by present MegaCLI version. It has some special meaning for the first s/g list entry, while the main s/g list begins from the the second entry, and those lists should remain separate after loading to the busdma map. - Fix bug in 32bit ioctl compatibility shims when s/g list consists of more then on element. Approved by: re (kib) Notes: svn path=/stable/9/; revision=225918
* In order to maximize the re-usability of kernel code in user space thisKip Macy2011-09-161-1/+1
| | | | | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz) Notes: svn path=/head/; revision=225617
* Shorten a variable access some using a cached value rather thanBjoern A. Zeeb2011-09-071-2/+1
| | | | | | | | | | | casting the input argument again, making the code more readable. Reviewed by: jhb MFC after: 2 weeks Approved by: re (kib) Notes: svn path=/head/; revision=225428
* 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
* Support controllers whose option ROM is disabled in the BIOS by kickingJohn Baldwin2011-07-142-2/+8
| | | | | | | | | | | | the firmware so that it boots. PR: kern/154978 Submitted by: Andrew Boyer aboyer of averesystems com Obtained from: LSI MFC after: 1 week Notes: svn path=/head/; revision=224041
* Use MFI_STAT_* constants for cmd_status field values rather than magicJohn Baldwin2011-07-141-5/+6
| | | | | | | | | | | numbers in a few places. PR: bin/145960 Submitted by: gcooper MFC after: 1 week Notes: svn path=/head/; revision=224039
* Remove duplicate header includesKevin Lo2011-06-281-3/+0
| | | | Notes: svn path=/head/; revision=223624
* There are a couple of structs in mfireg.h with members named 'class'.Ed Maste2011-06-022-11/+11
| | | | | | | | | | | | | These cause problems when trying to include the header in a C++ project. Rename them to 'evt_class', and track the change in mfi and mfiutil. Submitted by: Mark Johnston Sponsored by: Sandvine Incorporated Reviewed by: jhb@ MFC after: 1 week Notes: svn path=/head/; revision=222589
* When masking direct and processor devices during an inquiry, properlyJohn Baldwin2010-12-061-4/+4
| | | | | | | | | | | | | | preserve the upper bits of the first data byte. While here, shorten a few nearby lines. PR: kern/152768 Reported by: Sascha Wildner saw of online.de Reviewed by: scottl MFC after: 1 week Notes: svn path=/head/; revision=216235
* Update PD state firmware definitions: add copyback, system.Sergey Kandaurov2010-10-211-1/+3
| | | | | | | | | Reviewed by: jhb Approved by: avg (mentor) MFC after: 1 week Notes: svn path=/head/; revision=214130
* Correct mfip module dependency on mfi. This allows mfip to be loaded asKonstantin Belousov2010-03-022-0/+2
| | | | | | | | | | module when mfi is a module itself. Reviewed by: jhb, scottl MFC after: 1 week Notes: svn path=/head/; revision=204590
* Revert r200231. It was already taken cared by jhb long ago.Jung-uk Kim2009-12-071-16/+3
| | | | | | | | Pointed out by: jhb Pointy hat: jkim Notes: svn path=/head/; revision=200238
* Make mfi(4) little bit less chatty.Jung-uk Kim2009-12-071-3/+16
| | | | Notes: svn path=/head/; revision=200231