summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-06-12 11:13:29 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-06-12 11:13:29 +0000
commit2e9ec71da494f964cd034ed9a017860ae99310da (patch)
tree3eaffaddb2eb7d57ae8d6fd60cd7e9e64dffc2fe
parentc4384cf67909c3891e8096491477f9c137584b85 (diff)
Some devices, like parts of the NVIDIA C51 chipset, have a broken Capabilities
List. So turn a DIAGNOSTIC panic into returning failure. ok mglocker@, miod@
-rw-r--r--sys/dev/pci/pci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 3cb6423ce3d..0ecb5daeb04 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci.c,v 1.92 2011/05/30 19:09:46 kettenis Exp $ */
+/* $OpenBSD: pci.c,v 1.93 2011/06/12 11:13:28 kettenis Exp $ */
/* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */
/*
@@ -564,10 +564,13 @@ pci_get_capability(pci_chipset_tag_t pc, pcitag_t tag, int capid,
ofs = PCI_CAPLIST_PTR(pci_conf_read(pc, tag, ofs));
while (ofs != 0) {
-#ifdef DIAGNOSTIC
+ /*
+ * Some devices, like parts of the NVIDIA C51 chipset,
+ * have a broken Capabilities List. So we need to do
+ * a sanity check here.
+ */
if ((ofs & 3) || (ofs < 0x40))
- panic("pci_get_capability");
-#endif
+ return (0);
reg = pci_conf_read(pc, tag, ofs);
if (PCI_CAPLIST_CAP(reg) == capid) {
if (offset)