summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2013-01-04 23:19:41 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2013-01-04 23:19:41 +0000
commit59f1342291f7d15a9b502c5bb75f30adff942aa4 (patch)
tree3902f7883f5f6e06e7428d867883a7318a7b377b /sys/dev/pci
parent244cb54e30b6c10df2d1875c89288c77e2e96d90 (diff)
Attach rtsx(4) only to devices using the 'undefined' PCI class, and do
not ever attach sdhc(4) to devices matching the rtsx(4) vendor/product ID. Fixes an issue reported by Dave Anderson where on his hardware both drivers attached to apparently the same device which then failed to work reliably. ok deraadt
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/rtsx_pci.c10
-rw-r--r--sys/dev/pci/sdhc_pci.c13
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/pci/rtsx_pci.c b/sys/dev/pci/rtsx_pci.c
index 127f43f341a..5dfa3f3fcd9 100644
--- a/sys/dev/pci/rtsx_pci.c
+++ b/sys/dev/pci/rtsx_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsx_pci.c,v 1.1 2012/11/29 23:36:34 stsp Exp $ */
+/* $OpenBSD: rtsx_pci.c,v 1.2 2013/01/04 23:19:40 stsp Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -48,8 +48,14 @@ rtsx_pci_match(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = aux;
+ /*
+ * Explicitly match the UNDEFINED device class only. Some RTS5902
+ * devices advertise a SYSTEM/SDHC class in addition to the UNDEFINED
+ * device class. Let sdhc(4) handle the SYSTEM/SDHC ones.
+ */
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_REALTEK &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RTS5209)
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RTS5209 &&
+ PCI_CLASS(pa->pa_class) == PCI_CLASS_UNDEFINED)
return 1;
return 0;
diff --git a/sys/dev/pci/sdhc_pci.c b/sys/dev/pci/sdhc_pci.c
index 5abe511d84e..77dc54d1627 100644
--- a/sys/dev/pci/sdhc_pci.c
+++ b/sys/dev/pci/sdhc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc_pci.c,v 1.13 2012/10/08 21:47:50 deraadt Exp $ */
+/* $OpenBSD: sdhc_pci.c,v 1.14 2013/01/04 23:19:40 stsp Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -66,6 +66,17 @@ sdhc_pci_match(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = aux;
+ /*
+ * The Realtek RTS5209 is supported by rtsx(4). Usually the device
+ * class for these is UNDEFINED but there are RTS5209 devices which
+ * are advertising an SYSTEM/SDHC device class in addition to a
+ * separate device advertising the UNDEFINED class. Such devices are
+ * not compatible with sdhc(4), so ignore them.
+ */
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_REALTEK &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RTS5209)
+ return 0;
+
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_SYSTEM &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_SYSTEM_SDHC)
return 1;