History log of /freebsd-current/sys/dev/rtsx/rtsx.c
Revision Date Author Comments
# 13a5a46c 29-Apr-2024 Andrew Gallatin <gallatin@FreeBSD.org>

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable. This made
the #define MAXPHYS in sys/param.h almost entirely obsolete, as
it could now be overridden by kern.maxphys at boot time, or by
opt_maxphys.h.

However, decades of tradition have led to several new, incorrect, uses
of MAXPHYS in other parts of the kernel, mostly by seasoned
developers. I've corrected those uses here in a mechanical fashion,
and verified that it fixes a bug in the md driver that I was
experiencing.

Since using MAXPHYS is such an easy mistake to make, it is best to
hide it from the kernel namespace. So I've moved its definition to
_maxphys.h, which is now included in param.h only for userspace.

That brings up the fact that lots of userspace programs use MAXPHYS
for different reasons, most of them probably wrong. Userspace consumers
that really need to know the value of maxphys should probably be
changed to use the kern.maxphys sysctl. But that's outside the scope
of this change.

Reviewed by: imp, jkim, kib, markj
Fixes: 30038a8b4efc ("md: Get rid of the pbuf zone")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D44986


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 71883128 13-Apr-2023 Henri Hennebert <hlh@restart.be>

rtsx: Add plug-and-play info

Add MODULE_PNP_INFO() to the driver to make it autoload if not linked
statically into the kernel. Remove the device from amd64/i386 GENERIC.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D35074


# 03cfce6f 06-May-2022 John Baldwin <jhb@FreeBSD.org>

rtsx: Remove unused devclass argument to DRIVER_MODULE.


# 8290c144 26-Apr-2022 Henri Hennebert <hlh@restart.be>

rtsx: Number of tweaks for RTS5260.

MFC after: 2 weeks


# 2e883067 25-Mar-2022 Henri Hennebert <hlh@restart.be>

rtsx: Remove update of softc during probe and some var rename.

MFC after: 1 week


# 9b261d2e 23-Mar-2022 Henri Hennebert <hlh@restart.be>

rtsx: Display error if rtsx_read()/rtsx_write() fail.

MFC after: 1 week


# 6b771837 23-Mar-2022 Henri Hennebert <hlh@restart.be>

rtsx: Don't detach during shutdown

MFC after: 1 week


# 1b1bab00 18-Mar-2022 hlh-restart <hlh@restart.be>

rtsx: Call rtsx_init() on resume.

MFC after: 3 days


# 577130e5 19-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Add RTS5260 support and replace bootverbose with sysctl.

Tested by: mav
MFC after: 4 days
Differential Revision: https://reviews.freebsd.org/D34246


# ad494d3b 03-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Update driver version number to 2.1c

Differential Revision: https://reviews.freebsd.org/D32154


# 1e800a59 03-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Do not display pci_read_config() errors during rtsx_init()

Differential Revision: https://reviews.freebsd.org/D32154


# ec1f122b 03-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Add CTLFLAG_STATS flag for read and write counters

Differential Revision: https://reviews.freebsd.org/D32154


# 7e5933b3 03-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Prefer __FreeBSD_version over __FreeBSD__

No functional change.

Differential Revision: https://reviews.freebsd.org/D32154


# 8e9740b6 03-Feb-2022 Henri Hennebert <hlh@restart.be>

rtsx: Convert driver to use the mmc_sim interface

A lot more generic cam related things were done in mmc_sim so this
simplifies the driver a lot.

Differential Revision: https://reviews.freebsd.org/D32154
Reviewed by: imp


# 9d3bc163 09-Sep-2021 Henri Hennebert <hlh@restart.be>

rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic

- Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card
in the card slot which is detected as a valid SD card. This added long
timeout at boot time. To alleviate the problem, the default timeout is
reduced to one second during the setup phase. [1]

- Some configurations crash at boot if rtsx(4) is defined in the kernel
config. At boot time, without a card inserted, the driver found that
a card is present and just after that a "spontaneous" interrupt is
generated showing that no card is present. To solve this problem,
DELAY(9) is set to one quarter of a second before checking card presence
during driver attach.

- As advised by adrian, taskqueue and DMA are set up sooner during
the driver attach. A heuristic to try to detect configuration needing
inversion was added.

PR: 255130 [1]
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30499


# 5bdf58e1 28-Aug-2021 Gordon Bergling <gbe@FreeBSD.org>

Fix some common typos in source code comments

- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

MFC after: 3 days


# 9339e7c0 10-Aug-2021 Warner Losh <imp@FreeBSD.org>

rtsx: Fix wakeup race similar to sdhci one fixed in 35547df5c786

rtsx copied code from sdhci, and has the same wakeup race bug that was
fixed in 35547df5c786, so apply a similar fix here.

Sponsored by: Netflix


# 926ce35a 24-Nov-2020 Jung-uk Kim <jkim@FreeBSD.org>

Port rtsx(4) driver for Realtek SD card reader from OpenBSD.

This driver provides support for Realtek PCI SD card readers. It attaches
mmc(4) bus on card insertion and detaches it on card removal. It has been
tested with RTS5209, RTS5227, RTS5229, RTS522A, RTS525A and RTL8411B. It
should also work with RTS5249, RTL8402 and RTL8411.

PR: 204521
Submitted by: Henri Hennebert (hlh at restart dot be)
Reviewed by: imp, jkim
Differential Revision: https://reviews.freebsd.org/D26435