aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/firewire
Commit message (Collapse)AuthorAgeFilesLines
* fwcam: release the IR DMA channel when starting the stream failsAbdelkader Boudih2026-08-091-0/+3
| | | | | | | | Disabled the IR DMA channel on the error path, which clears the flag and frees the descriptor blocks before the chunks go away. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58502
* fwcamctl: remove, superseded by the video(4) interfaceAbdelkader Boudih2026-08-091-79/+1
| | | | | | | | | fwcam(4) no longer creates its own character device or implements the FWCAM_* ioctls; it registers with video(4) and is driven through the standard V4L2 interface on /dev/videoN. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58500
* fwcam: convert to video(4) frameworkAbdelkader Boudih2026-08-092-284/+518
| | | | | | | | Replaced the monolithic cdevsw implementation with the video(4) framework. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58369
* firewire: replace magic numbers with named constantsAbdelkader Boudih2026-07-2012-58/+112
| | | | | | | No functional change. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58311
* firewire: remove dead code across the subsystemAbdelkader Boudih2026-07-209-428/+3
| | | | | Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58310
* firewire: force root change when root node is not cycle master capableAbdelkader Boudih2026-07-201-3/+4
| | | | | | | | | When a FireWire bus resets, all devices negotiate who is the new boss. when we detect the root node can't be cycle master, we send a PHY config packet that forces a reelection. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58309
* firewire: drain pending xfers after callout stop in detachAbdelkader Boudih2026-07-201-1/+3
| | | | | | | Removes a TODO that predates the existing drain call. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58308
* firewire: add warn-only CRC validation for CSR ROM directoriesAbdelkader Boudih2026-07-205-1/+32
| | | | | | | | | | | | Implemented crom_crc_valid() helper to validate IEEE 1394 config ROM CRC-16 checksums. Skipped root header CRC validation since csrhdr.crc_len cover the entire ROM body which is not fully read at header parse time. Per-directory CRC checks below catch corruption where it needed. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58307
* firewire: remove SPL callsAbdelkader Boudih2026-07-178-107/+14
| | | | | | | | SPL is a no-op on amd64. Real locking is already handled by fc_mtx and per-driver mutexes. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D58210
* fwdv: match unit directories instead of IDENTIFYAbdelkader Boudih2026-07-171-87/+26
| | | | | | | Migrated fwdv to use per-unit-directory child device Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58204
* fwisound: match unit directories instead of IDENTIFYAbdelkader Boudih2026-07-171-116/+50
| | | | | | | Migrated fwisound to use per-unit-directory child device Differential Revision: https://reviews.freebsd.org/D58203 Reviewed by: adrian
* fwcam: match unit directories, defer probe to first openAbdelkader Boudih2026-07-172-105/+103
| | | | | | | Migrated fwcam to use per-unit-directory child device Differential Revision: https://reviews.freebsd.org/D58202 Reviewed by: adrian
* firewire: per-unit-directory child device supportAbdelkader Boudih2026-07-176-26/+285
| | | | | | | | Added structure to allow multiple device to attach to the same driver. Also removed the deprecation warning from the man page. Differential Revision: https://reviews.freebsd.org/D58201 Reviewed by: adrian
* 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