summaryrefslogtreecommitdiff
path: root/sys/dev/ciss/ciss.c
Commit message (Collapse)AuthorAgeFilesLines
* ciss: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-11/+0
| | | | Notes: svn path=/head/; revision=365218
* Add missing STAILQ_INIT() in ciss_disable_adapter().Alexander Motin2020-03-191-0/+1
| | | | | | | | | | I think it should fix reported panic after "ADAPTER HEARTBEAT FAILED". MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=359110
* Don't print the request we may be aborting in ciss_notify_abort asWarner Losh2019-06-131-4/+10
| | | | | | | | | | | | part of ciss_detach. It's a left-over debug that isn't needed and also discloses a kernel address. Only root could provoke as part of a devctl or kldunload. Submitted by: Fuqian Huang MFC After: 1 week Notes: svn path=/head/; revision=349011
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-1/+1
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* Add PNP info to PCI attachments of ciss driverWarner Losh2018-07-081-5/+8
| | | | | | | | | | | | | Move the module declaration so that it's after the device table. The PNP_INFO must come after the module declaration. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Notes: svn path=/head/; revision=336106
* Update a TBD string with a real model numberScott Long2018-03-251-1/+1
| | | | | | | Submitted by: Sam Gwydir Notes: svn path=/head/; revision=331528
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-5/+5
| | | | | | | | | | | | | | | | | | Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-5/+5
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* In the same vein as r311350, fix whitespace in handling of XPT_PATH_INQ inRavi Pokala2017-01-051-4/+4
| | | | | | | | | several more drivers. Sponsored by: Panasas Notes: svn path=/head/; revision=311351
* Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)Alan Somers2017-01-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are fixed-length strings. AFAICT the only place they're read is in sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. However, the kernel doesn't null-terminate them. A bunch of copy-pasted code uses strncpy to write them, and doesn't guarantee null-termination. For at least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually overflows. You can see the result by doing "camcontrol negotiate da0 -v". This change null-terminates those fields everywhere they're set in the kernel. It also shortens a few strings to ensure they'll fit within the 16-character field. PR: 215474 Reported by: Coverity CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 CID: 1010035 1010036 1010042 1010041 1010040 1010039 Reviewed by: imp, sephe, slm MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9037 Differential Revision: https://reviews.freebsd.org/D9038 Notes: svn path=/head/; revision=311305
* Update some of the TBD entries in ciss(4) to match what's in the pciSean Bruno2016-05-241-14/+15
| | | | | | | | | | IDS data. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=300551
* etc: minor spelling fixes.Pedro F. Giffuni2016-05-021-3/+3
| | | | | | | | | Mostly comments but also some user-visible strings. MFC after: 2 weeks Notes: svn path=/head/; revision=298931
* ciss(4): Fix overrun of arrayConrad Meyer2016-04-261-2/+2
| | | | | | | | | | | | | The softc member 'ciss_logical' is an array of 'ciss_max_logical_bus' members. Most of the time it is iterated correctly. This patch fixes the two instances where the driver iterated off the end of the array. Reported by: Coverity CID: 1305492 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298670
* r249170 was just plain wrong. The effect of the change is to alwaysSean Bruno2015-09-031-5/+3
| | | | | | | | | | | | | | | | | delete a logic volume on status change which is NOT what we want here. The original code is correct in that when the volume changes status the driver will only delete the volume if the status is one of the fatal errors. A drive failure in a mirrored volume is NOT a situtation where the volume should dissapear. Reported on freebsd-scsi@: https://lists.freebsd.org/pipermail/freebsd-scsi/2015-September/006800.html MFC after: 3 days Notes: svn path=/head/; revision=287437
* Remove redundant mtx_lock/unlock in ciss_name_device. This is a guaranteedPeter Wemm2015-04-021-2/+0
| | | | | | | | insta-panic on device add/remove. This is only called from the notify thread which already holds the lock while calling this function. Notes: svn path=/head/; revision=281008
* Remove MAXBSIZE use from drivers where it has nothing to do.Alexander Motin2015-03-221-2/+3
| | | | | | | | | | In some cases limits are just not needed, in others -- DFLTPHYS is the right constant to use instead. MFC after: 1 month Notes: svn path=/head/; revision=280347
* Remove compat shims for FreeBSD versions older than 6 (really early 5).John Baldwin2015-01-061-10/+0
| | | | | | | | The only diffs in the disassembly were different line numbers passed to lock functions. Notes: svn path=/head/; revision=276754
* Prevent overflow issues in timeout processingSteven Hartland2014-11-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously, any timeout value for which (timeout * hz) will overflow the signed integer, will give weird results, since callout(9) routines will convert negative values of ticks to '1'. For unsigned integer overflow we will get sufficiently smaller timeout values than expected. Switch from callout_reset, which requires conversion to int based ticks to callout_reset_sbt to avoid this. Also correct isci to correctly resolve ccb timeout. This was based on the original work done by Eygene Ryabinkin <rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid the overlow. Differential Revision: https://reviews.freebsd.org/D1157 Reviewed by: mav, davide MFC after: 1 month Sponsored by: Multiplay Notes: svn path=/head/; revision=274819
* Add detection for ciss(4) controllers that are set to non-raid JBOD mode.Sean Bruno2014-06-291-19/+26
| | | | | | | | | | | | | If a controller is set to JBOD, it has no RAID functions turned on. Populate even more of the firmware specification headers, copied from cciss_vol_status. Reviewed by: Benesh, Scott <scott.benesh@hp.com> MFC after: 2 weeks Notes: svn path=/head/; revision=268018
* Check return of cam_periph_find() before using it in a printf.Sean Bruno2014-06-291-3/+7
| | | | | | | | | | | | | If cam_periph_find() doesn't locate the path we requested, bail to error condition. Acquire ciss->mtx for this operation. Reviewed by: "Benesh, Scott" <scott.benesh@hp.com> MFC after: 2 weeks Notes: svn path=/head/; revision=268017
* Fix insta-panic on assert of unlocked periph mtx in ciss(4) whenSean Bruno2014-04-111-24/+11
| | | | | | | | | | | | | | | logical volume state changes. Currently, I view this as a critical fix for users and will MFC this rapidly as my testing has shown data loss when the disk is failed by removing it when under some amount of write activity and this code panics the box. Reviewed by: mav@ scottl@ MFC after: 3 days Sponsored by: Yahoo! Inc. Notes: svn path=/head/; revision=264354
* Add PCI-IDs for TBD Gen9 RAID controller HBAs from HP to ciss(4)Sean Bruno2014-04-041-0/+15
| | | | | | | | | Submitted by: Benesh, Scott <scott.benesh@hp.com> MFC after: 2 weeks Sponsored by: Yahoo! Inc. Notes: svn path=/head/; revision=264127
* Update ciss(4) with new models of raid controllers from HPSean Bruno2013-08-061-0/+9
| | | | | | | | | Submitted by: scott.benesh@hp.com MFC after: 2 weeks Sponsored by: Hewlett Packard Notes: svn path=/head/; revision=253980
* update ciss debugger command to iterate over multiple raid controllers up toSean Bruno2013-07-271-4/+10
| | | | | | | | | | | | max controllers supported PR: kern/179932 Reviewed by: Markus Gebert <markus.gebert@hostpoint.ch> MFC after: 2 weeks Sponsored by: Yahoo! Inc. Notes: svn path=/head/; revision=253712
* The controller does not zero this data structure, ever.Sean Bruno2013-04-281-0/+1
| | | | | | | | | | Zero it out here so we do not misinterpret the data error. Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=250031
* Let's align correctly by setting to 17.Sean Bruno2013-04-281-1/+1
| | | | | | | | | | | | | OpenCISS states that if the value is 0, then the driver should try a value of 31. That's just silly. Set to 17 so that the subtraction for maxio becomes 16 and aligns nicely. Reviewed by: scottl Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=250022
* Its time to retire COMPAQ. I don't think that its coming back. :-)Sean Bruno2013-04-281-1/+1
| | | | | | | | Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=250021
* Change maxio to reflect variable hardware configurations.Sean Bruno2013-04-271-1/+17
| | | | | | | | | | | | | | | | | | | | If max_sg_length is 0, then we default to 16 If max_sg_length is less than CISS_MAX_SG_ELEMENTS, then we will set round the value of max_sg_length to the nearest power of 2 and use it to align maxio. Else, we will use CISS_MAX_SG_ELEMENTS for our calculations. Thanks to scottl for working me through the history and providing the basis for this patch. Submitted by: scott Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249977
* Adjust the min comparison to look at the adjust value after subtraction, don'tSean Bruno2013-04-261-1/+1
| | | | | | | | | | subtract 1 from the chosen value if we are going to use the configued value. Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249947
* In the case where the controller supports an sg_list LESS than our predefinedSean Bruno2013-04-251-1/+1
| | | | | | | | | | | | | | and tuned value, we would advertise the unsupported value to CAM and it would merrily destroy the controller with way too many IO operations. This manifests itself in a Zero Memory RAID configuration for a P410 and possibly other controllers. Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249908
* Return a lun count of 1 and a lun id of 0 when CAM attempts a REPORT_LUNSSean Bruno2013-04-231-0/+13
| | | | | | | | | | | command on a disk device. This quieseces some noise on the console that recently appeared. Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249815
* MFprojects/camlock r248982:Alexander Motin2013-04-141-1/+1
| | | | | | | | | | | Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now. Notes: svn path=/head/; revision=249468
* While investigating a p/r I noted that the camcontrol devlist output forSean Bruno2013-04-101-3/+8
| | | | | | | | | | | | | | | | volumes behind a ciss(4) controller were being reported with malformeed names and identifiers. Repair that reporting by using the CAM values for the three SCSI indents reported via camcontrol devlist PR: kern/171650 Reviewed by: scottl Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249349
* Notify CAM on state* change to a logical volume not status. This resolvesSean Bruno2013-04-051-3/+5
| | | | | | | | | | | | | the issues reported regarding camcontrol devlist not showing the rebuild states of volumes unless an explicit camcontrol rescan was executed. PR: kern/171650 Reviewed by: scottl@freebsd.org Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=249170
* Restore DB_COMMAND capabilities of ciss(4) for debugging and diagnosticsSean Bruno2013-03-281-2/+5
| | | | | | | | Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=248826
* Fix compile of ciss(4) with CISS_DEBUG definedSean Bruno2013-03-281-1/+1
| | | | | | | | Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=248824
* The 5300 series ciss(4) board does not work in performant mode with ourSean Bruno2013-02-251-3/+12
| | | | | | | | | | | | | | | | currnet initialization sequence. Set it to simple mode only so that systems can be updated from stable/7 to newer installations. At some point, we should figure out why we cannot initialize performant mode on this board. PR: kern/153361 Reviewed by: scottl Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=247279
* Reform the busdma API so that new types may be added without modifyingKonstantin Belousov2013-02-121-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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>) Notes: svn path=/head/; revision=246713
* Satisfy the intent of kern/151564: [ciss] ciss(4) should increaseSean Bruno2013-01-151-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | CISS_MAX_LOGICAL to 107 Submitter wanted to increase the number of logical disks supported by ciss(4) by simply raising the CISS_MAX_LOGICAL value even higher. Instead, consult the documentation for the raid controller (OPENCISS) and poke the controller bits to ask it for how many logical/physical disks it can handle. Revert svn R242089 that raised CISS_MAX_LOGICAL to 64 for all controllers. For older controllers that don't support this mechanism, fallback to the old value of 16 logical disks. Tested on P420, P410, P400 and 6i model ciss(4) controllers. This should will be MFC'd back to stable/9 stable/8 and stable/7 after the MFC period. PR: kern/151564 Reviewed by: scottl@freebsd.org MFC after: 2 weeks Notes: svn path=/head/; revision=245459
* Convert a number of drivers to obtaining their parent DMA tag from theirScott Long2012-03-121-1/+1
| | | | | | | PCI device attachment. Notes: svn path=/head/; revision=232854
* Update PCI IDs for ciss controllers that are supported by this driver.Sean Bruno2012-01-261-2/+9
| | | | | | | | | Submitted by: scott.benesh@hp.com Obtained from: Yahoo! Inc and HP MFC after: 1 week Notes: svn path=/head/; revision=230588
* Add support for HP P420 to ciss(4)Sean Bruno2012-01-181-0/+1
| | | | | | | | | | | | Tested on upcoming Gen 8 releases of hardware from HP. MFC to all supported releases. Obtained from: Yahoo! Inc. MFC after: 2 weeks Notes: svn path=/head/; revision=230313
* Add the CAM Target Layer (CTL).Kenneth D. Merry2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=229997
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+2
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Add descriptor sense support to CAM, and honor sense residuals properly inKenneth D. Merry2011-10-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=225950
* Cosmetic: make it less confusing when displaying RAID 1 level, that mightKonstantin Belousov2010-10-021-1/+1
| | | | | | | | | | be 1+0 as well. PR: kern/150936 MFC after: 2 weeks Notes: svn path=/head/; revision=213354
* Initialize the callout structure earlier in attach before calling anyJohn Baldwin2010-04-281-1/+1
| | | | | | | | routines that can fail since ciss_free() always tries to stop and drain the callout. Notes: svn path=/head/; revision=207335