Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci check PCI subsystem ID for a SMC9432BTX1 or SMC9...



details:   https://anonhg.NetBSD.org/src/rev/748a7de33c6f
branches:  trunk
changeset: 510028:748a7de33c6f
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu May 17 17:35:13 2001 +0000

description:
check PCI subsystem ID for a SMC9432BTX1 or SMC9432FTX and tell the common
driver about their media support (BNC and 100FX, respectively)

diffstat:

 sys/dev/pci/if_epic_pci.c |  39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diffs (67 lines):

diff -r e914004ded93 -r 748a7de33c6f sys/dev/pci/if_epic_pci.c
--- a/sys/dev/pci/if_epic_pci.c Thu May 17 17:32:47 2001 +0000
+++ b/sys/dev/pci/if_epic_pci.c Thu May 17 17:35:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_epic_pci.c,v 1.15 2000/12/28 22:59:13 sommerfeld Exp $      */
+/*     $NetBSD: if_epic_pci.c,v 1.16 2001/05/17 17:35:13 drochner Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -134,6 +134,38 @@
        return (NULL);
 }
 
+const struct epic_pci_subsys_info {
+       pcireg_t subsysid;
+       int flags;
+} epic_pci_subsys_info[] = {
+       { PCI_ID_CODE(PCI_VENDOR_SMC, 0xa024), /* SMC9432BTX1 */
+         EPIC_HAS_BNC },
+       { PCI_ID_CODE(PCI_VENDOR_SMC, 0xa016), /* SMC9432FTX */
+         EPIC_HAS_MII_FIBER | EPIC_DUPLEXLED_ON_694 },
+       { 0xffffffff,
+         0 }
+};
+
+const struct epic_pci_subsys_info *
+  epic_pci_subsys_lookup(const struct pci_attach_args *);
+
+const struct epic_pci_subsys_info *
+epic_pci_subsys_lookup(pa)
+       const struct pci_attach_args *pa;
+{
+       pci_chipset_tag_t pc = pa->pa_pc;
+       pcireg_t reg;
+       const struct epic_pci_subsys_info *esp;
+
+       reg = pci_conf_read(pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+
+       for (esp = epic_pci_subsys_info; esp->subsysid != 0xffffffff; esp++)
+               if (esp->subsysid == reg)
+                       return (esp);
+
+       return (NULL);
+}
+
 int
 epic_pci_match(parent, match, aux)
        struct device *parent;
@@ -160,6 +192,7 @@
        pci_intr_handle_t ih;
        const char *intrstr = NULL;
        const struct epic_pci_product *epp;
+       const struct epic_pci_subsys_info *esp;
        bus_space_tag_t iot, memt;
        bus_space_handle_t ioh, memh;
        pcireg_t reg;
@@ -245,6 +278,10 @@
        }
        printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
 
+       esp = epic_pci_subsys_lookup(pa);
+       if (esp)
+               sc->sc_hwflags = esp->flags;
+
        /*
         * Finish off the attach.
         */



Home | Main Index | Thread Index | Old Index