Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/macppc move bootpath alias expansion from in...



details:   https://anonhg.NetBSD.org/src/rev/a24ad09bc1e0
branches:  trunk
changeset: 536780:a24ad09bc1e0
user:      dbj <dbj%NetBSD.org@localhost>
date:      Sun Sep 22 03:04:31 2002 +0000

description:
move bootpath alias expansion from initppc() into canonicalize_bootpath()

diffstat:

 sys/arch/macppc/macppc/autoconf.c |  39 ++++++++++++++++++++++++++++++++++++++-
 sys/arch/macppc/macppc/machdep.c  |  39 +--------------------------------------
 2 files changed, 39 insertions(+), 39 deletions(-)

diffs (106 lines):

diff -r f762966853a1 -r a24ad09bc1e0 sys/arch/macppc/macppc/autoconf.c
--- a/sys/arch/macppc/macppc/autoconf.c Sun Sep 22 01:56:08 2002 +0000
+++ b/sys/arch/macppc/macppc/autoconf.c Sun Sep 22 03:04:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.30 2002/07/28 07:00:58 chs Exp $        */
+/*     $NetBSD: autoconf.c,v 1.31 2002/09/22 03:04:31 dbj Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -93,6 +93,43 @@
        char last[32];
 
        /*
+        * If the bootpath doesn't start with a / then it isn't
+        * an OFW path and probably is an alias, so look up the alias
+        * and regenerate the full bootpath so device_register will work.
+        */
+       if (cbootpath[0] != '/' && cbootpath[0] != '\0') {
+               int aliases = OF_finddevice("/aliases");
+               char tmpbuf[100];
+               char aliasbuf[256];
+               if (aliases != 0) {
+                       char *cp1, *cp2, *cp;
+                       char saved_ch = 0;
+                       int len;
+                       cp1 = strchr(cbootpath, ':');
+                       cp2 = strchr(cbootpath, ',');
+                       cp = cp1;
+                       if (cp1 == NULL || (cp2 != NULL && cp2 < cp1))
+                               cp = cp2;
+                       tmpbuf[0] = '\0';
+                       if (cp != NULL) {
+                               strcpy(tmpbuf, cp);
+                               saved_ch = *cp;
+                               *cp = '\0';
+                       }
+                       len = OF_getprop(aliases, cbootpath, aliasbuf,
+                           sizeof(aliasbuf));
+                       if (len > 0) {
+                               if (aliasbuf[len-1] == '\0')
+                                       len--;
+                               memcpy(cbootpath, aliasbuf, len);
+                               strcpy(&cbootpath[len], tmpbuf);
+                       } else {
+                               *cp = saved_ch;
+                       }
+               }
+       }
+
+       /*
         * Strip kernel name.  bootpath contains "OF-path"/"kernel".
         *
         * for example:
diff -r f762966853a1 -r a24ad09bc1e0 sys/arch/macppc/macppc/machdep.c
--- a/sys/arch/macppc/macppc/machdep.c  Sun Sep 22 01:56:08 2002 +0000
+++ b/sys/arch/macppc/macppc/machdep.c  Sun Sep 22 03:04:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.119 2002/08/13 09:46:21 manu Exp $       */
+/*     $NetBSD: machdep.c,v 1.120 2002/09/22 03:04:31 dbj Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -168,43 +168,6 @@
        }
 
        /*
-        * If the bootpath doesn't start with a / then it isn't
-        * an OFW path and probably is an alias, so look up the alias
-        * and regenerate the full bootpath so device_register will work.
-        */
-       if (bootpath[0] != '/' && bootpath[0] != '\0') {
-               int aliases = OF_finddevice("/aliases");
-               char tmpbuf[100];
-               char aliasbuf[256];
-               if (aliases != 0) {
-                       char *cp1, *cp2, *cp;
-                       char saved_ch = 0;
-                       int len;
-                       cp1 = strchr(bootpath, ':');
-                       cp2 = strchr(bootpath, ',');
-                       cp = cp1;
-                       if (cp1 == NULL || (cp2 != NULL && cp2 < cp1))
-                               cp = cp2;
-                       tmpbuf[0] = '\0';
-                       if (cp != NULL) {
-                               strcpy(tmpbuf, cp);
-                               saved_ch = *cp;
-                               *cp = '\0';
-                       }
-                       len = OF_getprop(aliases, bootpath, aliasbuf,
-                           sizeof(aliasbuf));
-                       if (len > 0) {
-                               if (aliasbuf[len-1] == '\0')
-                                       len--;
-                               memcpy(bootpath, aliasbuf, len);
-                               strcpy(&bootpath[len], tmpbuf);
-                       } else {
-                               *cp = saved_ch;
-                       }
-               }
-       }
-
-       /*
         * i386 port says, that this shouldn't be here,
         * but I really think the console should be initialized
         * as early as possible.



Home | Main Index | Thread Index | Old Index