Commit graph

42428 commits

Author SHA1 Message Date
Andriy Gapon
8f374fa528 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43960
2024-02-19 12:44:00 +02:00
Dmitry Lukhtionov
5968e477a5 snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230
PR:		259640
MFC after:	2 weeks
Reviewed by:	delphij, markj
Differential Revision:	https://reviews.freebsd.org/D43804
2024-02-18 19:07:39 +02:00
Andriy Gapon
a044cf60bd rk8xx_poweroff: add parentheses missed in 8b408fc6f2
Fixes:		8b408fc6f2
MFC after:	2 weeks
2024-02-18 18:29:00 +02:00
Andriy Gapon
5f7312a0d7 syscon_power: do reboot after shutdown_panic is executed
A syscon_power instance can handle either poweroff or reboot, but not
both.  If the instance handles reboot then set its priority to be after
shutdown_panic.

This is to provide uniform experience with other platforms.

MFC after:	3 weeks
2024-02-18 16:38:27 +02:00
Andriy Gapon
0f354b2b58 psci: split off psci_reboot from psci_shutdown
Priority of psci_reboot set so that it is run after shutdown_panic is
executed.  This is to provide uniform experience with other platforms.

MFC after:	3 weeks
2024-02-18 16:38:27 +02:00
Andriy Gapon
8b408fc6f2 rk8xx_poweroff: enable power-cycling on support hardware
Previously, the function would return early if RB_POWERCYCLE was
specified without RB_POWEROFF.  Those flags are exclusive at the moment,
that is, they are never set together.

Søren Schmidt (sos) uses a similar but extended patch locally.

MFC after:	2 weeks
2024-02-18 16:04:29 +02:00
Bartosz Sobczak
5b5f7d0e77
irdma(4): Upgrade to 1.2.36-k
Update Intel irdma driver to version 1.2.36-k.

Notable changes:

- Start using ib_sge directly instead of irdma_sge
- Turn off flush completion generator for libirdma
- Minor formatting changes

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	erj@
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D43567
2024-02-16 14:01:34 -08:00
John Baldwin
66d37dbedf pci_host_generic: Fix build without PCI_RES_BUS
Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
2024-02-16 12:09:46 -08:00
John Baldwin
feefc3c71e pci_host_generic: Properly handle bus_release_resource of IRQ resources
Unlike other bus methods updated to use bus_generic_rman_* in commit
d79b6b8ec2, the bus_release_resource method was using
bus_generic_rman_release_resource for all types other than
PCI_RES_BUS.  Instead, bus_generic_rman_* should only be used for
memory and I/O port resources for this driver.

Tested by:	cperciva
Reviewed by:	cperciva
Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision:	https://reviews.freebsd.org/D43925
2024-02-15 17:56:01 -08:00
John Baldwin
992f5b16af pci_host_generic: Set a valid error if allocating a range resource fails
Previously pci_host_generic_attach was returning 0 (success)
incorrectly if allocating a range failed.  The error value was 0 from
the previously successful call to bus_set_resource in this case.

Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
2024-02-15 16:05:09 -08:00
John Baldwin
e89d0785ff simplebus: Implement bus_delete_resource 2024-02-15 16:05:00 -08:00
John Baldwin
4505c89242 simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource
Specifically, the set/get_resource methods do not currently remap
resource types, so remap the type in alloc_resource only after
looking for a matching resource list entry.

Fixes:		3cf553288b simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY
2024-02-15 16:04:50 -08:00
John Baldwin
57d312b8ea pci_pci: Remove obsolete comment
This comment referred to the layering violation fixed in commit
b377ff8110.
2024-02-15 12:27:45 -08:00
John Baldwin
d714e73f78 vmd: Use bus_generic_rman_* for PCI bus and memory resources
While here, add custom bus_map/unmap_resource methods to request
mappings via the window memory resources allocated from the parent
bus.

Tested by:		emaste
Differential Revision:	https://reviews.freebsd.org/D43886
2024-02-15 12:26:40 -08:00
John Baldwin
76c6786886 vmd: Use bus_read/write_* instead of bus_space_read/write_*
Using an explicit bus space tag and handle is deprecated.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D43885
2024-02-15 12:26:19 -08:00
Stephen J. Kiernan
53670ee165 psci: Add FDT node status check
Consider the PSCI missing if the FDT node status says it is not okay.

Reviewed by:	andrew
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43920
2024-02-15 14:24:15 -05:00
John Baldwin
d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Allocate resources from the parent device for decoded physical address
ranges.  When child resources suballocated from rman's are mapped,
translate those mapping requests into a mapping request of the
associated physical address range in a bus_map_resource method.

While here, convert generic_pcie_rman to a bus_get_rman method and use
bus_generic_rman_* for operations on child resources.

Factor out a generic_pcie_containing_range to share logic between
bus_translate_resource and bus_*map_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43894
2024-02-14 14:07:33 -08:00
John Baldwin
055c1fe230 acpi: Allow child drivers to use bus_set_resource for more resources
acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43892
2024-02-14 14:07:32 -08:00
John Baldwin
e05436d577 acpi: Don't assume a resource is reserved in acpi_delete_resource
This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43891
2024-02-14 14:07:32 -08:00
John Baldwin
51f8ac224f pci_host_generic: Include the bridge's device name in rman descriptions
The rman description strings now match those used in the PCI-PCI
bridge driver.  Using more specific names removes ambiguity in devinfo -u
output on systems with multiple host to PCI bridges.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43890
2024-02-14 14:07:32 -08:00
John Baldwin
eac46b9dd7 pci_host_generic: Remove unused res1 field from softc
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43889
2024-02-14 14:07:32 -08:00
John Baldwin
93923685d3 pci_host_generic_fdt: Remove duplicate DEVMETHOD entries
These are already inherited from generic_pcie_core_driver.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43888
2024-02-14 14:07:32 -08:00
John Baldwin
5bda26333a gpiobus: Use bus_generic_rman_*
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43887
2024-02-14 14:07:32 -08:00
Bjoern A. Zeeb
713db49d06 net80211: deal with lost state transitions
Since 5efea30f03 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389
2024-02-14 19:47:21 +00:00
Andrew Turner
a9fc9d6d15 dev/uart: Support 8-byte register access
While we only support 4-byte registers in the uart code the physical
access may be to an 8-byte register. Support this as an option on
non-i386. On i386 we lack the needed 8-byte bus_space functions.

ACPI has an option for 8-byte register io width, and FDT can be given
any size. Support these sizes, even if we don't expect to see hardware
with an 8-byte io width.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43374
2024-02-13 11:48:53 +00:00
Andrew Turner
53391af151 dev/uart: Support the pl011 uart in hw.uart.console
Add the pl011 uart to the list of supported uarts for use by
hw.uart.console. This is commonly found in Arm based devices, and a
variant is standardised in the Arm SBSA.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43363
2024-02-13 11:48:52 +00:00
Andrew Turner
eae36de826 dev/uart: Support setting the register io width
Some uarts require a specific register width. Support setting this in
the kernel environment.

Reviewed by:	imp (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43362
2024-02-13 11:48:52 +00:00
Andrew Turner
949670f8f4 dev/uart: Use a linker set to find uart classes
When the uart is configured via the environment we need to find the
uart class with a specified name. Currently to do this with an
incomplete list of uarts. As we may not have included all uarts in the
kernel each class is defined as weak.

Switch to a linker set so the list is always up to date based on what
is included in the kernel, and the class can be static.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43361
2024-02-13 11:48:52 +00:00
Andrew Turner
202890922e sys: Simplify enabling EARLY_PRINTF uarts
Support selecting the early uart with "options EARLY_PRINTF=foo" in
the kernel configuration file. This allows us to not have to change
source files when enabling EARLY_PRINTF, simplifying enabling it.

New uart drivers can be enabled by defining a new early_printf_foo
value to be unique, then using "#if CHECK_EARLY_PRINTF(foo)" to decide
when to enable the uart.

While here add pl011 early printf support.

Reviewed by:	imp (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43360
2024-02-13 11:48:52 +00:00
Wei Hu
47e99e5bc5 mana: fix leaking pci resource problem detaching mana deivces
Fixing the error messages when detaching the mana gdma devices
showed in dmesg: "Device leaked memory resources".

Reported by:	NetApp
MFC after:	3 days
Sponsored by:	Microsoft
2024-02-13 09:38:31 +00:00
Christos Margiolis
f60e99f45e snd_uaudio: mark selected configurations
snd_uaudio(4) selects the first maching rate/channel/bit/format/buffer
configuration for use during attach, even though it will print the rest
of the supported configurations detected. To make this clear, mark the
selected playback and recording configurations with a "selected" string.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D43766
2024-02-12 13:07:50 +02:00
Christos Margiolis
883b8ed582 sound: remove snddev_info->inprog and pcm_inprog()
No longer used.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43737
2024-02-12 13:07:50 +02:00
Florian Walpen
42fdcd9fd9 snd_uaudio(4): Fix config detection with defaults set.
Let the USB audio descriptor iteration detect configurations with more
channels and larger sample size, even when the following global sysctl
tunables are set to a lower value:

hw.usb.uaudio.default_channels hw.usb.uaudio.default_bits

This improves utility and is closer to the meaning of default.

Also, do not create duplicate sample rate entries.

MFC after:	2 weeks
Reviewed by:    christos
Differential Revision:	https://reviews.freebsd.org/D43679
2024-02-12 13:07:21 +02:00
Florian Walpen
b2e97edffd snd_uaudio(4): Adapt buffer length to buffer_ms tunable.
Adapt the length of the driver side audio buffer to the USB transfer
interval, which is adjustable through the buffer_ms tunable. This
eliminates unnecessary latency in USB audio playback.

To reduce power consumption caused by frequent CPU wakeups, increase the
default buffer_ms value to 4ms. In combination with adaptive buffer
length, this still results in less roundtrip latency compared to the
previous 2ms default.

Extend the buffer_ms value range to 1ms for low latency applications.

MFC after:	2 weeks
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D41942
2024-02-12 13:06:19 +02:00
Kristof Provost
8ecb749425 ichsmb: add Cedar Fork PCI id
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-02-10 02:14:27 +01:00
John Baldwin
b377ff8110 pcib: Refine handling of resources allocated from bridge windows
Fix a long-standing layering violation in the original NEW_PCIB code
by not passing suballocated resources up to the parent bus for
activation and mapping.  Instead, handle activation and mapping of
sub-allocated resources in this driver.  When mapping resources,
request a mapping from a suitable sub-region of the resource allocated
from the parent bus for the associated bridge window.

Note that this does require passing RF_ACTIVE (with RF_UNMAPPED) when
allocating bridge window resources from the parent.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43690
2024-02-09 10:27:45 -08:00
John Baldwin
36efc64a6b pcib: Allocate PCI_RES_BUS resources with RF_ACTIVE
The allocated bus numbers are in use so should be activated when
allocated.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43689
2024-02-09 10:27:45 -08:00
John Baldwin
03719c6514 pcib: Make various bus methods private to pci_pci.c
These functions are not used by pcib subclasses so do not need to
be exposed in pcib_private.h.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43688
2024-02-09 10:27:45 -08:00
John Baldwin
0e1246e334 acpi: Cleanup handling of suballocated resources
For resources suballocated from the system resource rmans, handle
those in the ACPI bus driver without passing them up to the parent.
This means using bus_generic_rman_* for several bus methods for
operations on suballocated resources.  For bus_map/unmap_resource,
find the system resource allocated from the parent bus (nexus) that
contains the range being mapped and request a mapping of that parent
resource.

This avoids a layering violation where nexus drivers were previously
asked to manage the activation and mapping of resources created
belonging to the ACPI resource managers.

Note that this does require passing RF_ACTIVE (with RF_UNMAPPED) when
allocating system resources from the parent.

While here, don't assume that the parent bus (nexus) provides a
resource list that sysres resources are placed on.  Instead, create a
dedicated resource_list in the ACPI bus driver's softc to hold sysres
resources.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43687
2024-02-09 10:27:45 -08:00
John Baldwin
1fb5445206 acpi: Use bus_generic_alloc_resource instead of duplicating it
No functional change, but it is cleaner to use the existing generic
wrappers rather than KOBJ methods directly.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43686
2024-02-09 10:27:45 -08:00
John Baldwin
0e72b8d365 acpi: Use kobj typedefs for new-bus method prototypes
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43685
2024-02-09 10:27:44 -08:00
Austin Zhang
70450ecd37 ntb: Add Intel Xeon Gen4 support
The NTB hardware of XEON Ice lake and Sapphire Rapids has register mapping changes
Add a new NTB_XEON_GEN4 device type and use it to conditionalize driver logic differs

Reviewed by:		vangyzen, dab
Sponsored by:		Dell Technologies
Differential Revision:	https://reviews.freebsd.org/D43291
2024-02-07 15:14:58 -06:00
Michael Tuexen
1d3d30c8d2 vnic: fix compilation of an IPv6 only kernel
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2024-02-06 22:47:16 +01:00
John Baldwin
c83d83206a speaker: Use standard C bool
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43717
2024-02-05 15:45:32 -08:00
Marius Strobl
069c6ac2c6 sdhci_fsl_fdt(4): Actually use modified SDHCI capabilities
SDHCI_QUIRK_MISSING_CAPS needs to be set unconditionally so sdhci(4)
adheres to the slot caps and caps2 set by sdhci_fsl_fdt(4). However,
so far this bug didn't have an impact as the front-end only filters
SDHCI_CAN_DO_SUSPEND, which in turn isn't used, yet.
2024-02-05 23:43:48 +01:00
Warner Losh
0ea4b40848 vtnet: Avoid ifdefs based on __NO_STRICT_ALIGNMENT
Some platforms require an adjustment of the ethernet hearders. Rather
than make this be on __NO_STRICT_ALIGNMENT being defined, define
VTNET_ETHER_ALIGN to be either 0 or ETHER_ALIGN (aka 2). Add a test to
the if statements to only do them when != 0. This eliminates the #ifdef
sprinkled in the code, still communicates the intent and gives the same
compiled results.

Sponsored by:		Netflix
Reviewed by:		bz, bryanv
Differential Revision:	https://reviews.freebsd.org/D43654
2024-02-04 22:43:49 -07:00
Warner Losh
d9e0e42627 vtnet: Account for the padding when selecting allocation size
While we account for the padding in the length of the mbuf we use, we do
not account for it when we 'guess' the size of the mbuf to allocate
based in the MTU of the device. This leads to a situation where we might
fail if the mtu is close to a bucket size (say 2018) such that the added
padding would push us over the edge for a full-sized packet. mtu of 2018
is super rare (2016 and 2020 would both work), but fix it none-the-less.
It's a shame we can't just set VTNET_RX_HEADER_PAD to 2 in this case. The 4
seems hard-coded somewhere I've not found documented (I think it's in the
protocol given the comments about VIRTIO_F_ANY_LAYOUT).

Sponsored by:		Netflix
Reviewed by:		bz
Differential Revision:	https://reviews.freebsd.org/D43656
2024-02-04 22:43:39 -07:00
rilysh
f830db48c1 sys/dev/enic/if_enic.c: remove an extra semicolon
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/959
2024-02-02 18:35:01 -07:00
rilysh
abd9758fe2 sys/dev/mii/mcommphy.c: remove an extra semicolon
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/959
2024-02-02 18:35:00 -07:00
rilysh
f61554272c sys/dev/iicbus/pmic/rockchip/rk8xx.c: remove an extra semicolon
Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/959
2024-02-02 18:35:00 -07:00