summaryrefslogtreecommitdiffstats
path: root/sys/dev/firewire
Commit message (Collapse)AuthorAgeFilesLines
* MFC r314864: firewire/sbp: try to improve locking, plus a few style nitsavg2017-03-231-23/+42
|
* MFC r311305 (by asomers):mav2017-03-232-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) 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
* MFC r314375: Remove some locking not needed for modern CAM.mav2017-03-141-13/+1
| | | | | This driver is full of LORs. This change allows to reduce deadlock chance from 100% to level that allows some tests to be done.
* MFC r313982, r314068:pfg2017-03-141-1/+1
| | | | | | sys: Replace zero with NULL for pointers. Found with: devel/coccinelle
* MFC r314374: Add safety check against too long CDB.mav2017-03-071-0/+5
| | | | | | SBP-2 specification defined maximum CDB length as 12 bytes. Newer SBP-3 specification allows CDB of any size, but this driver is too old. Proper solution would be to look on maximal ORB size supported by the target.
* MFC r314358: Announce that sbp_targ(4) does not support initiator mode.mav2017-03-061-1/+2
|
* MFC r309093: firewire: initialize tag label to -1 in fw_xfer_alloc()avg2016-12-141-0/+1
|
* MFC r309092: fwohci: report whether PhysicalUpperBound register is implementedavg2016-12-141-0/+10
|
* Remove NULL checks after M_WAITOK allocations from firewire.trasz2016-05-105-22/+0
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* sys/dev: minor spelling fixes.pfg2016-05-035-9/+9
| | | | Most affect comments, very few have user-visible effects.
* Make it explicit that D_MEM cdevsw d_flag is to signify that thekib2016-05-011-1/+0
| | | | | | | | | | | | | driver is (or behaves identically to) /dev/mem. Remove the D_MEM flag from random drivers. Note that currently the D_MEM flag does not affect any behaviour, but this going to change in the next commit. Noted and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D6149
* Don't assume bio_cmd is a bit field.imp2016-03-101-1/+1
| | | | Differential Revision: https://reviews.freebsd.org/D5594
* firewire: fix a mismatch introduced in r230558.pfg2016-02-191-1/+1
| | | | | | Found by: PVS Static Analysis Reviewed by: sbruno MFC after: 1 month
* Fix remote DMA based firewire debugging when targetingwill2015-01-211-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | systems with more than 4GB of physical memory. To remotely debug the system 'stealthy' which has a kernel with this change installed and firewire properly configured: % fwcontrol -m stealthy (or stealthy's firewire EUI64) % kgdb kernel /dev/fwmem0.0 sys/dev/firewire/fwohci.c: Rather than hard code the upper limit for hw based automatic responses to remote DMA requests at 4GB, program the hardware using Maxmem, the page number one higher than the highest physical page detected in the system. While here, garbage collect more useless splfw() calls. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110994 on 2015/01/06
* Fix firewire panic when issuing a reply to an unhandledwill2015-01-211-0/+1
| | | | | | | | | | | | | | asynchronous remote dma request (DMA request that the hardware cannot automatically handle). sys/dev/firewire/firewire.c In fw_rcv(), add missing early return in the error path for DMA requests to unregistered regions. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110993 on 2015/01/06
* Properly lock accesss to the firewire_comm->devices list.will2015-01-212-16/+6
| | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid(). sys/dev/firewire/firewire.c: sys/dev/firewire/fwmem.c: Remove no-op splfw() calls from functions that have been audited for proper lock usage. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110992 on 2015/01/06
* Fix panic in firewire and creation of invalid config ROM.will2015-01-211-10/+19
| | | | | | | | | | | | | | | | | sys/boot/i386/libfirewire/firewire.c: sys/dev/firewire/firewire.c: Fix configuration ROM generation count wrapping logic so that the generation count is never outside of allowed limits (0x2 -> 0xF). sys/dev/firewire/firewire.c: In fw_xfer_unload(), xfer->fc may be NULL. Protect against this before taking the fc lock. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110685 on 2015/01/05
* Fix a FWXF_INQ race in the firewire driver.will2015-01-211-10/+2
| | | | | | | | | | | | sys/dev/firewire/firewire.c: In fw_xfer_unload() expand lock coverage so that the test for FWXF_INQ doesn't race with it being cleared in another thread. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110207 on 2015/01/02
* Fix one cause of firewire panics.will2015-01-211-0/+1
| | | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: In fw_xfer_unload(), clear the FWXF_INQ flag on the xfer under protection of the FW_GMTX, after the xfer is removeed from the tx/rx queue. Otherwise it is possible for the xfer to be removed again (corrupting the list or immediately panicing) from another thread that has found this xfer in the transaction label table. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110200 on 2015/01/02
* Prevent overflow issues in timeout processingsmh2014-11-211-6/+8
| | | | | | | | | | | | | | | | | | | | | 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
* Do not pass whole descriptor block size as align to fwdma_malloc_multisegkan2014-09-271-1/+1
| | | | | | | | | Do not pass wrong alignment value to fwdma_malloc_multiseg and ultimately to contigalloc. In addition to being wrong, this causes insta-panic in certain cases due to safety assertion - the alignment is required to be the power of two and the value we calculate here seldom is. MFC after: 1 month
* Remove obsolete compatibility glue and improve firewire code readability.kan2014-09-2719-1014/+939
| | | | | | | | Commit my version of style(9) pass over the firewire code. Now that other people have started changing the code carrying this is as a local patch is not longer a viable option. MFC after: 1 month
* Mechanically convert to if_inc_counter().glebius2014-09-192-16/+16
|
* Start the process of cleaning up FreeBSD's firewire driver.will2014-09-1814-432/+2
| | | | | | | | | | | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: sys/dev/firewire/firewire.h: sys/dev/firewire/firewirereg.h: sys/dev/firewire/fwcrom.c: sys/dev/firewire/fwdev.c: sys/dev/firewire/fwdma.c: sys/dev/firewire/fwmem.c: sys/dev/firewire/fwohci.c: sys/dev/firewire/fwohci_pci.c: sys/dev/firewire/fwohcivar.h: sys/dev/firewire/if_fwe.c: sys/dev/firewire/if_fwip.c: sys/dev/firewire/sbp.c: sys/dev/firewire/sbp_targ.c: Unifdef the code, removing support for DragonflyBSD and FreeBSD prior to version 5. Submitted by: gibbs MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: 1081188 on 2014/08/01
* Silence noisy firewire logging.will2014-09-182-17/+0
| | | | | | MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: 974594 on 2013/08/02
* Use define from if_var.h to access a field inside struct if_data,glebius2014-08-301-1/+1
| | | | | | that resides in struct ifnet. Sponsored by: Nginx, Inc.
* Pull in r267961 and r267973 again. Fix for issues reported will follow.hselasky2014-06-284-33/+18
|
* Revert r267961, r267973:gjb2014-06-274-18/+33
| | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifhselasky2014-06-274-33/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies
* Set target->sbp field to valid value when sbp device is created.kan2014-06-201-1/+1
| | | | | | | | | | | | The sbp_cam_detach_target can be called from sbp_post_explore function on the first target that is not really attached and it was written with the corresponding safety check in place to tolerate that. Unfortunately the recent locking cleanup did add a locking assertion that tries to dereference the target->sbp pointer unconditionally, which causes less than desirable outcome. Since the assertion is useful, just initialize the target sbp pointer once when sbp device is being initialized instead of when the target is being attached. This makes assertion work in all cases and fixes the crash on boot.
* Various cleanups and fixes:jhb2014-05-271-172/+102
| | | | | | | | | | | - Switch from timeout() to callout_*() for per-request timers. - Use device_find_child() in the identify routine. - Use device_printf() instead of passing device_get_nameunit() to printf(). - Expand the SBP_LOCK coverage simplifying the locking. - Uninline STAILQ_FOREACH_SAFE(). Tested by: sbruno
* Remove some unused variables.brueffer2014-05-161-2/+0
| | | | | Found with: Clang Static Analyzer MFC after: 2 weeks
* Teach every SIOCGIFSTATUS provider to fill in ifs->ascii anyway.melifaro2014-01-071-7/+3
| | | | | | | | | Remove old bits of data concat for 'ascii' field. Remove special SIOCGIFSTATUS handling from if.c (which Coverity yells at). Reported by: Coverity Coverity CID: 1147174 MFC after: 2 weeks
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thiseadler2013-11-306-8/+8
| | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva
* Adjust various SCSI drivers to handle either a 32-bit or 64-bit lun_id_t,nwhitehorn2013-10-301-16/+19
| | | | | | | mostly by adjustments to debugging printf() format specifiers. For high numbered LUNs, also switch to printing them in hex as per SAM-5. MFC after: 2 weeks
* The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareglebius2013-10-262-0/+2
| | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc.
* Partial MFproject/camlock r256671:mav2013-10-211-1/+1
| | | | | Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them.
* Re-do r255853. Along with adding back the API/ABI changes from thescottl2013-09-251-3/+5
| | | | | | | | original, this hides the contents of cam_compat.h from ktrace/kdump/truss, avoiding problems there. There are no user-servicable parts in there, so no need for those tools to be groping around in there. Approved by: re
* Revert r255853 pending fixes to build errors in usr.bin/kdumpgjb2013-09-251-5/+3
| | | | Approved by: re (implicit)
* Update the CAM API for FreeBSD 10:scottl2013-09-241-3/+5
| | | | | | | | | | | | | | | | | | | | | | - Remove the timeout_ch field. It's been deprecated since FreeBSD 7.0; MPSAFE drivers should be managing their own timeout storage. The remaining non-MPSAFE drivers have been modified to also manage their own storage, and should be considered for updating to MPSAFE (or removal) during the FreeBSD 10.x lifecycle. - Add fields related to soft timeouts and quality of service, to be used in upcoming work. - Add room for more flags in the CCB header and path_inq structures. - Begin support for extended 64-bit LUNs. - Bump the CAM version number to 0x18, but add compat shims. Tested with camcontrol and smartctl. Reviewed by: nathanw, ken, kib Approved by: re Obtained from: Netflix
* - Use make_dev_credf(MAKEDEV_REF) instead of the race-prone make_dev()+davide2013-09-071-5/+3
| | | | | | | | dev_ref() in the clone handlers that still use it. - Don't set SI_CHEAPCLONE flag, it's not used anywhere neither in devfs (for anything real) Reviewed by: kib
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIscottl2013-08-121-1/+1
| | | | | | | | | | | | | | | | | command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day
* MFprojects/camlock r248982:mav2013-04-141-2/+2
| | | | | | | | 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.
* FireWire: Don't allow a tlabel to reference an xfer after free.will2013-04-081-3/+12
| | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: - fw_xfer_unload(): Since we are about to free this xfer, call fw_tl_free() to remove the xfer from its tlabel's list, if it has a tlabel. - In every occasion when a xfer is removed from a tlabel's list, reset xfer->tl to -1 while holding fc->tlabel_lock, so that the xfer isn't mis-identified as belonging to a tlabel. This doesn't fix all the use-after-free problems for M_FWMEM, but is an incremental towards that goal. Reviewed by: kan, sbruno Sponsored by: Spectra Logic
* bus_dmamap_load_ccb doesn't exist on earlier versions of FreeBSD orimp2013-02-211-3/+1
| | | | | | | DragonFlyBSD, so it certainly doesn't need splsoftvm(). Remove it. # I doubt this driver will now compile on older FreeBSD versions or DFBSD # We should consider unifdefing it since that code seems unmaintained.
* Reform the busdma API so that new types may be added without modifyingkib2013-02-121-8/+2
| | | | | | | | | | | | | | | | | | | | | 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>)
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-043-9/+9
| | | | malloc(9) flags in sys/dev.
* Fix an issue that caused the kernel to panic inside CTL when tryingken2012-06-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to attach to target capable HBAs that implement the old immediate notify (XPT_IMMED_NOTIFY) and notify acknowledge (XPT_NOTIFY_ACK) CCBs. The new API has been in place since SVN change 196008 in 2009. The solution is two-fold: fix CTL to handle the responses from the HBAs, and convert the HBA drivers in question to use the new API. These drivers have not been tested with CTL, so how well they will interoperate with CTL is unknown. scsi_target.c: Update the userland target example code to use the new immediate notify API. scsi_ctl.c: Detect when an immediate notify CCB is returned with CAM_REQ_INVALID or CAM_PROVIDE_FAIL status, and just free it. Fix a duplicate assignment. aic79xx.c, aic79xx_osm.c: Update the aic79xx driver to use the new API. Target mode is not enabled on for this driver, so the changes will have no practical effect. aic7xxx.c, aic7xxx_osm.c: Update the aic7xxx driver to use the new API. sbp_targ.c: Update the firewire target code to work with the new API. mpt_cam.c: Update the mpt(4) driver to work with the new API. Target mode is only enabled for Fibre Channel mpt(4) devices. MFC after: 3 days
* Update sbp_targ such that it can actually handle multiple CTIO's during ↵sbruno2012-01-251-79/+314
| | | | | | operation PR: kern/119575
* ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againkevlo2012-01-071-1/+0
| | | | Reviewed by: yongari
OpenPOWER on IntegriCloud