aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/firewire
Commit message (Collapse)AuthorAgeFilesLines
* fwdv: add AV/C DV capture driver for FireWire camcordersAbdelkader Boudih2026-07-122-0/+1296
| | | | | | | | | | | | Add fwdv(4) driver for DV video capture from FireWire camcorders using AV/C protocol and isochronous streaming. Supports AV/C tape transport commands (play, stop, ff, rewind, pause, record, eject) with NTSC/PAL auto-detection and read(2) interface for frame capture. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58122
* fwisound: add Apple FireWire audio driverAbdelkader Boudih2026-07-093-0/+954
| | | | | | | | | | | Expose audio capture from Apple FireWire devices as a standard pcm(4)/dsp(4) device via the newpcm framework. (adrian: I've tested this on an isight camera and looped it back to USB speakers via "sox -t oss /dev/dsp3 -t oss /dev/dsp4") Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58109
* fwcam: retry ISO enable after re-powering cameraAbdelkader Boudih2026-07-091-1/+16
| | | | | | | | | Some IIDC cameras power down the sensor when inactive (e.g. lens cover closed) and reject ISO enable with EIO. Re-power the camera and retry once before failing. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58101
* fwcam: defer ISO streaming to first readAbdelkader Boudih2026-07-091-14/+10
| | | | | | | | | | | Moved ISO start to first usage. Opening the device now only validates state and increments the open count, allowing info queries and mode changes without starting the camera. ISO streaming begins on demand when userland first reads frame data. This avoid the camera led to turn-on at attach. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58100
* fwcamctl: add control utility for fwcam(4) IIDC FireWire camerasAbdelkader Boudih2026-07-082-21/+64
| | | | | | | | | | | | | | | | | | fwcamctl provides userland access to /dev/fwcam0. Supported subcommands: info (camera state, format, mode, rate, features), snap (capture a frame as PPM), mode (set format/mode/rate), and feat (get/set camera feature registers). snap converts YUV422, YUV411, YUV444, RGB8, and Mono8 pixel formats to RGB24 PPM with no external dependencies. A configurable frame skip (default 5) allows auto-exposure and auto-white-balance to settle before capture. (from adrian - yes, I've successfully captured images from an Apple isight camera on firewire with this tool and in-tree support.) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57914
* fwcam: write video mode registers before enabling ISO streamingAbdelkader Boudih2026-07-082-3/+44
| | | | | | | | | | | The IIDC spec (s3.1) requires the video mode to be programmed before ISO enable. Without this, cameras that power up with invalid default mode/rate combinations reject the ISO_EN write. This can happen when the firmware of teh camera is outdated or vendor never updated it. Differential Revision: https://reviews.freebsd.org/D58092
* fwcam: set ISO speed from device link speedAbdelkader Boudih2026-07-081-0/+1
| | | | | | | | | | iso_speed was never initialized, defaulting to S100 regardless of the camera's actual link speed. Some cameras firmwares reject ISO_EN when the speed field in the ISO_CHANNEL register does not match their capabilities. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58091
* fwcam: add dynamic resolution and frame rate supportAbdelkader Boudih2026-07-082-3/+32
| | | | | | | | | | | | | | Read V_MODE_INQ and V_RATE_INQ registers for all supported formats during probe, caching the camera's actual capabilities. Use these to validate SMODE ioctl requests before writing to the camera. Writing an unsupported combination caused the camera to stop responding, requiring a physical power cycle. Tested with: Apple iSight (external FireWire) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58090
* fwohci: fix LPS delay, PHY_INT storm, and SID timeout recoveryAbdelkader Boudih2026-07-082-8/+54
| | | | | | | | | | | | Fixed the post-LPS delay from 500us to the IEEE 1394a-2000 s6.1 mandated 10ms ceiling. Handled PHY_INT by clearing W1C status bits in register 5 (masked ISBR to avoid spurious bus resets). Added a SID timeout callout that recovers the state machine when a remote device fails to complete self-ID. Fixed FW_PHY_SPD operator precedence and gated noisy messages behind bootverbose/firewire_debug. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58033
* fwip: Fix M_PKTHDR loss in fwip_async_output broadcast pathAbdelkader Boudih2026-07-051-7/+15
| | | | | | | | | | | | | M_PREPEND in the broadcast branch may call m_prepend(9) which allocates a new head mbuf and calls m_move_pkthdr(), stripping M_PKTHDR from the old mbuf. xfer->mbuf was set before M_PREPEND, so it pointed at the deheadered old mbuf. bus_dmamap_load_mbuf(9) asserts M_PKTHDR and panics. Reviewed by: zlei, adrian Differential Revision: https://reviews.freebsd.org/D57495
* fwcam: add IIDC 1394 FireWire camera driverAbdelkader Boudih2026-06-252-0/+1314
| | | | | | | | | | | | Add fwcam(4), a driver for IIDC v1.30 (TA Document 1999023) digital cameras over IEEE 1394. Supports Format_0 (VGA) video modes with isochronous receive DMA, feature control (brightness, exposure, gain, shutter, white balance, focus, etc.), poll/kqueue, and hot-plug via bus reset handling. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57685
* firewire: add shared helpers for ISO receive driversAbdelkader Boudih2026-06-251-0/+290
| | | | | | | | | Add fw_helpers.h with common static inline helpers for FireWire ISO receive drivers: async xfer wait with timeout and tlabel cleanup, quadlet read/write, and ISO mbuf management. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57684
* firewire: NULL check on malloc in fw_busreset()Abdelkader Boudih2026-06-221-0/+3
| | | | | | | | | | | fw_busreset() allocates newrom with M_NOWAIT from interrupt context. If the allocation fails, crom_load() dereferences a NULL pointer. Skip the config ROM comparison on allocation failure so the next bus reset will retry. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57728
* firewire: extract shared helpers from fwe and fwipAbdelkader Boudih2026-06-193-95/+128
| | | | | | | | | Add fw_net.h with common inline helpers used by both if_fwe and if_fwip: ISO chunk init, TX xfer allocation, xferlist free, send queue drain, and DEVICE_POLLING ioctl handling. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D57615
* firewire: Fix watchdog_clock aliasing and fw_tl2xfer UAF raceAbdelkader Boudih2026-06-082-30/+38
| | | | | | | | | | | | | | | Two bugs in the firewire bus layer that affect all consumers ( if_fwip, sbp): watchdog_clock was a static local in firewire_watchdog(), shared across all firewire_comm instances. With two controllers (e.g. built-in + Thunderbolt Display), both advance the same counter, so the second controller's 15-second boot-time timeout guard expires prematurely. fw_tl2xfer() released tlabel_lock before returning the xfer pointer. Reviewed by: zlei, adrian Differential Revision: https://reviews.freebsd.org/D57496
* firewire: clean up XXX commentsAbdelkader Boudih2026-06-061-16/+9
| | | | | | | | | | | | | Remove stale and misleading XXX comments throughout firewire.c. Most were from the original 2002 codebase and either described correct behavior or noted aspirational improvements that never happended. Two actionable items retained as TODO: config ROM CRC validation and pending xfer cleanup on detach. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57466
* fix(fwe): add missing net epoch around ether_inputAbdelkader Boudih2026-06-061-0/+3
| | | | | | | | | Wrap the if_input() call in fwe_as_input() with NET_EPOCH_ENTER/EXIT. The network stack requires epoch protection when delivering packets via if_input, and fwe was missing it. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57459
* chore: replace {0, 0} with {DEV,KOBJ}METHOD_ENDEnji Cooper2026-02-254-4/+4
| | | | | | | | | | | | | | Both of the aforementioned macros have been present in FreeBSD for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for `DEVMETHOD_END`. Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END` and `KOBJMETHOD_END` as appropriate. This helps ensure that future adaptations to drivers following patterns documented in driver(9) can be made more easily/without issue. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55414
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-211-1/+1
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* Internal scheduling priorities: Always use symbolic onesOlivier Certner2025-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | Replace priorities specified by a base priority and some hardcoded offset value by symbolic constants. Hardcoded offsets prevent changing the difference between priorities without changing their relative ordering, and is generally a dangerous practice since the resulting priority may inadvertently belong to a different selection policy's range. Since RQ_PPQ is 4, differences of less than 4 are insignificant, so just remove them. These small differences have not been changed for years, so it is likely they have no real meaning (besides having no practical effect). One can still consult the changes history to recover them if ever needed. No functional change (intended). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45390
* bus_generic_detach: Delete children after detaching themJohn Baldwin2025-01-021-5/+0
| | | | | | | | | | | | | | | | | This provides better semantics as a standalone DEVMETHOD for device_attach as bus drivers should remove child devices they created as part of detach cleanup. The implementation calls bus_detach_children() first to permit child devices an opportunity to veto the detach operation. If that succeeds, device_delete_children() is used to delete the child devices. This requires fixing various drivers that were deleting devices explicitly (via a device_t pointer cached in the softc) after calling bus_generic_detach to stop doing that and just rely on bus_generic_detach to remove child devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47959
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-062-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin2024-12-062-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
* 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