Commit graph

43687 commits

Author SHA1 Message Date
John Baldwin
b23314ecb9 pcib: Use taskqueue_bus for hot-plug events instead of a private taskqueue
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49269
2025-03-10 13:32:38 -04:00
Takanori Watanabe
f9b4092743 acpi_wmi: Add type check before evaluaeting query ACPI method
Some ACPI wmi query is implemented by named object, not method,
ACPICA complains when non-method object is evaluated with one or more arguments.
Especially, almost all binary MOF object obtaining method is the case.

This commit will fix it.

PR:	284912
Reported by:	Alexander Ziaee
Differential Revision: https://reviews.freebsd.org/D49129
2025-03-10 11:22:30 +09:00
Joshua Rogers
b7269d89e5 wsp: Fix whitespaces
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
e381dabcc5 wsp: Rename max_finger_area sysctl to max_finger_diameter
The value of this sysctl is not an area, but a maximum diameter.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
a79397d132 wsp: Handle horizontal scrolling and create tunable for swipe/scroll.
Previously, a two-finger horizontal scroll would result in a forwards/backwards
keyboard event being performed. This patch changes that functionality to be
specified via two new sysctls: horizontal_swipe_finger_count and
scroll_finger_count. The former specifies how many fingers are used to perform
the aforementioned forwards/backwards keyboard event, while the latter specifies
how many fingers are used to perform horizontal scrolling. 0 disables each of
them.

The threshold for scrolling has been coupled into a single tunable:
scr_threshold. This tunable is used for both scrolling and the horizontal swipe.

t_factor and t_invert tunables have been created in the same manner as their
z-axis counterparts.

Horizontal scrolling is disabled by default, as it requires the sysctl
hw.usb.wsp.t_factor to 3 (wsp mode). Horizontal swiping is enabled by default
with a three-finger tap.

Also rewrite much of, and improve, documentation.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
8b04f07eda sysmouse(4): Add wsp(4)-style T-Axis reporting.
Neither the ums(4) nor psm(4) reporting can be used by the wsp(4)
driver, as they rely on static-length movements, while wsp(4) may need
to scroll in large amounts per evdev event push.

This style uses a false button-5 press as an indicator that the z-axis
movement is a horizontal scroll, otherwise a vertical scroll.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:35 +03:00
Joshua Rogers
02fb6b1162 wsp: Fix typo in function name.
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Joshua Rogers
d452a02995 wsp: Add hw.usb.wsp.max_scroll_finger_distance for two-finger scrolling
The hw.usb.wsp.max_scroll_finger_distance sysctl may be used to specify
the maximum distance between two fingers which are registered as a z-axis
(vertical scroll with mousepad) movement.

Previously, this was shared with the tunable
hw.usb.wsp.max_double_tap_distance which is used to specify the maximum
distance between two fingers which register as a right-click.

This patch also cleans up and add new information to the manpage for
wsp(4).

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Joshua Rogers
8ceca72751 wsp: Raise the default scr_hor_threshold sysctl.
The previous value caused nearly every horizontal movement to be
classed as a left/right-keyboard button-click.

Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07 20:53:34 +03:00
Olivier Certner
ef446a8065
smbios: style(9): smbios_cksum()
Reduce some variables' lifecycle.  Remove useless casts.  Remove
superfluous braces.  Add some consts.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:47 +01:00
Olivier Certner
516e24e579
smbios: Harden decoding of the BCD revision
bcd2bin() must not be called with a value greater or equal to
LIBKERN_LEN_BCD2BIN.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:46 +01:00
Olivier Certner
bb04712e37
smbios: Carefully print wrong entry point signature on identify
Using printf() with '%s' can lead to arbitrary long printing (although,
usually, a NUL byte should appear quite quickly) and trying to print
unprintable characters.

Instead, print in hexadecimal the exact bytes that are compared to the
expected signature.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:46 +01:00
Olivier Certner
fdf08ac1e9
smbios: Print an error on unexpected entry point length on identify
This helps figuring out quickly why no SMBIOS device appears in this case.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:46 +01:00
Olivier Certner
f6cbd6b6d2
smbios: Apply the v2.1's length fixup only on a 32-bit entry point
Only allow the length tolerance (0x1e instead of 0x1f) for a 32-bit
entry point, as there was no 64-bit entry point in the erroneous SMBIOS
v2.1 standard and assigning the length with 0x1f does not make sense in
this case.

While here, fix accessing the major/minor versions via 'eps' even in the
64-bit entry point case (not causing any practical problem thus far as
the entry point length is greater than any SMBIOS revisions in
existence, so the comparison guarding the fixup would not pass).

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:46 +01:00
Olivier Certner
3907feff7a
smbios: Print an error on memory map failure on identify
Consistently with what the probe and attach methods are doing.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:46 +01:00
Olivier Certner
67d510f0c0
smbios: Unmap memory on error on identify
While here, de-indent most of the code by simply bailing out if 'addr'
is still 0 after the various detection methods have been tried.

Reviewed by:    emaste, imp
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49180
2025-03-07 17:42:45 +01:00
Olivier Certner
e421a6615d
smbios: On attach, print the entry point version and revision
Additionally, on verbose boot, print the entry point revision as
a diagnostic/debugging help.

PR:             284460
Reviewed by:    markj, imp (both older version)
MFC after:      2 weeks
Event:          February src bug-busting session
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49179
2025-03-07 17:42:45 +01:00
Olivier Certner
bc7f650836
smbios: Search for v3 (64-bit) entry point first on BIOS boot
When booted from BIOS (i.e., not EFI), also search for a 64-bit version
of the SMBIOS Entry Point.

This allows us to detect and report the proper SMBIOS version with
BIOSes that only provide the v3 table, as happens on Hetzner virtual
machines.

For machines that provide both, leverage the v3 table in priority
consistently with the EFI case.

PR:             284460
Reviewed by:    markj, imp (both older version)
MFC after:      2 weeks
Relnotes:       yes
Event:          February src bug-busting session
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49179
2025-03-07 17:42:45 +01:00
Olivier Certner
69cf9e9a45
smbios: style(9): sizeof(): No space before the parenthesis
No functional change.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2025-03-07 17:42:40 +01:00
Vladimir Kondratyev
adc2c156ac gpioaei: Add support for ACPI _EVT method
This method is often used to process GPIO "Power on" button press on
modern x86 laptops with S0ix sleep mode.

Tested with patch from https://reviews.freebsd.org/D26407

Sponsored by:	Future Crew LLC
MFC after:	2 month
2025-03-07 18:59:12 +03:00
Ahmad Khalifa
6aab381a49 acpi_gpiobus: assume GPIO_PIN_INPUT for interrupt pins
Different drivers respond differently to having neither GPIO_PIN_INPUT
or GPIO_PIN_OUTPUT set, this stops the unpredictable results.
2025-03-07 18:59:11 +03:00
Vladimir Kondratyev
daa098cc37 iichid(4): Wait for RESET command response while attaching
before starting of children initialization to ensure that parent device
is fully functional.

Sponsored by:	Future Crew LLC
MFC after:	2 month
Differential Revision:	https://reviews.freebsd.org/D48958
2025-03-07 09:26:51 +03:00
Vladimir Kondratyev
548d3aa856 iichid(4): Read wMaxInputLength bytes over I2C even if we discards data
For some devices e.g. ITE5570 it is not enough to read HID-over-I2C
input length header of RESET command response to acknowledge interrupt.
Do a full-size read to avoid interrupt storm.

Sponsored by:	Future Crew LLC
MFC after:	2 month
Differential Revision:	https://reviews.freebsd.org/D48957
2025-03-07 09:26:51 +03:00
Vladimir Kondratyev
c7225a3ede ig4_iic: Allow sleeping if called from iichid interrupt handler.
This replaces 50 ms busy loop with mtx_sleep for the same duration thus
saving CPU time when iichid is driven with interrupts.

Sponsored by:	Future Crew, LLC
MFC after:	2 month
Differential Revision:	https://reviews.freebsd.org/D48956
2025-03-07 09:26:51 +03:00
Colin Percival
d70bac252d acpi_pci: Add quirk for PSTAT_PME-before-detach
In order to signal to Graviton [123] systems that a device is ready
to be "ejected" (after a detach request is made via the EC2 API) we
need to set PCIM_PSTAT_PME to 1 and PCIM_PSTAT_PMEENABLE to 0.  We are
not aware of any rationale for this requirement beyond "another OS
kernel happens to do this", i.e. this is effectively bug-for-bug
compatibility.

Arguably this should be done by the ACPI _EJ0 method on these systems,
but it is not.

Create a new ACPI_Q_CLEAR_PME_ON_DETACH quirk and set it in EC2 AMIs,
and add the PCI register write to acpi_pci_device_notify_handler when
that quirk is set.

Reviewed by:	jhb
MFC after:	1 month
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D49146
2025-03-05 12:25:49 -08:00
SHENGYI HONG
8ee127efb0 vm_lowmem: Fix signature mismatches in vm_lowmem callbacks
This is required for kernel CFI.

Reviewed by:	rrs, jhb, glebius
Differential Revision:	https://reviews.freebsd.org/D49111
2025-03-04 20:18:52 -05:00
Warner Losh
ca48e43ba9 usb: Kill left-over cdefs.h includes
These includes were for __FBSD_RCSID() macro. They weren't formatted
like the rest of the tree so weren't trimmed automatically when that
script was run. Trim them now.

MFC After: 1 week
Sponsored by:		Netflix
2025-03-04 14:44:22 -07:00
Kyle Evans
2bef0d54f7 kern: wg: remove overly-restrictive address family check
IPv4 packets can be routed via an IPv6 nexthop, so the handling of the
parsed address family is more strict than it needs to be.  If we have a
valid header that matches a known peer, then we have no reason to
decline the packet.

Convert it to an assertion that it matches the destination as viewed by
the stack below it, instead.  `dst` may be the gateway instead of the
destination in the case of a nexthop, so the `af` assignment must be
switched to use the destination in all cases.

Add a test case that approximates a setup like in the PR and
demonstrates the issue.

PR:		284857
Reviewed by:	markj (earlier version), zlei
Differential Revision:	https://reviews.freebsd.org/D49172
2025-03-04 13:57:34 -06:00
Slava Shwartsman
85af37e159 mlx5en: Fix domain set usage in TLS tag import functions
Use the correct device pointer to obtain the domain set for memory
allocation. Previously, the functions were incorrectly using the arg
parameter directly instead of accessing mlx5_core_dev.

Signed-off-by: Slava Shwartsman <slavash@nvidia.com>

Sponsored by:	NVidia networking
MFC after:	1 week
2025-03-04 06:58:07 +02:00
Doug Ambrisko
1c9c4a25e6 enic: fix potential panic due to not understanding what iflib had allocated
For safety I was trying to clear out the descriptor but the full descriptor
was not allocated.  Remove any code trying to do that so the same mistake
won't be made.  This was found when looking to MFC the prior change
and having the loader, load the module.

Remove cq->ntxqsets since the completion queue is part of the RX and TX sets
2025-03-03 12:49:01 -08:00
Mitchell Horne
e2a08ac9ce riscv: enable EFI framebuffer
Pass framebuffer information from loader(8) to the kernel via the
MODINFOMD_EFI_FB metadata field.

Enable the vt_efifb driver. A small tweak is required to work around the
lack of VM_MEMATTR_WRITE_COMBINING on this platform; we use
VM_MEMATTR_UNCACHEABLE instead.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48884
2025-03-03 12:12:15 -04:00
Adrian Chadd
10c633ab12 ath_rate_sample: fix setting HT rates
ieee80211_node_set_txrate_ht_mcsrate() takes an MCS rate from 0..76,
the high bit (IEEE80211_RATE_MCS) must not be set.

This is definitely my fault - I likely didn't get to testing this
diff when I changed it from ieee80211_node_set_txrate_dot11rate()
just before landing.

Differential Revision:	https://reviews.freebsd.org/D49197
Reviewed by:	bz
2025-03-01 15:32:56 -08:00
Adrian Chadd
50ec1e7af0 ath: fix 20MHz HT short-gi logic.
This was broken in an earlier commit

(ca389486a9).

PR:		kern/285096
Differential Revision:	https://reviews.freebsd.org/D49196
Fixes:	ca389486a9
Reviewed by:	bz
2025-03-01 15:32:04 -08:00
Eric Joyner
7ee310c80e igc(4): Fix attach for I226-K and LMVP devices
Summary:
The device IDs for these were in the driver's list of PCI ids to attach
to, but igc_set_mac_type() had never been setup to set the correct mac
type for these devices. Fix this by adding these IDs to the switch block
in order for them to be recognized by the driver instead of returning an
error.

This fixes the igc(4) attach for the I226-K LOM on the ASRock Z790
PG-ITX/TB4 motherboard, allowing it to be recognized and used.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	kbowling@
MFC after:	3 days
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D49147
2025-02-26 10:15:38 -08:00
Kevin Lo
5c7087c349 ixgbe: Fix a logic error in ixgbe_read_mailbox_vf()
Reviewed by:	kbowling
Differential Revision:	https://reviews.freebsd.org/D49156
2025-02-28 16:12:00 +08:00
Wei Hu
9b8701b81f mana: refill the rx mbuf in batch
Set the default refill threshod to be one quarter of the rx queue
length. User can change this value with hw.mana.rx_refill_thresh
in loader.conf. It improves the rx completion handling by saving
10% to 15% of overall time with this change.

Tested by:	whu
MFC after:	2 weeks
Sponsored by:	Microsoft
2025-02-27 08:08:13 +00:00
Adrian Chadd
fdc8841611 rtwn: move to using ieee80211_node_get_txrate()
Migrate the transmit path to use ieee80211_node_get_txrate(), and handle
VHT rates.

Nothing is currently setting VHT rates, but the driver should now
be ready.

Differential Revision:	https://reviews.freebsd.org/D48606
Reviewed by:	bz
2025-02-26 11:30:01 -08:00
Adrian Chadd
46de4d9fc2 net80211: change ieee80211_ratectl_rate() to not return a rix
There are only a few places where the returned rix is used:

* linuxkpi - logging
* bwi/bwn - used for finding a fallback rate to choose, which
  honestly should be returned by the ratectl API
* iwm - building the rateset to program into firmware

Everyone else uses the dot11rate value in ni->ni_txnode.

This is a precursor for VHT and later rate support; where currently
there aren't rate tables in ieee80211_phy.c for VHT and later
rates.

Although it's likely doable to add tables for VHT, 11ax and MU-OFDMA
(HE) rates are sufficiently larger/different to just not fit in the
current scheme without more refactoring.

Differential Revision:	https://reviews.freebsd.org/D48603
Reviewed by:	bz, thj
2025-02-26 11:29:36 -08:00
Adrian Chadd
7067450010 sys: convert ni->ni_txrate references use to the new net80211 API
This just mechanically converts things.

* For linuxkpi, it was just used for display.
* For uath, it was just used for display, as firmware
  doesn't report it up.

Differential Revision:	https://reviews.freebsd.org/D48602
Reviewed by:	bz, thj
2025-02-26 11:29:18 -08:00
Navdeep Parhar
e19d84979a cxgbe(4): Block most access to the hardware as soon as the adapter stops.
Add a new hw_all_ok() routine and use it to avoid hardware access in the
public control interfaces (ifnet ioctls, ifmedia calls, etc.).  Continue
to use hw_off_limits() in the private ioctls/sysctls and other debug
code.  Retire adapter_stopped() as it's of no use by itself.

This fixes problems where ifnet slow-path operations would enter a
synch_op just before set_adapter_hwstatus(false) and touch the hardware
when it's not safe to do so.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-25 11:33:40 -08:00
Warner Losh
dc95228d98 nvme: Fix hotplug on one of the amazon platforms
Amazon EC2 m7i cloud instances use PCI hotplug rather than ACPI
hotplug. The card is removed and detach is called to remove the drive
from the system. The hardware is no longer present at this point, but
the bridge doesn't translate the now-missing hardware reads to all ff's
leading us to conclude the hardware is there and we need to do a proper
shutdown of it. Fix this oversight by asking the bridge if the device is
still present as well. We need both tests since some systems one cane
remove the card w/o a hotplug event and we want to fail-safe in those
cases.

Convert gone to a bool while I'm here and update a comment about
shutting down the controller and why that's important.

Tested by: cperciva
Sponsored by: Netflix
2025-02-25 09:36:53 -07:00
Christos Margiolis
bc7e65e950 sound: Call chn_kill() in chn_init() failure
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48966
2025-02-25 13:44:37 +02:00
Christos Margiolis
2868776c9c sound: Update comment and channel insertion in vchan_create()
The comment and rationale behind choosing CHN_INSERT_SORT_DESCEND()
instead of CHN_INSERT_SORT_ASCEND() are no longer relevant as of FILLME
("sound: Allocate vchans on-demand").

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48962
2025-02-25 13:44:30 +02:00
Christos Margiolis
fd906e47b1 sound: Simplify locking during device creation
The mechanism of acquiring SD_F_BUSY in pcm_init() and releasing it in
pcm_register() is a leftover from the previous device creation scheme,
where pcm_init() (previously pcm_register()) would create the sysctl
nodes, as well as the device node. In this scenario, acquiring SD_F_BUSY
was necessary, in order to avoid races in case the device was accessed
before it was ready for use. Commit 66f3eb14e9 ("sound: Move sysctl
and /dev/dspX creation to pcm_setstatus()") fixed this issue, so we can
simplify things now. Only acquire SD_F_BUSY in pcm_addchan(), because
chn_init() expects to be called with SD_F_BUSY acquired.

While here, move the sndstat_register() call further down to be more
robust.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D48482
2025-02-25 13:44:24 +02:00
Christos Margiolis
352aa9ad1d snd_uaudio: Remove undefined functions
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D48424
2025-02-25 13:44:18 +02:00
Christos Margiolis
40616b7e41 sound: Return if the new speed/format is the same as the current one
This gives us a slight performance boost since we do not have to go
through chn_setparam() and the driver functions.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D48012
2025-02-25 13:44:12 +02:00
Christos Margiolis
4e1b75bebf sound: Get rid of redundant variables in chn_setspeed() and chn_setformat()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D48011
2025-02-25 13:44:05 +02:00
Christos Margiolis
6524d2a5af sound: Remove SNDBUF_LOCKASSERT()
It's a no-op. There is no lock associated with the buffer.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D48008
2025-02-25 13:43:59 +02:00
Christos Margiolis
1cbafcd137 sound: Handle multiple primary channel cases in vchan sysctls
vchan_getparentchannel() is used by various vchan sysctl functions to
fetch the first primary channel. However, this assumes that all devices
have only one primary channel per direction. If a device does not meet
this assumption, then the sysctl functions will be applying the
configurations on the first primary channel only.

Since we now have the "primary" channel sublist, we can retire
vchan_getparentchannel() and iterate through the "primary" list in each
sysctl function and apply the settings to all primary channels.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D48336
2025-02-25 13:43:52 +02:00
Christos Margiolis
b50f53cf87 sound: Cache vchanmode
We already cache vchanrate and vchanformat.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D48335
2025-02-25 13:43:46 +02:00