uvideo: Return actual mtx_sleep error in dqbuf
Don't coerce errors to EINVAL, which isn't correct for mtx_sleep's
failure cases.
Sponsored by: The FreeBSD Foundation
sys: Import snapshot of Aquantia ACQ107 vendor driver
Obtained from https://github.com/Aquantia/aqtion-freebsd commit
c61d27b1d94af72c642deefa0595884481ea7377.
This is not using a vendor branch. The formerly-upstream repo is
abandoned and I do not believe it will receive updates. This initial
import serves as a snapshot of the vendor code, but from here we will
iterate on it in the tree as our own code.
Bug fixes, code cleanup, and build infrastructure will follow.
NetBSD and OpenBSD have derivatives of this driver (with additional
hardware support). We can look to changes in those drivers, and the
Linux driver, to add support here.
Reviewed by: adrian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53813
[2 lines not shown]
aq(4): Port to IfAPI
Direct access to struct ifnet members is not possible in FreeBSD 15;
accessors must be used. These exist in all supported FreeBSD versions,
so we do not need to make this conditional.
(cherry picked from commit 4756f5ff8f10cdda925cab60c0b66606698e49ee)
aq(4): Remove #include of user header <unistd.h>
pause() has 2 different definition in unistd.h and sys/systm.h
(cherry picked from commit 14eb7ec7b7135ad1a3448590cbe70b1368b40ec7)
aq(4): Fix VLAN tag test
Previously emitted a compiler warning "warning: bitwise comparison
always evaluates to false."
Looking at the OpenBSD driver (which is based on this code) it looks
like the VLAN flag should be set if either of these bits is. In the
OpenBSD driver these are AQ_RXDESC_TYPE_VLAN and AQ_RXDESC_TYPE_VLAN2
rather than a magic number 0x60.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53836
(cherry picked from commit 8666fda1afb03b3a88e57a20d76da8e7910b6407)
aq(4): Remove unimplemented functions
aq_if_priv_ioctl and aq_if_debug have prototypes but are not yet
implemented. Just remove the commented-out DEVMETHODs and the unused
prototypes, to clear a build-time warning; the DEVMETHODs and prototypes
can be readded if / when they are implemented.
(cherry picked from commit 0156be41a1eb8e0408819466b912181aa7966df9)
vtfontcvt: Avoid dead store in add_char
The fallback glyph is stored at index 0, and does not need to be
inserted into a mapping.
Previously there was a dead store of add_glyph's return value for the
fallback case, which upset Clang's static analyzer. Now, cast the
return value to (void) to make it clear this is intentional.
Also change add_glyph's fallback parameter to a c99 bool to make its use
more clear.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57174
(cherry picked from commit b273481f2a840a05e4039655be99528e1fa9388c)
uvideo: fix step=0 infinite loop and int overflow in fbuf_size
Prevent infinite loop in uvideo_vs_negotiation() when a USB camera reports
step=0 in its continuous frame interval descriptor.
Cast fbuf_size calculation to uint64_t to avoid int overflow for large
width/height/bpp combinations.
Reported by: emaste
libsysdecode: add Netlink attribute decoding infrastructure
Introduce a generic Netlink attribute decoding framework based on
attribute decoder tables. The framework supports decoding primitive
attribute types as well as nested attributes and can be reused by
different Generic Netlink families.
Signed-off-by: Ishan Agrawal <iagrawal9990 at gmail.com>
Sponsored-by: Google LLC (GSoC 2026)
Reviewed-by: kp
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2337
sound: Scale PCM secondary buffers by byte rate
The fixed 128 KiB secondary buffer cap dates from stereo-sized streams.
High channel-count or high sample-width OSS streams can consume most of
that budget in one graph quantum, leaving too little room for capture
catch-up or playback headroom.
Keep 128 KiB as the low-rate floor, but derive the effective soft-ring
cap from the channel byte rate, clamped to 4 MiB. Use that per-channel
cap when resizing the soft buffer and when clamping
SNDCTL_DSP_SETFRAGMENT requests.
Also clamp SNDCTL_DSP_LOW_WATER to the current soft-buffer size so an
impossible readiness threshold cannot make poll/select wait forever.
MFC after: 3 weeks
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D58064
cuse: Fix server reference leak in cuse_client_open()
If the server is closing (or the device node is going away), or if
devfs_set_cdevpriv() fails, cuse_client_open() returns with the server
reference taken at the top of the function still held and the newly
allocated client still linked on pcs->hcli. Since cuse_client_free()
has not been registered as the cdevpriv destructor at that point,
nothing ever undoes this work: every open() that races the is_closing
window permanently leaks one server reference and one cuse_client.
A leaked reference is fatal on server exit: cuse_server_free()
busy-waits in an uninterruptible pause("W", hz) loop until pcs->refs
drops to 1, which now never happens, so the exiting server process
(e.g. virtual_oss(8)) is left wedged in state "D", immune to SIGKILL,
cuse.ko is pinned (kldunload hangs too), and only a reboot recovers.
Before 634e578ac7b0 the is_closing error path dropped the reference by
calling devfs_clear_cdevpriv(), which ran the cuse_client_free()
destructor. That commit moved devfs_set_cdevpriv() after the
[14 lines not shown]
snd_uaudio: Don't let an idle stream reprogram a shared UAC2 clock
Some UAC2 devices expose a single Clock Source entity that is shared
between their playback and capture interfaces (it appears in both the
output and input clock bitmaps). On such a device uaudio(4) programs
the sample rate for both directions when a stream starts. If playback
runs at a 44.1 kHz-family rate while the idle capture channel is left
at its 48 kHz-family default, the capture
SET_CUR(UA20_CS_SAM_FREQ_CONTROL) is issued after the playback one and
overwrites the rate on the shared clock. The device then runs at
~48 kHz while the playback stream carries 44.1 kHz data. Consuming
samples faster than they arrive, the device repeatedly runs out of
data, loses sync with the playback stream, and re-locks onto it
(audible dropouts, front-panel play/idle flicker). The 48 kHz family
is unaffected because both directions then agree on the rate.
Fix it in three parts:
- Add a shared-clock guard: before issuing SET_CUR to a clock id, if
[28 lines not shown]
icmp: Verify redirect gateway with fib-aware ifa selection
During call to `icmp_verify_redirect_gateway()` ensure using
fib-aware source address selection function.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58409
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/14.
Fixes: 83e087e0ea21 (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/15.
Fixes: bd13516d400b (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
acpi_cpu(4): Call ACPI_GET_FEATURES() on a reset 'features' variable
This is to prevent child drivers from using the features returned by
previous drivers (in an arbitrary order). None of the existing ones do
that, so this is purely defensive.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 664ad9ac4c9047d29d5f37d43174e1b469e2ec80)
x86/local_apic.c: Fiddle with thermal LVT slot only if supported
The thermal LVT slot does not necessarily exist.
According to Intel's Software Developers Manual, for Intel processors
supporting 64-bit operation (amd64), probably even the earliest ones
should have a local APIC with such a slot (the slot was introduced with
Pentium 4 and Xeon processors according to the manual, and the 64-bit
implementation in some later versions of them). AMD's Architecture
Programmer's Manual also seems to imply that all AMD processors
supporting amd64 should have the slot too. So this change may not be
needed when i386's code is dropped, but it does not hurt to have it, and
it might ease possible MFCs.
Change the signature of lapic_enable_thermal() so that it can report
failure (if there is no local APIC or if there is no thermal LVT slot).
Reviewed by: bnovkov, kib
MFC after: 2 weeks
[4 lines not shown]
i386: provide PCPU pc_small_core for amd64 compat
Provide pc_small_core for i386 too to fix an i386 build break from x86
code referring to it. It won't be set.
Reviewed by: aokblast, kib
Fixes: 7b26353a59d6 ("hwpstate_intel: Disable package control on hybrid CPU")
Differential Revision: https://reviews.freebsd.org/D58335
(cherry picked from commit 29d15d658d175139196d821b123c30a5b58e135e)
i386: supply thermal interrupt handler
This fixes a build break for i386.
Reviewed by: kib, olce, Koine Yuusuke <koinec at yahoo.co.jp>
Fixes: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler")
Differential Revision: https://reviews.freebsd.org/D58332
(cherry picked from commit cb325dcedfa291c9bfe350a513694df3776a17a4)
x86/local_apic.c: Factor out version read and max LVT slot computation
This makes the code slightly more compact and easier to read.
No functional change intended.
Reviewed by: bnovkov
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58110
(cherry picked from commit 060ecf296664fd150328ac6dcdc24764a427bc3a)
x86/local_apic.c: Thermal interrupt support: Additional style fixes
Rename handler function type 'lapic_thermal_handle_function' to the
shorter 'lapic_thermal_handler_t'. Move it closer to the function
declaration block where it is used. Make it a true function type (no
pointer) and add explicit pointer marks on usage.
Rename 'lapic_thermal_function_value' to the more immediately clear
'lapic_thermal_function_arg'. In lapic_thermal_enable(), use 'func_arg'
as the argument name for the handler argument, which at least refers to
function 'func', rather than the generic 'value'.
Finally, rename the global handler variable from
'lapic_thermal_function_ptr' to the shorter 'lapic_thermal_function'
(dynamic functions can be referenced only through a pointer).
MFC with: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0)
files: riscv, arm64: Remove redundant 'ofw_cpu.c'
Should have been removed when that line was moved from 'files.arm' to
'files'.
Fixes: 14e1a2cd295d ("Move ofw_cpu file to the main files conf file.")
MFC after: 2 weeks
Event: Halifax Hackathon 202606
Location: Seat 36K in AC667, over Maine near Canadian border
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 10213f01773f22ab948ec1e87c880b1d19a1fc45)
x86/local_apic.c: Add support for installing a thermal interrupt handler
The thermal interrupt is initially masked.
Thermal interrupt handling is enabled by calling lapic_enable_thermal(),
which installs a (single) handler.
[olce: Wrote the commit message.]
Reviewed by: kib, olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44454
(cherry picked from commit 87ba088fa3108dd180008a04f25760ec71476c87)
ps.1: Fix broken comment line
While here, remove the long-unused dash in the first line.
Reviewed by: ziaee, olce
Fixes: ddf144a04b53 ("ps.1: Revamp: Explain general principles, update to match reality")
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D58038
(cherry picked from commit 759ce9a2b38e1de70c14c81dee7e245bf0bc6b94)
acpi_hpet(4): Remove unused 'acpi_hpet_disabled' boolean
Same reason as for the previous commit to acpi_cpu(4). This boolean is
not used anywhere. Disabling acpi_hpet(4) can be done through the
regular ACPI disable mechanism (using the 'debug.acpi.disabled' tunable,
see acpi_disabled()).
Reviewed by: emaste (implicit)
Fixes: ac3ede5371af ("x86/xen: remove PVHv1 code")
MFC after: 3 days
Event: Halifax Hackathon 202606
Location: Dalhousie CS Faculty building
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 25df388574ac1d295f4014825de0df1d65cbdc53)