git: 71883128e5c8 - main - rtsx: Add plug-and-play info
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 13 Apr 2023 14:13:12 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=71883128e5c883bd986219b1aa1b2a7e9772a448
commit 71883128e5c883bd986219b1aa1b2a7e9772a448
Author: Henri Hennebert <hlh@restart.be>
AuthorDate: 2023-04-13 14:07:12 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-04-13 14:12:50 +0000
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
---
sys/amd64/conf/GENERIC | 1 -
sys/dev/rtsx/rtsx.c | 49 +++++++++++++++++++++++++------------------------
sys/i386/conf/GENERIC | 1 -
3 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 67463e1013f8..6073f9716d3e 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -364,7 +364,6 @@ device snd_via8233 # VIA VT8233x Audio
device mmc # MMC/SD bus
device mmcsd # MMC/SD memory card
device sdhci # Generic PCI SD Host Controller
-device rtsx # Realtek SD card reader
# VirtIO support
device virtio # Generic VirtIO bus (required)
diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c
index 65c4aa809de9..cd3ca787ed9a 100644
--- a/sys/dev/rtsx/rtsx.c
+++ b/sys/dev/rtsx/rtsx.c
@@ -174,22 +174,20 @@ struct rtsx_softc {
#define RTSX_VERSION "2.1g"
-static const struct rtsx_device {
- uint16_t vendor_id;
+static const struct rtsx_pciids {
uint16_t device_id;
const char *desc;
-} rtsx_devices[] = {
- { RTSX_REALTEK, RTSX_RTS5209, RTSX_VERSION " Realtek RTS5209 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS5227, RTSX_VERSION " Realtek RTS5227 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS5229, RTSX_VERSION " Realtek RTS5229 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS522A, RTSX_VERSION " Realtek RTS522A PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS525A, RTSX_VERSION " Realtek RTS525A PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS5249, RTSX_VERSION " Realtek RTS5249 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTS5260, RTSX_VERSION " Realtek RTS5260 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTL8402, RTSX_VERSION " Realtek RTL8402 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTL8411, RTSX_VERSION " Realtek RTL8411 PCIe SD Card Reader"},
- { RTSX_REALTEK, RTSX_RTL8411B, RTSX_VERSION " Realtek RTL8411B PCIe SD Card Reader"},
- { 0, 0, NULL}
+} rtsx_ids[] = {
+ { RTSX_RTS5209, RTSX_VERSION " Realtek RTS5209 PCIe SD Card Reader" },
+ { RTSX_RTS5227, RTSX_VERSION " Realtek RTS5227 PCIe SD Card Reader" },
+ { RTSX_RTS5229, RTSX_VERSION " Realtek RTS5229 PCIe SD Card Reader" },
+ { RTSX_RTS522A, RTSX_VERSION " Realtek RTS522A PCIe SD Card Reader" },
+ { RTSX_RTS525A, RTSX_VERSION " Realtek RTS525A PCIe SD Card Reader" },
+ { RTSX_RTS5249, RTSX_VERSION " Realtek RTS5249 PCIe SD Card Reader" },
+ { RTSX_RTS5260, RTSX_VERSION " Realtek RTS5260 PCIe SD Card Reader" },
+ { RTSX_RTL8402, RTSX_VERSION " Realtek RTL8402 PCIe SD Card Reader" },
+ { RTSX_RTL8411, RTSX_VERSION " Realtek RTL8411 PCIe SD Card Reader" },
+ { RTSX_RTL8411B, RTSX_VERSION " Realtek RTL8411B PCIe SD Card Reader" },
};
/* See `kenv | grep smbios.system` */
@@ -199,6 +197,7 @@ static const struct rtsx_inversion_model {
char *product;
} rtsx_inversion_models[] = {
{ "LENOVO", "ThinkPad T470p", "20J7S0PM00"},
+ { "LENOVO", "ThinkPad X13 Gen 1", "20UF000QRT"},
{ NULL, NULL, NULL}
};
@@ -3571,22 +3570,19 @@ rtsx_probe(device_t dev)
uint16_t vendor_id;
uint16_t device_id;
int i;
- int result;
vendor_id = pci_get_vendor(dev);
device_id = pci_get_device(dev);
- result = ENXIO;
- for (i = 0; rtsx_devices[i].vendor_id != 0; i++) {
- if (rtsx_devices[i].vendor_id == vendor_id &&
- rtsx_devices[i].device_id == device_id) {
- device_set_desc(dev, rtsx_devices[i].desc);
- result = BUS_PROBE_DEFAULT;
- break;
+ if (vendor_id != RTSX_REALTEK)
+ return (ENXIO);
+ for (i = 0; i < nitems(rtsx_ids); i++) {
+ if (rtsx_ids[i].device_id == device_id) {
+ device_set_desc(dev, rtsx_ids[i].desc);
+ return (BUS_PROBE_DEFAULT);
}
}
-
- return (result);
+ return (ENXIO);
}
/*
@@ -3907,6 +3903,11 @@ static device_method_t rtsx_methods[] = {
DEFINE_CLASS_0(rtsx, rtsx_driver, rtsx_methods, sizeof(struct rtsx_softc));
DRIVER_MODULE(rtsx, pci, rtsx_driver, NULL, NULL);
+
+/* For Plug and Play */
+MODULE_PNP_INFO("U16:device;D:#;T:vendor=0x10ec", pci, rtsx,
+ rtsx_ids, nitems(rtsx_ids));
+
#ifndef MMCCAM
MMC_DECLARE_BRIDGE(rtsx);
#endif /* !MMCCAM */
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 475b584f366b..0ca5fe12d13f 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -319,7 +319,6 @@ device snd_via8233 # VIA VT8233x Audio
device mmc # MMC/SD bus
device mmcsd # MMC/SD memory card
device sdhci # Generic PCI SD Host Controller
-device rtsx # Realtek SD card reader
# VirtIO support
device virtio # Generic VirtIO bus (required)