asmc: move the sysctl registration loops next to their tables
asmc_attach() and asmc_init() had 4 description tables inline,
several hundred lines from the tables they index. Wrapped each loop in a
function defined after its table.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61293
asmc: make the raw key debug state unconditional
The ASMC_DEBUG block was in mid-struct, so struct asmc_softc had a different
layout in translation units that missed opt_asmc.h.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61292
asmc: move the backlight control level into the softc
light_control was a file-scope static shared by resume, the light.control
sysctl and the backlight method. Per-device state belongs in the softc.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61291
asmc: scan every sensor range through one helper
asmc_detect_sensors hand-rolled the temperature and light scans as copies
of asmc_scan_sensor_range(). Give the helper a match predicate and route
all five ranges through it.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61289
asmc: table-drive the system state and board identity sysctls
The dev.asmc.n.system subtree was seven copies of "probe the key, then
register", and the auto_poweron/sil pair in asmc_init two more. Drive both
from tables.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61288
asmc: collapse the SMS axis and light sensor sysctl handlers
asmc_mb_sysctl_sms_{x,y,z} differed only in which SMS key they read, and
asmc_mbp_sysctl_light_{left,right} only in which light key. One handler
each, selecting from a table through arg2.
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61287
asmc: collapse the per-fan speed sysctl handlers
The five fan speed handlers differed only in which key they read and
whether they wrote back. Select the key from a table through arg2, the way
asmc_sensor_sysctl() already packs a type and an index, and keep one
handler. A second table drives the seven registration calls.
No functional change,
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61286
asmc: share the getinfo and getbyindex PIO transactions
asmc_key_getinfo() and asmc_key_dump_by_index() both ran the command 0x13
transaction, the latter after a command 0x12. Put each behind a helper that
assumes the caller holds sc_mtx, and fold the shared response decode into
asmc_keyinfo_decode().
The index bytes are now derived inside the helper, so they are recomputed
per retry. Same value all the time.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61285
asmc: rebuild asmc_key_dump on the by-index helper
asmc_key_dump() branched on the backend, but asmc_key_dump_by_index()
already dispatches on it, so the PIO arm open-coded a transaction it could
have called. Keep one printer for both.
Output is unchanged. The PIO arm checked asmc_key_read()'s return value
instead of printing a zeroed buffer; the merged printer keeps that. Its
retry exhaustion message is gone, which asmc_dumpall() cannot observe.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61284
asmc: factor out the PIO data port byte loops
Reuse existing pattern and evict magic numbers
No functional change: the port access sequence and the per-caller retry
and error reporting behaviour are unchanged.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61283
acpi_apple: Fix sleep with non-sleepable lock held
Apple platform attach and detach functions are serialized with ordinary
mutex and contain code that executes malloc() that leads to INVARIANTS
warnings. Fix it through replacement of mutex with sx lock.
Fixes: d7d237ce731f ("acpi_apple: Apple platform ACPI driver")
Reviewed by: seuros
Differential Revision: https://reviews.freebsd.org/D61295
sys/kobj.h: Convert macro DEFINE_CLASS to designated initializers
So that it is less error prone when adding new struct members or
refactoring in future.
No functional change intended.
Reviewed by: kib, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61276
sdiob: copy vendor/device IDs from card common CIS
Copy both the vendor and device IDs from the card common CIS if they are
absent in a function.
These are optional according to the spec. [1]
[1] Part E1 SDIO Simplified Specification §16.6
MFC after: 3 days
Reviewed by: kibab, imp, adrian
Differential Revision: https://reviews.freebsd.org/D60988
(cherry picked from commit c91dfb47e0bcdf682f7f152624e03747787c6ea3)
sdiob: copy vendor/device IDs from card common CIS
Copy both the vendor and device IDs from the card common CIS if they are
absent in a function.
These are optional according to the spec. [1]
[1] Part E1 SDIO Simplified Specification §16.6
MFC after: 3 days
Reviewed by: kibab, imp, adrian
Differential Revision: https://reviews.freebsd.org/D60988
(cherry picked from commit c91dfb47e0bcdf682f7f152624e03747787c6ea3)
TCP RACK: fix RSM computation for TCP fast open
When spitting an RSM containing the SYN and data, honor the
sequence number used by the SYN flag when computing the offset
in the socket buffer.
PR: 297006
Reviewed by: rrs, Peter Lei
MFC after: 3 days
MFC to: stable/15
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D61149
mac syscalls: add kern_ implementations
Where the kern_ interfaces map trivially to the syscall interface, follow
the syscall name even if awkward (e.g., sys___mac* -> kern___mac*).
Otherwise use shorter names.
Effort: CHERI upstreaming
Sponsored by: DARPA, AFRL
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
xhci: only set the slot context parent hub fields on xHCI 1.2
The Enhanced SuperSpeed meaning of the slot context parent hub slot ID
and port number fields was introduced in xHCI 1.2. Controllers built to
an earlier revision define them only for a Low- or Full-speed device
behind a High-speed hub.
A SuperSpeed device behind a USB 3.2 hub on an Intel Alpine Ridge
controller, an xHCI 1.1 part, stops responding to Address Device and
loops in uhub_reattach_port until the port is disabled.
Fixes: 20b19982545e ("usb: support SSP and SSPx2 xHCI")
Reviewed by: aokblast, ngie, adrian
Differential Revision: https://reviews.freebsd.org/D61278
asmc: notify the SMC of shutdown and restart
Nothing tells the SMC that a power off or restart was user requested, so
the T2 keeps rebooting the machine thinking the system is wedged.
Approved-by: ngie (co-mentor)
Reviewed by: ngie, adrian
Differential Revision: https://reviews.freebsd.org/D61260
powerpc: Define the sub-word atomic load and store directly
All currently supported powerpc CPUs handle single-copy atomicity for
any size up to the native word size, so load and store operations are
guaranteed for sub-word size that are naturally aligned.
powerpc64: Don't ignore lookup errors in kernel linker
If a lookup fails for a R_PPC_JMP_SLOT (PLT relocation) ignoring errors
results in an address of 0 gets written into the jump slot, leading to a
NULL pointer jump when attempting to call the function it points to.
Fix this with proper error checking so that a module will fail to load
instead of crashing later on.
camcontrol: Fix -Wcast-align errors in the NVMe reservation report
Casting the byte buffer that holds the Reservation Report payload to
the status structures trips -Wcast-align on strict-alignment
architectures, which broke the CI builds there. Put the buffer in a
union with the two status structures instead, so it is properly
aligned and no casts are needed.
Reported by: FreeBSD CI
Fixes: ba75cf05727e ("camcontrol: Support NVMe reservations via the persist subcommand")
Co-authored-by: Claude Fable 5 <noreply at anthropic.com>
MFC after: 1 week
Sponsored by: Spectra Logic
zio_reexecute() keeps the old allocation trace
An allocating write that fails with anything but ENOSPC is reexecuted,
and keeps being reexecuted for as long as its vdev fails writes but
passes probes. With metaslab tracing enabled, each attempt adds its
allocation trace entries to the same io_alloc_list, which is only
reset when the zio is created. After a few thousand entries a debug
build panics with "too many entries in allocation list"; a non-debug
build keeps a list full of stale entries.
zio_reexecute() now starts a fresh trace list.
Reviewed by: George Wilson <gwilson at zfsmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #19634
msun: fix behaviour of nextafter*() and nexttoward*() for MAX value
For an edge case at an extreme, e.g., nextafter(-DBL_MAX,-INFINITY)
do not return x+x. Instead, evaluate x+x and assign it to a volatile
to raise an exception, and then fall through to return the correct
result in current rounding mode.
Approved by: re (cperciva)
PR: 299389
MFC after: 6 days (for inclusion into releng/15.2)
(cherry picked from commit 1fb5d8265bc4bbbf1f5bc79cc1d2a7f280b446b2)
(cherry picked from commit 42f926513b74cbac09d4d63a9daf8cb489078671)
contrib/bc: remove vs sub-directory
Some of the files in the vs sub-directory are checked out with CRLF
line breaks via .getattributes. This causes issues when checking out
the source tree with other tools that operate on Git repositories like
"got". Remove the vs sub-directory from the contrib tree, since it is
not required on FreeBSD.
Approved by: re (cperciva)
(cherry picked from commit 94d4ba04a96f495d635bf246e4d5021eb1faab22)
(cherry picked from commit 5b5f93f12e3683b3ba7d2d600384bb5c4ed6e91a)