Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Make pci_get_capability() work correctly on both...



details:   https://anonhg.NetBSD.org/src/rev/201c67e265ad
branches:  trunk
changeset: 485881:201c67e265ad
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon May 08 10:52:38 2000 +0000

description:
Make pci_get_capability() work correctly on both header type 0 and type 2
devices; both have different Capability List Pointer registers.

diffstat:

 sys/dev/pci/pci.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 7c515b33cdf0 -r 201c67e265ad sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Mon May 08 10:45:52 2000 +0000
+++ b/sys/dev/pci/pci.c Mon May 08 10:52:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci.c,v 1.46 2000/03/30 12:45:35 augustss Exp $        */
+/*     $NetBSD: pci.c,v 1.47 2000/05/08 10:52:38 kleink Exp $  */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -369,7 +369,19 @@
        if (!(reg & PCI_STATUS_CAPLIST_SUPPORT))
                return (0);
 
-       ofs = PCI_CAPLIST_PTR(pci_conf_read(pc, tag, PCI_CAPLISTPTR_REG));
+       reg = pci_conf_read(pc, tag, PCI_BHLC_REG);
+       switch (PCI_HDRTYPE_TYPE(reg)) {
+       case 0: /* standard device header */
+               ofs = PCI_CAPLISTPTR_REG;
+               break;
+       case 2: /* PCI-CardBus Bridge header */
+               ofs = PCI_CARDBUS_CAPLISTPTR_REG;
+               break;
+       default:
+               return (0);
+       }
+
+       ofs = PCI_CAPLIST_PTR(pci_conf_read(pc, tag, ofs));
        while (ofs != 0) {
 #ifdef DIAGNOSTIC
                if ((ofs & 3) || (ofs < 0x40))



Home | Main Index | Thread Index | Old Index