summaryrefslogtreecommitdiff
path: root/sys/dev/isp
Commit message (Collapse)AuthorAgeFilesLines
* MFC r226118:Marius Strobl2011-10-121-0/+1
| | | | | | | | | | | | Sync with ahc(4)/ahd(4)/sym(4) etc: Zero any sense not transferred by the device as the SCSI specification mandates that any untransferred data should be assumed to be zero. Reviewed by: ken Approved by: re (kib) Notes: svn path=/stable/9/; revision=226303
* MFC r225950:Kenneth D. Merry2011-10-061-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add descriptor sense support to CAM, and honor sense residuals properly in CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only. mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed. sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly. sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data(). ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key. mps_sas.c, mpt_cam.c: Set the sense residual properly. iir.c: Use scsi_set_sense_data() instead of building sense data by hand. iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly. umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly. isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual. Approved by: re (kib) Sponsored by: Spectra Logic Corporation Notes: svn path=/stable/9/; revision=226067
* Most of these changes to isp are to allow for isp.ko unloading.Matt Jacob2011-08-135-59/+186
| | | | | | | | | | | | | | We also revive loop down freezes. We also externaliz within isp isp_prt_endcmd so something outside the core module can print something about a command completing. Also some work in progress to assist in handling timed out commands better. Partially Sponsored by: Panasas Approved by: re (kib) MFC after: 1 month Notes: svn path=/head/; revision=224856
* Fixes zombie device and loop down timers so that they work more thanMatt Jacob2011-08-122-6/+39
| | | | | | | | | | | | | | | once. Use taskqueues to do the actual work. Fix an offset line. Fix isp_prt so that prints from just one buffer, which makes it appear cleanly cleanly in logs on SMP systems. Approved by: re (kib) MFC after: 1 month Notes: svn path=/head/; revision=224804
* Add support QLE220 card- an 2500 lookalike.Matt Jacob2011-03-101-0/+15
| | | | | | | | Obtained mostly from: Roman && Konstantin MFC after: 1 week Notes: svn path=/head/; revision=219471
* Flush both reads *and* writes to registers.Matt Jacob2011-03-051-1/+1
| | | | | | | | Obtained from: Miod Vallat in OpenBSD MFC after: 1 week Notes: svn path=/head/; revision=219282
* Sync FreeBSD ISP with mercurial tree. Minor changes having to do withMatt Jacob2011-02-284-6/+9
| | | | | | | a macro for minima. Notes: svn path=/head/; revision=219098
* - Use the correct DMA tag/map pair for synchronize the FC scratch area.Marius Strobl2011-02-147-49/+61
| | | | | | | | | | | | | | - Allocate coherent DMA memory for the request/response queue area and and the FC scratch area. These changes allow isp(4) to work properly on sparc64 with usage of the IOMMU streaming buffers enabled. Approved by: mjacob MFC after: 2 weeks Notes: svn path=/head/; revision=218691
* Partially revert 208119. We were overwriting tunable settings.Matt Jacob2010-11-271-3/+0
| | | | | | | | Obtained from: Oleg Sharoyko MFC after: 1 week Notes: svn path=/head/; revision=215951
* Fix typos.Rebecca Cran2010-11-091-7/+7
| | | | | | | | PR: bin/148894 Submitted by: olgeni Notes: svn path=/head/; revision=215034
* Don't pass a buffer directly as a printflike format string.Matt Jacob2010-06-101-1/+1
| | | | | | | | Found by: clang MFC after: 1 month Notes: svn path=/head/; revision=208997
* Fix XPT_GET_TRAN_SETTING for FC which has been broken for while so thatMatt Jacob2010-06-071-2/+4
| | | | | | | | | | it will figure out the correct target to handle index and be able to find things like WWPN, etc. MFC after: 2 weeks Notes: svn path=/head/; revision=208895
* Be more specific about which CDB length we're going to use. Not really a likelyMatt Jacob2010-06-051-4/+14
| | | | | | | | | | | | bug but we might as well be clearer. Found with: Coverity Prevent(tm) CID: 3981 MFC after: 2 weeks Notes: svn path=/head/; revision=208849
* Make the internal target > SPC2 (so REPORT LUNS can be tested).Matt Jacob2010-06-051-2/+8
| | | | | | | | | | Give the NIL inquiry data real values other than just plain 0x7f in the first byte. MFC after: 2 weeks Notes: svn path=/head/; revision=208809
* I was getting panics in sleepq_add for the second sleep in isp_kthread.Matt Jacob2010-06-051-1/+3
| | | | | | | | | | I don't know why- but it occurred to me in looking at the second sleep is that all I want is a pause- not an actual sleep. So do that instead. MFC after: 2 weeks Notes: svn path=/head/; revision=208808
* Various minor and not so minor fixes suggested by Coverity.Matt Jacob2010-06-024-44/+52
| | | | | | | | | | In at least one case, it's amazing that target mode worked at all. Found by: Coverity. MFC after: 2 weeks Notes: svn path=/head/; revision=208761
* Add a new primitive, XPT_SCAN_TGT, to cover the range between scanning aMatt Jacob2010-05-261-7/+2
| | | | | | | | | | | | | | whole bus (XPT_SCAN_BUS) and a single lun on that bus (XPT_SCAN_LUN). It's less resource comsumptive than scanning a whole bus when the caller knows only one target has changes. Reviewed by: scsi@ Sponsored by: Panasas MFC after: 1 month Notes: svn path=/head/; revision=208582
* Don't leak CCBs for every ABORT.Matt Jacob2010-05-251-1/+4
| | | | | | | | Submitted by: Ken Merry MFC after: One week Notes: svn path=/head/; revision=208548
* Remove extra break left by hand editing.Matt Jacob2010-05-251-1/+0
| | | | | | | | X-MFC: 208542 MFC after: One Month Notes: svn path=/head/; revision=208543
* Treat PRLI the same as PLOGI and make a database entry for it (target mode).Matt Jacob2010-05-251-3/+8
| | | | | | | | Obtained from: Ken Merry MFC after: One Month Notes: svn path=/head/; revision=208542
* Correct compilation error introduced in last commit.Matt Jacob2010-05-161-2/+2
| | | | | | | | | | | X-MFC: 208119 MFC after: 1 week Sponsored By: Panasas Pointy Hat to: Me Noticed by: Rob Notes: svn path=/head/; revision=208129
* Whap. Hook up some wires that were forgotten a few months ago and restoreMatt Jacob2010-05-152-18/+15
| | | | | | | | | | the zombie device timeout code and the loop down time code and the fabric hysteresis code. MFC after: 1 week Sponsored By: Panasas Notes: svn path=/head/; revision=208119
* On sparc64 obtain the initiator ID from the Open Firmware device treeMarius Strobl2010-05-032-5/+12
| | | | | | | | | in order to match what the PROM built-in driver uses. Approved by: mjacob Notes: svn path=/head/; revision=207579
* D'oh- isp_handle_index' logic was reversed (not used in FreeBSD).Matt Jacob2010-03-261-2/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=205712
* Clean up some printing stuff so that we can have a bit finer controlMatt Jacob2010-03-264-150/+100
| | | | | | | | | | | | | on debug output. Add a new platform function requirement to allow for printing based upon the ITL nexus instead of the isp unit plus channel, target and lun. This allows some printouts and error messages from the core code to appear in the same format as the platform's subsystem (in FreeBSD's case, CAM path). MFC after: 1 week Notes: svn path=/head/; revision=205698
* Put gone device timer into a structure tag that can hold more than 32 ↵Matt Jacob2010-03-174-17/+24
| | | | | | | | | | | | | seconds. Oops. Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've turned off autologin and find them, or rather don't, via camcontrol rescan. MFC after: 1 month Notes: svn path=/head/; revision=205236
* Revamp the pieces of some of the stuff I forgot to do when shifting toMatt Jacob2010-02-278-245/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix misallocation error in target mode.Matt Jacob2010-02-271-1/+1
| | | | | | | MFC after: 1 day Notes: svn path=/head/; revision=204384
* xpt_rescan only honors a wildcard in the target field. Revert the previousMatt Jacob2010-02-231-1/+6
| | | | | | | | | | | | change and have isp_make_here scan the whole bus which will then scan all luns. I think xpt_rescan needs to be fixed, but that's a separable issue. Suggested by: Alexander Notes: svn path=/head/; revision=204246
* When we rescan, just scan from logical unit 0. In other words, don'tMatt Jacob2010-02-231-1/+1
| | | | | | | | | | | specify a wildcard lun here. This unbreaks disk re-arrival. MFC after: 2 days Notes: svn path=/head/; revision=204231
* Don't try and re-use a handle, even if the firmware tells you that's what is ↵Matt Jacob2010-02-181-30/+33
| | | | | | | | | | logged in. PR: kern/144026 MFC after: 1 week Notes: svn path=/head/; revision=204050
* Yet another target mode compilation error.Matt Jacob2010-02-041-1/+1
| | | | Notes: svn path=/head/; revision=203478
* Fix target mode compilation problem with previous deltaMatt Jacob2010-02-041-2/+2
| | | | Notes: svn path=/head/; revision=203463
* Redo how commands handles are created and managed and implement sequenceMatt Jacob2010-02-038-109/+186
| | | | | | | | | | | | | | | numbers and handle types in rational way. This will better protect from (unwittingly) dealing with stale handles/commands. Fix the watchdog timeout code to better protect itself from mistakes. If we run an abort on a putatively timed out command, the command may in fact get completed, so check to make sure the command we're timing it out is still around. If the abort succeeds, btw, the command should get returned via a different path. Notes: svn path=/head/; revision=203444
* Amazingly we've been freeing a handle and using that which it refers toMatt Jacob2010-01-151-1/+1
| | | | | | | | | for years. Bad! MFC after: 1 week Notes: svn path=/head/; revision=202418
* Remove extraneous semicolons, no functional changes.Martin Blapp2010-01-072-4/+4
| | | | | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week Notes: svn path=/head/; revision=201758
* Make sure that the WWNN is also created for 2100..2300 cards.Matt Jacob2010-01-031-0/+2
| | | | | | | MFC after: 1 day Notes: svn path=/head/; revision=201408
* Create a Node WWN from the *Port* WWN, not vice versa, for 2400s.Matt Jacob2009-12-311-5/+4
| | | | | | | | | | If the NAA is type 2, the Node WWN is the Port WWN with the 12 bits of port (48..60) cleared. This iff a wwn fetched from NVRAM is zero. MFC after: 1 week Notes: svn path=/head/; revision=201325
* Fix cases where we've managed to get a Loop UP event prior to initializingMatt Jacob2009-12-042-43/+52
| | | | | | | | | | | | the loop down counter, as well as other things. This was brought to my attention with a different fix, more for RELENG_7- this one covers the multiple channel case. PR: 140438 MFC after: 1 month Notes: svn path=/head/; revision=200089
* Unbreak SBus cards which have been broken (apparently) for a while.Matt Jacob2009-11-021-18/+8
| | | | | | | | | | | | | Most of the pieces came from Marius- correct settings for channels and resource management. The one piece missing was that you cannot for SBus cards replace 32 bit operations with A64 operations- not supported. Submitted by: marius MFC after: 3 days Notes: svn path=/head/; revision=198822
* (semiforced commit to add comment missed in last delta)Matt Jacob2009-09-213-2/+1
| | | | | | | | | | | | | Add a maximum response length for FCP RSPNS IUs. Clarify some of the FC option words for setting parameters and try and disable automatic PRLI when in target mode- this should correct some cases of N-port topologies with 23XX cards where we put out an illegal PRLI (in target mode only we're not supposed to put out a PRLI). Notes: svn path=/head/; revision=197373
* Remove file unused in freebsd.Matt Jacob2009-09-214-457/+66
| | | | Notes: svn path=/head/; revision=197372
* Accomodate old style XPT_IMMED_NOTIFY and XPT_NOTIFY_ACK so thatMatt Jacob2009-09-152-27/+43
| | | | | | | | | | | | we at least don't panic. We don't really support dual role mode (INITIATOR/TARGET) any more. We should but it's broken and will take a fair amount of effort to fix and correctly manage both initiator and target roles sharing the port database. So, for now, disallow it. Notes: svn path=/head/; revision=197214
* Have at least *some* default WWN to fall back on,Matt Jacob2009-08-131-0/+4
| | | | | | | | | | otherwise Sun branded FC cards won't configure. Reviewed by: Ken, Scott Approved by: re Notes: svn path=/head/; revision=196162
* Add 8Gb support (isp_2500). Fix a fair number of configuration andMatt Jacob2009-08-0114-8117/+10462
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Separate the parallel scsi knowledge out of the core of the XPT, andScott Long2009-07-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modularize it so that new transports can be created. Add a transport for SATA Add a periph+protocol layer for ATA Add a driver for AHCI-compliant hardware. Add a maxio field to CAM so that drivers can advertise their max I/O capability. Modify various drivers so that they are insulated from the value of MAXPHYS. The new ATA/SATA code supports AHCI-compliant hardware, and will override the classic ATA driver if it is loaded as a module at boot time or compiled into the kernel. The stack now support NCQ (tagged queueing) for increased performance on modern SATA drives. It also supports port multipliers. ATA drives are accessed via 'ada' device nodes. ATAPI drives are accessed via 'cd' device nodes. They can all be enumerated and manipulated via camcontrol, just like SCSI drives. SCSI commands are not translated to their ATA equivalents; ATA native commands are used throughout the entire stack, including camcontrol. See the camcontrol manpage for further details. Testing this code may require that you update your fstab, and possibly modify your BIOS to enable AHCI functionality, if available. This code is very experimental at the moment. The userland ABI/API has changed, so applications will need to be recompiled. It may change further in the near future. The 'ada' device name may also change as more infrastructure is completed in this project. The goal is to eventually put all CAM busses and devices until newbus, allowing for interesting topology and management options. Few functional changes will be seen with existing SCSI/SAS/FC drivers, though the userland ABI has still changed. In the future, transports specific modules for SAS and FC may appear in order to better support the topologies and capabilities of these technologies. The modularization of CAM and the addition of the ATA/SATA modules is meant to break CAM out of the mold of being specific to SCSI, letting it grow to be a framework for arbitrary transports and protocols. It also allows drivers to be written to support discrete hardware without jeopardizing the stability of non-related hardware. While only an AHCI driver is provided now, a Silicon Image driver is also in the works. Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware is possible and encouraged. Help with new transports is also encouraged. Submitted by: scottl, mav Approved by: re Notes: svn path=/head/; revision=195534
* Change uses of the struct ccb_hdr timeout_ch missed when isp(4) wasMarius Strobl2009-05-101-2/+3
| | | | | | | | | | | | adapted to MPSAFE cam(4) to a isp(4) specific callout structure. Thanks to Florian Smeets for providing access to a machine exhibiting this problem for debugging. Approved by: mjacob MFC after: 3 days Notes: svn path=/head/; revision=191979
* Don't try reading the SXP_PINS_DIFF on the 10160 and 12160 SCSIMarius Strobl2008-12-151-4/+17
| | | | | | | | | | | | | controllers. Reading this register, for which there are indications that it doesn't really exist, returns 0 on at least some 12160 and doing so on Sun Fire V880 causes a data access error exception. Reported and tested by: Beat Gaetzi Approved by: mjacob Obtained from: OpenBSD (modulo setting isp_lvdmode) Notes: svn path=/head/; revision=186140
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-1/+1
| | | | | | | | | | | | | | | | | | 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
* Add missing locking for SBus controllers.Scott Long2007-11-051-0/+5
| | | | Notes: svn path=/head/; revision=173359