Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k/stand/boot Fix stupid botches in previous.



details:   https://anonhg.NetBSD.org/src/rev/2bb07ad4fff2
branches:  trunk
changeset: 328852:2bb07ad4fff2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Apr 21 11:06:55 2014 +0000

description:
Fix stupid botches in previous.

Use a proper device unit number if a unit number or non-default device
is specified on the boot command.

diffstat:

 sys/arch/luna68k/stand/boot/devopen.c   |  12 +++++++++---
 sys/arch/luna68k/stand/boot/init_main.c |   4 +++-
 sys/arch/luna68k/stand/boot/samachdep.h |   3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diffs (87 lines):

diff -r 0994a977d489 -r 2bb07ad4fff2 sys/arch/luna68k/stand/boot/devopen.c
--- a/sys/arch/luna68k/stand/boot/devopen.c     Mon Apr 21 10:53:47 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/devopen.c     Mon Apr 21 11:06:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devopen.c,v 1.7 2014/04/16 13:43:02 tsutsui Exp $      */
+/*     $NetBSD: devopen.c,v 1.8 2014/04/21 11:06:55 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -126,8 +126,9 @@
        int dev, unit, part;
        int i;
        char devname[MAXDEVNAME + 1];
+       bool haveunit;
 
-       unit = default_unit;
+       unit = 0;
        part = 0;
 
        /*
@@ -150,11 +151,14 @@
        }
        dev = dp - devsw;
        /* get mixed controller and unit number */
+       haveunit = false;
        for (; *cp != ',' && *cp != ')'; cp++) {
                if (*cp == '\0')
                        return -1;
-               if (*cp >= '0' && *cp <= '9')
+               if (*cp >= '0' && *cp <= '9') {
                        unit = unit * 10 + *cp - '0';
+                       haveunit = true;
+               }
        }
        if (unit < 0 || CTLR(unit) >= 2 || TARGET(unit) > 7) {
 #ifdef DEBUG
@@ -162,6 +166,8 @@
 #endif
                return (-1);
        }
+       if (!haveunit && strcmp(devname, default_bootdev) == 0)
+               unit = default_unit;
        /* get optional partition number */
        if (*cp == ',')
                cp++;
diff -r 0994a977d489 -r 2bb07ad4fff2 sys/arch/luna68k/stand/boot/init_main.c
--- a/sys/arch/luna68k/stand/boot/init_main.c   Mon Apr 21 10:53:47 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/init_main.c   Mon Apr 21 11:06:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.14 2014/04/16 13:43:02 tsutsui Exp $   */
+/*     $NetBSD: init_main.c,v 1.15 2014/04/21 11:06:55 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -88,6 +88,7 @@
 int hz = 60;
 int machtype;
 char default_file[64];
+const char *default_bootdev;
 int default_unit;
 
 #define        VERS_LOCAL      "Phase-31"
@@ -287,6 +288,7 @@
 
        snprintf(default_file, sizeof(default_file),
            "%s(%d,%d)%s", bootdev, unit, part, "netbsd");
+       default_bootdev = bootdev;
        default_unit = unit;
 
        howto = reorder_dipsw(dipsw2);
diff -r 0994a977d489 -r 2bb07ad4fff2 sys/arch/luna68k/stand/boot/samachdep.h
--- a/sys/arch/luna68k/stand/boot/samachdep.h   Mon Apr 21 10:53:47 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/samachdep.h   Mon Apr 21 11:06:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: samachdep.h,v 1.18 2014/04/16 13:43:02 tsutsui Exp $   */
+/*     $NetBSD: samachdep.h,v 1.19 2014/04/21 11:06:55 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -103,6 +103,7 @@
 extern int nplane;
 extern int machtype;
 extern char default_file[];
+extern const char *default_bootdev;
 extern int default_unit;
 
 /* kbd.c */



Home | Main Index | Thread Index | Old Index