This patch refactors the 'sdhci_fdt.c' driver by moving all vendor
specific routines into separate files and making the base 'sdhci_fdt'
driver subclassable. The goal is to make adding new FDT-based drivers
easier and more maintainable. No functional change intended.
Reviewed by: manu, imp
Differential Revision: https://reviews.freebsd.org/D48527
This bug and https://www.mail-archive.com/freebsd-stable@freebsd.org/msg124458.html
both have this fix. It turns unknown errors into an autosense failure, which causes
us to grab the sense buffer manually. It also sets a condition that we use to retry
timed out commands that jmg reports as being helpful.
I'm torn on committing it. The code seems fine in terms of fixing
things. But this is a 10-year-old bug with few other bugs and a short CC
list for a driver that might go away in 15 anyway. I'm going to commit
and close the bug, and MFC it in a week, unless someone complains (which
seems unliekly, given the age of this hardware, I susepct most of it is
out of service).
Suggested by: jmg, Scott Long
PR: 191135
MFC After: 1 week
Reviewed by: imp
Replace mpt_prt with mpt_lprt with DEBUG level to print kernel pointers
only at the debug level.
PR: 238662
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed-by: imp
Changing the rsc_switch flag using sysctl to turn rsc on or off
could hang. The orignal code sends request to host to get the
mtu setting. Sometimes the host fails to reply, causing
the thread to sleep forever waiting for the host response.
Use existing cached mtu from hn device instead to avoid calling
host.
Reported by: whu
Tested by: whu
MFC after: 1 week
Added ht20 mode, based on if_run from FreeBSD, and if_mtw.c
from OpenBSD.
PR: 247545
Approved by: adrian, wireless
Differential Revision: https://reviews.freebsd.org/D45179
Print the quirks in a more human-readable form. When testing a dozen
different removeable devices, the hex numbers quickly blur...
Sponsored by: Netflix
Builds now with BCE_DEBUG defined. All bets are of as to whether or not
it works though. This is not the default, and likely quite a rare config
given (a) it's been broken for years and (b) this is an old card people
aren't actively debugging anymore. I don't have the hardware to test it,
though I've not changed anything in the BCE_DEBUG undefined case.
Sponsored by: Netflix
When compiling with debug enabled, this produces an always false
warning. It's clear that this was to skip ranges that aren't used when
dumping the registers, so change the && to || to skip things properly.
PR: 200984
Sponsored by: Netflix
Although this is vendor code, and apparently abandoned vendor code at
that, this is clearly a mistake and always true. It's unclear how to
contribute back to the upstream at this point, alas.
PR: 217745
Reviewed by: imp
Linux has removed timespec_to_jiffies() half a decade ago [1].
I cannot find any use of it anymore in recent drm-kmod branches
or in the tree so retire it.
While here also retire it from drm2.
Reported by: emaste (D48318) [1].
Sponsored by: The freeBSD Foundation
MFC after: 2 weeks
Reviewed by: emaste, dumbbell (tested all drm-kmod versions, thanks!)
Differential Revision: https://reviews.freebsd.org/D48379
This returns an nvlist indicating if a Fabrics host is connected and
the time of the most recent disconnection.
Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48219
Both nvme and nvmf cache a copy of the controller's identify data in
the softc. Add an ioctl to fetch this copy of the cdata. This is
primarily useful for allowing commands like 'nvmecontrol devlist' to
work against a disconnected Fabrics host.
Reviewed by: dab, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48218
This is generally harmless but can trigger spurious warnings on the
console due to duplicate attempts to disable LUNs.
Sponsored by: Chelsio Communications
[Why]
linuxkpi needs to export `pci_get_base_class()` for DRM drivers from
Linux 6.7.
[How]
This new function searches a PCI device with the given base class and
returns it, regardless of its subclass.
The behavior is the same as `pci_find_class_from()` but the subclass is
ignored.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48745
In 4cc5d081d8, a change was introduced that manipulated
drv_ioctl_data->reqcap using IFCAP2 bits. This was noticed
when creating a mixed lagg with mce0 and ixl0 caused the
interfaces' txcsum caps to be disabled.
Fixes: 4cc5d081d8
Reviewed by: glebius
Sponsored by: Netflix
MFC After: 7 days
Child devices handling I/O port resources (such as PCI-e bridges)
should map those to a memory resource and pass up a request for the
translated memory resource.
Differential Revision: https://reviews.freebsd.org/D48501
These are reportedly still in fairly wide use.
We strongly encourage folks with this hardware to post a dmesg on
dmesgd.nycbug.org.
This reverts commit 4591322980.
Discussed with: brooks
Sponsored by: The FreeBSD Foundation
Recent AMD CPUs (SMBus PCI revision ID >= 0x51) can disable port-mapped
IO and only support memory-mapped IO. In practice this was observed on a
Zen 3 CPU where PMIO reads all returned 0xff. Update the driver to use
MMIO for these processors while continuing to use PMIO by default.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1437
The way we got the kernel metadata pointer was by calling
preload_search_by_type with one of the following three: "elf kernel",
"elf32 kernel" and "elf64 kernel". Which one(s) we used wasn't
consistent though. Sometimes we would only try "elf kernel", and other
times we would try one of the latter two if the first failed. However,
the loader only ever sets "elf kernel" as the kernel type.
Now, the kmdp is a global, preload_kmdp, and it's initialized using
preload_initkmdp in machdep.c (or machdep_boot.c on arm/64).
preload_initkmdp takes a single boolean argument that tells us whether
not finding the kmdp is fatal or not.
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
Using one taskqueue group with single thread to execute all admin
tasks may lead to unexpected timeouts when long running task (e.g.
handling a reset after FW update) for one interface prevents
tasks from other interfaces being executed. Taskqueue group API
doesn't let to dynamically add threads, and pre-allocating thread
for each CPU as it's done for traffic queues would be a waste
of resources on systems with small number of interfaces. Replace
global taskqueue group for admin tasks with taskqueue allocated
for each interface to allow independent execution.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp, jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1336
ELECOM EDC-QUA3C is a USB3.1 Gen1 Type-A/C 2.5GBASE-T network adapter.
This also works as a cdce(4) device by:
usbconfig -d X.Y set_config 1
or
usbconfig -d X.Y set_config 2
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1578
We need to complete calling the ACPI method before marking the interrupt
as complete. If two threads are inspecting the ACPI tables at the same
time they may both try to lock the ACPI mutex causing one to sleep. If
this is the ithread it will panic the kernel as this is not allowed.
Update the ged ithread to allow sleeping as it is expected this lock
will be uncommon enough any sleep will be short.
PR: 283103
Reviewed by: markj (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48284
Save more data associated with a new association including the network
address of the remote controller. This permits reconnecting an
association without providing the address or other details. To use
this new mode, provide only an existing device ID to nvmecontrol's
reconnect command. An address can still be provided to request a
different address or other different settings for the new association.
The saved data includes an entire Discovery Log page entry to aim to
be compatible with other transports in the future. When a remote
controller is connected to via a Discovery Log page entry (nvmecontrol
connect-all), the raw entry is used. When a remote controller is
connected to via an explicit address, an entry is synthesized from the
parameters.
Note that this is a pseudo-ABI break for the ioctls used by nvmf(4) in
that the nvlists for handoff and reconnect now use a slightly
different set of elements. Since this is only present in main I did
not bother implementing compatability shims.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48214
Add support for the Arm Errata Management Firmware Interface (Errata
ABI) [1]. This provides an interface for the kernel to query the status
of an erratum workaround.
Some errata may be mitigated depending on the other hardware in a SoC,
e.g. Cortex-A78 erratum 2712571 is not affected in systems that use
an Arm interconnect. As there may not be a way for the kernel to know
if this is the case then it would have to implement the workaround
even when not needed.
There are other cases where the needed workaround is implemented in
firmware and if not implemented then the kernel may decide to not use
a feature. In this case we can query the firmware before deciding if
we should use a feature or now.
There is a known issue with some firmware implementations of the Errata
ABI that incorrectly returns a status indicating the erratum is fully
mitigated by the firmware, however there is a kernel component needed,
e.g. Neoverse-N1 erratum 1542419. To handle this case we tell the
caller there is some workaround implemented in the firmware and it can
decide how to handle it. If this is fixed in a way we can detect we can
add a new erratum status value to indicate this.
[1] https://developer.arm.com/documentation/den0100/latest/
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48055
This flag was used as a transition for differing pcib implementations.
Today it is defined for all supported architectures, and can be removed.
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D48485
Expose as read-only the configured transport properties.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47428
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Add a few basic traces to track SCMI messages lifecycle.
Tested on: Arm Morello Board
Reviewed by: Andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47427
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Add the core logic to handle the replies to pending command in an
asynchronous manner.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47426
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Split scmi_request internals into a TX and an RX phase, which will be
called, anyway, in sequence as before when a normal transmission is
requested.
No functional change.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47425
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
During normal operation, the SCMI stack, upon each transmission attempt,
takes care to automatically pick an appropriate, monotonically increasing,
sequence number to fill-in the token field in the egressing message.
This does not cope well with the alternative scenario in which, instead,
a complete and fully formed message is provided upfront: in such a case the
SCMI stack will have to use the already provided sequence number, embedded
in the message, to track such transaction.
Add a method to attempt to reserve a specific sequence number to be used
when a fully firmed (raw) message is handled.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Pull Request: https://reviews.freebsd.org/D47424
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Refactor allocation logic for scmi_req and introduce new helpers to be able
to obtain an scmi_msg reference to a freshly allocated request.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47423
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
SCMI transport characteristics can be optionally described in the
devicetree to override the default build-time values.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47422
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
The defined maximum payload size should not include header and status
field. Fix the definition accordingly, so that it matches the
definitions as can be found in the Linux SCMI stack.
The semantic of this define is important since it will then be possible
to override such values from devicetree, like in Linux.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47421
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Once a message is received that fits into the RX buffer, update the
msg.rx_len field with the effective length of the message received.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Pull Request: https://reviews.freebsd.org/D47420
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
When a waited-for outstanding request is determined to have timed out,
mark such request immediately as such, so as to avoid any possible race on
the IRQ path with code path evaluating that same timed out condition.
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47419
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
By the SCMI specification the message sequence number field is 10-bit long.
Fix accordingly the used bitmask.
Fixes: d220b1cf02 ("scmi: Extend and refactor SCMI shmem support")
Tested on: Arm Morello Board
Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47418
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
It /looks/ like there's some weirdness in initial frame send after
the chip programming / channel change. Linux rtl8xxxu has no sleeps
here, instead it just retries the auth frame a few times.
My guess is there's some sequencing going on here between finishing
the programming, doing a calibration run and then sending the initial
frame.
Instead of doing sleeps on every write during the RF channel change,
this 10ms sleep at the end is enough to reliably associate in my
test environment (12-core intel laptop, USB-3 port.) It's not
required for an earlier 2-core haswell laptop w/ USB-3.
See the PR for more information.
PR: kern/247528
Differential Revision: https://reviews.freebsd.org/D48517
The Linux rtl8xxxu driver has more delays in the RF read and write
path.
It looks like for writes it's ensuring the hardware is out of
power save and that the transition has properly occured.
And it looks for reads that it wants a delay after some bit setting,
likely some shifting into the RF register space is occuring with
a bit set/clear to trigger a load.
See rtl8xxxu_write_rfreg() and rtl8xxxu_read_rfreg() for more
information.
Differential Revision: https://reviews.freebsd.org/D48512
Obtained from: Linux rtl8xxxu