summaryrefslogtreecommitdiffstats
path: root/sys/dev/mpt/mpt.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r285840marius2015-12-271-8/+3
| | | | | | | | | - In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing 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 r274926: Squelch a (bogus) gcc used before init warningian2014-12-271-0/+1
|
* MFC r274819:smh2014-12-211-6/+8
| | | | | | | | | Prevent overflow issues in timeout processing MFC r274852: Fix build with asr driver Sponsored by: Multiplay
* After r241858, remove the remainder of FreeBSD ~4 support from mpt(4).marius2012-10-221-10/+0
| | | | MFC after: 1 week
* Flesh out support for SAS1078 and SAS1078DE (which are said to actuallymarius2012-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)
* Remove extra newlines from panic messages.marius2012-02-081-4/+3
|
* Increase the IOC port initialization timeouts by ten times to what themarius2011-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
* - Staticize functions as appropriate and comment out unused ones.marius2011-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)
* Correct spelling.marius2011-04-221-9/+9
| | | | Submitted by: brucec
* - Allocate the DMA memory shared between the host and the controller asmarius2011-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
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-121-2/+2
| | | | Commit the rest of the devices.
* Improve r56796; the reply handler actually may remove the request frommarius2010-09-241-1/+2
| | | | | | | the chain in which case it shouldn't be removed twice. Reported by: Staale Kristoffersen MFC after: 1 week
* - Make the maxsize parameter of the data buffer DMA tag match maxio, whichmarius2010-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
* Change the mpt driver to allow larger I/O sizes.ken2010-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
* On sparc64 obtain the initiator ID to be used for SPI HBAs from themarius2010-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.
* Use callout_init_mtx on FreeBSD versions recent enough. This closeskan2009-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
* Make the whole initiator mode part of mpt(4) endian-clean,marius2009-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
* Don't force a reset at driver attach time. It doesn't work on somescottl2008-04-031-1/+1
| | | | adapters, apparently.
* The MPT driver treats the "core" module with the same importance andscottl2008-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.
* Ever since the module registration system was introduced to this driver,scottl2007-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.
* Spelling fix for interupt -> interruptkevlo2007-10-121-3/+3
|
* Move callout initialization to the proper spot. This prevents panics duringscottl2007-08-141-0/+1
| | | | | | | error recovery. Approved by: re Found by: kan
* Track an update in the MPI headers that was missed earlier.scottl2007-06-041-1/+1
|
* mpt.c:scottl2007-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).
* Make this driver MP safe and still be a multi-release driver.mjacob2007-05-051-4/+16
| | | | | Obtained from: 99% of the work done by Scott Long. MFC after: 3 days
* (commented out) multipath fault injection code.mjacob2007-01-051-0/+8
| | | | Some code to make diffs with RELENG_6 easier.
* PH! Forgot to do my cross-compile check. Also now rearranged things somjacob2006-12-071-6/+9
| | | | the ENDIAN defines are consistent between mpt.h and mpt.c.
* MFP4: principally to reapply tagged command support to FC and SAS cards.mjacob2006-12-071-223/+304
|
* Fix a debug message which didn't quite get it right about data direction.mjacob2006-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.
* Add big endian support.jb2006-11-151-14/+23
| | | | | Submitted by: scottl Reviewed by: mjacob
* Create a 'ready' handler for each personality. The purpose of this handlermjacob2006-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
* If we're in mpt_wait_req and the command times out,mjacob2006-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
* Fix config page writes to not strip out the attributes when youmjacob2006-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.
* Major Fixes:mjacob2006-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
* More checkpointing on the way toward really (finally)mjacob2006-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.
* Add acknowledgements to LSI-Logic for supportmjacob2006-05-291-0/+4
|
* Work in progress toward fixing IM checked in after havingmjacob2006-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.
* Remove handrolled raw dump of a request frommjacob2006-05-261-19/+1
| | | | mpt_send_cmd and replace with a new debug function.
* Remove debounce code in mpt_intr. After some reflectionmjacob2006-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.
* A large set of changes:mjacob2006-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.
* Fix fat-fingered version define.mjacob2006-04-011-2/+2
|
* Fix some of the previus changes 'better'.mjacob2006-04-011-52/+125
| | | | | | | | | | | | | | | | | | | | | | | There's something strange going on with async events. They seem to be be treated differently for different Fusion implementations. Some will really tell you when it's okay to free the request that started them. Some won't. Very disconcerting. This is particularily bad when the chip (FC in this case) tells you in the reply that it's not a continuation reply, which means you can free the request that its associated with. However, if you do that, I've found that additional async event replies come back for that message context after you freed it. Very Bad Things Happen. Put in a reply register debounce. Warn about out of range context indices. Use more MPILIB defines where possible. Replace bzero with memset. Add tons more KASSERTS. Do a *lot* more request free list auditting and serial number usages. Get rid of the warning about the short IOC Facts Reply. Go back to 16 bits of context index. Do a lot more target state auditting as well. Make a tag out of not only the ioindex but the request index as well and worry less about keeping a full serial number.
* Correct bad format args. Interesting- the lines that generatedmjacob2006-03-261-2/+2
| | | | | | | | the error on sparc64 hadn't changed since the last checkin, pass LINT on other platforms and mpt doesn't work on sparc64 anyway and the tinderbox build didn't work for me in a cross build case on my main build machine (which runs RELENG_6). Sigh. Still need to try harder.
* Some fairly major changes to this driver.mjacob2006-03-251-338/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A) Fibre Channel Target Mode support mostly works (SAS/SPI won't be too far behind). I'd say that this probably works just about as well as isp(4) does right now. Still, it and isp(4) and the whole target mode stack need a bit of tightening. B) The startup sequence has been changed so that after all attaches are done, a set of enable functions are called. The idea here is that the attaches do whatever needs to be done *prior* to a port being enabled and the enables do what need to be done for enabling stuff for a port after it's been enabled. This means that we also have events handled by their proper handlers as we start up. C) Conditional code that means that this driver goes back all the way to RELENG_4 in terms of support. D) Quite a lot of little nitty bug fixes- some discovered by doing RELENG_4 support. We've been living under Giant *waaaayyyyy* too long and it's made some of us (me) sloppy. E) Some shutdown hook stuff that makes sure we don't blow up during a reboot (like by the arrival of a new command from an initiator). There's been some testing and LINT checking, but not as complete as would be liked. Regression testing with Fusion RAID instances has not been possible. Caveat Emptor. Sponsored by: LSI-Logic.
* In mpt_complete_request_chain don't depend on somebody else tomjacob2006-03-171-1/+1
| | | | remove the request from the TAILQ.
* Add a serial number for requests so we don't just depend on a request pointermjacob2006-03-071-0/+4
| | | | to try and do forensics on what has occurred.
* turn some WARNs for unknown events into INFOsmjacob2006-03-041-2/+2
|
* Fix mpt_reset to try mpt_hard_reset more than once, and to trymjacob2006-02-281-43/+85
| | | | | | | | | | | | | | | | | | mpt_soft_reset more than once. And to wait for MPT_DB_STATE_READY twice. I mean, this is crucial- give the IOC a chance to get ready. If mpt_reset is called to reinit things, and we succeed, make sure to re-enable interrupts. This is what has mostly led to system lockup after having to hard reset the chip. Also, if we think that interrupts aren't function in mpt_cam_timeout, for goodness sake, turn them on again. In read_cfg_header, return distinguishing errnos so the caller can decide what's an error. It's *not* an error to fail to read a RAID page from a non-RAID capable device like the FC929X. Some whitespace fixes (removing spaces from ends of lines).
* a) Delay for port enable to succeed should be 30 seconds (at least) formjacob2006-02-261-4/+2
| | | | | | | | *both* SAS and FC, not just SAS. b) Don't tell the chip we want it to do FIFO signalling if we actually don't set up the address where the FIFO signal is supposed to be written (oops).
* Role a microrev of the MPI Library in preparation for target mode work.mjacob2006-02-251-3/+34
| | | | | | Make my portions of the license clearer. Thank Chris Ellsworth for his support in getting a bunch of this done.
OpenPOWER on IntegriCloud