summaryrefslogtreecommitdiffstats
path: root/sys/cam
Commit message (Collapse)AuthorAgeFilesLines
* Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to controlmav2012-01-031-0/+10
| | | | | | | | sector size same as acd driver does. Together with r228808 and r228847 this allows existing multimedia/vlc to play Audio CDs via CAM cd driver. PR: ports/162190 MFC after: 1 week
* Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call.mav2012-01-024-72/+0
| | | | | | | | cam_periph_runccb() since the beginning checks it and releases device queue. After r203108 it even clears CAM_DEV_QFRZN flag after that to avoid double release, so removed code is unreachable now. MFC after: 1 month
* Report stripeoffset as zero not stripesize if physical block is zeromav2011-12-231-1/+2
| | | | aligned, same as it is done for ATA.
* Addition to r228808:mav2011-12-231-0/+3
| | | | | | | READ CD is a 12 byte command. So fill additional bytes and update CDB length when patching READ(10). MFC after: 1 month
* Use READ CAPACITY(16) to get information about device physical sectors.mav2011-12-232-10/+125
| | | | | | | | | As soon as not all devices support READ CAPACITY(16), automatically fall back to READ CAPACITY(10) if CAM_REQ_INVALID or SSD_KEY_ILLEGAL_REQUEST status returned. It also provides first bits of information about Logical Block Provisioning (aka UNMAP/TRIM) support by the device.
* Merge to da driver quirks hinting 4K physical sector sizes for SATA disksmav2011-12-231-6/+238
| | | | | | | connected via SAS or USB. Unluckily I've found that SAS (mps) and USB-SATA I have translate models in different ways, requiring twice more quirks. Unluckily for Hitachi, their model names are trimmed on SAS, making impossible to identify 4K sector drives that way.
* Update list of 4K physical sector hard drives.mav2011-12-221-0/+30
|
* Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors tomav2011-12-222-0/+13
| | | | | | | | | | | GEOM and using READ CD command for reading data, same as acd driver does. Audio CDs identified by checking respective bit of the control field of the first track in TOC. This fixes bunch of error messages during boot (GEOM taste) with Audio CD inserted and allows to grab Audio CD image using just dd. MFC after: 1 month
* Change targ(4) to use cdevpriv, instead of multiple character devices.ed2011-12-131-116/+43
| | | | | | | Also update the manpage and the scsi_target example program accordingly. Discussed on: scsi@ Tested by: Chuck Tuffli <chuck tuffli net>
* Do not use the sometimes-reserved work 'bool' for a variable name.mdf2011-12-121-5/+5
| | | | | MFC after: 2 weeks Sponsored by: Isilon Systems, LLC
* - Add support for Support SEAGATE DAT Scopion 130eadler2011-12-081-0/+4
| | | | | | | PR: kern/141934 Submitted by: HASHI Hiroaki <hashiz@stenmark.meridiani.jp> Approved by: sbruno@ MFC after: 1 week
* Move the scsi_da_bios_params() prototype from pc98_machdep.h to md_var.hmarius2011-11-271-4/+0
| | | | | where the prototype for pc98_ata_disk_firmware_geom_adjust() also lives in order to avoid an #ifdef'ed include in cam(4).
* For sparc64 also adjust the geometry of da(4) driven disks to not overflowmarius2011-11-271-1/+7
| | | | | | | | | | | the 16-bit cylinders field of the VTOC8 disk label (at around 502GB). The geometry chosen for disks above that limit allows to use disks up to 2TB, which is the limit of the extended VTOC8 format. The geometry used for disks smaller than the 16-bit cylinders limit stays the same as used by cam_calc_geometry(9) for extended translation. Thanks to Hans-Joerg Sirtl for providing hardware for testing this change. MFC after: 3 days
* Introduce CAM_SIM_POLLED SIM flag, indicating that it works in polling mode.mav2011-11-172-2/+9
| | | | | | | | | | | It blocks CAM SWI usage on requests completion, unneeded because of polling and denied during kernel dumping because of blocked scheduler. Before r198899 there was periph flag CAM_PERIPH_POLLED, but that was wrong, because there is whole SIM is polled or handled by SWI, not a single periph. Tested by: kib MFC after: 1 month
* - fix duplicate "a a" in some commentseadler2011-11-132-2/+2
| | | | | | Submitted by: eadler Approved by: simon MFC after: 3 days
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-074-5/+6
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-0712-14/+14
| | | | This means that their use is restricted to a single C file.
* Add descriptor sense support to CAM, and honor sense residuals properly inken2011-10-039-265/+2433
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. MFC after: 3 days Sponsored by: Spectra Logic Corporation
* Fixes for sure bus reference miscounting and potential device andmjacob2011-08-122-16/+59
| | | | | | | | | | | target reference miscounts. It also adds a helper function to get the current reference counts for components of cam_path for debug aid. One minor style(9) change. Partially Obtained from: Chuck Tuffli (Emulex) Reviewed by: scsi@ (ken) Approved by: re (kib) MFC after: 1 month
* Higher-priority initialization request can eat request scheduling done frommav2011-07-301-2/+10
| | | | | | | adaclose(). Add immediate_priority check into adaschedule() to restore it. Approved by: re (kib) MFC after: 1 week
* Add control for ATA disk read-ahead, alike to the previously added writemav2011-07-291-11/+102
| | | | | | | | cache control. Some controller BIOS'es tend to disable read-ahead, that dramatically reduces read performance. Previously ata(4) always enabled read-ahead unconditionally. Approved by: re (kib)
* In some cases failed SATA disks may report their presence, but don'tmav2011-07-291-8/+19
| | | | | | | | | | | | | | | | | respond to any commands. I've found that because of multiple command retries, each of which cause 30s timeout, bus reset and another retry or requeue for many commands, it may take ages to eventually drop the failed device. The odd thing is that those retries continue even after XPT considered device as dead and invalidated it. This patch makes cam_periph_error() to block any command retries after periph was marked as invalid. With that patch all activity completes in 1-2 minutes, just after several timeouts, required to consider device death. This should make ZFS, gmirror, graid, etc. operation more robust. Reviewed by: mjacob@ on scsi@ Approved by: re (kib)
* Do not try to execute FLUSHCACHE on close and print extra messages formav2011-07-231-2/+4
| | | | | | | | invalidated (considered lost) ada device. Exactly same already done for the da devices. Approved by: re (kib) MFC after: 1 week
* cam/scsi/scsi_cd.c:gibbs2011-06-261-7/+4
| | | | | | In cdregister(), hold the periph lock semaphore during changer probe/configuration. This removes a window where an open of the cd device may succeed before probe processing has completed.
* cam/cam_xpt.c:gibbs2011-06-261-2/+2
| | | | | | | | In camisr_runqueue(), we need to run the sims queue regardless of whether or not the current peripheral has more work to do. This reverts a change mistakenly made in revision 223081. Reported by: ache
* Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPImav2011-06-231-1/+2
| | | | device to never complete, that caused probe process (system boot) stuck.
* Return CAM_REQ_INVALID if the SCSI XPT receives an unsupported operationwill2011-06-221-3/+4
| | | | | | via the XPT_DEV_ADVINFO CCB. Reviewed by: ken
* Plumb support for the device advanced information CCB in the ATA XPT.will2011-06-221-0/+33
| | | | | | | | | | This was previously done only for SCSI XPT in r223081, on which the change in r223089 depended in order to respond to serial number requests. As a result of r223089, da(4) and ada(4) devices register a d_getattr for geom to use to obtain the information. Reported by: ache Reviewed by: ken
* Fix a typo in adagetattr() from r223089. In particular, this restoreskib2011-06-181-1/+1
| | | | the ability to use ahci(4) for kernel dumps.
* Plumb device physical path reporting from CAM devices, through GEOM andgibbs2011-06-143-24/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DEVFS, and make it accessible via the diskinfo utility. Extend GEOM's generic attribute query mechanism into generic disk consumers. sys/geom/geom_disk.c: sys/geom/geom_disk.h: sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Allow disk providers to implement a new method which can override the default BIO_GETATTR response, d_getattr(struct bio *). This function returns -1 if not handled, otherwise it returns 0 or an errno to be passed to g_io_deliver(). sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Don't copy the serial number to dp->d_ident anymore, as the CAM XPT is now responsible for returning this information via d_getattr()->(a)dagetattr()->xpt_getatr(). sys/geom/geom_dev.c: - Implement a new ioctl, DIOCGPHYSPATH, which returns the GEOM attribute "GEOM::physpath", if possible. If the attribute request returns a zero-length string, ENOENT is returned. usr.sbin/diskinfo/diskinfo.c: - If the DIOCGPHYSPATH ioctl is successful, report physical path data when diskinfo is executed with the '-v' option. Submitted by: will Reviewed by: gibbs Sponsored by: Spectra Logic Corporation Add generic attribute change notification support to GEOM. sys/sys/geom/geom.h: Add a new attrchanged method field to both g_class and g_geom. sys/sys/geom/geom.h: sys/geom/geom_event.c: - Provide the g_attr_changed() function that providers can use to advertise attribute changes. - Perform delivery of attribute change notifications from a thread context via the standard GEOM event mechanism. sys/geom/geom_subr.c: Inherit the attrchanged method from class to geom (class instance). sys/geom/geom_disk.c: Provide disk_attr_changed() to provide g_attr_changed() access to consumers of the disk API. sys/cam/scsi/scsi_pass.c: sys/cam/scsi/scsi_da.c: sys/geom/geom_dev.c: sys/geom/geom_disk.c: Use attribute changed events to track updates to physical path information. sys/cam/scsi/scsi_da.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, and the updated buffer type references our physical path attribute, emit a GEOM attribute changed event via the disk_attr_changed() API. sys/cam/scsi/scsi_pass.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, update the physical patch devfs alias for this pass instance. Submitted by: gibbs Sponsored by: Spectra Logic Corporation
* sys/cam/scsi/scsi_da.c:gibbs2011-06-141-13/+25
| | | | | | | | | | | | | - Only attempt the closing synchronize cache on a disk if it is still there. - When a device is lost, report the number of outstanding I/Os as they are drained. - When a device is lost, return any unprocessed bios with ENXIO instead of EIO. - Filter asynchronous events, but always allow cam_periph_async() to see them too. Sponsored by: Spectra Logic Corporation
* Lay groundwork in CAM for recording and reporting physical path andgibbs2011-06-1410-114/+465
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | other device attributes stored in the CAM Existing Device Table (EDT). This includes some infrastructure requried by the enclosure services driver to export physical path information. Make the CAM device advanced info interface accept store requests. sys/cam/scsi/scsi_all.c: sys/cam/scsi/scsi_all.h: - Replace scsi_get_sas_addr() with a scsi_get_devid() which takes a callback that decides whether to accept a particular descriptor. Provide callbacks for NAA IEEE Registered addresses and for SAS addresses, replacing the old function. This is needed because the old function doesn't work for an enclosure address for a SAS device, which is not flagged as a SAS address, but is NAA IEEE Registered. It may be worthwhile merging this interface with the devid match interface. - Add a few more defines for some device ID fields. sbin/camcontrol/camcontrol.c: - Update for the CCB_DEV_ADVINFO interface change. cam/cam_xpt_internal.h: - Add the new fields for the physical path string to the CAM EDT. cam/cam_ccb.h: - Rename CCB_GDEV_ADVINFO to simply CCB_DEV_ADVINFO, and the ccb structure to ccb_dev_advinfo. - Add a flag that changes this CCB's action to store, rather than the default, retrieve. - Add a new buffer type, CDAI_TYPE_PHYS_PATH, for the new CAM EDT physpath field. - Remove the never-implemented transport & proto flags. cam/cam_xpt.c: cam/cam_xpt.h: - Add xpt_getattr(), which provides a wrapper for fetching a device's attribute using the GEOM strings as key. This method currently supports "GEOM::ident" and "GEOM::physpath". Submitted by: will Reviewed by : gibbs Extend the XPT_DEV_MATCH api to allow a device search by device ID. As far as the API is concerned, device ID is a binary blob to be interpreted by the transport layer. The SCSI implementation assumes it is an array of VPD device ID descriptors. sys/cam/cam_ccb.h: Create a new structure, device_id_match_pattern, and update the XPT_DEV_MATCH datastructures and flags so that this pattern type can be used. sys/cam/cam_xpt.c: - A single pattern matching on both inquiry data and device ID is invalid. Report any violators. - Pass device ID match requests through to the new routine scsi_devid_match(). The direct call of a SCSI routine is a layering violation, but no worse than the one a few lines up that checks inquiry data. Defer cleaning this up until our future, larger, rototilling of CAM. - Zero out cam_ed and cam_et nodes on allocation. Prior to this change, device_id_len and device_id were not inialized, preventing proper detection of the presence of this information. sys/cam/scsi/scsi_all.c: sys/cam/scsi/scsi_all.h: Add the scsi_match_devid() routine. Add a helper function for extracting peripherial driver names sys/cam/cam_periph.c: sys/cam/cam_periph.h: Add the cam_periph_list() method which fills an sbuf with a comma delimited list of the peripheral instances associated with a given CAM path. Add a helper functions for SCSI commands used by the SES driver. sys/cam/scsi/scsi_all.c: sys/cam/scsi/scsi_all.h: Add structure definitions and csio filling functions for the receive diagnostic results and send diagnostic commands. Misc CAM XPT cleanups. sys/cam/cam_xpt.c: Broadcast AC_FOUND_DEVICE and AC_PATH_REGISTERED events at the time async event handlers are attached even when registering just for events on a partitular SIM. Previously, you had to register for these events on all SIMs in the system in order to get the initial broadcast even though subsequent device and path arrivals would be delivered. sys/cam/cam_xpt.c: Remove SIM mutex held asserts from path accessors. CAM paths are reference counted and it is this reference count, not the sim mutex, that garantees they are stable. Sponsored by: Spectra Logic Corporation
* Do not report CFA devices as ATAPI, even though IDENTIFY data look alike.mav2011-06-122-3/+8
|
* Increase maximum supported number of ranges per TRIM command from 256 to 512mav2011-06-031-2/+2
| | | | | to use full potential of Intel X25-M SSDs. On synthetic test with 32K ranges it gives about 20% speedup, which probably costs more then 2K of RAM.
* When possible, join ranges of subsequest BIO_DELETE requests to handle moremav2011-06-021-9/+25
| | | | | | | | | (up to 2048 instead of 256 or even 64) of them with single TRIM request. OCZ Vertex2/Vertex3 SSDs can handle no more then 64 ranges per TRIM request. Due to lack of BIO_DELETE clustering now, it means that we could delete no more then 2MB per request (on FS with 32K block) with limited request rate. This change increases delete rate on Vertex2 from 250MB/s to 950MB/s.
* Add quirks to hint 4K physical sector (Advanced Format) for ATA disks notmav2011-05-311-2/+91
| | | | | | | | reporting it properly (none? of known disks now). Hitachi and WDC AF disks seem could be identified more or less formally. For Seagate and Samsung enumerate some found models/series. For other disks it can be forced with kern.cam.ada.X.quirks=1 tunable.
* Change new constant names to ones used by OpenSolaris.mav2011-05-271-2/+2
|
* Add names for few more SES element types according SES-2 specification.mav2011-05-271-0/+4
|
* scsi_cd: silence READ_TOC errors in CDIOREADTOCHEADER ioctlavg2011-05-071-1/+1
| | | | | | | | | An optical disk may not have a TOC (e.g. for blank media) and userland software may legitimately try to use CDIOREADTOCHEADER to find out about the TOC. Silence from: scsi@ MFC after: 10 days
* Do not report legacy unit numbers (do not create legacy aliases) for disksmav2011-05-031-3/+6
| | | | | on port multiplier ports above first two. They don't fit into ATA_STATIC_ID scheme and so can't be mapped properly. No need to pollute dev.
* Make CAM_DEBUG_CDB also dump ATA commands in addition to SCSI.mav2011-04-291-28/+29
|
* - Add shim to simplify migration to the CAM-based ATA. For each new adaXmav2011-04-263-1/+71
| | | | | | | | | device in /dev/ create symbolic link with adY name, trying to mimic old ATA numbering. Imitation is not complete, but should be enough in most cases to mount file systems without touching /etc/fstab. - To know what behavior to mimic, restore ATA_STATIC_ID option in cases where it was present before. - Add some more details to UPDATING.
* Add basic support for DMA-capable ATA disks on DMA-incapable controller.mav2011-04-203-2/+10
| | | | This is really rare situation these days, but still may happen in embedded.
* Remove always false "< 0" check for unsgined int variable. This check ismav2011-04-181-2/+0
| | | | | | also duplicate, as the value was already checked for 0 before decrementing. Reported by: rpaulo
* Remove some used variables.mav2011-04-181-4/+0
| | | | Found with: Clang Static Analyzer
* Remove some used variables.mav2011-04-182-21/+10
| | | | Found with: Clang Static Analyzer
* 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 ada(4) driver put ATA disks into sleep state on suspend.mav2011-04-151-8/+83
| | | | Submitted by: jkim (original version)
* Make CAM report devices with ATA/SATA transport to devstat(9) as IDE.mav2011-04-149-11/+69
|
OpenPOWER on IntegriCloud