From owner-svn-src-head@FreeBSD.ORG Mon Dec 22 22:07:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DA32734A; Mon, 22 Dec 2014 22:07:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5CE03634; Mon, 22 Dec 2014 22:07:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBMM7NSJ091058; Mon, 22 Dec 2014 22:07:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBMM7NGd091055; Mon, 22 Dec 2014 22:07:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201412222207.sBMM7NGd091055@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 22 Dec 2014 22:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276087 - in head/sys/boot: common forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2014 22:07:24 -0000 Author: ian Date: Mon Dec 22 22:07:22 2014 New Revision: 276087 URL: https://svnweb.freebsd.org/changeset/base/276087 Log: Add a new loader(8) variable, twiddle_divisor, allowing control over the output frequency of the "twiddle" IO progress indicator. The default value is 1. For larger values N, the next stage of the animation is only output on every Nth call to the output routine. A sufficiently large N effectively disables the animation completely. Modified: head/sys/boot/common/console.c head/sys/boot/common/loader.8 head/sys/boot/forth/loader.conf Modified: head/sys/boot/common/console.c ============================================================================== --- head/sys/boot/common/console.c Mon Dec 22 21:52:37 2014 (r276086) +++ head/sys/boot/common/console.c Mon Dec 22 22:07:22 2014 (r276087) @@ -39,6 +39,7 @@ static int cons_set(struct env_var *ev, static int cons_find(const char *name); static int cons_check(const char *string); static void cons_change(const char *string); +static int twiddle_set(struct env_var *ev, int flags, const void *value); /* * Detect possible console(s) to use. If preferred console(s) have been @@ -52,6 +53,9 @@ cons_probe(void) int active; char *prefconsole; + /* We want a callback to install the new value when this var changes. */ + env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, env_nounset); + /* Do all console probes */ for (cons = 0; consoles[cons] != NULL; cons++) { consoles[cons]->c_flags = 0; @@ -232,3 +236,28 @@ cons_change(const char *string) free(dup); } + +/* + * Change the twiddle divisor. + * + * The user can set the twiddle_divisor variable to directly control how fast + * the progress twiddle spins, useful for folks with slow serial consoles. The + * code to monitor changes to the variable and propagate them to the twiddle + * routines has to live somewhere. Twiddling is console-related so it's here. + */ +static int +twiddle_set(struct env_var *ev, int flags, const void *value) +{ + u_long tdiv; + char * eptr; + + tdiv = strtoul(value, &eptr, 0); + if (*(const char *)value == 0 || *eptr != 0) { + printf("invalid twiddle_divisor '%s'\n", (const char *)value); + return (CMD_ERROR); + } + twiddle_divisor((u_int)tdiv); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return(CMD_OK); +} Modified: head/sys/boot/common/loader.8 ============================================================================== --- head/sys/boot/common/loader.8 Mon Dec 22 21:52:37 2014 (r276086) +++ head/sys/boot/common/loader.8 Mon Dec 22 22:07:22 2014 (r276087) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd December 22, 2014 .Dt LOADER 8 .Os .Sh NAME @@ -670,6 +670,12 @@ Overrides the compile-time set value of .Dv TCBHASHSIZE or the preset default of 512. Must be a power of 2. +.It Va twiddle_divisor +Throttles the output of the `twiddle' I/O progress indicator displayed +while loading the kernel and modules. +This is useful on slow serial consoles where the time spent waiting for +these characters to be written can add up to many seconds. +The default is 1 (full speed); a value of 2 spins half as fast, and so on. .It Va vm.kmem_size Sets the size of kernel memory (bytes). This overrides the value determined when the kernel was compiled. Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Mon Dec 22 21:52:37 2014 (r276086) +++ head/sys/boot/forth/loader.conf Mon Dec 22 22:07:22 2014 (r276087) @@ -75,6 +75,7 @@ module_path="/boot/modules" # Set the mo # the block size is set to 512. If the value # is out of range ( < 8 || > 9008 ) an error is # returned. +#twiddle_divisor="1" # >1 means slow down the progress indicator. ##############################################################