Commit graph

42459 commits

Author SHA1 Message Date
John Baldwin
291079d0eb pci_host_generic: Simplify generic_pcie_translate_resource
Inline generic_pcie_translate_resource_common into its sole caller.
No functional change.

Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D44206
2024-03-04 20:53:21 -08:00
John Baldwin
332dbd3a2f pci_host_generic: Pass a valid end address in generic_pcie_translate_resource
The generic_pcie_containing_range helper added in commit d79b6b8ec2
assumed that the passed in (start, end) range used to locate the
containing mapping range was a valid address range (with end >=
start).  The previous version of
generic_pcie_translate_resource_common only used the start address to
locate a mapping range, so the end address of 0 did not matter, but an
end of 0 now causes the first range to match and an incorrect
translation for resources using a later range.

PR:		277211
Reported by:	dch, tuexen
Reviewed by:	tuexen
Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision:	https://reviews.freebsd.org/D44205
2024-03-04 20:52:54 -08:00
Warner Losh
c5246cb7b0 nvme: Report only the unknown bits
When we get a smart error that's unknown, report only the unknown
(reserved) bits of the Critical Warning Bitfield.

Sponsored by:		Netflix
2024-03-01 16:04:27 -07:00
John Baldwin
b28670018d pci_host_generic: Enumerate resource ranges under bootverbose
Previously ranges were only enumerated for the FDT attachment but not
ACPI.  This commit moves the enumeration to the shared attach routine
so it is done for both.  While here, don't list empty ranges but do
include the resource type for each range.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D44132
2024-03-01 14:20:10 -08:00
John Baldwin
7485926e09 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
In particular, don't try to byteswap the values as 64-bit integers and
always print a non-empty version as a string.

Reviewed by:	chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44121
2024-03-01 14:18:43 -08:00
Mitchell Horne
fae39d8da9 dwc: fix DEBUG macro name
It conflicts with the general "DEBUG" macro defined as an option in LINT
builds. Since this is actually unused, just rename it to GMAC_DEBUG.

Reviewed by:	manu
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44102
2024-02-27 18:10:14 -04:00
John Baldwin
3a48dfe115 bhnd_chipc: Make use of bus_generic_rman_* to simplify some code
This uses bus_generic_rman_alloc/release_resource to reduce some code
duplication.  However, I've left the custom activate/deactivate
methods as-is.

Differential Revision:	https://reviews.freebsd.org/D43939
2024-02-27 11:44:22 -08:00
John Baldwin
b25f03a1a2 bhnd_usb: Use bus_generic_rman_*
For SYS_RES_MEMORY, use bus_generic_rman_* for
activate/deactivate_resource methods as well as custom
map/unmap_resource methods that request submappings of the sc_mem
resource allocated from the parent bus.

Differential Revision:	https://reviews.freebsd.org/D43938
2024-02-27 11:44:03 -08:00
John Baldwin
9b619f0e90 dpaa2: Use bus_generic_rman_*
Reviewed by:	dsl
Differential Revision:	https://reviews.freebsd.org/D43937
2024-02-27 11:43:50 -08:00
Gordon Bergling
e2f3649613 bxe(4): Fix two typos in a kernel messages
- s/successfull/successful/

MFC after:	3 days
2024-02-27 17:38:53 +01:00
Gordon Bergling
04d5a8ae04 vge(4): Fix a typo in a source code comment
- s/opration/operation/

MFC after:	3 days
2024-02-27 13:42:10 +01:00
Florian Walpen
a9341f0f0a snd_uaudio(4): Fix sample rate selection after 42fdcd9fd9.
The sample rate selection of snd_uaudio(4) at runtime was implicitly
relying on a specific order in the device config list. In case a default
was set through the hw.usb.uaudio.default_rate sysctl tunable, commit
42fdcd9fd9 removed a duplicate sample rate entry from that list, which
inadvertently broke sample rate selection at runtime. Implement sample
rate selection in a way that works for any order in the device config
list.

Reported by:	Lexi Winter <lexi@le-fay.org>
MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D44051
2024-02-27 00:27:47 +01:00
Florian Walpen
dc15f02506 snd_hdspe(4): Optional unified pcm device.
Add a sysctl tunable to unify all physical ports of an HDSPe sound card
into one pcm device, with up to 14 (AIO) or 36 (RayDAT) channels. This
makes all ports available in multi-channel audio software.

Differential Revision:	https://reviews.freebsd.org/D43798
2024-02-25 21:39:36 +00:00
Gordon Bergling
61b88a230b if_hn: Fix two typos in source code comments
- s/managment/management/
- s/transacion/transaction/

Obtained from:	NetBSD
MFC after:	3 days
2024-02-24 10:13:44 +01:00
Gleb Smirnoff
89189224ad snd_hda: add 32-bit memory quirk for Creative Sound Blaster Audigy FX
Despite still being in production the device appeared not able to use
memory above BUS_SPACE_MAXADDR_32BIT, and if your desktop has a lot of
memory there is a high chance driver would allocate inaccessible memory.

Submitted by:	wulf
Reviewed by:	mav
2024-02-23 11:30:13 -08:00
John Baldwin
04eca69323 gpiobus: Add missing DEVMETHOD for bus_get_rman
Reported by:	andrew
Fixes:		5bda26333a gpiobus: Use bus_generic_rman_*
2024-02-22 16:14:58 -08:00
Bjoern A. Zeeb
46a968ecfb dev/uart: name uart_class_set DATA_SET macro UART_CLASS()
Use the macro "UART_CLASS()" for the newly created data set
'uart_class_set' as we do for other data sets.
This further hides the data set name.
Also add UART_CLASS for quicc, which was previously not done.

MFC after:	1 week
Improves:	949670f8f4 dev/uart: Use a linker set to find uart classes
Obtained from:	jhb, 269e99ac86
Reviewed by:	andrew
Differential Revision: https://reviews.freebsd.org/D43981
2024-02-22 22:43:22 +00:00
Bjoern A. Zeeb
89c1e54a71 ath(4): always enable 11n
Enabling 11n for ath(4) so far was handled by a kernel option, which
was only enabled for certain kernel configurations.
In order to allow loading ath(4) as a module with 11n support on
all platforms, remove the kernel option and unconditionally enable
11n in ath(4).

Reported by:	pkubaj
Discussed with:	adrian in D43549.
Reviewed by:	adrian, imp
Differential Revision: https://reviews.freebsd.org/D43964
2024-02-22 22:34:17 +00:00
Gordon Bergling
d646dca3bc bge(4): Fix some typos in source code comments
- s/firwmare/firmware/
- s/recue/reduce/
- s/throughpout/throughput/
- s/hardwares/hardware/

Obtainted from:	NetBSD
MFC after:	3 days
2024-02-22 20:40:10 +01:00
John Baldwin
f2fcb68074 acpi: Defer reserving resources for ACPI devices
The goal of reserving firmware-assigned resources is to ensure that
"wildcard" resource allocation requests will not claim an address
range that is actually in use even if no attached driver is actively
using that range.  However, the current approach can break in some
cases.

In particular, ACPI can enumerate devices behind PCI bridges that
don't show up in a normal PCI scan, but those device_t objects can end
up as direct children of acpi0.  Reserving resources for those devices
directly from acpi0 ends up conflicting with later attempts to reserve
the PCI bridge windows.

As a workaround, defer reserving unclaimed resources until after the
initial probe and attach scan.  Eventually this pass of reserving
unclaimed resources can be moved earlier, but it requires changes to
other drivers in the tree to permit enumerating devices and reserving
firmware-assigned resources in a depth-first traversal before
attaching devices whose drivers request wildcard allocations.

PR:		272507
Reported by:	Justin Tocci <justin@tocci.org>
Reported by:	john@feith.com, many others
Tested by:	Oleg Sidorkin <osidorkin@gmail.com>, dch
2024-02-22 10:43:43 -08:00
Gordon Bergling
04440331b5 vge(4): Fix a typo in a source code comment
- s/embadded/embedded/

MFC after:	3 days
2024-02-22 17:34:13 +01:00
Gordon Bergling
a53204c227 sk(4): Fix a typo in a source code comment
- /integeated/integrated/
- s/extented/extended/

Obtained from:	NetBSD
MFC after:	3 days
2024-02-22 17:16:49 +01:00
Gordon Bergling
5a476e64b5 uath(4): Fix a typo in a source code comment
- s/parmeter/parameter/

MFC after:	3 days
2024-02-22 16:55:51 +01:00
Gordon Bergling
5e89e34f84 random(4): Fix a typo in a source code comment
- s/parmeter/parameter/

MFC after:	3 days
2024-02-22 16:54:50 +01:00
Gordon Bergling
059fd69e74 umcs(4): Fix two typos in source code comments
- s/frequences/frequencies/

MFC after:	3 days
2024-02-22 14:14:08 +01:00
Roger Pau Monné
399386f190 x86/xen: introduce non-hypercall based emergency print
The current xc_printf() function uses an hypercall in order to send character
buffers to the hypervisor for it to print on the hypervisor console (if the
hypervisor is configured to print such messages).

This requires the hypercall page to be initialized, which is extra work and can
go wrong.

On x86 instead of using the console IO hypercall use the debug console IO port,
also called "port E9 hack".  This allows sending characters to Xen using an
outb instruction, without any initialization required.

Keep the previous hypervisor based implementation by using the weak attribute,
which allows each architecture to provide an alternate (arch-specific)
implementation.

Sponsored by: Cloud Software Group
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D43929
2024-02-22 11:08:03 +01:00
Roger Pau Monné
4ece79968e x86/xen: fix out of bounds access to the event channel masks on resume
When resuming from migration or suspension all regular event channels ports are
reset to the INVALID_EVTCHN value, and drivers should re-initialize them
according to the new value provided by the other end of the connection.

However, the driver would first attempt to unbind the event channel handler
before attempting to bind it using the newly provided port.  This unbind uses
the stale event channel port that has been set to INVALID_EVTCHN for some
operations (notably as a result of the handler removal the interrupt subsystem
ends up calling disable intr and source PIC hooks).

This was fine when INVALID_EVTCHN was 0, as then the operation would just
result in pointless setting of the 0 bit in the different event channel related
control arrays (evtchn_{pending,mask} for example).  However with the change to
define INVALID_EVTCHN as ~0 the write is no longer pointless, and we end up
triggering a page-fault, or corrupting random data that happens to be mapped at
the array position + ~0 bits.

In hindsight the change of INVALID_EVTCHN from 0 to ~0 was way more risky than
initially assessed, and I believe has end up resulting in more fragile code for
no real benefit.

Fix the disable intr and source wrappers to check whether the event channel is
valid before attempting to use it.

Also introduce some extra KASSERTs in several array accesses in order to avoid
out of bounds accesses if INVALID_EVTCHN ever reaches those functions.

Fixes: 1797ff9627 ('xen/intr: cleanup event channel number use')
MFC after: 1 week
Sponsored by: Cloud Software Group
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D43928
2024-02-22 11:08:03 +01:00
Vladimir Kondratyev
9097284b98 bcm5974(4): Properly assign MT-slot on Apple Magic Trackpad
Assign multi-touch slot number based on internal evdev MT state and
reported tracking ID of contact rather than on sequentional number of
contact in report.

Sponsored by:	Serenity Cyber Security
Fixes:		ef8397c28e ("add Magic Trackpad 2 (USB only) support")
MFC after:	1 month
2024-02-21 23:31:39 +03:00
Vladimir Kondratyev
4f34598970 bcm5974(4): Respect HID_DEBUG option and fix debugging printf
Sponsored by:	Serenity Cyber Security
MFC after:	1 month
2024-02-21 23:31:39 +03:00
Vladimir Kondratyev
c85e6a5c22 bcm5974(4): Report proper width and depth for Apple Magic Trackpads
The size of modern Apple Magic Trackpad is about 160x110mm

Sponsored by:	Serenity Cyber Security
MFC after:	1 month
2024-02-21 23:31:38 +03:00
Bjoern A. Zeeb
c81df1c112 iicbus/mux/pca954x: add support for PCA9546 I2C Switch
Add support for the 4 channel I2C switch from NXP by adding a new
description struct and the list entries.  Compared to x=[2345] which
require code to support the INT, for this one no further changes are
needed.

Tested on:	WHLE-LS1088A using a SPF+
MFC after:	1 week
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D44009
2024-02-21 16:46:15 +00:00
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