Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dev/pci Pull up following revision(s) (requested by c...



details:   https://anonhg.NetBSD.org/src/rev/9cfe2d6bd040
branches:  netbsd-6
changeset: 775489:9cfe2d6bd040
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Nov 22 17:28:46 2012 +0000

description:
Pull up following revision(s) (requested by chs in ticket #688):
        sys/dev/pci/twa.c: revision 1.43
fix autoconf output (don't print from the match routine).

diffstat:

 sys/dev/pci/twa.c |  50 ++++++++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

diffs (109 lines):

diff -r 88cea522269b -r 9cfe2d6bd040 sys/dev/pci/twa.c
--- a/sys/dev/pci/twa.c Thu Nov 22 17:24:52 2012 +0000
+++ b/sys/dev/pci/twa.c Thu Nov 22 17:28:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: twa.c,v 1.40 2012/01/30 19:41:23 drochner Exp $ */
+/*     $NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz Exp $ */
 /*     $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $        */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.40 2012/01/30 19:41:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -84,9 +84,6 @@
 #include <sys/disk.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
-#if 1
-#include <sys/ktrace.h>
-#endif
 
 #include <sys/bus.h>
 
@@ -386,7 +383,7 @@
        const char      *name;
 };
 
-static const struct twa_pci_identity pci_twa_products[] = {
+static const struct twa_pci_identity twa_pci_products[] = {
        { PCI_VENDOR_3WARE,
          PCI_PRODUCT_3WARE_9000,
          "3ware 9000 series",
@@ -434,23 +431,31 @@
        wakeup(tr);
 }
 
+static const struct twa_pci_identity *
+twa_lookup(pcireg_t id)
+{
+       const struct twa_pci_identity *entry;
+       int i;
+
+       for (i = 0; i < __arraycount(twa_pci_products); i++) {
+               entry = &twa_pci_products[i];
+               if (entry->vendor_id == PCI_VENDOR(id) &&
+                   entry->product_id == PCI_PRODUCT(id)) {
+                       return entry;
+               }
+       }
+       return NULL;
+}
+
 static int
-twa_match(device_t parent, cfdata_t cfdata,
-    void *aux)
+twa_match(device_t parent, cfdata_t cfdata, void *aux)
 {
-       int i;
        struct pci_attach_args *pa = aux;
-       const struct twa_pci_identity *entry = 0;
-
-       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3WARE) {
-               for (i = 0; (pci_twa_products[i].product_id); i++) {
-                       entry = &pci_twa_products[i];
-                       if (entry->product_id == PCI_PRODUCT(pa->pa_id)) {
-                               aprint_normal("%s: (rev. 0x%02x)\n",
-                                   entry->name, PCI_REVISION(pa->pa_class));
-                               return (1);
-                       }
-               }
+       const struct twa_pci_identity *entry;
+
+       entry = twa_lookup(pa->pa_id);
+       if (entry != NULL) {
+               return 1;
        }
        return (0);
 }
@@ -713,7 +718,6 @@
                SID_QUAL_LU_NOTPRESENT;
 
        error = twa_immediate_request(tr, TWA_REQUEST_TIMEOUT_PERIOD);
-
        if (error != 0)
                return (error);
 
@@ -1495,6 +1499,7 @@
        pci_intr_handle_t ih;
        const char *intrstr;
        const struct sysctlnode *node; 
+       const struct twa_pci_identity *entry;
        int i;
        bool use_64bit;
 
@@ -1505,7 +1510,8 @@
        sc->pc = pa->pa_pc;
        sc->tag = pa->pa_tag;
 
-       pci_aprint_devinfo_fancy(pa, "RAID controller", "3ware Apache", 0);
+       entry = twa_lookup(pa->pa_id);
+       pci_aprint_devinfo_fancy(pa, "RAID controller", entry->name, 1);
 
        sc->sc_quirks = 0;
                



Home | Main Index | Thread Index | Old Index