Module Name:    src
Committed By:   kim
Date:           Wed Jul 15 12:36:30 UTC 2020

Modified Files:
        src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Let consdev command also set speed

Adapted from PR install/55490 by Sunil Nimmagadda


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/boot/boot2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.73 src/sys/arch/i386/stand/boot/boot2.c:1.74
--- src/sys/arch/i386/stand/boot/boot2.c:1.73	Sat Apr  4 19:50:54 2020
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Jul 15 12:36:30 2020
@@ -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 @@ command_help(char *arg)
 	       "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 @@ void
 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");
 }
 

Reply via email to