summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
Commit message (Collapse)AuthorAgeFilesLines
* mdoc(7) police: replace `\*(Ba' with a simple `|', it's handled specially.ru2001-08-161-1/+1
|
* mdoc(7) police: s/BSD/.Bx/ where appropriate.ru2001-08-141-1/+3
|
* mdoc(7) police:ru2001-08-071-1/+1
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. Thesheldonh2001-07-261-1/+1
| | | | | | | definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms>
* Remove whitespace at EOL.dd2001-07-151-6/+6
|
* Rewrite of the CAM error recovery code.ken2001-03-272-113/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the major changes include: - The SCSI error handling portion of cam_periph_error() has been broken out into a number of subfunctions to better modularize the code that handles the hierarchy of SCSI errors. As a result, the code is now much easier to read. - String handling and error printing has been significantly revamped. We now use sbufs to do string formatting instead of using printfs (for the kernel) and snprintf/strncat (for userland) as before. There is a new catchall error printing routine, cam_error_print() and its string-based counterpart, cam_error_string() that allow the kernel and userland applications to pass in a CCB and have errors printed out properly, whether or not they're SCSI errors. Among other things, this helped eliminate a fair amount of duplicate code in camcontrol. We now print out more information than before, including the CAM status and SCSI status and the error recovery action taken to remedy the problem. - sbufs are now available in userland, via libsbuf. This change was necessary since most of the error printing code is shared between libcam and the kernel. - A new transfer settings interface is included in this checkin. This code is #ifdef'ed out, and is primarily intended to aid discussion with HBA driver authors on the final form the interface should take. There is example code in the ahc(4) driver that implements the HBA driver side of the new interface. The new transfer settings code won't be enabled until we're ready to switch all HBA drivers over to the new interface. src/Makefile.inc1, lib/Makefile: Add libsbuf. It must be built before libcam, since libcam uses sbuf routines. libcam/Makefile: libcam now depends on libsbuf. libsbuf/Makefile: Add a makefile for libsbuf. This pulls in the sbuf sources from sys/kern. bsd.libnames.mk: Add LIBSBUF. camcontrol/Makefile: Add -lsbuf. Since camcontrol is statically linked, we can't depend on the dynamic linker to pull in libsbuf. camcontrol.c: Use cam_error_print() instead of checking for CAM_SCSI_STATUS_ERROR on every failed CCB. sbuf.9: Change the prototypes for sbuf_cat() and sbuf_cpy() so that the source string is now a const char *. This is more in line wth the standard system string functions, and helps eliminate warnings when dealing with a const source buffer. Fix a typo. cam.c: Add description strings for the various CAM error status values, as well as routines to look up those strings. Add new cam_error_string() and cam_error_print() routines for userland and the kernel. cam.h: Add a new CAM flag, CAM_RETRY_SELTO. Add enumerated types for the various options available with cam_error_print() and cam_error_string(). cam_ccb.h: Add new transfer negotiation structures/types. Change inq_len in the ccb_getdev structure to be "reserved". This field has never been filled in, and will be removed when we next bump the CAM version. cam_debug.h: Fix typo. cam_periph.c: Modularize cam_periph_error(). The SCSI error handling part of cam_periph_error() is now in camperiphscsistatuserror() and camperiphscsisenseerror(). In cam_periph_lock(), increase the reference count on the periph while we wait for our lock attempt to succeed so that the periph won't go away while we're sleeping. cam_xpt.c: Add new transfer negotiation code. (ifdefed out) Add a new function, xpt_path_string(). This is a string/sbuf analog to xpt_print_path(). scsi_all.c: Revamp string handing and error printing code. We now use sbufs for much of the string formatting code. More of that code is shared between userland the kernel. scsi_all.h: Get rid of SS_TURSTART, it wasn't terribly useful in the first place. Add a new error action, SS_REQSENSE. (Send a request sense and then retry the command.) This is useful when the controller hasn't performed autosense for some reason. Change the default actions around a bit. scsi_cd.c, scsi_da.c, scsi_pt.c, scsi_ses.c: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Selection timeouts shouldn't be covered by a sense flag. scsi_pass.[ch]: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Get rid of the last vestiges of a read/write interface. libkern/bsearch.c, sys/libkern.h, conf/files: Add bsearch.c, which is needed for some of the new table lookup routines. aic7xxx_freebsd.c: Define AHC_NEW_TRAN_SETTINGS if CAM_NEW_TRAN_CODE is defined. sbuf.h, subr_sbuf.c: Add the appropriate #ifdefs so sbufs can compile and run in userland. Change sbuf_printf() to use vsnprintf() instead of kvprintf(), which is only available in the kernel. Change the source string for sbuf_cpy() and sbuf_cat() to be a const char *. Add __BEGIN_DECLS and __END_DECLS around function prototypes since they're now exported to userland. kdump/mkioctls: Include stdio.h before cam.h since cam.h now includes a function with a FILE * argument. Submitted by: gibbs (mostly) Reviewed by: jdp, marcel (libsbuf makefile changes) Reviewed by: des (sbuf changes) Reviewed by: ken
* - Backout botched attempt to introduce MANSECT feature.ru2001-03-261-0/+1
| | | | - MAN[1-9] -> MAN.
* Set the default manual section for sbin/ to 8.ru2001-03-201-1/+0
|
* Prepare for mdoc(7)NG.ru2000-12-181-20/+14
|
* Properly check malloc(3) return valuesjedgar2000-12-012-0/+24
| | | | Approved by: ken
* Fix format string warningskris2000-11-271-3/+3
|
* mdoc(7) police: use the new features of the Nm macro.ru2000-11-201-44/+44
|
* Adjust 'camcontrol negotiate -v' so it prints out the initiator ID from theken2000-09-171-0/+2
| | | | Path Inquiry CCB.
* optreset is declared in unistd.h, so we don't need to declare it here again.imp2000-08-161-2/+0
| | | | Reviews by: ken
* Fix an order-of-operations bug and properly shift page_control values forkbyanc2000-08-101-6/+8
| | | | comparison with SMS_PAGE_CTRL_* macros.
* Include new modepage list (-l) option in the verbose usage.kbyanc2000-08-091-0/+1
|
* Fix a typo in the last commit so that this compiles.jhb2000-08-091-1/+1
|
* Fix some whitespace errors.kbyanc2000-08-081-12/+12
| | | | Pointed out by: ps
* Replace -l with .Fl lkbyanc2000-08-081-1/+3
| | | | Pointed out by: sheldonh
* This is an overhaul of the mode page handling in camcontrol as well askbyanc2000-08-086-739/+823
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | related patches. These include: * Mode page editting can be scripted. This involves two things: first, if stdin is not a tty, changes are read from stdin rather than invoking $EDITOR. Second, and more importantly, not all modepage entries must be included in the change set. This means that camcontrol can now gracefully handle more intrusive editting from the $EDITOR, including removal or rearrangement of lines. It also means that you can do stuff like: # echo "WCE: 1" | camcontrol modepage da3 -m 8 -e # newfs /dev/da3 # echo "WCE: 0" | camcontrol modepage da3 -m 8 -e * Range-checking on user-supplied input values. modeedit.c now uses the field width specifiers to determine the maximum allowable value for a field. If the user enters a value larger than the maximum, it clips the value to the max and warns the user. This also involved patching cam_cmdparse.c to be more consistent with regards to the "count" parameter to arg_put (previously is was the length of strings and 1 for all integral types). The cam_cdbparse(3) man page was also updated to reflect the revised semantics. * In the process, I removed the 64 entry limit on mode pages (not that we were even close to hitting that limit). This was a nice side-effect of the other changes. * Technically, the new mode editting functionality allows editting of character array entries in mode pages (type 'c' or 'z'), however since buff_encode doesn't grok them it is currently useless. * Camcontrol gained two new options related to mode pages: -l and -b. The former lists all available mode pages for a given device. The latter forces mode page display in binary format (the default when no mode page definition was found in scsi_modes). * Added support for mode page names to scsi_modes. Allows names to be displayed alongside mode numbers in the mode page listing. Updated scsi_modes to use the new functionality. This also adds the semicolon into the scsi_modes syntax as an optional mode page definition terminator. This is needed to name pages without providing a page format definition. * Updated scsi_all.h to include a structure describing mode page headers. * Added $FreeBSD$ line to scsi_modes. Inspired by: dwhite Reviewed by: ken
* Print the correct speed when speed is less than 1MB/s.n_hibma2000-07-011-1/+1
| | | | | | Fixed in cam_xpt.c, r1.81 Submitted by: Gerd Knops <gerti@bitart.com>
* When printing out the transfer rate display for 'camcontrol inquiry',ken2000-06-281-1/+2
| | | | | | | | | | | | | use the current setting for tagged queueing when deciding whether or not to print "Tagged Queueing Enabled" instead of using the device's actual capabilities. This is more consistent with the rest of the transfer rate display, which relies on current settings, and is more consistent with the way we display things on boot. Reported by: Gustavo Vieira Goncalves Coelho Rios <kernel@tdnet.com.br> Reviewed by: mjacob
* Eliminate the default device name (da) and unit number (0) in camcontrol.ken2000-06-042-17/+15
| | | | | | | | This may break some scripts, but with the number of ways users can damage a system with this tool, it's important to make sure they specify which device they want to talk to. Suggested by: joerg
* Use the Ic (Internal command) mdoc macro to denote camcontrol subcommands.ken2000-06-031-44/+51
| | | | Submitted by: sheldonh
* Send 'camcontrol help' usage output to stdout instead of stderr, so itken2000-06-031-2/+2
| | | | | | | | | can be viewed more easily with a pager. Regular (i.e. short) usage output is still sent to stderr. PR: bin/12358 Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
* Implement a new camcontrol function, 'camcontrol format'.ken2000-05-212-31/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libcam/Makefile: Add scsi_da.c to libcam for the new scsi_format_unit() function. camcontrol.8: Update the man page for the new format functionality, and take out the examples section describing how to do it with 'camcontrol cmd'. camcontrol.c: New format functionality. Note that unlike the rest of the camcontrol subcommands, this one is interactive by default. Because of the potential destructiveness of the format command, I thought it necessary to get confirmation from the user before spamming a disk. You can disable the interactive behavior, and the status meter with command line arguments. scsi_da.c: Add the new scsi_format_unit() cdb building function and use #ifdef _KERNEL to make this file compile in both the kernel and userland. The format unit function is currently only defined in the non-kernel case, because nothing in the kernel is using it. If that changes, it should be un-ifdefed and compiled in both cases. scsi_da.h: New function declaration, CDB structure and format data structures. Thanks to Nick Hibma for providing some valuable input on these changes.
* Correct the usage of the ".Bd -literal -offset xxx" macro to usempp2000-05-051-8/+8
| | | | | | | a proper offset. This silences warnings when the man page is formated with groff. PR: bin/14534
* Typo ("frequencey").mph2000-03-151-1/+1
|
* Remove single-space hard sentence breaks. These degrade the qualitysheldonh2000-03-011-1/+2
| | | | | of the typeset output, tend to make diffs harder to read and provide bad examples for new-comers to mdoc.
* Fix 'camcontrol inquiry'. The inquiry data structure changes (increased token2000-02-201-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 256 bytes) caused it to break on many devices. The SCSI spec says that for commands with 8-bit length fields, a value of 0 means 256 bytes. As it turns out, many devices don't deal with that properly. Some interpret the 0 as 0, and return no data. Others return more than 256 bytes of data, and cause an overrun. The fix is to tell the device we've only allocated SHORT_INQUIRY_LENGTH (36 bytes) of inquiry data, instead of sizeof(struct scsi_inquiry_data). camcontrol.c: Change inq_len in the call to scsi_inquiry() to SHORT_INQUIRY_LENGTH, and add a long comment explaining the reason for the change. scsi_all.h: Add a comment above the definitinon of SHORT_INQUIRY_LENGTH alerting people that it is both the initial probe inquiry length, and the minimum amount of data needed for scsi_print_inquiry() to function. scsi_all.c: Add a comment about SHORT_INQUIRY_LENGTH being the minimum amount of data needed for scsi_print_inquiry() to function. Reviewed by: gibbs Approved by: jkh Reported by: "John W. DeBoskey" <jwd@unx.sas.com>
* Fix a couple of typos in the 'camcontrol negotiate' output.ken2000-02-041-2/+2
| | | | | Submitted by: T-Om <tom@iki.fi> Approved by: jkh
* Do some intptr_t casting for alpha.mjacob2000-01-212-8/+8
| | | | Reviewed by: ken@freebsd.org
* Specify the system directory for which we put in our include pathmjacob2000-01-211-1/+3
| | | | | | | as a separate line so we can override it on the command line if we need to. Reviewed by: ken@freebsd.org
* use XPT_GDEV_STATS- XPT_GDEV_TYPE was deprecated a while backmjacob2000-01-161-12/+12
|
* Fix the example in the bugs section.ken1999-12-171-1/+1
|
* Fix Bus Device Resets from userland, and specifically from camcontrol.ken1999-10-311-11/+41
| | | | | | | | | | | camcontrol was setup to use the old scheme of going through the xpt(4) device, which never worked properly (and has been disabled for a while). camcontrol now sends BDRs through the pass(4) device, and XPT_RESET_DEV CCBs are put on the device queue in the transport layer, as they should be. Submitted by: luoqi Reviewed by: ken
* Add references to cam(4) and xpt(4).mph1999-10-281-5/+2
| | | | | | | | | Delete references to cam(9) and xpt(9) which do not exist. Delete statement in BUGS that cam(9) and xpt(9) will be added soon. PR: 14567 Submitted by: Ronald F. Guilmette <rfg@monkeys.com> Approved by: ken
* Restore alphabetical order of command line options parsing.luoqi1999-10-261-4/+4
| | | | Requested by: ken
* Debug flags -T and -S were reversed.luoqi1999-10-261-2/+2
|
* Use mkstemp(3) instead of tmpnam(3) when creating temporary files for modeken1999-09-282-6/+12
| | | | | | | page editing. Submitted by: roberto Reviewed by: imp, ken
* Fix two rather embarrassing bugs in camcontrol. The first caused theken1999-09-271-3/+5
| | | | | | | | | | | | CAM_PASS_ERR_RECOVER flag to be set unconditionally on READ DEFECTS commands, and also caused the CAM_DIR_IN flag to not be set. This was the cause of all of the "camcontrol defects doesn't work with my NCR controller" bugs. The second prevented camcontrol negotiate from negotiating any bus width other than 8 bits. Submitted by: groudier@club-internet.fr (Gerard Roudier)
* -Wall cleanups, handle unknown cases.billf1999-09-261-5/+9
| | | | | Submitted by: billf, ken Reviewed by: ken
* $Id$ -> $FreeBSD$peter1999-08-285-5/+5
|
* Various man page cleanup:mpp1999-08-151-2/+2
| | | | | | | | | | | - Sort xrefs - FreeBSD.ORG -> FreeBSD.org - Properly xref RFCs. - Be consistent with section names as outlined in mdoc(7). - Other misc mdoc cleanup. PR: doc/13144 Submitted by: Alexey M. Zelkin <phantom@cris.net>
* Typo of sample command line.sada1999-08-011-2/+2
| | | | Submitted by: Seiichi Satomi <ssatomi@rr.iij4u.or.jp>
* Add a MAINTAINER line to modules that I maintain.ken1999-06-181-0/+2
| | | | Suggested by: brian, markm
* For vendor-specific commands sent using the 'camcontrol cmd' facility,ken1999-06-101-4/+4
| | | | | | use the passed in CDB length, not 1. Submitted by: Jean-Marc Zucconi <jmz@FreeBSD.ORG>
* Fix a typo, and get rid of the bugs section that talks about addingken1999-05-191-5/+2
| | | | different ways to specify devices. That code has been added.
* Add a new device specification syntax to camcontrol. It is now possible token1999-05-105-91/+204
| | | | | | | | | | | | | | | | | | | | | | | | do things like: camcontrol tur da5 or camcontrol tur 1:2:0 or camcontrol tur 1:2 These changes are fully backwards compatible with the original device specification syntax (-n dev -u unit), so it is possible to use either method to specify a device now. The device specification changes do not affect the rescan, reset or debug commands, since by design, those commands work on a bus or bus:target:lun basis only. Also, shorten the default usage statement so that it fits in a 24 column terminal. The full usage statement is still available by using the "help" "-h" or "-?" arguments to camcontrol. Submitted by: Joerg Wunsch <joerg_wunsch@interface-business.de>
* Add a number of interrelated CAM feature enhancements and bug fixes.ken1999-05-062-50/+1061
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
OpenPOWER on IntegriCloud