summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-cam.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove all legacy ATA code parts, not used since options ATA_CAM enabled inmav2013-04-041-919/+0
| | | | | | | | | most kernels before FreeBSD 9.0. Remove such modules and respective kernel options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam. Remove the atacontrol utility and some man pages. Remove useless now options ATA_CAM. No objections: current@, stable@ MFC after: never
* Reform the busdma API so that new types may be added without modifyingkib2013-02-121-6/+0
| | | | | | | | | | | | | | | | | | | | | every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback. The cam changes unify the bus_dmamap_load* handling in cam drivers. The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map. Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
* - First pass at const'ifying ata(4) as appropriate.marius2012-03-211-1/+1
| | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week
* Add the CAM Target Layer (CTL).ken2012-01-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTL is a disk and processor device emulation subsystem originally written for Copan Systems under Linux starting in 2003. It has been shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is available under a BSD-style license. The intent behind the agreement was that Spectra would work to get CTL into the FreeBSD tree. Some CTL features: - Disk and processor device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode select, the read will be blocked until the mode select completes.) - Full task management support (abort, LUN reset, target reset, etc.) - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores - Persistent reservation support - Mode sense/select support - Error injection support - High Availability support (1) - All I/O handled in-kernel, no userland context switch overhead. (1) HA Support is just an API stub, and needs much more to be fully functional. ctl.c: The core of CTL. Command handlers and processing, character driver, and HA support are here. ctl.h: Basic function declarations and data structures. ctl_backend.c, ctl_backend.h: The basic CTL backend API. ctl_backend_block.c, ctl_backend_block.h: The block and file backend. This allows for using a disk or a file as the backing store for a LUN. Multiple threads are started to do I/O to the backing device, primarily because the VFS API requires that to get any concurrency. ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a small amount of memory to act as a source and sink for reads and writes from an initiator. Therefore it cannot be used for any real data, but it can be used to test for throughput. It can also be used to test initiators' support for extremely large LUNs. ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes, and command handler functions defined for supported opcodes. ctl_debug.h: Debugging support. ctl_error.c, ctl_error.h: CTL-specific wrappers around the CAM sense building functions. ctl_frontend.c, ctl_frontend.h: These files define the basic CTL frontend port API. ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM. This frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible in CAM via this port. ctl_frontend_internal.c, ctl_frontend_internal.h: This is a frontend port written for Copan to do some system-specific tasks that required sending commands into CTL from inside the kernel. This isn't entirely relevant to FreeBSD in general, but can perhaps be repurposed. ctl_ha.h: This is a stubbed-out High Availability API. Much more is needed for full HA support. See the comments in the header and the description of what is needed in the README.ctl.txt file for more details. ctl_io.h: This defines most of the core CTL I/O structures. union ctl_io is conceptually very similar to CAM's union ccb. ctl_ioctl.h: This defines all ioctls available through the CTL character device, and the data structures needed for those ioctls. ctl_mem_pool.c, ctl_mem_pool.h: Generic memory pool implementation used by the internal frontend. ctl_private.h: Private data structres (e.g. CTL softc) and function prototypes. This also includes the SCSI vendor and product names used by CTL. ctl_scsi_all.c, ctl_scsi_all.h: CTL wrappers around CAM sense printing functions. ctl_ser_table.c: Command serialization table. This defines what happens when one type of command is followed by another type of command. ctl_util.c, ctl_util.h: CTL utility functions, primarily designed to be used from userland. See ctladm for the primary consumer of these functions. These include CDB building functions. scsi_ctl.c: CAM target peripheral driver and CTL frontend port. This is the path into CTL for commands from target-capable hardware/SIMs. README.ctl.txt: CTL code features, roadmap, to-do list. usr.sbin/Makefile: Add ctladm. ctladm/Makefile, ctladm/ctladm.8, ctladm/ctladm.c, ctladm/ctladm.h, ctladm/util.c: ctladm(8) is the CTL management utility. It fills a role similar to camcontrol(8). It allow configuring LUNs, issuing commands, injecting errors and various other control functions. usr.bin/Makefile: Add ctlstat. ctlstat/Makefile ctlstat/ctlstat.8, ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics for CTL. sys/conf/files: Add CTL files. sys/conf/NOTES: Add device ctl. sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB length field is now 2 bytes long. Add several mode page definitions for CTL. sys/cam/scsi_all.c: Handle the new 2 byte inquiry length. sys/dev/ciss/ciss.c, sys/dev/ata/atapi-cam.c, sys/cam/scsi/scsi_targ_bh.c, scsi_target/scsi_cmds.c, mlxcontrol/interface.c: Update for 2 byte inquiry length field. scsi_da.h: Add versions of the format and rigid disk pages that are in a more reasonable format for CTL. amd64/conf/GENERIC, i386/conf/GENERIC, ia64/conf/GENERIC, sparc64/conf/GENERIC: Add device ctl. i386/conf/PAE: The CTL frontend SIM at least does not compile cleanly on PAE. Sponsored by: Copan Systems, SGI and Spectra Logic MFC after: 1 month
* Fix possible use after free.mav2010-06-051-2/+2
| | | | | Found with: Coverity Prevent(tm) CID: 4634
* Implement poll method for atapicam.mav2010-02-031-2/+6
| | | | It is not perfect, but better then nothing.
* Report to CAM unit number of underlying ataX bus device, instead of thismav2010-02-031-1/+1
| | | | atapicamX. It is more apropriate and useful together with "ata" name.
* MFp4: Large set of CAM inprovements.mav2010-01-281-28/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Unify bus reset/probe sequence. Whenever bus attached at boot or later, CAM will automatically reset and scan it. It allows to remove duplicate code from many drivers. - Any bus, attached before CAM completed it's boot-time initialization, will equally join to the process, delaying boot if needed. - New kern.cam.boot_delay loader tunable should help controllers that are still unable to register their buses in time (such as slow USB/ PCCard/ CardBus devices), by adding one more event to wait on boot. - To allow synchronization between different CAM levels, concept of requests priorities was extended. Priorities now split between several "run levels". Device can be freezed at specified level, allowing higher priority requests to pass. For example, no payload requests allowed, until PMP driver enable port. ATA XPT negotiate transfer parameters, periph driver configure caching and so on. - Frozen requests are no more counted by request allocation scheduler. It fixes deadlocks, when frozen low priority payload requests occupying slots, required by higher levels to manage theit execution. - Two last changes were holding proper ATA reinitialization and error recovery implementation. Now it is done: SATA controllers and Port Multipliers now implement automatic hot-plug and should correctly recover from timeouts and bus resets. - Improve SCSI error recovery for devices on buses without automatic sense reporting, such as ATAPI or USB. For example, it allows CAM to wait, while CD drive loads disk, instead of immediately return error status. - Decapitalize diagnostic messages and make them more readable and sensible. - Teach PMP driver to limit maximum speed on fan-out ports. - Make boot wait for PMP scan completes, and make rescan more reliable. - Fix pass driver, to return CCB to user level in case of error. - Increase number of retries in cd driver, as device may return several UAs.
* Report SATA speeds to CAM, to not confuse users with low numbers logged.mav2009-10-261-0/+6
|
* Round timeout up when converting CAM milliseconds to ATA seconds.mav2009-10-261-2/+2
|
* Separate the parallel scsi knowledge out of the core of the XPT, andscottl2009-07-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove dead code.trasz2009-05-121-4/+0
| | | | | Found with: Coverity Prevent(tm) CID: 556
* Revert my ata_identify()/ata_reinit() related changes: r189166, r189091mav2009-02-281-8/+12
| | | | | | | | | | | | | | and partially r188903. Revert breaks new drives detection on reinit to the state as it was before me, but fixes series of new bugs reported by some people. Unconditional queueing of ata_completed() calls can lead to deadlock if due to timeout ata_reinit() was called at the same thread by previous ata_completed(). Calling of ata_identify() on ata_reinit() in current implementation opens numerous races and deadlocks. Problems I was touching here are still exist and should be addresed, but probably in different way.
* Rework device probing by moving ata_getparam() call from ata_identify() tomav2009-02-281-12/+8
| | | | | | | | | | | drivers' probe routines. It allows not to sleep and so not drop Giant inside ata_identify() critical section and so avoid crash if it reentered on request timeout. Reentering of probe call checked inside of it. Give device own knowledge about it's type (ata/atapi/atapicam). It is not a good idea to ask channel status for device type inside ata_getparam(). Add softc memory deallocation on device destruction.
* Correct signature for the identify routine. The bad parameter wasn'timp2009-02-041-2/+2
| | | | used at all, so this is just a tidiness excersize.
* Make "kldunload atapicam" return EBUSY instead of deadlocking when a devicetrasz2009-01-081-0/+4
| | | | | | | | | | created by atapicam is being kept opened or mounted. This is probably just a temporary solution until we invent something better. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Reported by: Jaakko Heinonen
* Go back to preallocating everything possible on init.sos2008-04-171-1/+2
| | | | | This avoids calling busdma in the request processing path which caused a traumatic performance degradation. Allocation has be postponed to after we know how many devices we possible can have on portmulitpliers to save some space.
* Fix the brokenness in the former commit, sorry for the mess.sos2008-04-111-2/+1
| | | | | | | | The problem is that the PM support is part of a much larger WIP here, but due to popular demand I decided to get some of it imported. Also I forgot the mention: HW sponsored by: Vitsch Electronics / VEHosting
* Prepare for future integration between CAM and newbus. xpt_bus_registerscottl2007-06-171-1/+1
| | | | | | | now takes a device_t to be the parent of the bus that is being created. Most SIMs have been updated with a reasonable argument, but a few exceptions just pass NULL for now. This argument isn't used yet and the newbus integration likely won't be ready until after 7.0-RELEASE.
* MPSAFE atapi-camscottl2007-05-021-28/+23
|
* (atapi_action, case XPT_SCSI_IO): Enable DMA only for READ and WRITE commandsthomas2007-04-301-4/+19
| | | | | | | | as some combinations of chipset, controller and target do not behave correctly when DMA is enabled for other commands. PR: kern/103602 MFC after: 2 weeks
* (atapi_cb): Fix test for the presence of sense data. An incorrect conditionthomas2007-04-301-2/+2
| | | | | | | | was being tested, which would result in a system hang in some configurations. PR: kern/112119 Reviewed by: scottl MFC after: 3 days
* Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM willscottl2007-04-151-1/+1
| | | | | | | | | | | use to synchornize and protect all data objects that are used for that SIM. Drivers that are not yet MPSAFE register Giant and operate as usual. RIght now, no drivers are MPSAFE, though a few will be changed in the coming week as this work settles down. The driver API has changed, so all CAM drivers will need to be recompiled. The userland API has not changed, so tools like camcontrol do not need to be recompiled.
* Make it compilekevlo2007-03-141-1/+1
|
* (atapi_action): Improve error reporting by removing ATA_R_QUIET flagthomas2007-03-131-33/+49
| | | | | | | | | | | from ATAPI requests. If CAM debugging is enabled, also mark ATAPI requests with ATA_R_DEBUG flag. (atapi_cb): Report ATAPI timeouts to the CAM layer. Fix incorrect debugging traces in the presence of ATAPI errors. PR: kern/103602 MFC after: 2 weeks
* (reinit_bus): When the ATAPI bus is reset, do not schedule an automatedthomas2007-03-131-2/+10
| | | | | | | | | | | | CAM rescan if the ATAPI device entries have not changed. The ATAPI bus may be reset for a variety of reasons, including any time an ATAPI request times out. It is not necessary to rescan at the CAM level in such a case, unless a device has appeared or disappeared, or has otherwise changed. PR: kern/103602 MFC after: 2 weeks
* (cam_rescan): Do not reference ccb->ccb_h.path in CAM_DEBUG call beforethomas2007-02-271-2/+2
| | | | | | | | | | | | | it is initialized; use path instead. This change fixes a panic when using atapicam in conjunction with CAMDEBUG, which has been described under kern/103602. Thanks to Josh Carroll <josh.carroll@gmail.com> for providing the traces that allowed identifying this problem. PR: kern/103602 MFC after: 1 week
* 2nd and final commit that moves us to CAM_NEW_TRAN_CODEmjacob2006-11-021-12/+0
| | | | | | as the default. Reviewed by multitudes.
* The first of 3 major steps to move the CAM layer forward to usingmjacob2006-10-311-3/+18
| | | | | | | | | | | | | | | | | | | | | the CAM_NEW_TRAN_CODE that has been in the tree for some years now. This first step consists solely of adding to or correcting CAM_NEW_TRAN_CODE pieces in the kernel source tree such that a both a GENERIC (at least on i386) and a LINT build with CAM_NEW_TRAN_CODE as an option will compile correctly and run (at least with some the h/w I have). After a short settle time, the other pieces (making CAM_NEW_TRAN_CODE the default and updating libcam and camcontrol) will be brought in. This will be an incompatible change in that the size of structures related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change in both size and content. However, basic system operation and basic system utilities work well enough with this change. Reviewed by: freebsd-scsi and specific stakeholders
* Make the ATAPI sense data accessible when using the ioctl interfacesos2006-03-311-2/+2
| | | | MFC candidate.
* Normalize a significant number of kernel malloc type names:rwatson2005-10-311-1/+1
| | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
* Change the way ioctls are issue to ATA.sos2005-05-161-1/+1
| | | | | | The most prominent part is that its now possible to issue ata_requests directly to say acd0, instead of going through the cumbersome /dev/ata device.
* Take newbusification one step further, ie use the device_t more consequentlysos2005-04-301-28/+28
| | | | | | | all way through the code down the layers, instead of the mix'n'match that resulted from the conversion done earlier. Sponsored by: pair.com
* Move the creation of ata_channel child devices to the channel code.sos2005-04-151-14/+67
| | | | | | | | | This allows to attach to the children (ATA devices) even without a driver being attached. This allows atapi-cam to do its work both with and without the pure ATAPI driver being present. ATA patches by /me ATAPI-cam pathes by Thomas
* Explicity make atapi-cam depend on CAM.scottl2005-04-081-0/+1
| | | | Submitted by: Michal Mertl
* Fix a use-after-free problem in atapi_cb(). Add some necessary synchronizationscottl2005-04-051-4/+13
| | | | | to the XPT_PATH_INQ op. Don't leak locks on failure in XPT_SCSIIO. Correctly fix the CAMDEBUG message.
* Push some faulty debugging aside so LINT compiles.phk2005-04-051-1/+1
|
* Commit ATAPI-CAM for ATAmkIII. Improvements and changes:scottl2005-04-051-151/+186
| | | | | | | | | | | | | | | | | | - newbus plumbing. Each atapicam bus is a child off of a parent ata channel bus. This is somewhat of a hack, but allows the ata core to be completely free of atapicam knowledge. - No more global lists of softc's and no more groping around in internal ata structures on each command. - Giant-free operation of the completion handler. - Per-bus mutex for protecting the busy list and synchronizing detach. - Lots of streamlining and dead code elimination, better adherence to the CAM locking protocol. This feature still requires that the appropriate atapi-* driver be present for each atapi device that you want to talk to (i.e. atapi-cd for cdroms). It does work both compiled into the kernel and as a loadable module. Reviewed by: thomas, sos
* atapicam(4) is currently off by three orders of magnitude regarding thegreen2004-06-171-2/+2
| | | | | | | | | timeout values in the CAM CCBs. Divide by 1000 to get values in seconds which are what ata(4) timeouts internally use. This does lose granularity, though, and small values can now round down to zero. It's probably worth making all ata(4) timeouts in terms of hz/ticks/milliseconds/something.
* Use auto-sense data provided by the lowlevel ATA code.thomas2004-03-041-1/+10
|
* (atapi_cb): Reenable automatic retrieve of sense data on error, makingthomas2004-02-111-14/+21
| | | | | | | it asynchronous to avoid incorrect use of ata_atapicmd within an ATAPI callback. Tested by: harti
* Fixed a memory leak.ru2004-01-181-1/+3
|
* Use UMA instead of plain malloc for getting ATA request storage.sos2004-01-141-0/+1
| | | | | | | This gives +10% performance on simple tests, so definitly worth it. A few percent more could be had by not using M_ZERO'd alloc's, but we then need to clear fields all over the place to be safe, and that was deemed not worth the trouble (and it makes life dangerous).
* #include sema.h is now required.sos2004-01-121-0/+1
|
* Fix a potential problem with atapi-cam where an incorrect flag is passedscottl2003-12-051-1/+1
| | | | | | into the ata queueing layer. Approved by: re
* Centralise mode setting. Instead of doing it in all subdrivers, dosos2003-11-111-5/+0
| | | | | | it in ata-all.c where it belongs. Prime controller HW by always setting PIO mode first in attach.
* Free the ata_request struct after we are done using it. This should stopscottl2003-11-091-2/+9
| | | | the memory leak seen when using ATAPICAM.
* Enable DMA for ATAPI/CAM input/output operations.thomas2003-09-241-3/+10
| | | | Reviewed by: scottl
* (atapi_cb): Reorganize error handling circuitry.thomas2003-09-211-17/+19
| | | | | | Fix to the messages output under CAM_DEBUG_CCB: the summary sense information (error bits and sense key) is in the error field, not in the result field, of struct ata_request. No other functional change.
* (atapi_cb): Disable autosense for now as it causes a missed ATA interrupt.thomas2003-09-211-2/+8
| | | | Minor reformatting.
OpenPOWER on IntegriCloud