summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
Commit message (Collapse)AuthorAgeFilesLines
* Move a comment to the right place. The rearrange done in r208928 leftjh2011-04-161-4/+3
| | | | the comment to a wrong place.
* Move TUNABLE_INT_FETCH() out of the SIM lock to avoid sleeping whilejh2011-04-162-30/+32
| | | | | | holding the lock. The fix is analogous to r220618 for ada(4). Reviewed by: mav
* Make CAM report devices with ATA/SATA transport to devstat(9) as IDE.mav2011-04-147-11/+55
|
* Missed a file in r219056: add disk description for da(4).nwhitehorn2011-02-261-0/+6
|
* Add the disk ident and a human-meaningful description (here, the disk modelnwhitehorn2011-02-261-0/+6
| | | | | | | string) to the geom_disk config XML so that they are easily accessible from userland. MFC after: 1 week
* Fix typos - remove duplicate "the".brucec2011-02-211-1/+1
| | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* sysctl(8) should use the CTLTYPE to determine the type of data whenmdf2011-01-191-1/+1
| | | | | | | | | | | reading. (This was already done for writing to a sysctl). This requires all SYSCTL setups to specify a type. Most of them are now checked at compile-time. Remove SYSCTL_*X* sysctl additions as the print being in hex should be controlled by the -x flag to sysctl(8). Succested by: bde
* Add a 64-bit hex-printed sysctl(9) since there is at least one place inmdf2011-01-131-2/+2
| | | | | the code that wanted it. It is named X64 rather than XQUAD since the quad name is a historical abomination that should not be perpetuated.
* Fix a few issues related to the XPT_GDEV_ADVINFO CCB.ken2010-12-101-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | camcontrol.c: In buildbusdevlist(), don't attempt to get call getdevid() for an unconfigured device, even when the verbose flag is set. The cam_open_btl() call will almost certainly fail. Probe for the buffer size when issuing the XPT_GDEV_ADVINFO CCB. Probing for the buffer size first helps us avoid allocating the maximum buffer size when it really may not be necessary. This also helps avoid errors from cam_periph_mapmem() if we attempt to map more than MAXPHYS. cam_periph.c: In cam_periph_mapmem(), if the XPT_GDEV_ADVINFO CCB shows a bufsiz of 0, we don't have anything to map, so just return. Also, set the maximum mapping size to MAXPHYS instead of DFLTPHYS for XPT_GDEV_ADVINFO CCBs, since they don't actually go down to the hardware. scsi_pass.c: Don't bother mapping the buffer in XPT_GDEV_ADVINFO CCBs if bufsiz is 0.
* Add Serial Management Protocol (SMP) passthrough support to CAM.ken2010-11-306-52/+1507
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes support in the kernel, camcontrol(8), libcam and the mps(4) driver for SMP passthrough. The CAM SCSI probe code has been modified to fetch Inquiry VPD page 0x00 to determine supported pages, and will now fetch page 0x83 in addition to page 0x80 if supported. Add two new CAM CCBs, XPT_SMP_IO, and XPT_GDEV_ADVINFO. The SMP CCB is intended for SMP requests and responses. The ADVINFO is currently used to fetch cached VPD page 0x83 data from the transport layer, but is intended to be extensible to fetch other types of device-specific data. SMP-only devices are not currently represented in the CAM topology, and so the current semantics are that the SIM will route SMP CCBs to either the addressed device, if it contains an SMP target, or its parent, if it contains an SMP target. (This is noted in cam_ccb.h, since it will change later once we have the ability to have SMP-only devices in CAM's topology.) smp_all.c, smp_all.h: New helper routines for SMP. This includes SMP request building routines, response parsing routines, error decoding routines, and structure definitions for a number of SMP commands. libcam/Makefile: Add smp_all.c to libcam, so that SMP functionality is available to userland applications. camcontrol.8, camcontrol.c: Add smp passthrough support to camcontrol. Several new subcommands are now available: 'smpcmd' functions much like 'cmd', except that it allows the user to send generic SMP commands. 'smprg' sends the SMP report general command, and displays the decoded output. It will automatically fetch extended output if it is available. 'smppc' sends the SMP phy control command, with any number of potential options. Among other things, this allows the user to reset a phy on a SAS expander, or disable a phy on an expander. 'smpmaninfo' sends the SMP report manufacturer information and displays the decoded output. 'smpphylist' displays a list of phys on an expander, and the CAM devices attached to those phys, if any. cam.h, cam.c: Add a status value for SMP errors (CAM_SMP_STATUS_ERROR). Add a missing description for CAM_SCSI_IT_NEXUS_LOST. Add support for SMP commands to cam_error_string(). cam_ccb.h: Rename the CAM_DIR_RESV flag to CAM_DIR_BOTH. SMP commands are by nature bi-directional, and we may need to support bi-directional SCSI commands later. Add the XPT_SMP_IO CCB. Since SMP commands are bi-directional, there are pointers for both the request and response. Add a fill routine for SMP CCBs. Add the XPT_GDEV_ADVINFO CCB. This is currently used to fetch cached page 0x83 data from the transport later, but is extensible to fetch many other types of data. cam_periph.c: Add support in cam_periph_mapmem() for XPT_SMP_IO and XPT_GDEV_ADVINFO CCBs. cam_xpt.c: Add support for executing XPT_SMP_IO CCBs. cam_xpt_internal.h: Add fields for VPD pages 0x00 and 0x83 in struct cam_ed. scsi_all.c: Add scsi_get_sas_addr(), a function that parses VPD page 0x83 data and pulls out a SAS address. scsi_all.h: Add VPD page 0x00 and 0x83 structures, and a prototype for scsi_get_sas_addr(). scsi_pass.c: Add support for mapping buffers in XPT_SMP_IO and XPT_GDEV_ADVINFO CCBs. scsi_xpt.c: In the SCSI probe code, first ask the device for VPD page 0x00. If any VPD pages are supported, that page is required to be implemented. Based on the response, we may probe for the serial number (page 0x80) or device id (page 0x83). Add support for the XPT_GDEV_ADVINFO CCB. sys/conf/files: Add smp_all.c. mps.c: Add support for passing in a uio in mps_map_command(), so we can map a S/G list at once. Add support for SMP passthrough commands in mps_data_cb(). SMP is a special case, because the first buffer in the S/G list is outbound and the second buffer is inbound. Add support for warning the user if the busdma code comes back with more buffers than will work for the command. This will, for example, help the user determine why an SMP command failed if busdma comes back with three buffers. mps_pci.c: Add sys/uio.h. mps_sas.c: Add the SAS address and the parent handle to the list of fields we pull from device page 0 and cache in struct mpssas_target. These are needed for SMP passthrough. Add support for the XPT_SMP_IO CCB. For now, this CCB is routed to the addressed device if it supports SMP, or to its parent if it does not and the parent does. This is necessary because CAM does not currently support SMP-only nodes in the topology. Make SMP passthrough support conditional on __FreeBSD_version >= 900026. This will make it easier to MFC this change to the driver without MFCing the CAM changes as well. mps_user.c: Un-staticize mpi_init_sge() so we can use it for the SMP passthrough code. mpsvar.h: Add a uio and iovecs into struct mps_command for SMP passthrough commands. Add a cm_max_segs field to struct mps_command so that we can warn the user if busdma comes back with too many segments. Clear the cm_reply when a command gets freed. If it is not cleared, reply frames will eventually get freed into the pool multiple times and corrupt the pool. (This fix is from scottl.) Add a prototype for mpi_init_sge(). sys/param.h: Bump __FreeBSD_version to 900026 for the for the inclusion of the XPT_GDEV_ADVINFO and XPT_SMP_IO CAM CCBs.
* Make da driver to handle some probably broken Android devices, returningmav2010-10-241-1/+4
| | | | | zero media and sector size instead of "Medium not present" error, until some confirmation button is tapped on device.
* Use destroy_dev_sched(9) instead of destroy_dev(9) in passcleanup() asmdf2010-09-201-1/+5
| | | | | | | | it is indirectly a d_close method. Prompted by: kib Reviewed by: mav MFC after: 2 weeks
* Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.gibbs2010-09-021-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the BIO_ORDERED flag for struct bio and update bio clients to use it. The barrier semantics of bioq_insert_tail() were broken in two ways: o In bioq_disksort(), an added bio could be inserted at the head of the queue, even when a barrier was present, if the sort key for the new entry was less than that of the last queued barrier bio. o The last_offset used to generate the sort key for newly queued bios did not stay at the position of the barrier until either the barrier was de-queued, or a new barrier (which updates last_offset) was queued. When a barrier is in effect, we know that the disk will pass through the barrier position just before the "blocked bios" are released, so using the barrier's offset for last_offset is the optimal choice. sys/geom/sched/subr_disk.c: sys/kern/subr_disk.c: o Update last_offset in bioq_insert_tail(). o Only update last_offset in bioq_remove() if the removed bio is at the head of the queue (typically due to a call via bioq_takefirst()) and no barrier is active. o In bioq_disksort(), if we have a barrier (insert_point is non-NULL), set prev to the barrier and cur to it's next element. Now that last_offset is kept at the barrier position, this change isn't strictly necessary, but since we have to take a decision branch anyway, it does avoid one, no-op, loop iteration in the while loop that immediately follows. o In bioq_disksort(), bypass the normal sort for bios with the BIO_ORDERED attribute and instead insert them into the queue with bioq_insert_tail(). bioq_insert_tail() not only gives the desired command order during insertion, but also provides barrier semantics so that commands disksorted in the future cannot pass the just enqueued transaction. sys/sys/bio.h: Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio. sys/cam/ata/ata_da.c: sys/cam/scsi/scsi_da.c Use an ordered command for SCSI/ATA-NCQ commands issued in response to bios with the BIO_ORDERED flag set. sys/cam/scsi/scsi_da.c Use an ordered tag when issuing a synchronize cache command. Wrap some lines to 80 columns. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c sys/geom/geom_io.c Mark bios with the BIO_FLUSH command as BIO_ORDERED. Sponsored by: Spectra Logic Corporation MFC after: 1 month
* Revert r211434. Offline discussions have convinced me that this shouldmjacob2010-08-201-18/+2
| | | | be left alone for now.
* Now is as good a time as any to find out if we induce breakagemjacob2010-08-171-2/+18
| | | | | | | by issueing aborts for any pending commands when we're decommssioning a disk. MFC after: 3 months
* Fix two (very common) occurrences of s/sytem/system in comments.bcr2010-08-021-1/+1
| | | | | Approved by: mav MFC after: 3 days
* Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers tomav2010-07-252-0/+8
| | | | | GEOM. This information needed for proper soft-RAID's on-disk metadata reading and writing.
* For the target port groups structures, don't allocate the initial element.ken2010-06-141-3/+4
| | | | | | | | This makes things easier for target implementations to calculate how many elements they need to allocate. Discussed with: mjacob, gibbs MFC after: 1 week
* Rearrange how things are done to avoid dereferencing stale pointers inmjacob2010-06-081-30/+32
| | | | | | | | | | the case of immediate unconfigure after configure. Hold the periph an extra count while we have the task to create sysctl context outstanding so that the periph doesn't go away unexpectedly. Sponsored by: Panasas Reviewed by: scsi@ MFC after: 1 month
* One byte off for scsi_target_group cdb.mjacob2010-06-081-1/+1
| | | | MFC after: 2 weeks
* Implement the usage of Report Luns as part of SCSI probing for SCP3 ormjacob2010-06-081-26/+351
| | | | | | | | | | | better devices. This can be disabled on a per-device basis using quirks as well. This also handles the case where there is actually no connected LUN 0 (which can definitely be the case for storage arrays). Reviewed by: scsi@ MFC after: 1 month
* Make additional definitions up to and including SPC-4. Add in definitionsmjacob2010-06-083-131/+276
| | | | | | | | | | for REPORT and SET TARGET PORT GROUP commands (foundations for future work). Regularize opcodes to be upper case hex. Pick *one* of tab or space after #define (tab) and stick with that. MFC after: 2 weeks
* redfacedly noting a missing part of a patch.mjacob2010-06-071-0/+1
| | | | | | Pointy Hat To: Me MFC after: 2 Week X-MFC: 208896
* Do a minor amount of stylifying. Also, get a Fibre Channel WWPN if one existsmjacob2010-06-071-2/+27
| | | | for a da unit and create a sysctl OID for it.
* scsi_cd: pass correct pointer to free()avg2010-06-041-1/+1
| | | | | | Found with: Coverity Prevent(tm) CID: 2986 MFC after: 4 days
* Add a new primitive, XPT_SCAN_TGT, to cover the range between scanning amjacob2010-05-261-4/+13
| | | | | | | | | | | 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
* Remove unnecessary headers which were inherited from cam_xpt.c withoutmarius2010-05-201-4/+0
| | | | | | | reason. Reviewed by: mav MFC after: 3 days
* Pick up the right change, not it's close cousin. The onemjacob2010-05-111-2/+4
| | | | | | | | previously submitted was wrong. Point hat: mjacob X-MFC: 207933 MFC after: 1 week
* Deal sensibly with more than 26 sg devices. It isn't a completemjacob2010-05-111-1/+6
| | | | | | | solution. Sponsored by: Panasas MFC after: 1 week
* scsi_cd: CD_FLAG_VALID_MEDIA is sufficient to set d_sectorsize andavg2010-04-151-4/+5
| | | | | | | | | | | | | | | d_mediasize CD_FLAG_VALID_TOC is not required for setting those media properties. PR: kern/145385 Submitted by: Juergen Lock <nox@jelal.kn-bremen.de> a slightly different version Tested by: Pavel Sukhoy <sukhoy@ripn.net>, Markus Wild <m.wild@cybernet.ch>, Juergen Lock <nox@jelal.kn-bremen.de>, uqs MFC after: 1 week
* Nullify our periph pointer in dacleanup to try and catchmjacob2010-04-021-0/+5
| | | | race conditions in callbacks/downcalls.
* Add a couple missing basic mode page codes.mjacob2010-04-011-0/+2
| | | | MFC after: 1 week
* We actually can generate a host number.mjacob2010-03-171-1/+1
| | | | MFC after: 1 month
* Virtualize transport part of periph announcement.mav2010-02-221-0/+99
|
* Make CD driver a bit more robust and predictable to unreported errors.mav2010-02-151-17/+13
|
* MFp4: Large set of CAM inprovements.mav2010-01-287-108/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* Remove extraneous semicolons, no functional changes.mbr2010-01-072-3/+3
| | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week
* Remove duplicate devstat_start_transaction_bio() call. It is already calledmav2009-12-181-2/+0
| | | | from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
* Clear result before requesting XPT_PATH_INQ.mav2009-12-091-0/+1
| | | | Many SIMs doesn't fill maxio field yet.
* MFp4:mav2009-12-061-2/+6
| | | | | | | | | | | | | | | | | | Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this options deprecates all ata(4) peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers (ada, cd, ...) and interfaces to be natively used instead. As side effect of this, ata(4) mode setting code was completely rewritten to make controller API more strict and permit above change. While doing this, SATA revision was separated from PATA mode. It allows DMA-incapable SATA devices to operate and makes hw.ata.atapi_dma tunable work again. Also allow ata(4) controller drivers (except some specific or broken ones) to handle larger data transfers. Previous constraint of 64K was artificial and is not really required by PCI ATA BM specification or hardware. Submitted by: nwitehorn (powerpc part)
* Fix several cases where the periph lock was held over malloc.scottl2009-12-021-54/+24
| | | | Submitted by: Jaakko Heinonen
* MFp4:mav2009-11-142-3/+6
| | | | Fix several device freeze counting bugs.
* MFp4:mav2009-11-111-18/+1
| | | | | | | | | | - Move tagged queueing control from ADA to ATA XPT. It allows to control device command queue length correctly. First step to support < 32 tags. - Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4). - Implement quirk matching for ATA devices. - Move xpt_schedule_dev_sendq() from header to source file. - Move delayed queue shrinking to the more expected place - element freeing. - Remove some SCSIsms in ATA.
* MFp4:mav2009-11-041-3/+0
| | | | | | | | | - Remove CAM_PERIPH_POLLED flag. It is broken by design. Polling can't be periph flag. May be SIM, may be CCB, but now it works fine just without it. - Remove check unused for at least five years. If we will ever have non-BIO devices in CAM, this check is smallest of what we will need. - If several controllers complete requests same time, call swi_sched() only once.
* Provide the same sanity check on the sector size in dagetcapacity as when thethompsa2009-11-021-2/+9
| | | | | disk is first probed. dagetcapacity is called whenever the disk is opened from geom via d_open(), a zero sector size will cause geom to panic later on.
* MFp4:mav2009-11-011-5/+17
| | | | | | | | | Fix reference counting bug, when device unreferenced before then invalidated. To do it, do not handle validity flag as another reference, but explicitly modify reference count each time flag is modified. Discovered by: thompsa
* MFp4:mav2009-10-313-4/+7
| | | | | | | | | | | | - Reduce code duplication in ATA XPT and PMP driver. - Move PIO size setting from ada driver to ATA XPT. It is XPT business to negotiate transfer details. ada driver is now stateless. - Report PIO size to SIM. It is required for correct PATA SIM operation. - Tune PMP scan timings. It workarounds some problems with SiI. - If reset hapens during PMP initialization - restart it. - Introduce early-initialized periph drivers, which are used during initial scan process. Use it for xpt, probe, aprobe and pmp. It gives pmp chance to finish scan before mountroot and numerate devices in right order.
* Replace most of priority numbers with defines. No logical changes.mav2009-10-239-72/+72
|
* Remove some obsoleted comments.mav2009-10-231-13/+0
|
* Fix a memory leak in an error case.brueffer2009-10-221-0/+3
| | | | | | | PR: 138376 Submitted by: Patroklos Argyroudis <argp@census-labs.com> Reviewed by: scottl MFC after: 1 week
OpenPOWER on IntegriCloud