summaryrefslogtreecommitdiff
path: root/sys/dev/isp/isp_target.c
Commit message (Collapse)AuthorAgeFilesLines
* Some code reorganization.Alexander Motin2020-11-271-37/+5
| | | | | | | | | | | | | | | | - Remove code duplication by adding two new functions to execute prepared queue entry via either mbox or request queue and wait for result. - Since the new function executing via request queue sleeps any way, make it sleep also in case of overflows or handle shortages. It should make it more reliable and less affecting other less flexible request queue users. - Turn isp_target_put_entry() into not target-specific isp_send_entry(). - Make handling of responses with control handles more universal. - Move RQSTYPE_RPT_ID_ACQ handling into new function. - Inline isp_handle_other_response(), becoming trivial after above. - Clean the list of IOCBs from pre-24xx ones. Notes: svn path=/head/; revision=368105
* Restore break statement lost in r367857.Alexander Motin2020-11-271-0/+1
| | | | Notes: svn path=/head/; revision=368091
* Remove some more dead code from pre-24xx.Alexander Motin2020-11-261-11/+3
| | | | Notes: svn path=/head/; revision=368043
* Increase queue depths from 1024/256 to 8192/1024 IOCBs.Alexander Motin2020-11-201-2/+2
| | | | | | | | | | | | | | Qlogic chips store S/G lists in the same queue as requests themselves. In the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024 IOCBs can store only 19 of such requests. The increase reduces chances of overflow, while we should be able to afford additional 512KB of RAM per HBA. The Linux driver uses comparable numbers. While there, decouple ATIO queue size from response queue size. There is no reason for them to be equal. Notes: svn path=/head/; revision=367909
* Cleanup DMA handling.Alexander Motin2020-11-201-3/+1
| | | | | | | | | | | | - Make isp_start() to set all the IOCB fields aside of S/G list, removing extra information from isp_send_cmd(), now only doing S/G lists and sending. - Turn DMA setup/free from being card and PCI-specific into OS-specific, instead add new card-specific method for isp_send_cmd(). Previously this function was a monster handling all the cards. - Remove double error code translation. Notes: svn path=/head/; revision=367906
* Remove parallel SCSI and 1/2Gb FC support from isp(4).Alexander Motin2020-11-201-753/+104
| | | | | | | | | | | | | | | | | | | | | This removes 288KB (36%) of the driver code and zillions of hacks and workarounds, making single driver uniformly support several different generations of hardware interfaces, not counting minor card variations. After years of the hopeless fight, I don't think it worth to continue support for hardware obsolete for 15-20 years. Instead much cleaner now code should allow to move forward toward better locking, multiple queues and other cool features. All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use the same hardware/firmware interface with minor incremental improvements, so it seems to be a good new starting point. Except one PCI-X model all all of them are PCIe and so still usable in modern systems. Discussed with: ken, scottl, jpaetzel, imp Relnotes: yes Notes: svn path=/head/; revision=367857
* 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
* Remove hackish code delaying ATIOs to unknown virtual port.Alexander Motin2017-03-191-12/+21
| | | | | | | | | | Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful in loop mode, which probably doesn't worth having this hack in 2017. MFC after: 2 weeks Notes: svn path=/head/; revision=315545
* Move <= 23xx PDB workaround to generic code.Alexander Motin2017-03-191-3/+21
| | | | | | | | | It is chip-specific and has nothing to do with platform. MFC after: 2 weeks Notes: svn path=/head/; revision=315536
* Move 24xx RQSTYPE_NOTIFY handling to generic code.Alexander Motin2017-03-191-39/+138
| | | | | | | | | This code has nothing to do with specific platform. MFC after: 2 weeks Notes: svn path=/head/; revision=315533
* Reorganize RQSTYPE_NOTIFY handling for chips <= 23xx.Alexander Motin2017-03-181-111/+86
| | | | | | | | | | | There were two copies of the code: one in generic code was half-broken, and another in platform code was never called. Leave only one in generic code and working. MFC after: 2 weeks Notes: svn path=/head/; revision=315507
* Move RQSTYPE_ABTS_RCVD parsing into generic code.Alexander Motin2017-03-181-1/+43
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=315489
* Extend nt_lun to full 8 byte.Alexander Motin2017-03-181-5/+5
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=315488
* Remove dead remnants of SPI target.Alexander Motin2017-03-181-6/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=315485
* Use isp_target_put_entry() in places where it can be.Alexander Motin2017-03-181-45/+28
| | | | | | | | | This unifies the code and removes some duplication. MFC after: 2 weeks Notes: svn path=/head/; revision=315482
* Do some notify acks cleanup.Alexander Motin2017-03-181-71/+67
| | | | | | | | | ISPASYNC_TARGET_NOTIFY_ACK makes no sense without argument. MFC after: 2 weeks Notes: svn path=/head/; revision=315478
* Remove some dead/broken code paths around async handlingAlexander Motin2017-03-141-2/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=315279
* Remove code for unsupported FreeBSD versions.Alexander Motin2017-03-121-6/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=315160
* Fix residual length reporting in target mode.Alexander Motin2017-02-261-6/+2
| | | | | | | | | | | This allows to properly handle cases when target wants to receive or send more data then initiator wants to send or receive. Previously in such cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0. MFC after: 2 weeks Notes: svn path=/head/; revision=314299
* Fix multiple problems around LUN disable under load.Alexander Motin2017-02-221-1/+4
| | | | | | | | | | | | | | | | | | | | - Move private data about ATIOs/INOTs from per-LUN to per-channel data. This allows active commands to continue operation after LUN destruction. This also simplifies lookup of the data by tag in some situations. - Unify three restart_queue processing implementations. - Complete all ATIOs from restart_queue on LUN disable. - Delete ATIO private data when command completed or aborted, not depending on the ATIO being requeued, that was ugly hack and could never happen. CAM should always call ether XPT_CONT_TARGET_IO with status or XPT_ABORT. - Implement XPT_ABORT for queued ATIOs/INOTs to allow CAM do graceful shutdown, not depending on LUN disable, as it is done in ahd(4)/targ(4). - Unify isp_endcmd() arguments to make it more usable in generic code. - Remove never really used LUN state reference counter. MFC after: 2 weeks Notes: svn path=/head/; revision=314086
* Add proper reporting for early task management errors.Alexander Motin2016-05-191-4/+18
| | | | | | | | This covers unknown requests and requests to unknown virtual ports. Previously it "worked" only because of timeout handling on initiator. Notes: svn path=/head/; revision=300218
* Unify Multi ID target code by reusing isp_find_chan_by_did().Alexander Motin2016-05-181-10/+9
| | | | Notes: svn path=/head/; revision=300157
* Fix FCP_CMD LENGTH mask in ATIO7 IOCB.Alexander Motin2016-05-131-1/+1
| | | | | | | | | This caused "long IU length (16384) ignored" errors following by others. MFC after: 2 weeks Notes: svn path=/head/; revision=299691
* Unify handles allocation for initiator and target IOCBs.Alexander Motin2015-12-251-2/+2
| | | | | | | | | I am not sure why this was split long ago, but I see no reason for it. At this point this unification just slightly reduces memory usage, but as next step I plan to reuse shared handle space for other IOCB types. Notes: svn path=/head/; revision=292725
* Rename ASYNC_LIP_F8 to ASYNC_LIP_NOS_OLS_RECV.Alexander Motin2015-11-241-1/+1
| | | | | | | New name better repsents its meaning for modern chips. Notes: svn path=/head/; revision=291265
* Rip off target mode support for parallel SCSI QLogic adapters.Alexander Motin2015-11-231-522/+44
| | | | | | | | | | Hacks to enable target mode there complicated code, while didn't really work. And for outdated hardware fixing it is not really interesting. Initiator mode tested with Qlogic 1080 adapter is still working fine. Notes: svn path=/head/; revision=291188
* Remove some confusions between loopid and nphdl.Alexander Motin2015-11-181-24/+24
| | | | | | | | | | | Modern cards in most cases operate abstract port handles, that have no any relation to real loop IDs. Leave loopid used only where it really goes about local loop IDs. While there, fix few more cases where LUNs were still printed in decimal. Notes: svn path=/head/; revision=291013
* Deliver INOTs only to enabled virtual ports.Alexander Motin2015-10-251-0/+2
| | | | Notes: svn path=/head/; revision=289942
* Add PIM_EXTLUNS support to isp(4) driver.Alexander Motin2015-10-241-3/+9
| | | | | | | | | Now 24xx and above chips support full 8-byte LUN address space. Older FC chips may support up to 16K LUNs when firmware allows. Tested in both initiator and target modes for 23xx, 24xx and 25xx. Notes: svn path=/head/; revision=289882
* Add partial support for QUERY TMF to CAM and isp(4).Alexander Motin2015-10-231-1/+7
| | | | | | | | | | | This change allows to decode respective functions in isp(4) in target mode and pass them through CAM to CTL. Unfortunately neither CAM nor isp(4) support returning response info for those task management functions now. On the other side I just have no initiator to test this functionality. Notes: svn path=/head/; revision=289843
* Improve INOTs handling for 24xx and above chips.Alexander Motin2015-10-231-0/+1
| | | | Notes: svn path=/head/; revision=289838
* -----------Matt Jacob2012-07-281-35/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MISC CHANGES Add a new async event- ISP_TARGET_NOTIFY_ACK, that will guarantee eventual delivery of a NOTIFY ACK. This is tons better than just ignoring the return from isp_notify_ack and hoping for the best. Clean up the lower level lun enable code to be a bit more sensible. Fix a botch in isp_endcmd which was messing up the sense data. Fix notify ack for SRR to use a sensible error code in the case of a reject. Clean up and make clear what kind of firmware we've loaded and what capabilities it has. ----------- FULL (252 byte) SENSE DATA In CTIOs for the ISP, there's only a limimted amount of space to load SENSE DATA for associated CHECK CONDITIONS (24 or 26 bytes). This makes it difficult to send full SENSE DATA that can be up to 252 bytes. Implement MODE 2 responses which have us build the FCP Response in system memory which the ISP will put onto the wire directly. On the initiator side, the same problem occurs in that a command status response only has a limited amount of space for SENSE DATA. This data is supplemented by status continuation responses that the ISP pushes onto the response queue after the status response. We now pull them all together so that full sense data can be returned to the periph driver. This is supported on 23XX, 24XX and 25XX cards. This is also preparation for doing >16 byte CDBs. ----------- FC TAPE Implement full FC-TAPE on both initiator and target mode side. This capability is driven by firmware loaded, board type, board NVRAM settings, or hint configuration options to enable or disable. This is supported for 23XX, 24XX and 25XX cards. On the initiator side, we pretty much just have to generate a command reference number for each command we send out. This is FCP-4 compliant in that we do this per ITL nexus to generate the allowed 1 thru 255 CRN. In order to support the target side of FC-TAPE, we now pay attention to more of the PRLI word 3 parameters which will tell us whether an initiator wants confirmed responses. While we're at it, we'll pay attention to the initiator view too and report it. On sending back CTIOs, we will notice whether the initiator wants confirmed responses and we'll set up flags to do so. If a response or data frame is lost the initiator sends us an SRR (Sequence Retransmit Request) ELS which shows up as an SRR notify and all outstanding CTIOs are nuked with SRR Received status. The SRR notify contains the offset that the initiator wants us to restart the data transfer from or to retransmit the response frame. If the ISP driver still has the CCB around for which the data segment or response applies, it will retransmit. However, we typically don't know about a lost data frame until we send the FCP Response and the initiator totes up counters for data moved and notices missing segments. In this case we've already completed the data CCBs already and sent themn back up to the periph driver. Because there's no really clean mechanism yet in CAM to handle this, a hack has been put into place to complete the CTIO CCB with the CAM_MESSAGE_RECV status which will have a MODIFY DATA POINTER extended message in it. The internal ISP target groks this and ctl(8) will be modified to deal with this as well. At any rate, the data is retransmitted and an an FCP response is sent. The whole point here is to successfully complete a command so that you don't have to depend on ULP (SCSI) to have to recover, which in the case of tape is not really possible (hence the name FC-TAPE). Sponsored by: Spectralogic MFC after: 1 month Notes: svn path=/head/; revision=238869
* Revamp the pieces of some of the stuff I forgot to do when shifting toMatt Jacob2010-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 32 bit handles. The RIO (reduced interrupt operation) and fast posting for the parallel SCSI cards were all 16 bit handles. Furthermore, target mode parallel SCSI only can have 16 bit handles. Use part of a supplied patch to switch over to using 32 bit handles. Be a bit more conservative here and only do this for parallel SCSI for the 12160 (Ultra3) cards. There were a lot of marginal Ultra2 cards, and, frankly, few are findable now for testing. Fix the target handle routine to only do 16 bit handles for parallel SCSI cards. This is okay because the upper sixteen bits of the new 32 bit handles is a sequence number to help protect against duplicate completions. This would be very unlikely to happen with parallel SCSI target mode, and wasn't present before, so we're no worse off than we used to be. While we're at it, finally split the async mailbox completion handlers into FC and parallel SCSI functions. This makes it much cleaner and easier to figure out what is or isn't a legal async mailbox completion code for different card classes. PR: kern/144250 Submitted partially by: Charles D MFC after: 1 week Notes: svn path=/head/; revision=204397
* Add 8Gb support (isp_2500). Fix a fair number of configuration andMatt Jacob2009-08-011-421/+526
| | | | | | | | | | | | | | | | | | | | | | | | firmware loading bugs. Target mode support has received some serious attention to make it more usable and stable. Some backward compatible additions to CAM have been made that make target mode async events easier to deal with have also been put into place. Further refinement and better support for NP-IV (N-port Virtualization) is now in place. Code for release prior to RELENG_7 has been stripped away for code clarity. Sponsored by: Copan Systems Reviewed by: scottl, ken, jung-uk kim Approved by: re Notes: svn path=/head/; revision=196008
* Spelling fix for interupt -> interruptKevin Lo2007-10-121-2/+2
| | | | Notes: svn path=/head/; revision=172568
* Fix some stupid copyright mistakes that have been there for quite some time.Matt Jacob2007-03-101-24/+26
| | | | Notes: svn path=/head/; revision=167403
* Grumble- let a linux-ism slip in and had an llx whichMatt Jacob2007-01-201-9/+12
| | | | | | | then choked on a 64 bit platforms. Oops. Notes: svn path=/head/; revision=166127
* MFP4: Move default setting to the end of isp_reset instead of theMatt Jacob2007-01-201-6/+8
| | | | | | | | | | | | | front of isp_init so we can read NVRAM even if we're role ISP_NONE. Prepare for reintroduction of channels (for FC) for N-Port Virtualization. Fix a botch in handle assignment that caused us to nuke one device when a new one arrives and end up with two devices with the same identity in the virtual target mapping table. Notes: svn path=/head/; revision=166120
* Add a chip timeout to ENABLE/MODIFY/DISABLE lun calls.Matt Jacob2006-12-051-0/+1
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=164908
* Add 4Gb (24XX) support and lay the foundation for a lot of new stuff.Matt Jacob2006-11-021-74/+518
| | | | Notes: svn path=/head/; revision=163899
* Fix na_fcentry_t to not have a lun field. Fix indentation in handlyMatt Jacob2006-08-041-26/+43
| | | | | | | | | | | | the notify structs. Fix messages in isp_got_msg_fc to print out the loop id of the sender- not the wwpn which will be synthesized later, if possible, in the outer layers. Put in debug printouts to pair a notify ack to a notify so one can see the start/close of an immediate notify event. Put in spsace for TASK MANAGEMENT response flags (which we don't do yet). Notes: svn path=/head/; revision=160978
* Some rearrangement of headers to minimize diffs with outside ofMatt Jacob2006-07-161-5/+2
| | | | | | | | | | | FreeBSD repository and to clean up the license header so as to not pollute the license with file function. Zero all mailbox structures prior to use (just in case). Change the outgoing mailbox count for INIT_FIRMWARE to be correct. Notes: svn path=/head/; revision=160410
* Put in some missing target mode for 2KLOGIN f/w spots.Matt Jacob2006-07-101-10/+24
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=160251
* Redo some code based upon issues found by Coverity.Matt Jacob2006-04-211-1/+1
| | | | Notes: svn path=/head/; revision=157945
* Some more gratuitous format and name changes.Matt Jacob2006-04-211-28/+28
| | | | | | | | | | Pull in some target mode changes from a private branch. Pull in some more RELENG_4 compilation changes. A lot of lines changed, but not much content change yet. Notes: svn path=/head/; revision=157943
* a) clean up some declaration stuff (i.e., make more modern with respectMatt Jacob2006-02-151-22/+23
| | | | | | | | | | | | | | | | | | to getting rid u_int for uint and so on). b) Turn back on 64 bit DAC support. Cheeze it a bit in that we have two DMA callback functions- one when we have bus_addr_t > 4 bits in width and the other which should be normal. Even Cheezier in that we turn off setting up DMA maps to be BUS_SPACE_MAXADDR if we're in ISP_TARGET_MODE. More work on this in a week or so. c) Tested under amd64 and 1MB DFLTPHYS, sparc64, i386 (PAE, but insufficient memory to really test > 4GB). LINT check under amd64. MFC after: 1 month Notes: svn path=/head/; revision=155704
* First of several commits as this driver is dusted off and maybe broughtMatt Jacob2006-01-231-125/+216
| | | | | | | | | | | | | | | | | | | | | up to date. Principle changes for this reelase is to support 2K Port Login firmware. This allows us to support the 2322 (and 2422 4Gb) cards which only come with the 2K Port Login firmware. The 2322 should now work- but we don't have firmware sets for it in ispfw (as the change to load 2K Port Login f/w hasn't been made- that f/w is so big it has to be loaded in more than one chunk). Other changes are the beginnings of cleaning up some long standing target mode issues. The next changes here will incorporate a lot of bug fixes from others. Finally, some copyright cleanup and attempts to make the parts of the driver that are FreeBSD specific start conforming more to FreeBSD style. MFC after: 1 month Notes: svn path=/head/; revision=154704
* Macroize the making of tag ids.Matt Jacob2005-01-231-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=140651
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Store the target handles in a separate list from normal commands. Add aNate Lawson2004-05-241-2/+2
| | | | | | | | | CTIO fast post routine to handle CTIO completions. Submitted by: mjacob Notes: svn path=/head/; revision=129643