summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_freebsd.c
Commit message (Collapse)AuthorAgeFilesLines
* Spring MegaChange #1.mjacob2001-05-281-110/+376
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---- Make a device for each ISP- really usable only with devfs and add an ioctl entry point (this can be used to (re)set debug levels, reset the HBA, rescan the fabric, issue lips, etc). ---- Add in a kernel thread for Fibre Channel cards. The purpose of this thread is to be woken up to clean up after Fibre Channel events block things. Basically, any FC event that casts doubt on the location or identify of FC devices blocks the queues. When, and if, we get the PORT DATABASE CHANGED or NAME SERVER DATABASE CHANGED async event, we activate the kthread which will then, in full thread context, re-evaluate the local loop and/or the fabric. When it's satisfied that things are stable, it can then release the blocked queues and let commands flow again. The prior mechanism was a lazy evaluation. That is, the next command to come down the pipe after change events would pay the full price for re-evaluation. And if this was done off of a softcall, it really could hang up the system. These changes brings the FreeBSD port more in line with the Solaris, Linux and NetBSD ports. It also, more importantly, gets us being more proactive about topology changes which could then be reflected upwards to CAM so that the periph driver can be informed sooner rather than later when things arrive or depart. --- Add in the (correct) usage of locking macros- we now have lock transition macros which allow us to transition from holding the CAM lock (Giant) and grabbing the softc lock and vice versa. Switch over to having this HBA do real locking. Some folks claim this won't be a win. They're right. But you have to start somewhere, and this will begin to teach us how to DTRT for HBAs, etc. -- Start putting in prototype 2300 support. Add back in LIP and Loop Reset as async events that each platform will handle. Add in another int_bogus instrumentation point. Do some more substantial target mode cleanups. MFC after: 8 weeks
* Redo a lot of the target mode infrastructure to be cognizant of Dual Busmjacob2001-04-041-188/+215
| | | | | | cards like the 1280 && the 12160. Cleanup isp_target_putback_atio. Make sure bus and correct tag ids and firmware handles get propagated as needed.
* Check CT2_SENDSTATUS/CT_SENDSTATUS against cto->ct_flags, notmjacob2001-03-211-6/+8
| | | | | | CAM_SEND_STATUS. Set a timeout of 2 seconds per CTIO. Make sure that the 'real' tag value is being checked against- not the one that also carries the firmware handle.
* Switch to using 16 bit handles instead of 32 bit handles.mjacob2001-03-021-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | This is a pretty invasive change, but there are three good reasons to do this: 1. We'll never have > 16 bits of handle. 2. We can (eventually) enable the RIO (Reduced Interrupt Operation) bits which return multiple completing 16 bit handles in mailbox registers. 3. The !)$*)$*~)@$*~)$* Qlogic target mode for parallel SCSI spec changed such that at_reserved (which was 32 bits) was split into two pieces- and one of which was a 16 bit handle id that functions like the at_rxid for Fibre Channel (a tag for the f/w to correlate CTIOs with a particular command). Since we had to muck with that and this changed the whole handler architecture, we might as well... Propagate new at_handle on through int ct_fwhandle. Follow implications of changing to 16 bit handles. These above changes at least get Qlogic 1040 cards working in target mode again. 1080/12160 cards don't work yet. In isp.c: Prepare for doing all loop management in outer layers.
* Finally eliminate as many of the printf calls as possible (still leavingmjacob2001-03-011-30/+42
| | | | | | | ones where we have a CAM path) and replacing them with calls to isp_prt., Eliminate isp_unit references- we no longer have an isp_unit- we now have an isp_dev that device_get_unit can work with.
* Fix at2_entry_t to reflect what the firmware actually writes (insteadmjacob2001-02-271-7/+4
| | | | | of just deriving from SCSI at_entry_t). In this case, there is no 'suggested sense' for FC cards.
* Do some cleanup based upon adapter role- mainly not enabling interruptsmjacob2001-02-111-35/+33
| | | | | | | | | | | if we're ISP_ROLE_NONE. Change ISPASYNC_LOGGED_INOUT to ISPASYNC_PROMENADE. Make sure we note if something is a fabric device. Target mode: Finally fix (to a first approximation) SCSI Target Mode again- we needed to correctly check against CAM_TARGET_WILDCARD and CAM_LUN_WILDCARD so that targbh won't confuse us. Comment out the drainqueue stuff for now. Use isp_fc_runstate instead if isp_control/ISPCTL_FCLINK_TEST.
* Change and clean the mutex lock interface.bmilekic2001-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Guard against overflow of the calculated timeout value.mjacob2001-01-161-4/+9
|
* Do more cleanup of the usage of 0..125 for F-port topologies.mjacob2001-01-151-11/+29
|
* Follow the ISPASYNC_PDB_CHANGED -> ISPASYNC_LOGGED_INOUT change. Also,mjacob2001-01-091-2/+8
| | | | ISPASYNC_NOTIFY_CHANGE now is for both local loop && fabric changes.
* Fix problems with incomplete conversions from printf to isp_prt.mjacob2000-12-311-5/+3
|
* Make sure we do locking if we call isp_intr.mjacob2000-12-291-1/+14
| | | | Make sure we enter Giant for now if we call into cam for completion.
* Replace some more printfs with isp_prt's. Use isp_prt/ISP_LOGDEBUG0mjacob2000-12-051-31/+31
| | | | for rate setting/getting printouts.
* More M_ZERO patches.dwmalone2000-12-031-2/+1
| | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Approved by: mjacob
* remove "SERVICING_INTERRUPT" nonsensemjacob2000-10-171-2/+0
|
* some copyright cleanupsmjacob2000-09-211-3/+2
|
* various fixesmjacob2000-08-271-30/+64
|
* Add a comment as to where stdarg.h applies.mjacob2000-08-031-1/+1
|
* Use <machine/stdarg.h> instead of <stdarg.h> so that this will compile.jhb2000-08-031-1/+1
| | | | While I'm at it, move the #include line up to the top of the file.
* Core version 2.0 rewrite. In this file we replace isp_tdebug withmjacob2000-08-011-118/+104
| | | | | | isp_prt calls. We now use an argument to the ISPCTL_FCLINK_TEST call. We change all IDPRINTF macros to isp_prt calls. We add the isp_prt function here.
* Add a isp_target_putback_atio- we aren't using CCINCR at this time, somjacob2000-07-181-40/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | we need a function that tells the Qlogic f/w that a target mode command is done, so increase the resource count for that lun. Add in a timeout function to kick the putback again if we fail to do it the first time (we may not have the request queue space for ATIO push). Split the function isp_handle_platform_ctio into two parts so that the timeout function for the ATIO push or isp_handle_platform_ctio can inform CAM that the requested CTIO(s) are now done. Clean up (cough) residual handling. What we need for Fibre Channel is to preserve the at_datalen field from the original incoming ATIO so we can calculate a 'true' residual. Unfortunately, we're not guaranteed to get that back from CAM. We'll *try* to find it hiding in the periph_priv field (layering violation)- but if an ATIO was passed in from user land- forget it. This means that we'll probably get residuals wrong for Fibre Channel commands we're completing with an error. It's too late to 4.1 release to fix this- too bad. Luckily the only device we'd really care about this occurring on is a tape device and they're still so rare as FC attached devices that this can be considered an untested combination anyway. Remove all CCINCR usage (resource autoreplenish). When we've proved to ourself that things are working properly, we can add it back in. Make sure we propage 'suggested' sense data from the incoming ATIO into the created system ATIO- and set sense_len appropriately. Correctly propagate tag values. Fall back to the model of generating (well, the functions in isp_pci.c do the work) multiple CTIOs based upon what we get from XPT. Instead of being able to pair Qlogic generated ATIOs with CAM ATIOs, and then to pair CAM CTIOs with Qlogic CTIOs, we have to take the CTIO passed to us from XPT, and if it implies that we have to generate extra Qlogic CTIOs, so be it. This means that we have to wait until the last CTIO in a sequence we generated completes before calling xpt_done. Executive summary- target mode actually now pretty much works well enough to tell folks about.
* Oops! If we're deciding a command is now really dead, make *darned*mjacob2000-07-051-0/+9
| | | | | | sure that it really is by issuing a ISPCTL_ABORT_CMD just on the off chance the f/w will start it up again and, ha ha, start using the DMA resources we gave it but are now taking away.
* Add in config_hook for catching when interrupts are safe- this allowsmjacob2000-07-041-72/+91
| | | | | | us to not the ints are ok and also to (re)ENABLE isp interrupts. Remove all splcam()/splx() invocates and replace them with ISP_LOCK/ISP_UNLOCK macros.
* Add in the enabling of interrupts (to isp_attach). Clean up a bustedmjacob2000-06-271-34/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | comment. Check against firmware state- not loop state when enabling target mode. Other changes have to do with no longer enabling/disabling interrupts at will. Rearchitect command watchdog timeouts- First of all, set the timeout period for a command that has a timeout (in isp_action) to the period of time requested *plus* two seconds. We don't want the Qlogic firmware and the host system to race each other to report a dead command (the watchdog is there to catch dead and/or broken firmware). Next, make sure that the command being watched isn't done yet. If it's not done yet, check for INT_PENDING and call isp_intr- if that said it serviced an interrupt, check to see whether the command is now done (this is what the "IN WATCHDOG" private flag is for- if isp_intr completes the command, it won't call xpt_done on it because isp_watchdog is still looking at the command). If no interrupt was pending, or the command wasn't completed, check to see if we've set the private 'grace period' flag. If so, the command really *is* dead, so report it as dead and complete it with a CAM_CMD_TIMEOUT value. If the grace period flag wasn't set, set it and issue a SYNCHRONIZE_ALL Marker Request Queue entry and re-set the timeout for one second from now (see Revision 1.45 isp.c notes for more on this) to give the firmware a final chance to complete this command.
* Remove all ISP2100_SCCLUN define protected code and replace it withmjacob2000-06-181-23/+12
| | | | runtime checks.
* Fix breakage to target mode support.mjacob2000-06-121-14/+25
| | | | | | | | | | | | | | | | | | | | | | | What we'd like to know is whether or not we have a listener upstream that really hasn't configured yet. If we do, then we can give a more sensible reply here. If not, then we can reject this out of hand. Choices for what to send were Not Ready, Unit Not Self-Configured Yet (0x2,0x3e,0x00) for the former and Illegal Request, Logical Unit Not Supported (0x5,0x25,0x00) for the latter. We used to decide whether there was at least one listener based upon whether the black hole driver was configured. However, recent config(8) changes have made this hard to do at this time. Actually, we didn't use the above quite yet, but were sure considering it.
* Add in a watchdog routine to catch cases where we've dropped the command.mjacob2000-05-091-2/+32
| | | | | | | Apparently the f/w has finished the command, but somehow an interrupt is being lost. So, we just plain wedge when booting alphas. This is a general routine we've needed for a while.
* Now that we fixed the isp_sendmarker botch, we can now do initial busmjacob2000-04-211-4/+1
| | | | | resets for ULTRA2/ULTRA3 cards again (which were turned off really because of a botch for dual bus configurations).
* Remove ~25 unneeded #include <sys/conf.h>phk2000-04-191-1/+0
| | | | Remove ~60 unneeded #include <sys/malloc.h>
* Don't do bus resets for ULTRA2 or later cards because what seems tomjacob2000-03-131-1/+4
| | | | | happen currently is that several commands issued *after* the bus reset are then reported destroyed.
* Prettier print of fabric devices being attached- say what kind ofmjacob2000-02-291-9/+59
| | | | | | port they are (e.g., F_Port vs. N_Port). Approved: jkh
* Clean up some target mode debug messages. Fix (finally, I believe)mjacob2000-02-151-14/+9
| | | | | | | | | | | | | Andrew's problems with SCSI on some alphas- do not call isp_update directly to update parameters- just mark them as being ready to update for the next command- the system would just hang on a READ CAPACITY for a drive. Really annoying because it wouldn't even timeout (and it has a timeout) so either the SET PARAMETERS call was nuking things or the f/w was really dropping the ball. approved: jkh Reviewed by: gallatin@freebsd.org
* a whale of a lot of target mode cleanupmjacob2000-01-151-42/+70
|
* Clean up some debug printing. Find the correct lun when SCCLUN ismjacob2000-01-041-25/+43
| | | | | defined. If we complete with a check condition but no sense data, say we had an AUTOSENSE failure.
* Make a static chain of isp softcs- gdb usage becomes a lot easier.mjacob2000-01-031-17/+1079
| | | | | | | | | Add in a very large amount of target mode support code- this is just a first pass at this. It's a difficult thing because some of the code can be in platform independent areas (see isp_target.?) but a lot has to be in platform dependent areas because of not only the tight coupling of received commands/events and the specific OS subsystem but because the platform independent code has (deliberately) no event/wait mechanisms.
* Clean up lun width determination based upon f/w revisionsmjacob1999-12-201-3/+6
| | | | for the parallel SCSI cards (4.55..4.65 :: 8.55..8.65).
* Add Dual LVD bus (1280) supportmjacob1999-12-161-2/+4
|
* Add in isp_debug variable. It defaults to zero unless CAMDEBUG is definedmjacob1999-10-171-26/+15
| | | | | | where it defaults to one. Change simq width allocation to the max number of commands supported by the HBA after f/w fires up- not the constant MAXISPREQUEST value. Do some stylistic changes.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Clarify and cleanup some CAM queueing breakages.mjacob1999-08-161-176/+175
|
* add 2200 f/w; fix botched definemjacob1999-07-051-2/+2
|
* Well, don't try and probe 65535 luns- things just don't really work wellmjacob1999-07-031-1/+6
| | | | when this happens. Limit to 16 luns for the 2100/2200 for now.
* Remove all pre-CAM code. Fix breakage for SCCLUN when it is in factmjacob1999-07-021-427/+80
| | | | | ISP2100_SCCLUN. Make changes for how ISPASYNC_PDB_CHANGE_COMPLETE is now ISPASYNC_PDB_CHANGED. Add in ISPASYNC_FABRIC_DEV case.
* When asked to get the current transfer settings go do a dev_refreshmjacob1999-05-121-12/+26
| | | | | isp_update call to get a better chance at seeing whether a recent settings change has latched up.
* A large set of changes to handle dual bus adapters.mjacob1999-05-111-50/+106
|
* Add a number of interrelated CAM feature enhancements and bug fixes.ken1999-05-061-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: These changes will require recompilation of any userland applications, like cdrecord, xmcd, etc., that use the CAM passthrough interface. A make world is recommended. camcontrol.[c8]: - We now support two new commands, "tags" and "negotiate". - The tags commands allows users to view the number of tagged openings for a device as well as a number of other related parameters, and it allows users to set tagged openings for a device. - The negotiate command allows users to enable and disable disconnection and tagged queueing, set sync rates, offsets and bus width. Note that not all of those features are available for all controllers. Only the adv, ahc, and ncr drivers fully support all of the features at this point. Some cards do not allow the setting of sync rates, offsets and the like, and some of the drivers don't have any facilities to do so. Some drivers, like the adw driver, only support enabling or disabling sync negotiation, but do not support setting sync rates. - new description in the camcontrol man page of how to format a disk - cleanup of the camcontrol inquiry command - add support in the 'devlist' command for skipping unconfigured devices if -v was not specified on the command line. - make use of the new base_transfer_speed in the path inquiry CCB. - fix CCB bzero cases cam_xpt.c, cam_sim.[ch], cam_ccb.h: - new flags on many CCB function codes to designate whether they're non-immediate, use a user-supplied CCB, and can only be passed from userland programs via the xpt device. Use these flags in the transport layer and pass driver to categorize CCBs. - new flag in the transport layer device matching code for device nodes that indicates whether a device is unconfigured - bump the CAM version from 0x10 to 0x11 - Change the CAM ioctls to use the version as their group code, so we can force users to recompile code even when the CCB size doesn't change. - add + fill in a new value in the path inquiry CCB, base_transfer_speed. Remove a corresponding field from the cam_sim structure, and add code to every SIM to set this field to the proper value. - Fix the set transfer settings code in the transport layer. scsi_cd.c: - make some variables volatile instead of just casting them in various places - fix a race condition in the changer code - attach unless we get a "logical unit not supported" error. This should fix all of the cases where people have devices that return weird errors when they don't have media in the drive. scsi_da.c: - attach unless we get a "logical unit not supported" error scsi_pass.c: - for immediate CCBs, just malloc a CCB to send the user request in. This gets rid of the 'held' count problem in camcontrol tags. scsi_pass.h: - change the CAM ioctls to use the CAM version as their group code. adv driver: - Allow changing the sync rate and offset separately. adw driver - Allow changing the sync rate and offset separately. aha driver: - Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs. ahc driver: - Allow setting offset and sync rate separately bt driver: - Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs. NCR driver: - Fix the ultra/ultra 2 negotiation bug - allow setting both the sync rate and offset separately Other HBA drivers: - Put code in to set the base_transfer_speed field for XPT_GET_TRAN_SETTINGS CCBs. Reviewed by: gibbs, mjacob (isp), imp (aha)
* oops on this lastmjacob1999-04-041-3/+2
|
* F/W revisions now a tuple (not a duple). Fix pre-CAM code.mjacob1999-04-041-19/+57
|
* Add in 1080 LVD support and some basis also for the 1240. The port databasemjacob1999-03-251-77/+99
| | | | printout is now enabled.
OpenPOWER on IntegriCloud