Index: sys/amd64/conf/GENERIC =================================================================== --- sys/amd64/conf/GENERIC +++ sys/amd64/conf/GENERIC @@ -363,7 +363,7 @@ device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller -device rtsx # Realtek SD card reader +#device rtsx # Realtek SD card reader # VirtIO support device virtio # Generic VirtIO bus (required) Index: sys/dev/rtsx/rtsx.c =================================================================== --- sys/dev/rtsx/rtsx.c +++ sys/dev/rtsx/rtsx.c @@ -174,22 +174,20 @@ #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` */ @@ -3571,22 +3569,19 @@ 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); } /* @@ -3909,6 +3904,11 @@ DEFINE_CLASS_0(rtsx, rtsx_driver, rtsx_methods, sizeof(struct rtsx_softc)); DRIVER_MODULE(rtsx, pci, rtsx_driver, rtsx_devclass, 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 */ Index: sys/i386/conf/GENERIC =================================================================== --- sys/i386/conf/GENERIC +++ sys/i386/conf/GENERIC @@ -319,7 +319,7 @@ device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller -device rtsx # Realtek SD card reader +#device rtsx # Realtek SD card reader # VirtIO support device virtio # Generic VirtIO bus (required)