This is a simple RTC driver for the rv3032 from Microcrystal.
Just the basic functionality is implemented (no timer, alarm etc ..).
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41995
(cherry picked from commit 1d6a6a524409662992ca96bc91ae69b2a2a5ff35)
This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64)
so only enable it there for now.
Differential Revision: https://reviews.freebsd.org/D41994
(cherry picked from commit 137b58e4d2044adc200d13c8989d3746a0a4bd7f)
No reason that they should live directly under iicbus
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41913
(cherry picked from commit 7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074)
No reason that they should live directly under iicbus
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41911
(cherry picked from commit 06589d6e029c6ff64a7816d743e0a508abe6193b)
Those are (mainly) pwm controller so move it under a new subdirectory.
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41910
(cherry picked from commit 22d7dd834bc5cd189810e414701e3ad1e98102e4)
No reason that they should live directly under iicbus
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41908
(cherry picked from commit 2f16049c985a364e2bd2b256f5bef9af17e10c62)
The folder is a mess so start moving stuff into sub-directories.
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D41907
(cherry picked from commit 580d00f42fdd94ce43583cc45fe3f1d9fdff47d4)
- pclk and hclk are mandatory so always try to get them.
Don't make it fatal if it fails as some platform (like Zynq) don't
have a proper clock driver.
- Always use pclk for the reference clock.
- Try to get all the possible clocks and enable them.
Reviewed-by: mhorne
Tested-by: Milan Obuch <bsd@dino.sk>
Differential Revision: https://reviews.freebsd.org/D41857
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 4c52dde5bda099936d43820da84e569dccc6f475)
- Remove cdns,gem, it's the generic binding but for all platform that include
this one we need specific drivers setup so remove it.
- Remove cdns,macb, it's the generic binding for Atmel AT91 which we don't suport
- Remove cadence,gem, it's not an official binding and seems to be only used in some
obscure ARM11 SoC.
- Note that the cdns,zynq* are deprecated
- Add the new Xilinx compatible for zynq and zynqmp
Reviewed-by: mhorne
Tested-by: skibo, Milan Obuch <bsd@dino.sk>
Differential Revision: https://reviews.freebsd.org/D41856
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit bdbbbbb32104569fccd786d9cc07d17f6231a713)
The binding says that we can have one or two clocks to export.
The first one is the actual sdclock while the second is the sample clock.
Both have the same parent, clk_xin.
Correctly export the clocks for RK3399 and ZynqMP.
No need to use a high ID as before, we have our own clock domain so use
ids starting at 1 as all exported clocks should be.
Reviewed-by: bz
Differential Revision: https://reviews.freebsd.org/D41810
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 81a4fe38a6ce818bb7cba548bb2c697429fa9479)
Per the bindings the phy and the syscon can always be present not just
for RK3399.
Reviewed-by: bz
Differiential Revision: https://reviews.freebsd.org/D41809
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 0ee5d6fcfc63be48fd7c1b461917dfb880dc7f72)
Those two (in fact all of the supported one in this driver except RK3568) always
needs the clocks to be enabled.
Reviewed-by: bz
Differential Revision: https://reviews.freebsd.org/D41808
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 9377d7049c846d1e35c8fc8809c23e6413909fca)
This was used when we had our own DTS, it's not used anymore.
Reviewed-by: bz
Differential Revision: https://reviews.freebsd.org/D41807
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 8c7e747491ad636d6ee4069a74ddb24814870540)
Add clock and reset drivers for the ZynqMP SoC.
The clocks are discovered by talking to the firmware as the topology isn't
fixed on this SoC.
Differential Revision: https://reviews.freebsd.org/D41812
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 4e579ad047720775ab580b74192c7de8a3386fea)
The ZynqMP SoC have a MCU running a firmware to control clocks, resets,
fpga loading etc ...
Add a driver that can be use to communicate with it.
For now only the clock and reset part are implemented.
Differential Revision: https://reviews.freebsd.org/D41811
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 9e88711f28dc9afa7d68ae8dd027d2399a2a290b)
When building the frequencies table we convert the value in the DTS to
megahertz and loose precision. While it's not a problem for most of the
DTS it is when the expected frequency value is strict down to the hertz.
So it's either we don't truncate the value and have some ugly and long
values in the sysctls or we just find the closest frequency.
Do the latter.
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D41762
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 17c17872ca98df0e2b9f9c7a2c41ef73f7dee21a)
callout_stop() requires the associated lock to be held.
This is a bit hacky, but I believe it's safe since the subsequent
mrsas_cmd_done() call will also acquire the SIM lock to stop a different
callout.
PR: 265484
Reviewed by: imp
Tested by: Jérémie Jourdin <jeremie.jourdin@advens.fr>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39559
(cherry picked from commit 4640df1b0a49697840b81f6bcd269a483514c6aa)
Similar to dcfddc8dc091e7688abc8488a0307eba425fa7a2, replace the
simpler, inlined version with the full version.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41690
(cherry picked from commit 897e564361624411c4e557e0817642e1477f0af4)
In particular, the kernel RPC layer used by the NFS client never
invokes pru_rcvd since it always reads data from the socket upcall
via MSG_SOCALLBCK which avoids calling pru_rcvd. As a result, on an
NFS client connection managed by t4_tom, RX credits were never
returned to the TOE connection to open the TCP window resulting in
connection hangs.
To fix, expand the set of conditions in do_rx_data where RX credits
are returned to match those in t4_rcvd_locked by calling the function
directly.
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41688
(cherry picked from commit dcfddc8dc091e7688abc8488a0307eba425fa7a2)
Queue an initial fetch of data during attach and after every read
rather than synchronously fetching data and polling for completion.
If data has not been returned from an previous fetch during read,
just return EAGAIN rather than blocking.
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41656
(cherry picked from commit f1c5a2e3a625053e2b70d5b1777d849a4d9328f2)
The AX88179A has two firmware modes, one of which is backward
compatible with existing AX88178A/179 driver. The active firmware mode
can be controlled through a register.
Update axge(4) man page to mention 179A support and ensure that, when
bound to a AX88179A, the driver activates the compatible firmware mode.
Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/854
MFC after: 1 week
(cherry picked from commit 6962da914dd511349b219241e92b32329be76fc6)
Applies only to bare-metal Zen2 processors. The system currently
automatically applies it to all of them.
Tunable/sysctl 'machdep.mitigations.zenbleed.enable' can be used to
forcibly enable or disable the mitigation at boot or run-time. Possible
values are:
0: Mitigation disabled
1: Mitigation enabled
2: Run the automatic determination.
Currently, value 2 is the default and has identical effect as value 1.
This might change in the future if we choose to take into account
microcode revisions in the automatic determination process.
The tunable/sysctl value is simply ignored on non-applicable CPU models,
which is useful to apply the same configuration on a set of machines
that do not all have Zen2 processors. Trying to set it to any integer
value not listed above is silently equivalent to setting it to value 2
(automatic determination).
The current mitigation state can be queried through sysctl
'machdep.mitigations.zenbleed.state', which returns "Not applicable",
"Mitigation enabled" or "Mitigation disabled". Note that this state is
not guaranteed to be accurate in case of intervening modifications of
the corresponding chicken bit directly via cpuctl(4) (this includes the
cpucontrol(8) utility). Resetting the desired policy through
'machdep.mitigations.zenbleed.enable' (possibly to its current value)
will reset the hardware state and ensure that the reported state is
again coherent with it.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41817
(cherry picked from commit ebaea1bcd2eb0aa90937637ed305184b6fedc69b)
When running nvme passthrough commands through the ioctl interface
memory is mapped with vmapbuf() but not unmapped. This results in leaked
memory whenever a process executes an nvme passthrough command with a
data buffer. This can be replicated with a simple c function (error
checks skipped for brevity):
void leak_memory(int nvme_ns_fd, uint16_t nblocks) {
struct nvme_pt_command pt = {
.cmd = {
.opc = NVME_OPC_READ,
.cdw12 = nblocks - 1,
},
.len = nblocks * 512, // Assumes devices with 512 byte lba
.is_read = 1, // Reads and writes should both trigger leak
}
void *buf;
posix_memalign(&buf, nblocks * 512);
pt.buf = buf;
ioctl(nvme_ns_fd, NVME_PASSTHROUGH_COMMAND, &pt);
free(buf);
}
Signed-off-by: David Sloan <david.sloan@eideticom.com>
PR: 273626
Reviewed by: imp, markj
MFC after: 1 week
(cherry picked from commit 7ea866eb14f8ec869a525442c03228b6701e1dab)
ieee80211_node_incref() is the FreeBSD implementation of
ieee80211_ref_node(). Not being interested in the node returned
it was used as a shortcut in 3 drivers (ath, uath, wpi).
Replace the call with the public KPI of ieee80211_ref_node() and
ignore the result.
This leaves us with the single internal call going
ieee80211_ref_node() -> ieee80211_node_incref() and that should
help increasing portability but also limiting the places to trace
for node reference operations.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit f156cd892b55c04a39fa06d1899e6e316de77f03)
hdac_attach() registers an interrupt handler before allocating various
driver resources which are accessed by the interrupt handler. On some
platforms we observe what appear to be spurious interrupts upon a cold
boot, resulting in panics.
Partially work around the problem by deferring irq allocation until
after other resources are allocated. I think this is not a complete
solution, but is correct and sufficient to work around the problems
reported in the PR.
PR: 268393
Tested by: Alexander Sherikov <asherikov@yandex.com>
Tested by: Oleh Hushchenkov <o.hushchenkov@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41883
(cherry picked from commit 015daf5221f7588b9258fe0242cee09bde39fe21)
Depending on the card's firmware version, it may return different length
responses for MPI2_FUNCTION_IOC_FACTS. But the first part of the
response contains the length of the rest, so query it first to get the
length and then use that to size the buffer for the full response.
Also, correctly zero-initialize MPI2_IOC_FACTS_REQUEST. It only worked
by luck before.
PR: 264848
Reported by: Julien Cigar <julien@perdition.city>
Sponsored by: Axcient
Reviewed by: scottl, imp
Differential Revision: https://reviews.freebsd.org/D38739
(cherry picked from commit 7d154c4dc64e61af7ca536c4e9927fa07c675a83)
When we're suspending, we get messages about waiting for the controller
to reset. These are in error: we're not waiting for it to reset. We put
the recovery state as part of suspending, so we should suppress these as
a false positive.
Also remove a stray debug that's left over from earlier versions of
the recovery code that no longer makes sense.
Sponsored by: Netflix
(cherry picked from commit 1d6021cd72689f54093af4ed77066a2f8abde664)
Currently, when we suspend, we need to tear down all the qpairs. We call
nvme_admin_qpair_abort_aers with the admin qpair lock held, but the
tracker it will call for the pending AER also locks it (recursively)
hitting an assert. This routine is called without the qpair lock held
when we destroy the device entirely in a number of places. Add an assert
to this effect and drop the qpair lock before calling it.
nvme_admin_qpair_abort_aers then locks the qpair lock to traverse the
list, dropping it around calls to nvme_qpair_complete_tracker, and
restarting the list scan after picking it back up.
Note: If interrupts are still running, there's a tiny window for these
AERs: If one fires just an instant after we manually complete it, then
we'll be fine: we set the state of the queue to 'waiting' and we ignore
interrupts while 'waiting'. We know we'll destroy all the queue state
with these pending interrupts before looking at them again and we know
all the TRs will have been completed or rescheduled. So either way we're
covered.
Also, tidy up the failure case as well: failing a queue is a superset of
disabling it, so no need to call disable first. This solves solves some
locking issues with recursion since we don't need to recurse.. Set the
qpair state of failed queues to RECOVERY_FAILED and stop scheduling the
watchdog. Assert we're not failed when we're enabling a qpair, since
failure currently is one-way. Make failure a little less verbose.
Next, kill the pre/post reset stuff. It's completely bogus since we
disable the qparis, we don't need to also hold the lock through the
reset: disabling will cause the ISR to return early. This keeps us from
recursing on the recovery lock when resuming. We only need the recovery
lock to avoid a specific race between the timer and the ISR.
Finally, kill NVME_RESET_2X. It'S been a major release since we put it
in and nobody has used it as far as I can tell. And it was a motivator
for the pre/post uglification.
These are all interrelated, so need to be done at the same time.
Sponsored by: Netflix
Reviewed by: jhb
Tested by: jhb (made sure suspend / resume worked)
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D41866
(cherry picked from commit da8324a9258f1791cd10423103c1746646e33104)
Normally, we poll the device every so often to see if commands have
timed out. However, we'll go into the recovery state as part of failing
the drive. To account for all possibilties, if we're failed when we get
into the polling function, just stop polling: Party is over.
Sponsored by: Netflix
(cherry picked from commit d95431624f934fe4740211738fc787808005b14e)
Add a basically uncontended spinlock that we take out while the ISR is
running. This has two effects: First, when we get a timeout, we can
safely call the nvme_qpair_process_completions w/o racing any ISRs.
Second, we can use it to ensure that we don't reset the card while
the ISRs are active (right now we just sleep and hope for the best,
which usually is fine, but not always).
Sponsored by: Netflix
MFC After: 2 weeks
Reviewed by: chuck, gallatin
Differential Revision: https://reviews.freebsd.org/D41452
(cherry picked from commit 8052b01e7e4113fa8296ce43c354116b0a1774b7)
Next phase of error recovery: Eliminate the REOVERY_START phase, since
we don't need to wait to start recovery. Eliminate the RECOVERY_RESET
phase since it is transient, we now transition from RECOVERY_NORMAL into
RECOVERY_WAITING.
In normal mode, read the status of the controller. If it is in failed
state, or appears to be hot-plugged, jump directly to reset which will
sort out the proper things to do. This will cause all pending I/O to
complete with an abort status before the reset.
When in the NORMAL state, call the interrupt handler. This will complete
all pending transactions when interrupts are broken or temporarily
misbehaving. We then check all the pending completions for timeouts. If
we have abort enabled, then we'll send an abort. Otherwise we'll assume
the controller is wedged and needs a reset. By calling the interrupt
handler here, we'll avoid an issue with the current code where we
transitioned to RECOVERY_START which prevented any completions from
happening. Now completions happen. In addition and follow-on I/O that is
scheduled in the completion routines will be submitted, rather than
queued, because the recovery state is correct. This also fixes a problem
where I/O would timeout, but never complete, leading to hung I/O.
Resetting remains the same as before, just when we chose to reset has
changed.
A nice side effect of these changes is that we now do I/O when
interrupts to the card are totally broken. Followon commits will improve
the error reporting and logging when this happens. Performance will be
aweful, but will at least be minimally functional.
There is a small race when we're checking the completions if interrupts
are working, but this is handled in a future commit.
Sponsored by: Netflix
MFC After: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36922
(cherry picked from commit d4959bfcd110ea471222c7dd87775ba1f4e3d1d9)
When we went to having a shared timeout routine, failing the timed-out
transaction code was inadvertantly dropped. Reinstate it.
Fixes: 502dc84a8b
Sponsored by: Netflix
MFC After: 2 weeks
Reviewed by: chuck, jhb
Differential Revision: https://reviews.freebsd.org/D36921
(cherry picked from commit 2a6b7055a980f7e7543dfdbda4aa0c356133b77d)
Use the correct endian switching function when switching to a little
endian 64-bit address. Even on a little-endian machine this will
truncate the address to a 32-bit value.
Sponsored by: Arm Ltd
(cherry picked from commit 4386935191c576fa62a52d52734e264fe8329a67)
Newer versions of the AX88179 interweave dummies alongside valid
packet headers in bulk IN transfer data. This was probably done for
backward compatibility with existing drivers.
However current driver records these dummy headers as dropped frames,
leading to stats misreporting one Ierr per Ipkt.
This skips those dummy headers silently, thereby not generating Ierrs
for them.
Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/842
(cherry picked from commit 70fbcd451b68b7f6038d8a602cd8d5e1bb890f1d)
New features
- Add sysctl "link_active_on_if_down" (defaults to 1 to match previous
behavior): set this to 0 to have the driver bring the physical link down when
the interface is brought administratively down
- Add sysctl "temp" to read chip temperature on E810 devices; this requires a
4.30 or newer NVM (see package sysutils/intel-nvmupdate-100g)
Bug fixes and general changes
- (linked to irdma) properly propagate PF reset request from irdma driver
- (linked to irdma) properly notify irdma of an impending PF reset
- (linked to irdma) move Protocol Engine error handling to irdma
- Print log message when using a DDP that doesn't support the "TX balancing"
mode
- Block LLDP agent configuration when DSCP QoS mode is enabled
- Fix kernel panic when updating NVM when adapter is in the "TX balancing" mode
- Remove ice_sbq_cmd.h since it's unused
- Fix LLDP RX filter to still allow LLDP frames to be received by SW after a PF
reset in SW LLDP mode
- Add ice_if_needs_restart handler in order to fix a bad VLAN and link down
interaction
- Issue PF reset during unload
- nvmupdate process fixes
- Use pci_msix_table_bar() to get MSI-X bar index at runtime instead of hardcoding it
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: anzhu@netapp.com
Sponsored by: Intel Corporation, NetApp
Differential Revision: https://reviews.freebsd.org/D41655
(cherry picked from commit 9c30461dd25bac49045acbeac10e00b6cc13d2bc)
It was found through testing that when ULP uses individual vnet, the
search for the correct vlan_id may failing because of no proper
interface with given address.
The solution is to use vnet associated to the connection whenever
possible.
Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41592
(cherry picked from commit bc3a013ccd23c50bb48f17211ffc36fe85d11e18)
The current dts for Raspberry 3B+ and 4B have 2 disabled fixed-clock
nodes which have no clock-frequency value. Such nodes are non-standard.
This results in about 150 messages during autoconfiguration:
clk_fixed2: <Fixed clock> disabled on ofwbus0
clk_fixed2: Cannot FDT parameters.
device_attach: clk_fixed2 attach returned 6
Defensively check for clock-frequency in the probe routine, and if
none, return an error with a more direct error message (1 line per
occurrence, 50 lines total):
clk_fixed2: clock-fixed has no clock-frequency
Based on a patch by manu.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41594
(cherry picked from commit b4ef09b9eb117d622bb274448e5cffcae0ba3488)
1. The tracing ifnet's name must match the nexus name. One way to do
this is to not use a unit number.
2. Do not hold the tracer lock around ether_ifattach or ether_ifdetach.
netlink calls back into the driver (see stack below) and that leads
to illegal lock recursion.
tracer_ioctl
if_ioctl
get_operstate_ether
get_operstate
dump_iface
rtnl_handle_ifevent
rtnl_handle_ifattach
if_attach_internal
if_attach
ether_ifattach
t4_cloner_create
MFC after: 3 days
Sponsored by: Chelsio Communications
(cherry picked from commit e203cb393fe0b963dd585d0576dcc6a47a28c386)
netlink(4) calls back into the driver during detach and it attempts to
start an internal synchronized op recursively, causing an interruptible
hang. Fix it by failing the ioctl if the VI has been marked as DOOMED
by cxgbe_detach.
Here's the stack for the hang for reference.
#6 begin_synchronized_op
#7 cxgbe_media_status
#8 ifmedia_ioctl
#9 cxgbe_ioctl
#10 if_ioctl
#11 get_operstate_ether
#12 get_operstate
#13 dump_iface
#14 rtnl_handle_ifevent
#15 rtnl_handle_ifnet_event
#16 rt_ifmsg
#17 if_unroute
#18 if_down
#19 if_detach_internal
#20 if_detach
#21 ether_ifdetach
#22 cxgbe_vi_detach
#23 cxgbe_detach
#24 DEVICE_DETACH
MFC after: 3 days
Sponsored by: Chelsio Communications
(cherry picked from commit 3814249f1e8dacfcd326dd7c416c528a1d88b6a1)
Add a few stat counters for tso and lro.
MFC after: 3 days
Sponsored by: Microsoft
(cherry picked from commit b167e449c8db01f082691503fb5c1255ad5750eb)