Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand/boot Let consdev command also set speed



details:   https://anonhg.NetBSD.org/src/rev/c55447516e2d
branches:  trunk
changeset: 935997:c55447516e2d
user:      kim <kim%NetBSD.org@localhost>
date:      Wed Jul 15 12:36:30 2020 +0000

description:
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda

diffstat:

 sys/arch/i386/stand/boot/boot2.c |  30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 420f969ec9ff -r c55447516e2d sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c  Wed Jul 15 12:15:30 2020 +0000
+++ b/sys/arch/i386/stand/boot/boot2.c  Wed Jul 15 12:36:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot2.c,v 1.73 2020/04/04 19:50:54 christos Exp $      */
+/*     $NetBSD: boot2.c,v 1.74 2020/07/15 12:36:30 kim Exp $   */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -449,7 +449,7 @@
               "ls [dev:][path]\n"
 #endif
               "dev [dev:]\n"
-              "consdev {pc|com[0123]|com[0123]kbd|auto}\n"
+              "consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n"
               "vesa {modenum|on|off|enabled|disabled|list}\n"
 #ifndef SMALL
               "menu (reenters boot menu, if defined in boot.cfg)\n"
@@ -581,14 +581,32 @@
 command_consdev(char *arg)
 {
        const struct cons_devs *cdp;
+       char *sep;
+       int speed;
+
+       sep = strchr(arg, ',');
+       if (sep != NULL)
+               *sep++ = '\0';
 
        for (cdp = cons_devs; cdp->name; cdp++) {
-               if (strcmp(arg, cdp->name) == 0) {
-                       initio(cdp->tag);
-                       print_banner();
-                       return;
+               if (strcmp(arg, cdp->name) != 0)
+                       continue;
+
+               if (sep != NULL) {
+                       if (cdp->tag == CONSDEV_PC)
+                               goto error;
+
+                       speed = atoi(sep);
+                       if (speed < 0)
+                               goto error;
+                       boot_params.bp_conspeed = speed;
                }
+
+               initio(cdp->tag);
+               print_banner();
+               return;
        }
+error:
        printf("invalid console device.\n");
 }
 



Home | Main Index | Thread Index | Old Index