aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mpt/mpt.c
Commit message (Collapse)AuthorAgeFilesLines
* mpt: print req->index rather than the pointer itself in mpt.cFuqian Huang2025-02-051-2/+2
| | | | | | | | | Print req->index instead of printing the pointer itself to avoid kernel pointer leakage. PR: 238661 Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Reviewed-by: imp
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* mpt: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-11/+4
| | | | Notes: svn path=/head/; revision=365202
* 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
* "Buses" is the preferred plural of "bus"Conrad Meyer2017-01-151-2/+2
| | | | | | | | | | | | | | | | | | | | Replace archaic "busses" with modern form "buses." Intentionally excluded: * Old/random drivers I didn't recognize * Old hardware in general * Use of "busses" in code as identifiers No functional change. http://grammarist.com/spelling/buses-busses/ PR: 216099 Reported by: bltsrc at mail.ru Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312234
* Fix the fallout from r308268 (mpt driver causes endless witness warnings inScott Long2016-11-071-0/+8
| | | | | | | | | | VMWare and elsewhere) with the precision of a dull, rusty butter knife. Reported by: tuexen Obtained from: Netflix Notes: svn path=/head/; revision=308423
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* - In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writingMarius Strobl2015-07-241-8/+3
| | | | | | | | | | | | | raw data to the doorbell offset in order to clarify the intent and for avoiding unnecessarily converting the endianess back and forth. Unfortunately, the same can't be done in mpt_recv_handshake_reply() as 16-bit data needs to be read using 32-bit bus accessors. - In mpt_recv_handshake_reply(), get rid of a redundant variable. MFC after: 1 fortnight Notes: svn path=/head/; revision=285840
* Squelch a (bogus) used before init warning when building with gcc.Ian Lepore2014-11-231-0/+1
| | | | Notes: svn path=/head/; revision=274926
* Prevent overflow issues in timeout processingSteven Hartland2014-11-211-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | Previously, any timeout value for which (timeout * hz) will overflow the signed integer, will give weird results, since callout(9) routines will convert negative values of ticks to '1'. For unsigned integer overflow we will get sufficiently smaller timeout values than expected. Switch from callout_reset, which requires conversion to int based ticks to callout_reset_sbt to avoid this. Also correct isci to correctly resolve ccb timeout. This was based on the original work done by Eygene Ryabinkin <rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid the overlow. Differential Revision: https://reviews.freebsd.org/D1157 Reviewed by: mav, davide MFC after: 1 month Sponsored by: Multiplay Notes: svn path=/head/; revision=274819
* After r241858, remove the remainder of FreeBSD ~4 support from mpt(4).Marius Strobl2012-10-221-10/+0
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=241874
* Flesh out support for SAS1078 and SAS1078DE (which are said to actuallyMarius Strobl2012-02-111-0/+11
| | | | | | | | | | | | | | | | | | | | be the same chip): - The I/O port resource may not be available with these. However, given that we actually only need this resource for some controllers that require their firmware to be up- and downloaded (which excludes the SAS1078{,DE}) just handle failure to allocate this resource gracefully when possible. While at it, generally put non-fatal resource allocation failures under bootverbose. - SAS1078{,DE} use a different hard reset protocol. - Add workarounds for the 36GB physical address limitation of scatter/ gather elements of these controllers. Tested by: Slawa Olhovchenkov PR: 149220 (remaining part) Notes: svn path=/head/; revision=231518
* Remove extra newlines from panic messages.Marius Strobl2012-02-081-4/+3
| | | | Notes: svn path=/head/; revision=231228
* Increase the IOC port initialization timeouts by ten times to what theMarius Strobl2011-11-011-1/+1
| | | | | | | | | | | | | | corresponding Linux driver uses. This allows mpt(4) to still recognize all good SATA devices in presence of a defective one, which takes about 45 seconds. In the long term we probably should implement the logic used by mpt2sas(4) allowing IOC port initialization to complete at a later time. Submitted by: Andrew Boyer MFC after: 3 days Notes: svn path=/head/; revision=227001
* - Staticize functions as appropriate and comment out unused ones.Marius Strobl2011-07-291-20/+46
| | | | | | | | | | | | - Sprinkle some const where appropriate. - Consistently use target_id_t for the target parameter of mpt_map_physdisk() and mpt_is_raid_volume(). - Fix some whitespace bugs. Approved by: re (kib) Notes: svn path=/head/; revision=224493
* Correct spelling.Marius Strobl2011-04-221-9/+9
| | | | | | | Submitted by: brucec Notes: svn path=/head/; revision=220945
* - Allocate the DMA memory shared between the host and the controller asMarius Strobl2011-03-061-14/+28
| | | | | | | | | | | | | | | coherent. - Add some missing bus_dmamap_sync() calls. This includes putting such calls before calling reply handlers instead of calling bus_dmamap_sync() for the request queue from individual reply handlers as these handlers generally read back updates by the controller. Tested on amd64 and sparc64. MFC after: 2 weeks Notes: svn path=/head/; revision=219335
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.Matthew D Fleming2011-01-121-2/+2
| | | | | | | Commit the rest of the devices. Notes: svn path=/head/; revision=217323
* Improve r56796; the reply handler actually may remove the request fromMarius Strobl2010-09-241-1/+2
| | | | | | | | | | the chain in which case it shouldn't be removed twice. Reported by: Staale Kristoffersen MFC after: 1 week Notes: svn path=/head/; revision=213105
* - Make the maxsize parameter of the data buffer DMA tag match maxio, whichMarius Strobl2010-07-121-3/+5
| | | | | | | | | | | | | was missed in r209599. Reported and tested by: Michael Moll - Declare mpt_dma_buf_alloc() static just like mpt_dma_buf_free(), both are used in mpt.c only. Reviewed by: ken MFC after: r209599 Notes: svn path=/head/; revision=209960
* Change the mpt driver to allow larger I/O sizes.Kenneth D. Merry2010-06-291-16/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mpt driver previously didn't report a 'maxio' size to CAM, and so the da(4) driver limited I/O sizes to DFLTPHYS (64K) by default. The number of scatter gather segments allowed, as reported to busdma, was (128K / PAGE_SIZE) + 1, or 33 on architectures with 4K pages. Change things around so that we wait until we've determined how many segments the adapter can support before creating the busdma tag used for buffers, so we can potentially support more S/G segments and therefore larger I/O sizes. Also, fix some things that were broken about the module unload path. It still gets hung up inside CAM, though. mpt.c: Move some busdma initialization calls in here, and call them just after we've gotten the IOCFacts, and know how many S/G segments this adapter can support. mpt.h: Get rid of MPT_MAXPHYS, it is no longer used. Add max_cam_seg_cnt, which is used to report our maximum I/O size up to CAM. mpt_cam.c: Use max_cam_seg_cnt to report our maximum I/O size to CAM. Fix the locking in mpt_cam_detach(). mpt_pci.c: Pull some busdma initialization and teardown out and put it in mpt.c. We now delay it until we know many scatter gather segments the adapter can support, and therefore how to setup our busdma tags. mpt_raid.c: Make sure we wake up the right wait channel to get the raid thread to wake up when we're trying to shut it down. Reviewed by: gibbs, mjacob MFC after: 2 weeks Notes: svn path=/head/; revision=209599
* On sparc64 obtain the initiator ID to be used for SPI HBAs from theMarius Strobl2010-04-271-0/+2
| | | | | | | | | | | Open Firmware device tree in order to match what the PROM built-in driver uses. This is especially important when netbooting Fujitsu Siemens PRIMEPOWER250 as in that case the built-in driver isn't used and the port facts PortSCSIID defaults to 0, conflicting with the disk at the same address. Notes: svn path=/head/; revision=207287
* Use callout_init_mtx on FreeBSD versions recent enough. This closesAlexander Kabaev2009-10-201-1/+9
| | | | | | | | | | | | | | the race where interrupt thread can complete the request for which timeout has fired and while mpt_timeout has blocked on mpt_lock. Do a best effort to keep 4.x ang Giant-locked configurartions compiling still. Reported by: ups Reviewed by: scottl Notes: svn path=/head/; revision=198262
* Make the whole initiator mode part of mpt(4) endian-clean,Marius Strobl2009-01-071-3/+139
| | | | | | | | | | | | | | | | | | | | | | specifically SPI controllers now also work in big-endian machines and some conversions relevant for FC and SAS controllers as well as support for ILP32 machines which all were omitted in previous attempts are now also implemented. The IOCTL-interface is intentionally left (and where needed actually changed) to be completely little-endian as otherwise we would have to add conversion code for every possible configuration page to mpt(4), which didn't seem the right thing to do, neither did converting only half of the user- interface to the native byte order. This change was tested on amd64 (SAS+SPI), i386 (SAS) and sparc64 (SAS+SPI). Due to lack of the necessary hardware the target mode code is still left to be made endian-clean. Reviewed by: scottl MFC after: 1 month Notes: svn path=/head/; revision=186878
* Don't force a reset at driver attach time. It doesn't work on someScott Long2008-04-031-1/+1
| | | | | | | adapters, apparently. Notes: svn path=/head/; revision=177881
* The MPT driver treats the "core" module with the same importance andScott Long2008-03-311-4/+7
| | | | | | | | | | | | | | | | | | | abstraction as the RAID and CAM modules, making it nearly impossible for enough initialization to be done in time for the RAID module to know whether to attach. On top of this, no reset was being done on the controller on attach, in violation of the spec. Additionally, the port enable step was being deferred to the end of the attach process, long after it should have been done to ensure reliable operation from the controller. Fix all of these with a few hacks to force the "attach" and "enable" steps of the core module early on, and ensure that a reset and port enable also happens early on. In the future, the driver needs to be refactored to eliminate the core module abstraction, clean up withe reset/enable steps, and defer event messages until all of the modules are available to recieve them. Notes: svn path=/head/; revision=177808
* Ever since the module registration system was introduced to this driver,Scott Long2007-11-031-1/+2
| | | | | | | | | it's been printing out scary messages about "Unhanded Event Notify Frame" that are needlessly worrisome to users. Change this warning to only print out at an elevated debugging level. Notes: svn path=/head/; revision=173303
* Spelling fix for interupt -> interruptKevin Lo2007-10-121-3/+3
| | | | Notes: svn path=/head/; revision=172568
* Move callout initialization to the proper spot. This prevents panics duringScott Long2007-08-141-0/+1
| | | | | | | | | | error recovery. Approved by: re Found by: kan Notes: svn path=/head/; revision=171842
* Track an update in the MPI headers that was missed earlier.Scott Long2007-06-041-1/+1
| | | | Notes: svn path=/head/; revision=170276
* mpt.c:Scott Long2007-06-031-29/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | mpt.h: Add support for reading extended configuration pages. mpt_cam.c: Do a top level topology scan on the SAS controller. If any SATA device are discovered in this scan, send a passthrough FIS to set the write cache. This is controllable through the following tunable at boot: hw.mpt.enable_sata_wc: -1 = Do not configure, use the controller default 0 = Disable the write cache 1 = Enable the write cache The default is -1. This tunable is just a hack and may be deprecated in the future. Turning on the write cache alleviates the write performance problems with SATA that many people have observed. It is not recommend for those who value data reliability! I cannot stress this strongly enough. However, it is useful in certain circumstances, and it brings the performence in line with what a generic SATA controller running under the FreeBSD ATA driver provides (and the ATA driver has had the WC enabled by default for years). Notes: svn path=/head/; revision=170252
* Make this driver MP safe and still be a multi-release driver.Matt Jacob2007-05-051-4/+16
| | | | | | | | Obtained from: 99% of the work done by Scott Long. MFC after: 3 days Notes: svn path=/head/; revision=169293
* (commented out) multipath fault injection code.Matt Jacob2007-01-051-0/+8
| | | | | | | Some code to make diffs with RELENG_6 easier. Notes: svn path=/head/; revision=165814
* PH! Forgot to do my cross-compile check. Also now rearranged things soMatt Jacob2006-12-071-6/+9
| | | | | | | the ENDIAN defines are consistent between mpt.h and mpt.c. Notes: svn path=/head/; revision=164998
* MFP4: principally to reapply tagged command support to FC and SAS cards.Matt Jacob2006-12-071-223/+304
| | | | Notes: svn path=/head/; revision=164990
* Fix a debug message which didn't quite get it right about data direction.Matt Jacob2006-12-031-5/+4
| | | | | | | | | Fix things to use the LSI-Logic Fusion Library mask and shift names for offset and sync, no matter how awkward they are, in preference to just plain numbers. Notes: svn path=/head/; revision=164837
* Add big endian support.John Birrell2006-11-151-14/+23
| | | | | | | | Submitted by: scottl Reviewed by: mjacob Notes: svn path=/head/; revision=164315
* Create a 'ready' handler for each personality. The purpose of this handlerMatt Jacob2006-09-071-3/+30
| | | | | | | | | | | | | | | | | | is to able to be called after *all* attach and enable events are done. We establish a SYSINIT hook to call this handler. The current usage for it is to add scsi target resources *after* all enables are done. There seems to be some dependencies between different halves of a dual-port with respect to target mode. Put in more meaningful event messages for some events- in particular QUEUE FULL events so we can see what the queue depth was when the IOC sent us this message. MFC after: 1 week Notes: svn path=/head/; revision=162133
* If we're in mpt_wait_req and the command times out,Matt Jacob2006-07-161-1/+12
| | | | | | | | | | | | | | | | mark it as timed out. Don't try and free the config request for read_cfg_header that times out because it's still active. Put in code for the config reply handler that will then free up timed out requests. Fix the FC_PRIMITIVE_SEND completion to not try and free a command twice. Dunno how this possibly could have been working for awhile. MFC after: 2 weeks Notes: svn path=/head/; revision=160396
* Fix config page writes to not strip out the attributes when youMatt Jacob2006-07-121-10/+29
| | | | | | | | | | | | | | | | actually go write the config page. This fixes the long standing problem about updating NVRAM on Fibre Channel cards and seems so far to not break SPI config page writes. Put back role setting into mpt. That is, you can set a desired role for mpt as a hint. On the next reboot, it'll pick that up and redo the NVRAM settings appropriately and warn you that this won't take effect until the next reboot. This saves people the step of having to find a BIOS utilities disk to set target and/or initiator role for the MPT cards. Notes: svn path=/head/; revision=160290
* Major Fixes:Matt Jacob2006-06-251-11/+13
| | | | | | | | | | | | | | | | | Don't enable/disable I/O space except for SAS adapters. This fixes a problem with VMware 4.5 Workstation. Fix an egregious bug introduced to target mode so it actually will not panic when you first enable a lun. Minor fixes: Take more infor from port facts and configuration pages. MFC after: 1 week Notes: svn path=/head/; revision=159919
* More checkpointing on the way toward really (finally)Matt Jacob2006-06-021-0/+3
| | | | | | | | | | | fixing speed negotiation. Also fix the mpt_execute_req function to actually match mpt_execute_req_a64. This may explain why i386 users were having more grief. Notes: svn path=/head/; revision=159178
* Add acknowledgements to LSI-Logic for supportMatt Jacob2006-05-291-0/+4
| | | | Notes: svn path=/head/; revision=159052
* Work in progress toward fixing IM checked in after havingMatt Jacob2006-05-271-38/+51
| | | | | | | | | | | | | | | | | | | | | lost one set to a peninsula power failure last night. After this, I can see both submembers and the raid volumes again, but speed negotiation is still broken. Add a mpt_raid_free_mem function to centralize the resource reclaim and fixed a small memory leak. Remove restriction on number of targets for systems with IM enabled- you can have setups that have both IM volumes as well as other devices. Fix target id selection for passthru and nonpastrhu cases. Move complete command dumpt to MPT_PRT_DEBUG1 level so that just setting debug level gets mostly informative albeit less verbose dumping. Notes: svn path=/head/; revision=158982
* Remove handrolled raw dump of a request fromMatt Jacob2006-05-261-19/+1
| | | | | | | mpt_send_cmd and replace with a new debug function. Notes: svn path=/head/; revision=158932
* Remove debounce code in mpt_intr. After some reflectionMatt Jacob2006-04-191-10/+0
| | | | | | | | and watching a debounce followed by a timeout, I think I'm forced to conclude that it was not a good idea. Notes: svn path=/head/; revision=157885
* A large set of changes:Matt Jacob2006-04-111-33/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | + Add boatloads of KASSERTs and *really* check out more locking issues (to catch recursions when we actually go to real locking in CAM soon). The KASSERTs also caught lots of other issues like using commands that were put back on free lists, etc. + Target mode: role setting is derived directly from port capabilities. There is no need to set a role any more. Some target mode resources are allocated early on (ELS), but target command buffer allocation is deferred until the first lun enable. + Fix some breakages I introduced with target mode in that some commands are *repeating* commands. That is, the reply shows up but the command isn't really done (we don't free it). We still need to take it off the pending list because when we resubmit it, bad things then happen. + Fix more of the way that timed out commands and bus reset is done. The actual TMF response code was being ignored. + For SPI, honor BIOS settings. This doesn't quite fix the problems we've seen where we can't seem to (re)negotiate U320 on all drives but avoids it instead by letting us honor the BIOS settings. I'm sure this is not quite right and will have to change again soon. Notes: svn path=/head/; revision=157662
* Fix fat-fingered version define.Matt Jacob2006-04-011-2/+2
| | | | Notes: svn path=/head/; revision=157382