aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/firewire
Commit message (Collapse)AuthorAgeFilesLines
* fwip(4): Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang2024-09-031-5/+1
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
* newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh2024-07-252-2/+2
| | | | Sponsored by: Netflix
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-282-8/+2
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* bpf: Add IfAPI analogue for bpf_peers_present()Justin Hibbits2023-10-131-2/+2
| | | | | | | | | | | | An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a new IfAPI that could deal with a NULL bpf, if such could occur in the network stack. Reviewed by: zlei Sponsored by: Juniper Networks, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42082
* Revert "bpf: Add IfAPI analogue for bpf_peers_present()"Justin Hibbits2023-10-131-2/+2
| | | | | | This reverts commit c81dd8e5fe72d0c7ec055c8621bb2da3a3627abf. Commit message needs revised.
* bpf: Add IfAPI analogue for bpf_peers_present()Justin Hibbits2023-10-131-2/+2
| | | | | | | | | | | An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a new IfAPI that includes a NULL check. Since this API is used in only a handful of locations, it reduces the the NULL check scope over inserting the check into bpf_peers_present(). Sponsored by: Juniper Networks, Inc. MFC after: 1 week
* sys: Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-165-7/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1610-10/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-169-18/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Mechanically convert fwe(4) and fwip(4) to IfAPIJustin Hibbits2023-02-064-96/+96
| | | | | Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37850
* firewire(4): Fix a typo in an error messageGordon Bergling2022-10-251-1/+1
| | | | | | - s/faild/failed/ MFC after: 5 days
* Fix unused variable warning in fwohci.cDimitry Andric2022-07-211-2/+9
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/dev/firewire/fwohci.c:2762:23: error: variable 'pcnt' set but not used [-Werror,-Wunused-but-set-variable] int len, plen, hlen, pcnt, offset; ^ The 'pcnt' variable is eventually used only in an #if 0'd block, obviously meant for debugging. Ensure that 'pcnt' is only declared and used when COUNT_PACKETS is defined, so the debugging can be easily turned on later, if desired. MFC after: 3 days
* firewire: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-095-15/+5
|
* firewire: Initialize firewire_devclass in fw_modevent.John Baldwin2022-04-271-2/+2
| | | | | | | | | | The use of devclass_get_softc() combined with cdev unit numbers is probably not ideal (probably should be initializing si_drv1 when each cdev is created instead), but it looks like a bit of a PITA to do, so just initialize the devclass explicitly instead. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D35060
* firewire(4): Fix "set but not used" warningsEdward Tomasz Napierala2021-12-204-7/+8
| | | | Sponsored By: EPSRC
* firewire: plug set-but-not-used varsMateusz Guzik2021-12-091-13/+31
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* firewire(4): Fix a typo in a source code commentGordon Bergling2021-11-191-1/+1
| | | | | | - s/unavailabe/unavailable/ MFC after: 3 days
* cam: prefer cam_sim_softc() over accessing cam_sim structure directly.Warner Losh2021-06-031-2/+2
| | | | | | | | | Use the accessor function to get the softc for this sim. This also drops an unneeded cast. Sponsored by: Netflix Reviewed by: mav@, hselasky@ Differential Revision: https://reviews.freebsd.org/D30360
* fwip(4): fixing kernel panic when receiving unicast packetTai-hwa Liang2021-04-151-1/+5
| | | | | | | | Wrapping fwip_unicast_input() with NET_EPOCH_{ENTER,EXIT} to avoid a NET_EPOCH_ASSERT() in netisr_dispatch(). Reviewed by: hselasky MFC after: 2 weeks
* fwohci: Cast bitfield to uint32_t before passing it to roundup2().John Baldwin2021-02-171-1/+1
| | | | | | | | | | The fallback for __align_up() used by roundup2() uses __typeof__() which doesn't work for bitfields. This fixes the build on GCC which uses the fallback. Reviewed by: arichardson, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D28599
* fwohci(4): remove support for Sun PCIO-2 FireWire controllersMarius Strobl2020-12-252-14/+0
| | | | | It's no longer used since 58aa35d42975c298ca0adba705c042596303c9f5 and r357455 respectively.
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.Edward Tomasz Napierala2020-11-231-3/+3
| | | | | | | | | | | Reviewed by: imp, mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26843 Notes: svn path=/head/; revision=367953
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-265-8/+10
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Remove sparc64 kernel supportWarner Losh2020-02-031-4/+0
| | | | | | | | | Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs Notes: svn path=/head/; revision=357455
* Widen NET_EPOCH coverage.Gleb Smirnoff2019-10-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When epoch(9) was introduced to network stack, it was basically dropped in place of existing locking, which was mutexes and rwlocks. For the sake of performance mutex covered areas were as small as possible, so became epoch covered areas. However, epoch doesn't introduce any contention, it just delays memory reclaim. So, there is no point to minimise epoch covered areas in sense of performance. Meanwhile entering/exiting epoch also has non-zero CPU usage, so doing this less often is a win. Not the least is also code maintainability. In the new paradigm we can assume that at any stage of processing a packet, we are inside network epoch. This makes coding both input and output path way easier. On output path we already enter epoch quite early - in the ip_output(), in the ip6_output(). This patch does the same for the input path. All ISR processing, network related callouts, other ways of packet injection to the network stack shall be performed in net_epoch. Any leaf function that walks network configuration now asserts epoch. Tricky part is configuration code paths - ioctls, sysctls. They also call into leaf functions, so some need to be changed. This patch would introduce more epoch recursions (see EPOCH_TRACE) than we had before. They will be cleaned up separately, as several of them aren't trivial. Note, that unlike a lock recursion the epoch recursion is safe and just wastes a bit of resources. Reviewed by: gallatin, hselasky, cy, adrian, kristof Differential Revision: https://reviews.freebsd.org/D19111 Notes: svn path=/head/; revision=353292
* style(9): remove extraneous empty linesGleb Smirnoff2019-09-251-1/+0
| | | | Notes: svn path=/head/; revision=352725
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-202-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Use https over http for FreeBSD pagesEitan Adler2018-07-271-1/+1
| | | | Notes: svn path=/head/; revision=336757
* The Uninorth ID was really for Uninorth 2.Warner Losh2018-04-012-3/+3
| | | | | | | | Submitted by: Sevan Janiyan Differential Revision: https://reviews.freebsd.org/D14919 Notes: svn path=/head/; revision=331858
* fwohcireg.h is 99% the same between the boot loader and theWarner Losh2018-03-311-0/+2
| | | | | | | | kernel. Delete it and fix up the 1% difference because there's no need for them to be different. Notes: svn path=/head/; revision=331852
* Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since veryGleb Smirnoff2017-12-062-5/+1
| | | | | | | | beginning of polling(4). The module always ignored return value from driver polling handler. Notes: svn path=/head/; revision=326642
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2713-0/+26
| | | | | | | | | | | | | | | 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
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-1811-0/+22
| | | | | | | | | | | | | | | | | | | | 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. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* firewire/sbp: try to improve locking, plus a few style nitsAndriy Gapon2017-03-071-23/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change tries to fix the most obvious locking problems. sbp_cam_scan_lun() is never called with the sbp lock held, so the lock needs to be acquired internally (if it's needed at all). Without this change a kernel with INVARIANTS panics when a firewire disk is connected: panic: mutex sbp not owned at /usr/src/sys/dev/firewire/sbp.c:967 KDB: stack backtrace: db_trace_self_wrapper() at 0xffffffff80420bbb = db_trace_self_wrapper+0x2b/frame 0xfffffe0504df0930 kdb_backtrace() at 0xffffffff80670359 = kdb_backtrace+0x39/frame 0xfffffe0504df09e0 vpanic() at 0xffffffff8063986c = vpanic+0x14c/frame 0xfffffe0504df0a20 panic() at 0xffffffff806395b3 = panic+0x43/frame 0xfffffe0504df0a80 __mtx_assert() at 0xffffffff8061c40d = __mtx_assert+0xed/frame 0xfffffe0504df0ac0 sbp_cam_scan_lun() at 0xffffffff80474667 = sbp_cam_scan_lun+0x37/frame 0xfffffe0504df0af0 xpt_done_process() at 0xffffffff802aacfa = xpt_done_process+0x2da/frame 0xfffffe0504df0b30 xpt_done_td() at 0xffffffff802ac2e5 = xpt_done_td+0xd5/frame 0xfffffe0504df0b80 fork_exit() at 0xffffffff805ff72f = fork_exit+0xdf/frame 0xfffffe0504df0bf0 fork_trampoline() at 0xffffffff8082483e = fork_trampoline+0xe/frame 0xfffffe0504df0bf0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Also, I tried to reduce the scope of the sbp lock to avoid holding it while doing bus_dma allocations. The code badly needs some re-engineering. SBP really should implement a CAM transport, so that it avoids control flow inversion when re-scanning the bus. Also, the sbp lock seems to be too coarse. Additionally, the commit includes some changes not related to locking. - sbp_cam_scan_lun: restore CAM_DEV_QFREEZE before re-queueing the ccb because xpt_setup_ccb resets ccb_h.flags - sbp_post_busreset: call xpt_release_simq only if it's actually frozen - don't place private SIMQ_FREEZED flag (sic, "freezed") into sim->flags, use sbp->flags for that - some style fixes and control flow enhancements Reviewed by: sbruno MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9898 Notes: svn path=/head/; revision=314864
* Remove some locking not needed for modern CAM.Alexander Motin2017-02-281-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 after: 2 weeks Notes: svn path=/head/; revision=314375
* Add safety check against too long CDB.Alexander Motin2017-02-281-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 after: 1 week Notes: svn path=/head/; revision=314374
* Announce that sbp_targ(4) does not support initiator mode.Alexander Motin2017-02-271-1/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=314358
* sys/dev: Replace zero with NULL for pointers.Pedro F. Giffuni2017-02-201-1/+1
| | | | | | | | | | | Makes things easier to read, plus architectures may set NULL to something different than zero. Found with: devel/coccinelle MFC after: 3 weeks Notes: svn path=/head/; revision=313982
* 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-042-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* firewire: initialize tag label to -1 in fw_xfer_alloc()Andriy Gapon2016-11-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Zero can be confused for a potentially valid value. For example, if I load and unload sbp driver I get a lot of messages like the following: fw_tl_free: the xfer is not in the queue (tlabel=0, flag=0x0) send: dst=0x00 tl=0x00 rt=0 tcode=0x0 pri=0x0 src=0x000 recv: dst=0x01 tl=0x21 rt=1 tcode=0x1 pri=0x0 src=0xffc0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe04464407e0 fw_tl_free() at fw_tl_free+0x18d/frame 0xfffffe0446440820 fw_xfer_unload() at fw_xfer_unload+0xca/frame 0xfffffe0446440840 fw_xferlist_remove() at fw_xferlist_remove+0x2f/frame 0xfffffe0446440870 sbp_detach() at sbp_detach+0x1e0/frame 0xfffffe04464408e0 device_detach() at device_detach+0x80/frame 0xfffffe0446440900 devclass_driver_deleted() at devclass_driver_deleted+0x6a/frame 0xfffffe0446440940 devclass_delete_driver() at devclass_delete_driver+0x7d/frame 0xfffffe0446440980 driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe04464409d0 module_unload() at module_unload+0x32/frame 0xfffffe04464409f0 linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0446440a40 kern_kldunload() at kern_kldunload+0xbc/frame 0xfffffe0446440a70 amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe0446440bf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0446440bf0 MFC after: 2 weeks Notes: svn path=/head/; revision=309093
* fwohci: report whether PhysicalUpperBound register is implementedAndriy Gapon2016-11-241-0/+10
| | | | | | | | | | | | | | | | | Please see section 5.15 of 1394 OHCI Specification. If the register is not implemented, then the physical response unit is limited to the first 4GB of the physical memory. In that case the non-cooperative debugging over firewire (using /dev/fwmem) can not be expected to work if a target has more RAM than that. The method is described in gdb.4 and the Developer's Handbook. It seems that most of the consumer hardware does not implement PhysicalUpperBound register. MFC after: 1 week Notes: svn path=/head/; revision=309092
* Remove NULL checks after M_WAITOK allocations from firewire.Edward Tomasz Napierala2016-05-105-22/+0
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=299351
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-035-9/+9
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* Make it explicit that D_MEM cdevsw d_flag is to signify that theKonstantin Belousov2016-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 Notes: svn path=/head/; revision=298890
* Don't assume bio_cmd is a bit field.Warner Losh2016-03-101-1/+1
| | | | | | | Differential Revision: https://reviews.freebsd.org/D5594 Notes: svn path=/head/; revision=296591
* firewire: fix a mismatch introduced in r230558.Pedro F. Giffuni2016-02-191-1/+1
| | | | | | | | | Found by: PVS Static Analysis Reviewed by: sbruno MFC after: 1 month Notes: svn path=/head/; revision=295810