It is a programming error to call this function with an invalid pin.
Also return proper error value on failure.
Suggested by: mmel
Reviewed by: imp, mmel
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50940
Only attach gpiobus when the controller is fully initialized. Children
of gpiobus expect this to be the case.
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51088
Some drivers need to postpone the attachment of gpiobus until hardware
init is done. Add a new gpiobus_add_bus function to accommodate this
case.
Suggested by: mmel, andrew
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51133
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.
As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far. That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that. We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049
Such annotations are obsolete, the compiler tells us when parameters are
unused. No functional change intended.
Reviewed by: cem
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51114
Entropy queue entries always include the low 32 bits of a CPU cycle
count reading. Introduce a macro for this instead of hard-coding
get_cyclecount() calls everywhere; this is handy for testing purposes
since this way, random(4)'s use of the cycle counter (e.g., the number
of bits we use) can be changed in one place.
No functional change intended.
Reviewed by: cem, delphij
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51113
They can't be used externally, so it makes no sense to have them in a
header. No functional change intended.
Reviewed by: cem
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51111
The HWT framework provides infrastructure for hardware-assisted tracing. It
collects detailed information about software execution and records it as
"events" in highly compressed format into DRAM. The events cover information
about control flow changes of a program, whether branches taken or not,
exceptions taken, timing information, cycles elapsed and more. This allows
to reconstruct entire program flow of a given application.
This comes with separate machine-dependent tracing backends for trace
collection, trace decoder libraries and an instrumentation tool.
Reviewed by: kib (sys/kern bits)
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D40466
This way it is clear which type uses which members.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51127
When encountering a failed NIC, the mlx5 driver will wait up to 120
secs for the firmware to respond. This timeout is absurdly huge, and
leads to boot times of 40 minutes to over an hour on our servers when a
NIC fails. This is because the driver will attempt to attach to the
failed NIC multiple times (once for each driver loaded after mlx5),
and wait 2 minutes on each attempt. This happens because the mlx5
driver is still the best match for the device. This delay then
triggers watchdog timeouts in our environment, rendering servers
with a failed NIC entirely unbootable without manual intervention.
Note that FW_INIT_WARN_MESSAGE_INTERVAL must also be decreased, as
it must be less than the init timeout.
Reviewed by: kib (initial version, before reducing warn interval)
Sponsored by: Netflix
This was recently added to Linux to improve incremental update support,
as you could previously add Allowed-IPs but not remove without replacing
the whole set (and thus, potentially disrupting existing traffic).
Removal is incredibly straightforward; we'll find it in p_aips first
to ensure that it's actually valid for this peer, then we'll delete it
from the radix tree before we remove the corresponding p_aips entry.
Reviewed by: Jason A. Donenfeld, jhb
Differential Revision: https://reviews.freebsd.org/D50448
We'll re-use these in a future wg_aip_del() to perfectly reconstruct
what we expect to find in a_addr/a_mask.
Reviewed by: ivy, markj (both earlier version), Aaron LI, jhb
Differential Revision: https://reviews.freebsd.org/D50447
The only difference in the wg_aip_add() call after IP validation is the
address family. Just pull that out into a variable and avoid the two
different callsites for wg_aip_add(). A future change will add a new
call for each case to remove an address from the peer, so it's nice to
avoid needing to repeat the logic for two different branches.
Reviewed by: Aaron LI, Jason A. Donenfeld, ivy, jhb, markj
Differential Revision: https://reviews.freebsd.org/D50446
With the old size, the string could easily be truncated, resulting in
non-unique identifiers.
PR: 287679
Reported by: Phil Krylov <phil@krylov.eu>
Reviewed by: kib
MFC after: 2 weeks
The TRNG service will return random data in x3. Use the correct field
when filling the buffer in trng_read.
This driver has not been in any release, so no security advisory is
needed.
Reviewed by: bz
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50979
In the SMCCC TRNG and Errata ABI drivers check if the version
functions are implemented before calling them. Without this the firmware
may complain about an unimplemented function being called.
Reported by: bz
Reviewed by: bz
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50978
Switch to the SMCCC not supported macro in smccc_arch_features. This
shouldn't be a functional change as the value is identical to the PSCI
value it replaces.
Reviewed by: bz, emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50977
The CH343 devices support any baud rate up to 6 Mbps.
PR: 272803
Reviewed by: imp
Tested by: joerg, Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
Differential Revision: https://reviews.freebsd.org/D46290
Provide flexibility to use format strings for gone_in(). As a side
effect, this removes hardcoded string "Obsolete code will be removed
soon:" from the message, so now it is obligation of the deprecated code to
provide a meaningful message. This required a small adoption of the
existing users: midi, drm2 and le(4). Note that gone_in() is not a public
KPI as it has no sense to use it outside of the FreeBSD tree.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50783
Pass 0 as the number of indirect descriptors when they are not
supported.
This fixes an issue on the Arm FVP model where we don't negotiate
them, however pass a number of segments greater than
VIRTIO_MAX_INDIRECT. This leads to virtqueue_alloc failing and
virtio_blk failing to attach.
Reviewed by: Harry Moulton <harry.moulton@arm.com>
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50909
Account for endianness when writing to 24bpp framebuffers. Also create a
vt_fb_mem_wr3 function to avoid code duplication.
Reviewed by: manu, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50843
Make sure there is enough room to write more than one byte.
Reviewed by: manu, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50842
We are currently not reporting any per-chain S:N values so remove
IEEE80211_R_C_RSSI and IEEE80211_R_RSSI along with it as it is set
already in the line above.
Sponsored by: The FreeBSD Foundation
Reviewed by: thj
Differential Revision: https://reviews.freebsd.org/D50927
There is no point in assigning the channel index to the number of
chains for the RX status reporting. The value was not tagged as
being used. Rather than simply removing it try to fix it and
set the flag if we get a value.
Sposnored by: The FreeBSD Foundation
Reviewed by: thj
Differential Revision: https://reviews.freebsd.org/D50926
Replace priorities specified by a base priority and some hardcoded
offset value by symbolic constants. Hardcoded offsets prevent changing
the difference between priorities without changing their relative
ordering, and is generally a dangerous practice since the resulting
priority may inadvertently belong to a different selection policy's
range.
Since RQ_PPQ is 4, differences of less than 4 are insignificant, so just
remove them. These small differences have not been changed for years,
so it is likely they have no real meaning (besides having no practical
effect). One can still consult the changes history to recover them if
ever needed.
No functional change (intended).
MFC after: 1 month
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45390
<sys/proc.h> doesn't need <sys/runq.h>. Remove this include and add it
back for kernel files that relied on the pollution.
Reviewed by: kib
MFC after: 1 month
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45387
Function pci_mask_msix uses cached value of MSI-X CTRL
register to verify if vector index is valid. Update
that value in pci_alloc_msix_method before it is
used to avoid kernel panic.
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: jhb
Approved by: kbowling (mentor)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D49484
This commit adds a storage driver that supports the Universal Flash
Storage Host Controller Interface (UFSHCI) on FreeBSD.
Universal Flash Storage (UFS) is a flash-based mobile storage device
that replaces eMMC, aiming for high performance with low power. The UFS
Host Controller Interface (UFSHCI) is the host side controller and
connects UFS device to a system bus, such as PCIe.
The code targets the latest standards:
- UFS 4.1: https://www.jedec.org/standards-documents/docs/jesd220g
- UFSHCI 4.1: https://www.jedec.org/standards-documents/docs/jesd223f
The ufshci(4) driver implements controller/device initialization,
interrupt, single-doorbell(SDB) queue based IO requests. Support for
multi-queue (MCQ) IO requests is planned for a later commit.
Implemented features:
- PCIe bus support
- legacy(INTx) Interrupt Handling
- UIC command support
- UTP Transfer Request (UTR) support
- UTP Task Management Request (UTMR) support
- single doorbell queue (SDB) with multiple queue depth
- SCSI command set support
- sysctl
Work in progress:
- multi-Circular Queue (per-CPU IO queues)
- MSI-X interrupt Support
- write booster
- write Protect
- Host Performance Booster (HPB)
- interrupt aggregation
- ARM based system bus support
- ufs-utils port
Tests were performed on QEMU and an Intel-based laptop.
Since QEMU has an emulated UFS device, I tested on QEMU.
How to test on QEMU:
1. Run QEMU
$ qemu-system-x86_64 ... -device ufs -drive file=blk1g.bin,format=raw,if=none,id=luimg -device ufs-lu,drive=luimg,lun=0
2. Loading/unloading the ufshci module on QEMU
$ kldload /usr/obj/usr/src/amd64.amd64/sys/modules/ufshci/ufshci.ko
$ kldunload ufshci
Testing on real hardware:
- Samsung Galaxy Book S (Intel Lakefield) with UFS 3.0
- Lenovo duet 3 11ian8 (Intel N100) with UFS 2.1
Sponsored by: Samsung Electronics
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50370
This was broken in c63d67e137, the early returns prevent building the
media lists as expected.
The BASE-T parts of the patch were suggested by "cyric@mm.st", while I
am adding the additional 40G AOC, 1CX, autoneg and unknown PHY fixes
based on code inspection. There may be additional work left here for
Broadcom but this is certainly better than the returns.
PR: 287395
Reported by: mickael.maillot@gmail.com, cyric@mm.st
Tested by: Einar Bjarni Halldórsson <einar@isnic.is>
MFC after: 1 week
It's okay if MCLBYTES is larger than the default receive buffer size.
Fixes: 71702df612 ("gve: Add support for 4k RX Buffers when using DQO queue formats")
This change adds support for using 4K RX Buffers when using DQO queue
formats when a boot-time tunable flag is set to true by the user.
When this flag is enabled, the driver will use 4K RX Buffer size either
when HW LRO is enabled or mtu > 2048.
Signed-off-by: Vee Agarwal <veethebee@google.com>
Reviewed by: markj, ziaee
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D50786
While attaching the qlnx driver we can end up trying to call ifmedia functions
before those are set up (through ether_ifattach() -> rtnl_handle_ifattach()
-> dump_iface() -> get_operstate_ether() -> ifmedia_ioctl()). Postpone the
ether_ifattach() until after the ifmedia setup.
Reviewed by: markj,zlei
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D50819
HDMI audio did not work on my older Radeon GPU, the error message
during attach was:
hdac0: hdac_get_capabilities: Invalid corb size (0)
This is fixed by calling hdac_reset() before the HDA device
capabilities are retrieved. This solution was proposed by Andriy Gapon
in 2010, but apparently did not solve the problem reported at the time.
Approved by: christos
Differential Revision: https://reviews.freebsd.org/D50737
usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using
'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.
Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716