NetBSD Problem Report #55490

From www@netbsd.org  Tue Jul 14 11:14:19 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 992761A9213
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 14 Jul 2020 11:14:19 +0000 (UTC)
Message-Id: <20200714111418.5936B1A921E@mollari.NetBSD.org>
Date: Tue, 14 Jul 2020 11:14:18 +0000 (UTC)
From: sunil@nimmagadda.net
Reply-To: sunil@nimmagadda.net
To: gnats-bugs@NetBSD.org
Subject: bios boot: Let 'consdev' command accept speed just like efiboot 
X-Send-Pr-Version: www-1.0

>Number:         55490
>Category:       install
>Synopsis:       bios boot: Let 'consdev' command accept speed just like efiboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kim
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 14 11:15:01 +0000 2020
>Closed-Date:    Wed Aug 05 05:50:45 +0000 2020
>Last-Modified:  Wed Aug 05 05:50:45 +0000 2020
>Originator:     Sunil Nimmagadda
>Release:        NetBSD-9
>Organization:
>Environment:
NetBSD pri.nimmagadda.net 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
PC Engines apu2 bios console works at 115200 baud rate alone. During installation, unlike efiboot, there is no way to specify speed with boot(8) consdev command. As a result, after connecting to the device over serial console with 115200 baud rate using minicom/cu and selecting "com0" from boot menu using consdev command, the console speed falls back to the default 9600 baud rate requiring a disconnect and reconnect of serial cable now with 9600 baud rate.
>How-To-Repeat:
Connect to an apu2 using minicom/cu.
Plug in a bootable USB made from NetBSD-9.0-amd64-install.img.
From apu2 boot menu option select the USB device to boot.
From the NetBSD boot menu, select option 2 and type 'consdev com0' at the prompt.
The console speed is now at 9600 baud rate. Disconnect and reconnect serial console now with 9600 baud rate.

The diff attached will let consdev command accept 'com0,115200' just like efiboot.

>Fix:
diff --git a/share/man/man8/man8.x86/boot_console.8 b/share/man/man8/man8.x86/boot_console.8
--- a/share/man/man8/man8.x86/boot_console.8
+++ b/share/man/man8/man8.x86/boot_console.8
@@ -138,10 +138,3 @@
 not settable (either at compile time or run time).
 The default parameters are
 .Dq "8 N 1" .
-.Pp
-The baud rate is not settable when using BIOS I/O.
-It should be settable at compile time with
-.Dq Dv CONSPEED
-just as it is when using
-.Dq Dv DIRECT_SERIAL .
-The default speed is 9600 baud (the maximum for BIOS I/O).
diff --git a/sys/arch/i386/stand/boot/boot2.c b/sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c
+++ b/sys/arch/i386/stand/boot/boot2.c
@@ -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][,{speed}]|com[0123]kbd|auto}\n"
 	       "vesa {modenum|on|off|enabled|disabled|list}\n"
 #ifndef SMALL
 	       "menu (reenters boot menu, if defined in boot.cfg)\n"
@@ -581,14 +581,39 @@
 command_consdev(char *arg)
 {
 	const struct cons_devs *cdp;
+	char *ep, *sep;
+	uint32_t 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) {
+			switch (cdp->tag) {
+			case CONSDEV_COM0:
+			case CONSDEV_COM1:
+			case CONSDEV_COM2:
+			case CONSDEV_COM3:
+				errno = 0;
+				speed = strtoul(sep, &ep, 10);
+				if (ep == sep || *ep != '\0' || errno)
+					goto error;
+				boot_params.bp_conspeed = speed;
+				break;
+			default:
+				goto error;
+			}
 		}
+
+		initio(cdp->tag);
+		print_banner();
+		return;
 	}
+error:
 	printf("invalid console device.\n");
 }



>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: install-manager->kim
Responsible-Changed-By: kim@NetBSD.org
Responsible-Changed-When: Wed, 15 Jul 2020 07:07:23 +0000
Responsible-Changed-Why:
I can work in this


From: "Kimmo Suominen" <kim@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55490 CVS commit: src/sys/arch/i386/stand/boot
Date: Wed, 15 Jul 2020 12:36:30 +0000

 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.

State-Changed-From-To: open->feedback
State-Changed-By: kim@NetBSD.org
State-Changed-When: Wed, 15 Jul 2020 12:41:48 +0000
State-Changed-Why:
Committed code for requested functionality.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55490 CVS commit: [netbsd-9] src
Date: Wed, 15 Jul 2020 15:51:03 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Jul 15 15:51:03 UTC 2020

 Modified Files:
 	src/share/man/man8/man8.x86 [netbsd-9]: boot.8
 	src/sys/arch/i386/stand/boot [netbsd-9]: boot2.c

 Log Message:
 Pull up following revision(s) (requested by kim in ticket #1013):

 	sys/arch/i386/stand/boot/boot2.c: revision 1.74
 	share/man/man8/man8.x86/boot.8: revision 1.21

 Let consdev command also set speed
 Adapted from PR install/55490 by Sunil Nimmagadda

 Document optional speed argument to consdev


 To generate a diff of this commit:
 cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/share/man/man8/man8.x86/boot.8
 cvs rdiff -u -r1.70.8.1 -r1.70.8.2 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.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55490 CVS commit: [netbsd-8] src
Date: Wed, 15 Jul 2020 15:54:50 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Jul 15 15:54:50 UTC 2020

 Modified Files:
 	src/share/man/man8/man8.x86 [netbsd-8]: boot.8
 	src/sys/arch/i386/stand/boot [netbsd-8]: boot2.c

 Log Message:
 Pull up following revision(s) (requested by kim in ticket #1575):

 	sys/arch/i386/stand/boot/boot2.c: revision 1.74
 	share/man/man8/man8.x86/boot.8: revision 1.21

 Let consdev command also set speed
 Adapted from PR install/55490 by Sunil Nimmagadda

 Document optional speed argument to consdev


 To generate a diff of this commit:
 cvs rdiff -u -r1.11.4.4 -r1.11.4.5 src/share/man/man8/man8.x86/boot.8
 cvs rdiff -u -r1.66.10.1 -r1.66.10.2 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.

State-Changed-From-To: feedback->closed
State-Changed-By: kim@NetBSD.org
State-Changed-When: Wed, 05 Aug 2020 05:50:45 +0000
State-Changed-Why:
Feedback timeout


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.