Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 - add a bus class check to the conv...



details:   https://anonhg.NetBSD.org/src/rev/126b6ce7126c
branches:  trunk
changeset: 494196:126b6ce7126c
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jul 03 14:38:05 2000 +0000

description:
- add a bus class check to the conversion of prom names to NetBSD driver
names, as we need to convert `pci' to both `psycho' and `simba'.  add
a member to dev_compat_table[] for this, using BUSCLASS_NONE for when
we don't care (all other cases, currently).  add `ide' -> `pciide' and
`disk' -> `wd' mappings here, also.
- "psycho" is a BUSCLASS_MAINBUS device; it has UPA attachment semantics.


this fixes bootpath detection for IDE disks.

diffstat:

 sys/arch/sparc64/sparc64/autoconf.c |  34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diffs (87 lines):

diff -r e887856ff8af -r 126b6ce7126c sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Mon Jul 03 12:50:09 2000 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Mon Jul 03 14:38:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.34 2000/06/29 07:37:57 mrg Exp $ */
+/*     $NetBSD: autoconf.c,v 1.35 2000/07/03 14:38:05 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1017,7 +1017,7 @@
 #define BUSCLASS_FDC           9
 
 static int bus_class __P((struct device *));
-static char *bus_compatible __P((char *));
+static char *bus_compatible __P((char *, struct device *));
 static int instance_match __P((struct device *, void *, struct bootpath *));
 static void nail_bootdev __P((struct device *, struct bootpath *));
 
@@ -1027,6 +1027,7 @@
 } bus_class_tab[] = {
        { "mainbus",    BUSCLASS_MAINBUS },
        { "upa",        BUSCLASS_MAINBUS },
+       { "psycho",     BUSCLASS_MAINBUS },
        { "obio",       BUSCLASS_OBIO },
        { "iommu",      BUSCLASS_IOMMU },
        { "sbus",       BUSCLASS_SBUS },
@@ -1035,7 +1036,6 @@
        { "dma",        BUSCLASS_SBUS },
        { "espdma",     BUSCLASS_SBUS },
        { "ledma",      BUSCLASS_SBUS },
-       { "psycho",     BUSCLASS_PCI },
        { "simba",      BUSCLASS_PCI },
        { "pciide",     BUSCLASS_PCI },
        { "pci",        BUSCLASS_PCI },
@@ -1051,23 +1051,31 @@
  */
 static struct {
        char    *bpname;
+       int     class;
        char    *cfname;
 } dev_compat_tab[] = {
-       { "espdma",     "dma" },
-       { "QLGC,isp",   "isp" },
-       { "PTI,isp",    "isp" },
-       { "ptisp",      "isp" },
-       { "SUNW,fdtwo", "fdc" },
+       { "espdma",     BUSCLASS_NONE,          "dma" },
+       { "QLGC,isp",   BUSCLASS_NONE,          "isp" },
+       { "PTI,isp",    BUSCLASS_NONE,          "isp" },
+       { "ptisp",      BUSCLASS_NONE,          "isp" },
+       { "SUNW,fdtwo", BUSCLASS_NONE,          "fdc" },
+       { "pci",        BUSCLASS_MAINBUS,       "psycho" },
+       { "pci",        BUSCLASS_PCI,           "simba" },
+       { "ide",        BUSCLASS_PCI,           "pciide" },
+       { "disk",       BUSCLASS_NONE,          "wd" },
 };
 
 static char *
-bus_compatible(bpname)
+bus_compatible(bpname, dev)
        char *bpname;
+       struct device *dev;
 {
-       int i;
+       int i, class = bus_class(dev);
 
        for (i = sizeof(dev_compat_tab)/sizeof(dev_compat_tab[0]); i-- > 0;) {
-               if (strcmp(bpname, dev_compat_tab[i].bpname) == 0)
+               if (strcmp(bpname, dev_compat_tab[i].bpname) == 0 &&
+                   (class == BUSCLASS_NONE ||
+                    class == dev_compat_tab[i].class))
                        return (dev_compat_tab[i].cfname);
        }
 
@@ -1207,10 +1215,10 @@
        /*
         * Translate PROM name in case our drivers are named differently
         */
-       bpname = bus_compatible(bp->name);
+       bpname = bus_compatible(bp->name, dev);
+       dvname = dev->dv_cfdata->cf_driver->cd_name;
 
        /* First, match by name */
-       dvname = dev->dv_cfdata->cf_driver->cd_name;
        if (strcmp(dvname, bpname) != 0)
                return;
 



Home | Main Index | Thread Index | Old Index