NetBSD-Bugs archive

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

install/55490: bios boot: Let 'consdev' command accept speed just like efiboot



>Number:         55490
>Category:       install
>Synopsis:       bios boot: Let 'consdev' command accept speed just like efiboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 14 11:15:01 +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@localhost:/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");
 }
 




Home | Main Index | Thread Index | Old Index